Removed the 'master user' feature ... if we still need this we'll find another way
authorArt Cancro <ajc@citadel.org>
Thu, 20 Dec 2018 22:12:07 +0000 (17:12 -0500)
committerArt Cancro <ajc@citadel.org>
Thu, 20 Dec 2018 22:12:07 +0000 (17:12 -0500)
14 files changed:
citadel/config.c
citadel/context.h
citadel/control.c
citadel/include/ctdl_module.h
citadel/modules/ctdlproto/serv_user.c
citadel/modules/imap/serv_imap.c
citadel/modules/managesieve/serv_managesieve.c
citadel/modules/nntp/serv_nntp.c
citadel/modules/pop3/serv_pop3.c
citadel/modules/smtp/serv_smtp.c
citadel/modules/xmpp/xmpp_sasl_service.c
citadel/user_ops.c
textclient/tuiconfig.c
webcit/static/t/aide/siteconfig/tab_access.html

index 907d27fce7b98a06703ed632e2584600d44c1666..2507abfee037e042aee267c0ca7fc7a4c0277738 100644 (file)
@@ -205,8 +205,6 @@ void migrate_legacy_config(struct legacy_config *lconfig)
        CtdlSetConfigInt(       "c_managesieve_port"    ,       lconfig->c_managesieve_port     );
        CtdlSetConfigInt(       "c_auth_mode"           ,       lconfig->c_auth_mode            );
        CtdlSetConfigInt(       "c_rbl_at_greeting"     ,       lconfig->c_rbl_at_greeting      );
-       CtdlSetConfigStr(       "c_master_user"         ,       lconfig->c_master_user          );
-       CtdlSetConfigStr(       "c_master_pass"         ,       lconfig->c_master_pass          );
        CtdlSetConfigStr(       "c_pager_program"       ,       lconfig->c_pager_program        );
        CtdlSetConfigInt(       "c_imap_keep_from"      ,       lconfig->c_imap_keep_from       );
        CtdlSetConfigInt(       "c_xmpp_c2s_port"       ,       lconfig->c_xmpp_c2s_port        );
