Index: cups/http.c =================================================================== --- cups/http.c (revision 10903) +++ cups/http.c (working copy) @@ -3,7 +3,7 @@ * * HTTP routines for CUPS. * - * Copyright 2007-2012 by Apple Inc. + * Copyright 2007-2013 by Apple Inc. * Copyright 1997-2007 by Easy Software Products, all rights reserved. * * This file contains Kerberos support code, copyright 2006 by @@ -3895,7 +3895,8 @@ int any_root; /* Allow any root */ char hostname[256], /* Hostname */ *hostptr; /* Pointer into hostname */ - + _cups_globals_t *cg = _cupsGlobals(); + /* Pointer to library globals */ # ifdef HAVE_LIBSSL SSL_CTX *context; /* Context for encryption */ BIO *bio; /* BIO data */ @@ -3905,8 +3906,6 @@ gnutls_certificate_client_credentials *credentials; /* TLS credentials */ # elif defined(HAVE_CDSASSL) - _cups_globals_t *cg = _cupsGlobals(); - /* Pointer to library globals */ OSStatus error; /* Error code */ const char *message = NULL;/* Error message */ # ifdef HAVE_SECCERTIFICATECOPYDATA Index: cups/auth.c =================================================================== --- cups/auth.c (revision 10903) +++ cups/auth.c (working copy) @@ -3,7 +3,7 @@ * * Authentication functions for CUPS. * - * Copyright 2007-2012 by Apple Inc. + * Copyright 2007-2013 by Apple Inc. * Copyright 1997-2007 by Easy Software Products. * * This file contains Kerberos support code, copyright 2006 by @@ -660,8 +660,7 @@ int pid; /* Current process ID */ FILE *fp; /* Certificate file */ char trc[16], /* Try Root Certificate parameter */ - filename[1024], /* Certificate filename */ - certificate[33];/* Certificate string */ + filename[1024]; /* Certificate filename */ _cups_globals_t *cg = _cupsGlobals(); /* Global data */ # if defined(HAVE_AUTHORIZATION_H) OSStatus status; /* Status */ @@ -855,19 +854,25 @@ * Read the certificate from the file... */ - fgets(certificate, sizeof(certificate), fp); + char certificate[33], /* Certificate string */ + *certptr; /* Pointer to certificate string */ + + certptr = fgets(certificate, sizeof(certificate), fp); fclose(fp); - /* - * Set the authorization string and return... - */ + if (certptr) + { + /* + * Set the authorization string and return... + */ - httpSetAuthString(http, "Local", certificate); + httpSetAuthString(http, "Local", certificate); - DEBUG_printf(("8cups_local_auth: Returning authstring=\"%s\"", - http->authstring)); + DEBUG_printf(("8cups_local_auth: Returning authstring=\"%s\"", + http->authstring)); - return (0); + return (0); + } } return (1);