From: msweet Date: Fri, 23 May 2008 22:28:53 +0000 (+0000) Subject: Merge changes from CUPS 1.4svn-r7614. X-Git-Tag: release-1.6.3~164 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8922323b9f8993f0269e99cac0af57de4f62ca64;p=thirdparty%2Fcups.git Merge changes from CUPS 1.4svn-r7614. git-svn-id: svn+ssh://src.apple.com/svn/cups/easysw/current@789 a1ca3aef-8c08-0410-bb20-df032aa958be --- diff --git a/Makefile b/Makefile index 733c86b532..1c83cc5135 100644 --- a/Makefile +++ b/Makefile @@ -55,7 +55,7 @@ libs: echo Using LDFLAGS="$(LDFLAGS)" echo Using LIBS="$(LIBS)" for dir in $(DIRS); do\ - echo Making all in $$dir... ;\ + echo Making libraries in $$dir... ;\ (cd $$dir ; $(MAKE) $(MFLAGS) libs) || exit 1;\ done diff --git a/cups/getdevices.c b/cups/getdevices.c index 6843e5afd1..d0e1cf2fa6 100644 --- a/cups/getdevices.c +++ b/cups/getdevices.c @@ -232,6 +232,7 @@ cupsGetDevices( */ httpBlocking(http, blocking); + httpFlush(http); if (status == IPP_ERROR) _cupsSetError(IPP_ERROR, NULL); diff --git a/ppdc/Makefile b/ppdc/Makefile index bc3c052680..fc0fbc885e 100644 --- a/ppdc/Makefile +++ b/ppdc/Makefile @@ -308,13 +308,16 @@ libcupsppdc.so.1 libcupsppdc.sl.1: $(LIBOBJS) # libcupsppdc.1.dylib: $(LIBOBJS) + echo Creating export list for $@... + nm $(LIBOBJS) | grep "T __" | awk '{print $$3}' | sort >t.exp echo Linking $@... $(DSOXX) $(ARCHFLAGS) $(DSOFLAGS) -o $@ \ -install_name $(libdir)/$@ \ -current_version 1.0.0 \ -compatibility_version 1.0.0 \ + -exported_symbols_list t.exp \ $(LIBOBJS) $(LIBS) - $(RM) libcupsppdc.dylib + $(RM) libcupsppdc.dylib t.exp $(LN) $@ libcupsppdc.dylib diff --git a/scheduler/auth.c b/scheduler/auth.c index 8d551abf04..4447ba1b08 100644 --- a/scheduler/auth.c +++ b/scheduler/auth.c @@ -1352,13 +1352,13 @@ cupsdCheckGroup( struct passwd *user, /* I - System user info */ const char *groupname) /* I - Group name */ { - int i; /* Looping var */ - struct group *group; /* System group info */ - char junk[33]; /* MD5 password (not used) */ + int i; /* Looping var */ + struct group *group; /* System group info */ + char junk[33]; /* MD5 password (not used) */ #ifdef HAVE_MBR_UID_TO_UUID - uuid_t useruuid, /* UUID for username */ - groupuuid; /* UUID for groupname */ - int is_member; /* True if user is a member of group */ + uuid_t useruuid, /* UUID for username */ + groupuuid; /* UUID for groupname */ + int is_member; /* True if user is a member of group */ #endif /* HAVE_MBR_UID_TO_UUID */ @@ -1404,24 +1404,40 @@ cupsdCheckGroup( * Check group membership through MacOS X membership API... */ - if (group) - { - if (mbr_gid_to_uuid(group->gr_gid, groupuuid)) - uuid_clear(groupuuid); - } - else if (groupname[0] == '#') + if (!mbr_uid_to_uuid(user->pw_uid, useruuid)) { - if (uuid_parse((char *)groupname + 1, groupuuid)) - uuid_clear(groupuuid); - } - else - uuid_clear(groupuuid); + if (group) + { + /* + * Map group name to UUID and check membership... + */ + + if (!mbr_gid_to_uuid(group->gr_gid, groupuuid)) + if (!mbr_check_membership(useruuid, groupuuid, &is_member)) + if (is_member) + return (1); + } + else if (groupname[0] == '#') + { + /* + * Use UUID directly and check for equality (user UUID) and + * membership (group UUID)... + */ - if (user && !uuid_is_null(groupuuid)) - if (!mbr_uid_to_uuid(user->pw_uid, useruuid)) - if (!mbr_check_membership(useruuid, groupuuid, &is_member)) - if (is_member) + if (!uuid_parse((char *)groupname + 1, groupuuid)) + { + if (!uuid_compare(useruuid, groupuuid)) return (1); + else if (!mbr_check_membership(useruuid, groupuuid, &is_member)) + if (is_member) + return (1); + } + + return (0); + } + } + else if (groupname[0] == '#') + return (0); #endif /* HAVE_MBR_UID_TO_UUID */ /* diff --git a/scheduler/classes.c b/scheduler/classes.c index 81d7c0b61b..3e905b448c 100644 --- a/scheduler/classes.c +++ b/scheduler/classes.c @@ -880,8 +880,25 @@ cupsdSaveAllClasses(void) cupsFilePrintf(fp, "JobSheets %s %s\n", pclass->job_sheets[0], pclass->job_sheets[1]); - for (i = 0; i < pclass->num_printers; i ++) - cupsFilePrintf(fp, "Printer %s\n", pclass->printers[i]->name); + for (i = 0; i < pclass->num_users; i ++) + { + if ((ptr = strchr(pclass->users[i], '#')) != NULL) + { + /* + * Need to quote the first # in the user string... + */ + + cupsFilePrintf(fp, "%sUser ", pclass->deny_users ? "Deny" : "Allow"); + cupsFileWrite(fp, pclass->users[i], ptr - pclass->users[i]); + cupsFilePutChar(fp, '\\'); + cupsFilePuts(fp, ptr); + cupsFilePutChar(fp, '\n'); + } + else + cupsFilePrintf(fp, "%sUser %s\n", + pclass->deny_users ? "Deny" : "Allow", + pclass->users[i]); + } cupsFilePrintf(fp, "QuotaPeriod %d\n", pclass->quota_period); cupsFilePrintf(fp, "PageLimit %d\n", pclass->page_limit); diff --git a/scheduler/ipp.c b/scheduler/ipp.c index 32e4dc2ad4..58e27f2f21 100644 --- a/scheduler/ipp.c +++ b/scheduler/ipp.c @@ -10793,7 +10793,7 @@ user_allowed(cupsd_printer_t *p, /* I - Printer or class */ for (i = 0; i < p->num_users; i ++) { - if (p->users[i][0] == '@' || p->users[i][0] == '#') + if (p->users[i][0] == '@') { /* * Check group membership... @@ -10802,6 +10802,15 @@ user_allowed(cupsd_printer_t *p, /* I - Printer or class */ if (cupsdCheckGroup(username, pw, p->users[i] + 1)) break; } + else if (p->users[i][0] == '#') + { + /* + * Check UUID... + */ + + if (cupsdCheckGroup(username, pw, p->users[i])) + break; + } else if (!strcasecmp(username, p->users[i])) break; } diff --git a/scheduler/printers.c b/scheduler/printers.c index a2e71fb931..3a63fc2e66 100644 --- a/scheduler/printers.c +++ b/scheduler/printers.c @@ -1,5 +1,5 @@ /* - * "$Id: printers.c 6970 2007-09-17 23:58:28Z mike $" + * "$Id: printers.c 7608 2008-05-21 01:37:21Z mike $" * * Printer routines for the Common UNIX Printing System (CUPS). * @@ -1247,6 +1247,9 @@ cupsdLoadAllPrinters(void) { for (; *valueptr && isspace(*valueptr & 255); *valueptr++ = '\0'); + if (!p->attrs) + cupsdSetPrinterAttrs(p); + cupsdSetPrinterAttr(p, value, valueptr); if (!strncmp(value, "marker-", 7)) @@ -1488,8 +1491,24 @@ cupsdSaveAllPrinters(void) cupsFilePrintf(fp, "KLimit %d\n", printer->k_limit); for (i = 0; i < printer->num_users; i ++) - cupsFilePrintf(fp, "%sUser %s\n", printer->deny_users ? "Deny" : "Allow", - printer->users[i]); + { + if ((ptr = strchr(printer->users[i], '#')) != NULL) + { + /* + * Need to quote the first # in the user string... + */ + + cupsFilePrintf(fp, "%sUser ", printer->deny_users ? "Deny" : "Allow"); + cupsFileWrite(fp, printer->users[i], ptr - printer->users[i]); + cupsFilePutChar(fp, '\\'); + cupsFilePuts(fp, ptr); + cupsFilePutChar(fp, '\n'); + } + else + cupsFilePrintf(fp, "%sUser %s\n", + printer->deny_users ? "Deny" : "Allow", + printer->users[i]); + } if (printer->op_policy) cupsFilePrintf(fp, "OpPolicy %s\n", printer->op_policy); @@ -1499,15 +1518,44 @@ cupsdSaveAllPrinters(void) for (i = printer->num_options, option = printer->options; i > 0; i --, option ++) - cupsFilePrintf(fp, "Option %s %s\n", option->name, option->value); + { + if ((ptr = strchr(option->value, '#')) != NULL) + { + /* + * Need to quote the first # in the option string... + */ + + cupsFilePrintf(fp, "Option %s ", option->name); + cupsFileWrite(fp, option->value, ptr - option->value); + cupsFilePutChar(fp, '\\'); + cupsFilePuts(fp, ptr); + cupsFilePutChar(fp, '\n'); + } + else + cupsFilePrintf(fp, "Option %s %s\n", option->name, option->value); + } if ((marker = ippFindAttribute(printer->attrs, "marker-colors", IPP_TAG_NAME)) != NULL) { - cupsFilePrintf(fp, "Attribute %s %s", marker->name, - marker->values[0].string.text); - for (i = 1; i < marker->num_values; i ++) - cupsFilePrintf(fp, ",%s", marker->values[i].string.text); + cupsFilePrintf(fp, "Attribute %s ", marker->name); + + for (i = 0, ptr = NULL; i < marker->num_values; i ++) + { + if (i) + cupsFilePutChar(fp, ','); + + if (!ptr && (ptr = strchr(marker->values[i].string.text, '#')) != NULL) + { + cupsFileWrite(fp, marker->values[i].string.text, + ptr - marker->values[i].string.text); + cupsFilePutChar(fp, '\\'); + cupsFilePuts(fp, ptr); + } + else + cupsFilePuts(fp, marker->values[i].string.text); + } + cupsFilePuts(fp, "\n"); } @@ -1524,20 +1572,48 @@ cupsdSaveAllPrinters(void) if ((marker = ippFindAttribute(printer->attrs, "marker-names", IPP_TAG_NAME)) != NULL) { - cupsFilePrintf(fp, "Attribute %s %s", marker->name, - marker->values[0].string.text); - for (i = 1; i < marker->num_values; i ++) - cupsFilePrintf(fp, ",%s", marker->values[i].string.text); + cupsFilePrintf(fp, "Attribute %s ", marker->name); + + for (i = 0, ptr = NULL; i < marker->num_values; i ++) + { + if (i) + cupsFilePutChar(fp, ','); + + if (!ptr && (ptr = strchr(marker->values[i].string.text, '#')) != NULL) + { + cupsFileWrite(fp, marker->values[i].string.text, + ptr - marker->values[i].string.text); + cupsFilePutChar(fp, '\\'); + cupsFilePuts(fp, ptr); + } + else + cupsFilePuts(fp, marker->values[i].string.text); + } + cupsFilePuts(fp, "\n"); } if ((marker = ippFindAttribute(printer->attrs, "marker-types", IPP_TAG_KEYWORD)) != NULL) { - cupsFilePrintf(fp, "Attribute %s %s", marker->name, - marker->values[0].string.text); - for (i = 1; i < marker->num_values; i ++) - cupsFilePrintf(fp, ",%s", marker->values[i].string.text); + cupsFilePrintf(fp, "Attribute %s ", marker->name); + + for (i = 0, ptr = NULL; i < marker->num_values; i ++) + { + if (i) + cupsFilePutChar(fp, ','); + + if (!ptr && (ptr = strchr(marker->values[i].string.text, '#')) != NULL) + { + cupsFileWrite(fp, marker->values[i].string.text, + ptr - marker->values[i].string.text); + cupsFilePutChar(fp, '\\'); + cupsFilePuts(fp, ptr); + } + else + cupsFilePuts(fp, marker->values[i].string.text); + } + cupsFilePuts(fp, "\n"); } @@ -1850,6 +1926,7 @@ cupsdSetPrinterAttrs(cupsd_printer_t *p)/* I - Printer to setup */ *media_quality, /* EFMediaQualityMode options */ *duplex; /* Duplex options */ ppd_attr_t *ppdattr; /* PPD attribute */ + ipp_t *oldattrs; /* Old printer attributes */ ipp_attribute_t *attr; /* Attribute data */ ipp_value_t *val; /* Attribute value */ int num_finishings; /* Number of finishings */ @@ -1971,9 +2048,7 @@ cupsdSetPrinterAttrs(cupsd_printer_t *p)/* I - Printer to setup */ * Create the required IPP attributes for a printer... */ - if (p->attrs) - ippDelete(p->attrs); - + oldattrs = p->attrs; p->attrs = ippNew(); ippAddString(p->attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD, @@ -2640,6 +2715,69 @@ cupsdSetPrinterAttrs(cupsd_printer_t *p)/* I - Printer to setup */ } } + /* + * Copy marker attributes as needed... + */ + + if (oldattrs) + { + ipp_attribute_t *oldattr; /* Old attribute */ + + + if ((oldattr = ippFindAttribute(oldattrs, "marker-colors", + IPP_TAG_NAME)) != NULL) + { + if ((attr = ippAddStrings(p->attrs, IPP_TAG_PRINTER, IPP_TAG_NAME, + "marker-colors", oldattr->num_values, NULL, + NULL)) != NULL) + { + for (i = 0; i < oldattr->num_values; i ++) + attr->values[i].string.text = + _cupsStrAlloc(oldattr->values[i].string.text); + } + } + + if ((oldattr = ippFindAttribute(oldattrs, "marker-levels", + IPP_TAG_INTEGER)) != NULL) + { + if ((attr = ippAddIntegers(p->attrs, IPP_TAG_PRINTER, IPP_TAG_INTEGER, + "marker-levels", oldattr->num_values, + NULL)) != NULL) + { + for (i = 0; i < oldattr->num_values; i ++) + attr->values[i].integer = oldattr->values[i].integer; + } + } + + if ((oldattr = ippFindAttribute(oldattrs, "marker-names", + IPP_TAG_NAME)) != NULL) + { + if ((attr = ippAddStrings(p->attrs, IPP_TAG_PRINTER, IPP_TAG_NAME, + "marker-names", oldattr->num_values, NULL, + NULL)) != NULL) + { + for (i = 0; i < oldattr->num_values; i ++) + attr->values[i].string.text = + _cupsStrAlloc(oldattr->values[i].string.text); + } + } + + if ((oldattr = ippFindAttribute(oldattrs, "marker-types", + IPP_TAG_KEYWORD)) != NULL) + { + if ((attr = ippAddStrings(p->attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD, + "marker-types", oldattr->num_values, NULL, + NULL)) != NULL) + { + for (i = 0; i < oldattr->num_values; i ++) + attr->values[i].string.text = + _cupsStrAlloc(oldattr->values[i].string.text); + } + } + + ippDelete(oldattrs); + } + /* * Force sharing off for remote queues... */ @@ -4182,5 +4320,5 @@ write_irix_state(cupsd_printer_t *p) /* I - Printer to update */ /* - * End of "$Id: printers.c 6970 2007-09-17 23:58:28Z mike $". + * End of "$Id: printers.c 7608 2008-05-21 01:37:21Z mike $". */ diff --git a/templates/classes.tmpl b/templates/classes.tmpl index e40103413f..e75dfb7a82 100644 --- a/templates/classes.tmpl +++ b/templates/classes.tmpl @@ -41,5 +41,5 @@ -}} +}