}
}
- /* On some systems, Aides can gain access to mailboxes as well */
- if ( (config.c_aide_mailboxes)
- && (userbuf->axlevel >= 6)
+ /* Aides can gain access to mailboxes as well, but they don't show
+ * by default.
+ */
+ if ( (userbuf->axlevel >= 6)
&& (roombuf->QRflags & QR_MAILBOX) ) {
retval = retval | UA_GOTOALLOWED;
}
struct floor *cgetfloor(int floor_num) {
static int initialized = 0;
int i;
+ int fetch_new = 0;
+ struct floor *fl = NULL;
+ begin_critical_section(S_FLOORCACHE);
if (initialized == 0) {
for (i=0; i<MAXFLOORS; ++i) {
floorcache[floor_num] = NULL;
}
initialized = 1;
}
-
if (floorcache[floor_num] == NULL) {
- floorcache[floor_num] = mallok(sizeof(struct floor));
- getfloor(floorcache[floor_num], floor_num);
+ fetch_new = 1;
+ }
+ end_critical_section(S_FLOORCACHE);
+
+ if (fetch_new) {
+ lprintf(CTDL_DEBUG, "fetch_new is active ... going to disk\n");
+ fl = malloc(sizeof(struct floor));
+ getfloor(fl, floor_num);
+ begin_critical_section(S_FLOORCACHE);
+ if (floorcache[floor_num] != NULL) {
+ free(floorcache[floor_num]);
+ }
+ floorcache[floor_num] = fl;
+ end_critical_section(S_FLOORCACHE);
}
return(floorcache[floor_num]);
*/
void putfloor(struct floor *flbuf, int floor_num)
{
- cdb_store(CDB_FLOORTAB, &floor_num, sizeof(int),
- flbuf, sizeof(struct floor));
-
/* If we've cached this, clear it out, 'cuz it's WRONG now! */
+ begin_critical_section(S_FLOORCACHE);
if (floorcache[floor_num] != NULL) {
- phree(floorcache[floor_num]);
- floorcache[floor_num] = NULL;
+ free(floorcache[floor_num]);
+ floorcache[floor_num] = malloc(sizeof(struct floor));
+ memcpy(floorcache[floor_num], flbuf, sizeof(struct floor));
}
+ end_critical_section(S_FLOORCACHE);
+
+ cdb_store(CDB_FLOORTAB, &floor_num, sizeof(int),
+ flbuf, sizeof(struct floor));
}
get_mm();
cdbfr = cdb_fetch(CDB_MSGLISTS, &CC->room.QRnumber, sizeof(long));
if (cdbfr != NULL) {
- msglist = mallok(cdbfr->len);
+ msglist = malloc(cdbfr->len);
memcpy(msglist, cdbfr->ptr, cdbfr->len);
num_msgs = cdbfr->len / sizeof(long);
cdb_free(cdbfr);
}
}
- if (msglist != NULL) phree(msglist);
+ if (msglist != NULL) free(msglist);
if (CC->room.QRflags & QR_MAILBOX)
rmailflag = 1;
if (num_parms(args) >= 5) {
fl = cgetfloor(extract_int(args, 4));
- if ((fl->f_flags & F_INUSE) == 0) {
+ if (fl == NULL) {
+ cprintf("%d Invalid floor number.\n",
+ ERROR + INVALID_FLOOR_OPERATION);
+ return;
+ }
+ else if ((fl->f_flags & F_INUSE) == 0) {
cprintf("%d Invalid floor number.\n",
ERROR + INVALID_FLOOR_OPERATION);
return;
}
if (new_room_type == 5) {
- if ((config.c_aide_mailboxes == 0)
- || (CC->user.axlevel < 6)) {
+ if (CC->user.axlevel < 6) {
cprintf("%d Higher access required\n",
ERROR + HIGHER_ACCESS_REQUIRED);
return;
return;
}
cprintf("%d Send info...\n", SEND_LISTING);
+ flush_output();
do {
client_gets(buf);