index fd486caa34a53e24b383633aa334cb6478f8a06d..585b5b1c7c8a7fe4c5f7a9ce3de7679fd9550645 100644 (file)
@@ -80,7 +80,6 @@ struct CitContext {
        int internal_pgm;       /* authenticated as internal program */
        int nologin;            /* not allowed to log in */
        int curr_view;          /* The view type for the current user/room */
-       int is_master;          /* Is this session logged in using the master user? */
 
        time_t previous_login;  /* Date/time of previous login */
        char lastcmdname[5];    /* name of last command executed */
index cf587a0443c9e89bd273a22348fbbc04a7de3a41..6f3a1d7ec447bd53b2a92c933db4e79bb9b65c2c 100644 (file)
@@ -318,8 +318,8 @@ void cmd_conf(char *argbuf)
                cprintf("\n");
                cprintf("\n");
                cprintf("%d\n",         CtdlGetConfigInt("c_rbl_at_greeting"));
-               cprintf("%s\n",         CtdlGetConfigStr("c_master_user"));
-               cprintf("%s\n",         CtdlGetConfigStr("c_master_pass"));
+               cprintf("\n");
+               cprintf("\n");
                cprintf("%s\n",         CtdlGetConfigStr("c_pager_program"));
                cprintf("%d\n",         CtdlGetConfigInt("c_imap_keep_from"));
                cprintf("%d\n",         CtdlGetConfigInt("c_xmpp_c2s_port"));
@@ -538,10 +538,10 @@ void cmd_conf(char *argbuf)
                                CtdlSetConfigInt("c_rbl_at_greeting", confbool(buf));
                                break;
                        case 58:
-                               CtdlSetConfigStr("c_master_user", buf);
+                               /* niu */
                                break;
                        case 59:
-                               CtdlSetConfigStr("c_master_pass", buf);
+                               /* niu */
                                break;
                        case 60:
                                CtdlSetConfigStr("c_pager_program", buf);
index 3b3d794c3531c79945ad8e9f84435ba3ac5d6973..1f5c8fcfb4c1bf25eea6d9d2a8418f760552be2d 100644 (file)
@@ -375,7 +375,7 @@ int CtdlGetUserByNumber(struct ctdluser *usbuf, long number);
 void CtdlGetRelationship(visit *vbuf, struct ctdluser *rel_user, struct ctdlroom *rel_room);
 void CtdlSetRelationship(visit *newvisit, struct ctdluser *rel_user, struct ctdlroom *rel_room);
 void CtdlMailboxName(char *buf, size_t n, const struct ctdluser *who, const char *prefix);
-int CtdlLoginExistingUser(char *authname, const char *username);
+int CtdlLoginExistingUser(const char *username);
 
 /*
  * Values which may be returned by CtdlLoginExistingUser()
index 5f8e9791bfdbcf5dca73f6db6556a22a1e2c49fb..48799de77d955c73e92bae7599d2c4affd8f1c0b 100644 (file)
@@ -1,7 +1,7 @@
 /* 
  * Server functions which perform operations on user objects.
  *
- * Copyright (c) 1987-2017 by the citadel.org team
+ * Copyright (c) 1987-2018 by the citadel.org team
  *
  * This program is open source software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License, version 3.
@@ -34,7 +34,7 @@ void cmd_user(char *cmdbuf)
        striplt(username);
        syslog(LOG_DEBUG, "user_ops: cmd_user(%s)", username);
 
-       a = CtdlLoginExistingUser(NULL, username);
+       a = CtdlLoginExistingUser(username);
        switch (a) {
        case login_already_logged_in:
                cprintf("%d Already logged in.\n", ERROR + ALREADY_LOGGED_IN);
@@ -162,11 +162,6 @@ 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;
-       }
 
        if (!strcasecmp(new_pw, "GENERATE_RANDOM_PASSWORD")) {
                char random_password[17];
index e3c55ae4ff7739a718f165f323fc7daa5ae5d62b..7bc97b6ed9745e216117c9edd111d6703410c892 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * IMAP server for the Citadel system
  *
- * Copyright (C) 2000-2017 by Art Cancro and others.
+ * Copyright (C) 2000-2018 by Art Cancro and others.
  * This code is released under the terms of the GNU General Public License.
  *
  * WARNING: the IMAP protocol is badly designed.  No implementation of it
@@ -628,7 +628,7 @@ void imap_login(int num_parms, ConstStr *Params)
                        return;
                }
        case 4:
-               if (CtdlLoginExistingUser(NULL, Params[2].Key) == login_ok) {
+               if (CtdlLoginExistingUser(Params[2].Key) == login_ok) {
                        if (CtdlTryPassword(Params[3].Key, Params[3].len) == pass_ok) {
                                /* hm, thats not doable by IReply :-( */
                                IAPrintf("%s OK [", Params[0].Key);
@@ -744,10 +744,10 @@ void imap_auth_plain(void)
        Imap->authstate = imap_as_normal;
 
        if (!IsEmptyStr(ident)) {
-               result = CtdlLoginExistingUser(user, ident);
+               result = CtdlLoginExistingUser(ident);
        }
        else {
-               result = CtdlLoginExistingUser(NULL, user);
+               result = CtdlLoginExistingUser(user);
        }
 
        if (result == login_ok) {
@@ -768,7 +768,7 @@ void imap_auth_login_user(long state)
        switch (state){
        case imap_as_expecting_username:
                StrBufDecodeBase64(Imap->Cmd.CmdBuf);
-               CtdlLoginExistingUser(NULL, ChrPtr(Imap->Cmd.CmdBuf));
+               CtdlLoginExistingUser(ChrPtr(Imap->Cmd.CmdBuf));
                size_t len = CtdlEncodeBase64(PWBuf, "Password:", 9, 0);
                if (PWBuf[len - 1] == '\n') {
                        PWBuf[len - 1] = '\0';
@@ -780,7 +780,7 @@ void imap_auth_login_user(long state)
                return;
        case imap_as_expecting_multilineusername:
                extract_token(PWBuf, ChrPtr(Imap->Cmd.CmdBuf), 1, ' ', sizeof(PWBuf));
-               CtdlLoginExistingUser(NULL, ChrPtr(Imap->Cmd.CmdBuf));
+               CtdlLoginExistingUser(ChrPtr(Imap->Cmd.CmdBuf));
                IAPuts("+ go ahead\r\n");
                Imap->authstate = imap_as_expecting_multilinepassword;
                return;
index 6bfe112643cc460a5a9d0c5958f971aa9a46a989..e085d5991a1691a7988e8df2f4c3f2c8afbef794 100644 (file)
@@ -6,7 +6,7 @@
  * as this draft expires with this writing, you might need to search for
  * the new one.
  *
- * Copyright (c) 2007-2015 by the citadel.org team
+ * Copyright (c) 2007-2018 by the citadel.org team
  *
  * This program is open source software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 3.
@@ -284,7 +284,7 @@ void cmd_mgsve_auth(int num_parms, char **parms, struct sdm_userdata *u)
                if ((*username == '\0') && (*(username + 1) != '\0'))
                        username ++;
                
-               if (login_ok == CtdlLoginExistingUser(NULL, username))
+               if (login_ok == CtdlLoginExistingUser(username))
                {
                        char *pass;
 
index 9e77f8dae5c7b6ccaa01fed9312f03297355913d..14f75db6ce32328f38133dec8e5a044648707270 100644 (file)
@@ -1,7 +1,7 @@
 //
 // NNTP server module (RFC 3977)
 //
-// Copyright (c) 2014-2015 by the citadel.org team
+// Copyright (c) 2014-2018 by the citadel.org team
 //
 // This program is open source software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License version 3.
@@ -278,7 +278,7 @@ void nntp_cleanup(void)
 //
 void nntp_authinfo_user(const char *username)
 {
-       int a = CtdlLoginExistingUser(NULL, username);
+       int a = CtdlLoginExistingUser(username);
        switch (a) {
        case login_already_logged_in:
                cprintf("482 Already logged in\r\n");
index 0b20e005956689fafa95a4ea72515a18bfc7edfe..3058ef315f76cac0fa52a8ab9f3845a173c41db4 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * POP3 service for the Citadel system
  *
- * Copyright (c) 1998-2017 by the citadel.org team
+ * Copyright (c) 1998-2018 by the citadel.org team
  *
  * This program is open source software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 3.
@@ -133,7 +133,7 @@ void pop3_user(char *argbuf)
        strcpy(username, argbuf);
        striplt(username);
 
-       if (CtdlLoginExistingUser(NULL, username) == login_ok) {
+       if (CtdlLoginExistingUser(username) == login_ok) {
                cprintf("+OK Password required for %s\r\n", username);
        }
        else {
index c8cd7017328d3eb017cd52111f8b70441c8d1233..b7ee16a693da15c0fa14789e12ba67b041226b0f 100644 (file)
@@ -407,7 +407,7 @@ void smtp_get_user(long offset)
 
        StrBufDecodeBase64(sSMTP->Cmd);
 
-       if (CtdlLoginExistingUser(NULL, ChrPtr(sSMTP->Cmd)) == login_ok) {
+       if (CtdlLoginExistingUser(ChrPtr(sSMTP->Cmd)) == login_ok) {
                size_t len = CtdlEncodeBase64(buf, "Password:", 9, 0);
 
                if (buf[len - 1] == '\n') {
@@ -492,10 +492,10 @@ void smtp_try_plain(long offset, long Flags)
        sSMTP->command_state = smtp_command;
 
        if (!IsEmptyStr(ident)) {
-               result = CtdlLoginExistingUser(user, ident);
+               result = CtdlLoginExistingUser(ident);
        }
        else {
-               result = CtdlLoginExistingUser(NULL, user);
+               result = CtdlLoginExistingUser(user);
        }
 
        if (result == login_ok) {
index da76374987a8a1e81fa377d3a4207072f622a421..1b2e98ae98197697b75a60f955127dfdef335d0f 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Note: RFC3920 says we "must" support DIGEST-MD5 but we only support PLAIN.
  *
- * Copyright (c) 2007-2009 by Art Cancro
+ * Copyright (c) 2007-2018 by Art Cancro
  *
  * This program is open source software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 3.
@@ -64,7 +64,7 @@ int xmpp_auth_plain(char *authstring)
        char pass[256];
        int result;
        long len;
-
+       int i;
 
        /* Take apart the authentication string */
        memset(pass, 0, sizeof(pass));
@@ -80,16 +80,24 @@ int xmpp_auth_plain(char *authstring)
         * do not allow spaces so we can tell the user to substitute underscores if their
         * login name contains spaces.
         */
-       convert_spaces_to_underscores(ident);
-       convert_spaces_to_underscores(user);
+       for (i=0; ident[i]!=0; ++i) {
+               if (ident[i] == '_') {
+                       ident[i] = ' ';
+               }
+       }
+       for (i=0; user[i]!=0; ++i) {
+               if (user[i] == '_') {
+                       user[i] = ' ';
+               }
+       }
 
        /* Now attempt authentication */
 
        if (!IsEmptyStr(ident)) {
-               result = CtdlLoginExistingUser(user, ident);
+               result = CtdlLoginExistingUser(ident);
        }
        else {
-               result = CtdlLoginExistingUser(NULL, user);
+               result = CtdlLoginExistingUser(user);
        }
 
        if (result == login_ok) {
@@ -153,7 +161,7 @@ void xmpp_non_sasl_authenticate(char *iq_id, char *username, char *password) {
 
         if (CC->logged_in) CtdlUserLogout();  /* Client may try to log in twice.  Handle this. */
 
-       result = CtdlLoginExistingUser(NULL, username);
+       result = CtdlLoginExistingUser(username);
        if (result == login_ok) {
                result = CtdlTryPassword(password, strlen(password));
                if (result == pass_ok) {
index dab7f296baed524f125cc5f849672ad6f5805998..397907524e91c04d91a5f8dd4930be81cc4307d7 100644 (file)
@@ -475,15 +475,13 @@ int getuserbyuid(struct ctdluser *usbuf, uid_t number)
 
 /*
  * Back end for cmd_user() and its ilk
- *
- * NOTE: "authname" should only be used if we are attempting to use the "master user" feature
  */
-int CtdlLoginExistingUser(char *authname, const char *trythisname)
+int CtdlLoginExistingUser(const char *trythisname)
 {
        char username[SIZ];
        int found_user;
 
-       syslog(LOG_DEBUG, "user_ops: CtdlLoginExistingUser(%s, %s)", authname, trythisname);
+       syslog(LOG_DEBUG, "user_ops: CtdlLoginExistingUser(%s)", trythisname);
 
        if ((CC->logged_in)) {
                return login_already_logged_in;
@@ -497,16 +495,6 @@ int CtdlLoginExistingUser(char *authname, const char *trythisname)
                return login_not_found;
        }
 
-       /* If a "master user" is defined, handle its authentication if specified */
-       CC->is_master = 0;
-       if (    (!IsEmptyStr(CtdlGetConfigStr("c_master_user"))) && 
-               (!IsEmptyStr(CtdlGetConfigStr("c_master_pass"))) &&
-               (authname != NULL) &&
-               (!strcasecmp(authname, CtdlGetConfigStr("c_master_user"))) )
-       {
-               CC->is_master = 1;
-       }
-
        /* Continue attempting user validation... */
        safestrncpy(username, trythisname, sizeof (username));
        striplt(username);
@@ -725,7 +713,6 @@ void CtdlUserLogout(void)
        /* Clear out the user record in memory so we don't behave like a ghost */
        memset(&CCC->user, 0, sizeof(struct ctdluser));
        CCC->curr_user[0] = 0;
-       CCC->is_master = 0;
        CCC->cs_inet_email[0] = 0;
        CCC->cs_inet_other_emails[0] = 0;
        CCC->cs_inet_fn[0] = 0;
@@ -846,10 +833,6 @@ int CtdlTryPassword(const char *password, long len)
                return pass_wrong_password;
        }
 
-       if (CCC->is_master) {
-               code = strcmp(password, CtdlGetConfigStr("c_master_pass"));
-       }
-
        else if (CtdlGetConfigInt("c_auth_mode") == AUTHMODE_HOST) {
 
                /* host auth mode */
index 48e009750acb22fad6966044455ae5bd103cc8a1..80f0c94feb06a93b0c2040f74e368790f79d3400 100644 (file)
@@ -261,19 +261,6 @@ void do_system_configuration(CtdlIPC * ipc)
                sc[60][0] = 0;
        }
 
-       /* Master user account */
-       int yes_muacct = 0;
-       if (strlen(sc[58]) > 0)
-               yes_muacct = 1;
-       yes_muacct = boolprompt("Enable a 'master user' account", yes_muacct);
-       if (yes_muacct) {
-               strprompt("Master user name", &sc[58][0], 31);
-               strprompt("Master user password", &sc[59][0], -31);
-       } else {
-               strcpy(&sc[58][0], "");
-               strcpy(&sc[59][0], "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
-       }
-
        /* Save it */
        scr_printf("Save this configuration? ");
        if (yesno()) {
index a1dfb7d9f77a182b29654bdd9fe50c8fa24126d6..c334a3b77007eee5e74c3855f772872b6ac1465e 100644 (file)
 <tr><td><?_("Allow anonymous guest access")></td><td>
 <input type="checkbox" NAME="c_guest_logins" VALUE="yes" <?%("COND:SERVCFG", 1, "c_guest_logins", 1, "CHECKED", "")>></td></tr>
 
-<tr><td><?_("Master user name (blank to disable)")></td><td>
-<input type="text" NAME="c_master_user" MAXLENGTH="31" VALUE='<?SERV:CFG("c_master_user")>'></td></tr>
-
-<tr><td><?_("Master user password")></td><td>
-<input type="password" NAME="c_master_pass" MAXLENGTH="31" VALUE='<?SERV:CFG("c_master_pass")>'></td></tr>
-<tr><td colspan=2><hr></td></tr>
-
-
 <tr><td><?_("Initial access level for new users")></td><td>
 <select name="c_initax" size="1">
        <option <?%("COND:SERVCFG", 1, "c_initax", 0, 'selected="selected"', "")> value="0">0 - <?_("Deleted")></option>