]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Merge changes from CUPS 1.4svn-r7614.
authormsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>
Fri, 23 May 2008 22:28:53 +0000 (22:28 +0000)
committermsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>
Fri, 23 May 2008 22:28:53 +0000 (22:28 +0000)
git-svn-id: svn+ssh://src.apple.com/svn/cups/easysw/current@789 a1ca3aef-8c08-0410-bb20-df032aa958be

Makefile
cups/getdevices.c
ppdc/Makefile
scheduler/auth.c
scheduler/classes.c
scheduler/ipp.c
scheduler/printers.c
templates/classes.tmpl

index 733c86b5328102579bc35037055ddace91288025..1c83cc513524aa1af9958ed63abedb6883980bec 100644 (file)
--- 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
 
index 6843e5afd12562c07deedfdd5cd43e4104798c9b..d0e1cf2fa6061fc12c34f310a440484b20d5559b 100644 (file)
@@ -232,6 +232,7 @@ cupsGetDevices(
   */
 
   httpBlocking(http, blocking);
+  httpFlush(http);
 
   if (status == IPP_ERROR)
     _cupsSetError(IPP_ERROR, NULL);
index bc3c052680dee6edb58ca881c4f1384d92fd0504..fc0fbc885eabe411023442d8d9f371f2cc20497e 100644 (file)
@@ -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
 
 
index 8d551abf044cd25d7e9ad1ab820ff8965f3fcc26..4447ba1b082ba17c1e22316b85ff69559d93ed34 100644 (file)
@@ -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 */
 
  /*
index 81d7c0b61bfc53f27fc3d54bd0792767de389628..3e905b448c7ccbb01927b158ca1ed2bdaa2c9dc0 100644 (file)
@@ -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);
index 32e4dc2ad4b79f13677e92224a1cb9e4ac918244..58e27f2f21c2f1420710d99aa64725ea5c7cd7ff 100644 (file)
@@ -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;
   }
index a2e71fb931bc698d363f0065f5a17464c5d7db4b..3a63fc2e668b80f792abfb5989521fec35af40d6 100644 (file)
@@ -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 $".
  */
index e40103413fe7c43bc709d45533ae84f181afe5b6..e75dfb7a822807d351a922aa1010b9cae6dd0213 100644 (file)
@@ -41,5 +41,5 @@
 </TD>
 </TR>
 </TABLE>
-}}
+}
 <BR>