aboutsummaryrefslogtreecommitdiff
path: root/src/include/microhttpd.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/microhttpd.h')
-rw-r--r--src/include/microhttpd.h125
1 files changed, 118 insertions, 7 deletions
diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h
index 6bf594cc..921ab56b 100644
--- a/src/include/microhttpd.h
+++ b/src/include/microhttpd.h
@@ -96,7 +96,7 @@ extern "C"
96 * they are parsed as decimal numbers. 96 * they are parsed as decimal numbers.
97 * Example: 0x01093001 = 1.9.30-1. 97 * Example: 0x01093001 = 1.9.30-1.
98 */ 98 */
99#define MHD_VERSION 0x00097512 99#define MHD_VERSION 0x00097513
100 100
101/* If generic headers don't work on your platform, include headers 101/* If generic headers don't work on your platform, include headers
102 which define 'va_list', 'size_t', 'ssize_t', 'intptr_t', 'off_t', 102 which define 'va_list', 'size_t', 'ssize_t', 'intptr_t', 'off_t',
@@ -4364,6 +4364,115 @@ enum MHD_DigestAuthAlgorithm
4364 4364
4365 4365
4366/** 4366/**
4367 * The result of digest authentication of the client.
4368 *
4369 * @note Available since #MHD_VERSION 0x00097513
4370 */
4371enum MHD_DigestAuthResult
4372{
4373 /**
4374 * Authentication OK.
4375 */
4376 MHD_DAUTH_OK = 1,
4377
4378 /**
4379 * General error, like "out of memory".
4380 */
4381 MHD_DAUTH_ERROR = 0,
4382
4383 /**
4384 * No "Authorization" header or wrong format of the header.
4385 */
4386 MHD_DAUTH_WRONG_HEADER = -1,
4387
4388 /**
4389 * Wrong 'username'.
4390 */
4391 MHD_DAUTH_WRONG_USERNAME = -2,
4392
4393 /**
4394 * Wrong 'realm'.
4395 */
4396 MHD_DAUTH_WRONG_REALM = -3,
4397
4398 /**
4399 * Wrong 'URI' (or URI parameters).
4400 */
4401 MHD_DAUTH_WRONG_URI = -4,
4402
4403 /* The different form of naming is intentionally used for the results below,
4404 * as they are more important */
4405
4406 /**
4407 * The 'nonce' is too old. Suggest the client to retry with the same
4408 * username and password to get the fresh 'nonce'.
4409 * The validity of the 'nonce' may not be checked.
4410 */
4411 MHD_DAUTH_NONCE_STALE = -16,
4412
4413 /**
4414 * The 'nonce' is wrong. May indicate an attack attempt.
4415 */
4416 MHD_DAUTH_NONCE_WRONG = -32,
4417
4418 /**
4419 * The 'response' is wrong. May indicate an attack attempt.
4420 */
4421 MHD_DAUTH_RESPONSE_WRONG = -33,
4422};
4423
4424
4425/**
4426 * Authenticates the authorization header sent by the client.
4427 *
4428 * @param connection the MHD connection structure
4429 * @param realm the realm to be used for authorization of the client
4430 * @param username the username needs to be authenticated
4431 * @param password the password used in the authentication
4432 * @param nonce_timeout the nonce validity duration in seconds
4433 * @param algo the digest algorithms allowed for verification
4434 * @return #MHD_DAUTH_OK if authenticated,
4435 * the error code otherwise
4436 * @note Available since #MHD_VERSION 0x00097513
4437 * @ingroup authentication
4438 */
4439_MHD_EXTERN enum MHD_DigestAuthResult
4440MHD_digest_auth_check3 (struct MHD_Connection *connection,
4441 const char *realm,
4442 const char *username,
4443 const char *password,
4444 unsigned int nonce_timeout,
4445 enum MHD_DigestAuthAlgorithm algo);
4446
4447
4448/**
4449 * Authenticates the authorization header sent by the client.
4450 *
4451 * @param connection the MHD connection structure
4452 * @param realm the realm to be used for authorization of the client
4453 * @param username the username needs to be authenticated
4454 * @param digest the pointer to the binary digest for the precalculated hash
4455 * value "username:realm:password" with specified @a algo
4456 * @param digest_size the number of bytes in @a digest (the size must match
4457 * @a algo!)
4458 * @param nonce_timeout the nonce validity duration in seconds
4459 * @param algo digest algorithms allowed for verification
4460 * @return #MHD_DAUTH_OK if authenticated,
4461 * the error code otherwise
4462 * @note Available since #MHD_VERSION 0x00097513
4463 * @ingroup authentication
4464 */
4465_MHD_EXTERN enum MHD_DigestAuthResult
4466MHD_digest_auth_check_digest3 (struct MHD_Connection *connection,
4467 const char *realm,
4468 const char *username,
4469 const uint8_t *digest,
4470 size_t digest_size,
4471 unsigned int nonce_timeout,
4472 enum MHD_DigestAuthAlgorithm algo);
4473
4474
4475/**
4367 * Authenticates the authorization header sent by the client. 4476 * Authenticates the authorization header sent by the client.
4368 * 4477 *
4369 * @param connection The MHD connection structure 4478 * @param connection The MHD connection structure
@@ -4376,6 +4485,7 @@ enum MHD_DigestAuthAlgorithm
4376 * @return #MHD_YES if authenticated, #MHD_NO if not, 4485 * @return #MHD_YES if authenticated, #MHD_NO if not,
4377 * #MHD_INVALID_NONCE if nonce is invalid or stale 4486 * #MHD_INVALID_NONCE if nonce is invalid or stale
4378 * @note Available since #MHD_VERSION 0x00096200 4487 * @note Available since #MHD_VERSION 0x00096200
4488 * @deprecated use MHD_digest_auth_check3()
4379 * @ingroup authentication 4489 * @ingroup authentication
4380 */ 4490 */
4381_MHD_EXTERN int 4491_MHD_EXTERN int
@@ -4402,8 +4512,8 @@ MHD_digest_auth_check2 (struct MHD_Connection *connection,
4402 * invalid in seconds 4512 * invalid in seconds
4403 * @return #MHD_YES if authenticated, #MHD_NO if not, 4513 * @return #MHD_YES if authenticated, #MHD_NO if not,
4404 * #MHD_INVALID_NONCE if nonce is invalid or stale 4514 * #MHD_INVALID_NONCE if nonce is invalid or stale
4515 * @deprecated use MHD_digest_auth_check3()
4405 * @ingroup authentication 4516 * @ingroup authentication
4406 * @deprecated use MHD_digest_auth_check2()
4407 */ 4517 */
4408_MHD_EXTERN int 4518_MHD_EXTERN int
4409MHD_digest_auth_check (struct MHD_Connection *connection, 4519MHD_digest_auth_check (struct MHD_Connection *connection,
@@ -4429,6 +4539,7 @@ MHD_digest_auth_check (struct MHD_Connection *connection,
4429 * @return #MHD_YES if authenticated, #MHD_NO if not, 4539 * @return #MHD_YES if authenticated, #MHD_NO if not,
4430 * #MHD_INVALID_NONCE if nonce is invalid or stale 4540 * #MHD_INVALID_NONCE if nonce is invalid or stale
4431 * @note Available since #MHD_VERSION 0x00096200 4541 * @note Available since #MHD_VERSION 0x00096200
4542 * @deprecated use MHD_digest_auth_check_digest3()
4432 * @ingroup authentication 4543 * @ingroup authentication
4433 */ 4544 */
4434_MHD_EXTERN int 4545_MHD_EXTERN int
@@ -4457,8 +4568,8 @@ MHD_digest_auth_check_digest2 (struct MHD_Connection *connection,
4457 * @return #MHD_YES if authenticated, #MHD_NO if not, 4568 * @return #MHD_YES if authenticated, #MHD_NO if not,
4458 * #MHD_INVALID_NONCE if nonce is invalid or stale 4569 * #MHD_INVALID_NONCE if nonce is invalid or stale
4459 * @note Available since #MHD_VERSION 0x00096000 4570 * @note Available since #MHD_VERSION 0x00096000
4571 * @deprecated use #MHD_digest_auth_check_digest3()
4460 * @ingroup authentication 4572 * @ingroup authentication
4461 * @deprecated use #MHD_digest_auth_check_digest2()
4462 */ 4573 */
4463_MHD_EXTERN int 4574_MHD_EXTERN int
4464MHD_digest_auth_check_digest (struct MHD_Connection *connection, 4575MHD_digest_auth_check_digest (struct MHD_Connection *connection,
@@ -4477,8 +4588,8 @@ MHD_digest_auth_check_digest (struct MHD_Connection *connection,
4477 * @param response reply to send; should contain the "access denied" 4588 * @param response reply to send; should contain the "access denied"
4478 * body; note that this function will set the "WWW Authenticate" 4589 * body; note that this function will set the "WWW Authenticate"
4479 * header and that the caller should not do this; the NULL is tolerated 4590 * header and that the caller should not do this; the NULL is tolerated
4480 * @param signal_stale #MHD_YES if the nonce is invalid to add 4591 * @param signal_stale #MHD_YES if the nonce is stale to add
4481 * 'stale=true' to the authentication header 4592 * 'stale=true' to the authentication header
4482 * @param algo digest algorithm to use 4593 * @param algo digest algorithm to use
4483 * @return #MHD_YES on success, #MHD_NO otherwise 4594 * @return #MHD_YES on success, #MHD_NO otherwise
4484 * @note Available since #MHD_VERSION 0x00096200 4595 * @note Available since #MHD_VERSION 0x00096200
@@ -4504,8 +4615,8 @@ MHD_queue_auth_fail_response2 (struct MHD_Connection *connection,
4504 * @param response reply to send; should contain the "access denied" 4615 * @param response reply to send; should contain the "access denied"
4505 * body; note that this function will set the "WWW Authenticate" 4616 * body; note that this function will set the "WWW Authenticate"
4506 * header and that the caller should not do this; the NULL is tolerated 4617 * header and that the caller should not do this; the NULL is tolerated
4507 * @param signal_stale #MHD_YES if the nonce is invalid to add 4618 * @param signal_stale #MHD_YES if the nonce is stale to add
4508 * 'stale=true' to the authentication header 4619 * 'stale=true' to the authentication header
4509 * @return #MHD_YES on success, #MHD_NO otherwise 4620 * @return #MHD_YES on success, #MHD_NO otherwise
4510 * @ingroup authentication 4621 * @ingroup authentication
4511 * @deprecated use MHD_queue_auth_fail_response2() 4622 * @deprecated use MHD_queue_auth_fail_response2()