43 #define EACCES_USERNAME __einfo_error ( EINFO_EACCES_USERNAME ) 44 #define EINFO_EACCES_USERNAME \ 45 __einfo_uniqify ( EINFO_EACCES, 0x01, \ 46 "No username available for Digest authentication" ) 57 #define HTTP_DIGEST_FIELD( _name ) { \ 59 .offset = offsetof ( struct http_transaction, \ 60 response.auth.digest._name ), \ 75 ptr = ( ( (
void * ) http ) + field->
offset );
140 static const char colon =
':';
161 base16_encode ( digest,
sizeof ( digest ),
out,
len );
175 static const char md5sess[] =
"MD5-sess";
176 static const char md5[] =
"MD5";
181 if ( !
rsp->realm ) {
182 DBGC ( http,
"HTTP %p has no realm for Digest authentication\n",
186 if ( !
rsp->nonce ) {
187 DBGC ( http,
"HTTP %p has no nonce for Digest authentication\n",
194 DBGC ( http,
"HTTP %p has no username for Digest " 195 "authentication\n", http );
213 if (
rsp->algorithm &&
263 char *buf,
size_t len ) {
280 "realm=\"%s\", nonce=\"%s\", uri=\"%s\", " 281 "username=\"%s\"",
rsp->realm,
rsp->nonce,
285 ", opaque=\"%s\"",
rsp->opaque );
289 ", qop=%s, algorithm=%s, cnonce=\"%s\", " 294 ", response=\"%s\"", req->
response );
const char * qop
Quality of protection.
#define EINVAL
Invalid argument.
static void digest_update(struct digest_algorithm *digest, void *ctx, const void *data, size_t len)
const char * username
Username.
struct http_response_auth_digest digest
Digest authorization descriptor.
static void http_digest_final(struct md5_context *ctx, char *out, size_t len)
Finalise HTTP Digest.
An HTTP Digest "WWW-Authenticate" response field.
static struct http_digest_field http_digest_fields[]
HTTP Digest "WWW-Authenticate" fields.
static int http_digest_authenticate(struct http_transaction *http)
Perform HTTP Digest authentication.
static void digest_final(struct digest_algorithm *digest, void *ctx, void *out)
struct uri * uri
Request URI.
int strcasecmp(const char *first, const char *second)
Compare case-insensitive strings.
An HTTP authentication scheme.
struct golan_eq_context ctx
Uniform Resource Identifiers.
struct http_response_auth auth
Authorization descriptor.
struct http_request request
Request.
static size_t base16_encoded_len(size_t raw_len)
Calculate length of base16-encoded data.
int ssnprintf(char *buf, ssize_t ssize, const char *fmt,...)
Version of vsnprintf() that accepts a signed buffer size.
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
struct http_response response
Response.
Hyper Text Transport Protocol.
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
const char * uri
Request URI string.
const char * algorithm
Algorithm.
pseudo_bit_t value[0x00020]
struct http_request_auth auth
Authentication descriptor.
HTTP request Digest authentication descriptor.
const char * name
Method name (e.g.
static void digest_init(struct digest_algorithm *digest, void *ctx)
struct http_authentication * auth
Authentication scheme (if any)
long int random(void)
Generate a pseudo-random number between 0 and 2147483647L or 2147483562?
size_t strlen(const char *src)
Get length of string.
char * http_token(char **line, char **value)
Get HTTP response token.
static struct dynamic_item password
REQUIRING_SYMBOL(http_digest_auth)
u16 algorithm
Authentication algorithm (Open System or Shared Key)
static int http_format_digest_auth(struct http_transaction *http, char *buf, size_t len)
Construct HTTP "Authorization" header for Digest authentication.
struct http_method * method
Method.
HTTP response Digest authorization descriptor.
const char * name
Name (e.g.
const char * password
Password.
char cnonce[HTTP_DIGEST_CNONCE_LEN+1]
Client nonce.
#define MD5_DIGEST_SIZE
MD5 digest size.
const char * user
User name.
int snprintf(char *buf, size_t size, const char *fmt,...)
Write a formatted string to a buffer.
static void http_digest_update(struct md5_context *ctx, const char *string)
Update HTTP Digest with new data.
Transaction may be retried on failure.
static void http_digest_init(struct md5_context *ctx)
Initialise HTTP Digest.
struct http_authentication http_digest_auth __http_authentication
HTTP Digest authentication scheme.
static void http_digest_field(struct http_transaction *http, struct http_digest_field *field, char *value)
Set HTTP Digest "WWW-Authenticate" response field value.
static int http_parse_digest_auth(struct http_transaction *http, char *line)
Parse HTTP "WWW-Authenticate" header for Digest authentication.
#define NULL
NULL pointer (VOID *)
char response[HTTP_DIGEST_RESPONSE_LEN+1]
Response.
#define HTTP_DIGEST_FIELD(_name)
Define an HTTP Digest "WWW-Authenticate" response field.
#define HTTP_DIGEST_NC
HTTP Digest authentication client nonce count.
struct digest_algorithm md5_algorithm
MD5 algorithm.
struct http_request_auth_digest digest
Digest authentication descriptor.