remove duplicate assignments; don't compare twice if first is successfull.
authorWilfried Goesgens <dothebart@citadel.org>
Sat, 26 May 2012 13:26:55 +0000 (15:26 +0200)
committerWilfried Goesgens <dothebart@citadel.org>
Sat, 26 May 2012 13:26:55 +0000 (15:26 +0200)
citadel/user_ops.c

index 2ca3b4220ddfb43c754da98643c37ccbbeacc047..c29a5613b1561fc84be89bf64dcb8c0c23ce3d49 100644 (file)
@@ -945,7 +945,6 @@ int CtdlTryPassword(const char *password, long len)
                CONM_syslog(LOG_INFO, "CtdlTryPassword: NULL password string supplied\n");
                return pass_wrong_password;
        }
-       code = (-1);
 
        if (CCC->is_master) {
                code = strcmp(password, config.c_master_pass);
@@ -1004,9 +1003,11 @@ int CtdlTryPassword(const char *password, long len)
                strproc(pw);
                strproc(CCC->user.password);
                code = strcasecmp(CCC->user.password, pw);
-               strproc(pw);
-               strproc(CCC->user.password);
-               code = strcasecmp(CCC->user.password, pw);
+               if (code != 0) {
+                       strproc(pw);
+                       strproc(CCC->user.password);
+                       code = strcasecmp(CCC->user.password, pw);
+               }
                free (pw);
        }