X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=client%2Fhttp_client.c;h=3045b1223f32aa85f0563f905508c2cba115bbb1;hb=5a97a7bec72eb87313c9b626321ea1d21f7fdab6;hp=0ace960fd42449201065367dd88eee63fff26ab3;hpb=753272412447dba91eb4119464af26515c3f9549;p=mod_auth_kerb.git diff --git a/client/http_client.c b/client/http_client.c index 0ace960..3045b12 100644 --- a/client/http_client.c +++ b/client/http_client.c @@ -335,7 +335,7 @@ do_http(const char *host, const char *page, gss_OID mech_oid, gss_cred_id_t cred if (h == NULL) errx(1, "Got %s but missed `WWW-Authenticate'", req.response); - if (strncasecmp(h, "GSSAPI", 6) == 0) { + if (strncasecmp(h, "Negotiate", 9) == 0) { OM_uint32 maj_stat, min_stat; gss_buffer_desc input_token, output_token; @@ -361,8 +361,7 @@ do_http(const char *host, const char *page, gss_OID mech_oid, gss_cred_id_t cred } #endif -// i = 9; - i = 6; + i = 9; while(h[i] && isspace((unsigned char)h[i])) i++; if (h[i] != '\0') { @@ -457,7 +456,7 @@ do_http(const char *host, const char *page, gss_OID mech_oid, gss_cred_id_t cred output_token.length, &neg_token); - asprintf(&headers[0], "Authorization: GSSAPI %s", + asprintf(&headers[0], "Authorization: Negotiate %s", neg_token); num_headers = 1; free(neg_token); @@ -563,6 +562,18 @@ main(int argc, char *argv[]) &cred, NULL, NULL); if (GSS_ERROR(maj_stat)) gss_err(1, maj_stat, min_stat, "Failed to load initial credentials"); + } else { + gss_OID_set_desc mechs, *mechsp = GSS_C_NO_OID_SET; + + mechs.elements = mech_oid; + mechs.count = 1; + mechsp = &mechs; + maj_stat = gss_acquire_cred(&min_stat, + gss_username, 0, + mechsp, GSS_C_INITIATE, + &cred, NULL, NULL); + if (GSS_ERROR(maj_stat)) + gss_err(1, maj_stat, min_stat, "Failed to load initial credentials"); } ret = do_http(host, page, mech_oid, cred);