Skip to content

Commit 2f33ee7

Browse files
committed
Sync up documentation and other changes from CUPS 2.x.
1 parent 213660f commit 2f33ee7

3 files changed

Lines changed: 26 additions & 23 deletions

File tree

cups/auth.c

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,7 @@ cupsDoAuthentication(
8383
}
8484
}
8585

86-
//
8786
// Nope, loop through the authentication schemes to find the first we support.
88-
//
89-
9087
www_auth = httpGetField(http, HTTP_FIELD_WWW_AUTHENTICATE);
9188

9289
for (schemedata = cups_auth_scheme(www_auth, scheme, sizeof(scheme)); schemedata; schemedata = cups_auth_scheme(schemedata + strlen(scheme), scheme, sizeof(scheme)))
@@ -147,8 +144,8 @@ cupsDoAuthentication(
147144

148145
cupsLangFormatString(cg->lang_default, prompt, sizeof(prompt), _("Password for %s on %s? "), cupsGetUser(), http->hostname[0] == '/' ? "localhost" : http->hostname);
149146

150-
http->digest_tries = _cups_strncasecmp(scheme, "Digest", 6) != 0;
151-
http->userpass[0] = '\0';
147+
http->digest_tries = _cups_strncasecmp(scheme, "Digest", 6) != 0;
148+
http->userpass[0] = '\0';
152149

153150
if ((password = cupsGetPassword(prompt, http, method, resource)) == NULL)
154151
{
@@ -358,7 +355,8 @@ cups_auth_param(const char *scheme, // I - Pointer to auth data
358355
scheme ++;
359356
}
360357

361-
// If this wasn't a parameter, we are at the end of this scheme's parameters...
358+
// If this wasn't a parameter, we are at the end of this scheme's
359+
// parameters...
362360
if (!param)
363361
break;
364362
}
@@ -374,7 +372,7 @@ cups_auth_param(const char *scheme, // I - Pointer to auth data
374372
//
375373
// 'cups_auth_scheme()' - Get the (next) WWW-Authenticate scheme.
376374
//
377-
// The "www_authenticate" parameter points to the current position in the header.
375+
// The "www_authenticate" argument points to the current position in the header.
378376
//
379377
// Returns `NULL` if there are no (more) auth schemes present.
380378
//
@@ -390,7 +388,7 @@ cups_auth_scheme(const char *www_authenticate, // I - Pointer into WWW-Authentic
390388
bool param; // Is this a parameter?
391389

392390

393-
DEBUG_printf("8cups_auth_scheme(www_authenticate=\"%s\", scheme=%p, schemesize=%d)", www_authenticate, (void *)scheme, (int)schemesize);
391+
DEBUG_printf("8cups_auth_scheme(www_authenticate=\"%s\", scheme=%p, schemesize=%u)", www_authenticate, (void *)scheme, (unsigned)schemesize);
394392

395393
while (*www_authenticate)
396394
{
@@ -439,7 +437,7 @@ cups_auth_scheme(const char *www_authenticate, // I - Pointer into WWW-Authentic
439437

440438

441439
//
442-
// 'cups_do_local_auth()' - Use local peer credentials if available/applicable.
440+
// 'cups_do_local_auth()' - Use local credentials if available/applicable.
443441
//
444442

445443
static bool // O - `true` if authorized, `false` otherwise

cups/tls-gnutls.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1876,7 +1876,12 @@ _httpTLSStart(http_t *http) // I - Connection to server
18761876
return (false);
18771877
}
18781878

1879-
cupsCopyString(priority_string, "NORMAL", sizeof(priority_string));
1879+
if (tls_options & _HTTP_TLS_NO_SYSTEM)
1880+
priority_string[0] = '\0';
1881+
else
1882+
cupsCopyString(priority_string, "@SYSTEM,", sizeof(priority_string));
1883+
1884+
cupsConcatString(priority_string, "NORMAL", sizeof(priority_string));
18801885

18811886
if (tls_max_version < _HTTP_TLS_MAX)
18821887
{
@@ -1984,7 +1989,7 @@ _httpTLSStop(http_t *http) // I - Connection to server
19841989
int error; // Error code
19851990

19861991

1987-
error = gnutls_bye(http->tls, http->mode == _HTTP_MODE_CLIENT ? GNUTLS_SHUT_RDWR : GNUTLS_SHUT_WR);
1992+
error = gnutls_bye(http->tls, GNUTLS_SHUT_RDWR);
19881993
if (error != GNUTLS_E_SUCCESS)
19891994
_cupsSetError(IPP_STATUS_ERROR_INTERNAL, gnutls_strerror(errno), 0);
19901995

cups/tls-openssl.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ cupsCreateCredentials(
284284
cups_credusage_t usage_bit; // Current usage
285285

286286

287-
DEBUG_printf("cupsCreateCredentials(path=\"%s\", ca_cert=%s, purpose=0x%x, type=%d, usage=0x%x, organization=\"%s\", org_unit=\"%s\", locality=\"%s\", state_province=\"%s\", country=\"%s\", common_name=\"%s\", num_alt_names=%u, alt_names=%p, root_name=\"%s\", expiration_date=%ld)", path, ca_cert ? "true" : "false", purpose, type, usage, organization, org_unit, locality, state_province, country, common_name, (unsigned)num_alt_names, alt_names, root_name, (long)expiration_date);
287+
DEBUG_printf("cupsCreateCredentials(path=\"%s\", ca_cert=%s, purpose=0x%x, type=%d, usage=0x%x, organization=\"%s\", org_unit=\"%s\", locality=\"%s\", state_province=\"%s\", country=\"%s\", common_name=\"%s\", num_alt_names=%u, alt_names=%p, root_name=\"%s\", expiration_date=%ld)", path, ca_cert ? "true" : "false", purpose, type, usage, organization, org_unit, locality, state_province, country, common_name, (unsigned)num_alt_names, (void *)alt_names, root_name, (long)expiration_date);
288288

289289
// Filenames...
290290
if (!path)
@@ -600,7 +600,7 @@ cupsCreateCredentialsRequest(
600600
cups_credusage_t usage_bit; // Current usage
601601

602602

603-
DEBUG_printf("cupsCreateCredentialsRequest(path=\"%s\", purpose=0x%x, type=%d, usage=0x%x, organization=\"%s\", org_unit=\"%s\", locality=\"%s\", state_province=\"%s\", country=\"%s\", common_name=\"%s\", num_alt_names=%u, alt_names=%p)", path, purpose, type, usage, organization, org_unit, locality, state_province, country, common_name, (unsigned)num_alt_names, alt_names);
603+
DEBUG_printf("cupsCreateCredentialsRequest(path=\"%s\", purpose=0x%x, type=%d, usage=0x%x, organization=\"%s\", org_unit=\"%s\", locality=\"%s\", state_province=\"%s\", country=\"%s\", common_name=\"%s\", num_alt_names=%u, alt_names=%p)", path, purpose, type, usage, organization, org_unit, locality, state_province, country, common_name, (unsigned)num_alt_names, (void *)alt_names);
604604

605605
// Filenames...
606606
if (!path)
@@ -777,7 +777,7 @@ cupsGetCredentialsInfo(
777777

778778

779779
// Range check input...
780-
DEBUG_printf("cupsGetCredentialsInfo(credentials=%p, buffer=%p, bufsize=" CUPS_LLFMT ")", credentials, buffer, CUPS_LLCAST bufsize);
780+
DEBUG_printf("cupsGetCredentialsInfo(credentials=%p, buffer=%p, bufsize=" CUPS_LLFMT ")", credentials, (void *)buffer, CUPS_LLCAST bufsize);
781781

782782
if (buffer)
783783
*buffer = '\0';
@@ -898,7 +898,7 @@ cupsGetCredentialsTrust(
898898
_cups_globals_t *cg = _cupsGlobals(); // Per-thread globals
899899

900900

901-
DEBUG_printf("cupsGetCredentialsTrust(path=\"%s\", common_name=\"%s\", credentials=%p, require_ca=%s)", path, common_name, (void *)credentials, require_ca ? "true" : "false");
901+
DEBUG_printf("cupsGetCredentialsTrust(path=\"%s\", common_name=\"%s\", credentials=\"%lu bytes\", require_ca=%s)", path, common_name, (unsigned long)(credentials ? strlen(credentials) : 0), require_ca ? "true" : "false");
902902

903903
// Range check input...
904904
if (!path)
@@ -1135,7 +1135,7 @@ cupsSignCredentialsRequest(
11351135
saw_san = false; // Saw NID_subject_alt_name?
11361136

11371137

1138-
DEBUG_printf("cupsSignCredentialsRequest(path=\"%s\", common_name=\"%s\", request=\"%s\", root_name=\"%s\", allowed_purpose=0x%x, allowed_usage=0x%x, cb=%p, cb_data=%p, expiration_date=%ld)", path, common_name, request, root_name, allowed_purpose, allowed_usage, cb, cb_data, (long)expiration_date);
1138+
DEBUG_printf("cupsSignCredentialsRequest(path=\"%s\", common_name=\"%s\", request=\"%s\", root_name=\"%s\", allowed_purpose=0x%x, allowed_usage=0x%x, cb=%p, cb_data=%p, expiration_date=%ld)", path, common_name, request, root_name, allowed_purpose, allowed_usage, (void *)cb, cb_data, (long)expiration_date);
11391139

11401140
// Filenames...
11411141
if (!path)
@@ -1482,14 +1482,14 @@ httpCopyPeerCredentials(http_t *http) // I - Connection to server
14821482
STACK_OF(X509) *chain; // Certificate chain
14831483

14841484

1485-
DEBUG_printf("httpCopyPeerCredentials(http=%p)", http);
1485+
DEBUG_printf("httpCopyPeerCredentials(http=%p)", (void *)http);
14861486

14871487
if (http && http->tls)
14881488
{
14891489
// Get the chain of certificates for the remote end...
14901490
chain = SSL_get_peer_cert_chain(http->tls);
14911491

1492-
DEBUG_printf("1httpCopyPeerCredentials: chain=%p", chain);
1492+
DEBUG_printf("1httpCopyPeerCredentials: chain=%p", (void *)chain);
14931493

14941494
if (chain)
14951495
{
@@ -1504,7 +1504,7 @@ httpCopyPeerCredentials(http_t *http) // I - Connection to server
15041504
BIO *bio = BIO_new(BIO_s_mem());
15051505
// Memory buffer for cert
15061506

1507-
DEBUG_printf("1httpCopyPeerCredentials: chain[%d/%d]=%p", i + 1, count, cert);
1507+
DEBUG_printf("1httpCopyPeerCredentials: chain[%d/%d]=%p", i + 1, count, (void *)cert);
15081508

15091509
#ifdef DEBUG
15101510
char subjectName[256], issuerName[256];
@@ -1514,7 +1514,7 @@ httpCopyPeerCredentials(http_t *http) // I - Connection to server
15141514

15151515
STACK_OF(GENERAL_NAME) *names; // subjectAltName values
15161516
names = X509_get_ext_d2i(cert, NID_subject_alt_name, /*crit*/NULL, /*idx*/NULL);
1517-
DEBUG_printf("1httpCopyPeerCredentials: subjectAltNames=%p(%d)", names, names ? sk_GENERAL_NAME_num(names) : 0);
1517+
DEBUG_printf("1httpCopyPeerCredentials: subjectAltNames=%p(%d)", (void *)names, names ? sk_GENERAL_NAME_num(names) : 0);
15181518
if (names)
15191519
GENERAL_NAMES_free(names);
15201520
#endif // DEBUG
@@ -1600,7 +1600,7 @@ _httpCreateCredentials(
16001600
}
16011601
}
16021602

1603-
DEBUG_printf("1_httpCreateCredentials: Returning %p.", hcreds);
1603+
DEBUG_printf("1_httpCreateCredentials: Returning %p.", (void *)hcreds);
16041604

16051605
return (hcreds);
16061606
}
@@ -1754,7 +1754,7 @@ _httpTLSStart(http_t *http) // I - Connection to server
17541754
};
17551755

17561756

1757-
DEBUG_printf("3_httpTLSStart(http=%p)", http);
1757+
DEBUG_printf("3_httpTLSStart(http=%p)", (void *)http);
17581758

17591759
if (!cg->client_conf_loaded)
17601760
{
@@ -1822,7 +1822,7 @@ _httpTLSStart(http_t *http) // I - Connection to server
18221822
{
18231823
// Resolve hostname from connection address...
18241824
http_addr_t addr; // Connection address
1825-
socklen_t addrlen; // Length of address
1825+
socklen_t addrlen; // Length of address
18261826

18271827
addrlen = sizeof(addr);
18281828
if (getsockname(http->fd, (struct sockaddr *)&addr, &addrlen))

0 commit comments

Comments
 (0)