]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Added new BrowseLocalProtocols and BrowseRemoteProtocols
authormike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Sun, 18 Sep 2005 00:40:01 +0000 (00:40 +0000)
committermike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Sun, 18 Sep 2005 00:40:01 +0000 (00:40 +0000)
directives to cupsd.conf, allowing for different browse protocols
for local and remote printers (STR #877)

man/cupsd.conf.man:
    - Add new directives.

scheduler/conf.c:
    - ReadConfiguration(): Initialize BrowseLocalProtocols and
      BrowseRemoteProtocols.
    - read_configuration(): Add support for BrowseLocalProtocols
      and BrowseRemoteProtocols.

scheduler/dirsvc.c:
    - SendBrowseDelete(): Use BrowseLocalProtocols.
    - SendBrowseList(): Use BrowseLocalProtocols.
    - StartBrowsing(): Use BrowseLocalProtocols and
      BrowseRemoteProtocols.
    - StopBrowsing(): Use BrowseLocalProtocols and
      BrowseRemoteProtocols.

scheduler/dirsvc.h:
    - Add BrowseLocalProtocols and BrowseRemoteProtocols.
    - Remove BrowseProtocols.

scheduler/main.c:
    - main(): Use BrowseLocalProtocols and
      BrowseRemoteProtocols.
    - select_timeout(): Use BrowseLocalProtocols.

git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@4670 7a7537e8-13f0-0310-91df-b6672ffda945

CHANGES.txt
man/cupsd.conf.man
scheduler/conf.c
scheduler/dirsvc.c
scheduler/dirsvc.h
scheduler/main.c

index 594b488422451189759440bdf2f088950937baac..a2ff6317808d3146071d2a638defeea80e7d4fe0 100644 (file)
@@ -3,6 +3,10 @@ CHANGES.txt - 09/17/2005
 
 CHANGES IN CUPS V1.2.0b1
 
+       - Added new BrowseLocalProtocols and
+         BrowseRemoteProtocols directives to cupsd.conf,
+         allowing for different browse protocols for local and
+         remote printers (STR #877)
        - PPD files can now contain strings up to 256k in length
          (STR #1215)
        - The pstops filter now supports the IncludeFeature DSC
index 7a602b0772ba6fc4200d5c580d2f28a324f8dfc7..650f5a55467aa4fb8f0143f9a9d2be6e51e6ab1d 100644 (file)
@@ -21,7 +21,7 @@
 .\"       EMail: cups-info@cups.org
 .\"         WWW: http://www.cups.org
 .\"
-.TH cupsd.conf 5 "Common UNIX Printing System" "18 August 2004" "Easy Software Products"
+.TH cupsd.conf 5 "Common UNIX Printing System" "17 September 2005" "Easy Software Products"
 .SH NAME
 cupsd.conf \- server configuration file for cups
 .SH DESCRIPTION
@@ -93,6 +93,14 @@ BrowseProtocols
 .br
 Specifies the protocols to use for printer browsing.
 .TP 5
+BrowseLocalProtocols
+.br
+Specifies the protocols to use for local printer browsing.
+.TP 5
+BrowseRemoteProtocols
+.br
+Specifies the protocols to use for remote printer browsing.
+.TP 5
 BrowseRelay
 .br
 Specifies that printer information packets should be relayed from one host or
@@ -131,6 +139,10 @@ DataDir
 .br
 Specified the directory where data files can be found.
 .TP 5
+DefaultAuthType
+.br
+Specifies the default type of authentication to use.
+.TP 5
 DefaultCharset
 .br
 Specifies the default character set to use for text.
@@ -139,6 +151,10 @@ DefaultLanguage
 .br
 Specifies the default language to use for text and web content.
 .TP 5
+DefaultPolicy
+.br
+Specifies the default access policy to use.
+.TP 5
 Deny
 .br
 Denies access to the named host or address.
@@ -218,6 +234,10 @@ KeepAliveTimeout
 .br
 Specifies the connection timeout for HTTP Keep-Alive.
 .TP 5
+<Limit operations> ... </Limit>
+.br
+Specifies the IPP operations that are being limited inside a policy.
+.TP 5
 <Limit methods> ... </Limit>
 .TP 5
 <LimitExcept methods> ... </LimitExcept>
@@ -286,6 +306,10 @@ PageLog
 .br
 Specifies the page log filename.
 .TP 5
+<Policy name> ... </Policy>
+.br
+Specifies access control for the named policy.
+.TP 5
 Port
 .br
 Specifies a port number to listen to for HTTP requests.
index 08521dabd5c82a331567c96196a2bc3a7c6e52d2..f818d7a53a78f3b29fc78d4eee9ea3ad50759032 100644 (file)
@@ -399,12 +399,13 @@ ReadConfiguration(void)
   RunAsUser           = FALSE;
   Timeout             = DEFAULT_TIMEOUT;
 
-  BrowseInterval      = DEFAULT_INTERVAL;
-  BrowsePort          = ippPort();
-  BrowseProtocols     = BROWSE_CUPS;
-  BrowseShortNames    = TRUE;
-  BrowseTimeout       = DEFAULT_TIMEOUT;
-  Browsing            = TRUE;
+  BrowseInterval        = DEFAULT_INTERVAL;
+  BrowsePort            = ippPort();
+  BrowseLocalProtocols  = BROWSE_CUPS;
+  BrowseRemoteProtocols = BROWSE_CUPS;
+  BrowseShortNames      = TRUE;
+  BrowseTimeout         = DEFAULT_TIMEOUT;
+  Browsing              = TRUE;
 
   ClearString(&BrowseLocalOptions);
   ClearString(&BrowseRemoteOptions);
@@ -1890,13 +1891,18 @@ read_configuration(cups_file_t *fp)     /* I - File to read from */
         LogMessage(L_ERROR, "Unknown BrowseOrder value %s on line %d.",
                   value, linenum);
     }
-    else if (!strcasecmp(line, "BrowseProtocols"))
+    else if (!strcasecmp(line, "BrowseProtocols") ||
+             !strcasecmp(line, "BrowseLocalProtocols") ||
+             !strcasecmp(line, "BrowseRemoteProtocols"))
     {
      /*
       * "BrowseProtocol name [... name]"
       */
 
-      BrowseProtocols = 0;
+      if (strcasecmp(line, "BrowseLocalProtocols"))
+        BrowseRemoteProtocols = 0;
+      if (strcasecmp(line, "BrowseRemoteProtocols"))
+        BrowseLocalProtocols = 0;
 
       for (; *value;)
       {
@@ -1911,13 +1917,33 @@ read_configuration(cups_file_t *fp)     /* I - File to read from */
        }
 
         if (!strcasecmp(value, "cups"))
-         BrowseProtocols |= BROWSE_CUPS;
+       {
+         if (strcasecmp(line, "BrowseLocalProtocols"))
+           BrowseRemoteProtocols |= BROWSE_CUPS;
+         if (strcasecmp(line, "BrowseRemoteProtocols"))
+           BrowseLocalProtocols |= BROWSE_CUPS;
+       }
         else if (!strcasecmp(value, "slp"))
-         BrowseProtocols |= BROWSE_SLP;
+       {
+         if (strcasecmp(line, "BrowseLocalProtocols"))
+           BrowseRemoteProtocols |= BROWSE_SLP;
+         if (strcasecmp(line, "BrowseRemoteProtocols"))
+           BrowseLocalProtocols |= BROWSE_SLP;
+       }
         else if (!strcasecmp(value, "ldap"))
-         BrowseProtocols |= BROWSE_LDAP;
+       {
+         if (strcasecmp(line, "BrowseLocalProtocols"))
+           BrowseRemoteProtocols |= BROWSE_LDAP;
+         if (strcasecmp(line, "BrowseRemoteProtocols"))
+           BrowseLocalProtocols |= BROWSE_LDAP;
+       }
         else if (!strcasecmp(value, "all"))
-         BrowseProtocols |= BROWSE_ALL;
+       {
+         if (strcasecmp(line, "BrowseLocalProtocols"))
+           BrowseRemoteProtocols |= BROWSE_ALL;
+         if (strcasecmp(line, "BrowseRemoteProtocols"))
+           BrowseLocalProtocols |= BROWSE_ALL;
+       }
        else
        {
          LogMessage(L_ERROR, "Unknown browse protocol \"%s\" on line %d.",
index ea202c9890e20b753e677d7d882fc64e059ff539..0bd80862f421bea05ad190d86993937c9dae9b84 100644 (file)
@@ -666,10 +666,10 @@ SendBrowseDelete(printer_t *p)            /* I - Printer to delete */
   * Announce the deletion...
   */
 
-  if (BrowseProtocols & BROWSE_CUPS)
+  if (BrowseLocalProtocols & BROWSE_CUPS)
     SendCUPSBrowse(p);
 #ifdef HAVE_LIBSLP
-  if (BrowseProtocols & BROWSE_SLP)
+  if (BrowseLocalProtocols & BROWSE_SLP)
     SLPDeregPrinter(p);
 #endif /* HAVE_LIBSLP */
 }
@@ -689,7 +689,7 @@ SendBrowseList(void)
                        to;             /* Timeout time */
 
 
-  if (!Browsing || !BrowseProtocols)
+  if (!Browsing || !BrowseLocalProtocols)
     return;
 
  /*
@@ -749,11 +749,11 @@ SendBrowseList(void)
 
        p->browse_time = time(NULL);
 
-       if (BrowseProtocols & BROWSE_CUPS)
+       if (BrowseLocalProtocols & BROWSE_CUPS)
           SendCUPSBrowse(p);
 
 #ifdef HAVE_LIBSLP
-       if (BrowseProtocols & BROWSE_SLP)
+       if (BrowseLocalProtocols & BROWSE_SLP)
           SendSLPBrowse(p);
 #endif /* HAVE_LIBSLP */
       }
@@ -998,10 +998,10 @@ StartBrowsing(void)
   struct sockaddr_in   addr;   /* Broadcast address */
 
 
-  if (!Browsing || !BrowseProtocols)
+  if (!Browsing || !(BrowseLocalProtocols | BrowseRemoteProtocols))
     return;
 
-  if (BrowseProtocols & BROWSE_CUPS)
+  if ((BrowseLocalProtocols | BrowseRemoteProtocols) & BROWSE_CUPS)
   {
    /*
     * Create the broadcast socket...
@@ -1011,7 +1011,8 @@ StartBrowsing(void)
     {
       LogMessage(L_ERROR, "StartBrowsing: Unable to create broadcast socket - %s.",
                 strerror(errno));
-      BrowseProtocols &= ~BROWSE_CUPS;
+      BrowseLocalProtocols &= ~BROWSE_CUPS;
+      BrowseRemoteProtocols &= ~BROWSE_CUPS;
       return;
     }
 
@@ -1031,8 +1032,9 @@ StartBrowsing(void)
       close(BrowseSocket);
 #endif /* WIN32 */
 
-      BrowseSocket    = -1;
-      BrowseProtocols &= ~BROWSE_CUPS;
+      BrowseSocket = -1;
+      BrowseLocalProtocols &= ~BROWSE_CUPS;
+      BrowseRemoteProtocols &= ~BROWSE_CUPS;
       return;
     }
 
@@ -1056,8 +1058,9 @@ StartBrowsing(void)
       close(BrowseSocket);
 #endif /* WIN32 */
 
-      BrowseSocket    = -1;
-      BrowseProtocols &= ~BROWSE_CUPS;
+      BrowseSocket = -1;
+      BrowseLocalProtocols &= ~BROWSE_CUPS;
+      BrowseRemoteProtocols &= ~BROWSE_CUPS;
       return;
     }
 
@@ -1080,7 +1083,7 @@ StartBrowsing(void)
     BrowseSocket = -1;
 
 #ifdef HAVE_LIBSLP
-  if (BrowseProtocols & BROWSE_SLP)
+  if ((BrowseLocalProtocols | BrowseRemoteProtocols) & BROWSE_SLP)
   {
    /* 
     * Open SLP handle...
@@ -1089,7 +1092,8 @@ StartBrowsing(void)
     if (SLPOpen("en", SLP_FALSE, &BrowseSLPHandle) != SLP_OK)
     {
       LogMessage(L_ERROR, "Unable to open an SLP handle; disabling SLP browsing!");
-      BrowseProtocols &= ~BROWSE_SLP;
+      BrowseLocalProtocols &= ~BROWSE_SLP;
+      BrowseRemoteProtocols &= ~BROWSE_SLP;
     }
 
     BrowseSLPRefresh = 0;
@@ -1205,10 +1209,10 @@ StartPolling(void)
 void
 StopBrowsing(void)
 {
-  if (!Browsing || !BrowseProtocols)
+  if (!Browsing || !(BrowseLocalProtocols | BrowseRemoteProtocols))
     return;
 
-  if (BrowseProtocols & BROWSE_CUPS)
+  if ((BrowseLocalProtocols | BrowseRemoteProtocols) & BROWSE_CUPS)
   {
    /*
     * Close the socket and remove it from the input selection set.
@@ -1231,7 +1235,7 @@ StopBrowsing(void)
   }
 
 #ifdef HAVE_LIBSLP
-  if (BrowseProtocols & BROWSE_SLP)
+  if ((BrowseLocalProtocols | BrowseRemoteProtocols) & BROWSE_SLP)
   {
    /* 
     * Close SLP handle...
index 135120c7b436940235b2c9c1cee3490bd88cdb52..72c63d59421682329150935d77e4155998c62de7 100644 (file)
@@ -82,8 +82,12 @@ typedef struct
 
 VAR int                        Browsing        VALUE(TRUE),
                                        /* Whether or not browsing is enabled */
-                       BrowseProtocols VALUE(BROWSE_ALL),
-                                       /* Protocols to support */
+                       BrowseLocalProtocols
+                                       VALUE(BROWSE_ALL),
+                                       /* Protocols to support for local printers */
+                       BrowseRemoteProtocols
+                                       VALUE(BROWSE_ALL),
+                                       /* Protocols to support for remote printers */
                        BrowseShortNames VALUE(TRUE),
                                        /* Short names for remote printers? */
                        BrowseSocket    VALUE(-1),
index 382916a974df0f4ed2f0bcedc291cd0defaca808..b5b967ea2939ea0674cf89f85e9a2b5491f3d4b1 100644 (file)
@@ -641,7 +641,7 @@ main(int  argc,                             /* I - Number of command-line arguments */
     * Update the browse list as needed...
     */
 
-    if (Browsing && BrowseProtocols)
+    if (Browsing && (BrowseLocalProtocols | BrowseRemoteProtocols))
     {
       if (BrowseSocket >= 0 && FD_ISSET(BrowseSocket, input))
         UpdateCUPSBrowse();
@@ -650,7 +650,8 @@ main(int  argc,                             /* I - Number of command-line arguments */
         UpdatePolling();
 
 #ifdef HAVE_LIBSLP
-      if ((BrowseProtocols & BROWSE_SLP) && BrowseSLPRefresh <= time(NULL))
+      if (((BrowseLocalProtocols | BrowseRemoteProtocols) & BROWSE_SLP) &&
+          BrowseSLPRefresh <= time(NULL))
         UpdateSLPBrowse();
 #endif /* HAVE_LIBSLP */
 
@@ -1339,17 +1340,17 @@ select_timeout(int fds)                 /* I - Number of ready descriptors select returned */
   * Update the browse list as needed...
   */
 
-  if (Browsing && BrowseProtocols)
+  if (Browsing && BrowseLocalProtocols)
   {
 #ifdef HAVE_LIBSLP
-    if ((BrowseProtocols & BROWSE_SLP) && (BrowseSLPRefresh < timeout))
+    if ((BrowseLocalProtocols & BROWSE_SLP) && (BrowseSLPRefresh < timeout))
     {
       timeout = BrowseSLPRefresh;
       why     = "update SLP browsing";
     }
 #endif /* HAVE_LIBSLP */
 
-    if (BrowseProtocols & BROWSE_CUPS)
+    if (BrowseLocalProtocols & BROWSE_CUPS)
     {
       for (p = Printers; p != NULL; p = p->next)
       {