]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Fix processing of server overrides without port numbers (STR #4675)
authormsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>
Thu, 30 Jul 2015 15:00:26 +0000 (15:00 +0000)
committermsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>
Thu, 30 Jul 2015 15:00:26 +0000 (15:00 +0000)
git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@12812 a1ca3aef-8c08-0410-bb20-df032aa958be

CHANGES-2.0.txt
cups/usersys.c

index ff74331c65c2add35e70c963da5238c9aef298aa..6128b02d29e59086825f5c791feac8bf7bff2f0e 100644 (file)
@@ -11,6 +11,7 @@ CHANGES IN CUPS V2.0.4
        - Fixed an RPM spec file issue (STR #4657)
        - The scheduler incorrectly started jobs while canceling multiple jobs
          (STR #4648)
+       - Fixed processing of server overrides without port numbers (STR #4675)
        - Documentation changes (STR #4651)
 
 
index 77ee7fc65d7a5e0965c32d7fa64f6174eaefe430..4273df7151e8943dfe2acc1dd241c477b1317797 100644 (file)
@@ -68,6 +68,7 @@ typedef struct _cups_client_conf_s    /**** client.conf config data ****/
 static void    cups_finalize_client_conf(_cups_client_conf_t *cc);
 static void    cups_init_client_conf(_cups_client_conf_t *cc);
 static void    cups_read_client_conf(cups_file_t *fp, _cups_client_conf_t *cc);
+static void    cups_set_default_ipp_port(_cups_globals_t *cg);
 static void    cups_set_encryption(_cups_client_conf_t *cc, const char *value);
 #ifdef HAVE_GSSAPI
 static void    cups_set_gss_service_name(_cups_client_conf_t *cc, const char *value);
@@ -382,6 +383,9 @@ cupsSetServer(const char *server)   /* I - Server name */
       cg->ipp_port = atoi(port);
     }
 
+    if (!cg->ipp_port)
+      cups_set_default_ipp_port(cg);
+
     if (cg->server[0] == '/')
       strlcpy(cg->servername, "localhost", sizeof(cg->servername));
     else
@@ -392,6 +396,7 @@ cupsSetServer(const char *server)   /* I - Server name */
     cg->server[0]      = '\0';
     cg->servername[0]  = '\0';
     cg->server_version = 20;
+    cg->ipp_port       = 0;
   }
 
   if (cg->http)
@@ -908,17 +913,7 @@ _cupsSetDefaults(void)
     cupsSetServer(cc.server_name);
 
   if (!cg->ipp_port)
-  {
-    const char *ipp_port;              /* IPP_PORT environment variable */
-
-    if ((ipp_port = getenv("IPP_PORT")) != NULL)
-    {
-      if ((cg->ipp_port = atoi(ipp_port)) <= 0)
-        cg->ipp_port = CUPS_DEFAULT_IPP_PORT;
-    }
-    else
-      cg->ipp_port = CUPS_DEFAULT_IPP_PORT;
-  }
+    cups_set_default_ipp_port(cg);
 
   if (!cg->user[0])
     strlcpy(cg->user, cc.user, sizeof(cg->user));
@@ -1150,6 +1145,26 @@ cups_read_client_conf(
 }
 
 
+/*
+ * 'cups_set_default_ipp_port()' - Set the default IPP port value.
+ */
+
+static void
+cups_set_default_ipp_port(
+    _cups_globals_t *cg)               /* I - Global data */
+{
+  const char   *ipp_port;              /* IPP_PORT environment variable */
+
+
+  if ((ipp_port = getenv("IPP_PORT")) != NULL)
+  {
+    if ((cg->ipp_port = atoi(ipp_port)) <= 0)
+      cg->ipp_port = CUPS_DEFAULT_IPP_PORT;
+  }
+  else
+    cg->ipp_port = CUPS_DEFAULT_IPP_PORT;
+}
+
 /*
  * 'cups_set_encryption()' - Set the Encryption value.
  */