Hyper Text Transfer Protocol (HTTP) NTLM authentication.
Definition in file httpntlm.c.
Parse HTTP "WWW-Authenticate" header for NTLM authentication.
- Parameters
-
| http | HTTP transaction |
| line | Remaining header line |
- Return values
-
Definition at line 54 of file httpntlm.c.
54 {
56 char *copy;
59
60
62 if ( ! copy ) {
64 goto err_alloc;
65 }
66
67
71 DBGC ( http,
"HTTP %p could not decode NTLM challenge "
73 goto err_decode;
74 }
75
76
78 rsp->challenge = ( (
void * ) line );
80 &
rsp->info ) ) != 0 ) {
81 DBGC ( http,
"HTTP %p could not parse NTLM challenge: "
83 goto err_challenge;
84 }
85 }
86
87
88
89
90
91
96 }
97
98
100
101 err_challenge:
102 err_decode:
104 err_alloc:
106}
#define NULL
NULL pointer (VOID *)
struct arbelprm_rc_send_wqe rc
int base64_decode(const char *encoded, void *data, size_t len)
Base64-decode string.
#define ENOMEM
Not enough space.
@ HTTP_RESPONSE_RETRY
Transaction may be retried on failure.
static void(* free)(struct refcnt *refcnt))
char * strerror(int errno)
Retrieve string representation of error number.
char * strdup(const char *src)
Duplicate string.
size_t strlen(const char *src)
Get length of string.
size_t len
Authenticate message length.
struct http_authentication * auth
Authentication scheme (if any)
struct http_request_auth_ntlm ntlm
NTLM authentication descriptor.
struct http_request_auth auth
Authentication descriptor.
HTTP response NTLM authorization descriptor.
struct http_response_auth_ntlm ntlm
NTLM authorization descriptor.
struct http_response_auth auth
Authorization descriptor.
struct http_response response
Response.
struct http_request request
Request.
References http_request::auth, http_request_auth::auth, http_response::auth, base64_decode(), DBGC, ENOMEM, http_response::flags, free, HTTP_RESPONSE_RETRY, http_request_auth_ntlm::len, len, http_request_auth::ntlm, http_response_auth::ntlm, NULL, rc, http_transaction::request, http_transaction::response, rsp, strdup(), strerror(), and strlen().
Perform HTTP NTLM authentication.
- Parameters
-
- Return values
-
Definition at line 114 of file httpntlm.c.
114 {
118 const char *domain;
121
122
123 if ( !
rsp->challenge ) {
124 DBGC ( http,
"HTTP %p sending NTLM Negotiate\n", http );
125 return 0;
126 }
127
128
130 DBGC ( http,
"HTTP %p has no username for NTLM "
131 "authentication\n", http );
133 }
136
137
140
141
143
144
146
147
150
151
153
154 return 0;
155}
union @162305117151260234136356364136041353210355154177 key
Sense key.
#define EACCES
Permission denied.
static const char http_ntlm_workstation[]
Workstation name used for NTLM authentication.
static struct dynamic_item username
static struct dynamic_item password
const char * netbios_domain(char **username)
Split NetBIOS [domain]username into separate domain and username fields.
static void netbios_domain_undo(const char *domain, char *username)
Restore NetBIOS [domain]username.
void ntlm_response(struct ntlm_challenge_info *info, struct ntlm_key *key, struct ntlm_nonce *nonce, struct ntlm_lm_response *lm, struct ntlm_nt_response *nt)
Construct NTLM responses.
size_t ntlm_authenticate_len(struct ntlm_challenge_info *info, const char *domain, const char *username, const char *workstation)
Calculate NTLM Authenticate message length.
void ntlm_key(const char *domain, const char *username, const char *password, struct ntlm_key *key)
Calculate NTLM verification key.
HTTP request NTLM authentication descriptor.
struct ntlm_lm_response lm
LAN Manager response.
struct ntlm_nt_response nt
NT response.
const char * username
Username.
struct uri * uri
Request URI.
An NTLM verification key.
const char * user
User name.
const char * password
Password.
References http_request::auth, http_response::auth, DBGC, EACCES, http_ntlm_workstation, key, http_request_auth_ntlm::len, http_request_auth_ntlm::lm, netbios_domain(), netbios_domain_undo(), http_request_auth_ntlm::nt, http_request_auth::ntlm, http_response_auth::ntlm, ntlm_authenticate_len(), ntlm_key(), ntlm_response(), NULL, password, uri::password, http_transaction::request, http_transaction::response, rsp, http_transaction::uri, uri::user, http_request_auth_ntlm::username, and username.
Construct HTTP "Authorization" header for NTLM authentication.
- Parameters
-
| http | HTTP transaction |
| buf | Buffer |
| len | Length of buffer |
- Return values
-
| len | Length of header value, or negative error |
Definition at line 165 of file httpntlm.c.
166 {
172 size_t check;
173
174
175 if ( !
rsp->challenge ) {
178 }
179
180
183
184
186 if ( ! auth )
188
189
192
193
198
199
201
202
204
205
207
209}
#define assert(condition)
Assert a condition at run-time.
size_t base64_encode(const void *raw, size_t raw_len, char *data, size_t len)
Base64-encode data.
static size_t base64_encoded_len(size_t raw_len)
Calculate length of base64-encoded data.
void * malloc(size_t size)
Allocate memory.
size_t ntlm_authenticate(struct ntlm_challenge_info *info, const char *domain, const char *username, const char *workstation, struct ntlm_lm_response *lm, struct ntlm_nt_response *nt, struct ntlm_authenticate *auth)
Construct NTLM Authenticate message.
struct ntlm_data domain
Domain name.
References assert, http_request::auth, http_response::auth, base64_encode(), base64_encoded_len(), ntlm_authenticate::domain, ENOMEM, free, http_ntlm_workstation, http_request_auth_ntlm::len, len, http_request_auth_ntlm::lm, malloc(), netbios_domain(), netbios_domain_undo(), http_request_auth_ntlm::nt, http_request_auth::ntlm, http_response_auth::ntlm, ntlm_authenticate(), http_transaction::request, http_transaction::response, rsp, http_request_auth_ntlm::username, and username.