]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - scheduler/ipp.c
Merge changes from CUPS trunk, r7566.
[thirdparty/cups.git] / scheduler / ipp.c
index f660dc29bdd6474277f56f8df8c02bd10c18d867..23f55f5628e0a02dfcfaa21969d20527c3e37c58 100644 (file)
@@ -2970,7 +2970,11 @@ apple_init_profile(
         language = (char *)cupsArrayNext(languages))
     {
       if (iccfile)
-        attr = _ppdLocalizedAttr(ppd, "cupsICCProfile", name, language);
+      {
+        if ((attr = _ppdLocalizedAttr(ppd, "cupsICCProfile", name,
+                                     language)) == NULL)
+         attr = _ppdLocalizedAttr(ppd, "APTiogaProfile", name, language);
+      }
       else
         attr = _ppdLocalizedAttr(ppd, "ColorModel", name, language);
 
@@ -3030,6 +3034,7 @@ apple_register_profiles(
   ppd_file_t           *ppd;           /* PPD file */
   ppd_attr_t           *attr,          /* cupsICCProfile attributes */
                        *profileid_attr;/* cupsProfileID attribute */
+  const char           *profile_key;   /* Profile keyword */
   ppd_option_t         *cm_option;     /* Color model option */
   ppd_choice_t         *cm_choice,     /* Color model choice */
                        *q1_choice,     /* ColorModel (or other) qualifier */
@@ -3074,9 +3079,15 @@ apple_register_profiles(
   * See if we have any profiles...
   */
 
-  for (num_profiles = 0, attr = ppdFindAttr(ppd, "cupsICCProfile", NULL);
-       attr;
-       attr = ppdFindNextAttr(ppd, "cupsICCProfile", NULL))
+  if ((attr = ppdFindAttr(ppd, "APTiogaProfile", NULL)) != NULL)
+    profile_key = "APTiogaProfile";
+  else
+  {
+    attr = ppdFindAttr(ppd, "cupsICCProfile", NULL);
+    profile_key = "cupsICCProfile";
+  }
+
+  for (num_profiles = 0; attr; attr = ppdFindNextAttr(ppd, profile_key, NULL))
     if (attr->spec[0] && attr->value && attr->value[0])
     {
       if (attr->value[0] != '/')
@@ -3091,6 +3102,7 @@ apple_register_profiles(
       num_profiles ++;
     }
 
+  
  /*
   * If we have profiles, add them...
   */
@@ -3138,9 +3150,9 @@ apple_register_profiles(
     languages              = _ppdGetLanguages(ppd);
 
     for (profile = profiles->profiles,
-             attr = ppdFindAttr(ppd, "cupsICCProfile", NULL);
+             attr = ppdFindAttr(ppd, profile_key, NULL);
         attr;
-        attr = ppdFindNextAttr(ppd, "cupsICCProfile", NULL))
+        attr = ppdFindNextAttr(ppd, profile_key, NULL))
       if (attr->spec[0] && attr->value && attr->value[0])
       {
        /*
@@ -3156,16 +3168,21 @@ apple_register_profiles(
         if (access(iccfile, 0))
          continue;
 
-        cupsArraySave(ppd->sorted_attrs);
+        if (profile_key[0] == 'c')
+       {
+         cupsArraySave(ppd->sorted_attrs);
 
-       if ((profileid_attr = ppdFindAttr(ppd, "cupsProfileID",
-                                         attr->spec)) != NULL &&
-            profileid_attr->value && isdigit(profileid_attr->value[0] & 255))
-          profile_id = (unsigned)strtoul(profileid_attr->value, NULL, 10);
-       else
-         profile_id = _ppdHashName(attr->spec);
+         if ((profileid_attr = ppdFindAttr(ppd, "cupsProfileID",
+                                           attr->spec)) != NULL &&
+             profileid_attr->value && isdigit(profileid_attr->value[0] & 255))
+           profile_id = (unsigned)strtoul(profileid_attr->value, NULL, 10);
+         else
+           profile_id = _ppdHashName(attr->spec);
 
-       cupsArrayRestore(ppd->sorted_attrs);
+         cupsArrayRestore(ppd->sorted_attrs);
+        }
+       else
+         profile_id = atoi(attr->spec);
 
         apple_init_profile(ppd, languages, profile, profile_id, attr->spec,
                           attr->text[0] ? attr->text : attr->spec, iccfile);
@@ -4166,8 +4183,13 @@ check_quotas(cupsd_client_t  *con,       /* I - Client connection */
        */
 
 #ifdef HAVE_MBR_UID_TO_UUID
-       if ((mbr_err = mbr_group_name_to_uuid((char *)p->users[i] + 1,
-                                             grp_uuid)) != 0)
+        if (p->users[i][1] == '#')
+       {
+         if (uuid_parse((char *)p->users[i] + 2, grp_uuid))
+           uuid_clear(grp_uuid);
+       }
+       else if ((mbr_err = mbr_group_name_to_uuid((char *)p->users[i] + 1,
+                                                  grp_uuid)) != 0)
        {
         /*
          * Invalid ACL entries are ignored for matching; just record a
@@ -4181,28 +4203,27 @@ check_quotas(cupsd_client_t  *con,      /* I - Client connection */
                          "Access control entry \"%s\" not a valid group name; "
                          "entry ignored", p->users[i]);
        }
-       else
-       {
-         if ((mbr_err = mbr_check_membership(usr_uuid, grp_uuid,
-                                             &is_member)) != 0)
-         {
-          /*
-           * At this point, there should be no errors, but check anyways...
-           */
-
-           cupsdLogMessage(CUPSD_LOG_DEBUG,
-                           "check_quotas: group \"%s\" membership check "
-                           "failed (err=%d)", p->users[i] + 1, mbr_err);
-            is_member = 0;
-         }
 
-         /*
-         * Stop if we found a match...
+       if ((mbr_err = mbr_check_membership(usr_uuid, grp_uuid,
+                                           &is_member)) != 0)
+       {
+        /*
+         * At this point, there should be no errors, but check anyways...
          */
 
-         if (is_member)
-           break;
+         cupsdLogMessage(CUPSD_LOG_DEBUG,
+                         "check_quotas: group \"%s\" membership check "
+                         "failed (err=%d)", p->users[i] + 1, mbr_err);
+         is_member = 0;
        }
+
+       /*
+       * Stop if we found a match...
+       */
+
+       if (is_member)
+         break;
+
 #else
         if (cupsdCheckGroup(username, pw, p->users[i] + 1))
          break;
@@ -4211,8 +4232,13 @@ check_quotas(cupsd_client_t  *con,       /* I - Client connection */
 #ifdef HAVE_MBR_UID_TO_UUID
       else
       {
-        if ((mbr_err = mbr_user_name_to_uuid((char *)p->users[i],
-                                            usr2_uuid)) != 0)
+        if (p->users[i][0] == '#')
+       {
+         if (uuid_parse((char *)p->users[i] + 1, usr2_uuid))
+           uuid_clear(usr2_uuid);
+        }
+        else if ((mbr_err = mbr_user_name_to_uuid((char *)p->users[i],
+                                                 usr2_uuid)) != 0)
        {
         /*
          * Invalid ACL entries are ignored for matching; just record a
@@ -4226,20 +4252,18 @@ check_quotas(cupsd_client_t  *con,      /* I - Client connection */
                          "Access control entry \"%s\" not a valid user name; "
                          "entry ignored", p->users[i]);
        }
-       else
-       {
-         if ((mbr_err = mbr_check_membership(usr_uuid, usr2_uuid,
-                                             &is_member)) != 0)
-          {
-           cupsdLogMessage(CUPSD_LOG_DEBUG,
-                           "check_quotas: User \"%s\" identity check failed "
-                           "(err=%d)", p->users[i], mbr_err);
-           is_member = 0;
-         }
 
-         if (is_member)
-           break;
+       if ((mbr_err = mbr_check_membership(usr_uuid, usr2_uuid,
+                                           &is_member)) != 0)
+       {
+         cupsdLogMessage(CUPSD_LOG_DEBUG,
+                         "check_quotas: User \"%s\" identity check failed "
+                         "(err=%d)", p->users[i], mbr_err);
+         is_member = 0;
        }
+
+       if (is_member)
+         break;
       }
 #else
       else if (!strcasecmp(username, p->users[i]))