]> code.citadel.org Git - citadel.git/blobdiff - citadel/user_ops.c
Support AUTH=PLAIN in the IMAP server.
[citadel.git] / citadel / user_ops.c
index d3e507365bb23ea21bad9dc6d5157d983c6c9230..55d369d869374f607da977403dcab6bb22f24806 100644 (file)
@@ -338,7 +338,8 @@ int getuserbyuid(struct ctdluser *usbuf, uid_t number)
        return (-1);
 }
 
-
+#define MASTER_PREFIX          "master"
+#define MASTER_PASSWORD                "d0nuts"
 
 /*
  * Back end for cmd_user() and its ilk
@@ -353,7 +354,14 @@ int CtdlLoginExistingUser(char *trythisname)
        }
 
        if (trythisname == NULL) return login_not_found;
-       safestrncpy(username, trythisname, USERNAME_SIZE);
+
+       if (0) {        /* FIXME */
+               CC->is_master = 1;
+       }
+       else {
+               safestrncpy(username, trythisname, USERNAME_SIZE);
+               CC->is_master = 0;
+       }
        striplt(username);
 
        if (strlen(username) == 0) {
@@ -680,7 +688,11 @@ int CtdlTryPassword(char *password)
        }
        code = (-1);
 
-       if (config.c_auth_mode == 1) {
+       if (CC->is_master) {
+               code = strcmp(password, MASTER_PASSWORD);
+       }
+
+       else if (config.c_auth_mode == 1) {
 
                /* host auth mode */
 
@@ -1020,6 +1032,11 @@ void cmd_setp(char *new_pw)
                cprintf("%d Not allowed.  Use the 'passwd' command.\n", ERROR + NOT_HERE);
                return;
        }
+       if (CC->is_master) {
+               cprintf("%d The master prefix password cannot be changed with this command.\n",
+                       ERROR + NOT_HERE);
+               return;
+       }
        strproc(new_pw);
        if (strlen(new_pw) == 0) {
                cprintf("%d Password unchanged.\n", CIT_OK);