]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Mirror 1.1.x changes.
authormike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Tue, 20 Apr 2004 13:40:30 +0000 (13:40 +0000)
committermike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Tue, 20 Apr 2004 13:40:30 +0000 (13:40 +0000)
git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/branches/branch-1.2@4149 7a7537e8-13f0-0310-91df-b6672ffda945

CHANGES-1.1.txt
scheduler/cert.c
scheduler/classes.c
scheduler/client.c
scheduler/conf.c
scheduler/conf.h
scheduler/ipp.c
scheduler/job.c
scheduler/log.c

index b7c5f11739beaa77d86c0625be943dc7a5cfd846..eacd34f5343fdfc8385ec46637c6e96677a9e772 100644 (file)
@@ -3,6 +3,9 @@ CHANGES-1.1.txt
 
 CHANGES IN CUPS V1.1.21rc1
 
+       - When using RunAsUser, the scheduler did not correctly
+         set the ownership of the log files, preventing log
+         file rotation (STR #686)
        - The image filters did not correctly load 1-bit PNG
          files (STR #687)
        - The pdftops filter did not show all annotation objects
index 1f7d3dc083d425821a2d62569eb1f45ad076b5b4..e680bdfd6130fb8a3b5053ba546c63c316c515f7 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: cert.c,v 1.7.2.10 2003/03/30 20:01:41 mike Exp $"
+ * "$Id: cert.c,v 1.7.2.11 2004/04/20 13:40:30 mike Exp $"
  *
  *   Authentication certificate routines for the Common UNIX
  *   Printing System (CUPS).
@@ -101,9 +101,9 @@ AddCert(int        pid,                     /* I - Process ID */
     fchmod(fd, 0440);
 
     if ((grp = getgrnam(SystemGroups[0])) == NULL)
-      fchown(fd, getuid(), 0);
+      fchown(fd, RunUser, 0);
     else
-      fchown(fd, getuid(), grp->gr_gid);
+      fchown(fd, RunUser, grp->gr_gid);
 
     endgrent();
 
@@ -293,5 +293,5 @@ InitCerts(void)
 
 
 /*
- * End of "$Id: cert.c,v 1.7.2.10 2003/03/30 20:01:41 mike Exp $".
+ * End of "$Id: cert.c,v 1.7.2.11 2004/04/20 13:40:30 mike Exp $".
  */
index 1bb942e6c64d6c40cba7b141eb07deca8e591f3a..d77b6801f2b73ce1ae921ab8becdd91929dbcbd5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: classes.c,v 1.34.2.19 2004/02/26 20:12:13 mike Exp $"
+ * "$Id: classes.c,v 1.34.2.20 2004/04/20 13:40:30 mike Exp $"
  *
  *   Printer class routines for the Common UNIX Printing System (CUPS).
  *
@@ -600,7 +600,7 @@ SaveAllClasses(void)
   * Restrict access to the file...
   */
 
-  fchown(cupsFileNumber(fp), getuid(), Group);
+  fchown(cupsFileNumber(fp), RunUser, Group);
   fchmod(cupsFileNumber(fp), ConfigFilePerm);
 
  /*
@@ -676,5 +676,5 @@ SaveAllClasses(void)
 
 
 /*
- * End of "$Id: classes.c,v 1.34.2.19 2004/02/26 20:12:13 mike Exp $".
+ * End of "$Id: classes.c,v 1.34.2.20 2004/04/20 13:40:30 mike Exp $".
  */
index f4c34cba96d8567de32d2ad2b678246ad29ba71c..423eed318adb3441cc35731063be7f7384222e20 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: client.c,v 1.91.2.80 2004/03/24 21:28:56 mike Exp $"
+ * "$Id: client.c,v 1.91.2.81 2004/04/20 13:40:30 mike Exp $"
  *
  *   Client routines for the Common UNIX Printing System (CUPS) scheduler.
  *
@@ -1553,7 +1553,7 @@ ReadClient(client_t *con)         /* I - Client to read from */
             SetStringf(&con->filename, "%s/%08x", RequestRoot, request_id ++);
            con->file = open(con->filename, O_WRONLY | O_CREAT | O_TRUNC, 0640);
            fchmod(con->file, 0640);
-           fchown(con->file, getuid(), Group);
+           fchown(con->file, RunUser, Group);
 
             LogMessage(L_DEBUG2, "ReadClient: %d REQUEST %s=%d", con->http.fd,
                       con->filename, con->file);
@@ -1796,7 +1796,7 @@ ReadClient(client_t *con)         /* I - Client to read from */
           SetStringf(&con->filename, "%s/%08x", RequestRoot, request_id ++);
          con->file = open(con->filename, O_WRONLY | O_CREAT | O_TRUNC, 0640);
          fchmod(con->file, 0640);
-         fchown(con->file, getuid(), Group);
+         fchown(con->file, RunUser, Group);
 
           LogMessage(L_DEBUG2, "ReadClient: %d REQUEST %s=%d", con->http.fd,
                     con->filename, con->file);
@@ -3228,7 +3228,7 @@ pipe_command(client_t *con,               /* I - Client connection */
     * Child comes here...  Close stdin if necessary and dup the pipe to stdout.
     */
 
-    if (getuid() == 0)
+    if (!RunUser)
     {
      /*
       * Running as root, so change to a non-priviledged user...
@@ -3395,5 +3395,5 @@ CDSAWriteFunc(SSLConnectionRef connection,        /* I  - SSL/TLS connection */
 
 
 /*
- * End of "$Id: client.c,v 1.91.2.80 2004/03/24 21:28:56 mike Exp $".
+ * End of "$Id: client.c,v 1.91.2.81 2004/04/20 13:40:30 mike Exp $".
  */
index c1c34ed1ddd6aa87a2d7b81b955c4c4a921b4039..4256e1321f030b26b2688c8916df796242585c5c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: conf.c,v 1.77.2.49 2004/02/25 20:01:37 mike Exp $"
+ * "$Id: conf.c,v 1.77.2.50 2004/04/20 13:40:30 mike Exp $"
  *
  *   Configuration routines for the Common UNIX Printing System (CUPS).
  *
@@ -190,7 +190,6 @@ ReadConfiguration(void)
   char         *language;              /* Language string */
   struct passwd        *user;                  /* Default user */
   struct group *group;                 /* Default group */
-  int          run_user;               /* User that will be running cupsd */
   char         *old_serverroot,        /* Old ServerRoot */
                *old_requestroot;       /* Old RequestRoot */
 
@@ -403,9 +402,9 @@ ReadConfiguration(void)
     return (0);
 
   if (RunAsUser)
-    run_user = User;
+    RunUser = User;
   else
-    run_user = getuid();
+    RunUser = getuid();
 
  /*
   * Use the default system group if none was supplied in cupsd.conf...
@@ -481,13 +480,13 @@ ReadConfiguration(void)
     SetStringf(&ServerCertificate, "%s/%s", ServerRoot, ServerCertificate);
 
 #  if defined(HAVE_LIBSSL) || defined(HAVE_GNUTLS)
-  chown(ServerCertificate, run_user, Group);
+  chown(ServerCertificate, RunUser, Group);
   chmod(ServerCertificate, ConfigFilePerm);
 
   if (ServerKey[0] != '/')
     SetStringf(&ServerKey, "%s/%s", ServerRoot, ServerKey);
 
-  chown(ServerKey, run_user, Group);
+  chown(ServerKey, RunUser, Group);
   chmod(ServerKey, ConfigFilePerm);
 #  endif /* HAVE_LIBSSL || HAVE_GNUTLS */
 #endif /* HAVE_SSL */
@@ -497,27 +496,27 @@ ReadConfiguration(void)
   * writable by the user and group in the cupsd.conf file...
   */
 
-  chown(ServerRoot, run_user, Group);
+  chown(ServerRoot, RunUser, Group);
   chmod(ServerRoot, 0775);
 
   snprintf(temp, sizeof(temp), "%s/certs", ServerRoot);
-  chown(temp, run_user, Group);
+  chown(temp, RunUser, Group);
   chmod(temp, 0711);
 
   snprintf(temp, sizeof(temp), "%s/ppd", ServerRoot);
-  chown(temp, run_user, Group);
+  chown(temp, RunUser, Group);
   chmod(temp, 0755);
 
   snprintf(temp, sizeof(temp), "%s/ssl", ServerRoot);
-  chown(temp, run_user, Group);
+  chown(temp, RunUser, Group);
   chmod(temp, 0700);
 
   snprintf(temp, sizeof(temp), "%s/cupsd.conf", ServerRoot);
-  chown(temp, run_user, Group);
+  chown(temp, RunUser, Group);
   chmod(temp, ConfigFilePerm);
 
   snprintf(temp, sizeof(temp), "%s/classes.conf", ServerRoot);
-  chown(temp, run_user, Group);
+  chown(temp, RunUser, Group);
 #ifdef __APPLE__
   chmod(temp, 0600);
 #else
@@ -525,7 +524,7 @@ ReadConfiguration(void)
 #endif /* __APPLE__ */
 
   snprintf(temp, sizeof(temp), "%s/printers.conf", ServerRoot);
-  chown(temp, run_user, Group);
+  chown(temp, RunUser, Group);
 #ifdef __APPLE__
   chmod(temp, 0600);
 #else
@@ -541,7 +540,7 @@ ReadConfiguration(void)
   * permissions...
   */
 
-  chown(RequestRoot, run_user, Group);
+  chown(RequestRoot, RunUser, Group);
   chmod(RequestRoot, 0710);
 
   if (strncmp(TempDir, RequestRoot, strlen(RequestRoot)) == 0)
@@ -551,7 +550,7 @@ ReadConfiguration(void)
     * is under the spool directory...
     */
 
-    chown(TempDir, run_user, Group);
+    chown(TempDir, RunUser, Group);
     chmod(TempDir, 01770);
   }
 
@@ -2306,5 +2305,5 @@ CDSAGetServerCerts(void)
 
 
 /*
- * End of "$Id: conf.c,v 1.77.2.49 2004/02/25 20:01:37 mike Exp $".
+ * End of "$Id: conf.c,v 1.77.2.50 2004/04/20 13:40:30 mike Exp $".
  */
index 2d80a0d74b63b5fbfa044bd0d7cad3216c092691..4257d983d58f8879487495c9f8529df004e37c0d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: conf.h,v 1.36.2.21 2003/10/09 19:13:52 mike Exp $"
+ * "$Id: conf.h,v 1.36.2.22 2004/04/20 13:40:30 mike Exp $"
  *
  *   Configuration file definitions for the Common UNIX Printing System (CUPS)
  *   scheduler.
@@ -150,6 +150,7 @@ VAR int                     ClassifyOverride        VALUE(0),
                                        /* Root certificate update interval */
                        RunAsUser               VALUE(FALSE),
                                        /* Run as unpriviledged user? */
+                       RunUser,        /* User to run as, used for files */
                        PrintcapFormat          VALUE(PRINTCAP_BSD);
                                        /* Format of printcap file? */
 VAR cups_file_t                *AccessFile             VALUE(NULL),
@@ -194,5 +195,5 @@ extern int  LogPage(job_t *job, const char *page);
 
 
 /*
- * End of "$Id: conf.h,v 1.36.2.21 2003/10/09 19:13:52 mike Exp $".
+ * End of "$Id: conf.h,v 1.36.2.22 2004/04/20 13:40:30 mike Exp $".
  */
index 2d4ed5d574d63a7c778732ea08d04feb44bdcdde..77ab472b6ac8258e064a25934361d5458c72499f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: ipp.c,v 1.127.2.80 2004/03/24 21:32:24 mike Exp $"
+ * "$Id: ipp.c,v 1.127.2.81 2004/04/20 13:40:30 mike Exp $"
  *
  *   IPP routines for the Common UNIX Printing System (CUPS) scheduler.
  *
@@ -2267,7 +2267,7 @@ copy_banner(client_t   *con,      /* I - Client connection */
   }
 
   fchmod(cupsFileNumber(out), 0640);
-  fchown(cupsFileNumber(out), getuid(), Group);
+  fchown(cupsFileNumber(out), RunUser, Group);
 
   if (con->language)
   {
@@ -6914,5 +6914,5 @@ validate_user(client_t   *con,            /* I - Client connection */
 
 
 /*
- * End of "$Id: ipp.c,v 1.127.2.80 2004/03/24 21:32:24 mike Exp $".
+ * End of "$Id: ipp.c,v 1.127.2.81 2004/04/20 13:40:30 mike Exp $".
  */
index db6b368e3446d293db346fa90f3e237de9e55beb..eb9706046164f15d6ff0d607f8e5c930f8ba1c46 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: job.c,v 1.124.2.84 2004/02/25 20:01:37 mike Exp $"
+ * "$Id: job.c,v 1.124.2.85 2004/04/20 13:40:30 mike Exp $"
  *
  *   Job management routines for the Common UNIX Printing System (CUPS).
  *
@@ -947,7 +947,7 @@ SaveJob(int id)                     /* I - Job ID */
   }
 
   fchmod(fd, 0600);
-  fchown(fd, getuid(), Group);
+  fchown(fd, RunUser, Group);
 
   ippWriteFile(fd, job->attrs);
 
@@ -2748,7 +2748,7 @@ start_process(const char *command,        /* I - Full path to command */
     * Change user to something "safe"...
     */
 
-    if (!root && getuid() == 0)
+    if (!root && !RunUser)
     {
      /*
       * Running as root, so change to non-priviledged user...
@@ -2877,5 +2877,5 @@ set_hold_until(job_t *job,                /* I - Job to update */
 
 
 /*
- * End of "$Id: job.c,v 1.124.2.84 2004/02/25 20:01:37 mike Exp $".
+ * End of "$Id: job.c,v 1.124.2.85 2004/04/20 13:40:30 mike Exp $".
  */
index 4c6c6b8699d1aa30d90ce7e99962927a9d5e3bee..c0f22fbdb4537cd3afb5ddecc89d984978543185 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: log.c,v 1.19.2.18 2003/10/09 19:13:52 mike Exp $"
+ * "$Id: log.c,v 1.19.2.19 2004/04/20 13:40:30 mike Exp $"
  *
  *   Log file routines for the Common UNIX Printing System (CUPS).
  *
@@ -490,7 +490,7 @@ check_log_file(cups_file_t **log,   /* IO - Log file */
 
     if (strncmp(filename, "/dev/", 5))
     {
-      fchown(cupsFileNumber(*log), getuid(), Group);
+      fchown(cupsFileNumber(*log), RunUser, Group);
       fchmod(cupsFileNumber(*log), LogFilePerm);
     }
   }
@@ -518,7 +518,7 @@ check_log_file(cups_file_t **log,   /* IO - Log file */
 
     if (strncmp(filename, "/dev/", 5))
     {
-      fchown(cupsFileNumber(*log), getuid(), Group);
+      fchown(cupsFileNumber(*log), RunUser, Group);
       fchmod(cupsFileNumber(*log), LogFilePerm);
     }
   }
@@ -528,5 +528,5 @@ check_log_file(cups_file_t **log,   /* IO - Log file */
 
 
 /*
- * End of "$Id: log.c,v 1.19.2.18 2003/10/09 19:13:52 mike Exp $".
+ * End of "$Id: log.c,v 1.19.2.19 2004/04/20 13:40:30 mike Exp $".
  */