]> code.citadel.org Git - citadel.git/blobdiff - citadel/user_ops.c
* Removed all of the thread cancellation cruft that is no longer necessary
[citadel.git] / citadel / user_ops.c
index 5815f1a2aafea9a454a6a2065e4f40464df12870..5cf386354cdb7c410d70e23e92b7f7c4b1da78b9 100644 (file)
@@ -14,9 +14,6 @@
 #include <string.h>
 #include <syslog.h>
 #include <limits.h>
-#ifdef HAVE_PTHREAD_H
-#include <pthread.h>
-#endif
 #ifndef ENABLE_CHKPWD
 #include "auth.h"
 #endif
@@ -95,6 +92,7 @@ void putuser(struct usersupp *usbuf)
                }
        lowercase_name[sizeof(lowercase_name)-1] = 0;
 
+       usbuf->version = config.c_setup_level;
        cdb_store(CDB_USERSUPP,
                lowercase_name, strlen(lowercase_name),
                usbuf, sizeof(struct usersupp));
@@ -424,14 +422,14 @@ void cmd_pass(char *buf)
                }
 
        code = (-1);
-       if (CC->usersupp.USuid == BBSUID) {
+       if (CC->usersupp.uid == BBSUID) {
                strproc(password);
                strproc(CC->usersupp.password);
                code = strcasecmp(CC->usersupp.password,password);
                }
 #ifdef ENABLE_AUTOLOGIN
        else {
-               if (validpw(CC->usersupp.USuid, password)) {
+               if (validpw(CC->usersupp.uid, password)) {
                        code = 0;
                        lgetuser(&CC->usersupp, CC->curr_user);
                        safestrncpy(CC->usersupp.password, password,
@@ -536,10 +534,10 @@ int create_user(char *newusername)
                for (a=0; a<strlen(username); ++a) {
                        if (username[a] == ',') username[a] = 0;
                        }
-               CC->usersupp.USuid = p->pw_uid;
+               CC->usersupp.uid = p->pw_uid;
                }
        else {
-               CC->usersupp.USuid = BBSUID;
+               CC->usersupp.uid = BBSUID;
                }
 
        if (!getuser(&usbuf,username)) {
@@ -561,12 +559,6 @@ int create_user(char *newusername)
        CC->usersupp.USscreenwidth = 80;
        CC->usersupp.USscreenheight = 24;
        time(&CC->usersupp.lastcall);
-       strcpy(CC->usersupp.USname, "");
-       strcpy(CC->usersupp.USaddr, "");
-       strcpy(CC->usersupp.UScity, "");
-       strcpy(CC->usersupp.USstate, "");
-       strcpy(CC->usersupp.USzip, "");
-       strcpy(CC->usersupp.USphone, "");
 
        /* fetch a new user number */
        CC->usersupp.usernum = get_new_user_number();
@@ -658,7 +650,7 @@ void cmd_setp(char *new_pw)
                cprintf("%d Not logged in.\n",ERROR+NOT_LOGGED_IN);
                return;
                }
-       if (CC->usersupp.USuid != BBSUID) {
+       if (CC->usersupp.uid != BBSUID) {
                cprintf("%d Not allowed.  Use the 'passwd' command.\n",ERROR);
                return;
                }
@@ -888,67 +880,6 @@ void cmd_gnur(void) {
        }
 
 
-/*
- * get registration info for a user
- */
-void cmd_greg(char *who)
-{
-       struct usersupp usbuf;
-       int a,b;
-       char pbuf[32];
-
-       if (!(CC->logged_in)) {
-               cprintf("%d Not logged in.\n",ERROR+NOT_LOGGED_IN);
-               return;
-               }
-
-       if (!strcasecmp(who,"_SELF_")) strcpy(who,CC->curr_user);
-
-       if ((CC->usersupp.axlevel < 6) && (strcasecmp(who,CC->curr_user))) {
-               cprintf("%d Higher access required.\n",
-                       ERROR+HIGHER_ACCESS_REQUIRED);
-               return;
-               }
-
-       if (getuser(&usbuf,who) != 0) {
-               cprintf("%d '%s' not found.\n",ERROR+NO_SUCH_USER,who);
-               return;
-               }
-
-       cprintf("%d %s\n",LISTING_FOLLOWS,usbuf.fullname);
-       cprintf("%ld\n",usbuf.usernum);
-       cprintf("%s\n",usbuf.password);
-       cprintf("%s\n",usbuf.USname);
-       cprintf("%s\n",usbuf.USaddr);
-       cprintf("%s\n%s\n%s\n",
-               usbuf.UScity,usbuf.USstate,usbuf.USzip);
-       strcpy(pbuf,usbuf.USphone);
-       usbuf.USphone[0]=0;
-       for (a=0; a<strlen(pbuf); ++a) {
-               if ((pbuf[a]>='0')&&(pbuf[a]<='9')) {
-                       b=strlen(usbuf.USphone);
-                       usbuf.USphone[b]=pbuf[a];
-                       usbuf.USphone[b+1]=0;
-                       }
-               }
-       while(strlen(usbuf.USphone)<10) {
-               strcpy(pbuf,usbuf.USphone);
-               strcpy(usbuf.USphone," ");
-               strcat(usbuf.USphone,pbuf);
-               }
-
-       cprintf("(%c%c%c) %c%c%c-%c%c%c%c\n",
-               usbuf.USphone[0],usbuf.USphone[1],
-               usbuf.USphone[2],usbuf.USphone[3],
-               usbuf.USphone[4],usbuf.USphone[5],
-               usbuf.USphone[6],usbuf.USphone[7],
-               usbuf.USphone[8],usbuf.USphone[9]);
-
-       cprintf("%d\n",usbuf.axlevel);
-       cprintf("%s\n",usbuf.USemail);
-       cprintf("000\n");
-       }
-
 /*
  * validate a user
  */
@@ -1047,89 +978,6 @@ void cmd_list(void) {
        }
 
 
-/*
- * enter registration info
- */
-void cmd_regi(void) {
-       int a,b,c;
-       char buf[256];
-
-       char tmpname[256];
-       char tmpaddr[256];
-       char tmpcity[256];
-       char tmpstate[256];
-       char tmpzip[256];
-       char tmpphone[256];
-       char tmpemail[256];
-
-       if (!(CC->logged_in)) {
-               cprintf("%d Not logged in.\n",ERROR+NOT_LOGGED_IN);
-               return;
-               }
-
-       strcpy(tmpname,"");
-       strcpy(tmpaddr,"");
-       strcpy(tmpcity,"");
-       strcpy(tmpstate,"");
-       strcpy(tmpzip,"");
-       strcpy(tmpphone,"");
-       strcpy(tmpemail,"");
-
-       cprintf("%d Send registration...\n",SEND_LISTING);
-       a=0;
-       while (client_gets(buf), strcmp(buf,"000")) {
-               if (a==0) strcpy(tmpname,buf);
-               if (a==1) strcpy(tmpaddr,buf);
-               if (a==2) strcpy(tmpcity,buf);
-               if (a==3) strcpy(tmpstate,buf);
-               if (a==4) {
-                       for (c=0; c<strlen(buf); ++c) {
-                               if ((buf[c]>='0')&&(buf[c]<='9')) {
-                                       b=strlen(tmpzip);
-                                       tmpzip[b]=buf[c];
-                                       tmpzip[b+1]=0;
-                                       }
-                               }
-                       }
-               if (a==5) {
-                       for (c=0; c<strlen(buf); ++c) {
-                               if ((buf[c]>='0')&&(buf[c]<='9')) {
-                                       b=strlen(tmpphone);
-                                       tmpphone[b]=buf[c];
-                                       tmpphone[b+1]=0;
-                                       }
-                               }
-                       }
-               if (a==6) strncpy(tmpemail,buf,31);
-               ++a;
-               }
-
-       tmpname[29]=0;
-       tmpaddr[24]=0;
-       tmpcity[14]=0;
-       tmpstate[2]=0;
-       tmpzip[9]=0;
-       tmpphone[10]=0;
-       tmpemail[31]=0;
-
-       lgetuser(&CC->usersupp,CC->curr_user);
-       strcpy(CC->usersupp.USname,tmpname);
-       strcpy(CC->usersupp.USaddr,tmpaddr);
-       strcpy(CC->usersupp.UScity,tmpcity);
-       strcpy(CC->usersupp.USstate,tmpstate);
-       strcpy(CC->usersupp.USzip,tmpzip);
-       strcpy(CC->usersupp.USphone,tmpphone);
-       strcpy(CC->usersupp.USemail,tmpemail);
-       CC->usersupp.flags=(CC->usersupp.flags|US_REGIS|US_NEEDVALID);
-       lputuser(&CC->usersupp);
-
-       /* set global flag calling for validation */
-       begin_critical_section(S_CONTROL);
-       get_control();
-       CitControl.MMflags = CitControl.MMflags | MM_VALID ;
-       put_control();
-       end_critical_section(S_CONTROL);
-       }
 
 
 /*