cprintf("%d all configuration variables\n", LISTING_FOLLOWS);
cdb_rewind(CDB_CONFIG);
- while (cdbcfg = cdb_next_item(CDB_CONFIG), cdbcfg.val.ptr!=NULL) {
+ while (cdbcfg = cdb_next_item(CDB_CONFIG), cdbcfg.val.ptr!=NULL) { // always read to the end
if (cdbcfg.val.len < 1020) {
keylen = strlen(cdbcfg.val.ptr);
key = cdbcfg.val.ptr;
cprintf("%d Who knows room:\n", LISTING_FOLLOWS);
cdb_rewind(CDB_USERS);
- while (cdbus = cdb_next_item(CDB_USERS), cdbus.val.ptr!=NULL) {
+ while (cdbus = cdb_next_item(CDB_USERS), cdbus.val.ptr!=NULL) { // always read to the end
memset(&temp, 0, sizeof temp);
memcpy(&temp, cdbus.val.ptr, sizeof temp);
CtdlRoomAccess(&CC->room, &temp, &ra, NULL);
void cmd_gnur(char *argbuf) {
struct cdbkeyval cdbus;
struct ctdluser usbuf;
+ int found_it = 0;
if (CtdlAccessCheck(ac_aide)) {
return;
memcpy(&usbuf, cdbus.val.ptr, ((cdbus.val.len > sizeof(struct ctdluser)) ? sizeof(struct ctdluser) : cdbus.val.len));
if ((usbuf.flags & US_NEEDVALID) && (usbuf.axlevel > AxDeleted)) {
cprintf("%d %s\n", MORE_DATA, usbuf.fullname);
- cdb_close_cursor(CDB_USERS);
- return;
+ found_it = 1; // always read through to the end
}
}
+ if (found_it) {
+ return;
+ }
+
// If we get to this point, there are no more unvalidated users. Therefore we clear the "users need validation" flag.
begin_critical_section(S_CONTROL);
int flags;
// Now traverse through the visits, purging irrelevant records...
cdb_rewind(CDB_VISIT);
- while(cdbvisit = cdb_next_item(CDB_VISIT), cdbvisit.val.ptr!=NULL) {
+ while(cdbvisit = cdb_next_item(CDB_VISIT), cdbvisit.val.ptr!=NULL) { // always read through to the end
memset(&vbuf, 0, sizeof(struct visit));
memcpy(&vbuf, cdbvisit.val.ptr, ((cdbvisit.val.len > sizeof(struct visit)) ? sizeof(struct visit) : cdbvisit.val.len));
RoomIsValid = 0;
syslog(LOG_DEBUG, "Purge use table: phase 1");
cdb_rewind(CDB_USETABLE);
- while(cdbut = cdb_next_item(CDB_USETABLE), cdbut.val.ptr!=NULL) {
+ while(cdbut = cdb_next_item(CDB_USETABLE), cdbut.val.ptr!=NULL) { // always read through to the end
++total;
if (cdbut.val.len > sizeof(struct UseTable))
memcpy(&ut, cdbut.val.ptr, sizeof(struct UseTable));
// Phase 1: traverse through the table, discovering old records...
syslog(LOG_DEBUG, "Purge EUID index: phase 1");
cdb_rewind(CDB_EUIDINDEX);
- while(cdbei = cdb_next_item(CDB_EUIDINDEX), cdbei.val.ptr!=NULL) {
+ while(cdbei = cdb_next_item(CDB_EUIDINDEX), cdbei.val.ptr!=NULL) { // always read through to the end
memcpy(&msgnum, cdbei.val.ptr, sizeof(long));
// Traverse the userlist
rights = NewStrBuf();
cdb_rewind(CDB_USERS);
- while (cdbus = cdb_next_item(CDB_USERS), cdbus.val.ptr!=NULL) {
+ while (cdbus = cdb_next_item(CDB_USERS), cdbus.val.ptr!=NULL) { // always read through to the end
memset(&temp, 0, sizeof temp);
memcpy(&temp, cdbus.val.ptr, sizeof temp);
struct cdbkeyval cdbqr;
cdb_rewind(CDB_ROOMS);
-
- while (cdbqr = cdb_next_item(CDB_ROOMS), cdbqr.val.ptr!=NULL) {
+ while (cdbqr = cdb_next_item(CDB_ROOMS), cdbqr.val.ptr!=NULL) { // always read through to the end
memset(&qrbuf, 0, sizeof(struct ctdlroom));
- memcpy(&qrbuf, cdbqr.val.ptr, ((cdbqr.val.len > sizeof(struct ctdlroom)) ? sizeof(struct ctdlroom) : cdbqr.val.len) );
+ memcpy(&qrbuf, cdbqr.val.ptr, ((cdbqr.val.len > sizeof(struct ctdlroom)) ? sizeof(struct ctdlroom) : cdbqr.val.len) );
room_sanity_check(&qrbuf);
if (qrbuf.QRflags & QR_INUSE) {
callback_func(&qrbuf, in_data);
// Yes, we do this the long way. Someday we might want to try an index.
// No, we don't use CtdlForEachUser() because that requires multiple reads for each record
cdb_rewind(CDB_USERS);
- while (cdbus = cdb_next_item(CDB_USERS), cdbus.val.ptr!=NULL) {
+ while (cdbus = cdb_next_item(CDB_USERS), cdbus.val.ptr!=NULL) { // always read through to the end
usptr = (struct ctdluser *) cdbus.val.ptr;
if (usptr->uid == number) {
}
- cdb_rewind(CDB_USERS);
-
// Phase 1 : build an array of all our user account names
- while (cdbus = cdb_next_item(CDB_USERS), cdbus.val.ptr!=NULL) {
+ cdb_rewind(CDB_USERS);
+ while (cdbus = cdb_next_item(CDB_USERS), cdbus.val.ptr!=NULL) { // always read through to the end
usptr = (struct ctdluser *) cdbus.val.ptr;
if (strlen(usptr->fullname) > 0) {
array_append(all_users, usptr->fullname);
int num_bad_rows = 0;
cdb_rewind(which_cdb);
- while (ckv = cdb_next_item(which_cdb), ckv.val.ptr!=NULL) {
+ while (ckv = cdb_next_item(which_cdb), ckv.val.ptr!=NULL) { // always read through to the end
// Call the export function registered to this table
export_functions[which_cdb](which_cdb, ckv);
}