|
Lines 33-39
cupsGetConf(void)
Link Here
|
| 33 |
char prompt[1024]; /* Prompt string */ |
33 |
char prompt[1024]; /* Prompt string */ |
| 34 |
int digest_tries; /* Number of tries with Digest */ |
34 |
int digest_tries; /* Number of tries with Digest */ |
| 35 |
static char filename[HTTP_MAX_URI]; /* Local filename */ |
35 |
static char filename[HTTP_MAX_URI]; /* Local filename */ |
| 36 |
#if CUPS_VERSION_MAJOR - 0 <= 1 && CUPS_VERSION_MINOR - 0 < 2 |
36 |
#if CUPS_VERSION_MAJOR < 1 || (CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR < 2) |
| 37 |
const char *fqdn = 0; |
37 |
const char *fqdn = 0; |
| 38 |
#else |
38 |
#else |
| 39 |
char fqdn[ HTTP_MAX_URI ]; /* Server name buffer */ |
39 |
char fqdn[ HTTP_MAX_URI ]; /* Server name buffer */ |
|
Lines 119-125
cupsGetConf(void)
Link Here
|
| 119 |
* See if we should retry the current digest password... |
119 |
* See if we should retry the current digest password... |
| 120 |
*/ |
120 |
*/ |
| 121 |
|
121 |
|
| 122 |
#if CUPS_VERSION_MAJOR - 0 <= 1 && CUPS_VERSION_MINOR - 0 < 2 |
122 |
#if CUPS_VERSION_MAJOR < 1 || (CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR < 2) |
| 123 |
www_authenticate = cups_server->fields[HTTP_FIELD_WWW_AUTHENTICATE]; |
123 |
www_authenticate = cups_server->fields[HTTP_FIELD_WWW_AUTHENTICATE]; |
| 124 |
#else |
124 |
#else |
| 125 |
www_authenticate = httpGetField( cups_server, HTTP_FIELD_WWW_AUTHENTICATE ); |
125 |
www_authenticate = httpGetField( cups_server, HTTP_FIELD_WWW_AUTHENTICATE ); |
|
Lines 130-136
cupsGetConf(void)
Link Here
|
| 130 |
/* |
130 |
/* |
| 131 |
* Nope - get a password from the user... |
131 |
* Nope - get a password from the user... |
| 132 |
*/ |
132 |
*/ |
| 133 |
#if CUPS_VERSION_MAJOR - 0 <= 1 && CUPS_VERSION_MINOR - 0 < 2 |
133 |
#if CUPS_VERSION_MAJOR < 1 || (CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR < 2) |
| 134 |
fqdn = cups_server->hostname; |
134 |
fqdn = cups_server->hostname; |
| 135 |
#else |
135 |
#else |
| 136 |
httpGetHostname( cups_server, fqdn, sizeof( fqdn ) ); |
136 |
httpGetHostname( cups_server, fqdn, sizeof( fqdn ) ); |
|
Lines 155-161
cupsGetConf(void)
Link Here
|
| 155 |
* Got a password; encode it for the server... |
155 |
* Got a password; encode it for the server... |
| 156 |
*/ |
156 |
*/ |
| 157 |
|
157 |
|
| 158 |
#if CUPS_VERSION_MAJOR - 0 <= 1 && CUPS_VERSION_MINOR - 0 < 2 |
158 |
#if CUPS_VERSION_MAJOR < 1 || (CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR < 2) |
| 159 |
www_authenticate = cups_server->fields[HTTP_FIELD_WWW_AUTHENTICATE]; |
159 |
www_authenticate = cups_server->fields[HTTP_FIELD_WWW_AUTHENTICATE]; |
| 160 |
#else |
160 |
#else |
| 161 |
www_authenticate = httpGetField( cups_server, HTTP_FIELD_WWW_AUTHENTICATE ); |
161 |
www_authenticate = httpGetField( cups_server, HTTP_FIELD_WWW_AUTHENTICATE ); |
|
Lines 167-173
cupsGetConf(void)
Link Here
|
| 167 |
*/ |
167 |
*/ |
| 168 |
|
168 |
|
| 169 |
snprintf(plain, sizeof(plain), "%s:%s", cupsUser(), pwdstring); |
169 |
snprintf(plain, sizeof(plain), "%s:%s", cupsUser(), pwdstring); |
| 170 |
#if CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR >= 2 |
170 |
#if CUPS_VERSION_MAJOR > 1 || (CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR >= 2) |
| 171 |
httpEncode64_2(encode, sizeof(encode), plain, sizeof(plain)); |
171 |
httpEncode64_2(encode, sizeof(encode), plain, sizeof(plain)); |
| 172 |
#else |
172 |
#else |
| 173 |
httpEncode64(encode, plain); |
173 |
httpEncode64(encode, plain); |
|
Lines 236-242
cupsGetConf(void)
Link Here
|
| 236 |
*/ |
236 |
*/ |
| 237 |
|
237 |
|
| 238 |
while ((bytes = |
238 |
while ((bytes = |
| 239 |
#if CUPS_VERSION_MAJOR - 0 <= 1 && CUPS_VERSION_MINOR - 0 < 2 |
239 |
#if CUPS_VERSION_MAJOR < 1 || (CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR < 2) |
| 240 |
httpRead |
240 |
httpRead |
| 241 |
#else |
241 |
#else |
| 242 |
httpRead2 |
242 |
httpRead2 |
|
Lines 266-272
cupsPutConf(const char *name) /* I - Name of the config file to send */
Link Here
|
| 266 |
http_status_t status; /* HTTP status from server */ |
266 |
http_status_t status; /* HTTP status from server */ |
| 267 |
char prompt[1024]; /* Prompt string */ |
267 |
char prompt[1024]; /* Prompt string */ |
| 268 |
int digest_tries; /* Number of tries with Digest */ |
268 |
int digest_tries; /* Number of tries with Digest */ |
| 269 |
#if CUPS_VERSION_MAJOR - 0 <= 1 && CUPS_VERSION_MINOR - 0 < 2 |
269 |
#if CUPS_VERSION_MAJOR < 1 || (CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR < 2) |
| 270 |
const char *fqdn = 0; |
270 |
const char *fqdn = 0; |
| 271 |
#else |
271 |
#else |
| 272 |
char fqdn[ HTTP_MAX_URI ]; /* Server name buffer */ |
272 |
char fqdn[ HTTP_MAX_URI ]; /* Server name buffer */ |
|
Lines 341-347
cupsPutConf(const char *name) /* I - Name of the config file to send */
Link Here
|
| 341 |
break; |
341 |
break; |
| 342 |
} |
342 |
} |
| 343 |
else |
343 |
else |
| 344 |
#if CUPS_VERSION_MAJOR - 0 <= 1 && CUPS_VERSION_MINOR - 0 < 2 |
344 |
#if CUPS_VERSION_MAJOR < 1 || (CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR < 2) |
| 345 |
httpWrite |
345 |
httpWrite |
| 346 |
#else |
346 |
#else |
| 347 |
httpWrite2 |
347 |
httpWrite2 |
|
Lines 350-356
cupsPutConf(const char *name) /* I - Name of the config file to send */
Link Here
|
| 350 |
|
350 |
|
| 351 |
if (status == HTTP_CONTINUE) |
351 |
if (status == HTTP_CONTINUE) |
| 352 |
{ |
352 |
{ |
| 353 |
#if CUPS_VERSION_MAJOR - 0 <= 1 && CUPS_VERSION_MINOR - 0 < 2 |
353 |
#if CUPS_VERSION_MAJOR < 1 || (CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR < 2) |
| 354 |
httpWrite |
354 |
httpWrite |
| 355 |
#else |
355 |
#else |
| 356 |
httpWrite2 |
356 |
httpWrite2 |
|
Lines 381-387
cupsPutConf(const char *name) /* I - Name of the config file to send */
Link Here
|
| 381 |
* See if we should retry the current digest password... |
381 |
* See if we should retry the current digest password... |
| 382 |
*/ |
382 |
*/ |
| 383 |
|
383 |
|
| 384 |
#if CUPS_VERSION_MAJOR - 0 <= 1 && CUPS_VERSION_MINOR - 0 < 2 |
384 |
#if CUPS_VERSION_MAJOR < 1 || (CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR < 2) |
| 385 |
www_authenticate = cups_server->fields[HTTP_FIELD_WWW_AUTHENTICATE]; |
385 |
www_authenticate = cups_server->fields[HTTP_FIELD_WWW_AUTHENTICATE]; |
| 386 |
#else |
386 |
#else |
| 387 |
www_authenticate = httpGetField( cups_server, HTTP_FIELD_WWW_AUTHENTICATE ); |
387 |
www_authenticate = httpGetField( cups_server, HTTP_FIELD_WWW_AUTHENTICATE ); |
|
Lines 394-400
cupsPutConf(const char *name) /* I - Name of the config file to send */
Link Here
|
| 394 |
*/ |
394 |
*/ |
| 395 |
|
395 |
|
| 396 |
|
396 |
|
| 397 |
#if CUPS_VERSION_MAJOR - 0 <= 1 && CUPS_VERSION_MINOR - 0 < 2 |
397 |
#if CUPS_VERSION_MAJOR < 1 || (CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR < 2) |
| 398 |
fqdn = cups_server->hostname; |
398 |
fqdn = cups_server->hostname; |
| 399 |
#else |
399 |
#else |
| 400 |
httpGetHostname( cups_server, fqdn, sizeof( fqdn ) ); |
400 |
httpGetHostname( cups_server, fqdn, sizeof( fqdn ) ); |
|
Lines 418-424
cupsPutConf(const char *name) /* I - Name of the config file to send */
Link Here
|
| 418 |
* Got a password; encode it for the server... |
418 |
* Got a password; encode it for the server... |
| 419 |
*/ |
419 |
*/ |
| 420 |
|
420 |
|
| 421 |
#if CUPS_VERSION_MAJOR - 0 <= 1 && CUPS_VERSION_MINOR - 0 < 2 |
421 |
#if CUPS_VERSION_MAJOR < 1 || (CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR < 2) |
| 422 |
www_authenticate = cups_server->fields[HTTP_FIELD_WWW_AUTHENTICATE]; |
422 |
www_authenticate = cups_server->fields[HTTP_FIELD_WWW_AUTHENTICATE]; |
| 423 |
#else |
423 |
#else |
| 424 |
www_authenticate = httpGetField( cups_server, HTTP_FIELD_WWW_AUTHENTICATE ); |
424 |
www_authenticate = httpGetField( cups_server, HTTP_FIELD_WWW_AUTHENTICATE ); |
|
Lines 430-436
cupsPutConf(const char *name) /* I - Name of the config file to send */
Link Here
|
| 430 |
*/ |
430 |
*/ |
| 431 |
|
431 |
|
| 432 |
snprintf(plain, sizeof(plain), "%s:%s", cupsUser(), pwdstring); |
432 |
snprintf(plain, sizeof(plain), "%s:%s", cupsUser(), pwdstring); |
| 433 |
#if CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR >= 2 |
433 |
#if CUPS_VERSION_MAJOR > 1 || (CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR >= 2) |
| 434 |
httpEncode64_2(encode, sizeof(encode), plain, sizeof(plain)); |
434 |
httpEncode64_2(encode, sizeof(encode), plain, sizeof(plain)); |
| 435 |
#else |
435 |
#else |
| 436 |
httpEncode64(encode, plain); |
436 |
httpEncode64(encode, plain); |
|
Lines 512-518
cups_local_auth(http_t *http) /* I - Connection */
Link Here
|
| 512 |
* See if we are accessing localhost... |
512 |
* See if we are accessing localhost... |
| 513 |
the struct has changed in newer versions - PiggZ (adam@piggz.co.uk) |
513 |
the struct has changed in newer versions - PiggZ (adam@piggz.co.uk) |
| 514 |
*/ |
514 |
*/ |
| 515 |
#if CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR >= 2 |
515 |
#if CUPS_VERSION_MAJOR > 1 || (CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR >= 2) |
| 516 |
if (!httpAddrLocalhost(http)) |
516 |
if (!httpAddrLocalhost(http)) |
| 517 |
#else |
517 |
#else |
| 518 |
if (ntohl(*(int*)&http->hostaddr.sin_addr) != 0x7f000001 && |
518 |
if (ntohl(*(int*)&http->hostaddr.sin_addr) != 0x7f000001 && |