struct recptypes *valid = NULL;
if (trythisname == NULL) return login_not_found;
- safestrncpy(username, trythisname, sizeof username);
- strproc(username);
+ safestrncpy(username, trythisname, USERNAME_SIZE);
+ striplt(username);
if ((CC->logged_in)) {
return login_already_logged_in;
* is an e-mail address
*/
if (found_user != 0) {
- valid = validate_recipients(trythisname);
+ valid = validate_recipients(username);
if (valid != NULL) {
if (valid->num_local == 1) {
found_user = getuser(&CC->user,
*/
void cmd_user(char *cmdbuf)
{
- char username[SIZ];
+ char username[256];
int a;
- extract(username, cmdbuf, 0);
+ extract_token(username, cmdbuf, 0, '|', sizeof username);
striplt(username);
a = CtdlLoginExistingUser(username);
/* Create any personal rooms required by the system.
* (Technically, MAILROOM should be there already, but just in case...)
*/
- create_room(MAILROOM, 4, "", 0, 1, 0);
- create_room(SENTITEMS, 4, "", 0, 1, 0);
+ create_room(MAILROOM, 4, "", 0, 1, 0, VIEW_MAILBOX);
+ create_room(SENTITEMS, 4, "", 0, 1, 0, VIEW_MAILBOX);
+ create_room(USERTRASHROOM, 4, "", 0, 1, 0, VIEW_MAILBOX);
/* Run any startup routines registered by loadable modules */
PerformSessionHooks(EVT_LOGIN);
}
close(pipev[0]);
- execl(BBSDIR "/chkpwd", BBSDIR "/chkpwd", NULL);
- perror(BBSDIR "/chkpwd");
+ execl(CTDLDIR "/chkpwd", CTDLDIR "/chkpwd", NULL);
+ perror(CTDLDIR "/chkpwd");
exit(1);
}
#ifdef ENABLE_AUTOLOGIN
- /* A uid of BBSUID or -1 indicates that this user exists only in
+ /* A uid of CTDLUID or -1 indicates that this user exists only in
* Citadel, not in the underlying operating system.
*/
- if ( (CC->user.uid == BBSUID) || (CC->user.uid == (-1)) ) {
+ if ( (CC->user.uid == CTDLUID) || (CC->user.uid == (-1)) ) {
strproc(password);
strproc(CC->user.password);
code = strcasecmp(CC->user.password, password);
void cmd_pass(char *buf)
{
- char password[SIZ];
+ char password[256];
int a;
- extract(password, buf, 0);
+ extract_token(password, buf, 0, '|', sizeof password);
a = CtdlTryPassword(password);
switch (a) {
case pass_ok:
logged_in_response();
return;
- cprintf("%d Can't find user record!\n",
- ERROR + INTERNAL_ERROR);
}
}
cdb_delete(CDB_USERS, usernamekey, strlen(usernamekey));
/* remove the user's bio file */
- snprintf(filename, sizeof filename, "./bio/%ld", usbuf.usernum);
+ snprintf(filename, sizeof filename,
+#ifndef HAVE_DATA_DIR
+ "."
+#else
+ DATA_DIR
+#endif
+ "/bio/%ld", usbuf.usernum);
unlink(filename);
/* remove the user's picture */
- snprintf(filename, sizeof filename, "./userpics/%ld.gif", usbuf.usernum);
+ snprintf(filename, sizeof filename,
+#ifndef HAVE_DATA_DIR
+ "."
+#else
+ DATA_DIR
+#endif
+ "/userpics/%ld.gif", usbuf.usernum);
unlink(filename);
return (0);
{
struct ctdluser usbuf;
struct ctdlroom qrbuf;
- char username[SIZ];
+ char username[256];
char mailboxname[ROOMNAMELEN];
uid_t uid;
struct passwd *p = (struct passwd *) getpwnam(username);
if (p != NULL) {
- extract_token(username, p->pw_gecos, 0, ',');
+ extract_token(username, p->pw_gecos, 0, ',', sizeof username);
uid = p->pw_uid;
} else {
uid = (-1);
* Make the latter an invisible system room.
*/
MailboxName(mailboxname, sizeof mailboxname, &usbuf, MAILROOM);
- create_room(mailboxname, 5, "", 0, 1, 1);
+ create_room(mailboxname, 5, "", 0, 1, 1, VIEW_MAILBOX);
MailboxName(mailboxname, sizeof mailboxname, &usbuf, USERCONFIGROOM);
- create_room(mailboxname, 5, "", 0, 1, 1);
+ create_room(mailboxname, 5, "", 0, 1, 1, VIEW_BBS);
if (lgetroom(&qrbuf, mailboxname) == 0) {
qrbuf.QRflags2 |= QR2_SYSTEM;
lputroom(&qrbuf);
void cmd_newu(char *cmdbuf)
{
int a;
- char username[SIZ];
+ char username[26];
if (config.c_disable_newu) {
cprintf("%d Self-service user account creation "
ERROR + MAX_SESSIONS_EXCEEDED,
config.c_nodename, config.c_maxsessions);
}
- extract(username, cmdbuf, 0);
+ extract_token(username, cmdbuf, 0, '|', sizeof username);
username[25] = 0;
strproc(username);
if (CtdlAccessCheck(ac_logged_in)) {
return;
}
- if ( (CC->user.uid != BBSUID) && (CC->user.uid != (-1)) ) {
+ if ( (CC->user.uid != CTDLUID) && (CC->user.uid != (-1)) ) {
cprintf("%d Not allowed. Use the 'passwd' command.\n", ERROR + NOT_HERE);
return;
}
void cmd_creu(char *cmdbuf)
{
int a;
- char username[SIZ];
- char password[SIZ];
+ char username[26];
+ char password[32];
struct ctdluser tmp;
if (CtdlAccessCheck(ac_aide)) {
return;
}
- extract(username, cmdbuf, 0);
- extract(password, cmdbuf, 1);
+ extract_token(username, cmdbuf, 0, '|', sizeof username);
+ extract_token(password, cmdbuf, 1, '|', sizeof password);
username[25] = 0;
password[31] = 0;
strproc(username);
target_msgnum = extract_long(argbuf, 0);
target_setting = extract_int(argbuf, 1);
- CtdlSetSeen(target_msgnum, target_setting, ctdlsetseen_seen);
+ CtdlSetSeen(&target_msgnum, 1, target_setting,
+ ctdlsetseen_seen, NULL, NULL);
cprintf("%d OK\n", CIT_OK);
}
*/
void cmd_vali(char *v_args)
{
- char user[SIZ];
+ char user[128];
int newax;
struct ctdluser userbuf;
- extract(user, v_args, 0);
+ extract_token(user, v_args, 0, '|', sizeof user);
newax = extract_int(v_args, 1);
if (CtdlAccessCheck(ac_aide)) {
*/
void ListThisUser(struct ctdluser *usbuf, void *data)
{
+ char *searchstring;
+
+ searchstring = (char *)data;
+ if (bmstrcasestr(usbuf->fullname, searchstring) == NULL) {
+ return;
+ }
+
if (usbuf->axlevel > 0) {
if ((CC->user.axlevel >= 6)
|| ((usbuf->flags & US_UNLISTED) == 0)
}
/*
- * List users
+ * List users (searchstring may be empty to list all users)
*/
-void cmd_list(void)
+void cmd_list(char *cmdbuf)
{
+ char searchstring[256];
+ extract_token(searchstring, cmdbuf, 0, '|', sizeof searchstring);
+ striplt(searchstring);
cprintf("%d \n", LISTING_FOLLOWS);
- ForEachUser(ListThisUser, NULL);
+ ForEachUser(ListThisUser, (void *)searchstring );
cprintf("000\n");
}
void cmd_agup(char *cmdbuf)
{
struct ctdluser usbuf;
- char requested_user[SIZ];
+ char requested_user[128];
if (CtdlAccessCheck(ac_aide)) {
return;
}
- extract(requested_user, cmdbuf, 0);
+ extract_token(requested_user, cmdbuf, 0, '|', sizeof requested_user);
if (getuser(&usbuf, requested_user) != 0) {
cprintf("%d No such user.\n", ERROR + NO_SUCH_USER);
return;
void cmd_asup(char *cmdbuf)
{
struct ctdluser usbuf;
- char requested_user[SIZ];
+ char requested_user[128];
char notify[SIZ];
int np;
int newax;
if (CtdlAccessCheck(ac_aide))
return;
- extract(requested_user, cmdbuf, 0);
+ extract_token(requested_user, cmdbuf, 0, '|', sizeof requested_user);
if (lgetuser(&usbuf, requested_user) != 0) {
cprintf("%d No such user.\n", ERROR + NO_SUCH_USER);
return;
}
np = num_parms(cmdbuf);
if (np > 1)
- extract(usbuf.password, cmdbuf, 1);
+ extract_token(usbuf.password, cmdbuf, 1, '|', sizeof usbuf.password);
if (np > 2)
usbuf.flags = extract_int(cmdbuf, 2);
if (np > 3)