]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - scheduler/main.c
Update svn:keyword properties.
[thirdparty/cups.git] / scheduler / main.c
index 07b0c153407b32ebb2a0d0f5d1625b2d030e4c32..5a8da815e5a99ef22127ea7106d69b0c182fc886 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: main.c 7925 2008-09-10 17:47:26Z mike $"
+ * "$Id$"
  *
  *   Main loop for the CUPS scheduler.
  *
@@ -208,7 +208,6 @@ main(int  argc,                             /* I - Number of command-line args */
 
                 char *current;         /* Current directory */
 
-
               /*
                * Allocate a buffer for the current working directory to
                * reduce run-time stack usage; this approximates the
@@ -272,6 +271,29 @@ main(int  argc,                            /* I - Number of command-line args */
              UseProfiles = 0;
              break;
 
+          case 's' : /* Set cups-files.conf location */
+              i ++;
+             if (i >= argc)
+             {
+               _cupsLangPuts(stderr, _("cupsd: Expected cups-files.conf "
+                                       "filename after \"-s\" option."));
+               usage(1);
+             }
+
+              if (argv[i][0] != '/')
+             {
+              /*
+               * Relative filename not allowed...
+               */
+
+               _cupsLangPuts(stderr, _("cupsd: Relative cups-files.conf "
+                                       "filename not allowed."));
+               usage(1);
+              }
+
+             cupsdSetString(&CupsFilesFile, argv[i]);
+             break;
+
 #ifdef __APPLE__
           case 'S' : /* Disable system management functions */
               fputs("cupsd: -S (disable system management) for internal "
@@ -301,6 +323,35 @@ main(int  argc,                            /* I - Number of command-line args */
   if (!ConfigurationFile)
     cupsdSetString(&ConfigurationFile, CUPS_SERVERROOT "/cupsd.conf");
 
+  if (!CupsFilesFile)
+  {
+    char       *filename,              /* Copy of cupsd.conf filename */
+               *slash;                 /* Final slash in cupsd.conf filename */
+    size_t     len;                    /* Size of buffer */
+
+    len = strlen(ConfigurationFile) + 15;
+    if ((filename = malloc(len)) == NULL)
+    {
+      _cupsLangPrintf(stderr,
+                     _("cupsd: Unable to get path to "
+                       "cups-files.conf file."));
+      return (1);
+    }
+
+    strlcpy(filename, ConfigurationFile, len);
+    if ((slash = strrchr(filename, '/')) == NULL)
+    {
+      _cupsLangPrintf(stderr,
+                     _("cupsd: Unable to get path to "
+                       "cups-files.conf file."));
+      return (1);
+    }
+
+    strlcpy(slash, "/cups-files.conf", len - (slash - filename));
+    cupsdSetString(&CupsFilesFile, filename);
+    free(filename);
+  }
+
  /*
   * If the user hasn't specified "-f", run in the background...
   */
@@ -484,17 +535,11 @@ main(int  argc,                           /* I - Number of command-line args */
   */
 
   if (!cupsdReadConfiguration())
-  {
-    if (TestConfigFile)
-      printf("%s contains errors\n", ConfigurationFile);
-    else
-      syslog(LOG_LPR, "Unable to read configuration file \'%s\' - exiting!",
-            ConfigurationFile);
     return (1);
-  }
   else if (TestConfigFile)
   {
-    printf("%s is OK\n", ConfigurationFile);
+    printf("\"%s\" is OK.\n", CupsFilesFile);
+    printf("\"%s\" is OK.\n", ConfigurationFile);
     return (0);
   }
 
@@ -901,7 +946,7 @@ main(int  argc,                             /* I - Number of command-line args */
       */
 
       cupsdDeleteCert(0);
-      cupsdAddCert(0, "root", NULL);
+      cupsdAddCert(0, "root", cupsdDefaultAuthType());
     }
 #endif /* !HAVE_AUTHORIZATION_H */
 
@@ -1093,23 +1138,6 @@ main(int  argc,                          /* I - Number of command-line args */
     cupsdStopSystemMonitor();
 #endif /* __APPLE__ */
 
-#ifdef HAVE_GSSAPI
- /*
-  * Free the scheduler's Kerberos context...
-  */
-
-#  ifdef __APPLE__
- /*
-  * If the weak-linked GSSAPI/Kerberos library is not present, don't try
-  * to use it...
-  */
-
-  if (krb5_init_context != NULL)
-#  endif /* __APPLE__ */
-  if (KerberosContext)
-    krb5_free_context(KerberosContext);
-#endif /* HAVE_GSSAPI */
-
   cupsdStopSelect();
 
   return (!stop_scheduler);
@@ -1257,7 +1285,7 @@ cupsdSetStringf(char       **s,           /* O - New string */
                 const char *f,         /* I - Printf-style format string */
                ...)                    /* I - Additional args as needed */
 {
-  char         v[4096];                /* Formatting string value */
+  char         v[65536 + 64];          /* Formatting string value */
   va_list      ap;                     /* Argument pointer */
   char         *olds;                  /* Old string */
 
@@ -1424,7 +1452,7 @@ launchd_checkin(void)
        lis->fd = fd;
 
 #  ifdef HAVE_SSL
-       if (_httpAddrPort(&(lis->address)) == 443)
+       if (httpAddrPort(&(lis->address)) == 443)
          lis->encryption = HTTP_ENCRYPT_ALWAYS;
 #  endif /* HAVE_SSL */
       }
@@ -1997,5 +2025,5 @@ usage(int status)                 /* O - Exit status */
 
 
 /*
- * End of "$Id: main.c 7925 2008-09-10 17:47:26Z mike $".
+ * End of "$Id$".
  */