From: msweet Date: Fri, 28 Aug 2015 13:17:53 +0000 (+0000) Subject: The scheduler did not use the ConfigFilePerm setting when copying PPD files or X-Git-Tag: v2.2b1~201 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=55516fd3bc9668b4f055220d3eb19c888f8cf1c2;p=thirdparty%2Fcups.git The scheduler did not use the ConfigFilePerm setting when copying PPD files or 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 --- diff --git a/CHANGES.txt b/CHANGES.txt index 40ea992f25..b61a4cc2d0 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -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 (, ) - "make check" incorrectly reported an expectation of 18 warning diff --git a/scheduler/ipp.c b/scheduler/ipp.c index 0e9249d8d3..624f219ad4 100644 --- a/scheduler/ipp.c +++ b/scheduler/ipp.c @@ -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)); }