]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - scheduler/cert.c
Fix a scheduler crash bug (rdar://42198057)
[thirdparty/cups.git] / scheduler / cert.c
index 92ca3650b3b1954a88a73104539efa44c920c533..192ad8ad9db6c748acb2aa82a88c534b04b3ce8c 100644 (file)
@@ -1,16 +1,10 @@
 /*
- * "$Id$"
- *
  * Authentication certificate routines for the CUPS scheduler.
  *
- * Copyright 2007-2015 by Apple Inc.
+ * Copyright 2007-2016 by Apple Inc.
  * Copyright 1997-2006 by Easy Software Products.
  *
- * These coded instructions, statements, and computer programs are the
- * property of Apple Inc. and are protected by Federal copyright
- * law.  Distribution and use rights are outlined in the file "LICENSE.txt"
- * which should have been included with this file.  If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * Licensed under Apache License v2.0.  See the file "LICENSE" for more information.
  */
 
 /*
@@ -108,8 +102,7 @@ cupsdAddCert(int        pid,                /* I - Process ID */
     fchmod(fd, 0440);
     fchown(fd, RunUser, SystemGroupIDs[0]);
 
-    cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdAddCert: NumSystemGroups=%d",
-                    NumSystemGroups);
+    cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdAddCert: NumSystemGroups=%d", NumSystemGroups);
 
 #ifdef HAVE_ACL_INIT
     if (NumSystemGroups > 1)
@@ -123,7 +116,7 @@ cupsdAddCert(int        pid,                /* I - Process ID */
 
 #  ifdef HAVE_MBR_UID_TO_UUID
      /*
-      * On MacOS X, ACLs use UUIDs instead of GIDs...
+      * On macOS, ACLs use UUIDs instead of GIDs...
       */
 
       acl = acl_init(NumSystemGroups - 1);
@@ -285,8 +278,7 @@ cupsdDeleteCert(int pid)            /* I - Process ID */
       * Remove this certificate from the list...
       */
 
-      cupsdLogMessage(CUPSD_LOG_DEBUG2,
-                      "cupsdDeleteCert: Removing certificate for PID %d", pid);
+      cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdDeleteCert: Removing certificate for PID %d.", pid);
 
       DEBUG_printf(("DELETE pid=%d, username=%s, cert=%s\n", cert->pid,
                     cert->username, cert->certificate));
@@ -360,17 +352,15 @@ cupsdFindCert(const char *certificate)    /* I - Certificate */
   cupsd_cert_t *cert;                  /* Current certificate */
 
 
-  cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdFindCert(certificate=%s)",
-                  certificate);
+  cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdFindCert(certificate=%s)", certificate);
   for (cert = Certs; cert != NULL; cert = cert->next)
     if (!ctcompare(certificate, cert->certificate))
     {
-      cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdFindCert: Returning %s...",
-                      cert->username);
+      cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdFindCert: Returning \"%s\".", cert->username);
       return (cert);
     }
 
-  cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdFindCert: Certificate not found!");
+  cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdFindCert: Certificate not found.");
 
   return (NULL);
 }
@@ -444,12 +434,11 @@ ctcompare(const char *a,          /* I - First string */
 
 
   while (*a && *b)
+  {
     result |= *a ^ *b;
+    a ++;
+    b ++;
+  }
 
   return (result);
 }
-
-
-/*
- * End of "$Id$".
- */