]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Deprecate raw print queues.
authorMichael R Sweet <michael.r.sweet@gmail.com>
Mon, 19 Mar 2018 22:35:22 +0000 (18:35 -0400)
committerMichael R Sweet <michael.r.sweet@gmail.com>
Mon, 19 Mar 2018 22:35:22 +0000 (18:35 -0400)
CHANGES.md
cups/ppd-util.c
man/lpadmin.man
systemv/lpadmin.c

index 746ede33379d2c3e7f1f8e182c142939d5a94cba..26bbdaa4c5a0f2384494bcc9274def5e5c624019 100644 (file)
@@ -22,6 +22,7 @@ Changes in CUPS v2.3rc1
   required a restart (Issue #5263)
 - The IPP Everywhere PPD generator did not include the `cupsJobPassword`
   keyword, when supported (Issue #5265)
+- Raw print queues are now deprecated (Issue #5269)
 - The IPP backend did not properly detect failed PDF prints (rdar://34055474)
 - TLS connections now properly timeout (rdar://34938533)
 - Temp files could not be created in some sandboxed applications
index 62a24901b5f713fa084ffbeacafe74270484d166..294d83927d1fa6975179382f02b4e9888e19675a 100644 (file)
@@ -548,23 +548,16 @@ cups_get_printer_uri(
     int        depth)                  /* I - Depth of query */
 {
   int          i;                      /* Looping var */
-  int          http_port;              /* Port number */
-  http_t       *http2;                 /* Alternate HTTP connection */
   ipp_t                *request,               /* IPP request */
                *response;              /* IPP response */
   ipp_attribute_t *attr;               /* Current attribute */
   char         uri[HTTP_MAX_URI],      /* printer-uri attribute */
                scheme[HTTP_MAX_URI],   /* Scheme name */
-               username[HTTP_MAX_URI], /* Username:password */
-               classname[255],         /* Temporary class name */
-               http_hostname[HTTP_MAX_HOST];
-                                       /* Hostname associated with connection */
+               username[HTTP_MAX_URI]; /* Username:password */
   static const char * const requested_attrs[] =
                {                       /* Requested attributes */
-                 "device-uri",
                  "member-uris",
-                 "printer-uri-supported",
-                 "printer-type"
+                 "printer-uri-supported"
                };
 
 
@@ -586,15 +579,6 @@ cups_get_printer_uri(
 
   DEBUG_printf(("5cups_get_printer_uri: printer-uri=\"%s\"", uri));
 
- /*
-  * Get the hostname and port number we are connected to...
-  */
-
-  httpGetHostname(http, http_hostname, sizeof(http_hostname));
-  http_port = httpAddrPort(http->hostaddr);
-
-  DEBUG_printf(("5cups_get_printer_uri: http_hostname=\"%s\"", http_hostname));
-
  /*
   * Build an IPP_GET_PRINTER_ATTRIBUTES request, which requires the following
   * attributes:
@@ -619,31 +603,7 @@ cups_get_printer_uri(
 
   if ((response = cupsDoRequest(http, request, resource)) != NULL)
   {
-    const char *device_uri = NULL;     /* device-uri value */
-
-    if ((attr = ippFindAttribute(response, "device-uri", IPP_TAG_URI)) != NULL)
-    {
-      device_uri = attr->values[0].string.text;
-      DEBUG_printf(("5cups_get_printer_uri: device-uri=\"%s\"", device_uri));
-    }
-
-    if (device_uri &&
-        (((!strncmp(device_uri, "ipp://", 6) || !strncmp(device_uri, "ipps://", 7)) &&
-         (strstr(device_uri, "/printers/") != NULL || strstr(device_uri, "/classes/") != NULL)) ||
-         ((strstr(device_uri, "._ipp.") != NULL || strstr(device_uri, "._ipps.") != NULL) &&
-          !strcmp(device_uri + strlen(device_uri) - 5, "/cups"))))
-    {
-     /*
-      * Statically-configured shared printer.
-      */
-
-      httpSeparateURI(HTTP_URI_CODING_ALL, _httpResolveURI(device_uri, uri, sizeof(uri), _HTTP_RESOLVE_DEFAULT, NULL, NULL), scheme, sizeof(scheme), username, sizeof(username), host, hostsize, port, resource, resourcesize);
-      ippDelete(response);
-
-      DEBUG_printf(("5cups_get_printer_uri: Resolved to host=\"%s\", port=%d, resource=\"%s\"", host, *port, resource));
-      return (1);
-    }
-    else if ((attr = ippFindAttribute(response, "member-uris", IPP_TAG_URI)) != NULL)
+    if ((attr = ippFindAttribute(response, "member-uris", IPP_TAG_URI)) != NULL)
     {
      /*
       * Get the first actual printer name in the class...
@@ -668,55 +628,6 @@ cups_get_printer_uri(
          return (1);
        }
       }
-
-     /*
-      * No printers in this class - try recursively looking for a printer,
-      * but not more than 3 levels deep...
-      */
-
-      if (depth < 3)
-      {
-       for (i = 0; i < attr->num_values; i ++)
-       {
-         httpSeparateURI(HTTP_URI_CODING_ALL, attr->values[i].string.text,
-                         scheme, sizeof(scheme), username, sizeof(username),
-                         host, hostsize, port, resource, resourcesize);
-         if (!strncmp(resource, "/classes/", 9))
-         {
-          /*
-           * Found a class!  Connect to the right server...
-           */
-
-           if (!_cups_strcasecmp(http_hostname, host) && *port == http_port)
-             http2 = http;
-           else if ((http2 = httpConnect2(host, *port, NULL, AF_UNSPEC, cupsEncryption(), 1, 30000, NULL)) == NULL)
-           {
-             DEBUG_puts("8cups_get_printer_uri: Unable to connect to server");
-
-             continue;
-           }
-
-           /*
-           * Look up printers on that server...
-           */
-
-            strlcpy(classname, resource + 9, sizeof(classname));
-
-            cups_get_printer_uri(http2, classname, host, hostsize, port,
-                                resource, resourcesize, depth + 1);
-
-           /*
-           * Close the connection as needed...
-           */
-
-           if (http2 != http)
-             httpClose(http2);
-
-            if (*host)
-             return (1);
-         }
-       }
-      }
     }
     else if ((attr = ippFindAttribute(response, "printer-uri-supported", IPP_TAG_URI)) != NULL)
     {
index ad73545d7f646817a0cf144e1fe9feac469313a6..ac0ed7ba156974aef7636ca884fc80bb90609ae2 100644 (file)
@@ -6,7 +6,7 @@
 .\"
 .\" Licensed under Apache License v2.0.  See the file "LICENSE" for more information.
 .\"
-.TH lpadmin 8 "CUPS" "1 November 2017" "Apple Inc."
+.TH lpadmin 8 "CUPS" "19 March 2018" "Apple Inc."
 .SH NAME
 lpadmin \- configure cups printers and classes
 .SH SYNOPSIS
@@ -85,6 +85,7 @@ Use the \fI-m\fR option with the
 .BR lpinfo (8)
 command to get a list of supported models.
 The model "raw" clears any existing PPD file and the model "everywhere" queries the printer referred to by the specified IPP \fIdevice-uri\fR.
+The "raw" model is deprecated and will not be supported in a future version of CUPS.
 .TP 5
 \fB\-o cupsIPPSupplies=true\fR
 .TP 5
index a43295b5b7d0f5bc999dba9d23accc6d8b33ac48..93579c5c4814708c2f93b77dbd66ec7389ae6972 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * "lpadmin" command for CUPS.
  *
- * Copyright 2007-2017 by Apple Inc.
- * Copyright 1997-2006 by Easy Software Products.
+ * Copyright © 2007-2018 by Apple Inc.
+ * Copyright © 1997-2006 by Easy Software Products.
  *
  * Licensed under Apache License v2.0.  See the file "LICENSE" for more information.
  */
@@ -42,23 +42,22 @@ static int          validate_name(const char *name);
  * 'main()' - Parse options and configure the scheduler.
  */
 
-int
-main(int  argc,                        /* I - Number of command-line arguments */
-     char *argv[])             /* I - Command-line arguments */
+int                                    /* O - Exit status */
+main(int  argc,                                /* I - Number of command-line arguments */
+     char *argv[])                     /* I - Command-line arguments */
 {
-  int          i;              /* Looping var */
-  http_t       *http;          /* Connection to server */
-  char         *printer,       /* Destination printer */
-               *pclass,        /* Printer class name */
-               *opt,           /* Option pointer */
-               *val;           /* Pointer to allow/deny value */
-  int          num_options;    /* Number of options */
-  cups_option_t        *options;       /* Options */
-  char         *file,          /* New PPD file */
-               evefile[1024] = "";
-                               /* IPP Everywhere PPD */
-  const char   *ppd_name,      /* ppd-name value */
-               *device_uri;    /* device-uri value */
+  int          i;                      /* Looping var */
+  http_t       *http;                  /* Connection to server */
+  char         *printer,               /* Destination printer */
+               *pclass,                /* Printer class name */
+               *opt,                   /* Option pointer */
+               *val;                   /* Pointer to allow/deny value */
+  int          num_options;            /* Number of options */
+  cups_option_t        *options;               /* Options */
+  char         *file,                  /* New PPD file */
+               evefile[1024] = "";     /* IPP Everywhere PPD */
+  const char   *ppd_name,              /* ppd-name value */
+               *device_uri;            /* device-uri value */
 
 
   _cupsSetLocale(argv);
@@ -606,7 +605,17 @@ main(int  argc,                    /* I - Number of command-line arguments */
   * Set options as needed...
   */
 
-  if ((ppd_name = cupsGetOption("ppd-name", num_options, options)) != NULL && !strcmp(ppd_name, "everywhere") && (device_uri = cupsGetOption("device-uri", num_options, options)) != NULL)
+  ppd_name   = cupsGetOption("ppd-name", num_options, options);
+  device_uri = cupsGetOption("device-uri", num_options, options);
+
+  if (ppd_name && !strcmp(ppd_name, "raw"))
+  {
+    _cupsLangPuts(stderr, _("lpadmin: Raw queues are deprecated and will stop working in a future version of CUPS."));
+
+    if (device_uri && (!strncmp(device_uri, "ipp://", 6) || !strncmp(device_uri, "ipps://", 7)) && strstr(device_uri, "/printers/"))
+      _cupsLangPuts(stderr, _("lpadmin: Use the 'everywhere' model for shared printers."));
+  }
+  else if (ppd_name && !strcmp(ppd_name, "everywhere") && device_uri)
   {
     if ((file = get_printer_ppd(device_uri, evefile, sizeof(evefile), &num_options, &options)) == NULL)
       return (1);