Skip to content

Commit 1297d37

Browse files
committed
Fix crash in unit tests.
Only test pinning for self-signed certs. Fix sanity check for cupsSaveCredentials (copy/paste error)
1 parent fb52b69 commit 1297d37

4 files changed

Lines changed: 7 additions & 7 deletions

File tree

cups/request.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -902,14 +902,14 @@ _cupsSetHTTPError(http_t *http, // I - HTTP connection
902902
{
903903
switch (status)
904904
{
905+
case HTTP_STATUS_NOT_MODIFIED :
906+
_cupsSetError(IPP_STATUS_OK_EVENTS_COMPLETE, httpStatusString(status), false);
907+
break;
908+
905909
case HTTP_STATUS_NOT_FOUND :
906910
_cupsSetError(IPP_STATUS_ERROR_NOT_FOUND, httpStatusString(status), false);
907911
break;
908912

909-
case HTTP_STATUS_NOT_MODIFIED :
910-
_cupsSetError(IPP_STATUS_OK_EVENTS_COMPLETE, httpStatusString(status), false);
911-
break;
912-
913913
case HTTP_STATUS_UNAUTHORIZED :
914914
_cupsSetError(IPP_STATUS_ERROR_NOT_AUTHENTICATED, httpStatusString(status), false);
915915
break;

cups/tls-gnutls.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -829,7 +829,7 @@ cupsGetCredentialsTrust(
829829
}
830830

831831
// Look this common name up in the default keychains...
832-
if ((tcreds = cupsCopyCredentials(path, common_name)) != NULL)
832+
if (num_certs == 1 && (tcreds = cupsCopyCredentials(path, common_name)) != NULL)
833833
{
834834
char credentials_str[1024], // String for incoming credentials
835835
tcreds_str[1024]; // String for saved credentials

cups/tls-openssl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -890,7 +890,7 @@ cupsGetCredentialsTrust(
890890
}
891891

892892
// Look this common name up in the default keychains...
893-
if ((tcreds = cupsCopyCredentials(path, common_name)) != NULL)
893+
if (sk_X509_num(certs) == 1 && (tcreds = cupsCopyCredentials(path, common_name)) != NULL)
894894
{
895895
char credentials_str[1024], // String for incoming credentials
896896
tcreds_str[1024]; // String for saved credentials

cups/tls.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ cupsSaveCredentials(
140140
if (credentials)
141141
{
142142
// Make sure it looks like a PEM-encoded cert...
143-
if (strncmp(credentials, "-----BEGIN CERTIFICATE-----", 27) || strstr(key, "-----END CERTIFICATE-----") == NULL)
143+
if (strncmp(credentials, "-----BEGIN CERTIFICATE-----", 27) || strstr(credentials, "-----END CERTIFICATE-----") == NULL)
144144
return (false);
145145
}
146146

0 commit comments

Comments
 (0)