* use eUsrAxlvl all over the place
authorWilfried Göesgens <willi@citadel.org>
Fri, 26 Feb 2010 18:11:39 +0000 (18:11 +0000)
committerWilfried Göesgens <willi@citadel.org>
Fri, 26 Feb 2010 18:11:39 +0000 (18:11 +0000)
16 files changed:
citadel/citserver.c
citadel/context.c
citadel/file_ops.c
citadel/modules/chat/serv_chat.c
citadel/modules/rwho/serv_rwho.c
citadel/modules/vcard/serv_vcard.c
citadel/modules/xmpp/xmpp_presence.c
citadel/modules/xmpp/xmpp_query_namespace.c
citadel/msgbase.c
citadel/policy.c
citadel/room_ops.c
citadel/textclient/citadel.c
citadel/textclient/messages.c
citadel/textclient/routines.c
citadel/user_ops.c
citadel/utillib/citadel_ipc.c

index 054bf50687b3e14fc9ad213bb6cb3c273f943a8d..f371d6bf5c3ad193dee6d571c09d0a0f99f5f204 100644 (file)
@@ -680,7 +680,7 @@ int CtdlAccessCheck(int required_level) {
                return(-1);
        }
 
-       if (CC->user.axlevel >= 6) return(0);
+       if (CC->user.axlevel >= AxAideU) return(0);
        if (required_level >= ac_aide) {
                cprintf("%d This command requires Aide access.\n",
                        ERROR + HIGHER_ACCESS_REQUIRED);
index ffe87a09a966ae668b200cd8cb9c4c75d2f8d316..90516d7d8f2179bf624a6d0fe54a43715eeeba9a 100644 (file)
@@ -164,7 +164,7 @@ int CtdlTerminateOtherSession (int session_num)
                if (session_num == ccptr->cs_pid) {
                        ret |= TERM_FOUND;
                        if ((ccptr->user.usernum == CC->user.usernum)
-                          || (CC->user.axlevel >= 6)) {
+                          || (CC->user.axlevel >= AxAideU)) {
                                ret |= TERM_ALLOWED;
                                ccptr->kill_me = 1;
                        }
index 6f0669093bc08d705aad4ad141101f18b341ad85..96e00a0fd00d7cb44a2207b7722a9dfdad3c1fe1 100644 (file)
@@ -470,7 +470,7 @@ void cmd_uimg(char *cmdbuf)
                }
        }
 
