]> code.citadel.org Git - citadel.git/blobdiff - citadel/server/user_ops.c
GOTO no longer counts newly arrived mail in the inbox. BIFF now does this.
[citadel.git] / citadel / server / user_ops.c
index d45e5004469d69739dc7adc5d1805af2988ce2dd..d907074a4f88fb8367bbc3af755cc8a596f48ad1 100644 (file)
@@ -4,11 +4,6 @@
 //
 // 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.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
 
 #include <stdlib.h>
 #include <unistd.h>
@@ -475,14 +470,15 @@ int CtdlLoginExistingUser(const char *trythisname) {
 
        if (trythisname == NULL) return login_not_found;
        
-       if (!strncasecmp(trythisname, "SYS_", 4)) {
-               syslog(LOG_DEBUG, "user_ops: system user \"%s\" is not allowed to log in.", trythisname);
-               return login_not_found;
-       }
+       // We handle this a different way now (see below)
+       //if (!strncasecmp(trythisname, "SYS_", 4)) {
+               //syslog(LOG_DEBUG, "user_ops: system user \"%s\" is not allowed to log in.", trythisname);
+               //return login_not_found;
+       //}
 
        // Continue attempting user validation...
        safestrncpy(username, trythisname, sizeof (username));
-       striplt(username);
+       string_trim(username);
 
        if (IsEmptyStr(username)) {
                return login_not_found;
@@ -496,13 +492,8 @@ int CtdlLoginExistingUser(const char *trythisname) {
        
                syslog(LOG_DEBUG, "user_ops: asking host about <%s>", username);
 #ifdef HAVE_GETPWNAM_R
-#ifdef SOLARIS_GETPWUID
-               syslog(LOG_DEBUG, "user_ops: calling getpwnam_r()");
-               tempPwdPtr = getpwnam_r(username, &pd, pwdbuffer, sizeof pwdbuffer);
-#else // SOLARIS_GETPWUID
                syslog(LOG_DEBUG, "user_ops: calling getpwnam_r()");
                getpwnam_r(username, &pd, pwdbuffer, sizeof pwdbuffer, &tempPwdPtr);
-#endif // SOLARIS_GETPWUID
 #else // HAVE_GETPWNAM_R
                syslog(LOG_DEBUG, "user_ops: SHOULD NEVER GET HERE!!!");
                tempPwdPtr = NULL;
@@ -567,7 +558,8 @@ int CtdlLoginExistingUser(const char *trythisname) {
        }
 
        // User 0 is a system account and must not be used by a real user
-       if (&CC->user.usernum <= 0) {
+       if (CC->user.usernum <= 0) {
+               syslog(LOG_DEBUG, "user_ops: system account <%s> is not allowed to log in.", trythisname);
                return login_not_found;
        }
 
@@ -1126,7 +1118,8 @@ void ForEachUser(void (*CallBack) (char *, void *out_data), void *in_data) {
 }
 
 
-// Count the number of new mail messages the user has
+// Return the number of new messages that have arrived in the user's inbox while they were logged in.
+// Resets to zero when called.
 int NewMailCount() {
        int num_newmsgs = 0;
        num_newmsgs = CC->newmail;