]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Mirror fixes from trunk.
authormsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>
Mon, 9 Jun 2014 18:58:16 +0000 (18:58 +0000)
committermsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>
Mon, 9 Jun 2014 18:58:16 +0000 (18:58 +0000)
git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/branches/branch-1.7@11909 a1ca3aef-8c08-0410-bb20-df032aa958be

CHANGES.txt
backend/ipp.c
backend/lpd.c
backend/socket.c
cups/usersys.c

index 732245499697b73408a23f5f7ad14799bd3a46fb..d6fdaca9f8353a8f8f72453ed49a35c6e4c8d38a 100644 (file)
@@ -5,6 +5,9 @@ CHANGES IN CUPS V1.7.4
 
        - CUPS did not compile when Avahi or mDNSResponder was not present
          (STR #4402, STR #4424)
+       - The "snmp" option did not work with the network backends (STR #4422)
+       - The User directive in client.conf did not override the USER
+         environment variable (STR #4426)
 
 
 CHANGES IN CUPS V1.7.3
index f36e3720f7a01ba1cc9c2a5869711e15a23b095b..7919c228f85c9590d581cf75edeeb5064050632d 100644 (file)
@@ -528,8 +528,8 @@ main(int  argc,                             /* I - Number of command-line args */
          */
 
          snmp_enabled = !value[0] || !_cups_strcasecmp(value, "on") ||
-                        _cups_strcasecmp(value, "yes") ||
-                        _cups_strcasecmp(value, "true");
+                        !_cups_strcasecmp(value, "yes") ||
+                        !_cups_strcasecmp(value, "true");
       }
       else if (!_cups_strcasecmp(name, "version"))
       {
index d73d1bcf0894ee5b871ccbc6087e594f80ab3f17..faf71aff5c07d58134b100c6ec556188b82bed8e 100644 (file)
@@ -393,8 +393,8 @@ main(int  argc,                             /* I - Number of command-line arguments (6 or 7) */
          */
 
          snmp_enabled = !value[0] || !_cups_strcasecmp(value, "on") ||
-                        _cups_strcasecmp(value, "yes") ||
-                        _cups_strcasecmp(value, "true");
+                        !_cups_strcasecmp(value, "yes") ||
+                        !_cups_strcasecmp(value, "true");
       }
       else if (!_cups_strcasecmp(name, "timeout"))
       {
index ebed1361b476f6c5d220e32be9496f6d00629128..4767a2d16b02832872eb0bba4d3cc5dff6288059 100644 (file)
@@ -250,8 +250,8 @@ main(int  argc,                             /* I - Number of command-line arguments (6 or 7) */
          */
 
          snmp_enabled = !value[0] || !_cups_strcasecmp(value, "on") ||
-                        _cups_strcasecmp(value, "yes") ||
-                        _cups_strcasecmp(value, "true");
+                        !_cups_strcasecmp(value, "yes") ||
+                        !_cups_strcasecmp(value, "true");
       }
       else if (!_cups_strcasecmp(name, "contimeout"))
       {
index 4b233ee7e006d9cd36e4341c833d3542b6ea6c7f..b732d4b995c918a1bacc5063fb399adf7d88c549 100644 (file)
@@ -3,7 +3,7 @@
  *
  * User, system, and password routines for CUPS.
  *
- * Copyright 2007-2013 by Apple Inc.
+ * Copyright 2007-2014 by Apple Inc.
  * Copyright 1997-2006 by Easy Software Products.
  *
  * These coded instructions, statements, and computer programs are the
@@ -851,29 +851,7 @@ _cupsSetDefaults(void)
   cups_anyroot       = getenv("CUPS_ANYROOT");
   cups_expiredroot    = getenv("CUPS_EXPIREDROOT");
   cups_expiredcerts   = getenv("CUPS_EXPIREDCERTS");
-
-  if ((cups_user = getenv("CUPS_USER")) == NULL)
-  {
-#ifndef WIN32
-   /*
-    * Try the USER environment variable...
-    */
-
-    if ((cups_user = getenv("USER")) != NULL)
-    {
-     /*
-      * Validate USER matches the current UID, otherwise don't allow it to
-      * override things...  This makes sure that printing after doing su or
-      * sudo records the correct username.
-      */
-
-      struct passwd    *pw;            /* Account information */
-
-      if ((pw = getpwnam(cups_user)) == NULL || pw->pw_uid != getuid())
-        cups_user = NULL;
-    }
-#endif /* !WIN32 */
-  }
+  cups_user           = getenv("CUPS_USER");
 
  /*
   * Then, if needed, read the ~/.cups/client.conf or /etc/cups/client.conf
@@ -1089,20 +1067,30 @@ cups_read_client_conf(
       if (!GetUserName(cg->user, &size))
 #else
      /*
-      * Get the user name corresponding to the current UID...
+      * Try the USER environment variable as the default username...
       */
 
-      struct passwd    *pwd;           /* User/password entry */
+      const char *envuser = getenv("USER");
+                                       /* Default username */
+      struct passwd    *pw = NULL;     /* Account information */
 
-      setpwent();
-      if ((pwd = getpwuid(getuid())) != NULL)
+      if (envuser)
       {
        /*
-       * Found a match!
+       * Validate USER matches the current UID, otherwise don't allow it to
+       * override things...  This makes sure that printing after doing su or
+       * sudo records the correct username.
        */
 
-       strlcpy(cg->user, pwd->pw_name, sizeof(cg->user));
+       if ((pw = getpwnam(envuser)) != NULL && pw->pw_uid != getuid())
+         pw = NULL;
       }
+
+      if (!pw)
+        pw = getpwuid(getuid());
+
+      if (pw)
+       strlcpy(cg->user, pw->pw_name, sizeof(cg->user));
       else
 #endif /* WIN32 */
       {