-       if (CC->user.axlevel >= 6) {
+       if (CC->user.axlevel >= AxAideU) {
                snprintf(CC->upl_path, sizeof CC->upl_path, 
                                 "%s/%s",
                                 ctdl_image_dir,
@@ -485,7 +485,7 @@ void cmd_uimg(char *cmdbuf)
        }
 
        if ((!strcasecmp(basenm, "_floorpic_"))
-           && (CC->user.axlevel >= 6)) {
+           && (CC->user.axlevel >= AxAideU)) {
                which_floor = extract_int(cmdbuf, 2);
                snprintf(CC->upl_path, sizeof CC->upl_path,
                                 "%s/floor.%d.gif",
index 028f2833b821716f529323d3c2f53e5d51225ddc..32e2f629ba92bbdbc82118b9e94da35a2f8138df 100644 (file)
@@ -294,7 +294,7 @@ void do_chat_listing(int allflag)
                }
 
                GenerateRoomDisplay(roomname, ccptr, CC);
-               if ((CC->user.axlevel < 6) && (!IsEmptyStr(ccptr->fake_roomname))) {
+               if ((CC->user.axlevel < AxAideU) && (!IsEmptyStr(ccptr->fake_roomname))) {
                        strcpy(roomname, ccptr->fake_roomname);
                }
 
@@ -312,7 +312,7 @@ void do_chat_listing(int allflag)
                for (ccptr = ContextList; ccptr != NULL; ccptr = ccptr->next) {
 
                        GenerateRoomDisplay(roomname, ccptr, CC);
-                       if ((CC->user.axlevel < 6)
+                       if ((CC->user.axlevel < AxAideU)
                        && (!IsEmptyStr(ccptr->fake_roomname))) {
                                strcpy(roomname, ccptr->fake_roomname);
                        }
@@ -692,7 +692,7 @@ int send_instant_message(char *lun, char *lem, char *x_user, char *x_msg)
                    || (!strcasecmp(x_user, "broadcast")))
                    && (ccptr->can_receive_im)
                    && ((ccptr->disable_exp == 0)
-                   || (CC->user.axlevel >= 6)) ) {
+                   || (CC->user.axlevel >= AxAideU)) ) {
                        if (do_send) {
                                newmsg = (struct ExpressMessage *) malloc(sizeof (struct ExpressMessage));
                                memset(newmsg, 0, sizeof (struct ExpressMessage));
@@ -748,7 +748,7 @@ void cmd_sexp(char *argbuf)
                cprintf("%d You were not previously paged.\n", ERROR + NO_SUCH_USER);
                return;
        }
-       if ((!strcasecmp(x_user, "broadcast")) && (CC->user.axlevel < 6)) {
+       if ((!strcasecmp(x_user, "broadcast")) && (CC->user.axlevel < AxAideU)) {
                cprintf("%d Higher access required to send a broadcast.\n",
                        ERROR + HIGHER_ACCESS_REQUIRED);
                return;
index 9a1944061a9a7d806a8350822f55e1e4d3605b03..6c2c9dc736d895fb5caa44ae2dfa74eb613ac56a 100644 (file)
@@ -90,7 +90,7 @@ void cmd_rwho(char *argbuf) {
                return;
        }
        
-       aide = CC->user.axlevel >= 6;
+       aide = CC->user.axlevel >= AxAideU;
        cprintf("%d%c \n", LISTING_FOLLOWS, CtdlCheckExpress() );
        
        for (i=0; i<nContexts; i++) 
index ff5c2ab4726a627fad3e81e400a7373f11d439a5..5133fce5449bb7d6382b0bd1b55f69ad496ca57e 100644 (file)
@@ -324,7 +324,7 @@ int vcard_upload_beforesave(struct CtdlMessage *msg) {
 
 #ifdef VCARD_SAVES_BY_AIDES_ONLY
                /* Prevent non-aides from performing registration changes */
-               if (CC->user.axlevel < 6) {
+               if (CC->user.axlevel < AxAideU) {
                        return(1);
                }
 #endif
@@ -360,7 +360,7 @@ int vcard_upload_beforesave(struct CtdlMessage *msg) {
        if (v == NULL) return(0);       /* no vCards were found in this message */
 
        /* If users cannot create their own accounts, they cannot re-register either. */
-       if ( (yes_my_citadel_config) && (config.c_disable_newu) && (CC->user.axlevel < 6) ) {
+       if ( (yes_my_citadel_config) && (config.c_disable_newu) && (CC->user.axlevel < AxAideU) ) {
                return(1);
        }
 
@@ -552,7 +552,7 @@ int vcard_upload_aftersave(struct CtdlMessage *msg) {
                         * But if the user was an Aide or was edited by an Aide then we can
                         * Assume they don't need validating.
                         */
-                       if (CC->user.axlevel >= 6) {
+                       if (CC->user.axlevel >= AxAideU) {
                                CtdlGetUserLock(&CC->user, CC->curr_user);
                                CC->user.flags |= US_REGIS;
                                CtdlPutUserLock(&CC->user);
@@ -685,7 +685,7 @@ void cmd_regi(char *argbuf) {
        }
 
        /* If users cannot create their own accounts, they cannot re-register either. */
-       if ( (config.c_disable_newu) && (CC->user.axlevel < 6) ) {
+       if ( (config.c_disable_newu) && (CC->user.axlevel < AxAideU) ) {
                cprintf("%d Self-service registration is not allowed here.\n",
                        ERROR + HIGHER_ACCESS_REQUIRED);
        }
@@ -748,7 +748,7 @@ void cmd_greg(char *argbuf)
 
        if (!strcasecmp(who,"_SELF_")) strcpy(who,CC->curr_user);
 
-       if ((CC->user.axlevel < 6) && (strcasecmp(who,CC->curr_user))) {
+       if ((CC->user.axlevel < AxAideU) && (strcasecmp(who,CC->curr_user))) {
                cprintf("%d Higher access required.\n",
                        ERROR + HIGHER_ACCESS_REQUIRED);
                return;
index 141b2d3fdc65c5c3c048a6c9e962a7e10f1c82c0..915f1d319ab624cfda906ca371c8c609a7a7c02c 100644 (file)
@@ -81,7 +81,7 @@ void xmpp_wholist_presence_dump(void)
        struct CitContext *cptr = NULL;
        int nContexts, i;
        
-       int aide = (CC->user.axlevel >= 6);
+       int aide = (CC->user.axlevel >= AxAideU);
 
        cptr = CtdlGetContextArray(&nContexts);
        if (!cptr) {
@@ -143,7 +143,7 @@ void xmpp_presence_notify(char *presence_jid, int event_type) {
        static int unsolicited_id;
        int visible_sessions = 0;
        int nContexts, i;
-       int aide = (CC->user.axlevel >= 6);
+       int aide = (CC->user.axlevel >= AxAideU);
 
        if (IsEmptyStr(presence_jid)) return;
        if (CC->kill_me) return;
@@ -209,7 +209,7 @@ void xmpp_massacre_roster(void)
 {
        struct CitContext *cptr;
        int nContexts, i;
-       int aide = (CC->user.axlevel >= 6);
+       int aide = (CC->user.axlevel >= AxAideU);
 
        cptr = CtdlGetContextArray(&nContexts);
        if (cptr) {
index 42875074ee7c882766ffe7db4f80eee9ba7da640..a94e6d6d1add77bdaa24f54a48a340761d39f274 100644 (file)
@@ -81,7 +81,7 @@ void xmpp_iq_roster_query(void)
 {
        struct CitContext *cptr;
        int nContexts, i;
-       int aide = (CC->user.axlevel >= 6);
+       int aide = (CC->user.axlevel >= AxAideU);
 
        cprintf("<query xmlns=\"jabber:iq:roster\">");
 
index 87641e3eef8a96e690bc72cd7982525b6f652b1c..df4d224d03b209908ee244c2ecef04f4f75b3f5a 100644 (file)
@@ -2875,7 +2875,7 @@ long CtdlSubmitMsg(struct CtdlMessage *msg,       /* message to save */
 
        /* If the user is a twit, move to the twit room for posting */
        if (TWITDETECT) {
-               if (CCC->user.axlevel == 2) {
+               if (CCC->user.axlevel == AxProbU) {
                        strcpy(hold_rm, actual_rm);
                        strcpy(actual_rm, config.c_twitroom);
                        CtdlLogPrintf(CTDL_DEBUG, "Diverting to twit room\n");
@@ -3546,7 +3546,7 @@ int CtdlDoIHavePermissionToPostInThisRoom(char *errmsgbuf,
 
        }
 
-       if ((CC->user.axlevel < 2)
+       if ((CC->user.axlevel < AxProbU)
            && ((CC->room.QRflags & QR_MAILBOX) == 0)) {
                snprintf(errmsgbuf, n, "Need to be validated to enter "
                                "(except in %s> to sysop)", MAILROOM);
@@ -3571,7 +3571,7 @@ int CtdlDoIHavePermissionToPostInThisRoom(char *errmsgbuf,
 int CtdlCheckInternetMailPermission(struct ctdluser *who) {
 
        /* Do not allow twits to send Internet mail */
-       if (who->axlevel <= 2) return(0);
+       if (who->axlevel <= AxProbU) return(0);
 
        /* Globally enabled? */
        if (config.c_restrict == 0) return(1);
@@ -3580,7 +3580,7 @@ int CtdlCheckInternetMailPermission(struct ctdluser *who) {
        if (who->flags & US_INTERNET) return(2);
 
        /* Aide level access? */
-       if (who->axlevel >= 6) return(3);
+       if (who->axlevel >= AxAideU) return(3);
 
        /* No mail for you! */
        return(0);
@@ -3932,7 +3932,7 @@ void cmd_ent0(char *entargs)
        if (IsEmptyStr(newusername)) {
                strcpy(newusername, CC->user.fullname);
        }
-       if (  (CC->user.axlevel < 6)
+       if (  (CC->user.axlevel < AxAideU)
           && (strcasecmp(newusername, CC->user.fullname))
           && (strcasecmp(newusername, CC->cs_inet_fn))
        ) {     
@@ -3982,7 +3982,7 @@ void cmd_ent0(char *entargs)
        if (  ( (CC->room.QRflags & QR_MAILBOX) && (!strcasecmp(&CC->room.QRname[11], MAILROOM)) )
           || ( (CC->room.QRflags & QR_MAILBOX) && (CC->curr_view == VIEW_MAILBOX) )
        ) {
-               if (CC->user.axlevel < 2) {
+               if (CC->user.axlevel < AxProbU) {
                        strcpy(recp, "sysop");
                        strcpy(cc, "");
                        strcpy(bcc, "");
@@ -4034,7 +4034,7 @@ void cmd_ent0(char *entargs)
                }
 
                if ( ( (valid_to->num_internet + valid_to->num_ignet + valid_cc->num_internet + valid_cc->num_ignet + valid_bcc->num_internet + valid_bcc->num_ignet) > 0)
-                  && (CC->user.axlevel < 4) ) {
+                  && (CC->user.axlevel < AxNetU) ) {
                        cprintf("%d Higher access required for network mail.\n",
                                ERROR + HIGHER_ACCESS_REQUIRED);
                        free_recipients(valid_to);
@@ -4393,7 +4393,7 @@ void cmd_move(char *args)
        permit = 0;
 
        /* Aides can move/copy */
-       if (CC->user.axlevel >= 6) permit = 1;
+       if (CC->user.axlevel >= AxAideU) permit = 1;
 
        /* Room aides can move/copy */
        if (CC->user.usernum == CC->room.QRroomaide) permit = 1;
index acfb916442e3880bec85fbeda49178751a5b6d12..52d3c697d894af4979a05bcac46b3bab6d4b9425 100644 (file)
@@ -138,7 +138,7 @@ void cmd_spex(char *argbuf) {
                return;
        }
 
-       if (CC->user.axlevel < 6) {
+       if (CC->user.axlevel < AxAideU) {
                cprintf("%d Higher access required.\n",
                        ERROR + HIGHER_ACCESS_REQUIRED);
                return;
index 5904b41eb871220e3958f34c9b78468b3e8a0f5f..baf2b4bf64ad53fa263a91df2ed8870a0bcebeb4 100644 (file)
@@ -67,7 +67,7 @@ void CtdlRoomAccess(struct ctdlroom *roombuf, struct ctdluser *userbuf,
 
        /* Force the properties of the Aide room */
        if (!strcasecmp(roombuf->QRname, config.c_aideroom)) {
-               if (userbuf->axlevel >= 6) {
+               if (userbuf->axlevel >= AxAideU) {
                        retval = UA_KNOWN | UA_GOTOALLOWED | UA_POSTALLOWED | UA_DELETEALLOWED;
                } else {
                        retval = 0;
@@ -83,7 +83,7 @@ void CtdlRoomAccess(struct ctdlroom *roombuf, struct ctdluser *userbuf,
 
        /* If this is a preferred users only room, check access level */
        if (roombuf->QRflags & QR_PREFONLY) {
-               if (userbuf->axlevel < 5) {
+               if (userbuf->axlevel < AxPrefU) {
                        retval = retval & ~UA_KNOWN & ~UA_GOTOALLOWED;
                }
        }
@@ -127,8 +127,8 @@ void CtdlRoomAccess(struct ctdlroom *roombuf, struct ctdluser *userbuf,
                 * - It is a read-only room
                 */
                int post_allowed = 1;
-               if (CC->user.axlevel < 2) post_allowed = 0;
-               if ((CC->user.axlevel < 4) && (CC->room.QRflags & QR_NETWORK)) post_allowed = 0;
+               if (CC->user.axlevel < AxProbU) post_allowed = 0;
+               if ((CC->user.axlevel < AxNetU) && (CC->room.QRflags & QR_NETWORK)) post_allowed = 0;
                if (roombuf->QRflags & QR_READONLY) post_allowed = 0;
                if (post_allowed) {
                        retval = retval | UA_POSTALLOWED;
@@ -161,7 +161,7 @@ void CtdlRoomAccess(struct ctdlroom *roombuf, struct ctdluser *userbuf,
        }
 
        /* Aides get access to all private rooms */
-       if ( (userbuf->axlevel >= 6)
+       if ( (userbuf->axlevel >= AxAideU)
           && ((roombuf->QRflags & QR_MAILBOX) == 0) ) {
                if (vbuf.v_flags & V_FORGET) {
                        retval = retval | UA_GOTOALLOWED | UA_POSTALLOWED;
@@ -174,13 +174,13 @@ void CtdlRoomAccess(struct ctdlroom *roombuf, struct ctdluser *userbuf,
        /* Aides can gain access to mailboxes as well, but they don't show
         * by default.
         */
-       if ( (userbuf->axlevel >= 6)
+       if ( (userbuf->axlevel >= AxAideU)
           && (roombuf->QRflags & QR_MAILBOX) ) {
                retval = retval | UA_GOTOALLOWED | UA_POSTALLOWED;
        }
 
        /* Aides and Room Aides have admin privileges */
-       if ( (userbuf->axlevel >= 6)
+       if ( (userbuf->axlevel >= AxAideU)
           || (userbuf->usernum == roombuf->QRroomaide)
           ) {
                retval = retval | UA_ADMINALLOWED | UA_DELETEALLOWED | UA_POSTALLOWED;
@@ -984,7 +984,7 @@ void CtdlUserGoto(char *where, int display_result, int transiently,
                rmailflag = 0;
 
        if ((CC->room.QRroomaide == CC->user.usernum)
-           || (CC->user.axlevel >= 6))
+           || (CC->user.axlevel >= AxAideU))
                raideflag = 1;
        else
                raideflag = 0;
@@ -1133,7 +1133,7 @@ void cmd_goto(char *gargs)
                        } else if ((QRscratch.QRflags & QR_PASSWORDED) &&
                            ((ra & UA_KNOWN) == 0) &&
                            (strcasecmp(QRscratch.QRpasswd, password)) &&
-                           (CC->user.axlevel < 6)
+                           (CC->user.axlevel < AxAideU)
                            ) {
                                cprintf("%d wrong or missing passwd\n",
                                        ERROR + PASSWORD_REQUIRED);
@@ -1142,7 +1142,7 @@ void cmd_goto(char *gargs)
                                   ((QRscratch.QRflags & QR_PASSWORDED) == 0) &&
                                   ((QRscratch.QRflags & QR_GUESSNAME) == 0) &&
                                   ((ra & UA_KNOWN) == 0) &&
-                                  (CC->user.axlevel < 6)
+                                  (CC->user.axlevel < AxAideU)
                                   ) {
                                CtdlLogPrintf(CTDL_DEBUG, "Failed to acquire private room\n");
                        } else {
@@ -1207,7 +1207,7 @@ void cmd_rdir(char *cmdbuf)
                return;
        }
        if (((CC->room.QRflags & QR_VISDIR) == 0)
-           && (CC->user.axlevel < 6)
+           && (CC->user.axlevel < AxAideU)
            && (CC->user.usernum != CC->room.QRroomaide)) {
                cprintf("%d not here.\n", ERROR + HIGHER_ACCESS_REQUIRED);
                return;
@@ -1344,7 +1344,7 @@ int CtdlRenameRoom(char *old_name, char *new_name, int new_floor) {
                ret = crr_room_not_found;
        }
 
-       else if ( (CC->user.axlevel < 6) && (!CC->internal_pgm)
+       else if ( (CC->user.axlevel < AxAideU) && (!CC->internal_pgm)
                  && (CC->user.usernum != qrbuf.QRroomaide)
                  && ( (((qrbuf.QRflags & QR_MAILBOX) == 0) || (atol(qrbuf.QRname) != CC->user.usernum))) )  {
                ret = crr_access_denied;
@@ -1985,7 +1985,7 @@ void cmd_cre8(char *args)
        }
 
        if (new_room_type == 5) {
-               if (CC->user.axlevel < 6) {
+               if (CC->user.axlevel < AxAideU) {
                        cprintf("%d Higher access required\n", 
                                ERROR + HIGHER_ACCESS_REQUIRED);
                        return;
index a50b8a85f96ec7f47428e7999aa60b2ff00b5340..b1abf294794d19638ebf0b99088580df4b5a808d 100644 (file)
@@ -73,8 +73,8 @@
 
 #define IFEXPERT if (userflags&US_EXPERT)
 #define IFNEXPERT if ((userflags&US_EXPERT)==0)
-#define IFAIDE if (axlevel>=6)
-#define IFNAIDE if (axlevel<6)
+#define IFAIDE if (axlevel>=AxAideU)
+#define IFNAIDE if (axlevel<AxAideU)
 
 int rordercmp(struct ctdlroomlisting *r1, struct ctdlroomlisting *r2);
 
@@ -98,7 +98,7 @@ char *uglist[UGLISTLEN]; /* size of the ungoto list */
 long uglistlsn[UGLISTLEN]; /* current read position for all the ungoto's. Not going to make any friends with this one. */
 int uglistsize = 0;
 char is_mail = 0;              /* nonzero when we're in a mail room */
-char axlevel = 0;              /* access level */
+char axlevel = AxDeleted;              /* access level */
 char is_room_aide = 0;         /* boolean flag, 1 if room aide */
 int timescalled;
 int posted;
@@ -1776,7 +1776,7 @@ NEWUSR:   if (IsEmptyStr(rc_password)) {
                                rv = system(rc_gotmail_cmd);
                        }
                }
-               if ((axlevel >= 6) && (chek.needvalid > 0)) {
+               if ((axlevel >= AxAideU) && (chek.needvalid > 0)) {
                        scr_printf("*** Users need validation\n");
                }
                if (chek.needregis > 0) {
index 0434cd36d9f0918820753fec617b1d1973fe8435..20ab408a060e8842f1e12e4405abb500fafa2ee1 100644 (file)
@@ -1147,7 +1147,7 @@ int entmsg(CtdlIPC *ipc,
        /* Handle the selection of a recipient, if necessary. */
        strcpy(buf, "");
        if (need_recp == 1) {
-               if (axlevel >= 2) {
+               if (axlevel >= AxProbU) {
                        if (is_reply) {
                                strcpy(buf, reply_to);
                        } else {
index c8e85a7f7d94ecce215e3c6101b3b8a961156c03..2cf1acf0ba6b430b043b7ceff60c07d30cd7a98a 100644 (file)
@@ -57,8 +57,8 @@ struct utmp *getutline(struct utmp *ut);
 #include "citadel_decls.h"
 #include "routines2.h"
 
-#define IFAIDE if(axlevel>=6)
-#define IFNAIDE if (axlevel<6)
+#define IFAIDE if(axlevel>=AxAideU)
+#define IFNAIDE if (axlevel<AxAideU)
 
 extern unsigned userflags;
 //extern char *axdefs[8];
@@ -186,7 +186,7 @@ void edituser(CtdlIPC *ipc, int cmd)
                        free(user);
                        return;
                }
-               user->axlevel = 0;
+               user->axlevel = AxDeleted;
        }
 
        r = CtdlIPCAideSetUserParameters(ipc, user, buf);
index ee9e2ed1ebad2bce760fbe4d53175c40fa75cd89..f95c3bab5c4d9380f0dc0bc4858a0dc8cbaa0b57 100644 (file)
@@ -378,7 +378,7 @@ void MailboxName(char *buf, size_t n, const struct ctdluser *who, const char *pr
  */
 int is_aide(void)
 {
-       if (CC->user.axlevel >= 6)
+       if (CC->user.axlevel >= AxAideU)
                return (1);
        else
                return (0);
@@ -395,7 +395,7 @@ int is_room_aide(void)
                return (0);
        }
 
-       if ((CC->user.axlevel >= 6)
+       if ((CC->user.axlevel >= AxAideU)
            || (CC->room.QRroomaide == CC->user.usernum)) {
                return (1);
        } else {
@@ -650,7 +650,7 @@ int CtdlLoginExistingUser(char *authname, const char *trythisname)
 
        /* Did we find something? */
        if (found_user == 0) {
-               if (((CC->nologin)) && (CC->user.axlevel < 6)) {
+               if (((CC->nologin)) && (CC->user.axlevel < AxAideU)) {
                        return login_too_many_users;
                } else {
                        safestrncpy(CC->curr_user, CC->user.fullname,
@@ -720,7 +720,7 @@ void do_login(void)
         * (as specified in setup), automatically assign access level 6.
         */
        if (!strcasecmp(CC->user.fullname, config.c_sysadm)) {
-               CC->user.axlevel = 6;
+               CC->user.axlevel = AxAideU;
        }
 
        /* If we're authenticating off the host system, automatically give
@@ -728,7 +728,7 @@ void do_login(void)
         */
        if (config.c_auth_mode == AUTHMODE_HOST) {
                if (CC->user.uid == 0) {
-                       CC->user.axlevel = 6;
+                       CC->user.axlevel = AxAideU;
                }
        }
 
@@ -819,7 +819,7 @@ void CtdlUserLogout(void)
        CCC->logged_in = 0;
 
        /* Check to see if the user was deleted whilst logged in and purge them if necessary */
-       if ((CCC->user.axlevel == 0) && (CCC->user.usernum))
+       if ((CCC->user.axlevel == AxDeleted) && (CCC->user.usernum))
                purge_user(CCC->user.fullname);
 
        /* Free any output buffers */
@@ -1045,7 +1045,7 @@ int purge_user(char pname[])
         */
        if (CtdlIsUserLoggedInByNum(usbuf.usernum)) {
                CtdlLogPrintf(CTDL_WARNING, "User <%s> is logged in; not deleting.\n", pname);
-               usbuf.axlevel = 0;
+               usbuf.axlevel = AxDeleted;
                CtdlPutUser(&usbuf);
                return (1);
        }
@@ -1669,7 +1669,7 @@ void cmd_gnur(char *argbuf)
                        sizeof(struct ctdluser) : cdbus->len));
                cdb_free(cdbus);
                if ((usbuf.flags & US_NEEDVALID)
-                   && (usbuf.axlevel > 0)) {
+                   && (usbuf.axlevel > AxDeleted)) {
                        cprintf("%d %s\n", MORE_DATA, usbuf.fullname);
                        cdb_close_cursor(CDB_USERS);
                        return;
@@ -1703,7 +1703,9 @@ void cmd_vali(char *v_args)
        extract_token(user, v_args, 0, '|', sizeof user);
        newax = extract_int(v_args, 1);
 
-       if (CtdlAccessCheck(ac_aide)) {
+       if (CtdlAccessCheck(ac_aide) || 
+           (newax > AxAideU) ||
+           (newax < AxDeleted)) {
                return;
        }
 
@@ -1763,8 +1765,8 @@ void ListThisUser(struct ctdluser *usbuf, void *data)
                return;
        }
 
-       if (usbuf->axlevel > 0) {
-               if ((CC->user.axlevel >= 6)
+       if (usbuf->axlevel > AxDeleted) {
+               if ((CC->user.axlevel >= AxAideU)
                    || ((usbuf->flags & US_UNLISTED) == 0)
                    || ((CC->internal_pgm))) {
                        cprintf("%s|%d|%ld|%ld|%ld|%ld||\n",
@@ -1811,7 +1813,7 @@ void cmd_chek(char *argbuf)
        if ((REGISCALL != 0) && ((CC->user.flags & US_REGIS) == 0))
                regis = 1;
 
-       if (CC->user.axlevel >= 6) {
+       if (CC->user.axlevel >= AxAideU) {
                get_control();
                if (CitControl.MMflags & MM_VALID)
                        vali = 1;
@@ -1902,8 +1904,8 @@ void cmd_asup(char *cmdbuf)
                usbuf.posted = extract_int(cmdbuf, 4);
        if (np > 5) {
                newax = extract_int(cmdbuf, 5);
-               if ((newax >= 0) && (newax <= 6)) {
-                       usbuf.axlevel = extract_int(cmdbuf, 5);
+               if ((newax >= AxDeleted) && (newax <= AxAideU)) {
+                       usbuf.axlevel = newax;
                }
        }
        if (np > 7) {
@@ -1913,7 +1915,7 @@ void cmd_asup(char *cmdbuf)
                usbuf.USuserpurge = extract_int(cmdbuf, 8);
        }
        CtdlPutUserLock(&usbuf);
-       if (usbuf.axlevel == 0) {
+       if (usbuf.axlevel == AxDeleted) {
                if (purge_user(requested_user) == 0) {
                        deleted = 1;
                }
index dddda672ece06f69c107f347962e28a6f8f0cc19..67f6d6991543ac70cb01fc17db244fd0c6d494d9 100644 (file)
@@ -1108,7 +1108,7 @@ int CtdlIPCValidateUser(CtdlIPC *ipc, const char *username, int axlevel, char *c
 
        if (!cret) return -2;
        if (!username) return -2;
-       if (axlevel < 0 || axlevel > 7) return -2;
+       if (axlevel < AxDeleted || axlevel > AxAideU) return -2;
 
        aaa = (char *)malloc(strlen(username) + 17);
        if (!aaa) return -1;