master
1#ifndef HEADER_CURL_VAUTH_H
2#define HEADER_CURL_VAUTH_H
3/***************************************************************************
4 * _ _ ____ _
5 * Project ___| | | | _ \| |
6 * / __| | | | |_) | |
7 * | (__| |_| | _ <| |___
8 * \___|\___/|_| \_\_____|
9 *
10 * Copyright (C) Steve Holme, <steve_holme@hotmail.com>.
11 *
12 * This software is licensed as described in the file COPYING, which
13 * you should have received as part of this distribution. The terms
14 * are also available at https://curl.se/docs/copyright.html.
15 *
16 * You may opt to use, copy, modify, merge, publish, distribute and/or sell
17 * copies of the Software, and permit persons to whom the Software is
18 * furnished to do so, under the terms of the COPYING file.
19 *
20 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21 * KIND, either express or implied.
22 *
23 * SPDX-License-Identifier: curl
24 *
25 ***************************************************************************/
26#include "curl_setup.h"
28#include "bufref.h"
29#include "curlx/dynbuf.h"
30#include "urldata.h"
32struct Curl_easy;
33struct Curl_creds;
34struct connectdata;
35struct Curl_peer;
37#ifndef CURL_DISABLE_DIGEST_AUTH
38struct digestdata;
39#endif
41#if (defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI)) && defined(USE_SPNEGO)
42struct negotiatedata;
43#endif
45#ifdef USE_GSASL
46struct gsasldata;
47#endif
49#ifdef USE_WINDOWS_SSPI
50#include "curl_sspi.h"
51#define GSS_ERROR(status) ((status) & 0x80000000)
52#endif
54/*
55 * Curl_auth_allowed_to_host() tells if authentication, cookies or other
56 * "sensitive data" can (still) be sent to this host.
57 */
58bool Curl_auth_allowed_to_host(struct Curl_easy *data);
59bool Curl_auth_allowed_to_origin(struct Curl_easy *data,
60 struct Curl_peer *origin);
62/* This is used to build an SPN string */
63#ifndef USE_WINDOWS_SSPI
64char *Curl_auth_build_spn(const char *service, const char *host,
65 const char *realm);
66#else
67TCHAR *Curl_auth_build_spn(const char *service, const char *host,
68 const char *realm);
69#endif
71/* This is used to test if the user contains a Windows domain name */
72bool Curl_auth_user_contains_domain(struct Curl_creds *creds);
74/* This is used to generate a PLAIN cleartext message */
75CURLcode Curl_auth_create_plain_message(struct Curl_creds *creds,
76 struct bufref *out);
78/* This is used to generate a LOGIN cleartext message */
79void Curl_auth_create_login_message(const char *value, struct bufref *out);
81/* This is used to generate an EXTERNAL cleartext message */
82void Curl_auth_create_external_message(const char *user, struct bufref *out);
84#ifndef CURL_DISABLE_DIGEST_AUTH
85/* This is used to generate a CRAM-MD5 response message */
86CURLcode Curl_auth_create_cram_md5_message(const struct bufref *chlg,
87 struct Curl_creds *creds,
88 struct bufref *out);
90/* This is used to evaluate if DIGEST is supported */
91bool Curl_auth_is_digest_supported(void);
93/* This is used to generate a base64 encoded DIGEST-MD5 response message */
94CURLcode Curl_auth_create_digest_md5_message(struct Curl_easy *data,
95 const struct bufref *chlg,
96 struct Curl_creds *creds,
97 const char *default_service,
98 struct bufref *out);
100/* This is used to decode an HTTP DIGEST challenge message */
101CURLcode Curl_auth_decode_digest_http_message(const char *chlg,
102 struct digestdata *digest);
104/* This is used to generate an HTTP DIGEST response message */
105CURLcode Curl_auth_create_digest_http_message(struct Curl_easy *data,
106 struct Curl_creds *creds,
107 const unsigned char *request,
108 const unsigned char *uripath,
109 struct digestdata *digest,
110 char **outptr, size_t *outlen);
112/* This is used to clean up the digest specific data */
113void Curl_auth_digest_cleanup(struct digestdata *digest);
114#else
115#define Curl_auth_digest_cleanup(x)
116#define Curl_auth_is_digest_supported() FALSE
117#endif /* !CURL_DISABLE_DIGEST_AUTH */
119#ifdef USE_GSASL
121/* meta key for storing GSASL meta at connection */
122#define CURL_META_GSASL_CONN "meta:auth:gsasl:conn"
124#include <gsasl.h>
125struct gsasldata {
126 Gsasl *ctx;
127 Gsasl_session *client;
128};
130struct gsasldata *Curl_auth_gsasl_get(struct connectdata *conn);
132/* This is used to evaluate if MECH is supported by gsasl */
133bool Curl_auth_gsasl_is_supported(struct Curl_easy *data,
134 const char *mech,
135 struct gsasldata *gsasl);
136/* This is used to start a gsasl method */
137CURLcode Curl_auth_gsasl_start(struct Curl_easy *data,
138 struct Curl_creds *creds,
139 struct gsasldata *gsasl);
141/* This is used to process and generate a new SASL token */
142CURLcode Curl_auth_gsasl_token(struct Curl_easy *data,
143 const struct bufref *chlg,
144 struct gsasldata *gsasl,
145 struct bufref *out);
147/* This is used to clean up the gsasl specific data */
148void Curl_auth_gsasl_cleanup(struct gsasldata *gsasl);
149#endif
151/* This is used to generate a base64 encoded OAuth 2.0 message */
152CURLcode Curl_auth_create_oauth_bearer_message(struct Curl_creds *creds,
153 const char *host,
154 const long port,
155 struct bufref *out);
157/* This is used to generate a base64 encoded XOAuth 2.0 message */
158CURLcode Curl_auth_create_xoauth_bearer_message(struct Curl_creds *creds,
159 struct bufref *out);
161#ifdef USE_KERBEROS5
163/* meta key for storing KRB5 meta at connection */
164#define CURL_META_KRB5_CONN "meta:auth:krb5:conn"
166struct kerberos5data {
167#ifdef USE_WINDOWS_SSPI
168 CredHandle *credentials;
169 CtxtHandle *context;
170 TCHAR *spn;
171 SEC_WINNT_AUTH_IDENTITY_EX identity;
172 SEC_WINNT_AUTH_IDENTITY_EX *p_identity;
173 size_t token_max;
174 BYTE *output_token;
175#else
176 gss_ctx_id_t context;
177 gss_name_t spn;
178#endif
179};
181struct kerberos5data *Curl_auth_krb5_get(struct connectdata *conn);
183/* This is used to evaluate if GSSAPI (Kerberos V5) is supported */
184bool Curl_auth_is_gssapi_supported(void);
186/* This is used to generate a base64 encoded GSSAPI (Kerberos V5) user token
187 message */
188CURLcode Curl_auth_create_gssapi_user_message(struct Curl_easy *data,
189 struct Curl_creds *creds,
190 const char *default_service,
191 const char *host,
192 const bool mutual_auth,
193 const struct bufref *chlg,
194 struct kerberos5data *krb5,
195 struct bufref *out);
197/* This is used to generate a base64 encoded GSSAPI (Kerberos V5) security
198 token message */
199CURLcode Curl_auth_create_gssapi_security_message(struct Curl_easy *data,
200 const char *authzid,
201 const struct bufref *chlg,
202 struct kerberos5data *krb5,
203 struct bufref *out);
205/* This is used to clean up the GSSAPI specific data */
206void Curl_auth_cleanup_gssapi(struct kerberos5data *krb5);
207#else
208#define Curl_auth_is_gssapi_supported() FALSE
209#endif /* USE_KERBEROS5 */
211#ifdef USE_SPNEGO
213bool Curl_auth_is_spnego_supported(void);
215/* meta key for storing NEGO meta at connection */
216#define CURL_META_NEGO_CONN "meta:auth:nego:conn"
217/* meta key for storing NEGO PROXY meta at connection */
218#define CURL_META_NEGO_PROXY_CONN "meta:auth:nego-proxy:conn"
220/* Struct used for Negotiate (SPNEGO) authentication */
221struct negotiatedata {
222#ifdef HAVE_GSSAPI
223 OM_uint32 status;
224 gss_ctx_id_t context;
225 gss_name_t spn;
226 gss_cred_id_t cred;
227 gss_buffer_desc output_token;
228#ifdef GSS_C_CHANNEL_BOUND_FLAG
229 struct dynbuf channel_binding_data;
230#endif
231#else
232#ifdef USE_WINDOWS_SSPI
233 CtxtHandle *sslContext;
234 SECURITY_STATUS status;
235 CredHandle *credentials;
236 CtxtHandle *context;
237 SEC_WINNT_AUTH_IDENTITY_EX identity;
238 SEC_WINNT_AUTH_IDENTITY_EX *p_identity;
239 TCHAR *spn;
240 size_t token_max;
241 BYTE *output_token;
242 size_t output_token_length;
243#endif
244#endif
245 BIT(noauthpersist);
246 BIT(havenoauthpersist);
247 BIT(havenegdata);
248 BIT(havemultiplerequests);
249};
251struct negotiatedata *Curl_auth_nego_get(struct connectdata *conn, bool proxy);
253/* This is used to decode a base64 encoded SPNEGO (Negotiate) challenge
254 message */
255CURLcode Curl_auth_decode_spnego_message(struct Curl_easy *data,
256 struct Curl_creds *creds,
257 const char *default_service,
258 const char *host,
259 const char *chlg64,
260 struct negotiatedata *nego);
262/* This is used to generate a base64 encoded SPNEGO (Negotiate) response
263 message */
264CURLcode Curl_auth_create_spnego_message(struct negotiatedata *nego,
265 char **outptr, size_t *outlen);
267/* This is used to clean up the SPNEGO specific data */
268void Curl_auth_cleanup_spnego(struct negotiatedata *nego);
270#endif /* USE_SPNEGO */
272#endif /* HEADER_CURL_VAUTH_H */
Diagnostics4 git calls · 43 ms
CallStatusSizeTime043 ms
discover200152 B3 ms
git.upload-pack discover http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=1 git.response.bytes=152 git.server.agent=gitty/1.0 git.server.object_format=sha1 git.server.caps=agent ls-refs fetch object-format git.server.fetch=shallow filter sideband-all git.protocol.version=2 git.pkt.frames=8 git.pkt.data=6 git.pkt.flush=2 git.pkt.delim=0 git.pkt.bytes=152 git.pkt.payload.max=34
ls-refs200149 B · hit3 ms
git.upload-pack ls-refs http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=ls-refs git.upstream.dur_ms=3 git.response.bytes=149 git.response.cache=HIT git.response.duration_ms=3 git.protocol.version=2 git.pkt.frames=3 git.pkt.data=2 git.pkt.flush=1 git.pkt.delim=0 git.pkt.bytes=149 git.pkt.payload.max=78 git.ls_refs.count=2 git.ls_refs.head=refs/heads/master
fetchblob:none · deepen 10200287 KiB · hit1 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=39 git.response.bytes=293470 git.response.cache=HIT git.response.duration_ms=1 git.fetch.filter=blob:none git.fetch.filter.requested=tree:0 git.fetch.filter.fallback=blob:none git.fetch.filter.learned=false git.fetch.wants=31c911efe5652725e930f4d2e60c9060e5f6646d git.fetch.haves.count=0 git.fetch.deepen=10 git.fetch.thin_pack=false git.fetch.ofs_delta=true git.protocol.version=2 git.pkt.frames=10 git.pkt.data=8 git.pkt.flush=1 git.pkt.delim=1 git.pkt.bytes=293470 git.pkt.payload.max=65516 git.sideband.band1.bytes=293354 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0 git.pack.objects=87 git.pack.bytes=293354 git.pack.ofs_delta=0 git.pack.ref_delta=1 git.pack.chain.max=1 git.pack.trailer=6a646bcda6740bab42e321b51998b52ea15146c0 git.pack.full=86Open pack map
fetch2002.5 KiB · hit39 ms
git.upload-pack fetch http.response.status_code=200 git.response.bytes=2590 git.response.cache=HIT git.response.duration_ms=39 git.fetch.wants=0b0096b4119783e2d3295f7314710d4bcddce4db git.fetch.haves.count=0 git.fetch.deepen=0 git.fetch.thin_pack=false git.fetch.ofs_delta=true git.protocol.version=2 git.pkt.frames=3 git.pkt.data=2 git.pkt.flush=1 git.pkt.delim=0 git.pkt.bytes=2590 git.pkt.payload.max=2569 git.sideband.band1.bytes=2568 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0
Each row is one HTTP round trip ply made to the git server for this page, on one timeline. discover asks what the server speaks, ls-refs lists branch tips, fetch brings objects by id. A hit was served by Workers Cache. Tap a row for its wire details.
- Remote
- https://5ad2236b39de4c8bd8f6270ea63f3ea9.artifacts.cloudflare.net/git/public-v0/curl.git
- Ref
- refs/heads/master
- Commit
- 31c911efe5652725e930f4d2e60c9060e5f6646d
- cf-ray
- a5eafa53c98db1bb
- Request
- 60a5c33d…
- Protocol
- v2 · sha1
- Agent
- gitty/1.0
- Filter
- advertised
- Fetch
- shallow filter sideband-all
- Capabilities
- agent ls-refs fetch object-format