Sophie

Sophie

distrib > Mageia > 5 > x86_64 > by-pkgid > a6aae3a662c1e10e2473fbb4ddffc9d5 > files > 51

cups-2.0.4-1.3.mga5.src.rpm

Index: scheduler/ipp.c
===================================================================
--- scheduler/ipp.c	(revision 12850)
+++ scheduler/ipp.c	(working copy)
@@ -70,7 +70,7 @@
 			   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 @@
 	* 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 @@
 
 	cupsdLogMessage(CUPSD_LOG_DEBUG,
 			"Copied interface script successfully");
-	chmod(dstfile, 0755);
       }
 
       snprintf(dstfile, sizeof(dstfile), "%s/ppd/%s.ppd", ServerRoot,
@@ -2638,7 +2637,7 @@
 	* 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 @@
 
 	cupsdLogMessage(CUPSD_LOG_DEBUG,
 			"Copied PPD file successfully");
-	chmod(dstfile, 0644);
       }
       else
       {
@@ -4336,7 +4334,8 @@
 
 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 @@
   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 @@
 
   cupsFileClose(src);
 
-  return (cupsFileClose(dst));
+  return (cupsdCloseCreatedConfFile(dst, to));
 }