]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Added support for the Apache PassEnv and SetEnv directives to
authormike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Sat, 1 Oct 2005 00:34:49 +0000 (00:34 +0000)
committermike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Sat, 1 Oct 2005 00:34:49 +0000 (00:34 +0000)
cupsd.conf (STR #853)

scheduler/conf.c:
    - read_configuration(): Add code to parse PassEnv and SetEnv.

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

CHANGES.txt
man/cupsd.conf.man
scheduler/conf.c

index 6fbdc7dac1dd5b0bea28d97c03d6d8c205045273..fe8ebb4b623b3082b67e4720e00c45ed1310a17b 100644 (file)
@@ -3,6 +3,8 @@ CHANGES.txt - 09/30/2005
 
 CHANGES IN CUPS V1.2.0b1
 
+       - Added support for the Apache PassEnv and SetEnv
+         directives to cupsd.conf (STR #853)
        - Added large file (64-bit) support (STR #541)
        - Fixed a performance issue with the ippReadIO()
          implementation (STR #1284)
index 650f5a55467aa4fb8f0143f9a9d2be6e51e6ab1d..aa76c8efe5723548aad541d3671b5b06463b7235 100644 (file)
@@ -21,7 +21,7 @@
 .\"       EMail: cups-info@cups.org
 .\"         WWW: http://www.cups.org
 .\"
-.TH cupsd.conf 5 "Common UNIX Printing System" "17 September 2005" "Easy Software Products"
+.TH cupsd.conf 5 "Common UNIX Printing System" "30 September 2005" "Easy Software Products"
 .SH NAME
 cupsd.conf \- server configuration file for cups
 .SH DESCRIPTION
@@ -306,6 +306,10 @@ PageLog
 .br
 Specifies the page log filename.
 .TP 5
+PassEnv variable [... variable]
+.br
+Passes the specified environment variable(s) to child processes.
+.TP 5
 <Policy name> ... </Policy>
 .br
 Specifies access control for the named policy.
@@ -401,6 +405,10 @@ ServerTokens
 Specifies what information is included in the Server header of HTTP
 responses.
 .TP 5
+SetEnv variable value
+.br
+Set the specified environment variable to be passed to child processes.
+.TP 5
 SSLListen
 .br
 Listens on the specified address and port for encrypted connections.
index 8ae27c83751aa5a35385ca44f96b94e911ff0458..741bd5860aa54b9e3f29cb10cd3ab562a380531a 100644 (file)
@@ -1705,7 +1705,9 @@ read_configuration(cups_file_t *fp)       /* I - File to read from */
                        temp2[HTTP_MAX_BUFFER],
                                        /* Temporary buffer 2 for value */
                        *ptr,           /* Pointer into line/temp */
-                       *value;         /* Pointer to value */
+                       *value,         /* Pointer to value */
+                       *valueptr,      /* Pointer into value */
+                       quote;          /* Quote character */
   int                  valuelen;       /* Length of value */
   cupsd_var_t          *var;           /* Current variable */
   unsigned             ip[4],          /* Address value */
@@ -2420,10 +2422,6 @@ read_configuration(cups_file_t *fp)      /* I - File to read from */
       * System (admin) group(s)...
       */
 
-      char     *valueptr,              /* Pointer into value */
-               quote;                  /* Quote character */
-
-
       for (i = NumSystemGroups; *value && i < MAX_SYSTEM_GROUPS;)
       {
         if (*value == '\'' || *value == '\"')
@@ -2566,6 +2564,55 @@ read_configuration(cups_file_t *fp)      /* I - File to read from */
        cupsdLogMessage(CUPSD_LOG_WARN, "Unknown ServerTokens %s on line %d.",
                         value, linenum);
     }
+    else if (!strcasecmp(line, "PassEnv"))
+    {
+     /*
+      * PassEnv variable [... variable]
+      */
+
+      for (; *value;)
+      {
+        for (valuelen = 0; value[valuelen]; valuelen ++)
+         if (isspace(value[valuelen]) || value[valuelen] == ',')
+           break;
+
+        if (value[valuelen])
+        {
+         value[valuelen] = '\0';
+         valuelen ++;
+       }
+
+        cupsdSetEnv(value, NULL);
+
+        for (value += valuelen; *value; value ++)
+         if (!isspace(*value) || *value != ',')
+           break;
+      }
+    }
+    else if (!strcasecmp(line, "SetEnv"))
+    {
+     /*
+      * SetEnv variable value
+      */
+
+      for (valueptr = value; *valueptr && !isspace(*valueptr & 255); valueptr ++);
+
+      if (*valueptr)
+      {
+       /*
+        * Found a value...
+       */
+
+        while (isspace(*valueptr & 255))
+         *valueptr++ = '\0';
+
+        cupsdSetEnv(value, valueptr);
+      }
+      else
+        cupsdLogMessage(CUPSD_LOG_ERROR,
+                       "Missing value for SetEnv directive on line %d.",
+                       linenum);
+    }
     else
     {
      /*