| 492 | |
| 493 | # ifdef DEBUG |
| 494 | else if (major_status == GSS_S_CONTINUE_NEEDED) |
| 495 | cups_gss_printf(major_status, minor_status, "_cupsSetNegotiateAuthString: Continuation needed"); |
| 496 | # endif /* DEBUG */ |
| 497 | |
| 498 | if (output_token.length > 0 && output_token.length <= 65536) |
| 499 | { |
| 500 | /* |
| 501 | * Allocate the authorization string since Windows KDCs can have |
| 502 | * arbitrarily large credentials... |
| 503 | */ |
| 504 | |
| 505 | int authsize = 10 + /* "Negotiate " */ |
| 506 | (((int)output_token.length * 4 / 3 + 3) & ~3) + 1; |
| 507 | /* Base64 + nul */ |
| 508 | |
| 509 | httpSetAuthString(http, NULL, NULL); |
| 510 | |
| 511 | if ((http->authstring = malloc((size_t)authsize)) == NULL) |
| 512 | { |
| 513 | http->authstring = http->_authstring; |
| 514 | authsize = sizeof(http->_authstring); |
| 515 | } |
| 516 | |
| 517 | strlcpy(http->authstring, "Negotiate ", (size_t)authsize); |
| 518 | httpEncode64_2(http->authstring + 10, authsize - 10, output_token.value, |
| 519 | (int)output_token.length); |
| 520 | |
| 521 | gss_release_buffer(&minor_status, &output_token); |
| 522 | } |
| 523 | else |
| 524 | { |
| 525 | DEBUG_printf(("1_cupsSetNegotiateAuthString: Kerberos credentials too " |
no test coverage detected