]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Remove objectionable code from authPosix.c
authorVMware, Inc <>
Mon, 21 May 2012 22:29:00 +0000 (15:29 -0700)
committerDmitry Torokhov <dtor@vmware.com>
Tue, 22 May 2012 18:57:14 +0000 (11:57 -0700)
Auth_AuthenticateUser in authPosix.c, for both the PAM and non-PAM
paths, has a short-circuit enabled by defining ACCEPT_XXX_PASS.  When
defined, anyone can login simply by specifying "XXX" as the password.
There is no evidence this has ever been enabled in production code, but
it's apparently X-rated enough that we want it gone immediately.

Signed-off-by: Dmitry Torokhov <dtor@vmware.com>
open-vm-tools/lib/auth/authPosix.c

index b1fdc2c8c3fa7ed5d9d22da65125442f8bd9a2a4..744b72ced66fd490c51fe9ebd8e17050869adc29 100644 (file)
@@ -276,17 +276,14 @@ Auth_AuthenticateUser(const char *user,  // IN:
    }
 
 #ifdef USE_PAM
-#ifdef ACCEPT_XXX_PASS
-   if (strcmp("XXX", pass) != 0) {
-#endif
-      if (!AuthLoadPAM()) {
-         return NULL;
-      }
+   if (!AuthLoadPAM()) {
+      return NULL;
+   }
 
-      /*
-       * XXX PAM can blow away our syslog level settings so we need
-       * to call Log_InitEx() again before doing any more Log()s
-       */
+   /*
+    * XXX PAM can blow away our syslog level settings so we need
+    * to call Log_InitEx() again before doing any more Log()s
+    */
 
 #define PAM_BAIL if (pam_error != PAM_SUCCESS) { \
                   Log_Error("%s:%d: PAM failure - %s (%d)\n", \
@@ -295,32 +292,29 @@ Auth_AuthenticateUser(const char *user,  // IN:
                   dlpam_end(pamh, pam_error); \
                   return NULL; \
                  }
-      PAM_username = user;
-      PAM_password = pass;
+   PAM_username = user;
+   PAM_password = pass;
 
 #if defined(VMX86_TOOLS)
-      pam_error = dlpam_start("vmtoolsd", PAM_username, &PAM_conversation,
-                              &pamh);
+   pam_error = dlpam_start("vmtoolsd", PAM_username, &PAM_conversation,
+                           &pamh);
 #else
-      pam_error = dlpam_start("vmware-authd", PAM_username, &PAM_conversation,
-                              &pamh);
+   pam_error = dlpam_start("vmware-authd", PAM_username, &PAM_conversation,
+                           &pamh);
 #endif
-      if (pam_error != PAM_SUCCESS) {
-         Log("Failed to start PAM (error = %d).\n", pam_error);
-         return NULL;
-      }
+   if (pam_error != PAM_SUCCESS) {
+      Log("Failed to start PAM (error = %d).\n", pam_error);
+      return NULL;
+   }
 
-      pam_error = dlpam_authenticate(pamh, 0);
-      PAM_BAIL;
-      pam_error = dlpam_acct_mgmt(pamh, 0);
-      PAM_BAIL;
-      pam_error = dlpam_setcred(pamh, PAM_ESTABLISH_CRED);
-      PAM_BAIL;
-      dlpam_end(pamh, PAM_SUCCESS);
+   pam_error = dlpam_authenticate(pamh, 0);
+   PAM_BAIL;
+   pam_error = dlpam_acct_mgmt(pamh, 0);
+   PAM_BAIL;
+   pam_error = dlpam_setcred(pamh, PAM_ESTABLISH_CRED);
+   PAM_BAIL;
+   dlpam_end(pamh, PAM_SUCCESS);
 
-#if ACCEPT_XXX_PASS
-   }
-#endif
    /* If this point is reached, the user has been authenticated. */
    setpwent();
    pwd = Posix_Getpwnam(user);
@@ -344,11 +338,7 @@ Auth_AuthenticateUser(const char *user,  // IN:
    if (*pwd->pw_passwd != '\0') {
       char *namep = (char *) crypt(pass, pwd->pw_passwd);
 
-      if (strcmp(namep, pwd->pw_passwd)
-#ifdef ACCEPT_XXX_PASS
-          && strcmp("XXX", pass) != 0
-#endif
-          ) {
+      if (strcmp(namep, pwd->pw_passwd) != 0) {
          // Incorrect password
          return NULL;
       }