e98daad9fa9e26f6d9e8f3ff79b61362a1f80c76
[citadel.git] / citadel / modules / ctdlproto / serv_user.c
1 /* 
2  * Server functions which perform operations on user objects.
3  *
4  * Copyright (c) 1987-2011 by the citadel.org team
5  *
6  * This program is open source software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License, version 3.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  */
14
15 #include "support.h"
16 #include "control.h"
17 #include "ctdl_module.h"
18
19 #include "citserver.h"
20
21 #include "user_ops.h"
22 #include "internet_addressing.h"
23
24
25
26 /*
27  * USER cmd
28  */
29 void cmd_user(char *cmdbuf)
30 {
31         char username[256];
32         int a;
33
34         CON_syslog(LOG_DEBUG, "cmd_user(%s)\n", cmdbuf);
35         extract_token(username, cmdbuf, 0, '|', sizeof username);
36         CON_syslog(LOG_DEBUG, "username: %s\n", username);
37         striplt(username);
38         CON_syslog(LOG_DEBUG, "username: %s\n", username);
39
40         a = CtdlLoginExistingUser(NULL, username);
41         switch (a) {
42         case login_already_logged_in:
43                 cprintf("%d Already logged in.\n", ERROR + ALREADY_LOGGED_IN);
44                 return;
45         case login_too_many_users:
46                 cprintf("%d %s: "
47                         "Too many users are already online "
48                         "(maximum is %d)\n",
49                         ERROR + MAX_SESSIONS_EXCEEDED,
50                         config.c_nodename, config.c_maxsessions);
51                 return;
52         case login_ok:
53                 cprintf("%d Password required for %s\n",
54                         MORE_DATA, CC->curr_user);
55                 return;
56         case login_not_found:
57                 cprintf("%d %s not found.\n", ERROR + NO_SUCH_USER, username);
58                 return;
59         default:
60                 cprintf("%d Internal error\n", ERROR + INTERNAL_ERROR);
61         }
62 }
63
64
65 void cmd_pass(char *buf)
66 {
67         char password[SIZ];
68         int a;
69         long len;
70
71         memset(password, 0, sizeof(password));
72         len = extract_token(password, buf, 0, '|', sizeof password);
73         a = CtdlTryPassword(password, len);
74
75         switch (a) {
76         case pass_already_logged_in:
77                 cprintf("%d Already logged in.\n", ERROR + ALREADY_LOGGED_IN);
78                 return;
79         case pass_no_user:
80                 cprintf("%d You must send a name with USER first.\n",
81                         ERROR + USERNAME_REQUIRED);
82                 return;
83         case pass_wrong_password:
84                 cprintf("%d Wrong password.\n", ERROR + PASSWORD_REQUIRED);
85                 return;
86         case pass_ok:
87                 logged_in_response();
88                 return;
89         }
90 }
91
92
93 /*
94  * cmd_newu()  -  create a new user account and log in as that user
95  */
96 void cmd_newu(char *cmdbuf)
97 {
98         int a;
99         long len;
100         char username[SIZ];
101
102         if (config.c_auth_mode != AUTHMODE_NATIVE) {
103                 cprintf("%d This system does not use native mode authentication.\n",
104                         ERROR + NOT_HERE);
105                 return;
106         }
107
108         if (config.c_disable_newu) {
109                 cprintf("%d Self-service user account creation "
110                         "is disabled on this system.\n", ERROR + NOT_HERE);
111                 return;
112         }
113
114         if (CC->logged_in) {
115                 cprintf("%d Already logged in.\n", ERROR + ALREADY_LOGGED_IN);
116                 return;
117         }
118         if (CC->nologin) {
119                 cprintf("%d %s: Too many users are already online (maximum is %d)\n",
120                         ERROR + MAX_SESSIONS_EXCEEDED,
121                         config.c_nodename, config.c_maxsessions);
122                 return;
123         }
124         extract_token(username, cmdbuf, 0, '|', sizeof username);
125         strproc(username);
126         len = cutuserkey(username);
127
128         if (IsEmptyStr(username)) {
129                 cprintf("%d You must supply a user name.\n", ERROR + USERNAME_REQUIRED);
130                 return;
131         }
132
133         if ((!strcasecmp(username, "bbs")) ||
134             (!strcasecmp(username, "new")) ||
135             (!strcasecmp(username, "."))) {
136                 cprintf("%d '%s' is an invalid login name.\n", ERROR + ILLEGAL_VALUE, username);
137                 return;
138         }
139
140         a = create_user(username, len, 1);
141
142         if (a == 0) {
143                 logged_in_response();
144         } else if (a == ERROR + ALREADY_EXISTS) {
145                 cprintf("%d '%s' already exists.\n",
146                         ERROR + ALREADY_EXISTS, username);
147                 return;
148         } else if (a == ERROR + INTERNAL_ERROR) {
149                 cprintf("%d Internal error - user record disappeared?\n",
150                         ERROR + INTERNAL_ERROR);
151                 return;
152         } else {
153                 cprintf("%d unknown error\n", ERROR + INTERNAL_ERROR);
154         }
155 }
156
157 /*
158  * set password - citadel protocol implementation
159  */
160 void cmd_setp(char *new_pw)
161 {
162         if (CtdlAccessCheck(ac_logged_in)) {
163                 return;
164         }
165         if ( (CC->user.uid != CTDLUID) && (CC->user.uid != (-1)) ) {
166                 cprintf("%d Not allowed.  Use the 'passwd' command.\n", ERROR + NOT_HERE);
167                 return;
168         }
169         if (CC->is_master) {
170                 cprintf("%d The master prefix password cannot be changed with this command.\n",
171                         ERROR + NOT_HERE);
172                 return;
173         }
174
175         if (!strcasecmp(new_pw, "GENERATE_RANDOM_PASSWORD")) {
176                 char random_password[17];
177                 snprintf(random_password, sizeof random_password, "%08lx%08lx", random(), random());
178                 CtdlSetPassword(random_password);
179                 cprintf("%d %s\n", CIT_OK, random_password);
180         }
181         else {
182                 strproc(new_pw);
183                 if (IsEmptyStr(new_pw)) {
184                         cprintf("%d Password unchanged.\n", CIT_OK);
185                         return;
186                 }
187                 CtdlSetPassword(new_pw);
188                 cprintf("%d Password changed.\n", CIT_OK);
189         }
190 }
191
192
193 /*
194  * cmd_creu() - administratively create a new user account (do not log in to it)
195  */
196 void cmd_creu(char *cmdbuf)
197 {
198         int a;
199         long len;
200         char username[SIZ];
201         char password[SIZ];
202         struct ctdluser tmp;
203
204         if (CtdlAccessCheck(ac_aide)) {
205                 return;
206         }
207
208         extract_token(username, cmdbuf, 0, '|', sizeof username);
209         strproc(username);
210         strproc(password);
211         if (IsEmptyStr(username)) {
212                 cprintf("%d You must supply a user name.\n", ERROR + USERNAME_REQUIRED);
213                 return;
214         }
215         len = cutuserkey(username);
216
217
218         extract_token(password, cmdbuf, 1, '|', sizeof password);
219
220         a = create_user(username, len, 0);
221
222         if (a == 0) {
223                 if (!IsEmptyStr(password)) {
224                         CtdlGetUserLock(&tmp, username);
225                         safestrncpy(tmp.password, password, sizeof(tmp.password));
226                         CtdlPutUserLock(&tmp);
227                 }
228                 cprintf("%d User '%s' created %s.\n", CIT_OK, username,
229                                 (!IsEmptyStr(password)) ? "and password set" :
230                                 "with no password");
231                 return;
232         } else if (a == ERROR + ALREADY_EXISTS) {
233                 cprintf("%d '%s' already exists.\n", ERROR + ALREADY_EXISTS, username);
234                 return;
235         } else if ( (config.c_auth_mode != AUTHMODE_NATIVE) && (a == ERROR + NO_SUCH_USER) ) {
236                 cprintf("%d User accounts are not created within Citadel in host authentication mode.\n",
237                         ERROR + NO_SUCH_USER);
238                 return;
239         } else {
240                 cprintf("%d An error occurred creating the user account.\n", ERROR + INTERNAL_ERROR);
241         }
242 }
243
244
245
246 /*
247  * get user parameters
248  */
249 void cmd_getu(char *cmdbuf)
250 {
251
252         if (CtdlAccessCheck(ac_logged_in))
253                 return;
254
255         CtdlGetUser(&CC->user, CC->curr_user);
256         cprintf("%d 80|24|%d|\n",
257                 CIT_OK,
258                 (CC->user.flags & US_USER_SET)
259         );
260 }
261
262 /*
263  * set user parameters
264  */
265 void cmd_setu(char *new_parms)
266 {
267         if (CtdlAccessCheck(ac_logged_in))
268                 return;
269
270         if (num_parms(new_parms) < 3) {
271                 cprintf("%d Usage error.\n", ERROR + ILLEGAL_VALUE);
272                 return;
273         }
274         CtdlLockGetCurrentUser();
275         CC->user.flags = CC->user.flags & (~US_USER_SET);
276         CC->user.flags = CC->user.flags | (extract_int(new_parms, 2) & US_USER_SET);
277         CtdlPutCurrentUserLock();
278         cprintf("%d Ok\n", CIT_OK);
279 }
280
281 /*
282  * set last read pointer
283  */
284 void cmd_slrp(char *new_ptr)
285 {
286         long newlr;
287         visit vbuf;
288         visit original_vbuf;
289
290         if (CtdlAccessCheck(ac_logged_in)) {
291                 return;
292         }
293
294         if (!strncasecmp(new_ptr, "highest", 7)) {
295                 newlr = CC->room.QRhighest;
296         } else {
297                 newlr = atol(new_ptr);
298         }
299
300         CtdlLockGetCurrentUser();
301
302         CtdlGetRelationship(&vbuf, &CC->user, &CC->room);
303         memcpy(&original_vbuf, &vbuf, sizeof(visit));
304         vbuf.v_lastseen = newlr;
305         snprintf(vbuf.v_seen, sizeof vbuf.v_seen, "*:%ld", newlr);
306
307         /* Only rewrite the record if it changed */
308         if ( (vbuf.v_lastseen != original_vbuf.v_lastseen)
309            || (strcmp(vbuf.v_seen, original_vbuf.v_seen)) ) {
310                 CtdlSetRelationship(&vbuf, &CC->user, &CC->room);
311         }
312
313         CtdlPutCurrentUserLock();
314         cprintf("%d %ld\n", CIT_OK, newlr);
315 }
316
317
318 void cmd_seen(char *argbuf) {
319         long target_msgnum = 0L;
320         int target_setting = 0;
321
322         if (CtdlAccessCheck(ac_logged_in)) {
323                 return;
324         }
325
326         if (num_parms(argbuf) != 2) {
327                 cprintf("%d Invalid parameters\n", ERROR + ILLEGAL_VALUE);
328                 return;
329         }
330
331         target_msgnum = extract_long(argbuf, 0);
332         target_setting = extract_int(argbuf, 1);
333
334         CtdlSetSeen(&target_msgnum, 1, target_setting,
335                         ctdlsetseen_seen, NULL, NULL);
336         cprintf("%d OK\n", CIT_OK);
337 }
338
339
340 void cmd_gtsn(char *argbuf) {
341         visit vbuf;
342
343         if (CtdlAccessCheck(ac_logged_in)) {
344                 return;
345         }
346
347         /* Learn about the user and room in question */
348         CtdlGetRelationship(&vbuf, &CC->user, &CC->room);
349
350         cprintf("%d ", CIT_OK);
351         client_write(vbuf.v_seen, strlen(vbuf.v_seen));
352         client_write(HKEY("\n"));
353 }
354
355 /*
356  * INVT and KICK commands
357  */
358 void cmd_invt_kick(char *iuser, int op) {
359
360         /*
361          * These commands are only allowed by admins, room admins,
362          * and room namespace owners
363          */
364         if (is_room_aide()) {
365                 /* access granted */
366         } else if ( ((atol(CC->room.QRname) == CC->user.usernum) ) && (CC->user.usernum != 0) ) {
367                 /* access granted */
368         } else {
369                 /* access denied */
370                 cprintf("%d Higher access or room ownership required.\n",
371                         ERROR + HIGHER_ACCESS_REQUIRED);
372                 return;
373         }
374
375         if (!strncasecmp(CC->room.QRname, config.c_baseroom,
376                          ROOMNAMELEN)) {
377                 cprintf("%d Can't add/remove users from this room.\n",
378                         ERROR + NOT_HERE);
379                 return;
380         }
381
382         if (CtdlInvtKick(iuser, op) != 0) {
383                 cprintf("%d No such user.\n", ERROR + NO_SUCH_USER);
384                 return;
385         }
386
387         cprintf("%d %s %s %s.\n",
388                 CIT_OK, iuser,
389                 ((op == 1) ? "invited to" : "kicked out of"),
390                 CC->room.QRname);
391         return;
392 }
393
394 void cmd_invt(char *iuser) {cmd_invt_kick(iuser, 1);}
395 void cmd_kick(char *iuser) {cmd_invt_kick(iuser, 0);}
396
397
398 /*
399  * forget (Zap) the current room
400  */
401 void cmd_forg(char *argbuf)
402 {
403
404         if (CtdlAccessCheck(ac_logged_in)) {
405                 return;
406         }
407
408         if (CtdlForgetThisRoom() == 0) {
409                 cprintf("%d Ok\n", CIT_OK);
410         }
411         else {
412                 cprintf("%d You may not forget this room.\n", ERROR + NOT_HERE);
413         }
414 }
415
416 /*
417  * Get Next Unregistered User
418  */
419 void cmd_gnur(char *argbuf)
420 {
421         struct cdbdata *cdbus;
422         struct ctdluser usbuf;
423
424         if (CtdlAccessCheck(ac_aide)) {
425                 return;
426         }
427
428         if ((CitControl.MMflags & MM_VALID) == 0) {
429                 cprintf("%d There are no unvalidated users.\n", CIT_OK);
430                 return;
431         }
432
433         /* There are unvalidated users.  Traverse the user database,
434          * and return the first user we find that needs validation.
435          */
436         cdb_rewind(CDB_USERS);
437         while (cdbus = cdb_next_item(CDB_USERS), cdbus != NULL) {
438                 memset(&usbuf, 0, sizeof(struct ctdluser));
439                 memcpy(&usbuf, cdbus->ptr,
440                        ((cdbus->len > sizeof(struct ctdluser)) ?
441                         sizeof(struct ctdluser) : cdbus->len));
442                 cdb_free(cdbus);
443                 if ((usbuf.flags & US_NEEDVALID)
444                     && (usbuf.axlevel > AxDeleted)) {
445                         cprintf("%d %s\n", MORE_DATA, usbuf.fullname);
446                         cdb_close_cursor(CDB_USERS);
447                         return;
448                 }
449         }
450
451         /* If we get to this point, there are no more unvalidated users.
452          * Therefore we clear the "users need validation" flag.
453          */
454
455         begin_critical_section(S_CONTROL);
456         get_control();
457         CitControl.MMflags = CitControl.MMflags & (~MM_VALID);
458         put_control();
459         end_critical_section(S_CONTROL);
460         cprintf("%d *** End of registration.\n", CIT_OK);
461
462
463 }
464
465
466 /*
467  * validate a user
468  */
469 void cmd_vali(char *v_args)
470 {
471         char user[128];
472         int newax;
473         struct ctdluser userbuf;
474
475         extract_token(user, v_args, 0, '|', sizeof user);
476         newax = extract_int(v_args, 1);
477
478         if (CtdlAccessCheck(ac_aide) || 
479             (newax > AxAideU) ||
480             (newax < AxDeleted)) {
481                 return;
482         }
483
484         if (CtdlGetUserLock(&userbuf, user) != 0) {
485                 cprintf("%d '%s' not found.\n", ERROR + NO_SUCH_USER, user);
486                 return;
487         }
488
489         userbuf.axlevel = newax;
490         userbuf.flags = (userbuf.flags & ~US_NEEDVALID);
491
492         CtdlPutUserLock(&userbuf);
493
494         /* If the access level was set to zero, delete the user */
495         if (newax == 0) {
496                 if (purge_user(user) == 0) {
497                         cprintf("%d %s Deleted.\n", CIT_OK, userbuf.fullname);
498                         return;
499                 }
500         }
501         cprintf("%d User '%s' validated.\n", CIT_OK, userbuf.fullname);
502 }
503
504 /* 
505  *  List users (searchstring may be empty to list all users)
506  */
507 void cmd_list(char *cmdbuf)
508 {
509         char searchstring[256];
510         extract_token(searchstring, cmdbuf, 0, '|', sizeof searchstring);
511         striplt(searchstring);
512         cprintf("%d \n", LISTING_FOLLOWS);
513         ForEachUser(ListThisUser, (void *)searchstring );
514         cprintf("000\n");
515 }
516
517
518
519
520 /*
521  * assorted info we need to check at login
522  */
523 void cmd_chek(char *argbuf)
524 {
525         int mail = 0;
526         int regis = 0;
527         int vali = 0;
528
529         if (CtdlAccessCheck(ac_logged_in)) {
530                 return;
531         }
532
533         CtdlGetUser(&CC->user, CC->curr_user);  /* no lock is needed here */
534         if ((REGISCALL != 0) && ((CC->user.flags & US_REGIS) == 0))
535                 regis = 1;
536
537         if (CC->user.axlevel >= AxAideU) {
538                 get_control();
539                 if (CitControl.MMflags & MM_VALID)
540                         vali = 1;
541         }
542
543         /* check for mail */
544         mail = InitialMailCheck();
545
546         cprintf("%d %d|%d|%d|%s|\n", CIT_OK, mail, regis, vali, CC->cs_inet_email);
547 }
548
549
550 /*
551  * check to see if a user exists
552  */
553 void cmd_qusr(char *who)
554 {
555         struct ctdluser usbuf;
556
557         if (CtdlGetUser(&usbuf, who) == 0) {
558                 cprintf("%d %s\n", CIT_OK, usbuf.fullname);
559         } else {
560                 cprintf("%d No such user.\n", ERROR + NO_SUCH_USER);
561         }
562 }
563
564
565 /*
566  * Administrative Get User Parameters
567  */
568 void cmd_agup(char *cmdbuf)
569 {
570         struct ctdluser usbuf;
571         char requested_user[128];
572
573         if (CtdlAccessCheck(ac_aide)) {
574                 return;
575         }
576
577         extract_token(requested_user, cmdbuf, 0, '|', sizeof requested_user);
578         if (CtdlGetUser(&usbuf, requested_user) != 0) {
579                 cprintf("%d No such user.\n", ERROR + NO_SUCH_USER);
580                 return;
581         }
582         cprintf("%d %s|%s|%u|%ld|%ld|%d|%ld|%ld|%d\n",
583                 CIT_OK,
584                 usbuf.fullname,
585                 usbuf.password,
586                 usbuf.flags,
587                 usbuf.timescalled,
588                 usbuf.posted,
589                 (int) usbuf.axlevel,
590                 usbuf.usernum,
591                 (long)usbuf.lastcall,
592                 usbuf.USuserpurge);
593 }
594
595
596
597 /*
598  * Administrative Set User Parameters
599  */
600 void cmd_asup(char *cmdbuf)
601 {
602         struct ctdluser usbuf;
603         char requested_user[128];
604         char notify[SIZ];
605         int np;
606         int newax;
607         int deleted = 0;
608
609         if (CtdlAccessCheck(ac_aide))
610                 return;
611
612         extract_token(requested_user, cmdbuf, 0, '|', sizeof requested_user);
613         if (CtdlGetUserLock(&usbuf, requested_user) != 0) {
614                 cprintf("%d No such user.\n", ERROR + NO_SUCH_USER);
615                 return;
616         }
617         np = num_parms(cmdbuf);
618         if (np > 1)
619                 extract_token(usbuf.password, cmdbuf, 1, '|', sizeof usbuf.password);
620         if (np > 2)
621                 usbuf.flags = extract_int(cmdbuf, 2);
622         if (np > 3)
623                 usbuf.timescalled = extract_int(cmdbuf, 3);
624         if (np > 4)
625                 usbuf.posted = extract_int(cmdbuf, 4);
626         if (np > 5) {
627                 newax = extract_int(cmdbuf, 5);
628                 if ((newax >= AxDeleted) && (newax <= AxAideU)) {
629                         usbuf.axlevel = newax;
630                 }
631         }
632         if (np > 7) {
633                 usbuf.lastcall = extract_long(cmdbuf, 7);
634         }
635         if (np > 8) {
636                 usbuf.USuserpurge = extract_int(cmdbuf, 8);
637         }
638         CtdlPutUserLock(&usbuf);
639         if (usbuf.axlevel == AxDeleted) {
640                 if (purge_user(requested_user) == 0) {
641                         deleted = 1;
642                 }
643         }
644
645         if (deleted) {
646                 snprintf(notify, SIZ, 
647                          "User \"%s\" has been deleted by %s.\n",
648                          usbuf.fullname,
649                         (CC->logged_in ? CC->user.fullname : "an administrator")
650                 );
651                 CtdlAideMessage(notify, "User Deletion Message");
652         }
653
654         cprintf("%d Ok", CIT_OK);
655         if (deleted)
656                 cprintf(" (%s deleted)", requested_user);
657         cprintf("\n");
658 }
659
660
661 /*
662  * Citadel protocol command to do the same
663  */
664 void cmd_isme(char *argbuf) {
665         char addr[256];
666
667         if (CtdlAccessCheck(ac_logged_in)) return;
668         extract_token(addr, argbuf, 0, '|', sizeof addr);
669
670         if (CtdlIsMe(addr, sizeof addr)) {
671                 cprintf("%d %s\n", CIT_OK, addr);
672         }
673         else {
674                 cprintf("%d Not you.\n", ERROR + ILLEGAL_VALUE);
675         }
676
677 }
678
679
680 /*
681  * Set the preferred view for the current user/room combination
682  */
683 void cmd_view(char *cmdbuf) {
684         int requested_view;
685         visit vbuf;
686
687         if (CtdlAccessCheck(ac_logged_in)) {
688                 return;
689         }
690
691         requested_view = extract_int(cmdbuf, 0);
692
693         CtdlGetRelationship(&vbuf, &CC->user, &CC->room);
694         vbuf.v_view = requested_view;
695         CtdlSetRelationship(&vbuf, &CC->user, &CC->room);
696         
697         cprintf("%d ok\n", CIT_OK);
698 }
699
700
701 /*
702  * Rename a user
703  */
704 void cmd_renu(char *cmdbuf)
705 {
706         int retcode;
707         char oldname[USERNAME_SIZE];
708         char newname[USERNAME_SIZE];
709
710         if (CtdlAccessCheck(ac_aide)) {
711                 return;
712         }
713
714         extract_token(oldname, cmdbuf, 0, '|', sizeof oldname);
715         extract_token(newname, cmdbuf, 1, '|', sizeof newname);
716
717         retcode = rename_user(oldname, newname);
718         switch(retcode) {
719                 case RENAMEUSER_OK:
720                         cprintf("%d '%s' has been renamed to '%s'.\n", CIT_OK, oldname, newname);
721                         return;
722                 case RENAMEUSER_LOGGED_IN:
723                         cprintf("%d '%s' is currently logged in and cannot be renamed.\n",
724                                 ERROR + ALREADY_LOGGED_IN , oldname);
725                         return;
726                 case RENAMEUSER_NOT_FOUND:
727                         cprintf("%d '%s' does not exist.\n", ERROR + NO_SUCH_USER, oldname);
728                         return;
729                 case RENAMEUSER_ALREADY_EXISTS:
730                         cprintf("%d A user named '%s' already exists.\n", ERROR + ALREADY_EXISTS, newname);
731                         return;
732         }
733
734         cprintf("%d An unknown error occurred.\n", ERROR);
735 }
736
737
738
739 void cmd_quit(char *argbuf)
740 {
741         cprintf("%d Goodbye.\n", CIT_OK);
742         CC->kill_me = KILLME_CLIENT_LOGGED_OUT;
743 }
744
745
746 void cmd_lout(char *argbuf)
747 {
748         if (CC->logged_in) 
749                 CtdlUserLogout();
750         cprintf("%d logged out.\n", CIT_OK);
751 }
752
753
754 /*****************************************************************************/
755 /*                      MODULE INITIALIZATION STUFF                          */
756 /*****************************************************************************/
757
758
759 CTDL_MODULE_INIT(serv_user)
760 {
761         if (!threading) {
762                 CtdlRegisterProtoHook(cmd_user, "USER", "Submit username for login");
763                 CtdlRegisterProtoHook(cmd_pass, "PASS", "Complete login by submitting a password");
764                 CtdlRegisterProtoHook(cmd_quit, "QUIT", "log out and disconnect from server");
765                 CtdlRegisterProtoHook(cmd_lout, "LOUT", "log out but do not disconnect from server");
766                 CtdlRegisterProtoHook(cmd_creu, "CREU", "Create User");
767                 CtdlRegisterProtoHook(cmd_setp, "SETP", "Set the password for an account");
768                 CtdlRegisterProtoHook(cmd_getu, "GETU", "Get User parameters");
769                 CtdlRegisterProtoHook(cmd_setu, "SETU", "Set User parameters");
770                 CtdlRegisterProtoHook(cmd_slrp, "SLRP", "Set Last Read Pointer");
771                 CtdlRegisterProtoHook(cmd_invt, "INVT", "Invite a user to a room");
772                 CtdlRegisterProtoHook(cmd_kick, "KICK", "Kick a user out of a room");
773                 CtdlRegisterProtoHook(cmd_forg, "FORG", "Forget a room");
774                 CtdlRegisterProtoHook(cmd_gnur, "GNUR", "Get Next Unregistered User");
775                 CtdlRegisterProtoHook(cmd_vali, "VALI", "Validate new users");
776                 CtdlRegisterProtoHook(cmd_list, "LIST", "List users");
777                 CtdlRegisterProtoHook(cmd_chek, "CHEK", "assorted info we need to check at login");
778                 CtdlRegisterProtoHook(cmd_qusr, "QUSR", "check to see if a user exists");
779                 CtdlRegisterProtoHook(cmd_agup, "AGUP", "Administratively Get User Parameters");
780                 CtdlRegisterProtoHook(cmd_asup, "ASUP", "Administratively Set User Parameters");
781                 CtdlRegisterProtoHook(cmd_seen, "SEEN", "Manipulate seen/unread message flags");
782                 CtdlRegisterProtoHook(cmd_gtsn, "GTSN", "Fetch seen/unread message flags");
783                 CtdlRegisterProtoHook(cmd_view, "VIEW", "Set preferred view for user/room combination");
784                 CtdlRegisterProtoHook(cmd_renu, "RENU", "Rename a user");
785                 CtdlRegisterProtoHook(cmd_newu, "NEWU", "Log in as a new user");
786                 CtdlRegisterProtoHook(cmd_isme, "ISME", "Determine whether an email address belongs to a user");
787         }
788         /* return our Subversion id for the Log */
789         return "user";
790 }