From: Art Cancro Date: Sat, 9 Mar 2002 05:02:20 +0000 (+0000) Subject: * Attempts to fix the access control crap X-Git-Tag: v7.86~6507 X-Git-Url: https://code.citadel.org/?a=commitdiff_plain;h=23a0174b21aa4cffa935a339c1130fd2200d8309;p=citadel.git * Attempts to fix the access control crap --- diff --git a/citadel/ChangeLog b/citadel/ChangeLog index d9c7ca010..a04a1fd36 100644 --- a/citadel/ChangeLog +++ b/citadel/ChangeLog @@ -1,4 +1,7 @@ $Log$ + Revision 590.130 2002/03/09 05:02:20 ajc + * Attempts to fix the access control crap + Revision 590.129 2002/03/08 05:42:02 ajc * Patch to allow invitations and admin access to mailbox rooms. NEEDS TESTING! @@ -3399,3 +3402,4 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant Fri Jul 10 1998 Art Cancro * Initial CVS import + diff --git a/citadel/room_ops.c b/citadel/room_ops.c index 56b040c7f..d3042d975 100644 --- a/citadel/room_ops.c +++ b/citadel/room_ops.c @@ -53,6 +53,8 @@ int CtdlRoomAccess(struct quickroom *roombuf, struct usersupp *userbuf) int retval = 0; struct visit vbuf; + lprintf(9, "CtdlRoomAccess( %s , %s )\n", + roombuf->QRname, userbuf->fullname); /* for internal programs, always do everything */ if (((CC->internal_pgm)) && (roombuf->QRflags & QR_INUSE)) { @@ -75,12 +77,14 @@ int CtdlRoomAccess(struct quickroom *roombuf, struct usersupp *userbuf) /* If this is a public room, it's accessible... */ if ( ((roombuf->QRflags & QR_PRIVATE) == 0) && ((roombuf->QRflags & QR_MAILBOX) == 0) ) { + lprintf(9, " -- public room, known/allowed\n"); retval = retval | UA_KNOWN | UA_GOTOALLOWED; } /* If this is a preferred users only room, check access level */ if (roombuf->QRflags & QR_PREFONLY) { if (userbuf->axlevel < 5) { + lprintf(9, " -- not a preferred user!\n"); retval = retval & ~UA_KNOWN & ~UA_GOTOALLOWED; } } @@ -88,9 +92,11 @@ int CtdlRoomAccess(struct quickroom *roombuf, struct usersupp *userbuf) /* For private rooms, check the generation number matchups */ if ( (roombuf->QRflags & QR_PRIVATE) && ((roombuf->QRflags & QR_MAILBOX) == 0) ) { + lprintf(9, " -- checking private room access\n"); /* An explicit match means the user belongs in this room */ if (vbuf.v_flags & V_ACCESS) { + lprintf(9, " -- explicit match! known/allowed\n"); retval = retval | UA_KNOWN | UA_GOTOALLOWED; } /* Otherwise, check if this is a guess-name or passworded @@ -98,6 +104,7 @@ int CtdlRoomAccess(struct quickroom *roombuf, struct usersupp *userbuf) */ else if ((roombuf->QRflags & QR_PRIVATE) || (roombuf->QRflags & QR_PASSWORDED)) { + lprintf(9, " -- guessable.\n"); retval = retval & ~UA_KNOWN; retval = retval | UA_GOTOALLOWED; } @@ -105,33 +112,42 @@ int CtdlRoomAccess(struct quickroom *roombuf, struct usersupp *userbuf) /* For mailbox rooms, also check the generation number matchups */ if (roombuf->QRflags & QR_MAILBOX) { + lprintf(9, " -- checking mailbox room access\n"); if (userbuf->usernum == atol(roombuf->QRname)) { + lprintf(9, " -- owner! known/allowed\n"); retval = retval | UA_KNOWN | UA_GOTOALLOWED; } /* An explicit match means the user belongs in this room */ if (vbuf.v_flags & V_ACCESS) { + lprintf(9, " -- explicit match! known/allowed\n"); retval = retval | UA_KNOWN | UA_GOTOALLOWED; } } /* Check to see if the user has forgotten this room */ if (vbuf.v_flags & V_FORGET) { + lprintf(9, " -- forgotten room!\n"); retval = retval & ~UA_KNOWN; retval = retval | UA_ZAPPED; } /* If user is explicitly locked out of this room, deny everything */ if (vbuf.v_flags & V_LOCKOUT) { + lprintf(9, " -- explicit lockout!\n"); retval = retval & ~UA_KNOWN & ~UA_GOTOALLOWED; } /* Aides get access to everything */ if (userbuf->axlevel >= 6) { + lprintf(9, " -- user is an Aide\n"); if (vbuf.v_flags & V_FORGET) { + lprintf(9, " -- forgotten room\n"); retval = retval | UA_GOTOALLOWED; } else { + lprintf(9, " -- goto allowed\n"); retval = retval | UA_GOTOALLOWED; if ((roombuf->QRflags & QR_MAILBOX) == 0) { + lprintf(9, " -- not mailbox, make it known\n"); retval = retval | UA_KNOWN; } } @@ -139,11 +155,13 @@ int CtdlRoomAccess(struct quickroom *roombuf, struct usersupp *userbuf) NEWMSG: /* By the way, we also check for the presence of new messages */ if (is_msg_in_mset(vbuf.v_seen, roombuf->QRhighest) == 0) { + lprintf(9, " -- has new messages\n"); retval = retval | UA_HASNEWMSGS; } /* System rooms never show up in the list. */ if (roombuf->QRflags2 & QR2_SYSTEM) { + lprintf(9, " -- system room -- hide it\n"); retval = retval & ~UA_KNOWN; } return (retval);