Lines Matching refs:http
14 * missing or damaged, see the license at "http://www.cups.org/".
88 static gss_name_t cups_gss_getname(http_t *http, const char *service_name);
96 static int cups_local_auth(http_t *http);
110 http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFAULT@ */
123 DEBUG_printf(("cupsDoAuthentication(http=%p, method=\"%s\", resource=\"%s\")", (void *)http, method, resource));
125 if (!http)
126 http = _cupsConnect();
128 if (!http || !method || !resource)
132 http->digest_tries, http->userpass));
134 httpGetField(http, HTTP_FIELD_WWW_AUTHENTICATE)));
140 httpSetAuthString(http, NULL, NULL);
146 if (http->digest_tries < 3)
148 if ((localauth = cups_local_auth(http)) == 0)
151 http->authstring));
153 if (http->status == HTTP_STATUS_UNAUTHORIZED)
154 http->digest_tries ++;
160 http->status = HTTP_STATUS_CUPS_AUTHORIZATION_CANCELED;
169 www_auth = http->fields[HTTP_FIELD_WWW_AUTHENTICATE];
171 if ((http->digest_tries > 1 || !http->userpass[0]) &&
187 if (httpGetSubField(http, HTTP_FIELD_WWW_AUTHENTICATE, "username",
194 http->hostname[0] == '/' ? "localhost" : http->hostname);
196 http->digest_tries = _cups_strncasecmp(www_auth, "Digest", 6) != 0;
197 http->userpass[0] = '\0';
199 if ((password = cupsGetPassword2(prompt, http, method, resource)) == NULL)
201 http->status = HTTP_STATUS_CUPS_AUTHORIZATION_CANCELED;
205 snprintf(http->userpass, sizeof(http->userpass), "%s:%s", cupsUser(),
208 else if (http->status == HTTP_STATUS_UNAUTHORIZED)
209 http->digest_tries ++;
211 if (http->status == HTTP_STATUS_UNAUTHORIZED && http->digest_tries >= 3)
214 http->digest_tries));
216 http->status = HTTP_STATUS_CUPS_AUTHORIZATION_CANCELED;
231 if (_cupsSetNegotiateAuthString(http, method, resource))
233 http->status = HTTP_STATUS_CUPS_AUTHORIZATION_CANCELED;
248 httpEncode64_2(encode, sizeof(encode), http->userpass,
249 (int)strlen(http->userpass));
250 httpSetAuthString(http, "Basic", encode);
261 httpGetSubField(http, HTTP_FIELD_WWW_AUTHENTICATE, "realm", realm);
262 httpGetSubField(http, HTTP_FIELD_WWW_AUTHENTICATE, "nonce", nonce);
264 httpMD5(cupsUser(), realm, strchr(http->userpass, ':') + 1, encode);
269 httpSetAuthString(http, "Digest", digest);
275 http->status = HTTP_STATUS_CUPS_AUTHORIZATION_CANCELED;
279 DEBUG_printf(("1cupsDoAuthentication: authstring=\"%s\"", http->authstring));
292 http_t *http, /* I - Connection to server */
319 if (http->gssname == GSS_C_NO_NAME)
321 http->gssname = cups_gss_getname(http, _cupsGSSServiceName());
324 if (http->gssctx != GSS_C_NO_CONTEXT)
326 gss_delete_sec_context(&minor_status, &http->gssctx, GSS_C_NO_BUFFER);
327 http->gssctx = GSS_C_NO_CONTEXT;
331 &http->gssctx,
332 http->gssname, http->gssmech,
336 GSS_C_NO_BUFFER, &http->gssmech,
360 cupsUser(), http->gsshost);
362 if ((password = cupsGetPassword2(prompt, http, method, resource)) == NULL)
372 snprintf(userbuf, sizeof(userbuf), "%s@%s", username, http->gsshost);
404 &http->gssctx,
405 http->gssname, http->gssmech,
409 GSS_C_NO_BUFFER, &http->gssmech,
442 httpSetAuthString(http, NULL, NULL);
444 if ((http->authstring = malloc((size_t)authsize)) == NULL)
446 http->authstring = http->_authstring;
447 authsize = sizeof(http->_authstring);
450 strlcpy(http->authstring, "Negotiate ", (size_t)authsize);
451 httpEncode64_2(http->authstring + 10, authsize - 10, output_token.value,
505 http_t *http, /* I - Connection to server */
516 DEBUG_printf(("7cups_gss_getname(http=%p, service_name=\"%s\")", http,
524 if (!http->gsshost[0])
526 httpGetHostname(http, http->gsshost, sizeof(http->gsshost));
528 if (!strcmp(http->gsshost, "localhost"))
530 if (gethostname(http->gsshost, sizeof(http->gsshost)) < 0)
534 http->gsshost[0] = '\0';
538 if (!strchr(http->gsshost, '.'))
546 if ((host = gethostbyname(http->gsshost)) != NULL && host->h_name)
552 strlcpy(http->gsshost, host->h_name, sizeof(http->gsshost));
557 http->gsshost));
558 http->gsshost[0] = '\0';
569 snprintf(buf, sizeof(buf), "%s@%s", service_name, http->gsshost);
640 cups_local_auth(http_t *http) /* I - HTTP connection to server */
665 DEBUG_printf(("7cups_local_auth(http=%p) hostaddr=%s, hostname=\"%s\"", (void *)http, httpAddrString(http->hostaddr, filename, sizeof(filename)), http->hostname));
671 if (!httpAddrLocalhost(http->hostaddr) &&
672 _cups_strcasecmp(http->hostname, "localhost") != 0)
683 if (http->auth_ref)
685 AuthorizationFree(http->auth_ref, kAuthorizationFlagDefaults);
686 http->auth_ref = NULL;
690 httpGetSubField2(http, HTTP_FIELD_WWW_AUTHENTICATE, "authkey",
694 kAuthorizationFlagDefaults, &http->auth_ref);
715 status = AuthorizationCopyRights(http->auth_ref, &auth_rights,
719 status = AuthorizationMakeExternalForm(http->auth_ref, &auth_extrn);
730 httpSetAuthString(http, "AuthRef", buffer);
733 http->authstring));
757 _cups_strncasecmp(http->fields[HTTP_FIELD_WWW_AUTHENTICATE], "Negotiate", 9) &&
760 !httpGetSubField2(http, HTTP_FIELD_WWW_AUTHENTICATE, "authkey",
763 http->hostaddr->addr.sa_family == AF_LOCAL &&
777 httpSetAuthString(http, "PeerCred", username);
780 http->authstring));
804 if (!_cups_strncasecmp(http->fields[HTTP_FIELD_WWW_AUTHENTICATE], "Negotiate", 9))
815 if (httpGetSubField2(http, HTTP_FIELD_WWW_AUTHENTICATE, "authkey",
825 if (!httpGetSubField2(http, HTTP_FIELD_WWW_AUTHENTICATE, "trc", trc,
857 httpSetAuthString(http, "Local", certificate);
860 http->authstring));