#include <string.h>
#include <syslog.h>
#include <limits.h>
-#ifdef HAVE_PTHREAD_H
-#include <pthread.h>
-#endif
#ifndef ENABLE_CHKPWD
#include "auth.h"
#endif
}
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));
}
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,
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)) {
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();
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;
}
lputuser(&USscratch);
/* post a message in Aide> saying what we just did */
- sprintf(bbb,"%s %s %s> by %s",
+ sprintf(bbb,"%s %s %s> by %s\n",
iuser,
((op == 1) ? "invited to" : "kicked out of"),
CC->quickroom.QRname,
}
-/*
- * 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
*/
}
-/*
- * 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);
- }
/*
}
}
+ if (msglist != NULL) phree(msglist);
+
return(num_newmsgs);
}