MCPcopy Create free account
hub / github.com/OpenPrinting/cups / httpCopyCredentials

Function httpCopyCredentials

cups/tls-gnutls.c:318–351  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

316 */
317
318int /* O - Status of call (0 = success) */
319httpCopyCredentials(
320 http_t *http, /* I - Connection to server */
321 cups_array_t **credentials) /* O - Array of credentials */
322{
323 unsigned count; /* Number of certificates */
324 const gnutls_datum_t *certs; /* Certificates */
325
326
327 DEBUG_printf(("httpCopyCredentials(http=%p, credentials=%p)", http, credentials));
328
329 if (credentials)
330 *credentials = NULL;
331
332 if (!http || !http->tls || !credentials)
333 return (-1);
334
335 *credentials = cupsArrayNew(NULL, NULL);
336 certs = gnutls_certificate_get_peers(http->tls, &count);
337
338 DEBUG_printf(("1httpCopyCredentials: certs=%p, count=%u", certs, count));
339
340 if (certs && count)
341 {
342 while (count > 0)
343 {
344 httpAddCredential(*credentials, certs->data, certs->size);
345 certs ++;
346 count --;
347 }
348 }
349
350 return (0);
351}
352
353
354/*

Callers

nothing calls this directly

Calls 2

cupsArrayNewFunction · 0.85
httpAddCredentialFunction · 0.85

Tested by

no test coverage detected