Miscellaneous bug fixes. Also restored the ability to delete a user by
authorArt Cancro <ajc@citadel.org>
Mon, 13 Jul 1998 05:07:47 +0000 (05:07 +0000)
committerArt Cancro <ajc@citadel.org>
Mon, 13 Jul 1998 05:07:47 +0000 (05:07 +0000)
setting his/her access level to 0.

citadel/control.c
citadel/database.c
citadel/file_ops.c
citadel/msgbase.c
citadel/stats.c
citadel/user_ops.c

index 0dd60f0137d7cc011b94abc1d58017c49b477526..b0cc45f23b849fb7604f831e610c5800e5fdf8a7 100644 (file)
@@ -58,7 +58,6 @@ void put_control() {
  * get_new_message_number()  -  Obtain a new, unique ID to be used for a message.
  */
 long get_new_message_number() {
-
        begin_critical_section(S_CONTROL);
        get_control();
        ++CitControl.MMhighest;
@@ -72,11 +71,10 @@ long get_new_message_number() {
  * get_new_user_number()  -  Obtain a new, unique ID to be used for a user.
  */
 long get_new_user_number() {
-
        begin_critical_section(S_CONTROL);
        get_control();
        ++CitControl.MMnextuser;
        put_control();
        end_critical_section(S_CONTROL);
-       return(CitControl.MMhighest);
+       return(CitControl.MMnextuser);
        }
index d81726affdfe0b9645c38c36c42151dd2927cc7d..14280397b5808a4472131bc94e0e4cafae4dcd15 100644 (file)
@@ -68,35 +68,35 @@ void open_databases() {
        int a;
 
        gdbms[CDB_MSGMAIN] = gdbm_open("msgmain.gdbm", 8192,
-               GDBM_WRCREAT, 0700, NULL);
+               GDBM_WRCREAT, 0600, NULL);
        if (gdbms[CDB_MSGMAIN] == NULL) {
                lprintf(2, "Cannot open msgmain: %s\n",
                        gdbm_strerror(gdbm_errno));
                }
 
        gdbms[CDB_USERSUPP] = gdbm_open("usersupp.gdbm", 0,
-               GDBM_WRCREAT, 0700, NULL);
+               GDBM_WRCREAT, 0600, NULL);
        if (gdbms[CDB_USERSUPP] == NULL) {
                lprintf(2, "Cannot open usersupp: %s\n",
                        gdbm_strerror(gdbm_errno));
                }
 
        gdbms[CDB_QUICKROOM] = gdbm_open("quickroom.gdbm", 0,
-               GDBM_WRCREAT, 0700, NULL);
+               GDBM_WRCREAT, 0600, NULL);
        if (gdbms[CDB_QUICKROOM] == NULL) {
                lprintf(2, "Cannot open quickroom: %s\n",
                        gdbm_strerror(gdbm_errno));
                }
 
        gdbms[CDB_FULLROOM] = gdbm_open("fullroom.gdbm", 0,
-               GDBM_WRCREAT, 0700, NULL);
+               GDBM_WRCREAT, 0600, NULL);
        if (gdbms[CDB_FULLROOM] == NULL) {
                lprintf(2, "Cannot open fullroom: %s\n",
                        gdbm_strerror(gdbm_errno));
                }
 
        gdbms[CDB_FLOORTAB] = gdbm_open("floortab.gdbm", 0,
-               GDBM_WRCREAT, 0700, NULL);
+               GDBM_WRCREAT, 0600, NULL);
        if (gdbms[CDB_FLOORTAB] == NULL) {
                lprintf(2, "Cannot open floortab: %s\n",
                        gdbm_strerror(gdbm_errno));
index 9d99dbfaf041d032b907145acfda92efea8597fe..0168837d0f7ba824306f26efc3fd8b055388f787 100644 (file)
@@ -60,7 +60,6 @@ void cmd_movf(char *cmdbuf)
        char newpath[256];
        char newroom[256];
        char buf[256];
-       FILE *fp;
        int a;
        int target_room = (-1);
        struct quickroom qrbuf;
index 7894541ba57b81887db6cee605afede36a9bd83a..a14cec67f8d5803c1232ed13c3237d9828c14801 100644 (file)
@@ -594,7 +594,6 @@ void send_message(char *filename, struct smreturn *retbuf, int generate_id)
                                /* set to 1 to generate an 'I' field */
 {
 
-       int file,a;
        FILE *fp;
        long newmsgid;
 
index e5664f5d754a887e22e92fb6e65885de7a785d16..b5615154d2509710a7d010f1f220a9134bcdbd3b 100644 (file)
@@ -117,7 +117,7 @@ main (argc, argv)
   struct tm *tm;
   struct caller *callers = NULL;
   struct caller *callptr = NULL;
-  FILE *fp, *sortpipe;
+  FILE *sortpipe;
   char thegraph[GRANULARITY][73];
   int pc_only = 0;
   char buf[256];
index 205a7f979735c212860eb7857f3cc2e7eab5ea16..6f6df898a47c33d6183b70ab4e1ce9e709eefc76 100644 (file)
@@ -343,6 +343,9 @@ void purge_user(char *pname) {
                        }
                }
 
+       /* delete the userlog entry */
+       cdb_delete(CDB_USERSUPP, pname, strlen(pname));
+
        /* remove the user's bio file */        
        sprintf(filename, "./bio/%ld", usbuf.usernum);
        unlink(filename);
@@ -360,8 +363,7 @@ void purge_user(char *pname) {
 int create_user(char *newusername)
 {
        struct usersupp usbuf;
-       int a,file;
-       long aa;
+       int a;
        struct passwd *p = NULL;
        char username[64];
 
@@ -690,7 +692,6 @@ void cmd_forg(void) {
 void cmd_gnur(void) {
        struct cdbdata *cdbus;
        struct usersupp usbuf;
-       FILE *fp;
 
        if (!(CC->logged_in)) {
                cprintf("%d Not logged in.\n",ERROR+NOT_LOGGED_IN);
@@ -832,6 +833,14 @@ void cmd_vali(char *v_args)
        userbuf.flags = (userbuf.flags & ~US_NEEDVALID);
 
        lputuser(&userbuf,user);
+
+       /* If the access level was set to zero, delete the user */
+       if (newax == 0) {
+               purge_user(user);
+               cprintf("%d %s Deleted.\n", OK, userbuf.fullname);
+               return;
+               }
+
        cprintf("%d ok\n",OK);
        }
 
@@ -877,7 +886,6 @@ void cmd_list(void) {
  */
 void cmd_regi(void) {
        int a,b,c;
-       FILE *fp;
        char buf[256];
 
        char tmpname[256];
@@ -966,7 +974,7 @@ void cmd_chek(void) {
        int mail = 0;
        int regis = 0;
        int vali = 0;
-       int a,file;
+       int a;
 
        if (!(CC->logged_in)) {
                cprintf("%d Not logged in.\n",ERROR+NOT_LOGGED_IN);