]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
The scheduler did not use the ConfigFilePerm setting when copying PPD files or
authormsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>
Fri, 28 Aug 2015 13:17:53 +0000 (13:17 +0000)
committermsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>
Fri, 28 Aug 2015 13:17:53 +0000 (13:17 +0000)
interface scripts attached to a request (STR #4703)

Use cupsdCreateConfFile when copying attached files, and use ConfigFilePerm.

git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@12851 a1ca3aef-8c08-0410-bb20-df032aa958be

CHANGES.txt
scheduler/ipp.c

index 40ea992f252f9c03678979e45049e47b06895f91..b61a4cc2d012ebd26717e63f1d3f570e553bba73 100644 (file)
@@ -1,10 +1,12 @@
-CHANGES.txt - 2.1.0 - 2015-08-26
+CHANGES.txt - 2.1.0 - 2015-08-28
 --------------------------------
 
 CHANGES IN CUPS V2.1.0
 
        - Fixed more scheduler crash bugs in the new logging code (STR #4687,
          STR #4690)
+       - The scheduler did not use the ConfigFilePerm setting when copying PPD
+         files or interface scripts attached to a request (STR #4703)
        - Now support new Chinese locale IDs and their correct fallback locales
          (<rdar://problem/22086642>, <rdar://problem/22130168>)
        - "make check" incorrectly reported an expectation of 18 warning
index 0e9249d8d3678de49246ac9b25ecbe49f7706b39..624f219ad4d62e49c998794207c92eeff126d068 100644 (file)
@@ -70,7 +70,7 @@ static void   copy_attrs(ipp_t *to, ipp_t *from, cups_array_t *ra,
                           cups_array_t *exclude);
 static int     copy_banner(cupsd_client_t *con, cupsd_job_t *job,
                            const char *name);
-static int     copy_file(const char *from, const char *to);
+static int     copy_file(const char *from, const char *to, mode_t mode);
 static int     copy_model(cupsd_client_t *con, const char *from,
                           const char *to);
 static void    copy_job_attrs(cupsd_client_t *con,
@@ -2615,7 +2615,7 @@ add_printer(cupsd_client_t  *con, /* I - Client connection */
        * interfaces directory and make it executable...
        */
 
-       if (copy_file(srcfile, dstfile))
+       if (copy_file(srcfile, dstfile, ConfigFilePerm | 0110))
        {
           send_ipp_status(con, IPP_INTERNAL_ERROR,
                          _("Unable to copy interface script - %s"),
@@ -2625,7 +2625,6 @@ add_printer(cupsd_client_t  *con, /* I - Client connection */
 
        cupsdLogMessage(CUPSD_LOG_DEBUG,
                        "Copied interface script successfully");
-       chmod(dstfile, 0755);
       }
 
       snprintf(dstfile, sizeof(dstfile), "%s/ppd/%s.ppd", ServerRoot,
@@ -2638,7 +2637,7 @@ add_printer(cupsd_client_t  *con, /* I - Client connection */
        * ppd directory and make it readable by all...
        */
 
-       if (copy_file(srcfile, dstfile))
+       if (copy_file(srcfile, dstfile, ConfigFilePerm))
        {
           send_ipp_status(con, IPP_INTERNAL_ERROR,
                          _("Unable to copy PPD file - %s"),
@@ -2648,7 +2647,6 @@ add_printer(cupsd_client_t  *con, /* I - Client connection */
 
        cupsdLogMessage(CUPSD_LOG_DEBUG,
                        "Copied PPD file successfully");
-       chmod(dstfile, 0644);
       }
       else
       {
@@ -4336,7 +4334,8 @@ copy_banner(cupsd_client_t *con,  /* I - Client connection */
 
 static int                             /* O - 0 = success, -1 = error */
 copy_file(const char *from,            /* I - Source file */
-          const char *to)              /* I - Destination file */
+          const char *to,              /* I - Destination file */
+         mode_t     mode)              /* I - Permissions */
 {
   cups_file_t  *src,                   /* Source file */
                *dst;                   /* Destination file */
@@ -4353,7 +4352,7 @@ copy_file(const char *from,               /* I - Source file */
   if ((src = cupsFileOpen(from, "rb")) == NULL)
     return (-1);
 
-  if ((dst = cupsFileOpen(to, "wb")) == NULL)
+  if ((dst = cupsdCreateConfFile(to, mode)) == NULL)
   {
     cupsFileClose(src);
     return (-1);
@@ -4377,7 +4376,7 @@ copy_file(const char *from,               /* I - Source file */
 
   cupsFileClose(src);
 
-  return (cupsFileClose(dst));
+  return (cupsdCloseCreatedConfFile(dst, to));
 }