[automerger skipped] Update libcups to v2.2.9 RESTRICT AUTOMERGE am: 1d296f843d -s ours
am: c32a540593 -s ours
am skip reason: subject contains skip directive
Change-Id: I4b3046efd3b4db3d9ed7c8e807a6728a1beb0eeb
diff --git a/METADATA b/METADATA
new file mode 100644
index 0000000..80b0191
--- /dev/null
+++ b/METADATA
@@ -0,0 +1,18 @@
+name: "libcups"
+description: "CUPS is the standards-based, open source printing system."
+third_party {
+ url {
+ type: HOMEPAGE
+ value: "https://www.cups.org/"
+ }
+ url {
+ type: ARCHIVE
+ value: "https://github.com/apple/cups/releases/download/v2.2.6/cups-2.2.6-source.tar.gz"
+ }
+ version: "v2.2.6"
+ last_upgrade_date {
+ year: 2018
+ month: 3
+ day: 16
+ }
+}
diff --git a/OWNERS b/OWNERS
new file mode 100644
index 0000000..930fb06
--- /dev/null
+++ b/OWNERS
@@ -0,0 +1,4 @@
+# Default code reviewers picked from top 3 or more developers.
+# Please update this list if you find better candidates.
+moltmann@google.com
+# used by packages/services/BuiltInPrintService
diff --git a/cups/tls-boringssl.c b/cups/tls-boringssl.c
index c3f9abc..6dab074 100644
--- a/cups/tls-boringssl.c
+++ b/cups/tls-boringssl.c
@@ -422,6 +422,35 @@
return (-1);
}
+ _cups_globals_t *cg = _cupsGlobals();
+ if (cg->server_cert_cb)
+ {
+ int error = 0;
+ X509 *peer_certificate = SSL_get_peer_certificate(http->tls);
+ if (peer_certificate)
+ {
+ ASN1_BIT_STRING *key = X509_get0_pubkey_bitstr(peer_certificate);
+ cups_array_t *credentials = cupsArrayNew(NULL, NULL);
+
+ if (credentials != NULL)
+ {
+ httpAddCredential(credentials, key->data, key->length);
+ error = cg->server_cert_cb(http, http->tls, credentials, cg->server_cert_data);
+ httpFreeCredentials(credentials);
+ }
+ X509_free(peer_certificate);
+ }
+
+ if (error != 0)
+ {
+ http->error = errno = EINVAL;
+ http->status = HTTP_STATUS_ERROR;
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("Client rejected the server certificate."), 1);
+ }
+
+ return (error);
+ }
+
return (0);
}