aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvgeny Grin (Karlson2k) <k2k@narod.ru>2022-01-27 20:31:05 +0300
committerEvgeny Grin (Karlson2k) <k2k@narod.ru>2022-01-27 20:31:05 +0300
commit63b63330fbe75873dce0e4e820da75de295ffd51 (patch)
tree96e0543a1545abdb54e718cab6e8d16604c4beaf
parent1a7e4a5a5be438726de9e9c9a55e23c021b62d47 (diff)
downloadlibmicrohttpd-63b63330fbe75873dce0e4e820da75de295ffd51.tar.gz
libmicrohttpd-63b63330fbe75873dce0e4e820da75de295ffd51.zip
Updated doxy; explicitly tolerated NULL in MHD_queue*_auth*()
-rw-r--r--src/include/microhttpd.h10
-rw-r--r--src/microhttpd/basicauth.c7
-rw-r--r--src/microhttpd/connection.c4
-rw-r--r--src/microhttpd/digestauth.c7
4 files changed, 18 insertions, 10 deletions
diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h
index 23ce06c7..42409403 100644
--- a/src/include/microhttpd.h
+++ b/src/include/microhttpd.h
@@ -3226,8 +3226,8 @@ MHD_lookup_connection_value_n (struct MHD_Connection *connection,
3226 * 3226 *
3227 * @param connection the connection identifying the client 3227 * @param connection the connection identifying the client
3228 * @param status_code HTTP status code (i.e. #MHD_HTTP_OK) 3228 * @param status_code HTTP status code (i.e. #MHD_HTTP_OK)
3229 * @param response response to transmit 3229 * @param response response to transmit, the NULL is tolerated
3230 * @return #MHD_NO on error (i.e. reply already sent), 3230 * @return #MHD_NO on error (reply already sent, response is NULL),
3231 * #MHD_YES on success or if message has been queued 3231 * #MHD_YES on success or if message has been queued
3232 * @ingroup response 3232 * @ingroup response
3233 * @sa #MHD_AccessHandlerCallback 3233 * @sa #MHD_AccessHandlerCallback
@@ -4226,7 +4226,7 @@ MHD_digest_auth_check_digest (struct MHD_Connection *connection,
4226 * @param opaque string to user for opaque value 4226 * @param opaque string to user for opaque value
4227 * @param response reply to send; should contain the "access denied" 4227 * @param response reply to send; should contain the "access denied"
4228 * body; note that this function will set the "WWW Authenticate" 4228 * body; note that this function will set the "WWW Authenticate"
4229 * header and that the caller should not do this 4229 * header and that the caller should not do this; the NULL is tolerated
4230 * @param signal_stale #MHD_YES if the nonce is invalid to add 4230 * @param signal_stale #MHD_YES if the nonce is invalid to add
4231 * 'stale=true' to the authentication header 4231 * 'stale=true' to the authentication header
4232 * @param algo digest algorithm to use 4232 * @param algo digest algorithm to use
@@ -4253,7 +4253,7 @@ MHD_queue_auth_fail_response2 (struct MHD_Connection *connection,
4253 * @param opaque string to user for opaque value 4253 * @param opaque string to user for opaque value
4254 * @param response reply to send; should contain the "access denied" 4254 * @param response reply to send; should contain the "access denied"
4255 * body; note that this function will set the "WWW Authenticate" 4255 * body; note that this function will set the "WWW Authenticate"
4256 * header and that the caller should not do this 4256 * header and that the caller should not do this; the NULL is tolerated
4257 * @param signal_stale #MHD_YES if the nonce is invalid to add 4257 * @param signal_stale #MHD_YES if the nonce is invalid to add
4258 * 'stale=true' to the authentication header 4258 * 'stale=true' to the authentication header
4259 * @return #MHD_YES on success, #MHD_NO otherwise 4259 * @return #MHD_YES on success, #MHD_NO otherwise
@@ -4290,7 +4290,7 @@ MHD_basic_auth_get_username_password (struct MHD_Connection *connection,
4290 * 4290 *
4291 * @param connection The MHD connection structure 4291 * @param connection The MHD connection structure
4292 * @param realm the realm presented to the client 4292 * @param realm the realm presented to the client
4293 * @param response response object to modify and queue 4293 * @param response response object to modify and queue; the NULL is tolerated
4294 * @return #MHD_YES on success, #MHD_NO otherwise 4294 * @return #MHD_YES on success, #MHD_NO otherwise
4295 * @ingroup authentication 4295 * @ingroup authentication
4296 */ 4296 */
diff --git a/src/microhttpd/basicauth.c b/src/microhttpd/basicauth.c
index d39019f5..a20a43d3 100644
--- a/src/microhttpd/basicauth.c
+++ b/src/microhttpd/basicauth.c
@@ -109,14 +109,14 @@ MHD_basic_auth_get_username_password (struct MHD_Connection *connection,
109 109
110 110
111/** 111/**
112 * Queues a response to request basic authentication from the client. 112 * Queues a response to request basic authentication from the client
113 * The given response object is expected to include the payload for 113 * The given response object is expected to include the payload for
114 * the response; the "WWW-Authenticate" header will be added and the 114 * the response; the "WWW-Authenticate" header will be added and the
115 * response queued with the 'UNAUTHORIZED' status code. 115 * response queued with the 'UNAUTHORIZED' status code.
116 * 116 *
117 * @param connection The MHD connection structure 117 * @param connection The MHD connection structure
118 * @param realm the realm presented to the client 118 * @param realm the realm presented to the client
119 * @param response response object to modify and queue 119 * @param response response object to modify and queue; the NULL is tolerated
120 * @return #MHD_YES on success, #MHD_NO otherwise 120 * @return #MHD_YES on success, #MHD_NO otherwise
121 * @ingroup authentication 121 * @ingroup authentication
122 */ 122 */
@@ -130,6 +130,9 @@ MHD_queue_basic_auth_fail_response (struct MHD_Connection *connection,
130 size_t hlen = strlen (realm) + strlen ("Basic realm=\"\"") + 1; 130 size_t hlen = strlen (realm) + strlen ("Basic realm=\"\"") + 1;
131 char *header; 131 char *header;
132 132
133 if (NULL == response)
134 return MHD_NO;
135
133 header = (char *) malloc (hlen); 136 header = (char *) malloc (hlen);
134 if (NULL == header) 137 if (NULL == header)
135 { 138 {
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index 21c4d338..f6a871c0 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -5084,8 +5084,8 @@ MHD_set_connection_option (struct MHD_Connection *connection,
5084 * 5084 *
5085 * @param connection the connection identifying the client 5085 * @param connection the connection identifying the client
5086 * @param status_code HTTP status code (i.e. #MHD_HTTP_OK) 5086 * @param status_code HTTP status code (i.e. #MHD_HTTP_OK)
5087 * @param response response to transmit 5087 * @param response response to transmit, the NULL is tolerated
5088 * @return #MHD_NO on error (i.e. reply already sent), 5088 * @return #MHD_NO on error (reply already sent, response is NULL),
5089 * #MHD_YES on success or if message has been queued 5089 * #MHD_YES on success or if message has been queued
5090 * @ingroup response 5090 * @ingroup response
5091 * @sa #MHD_AccessHandlerCallback 5091 * @sa #MHD_AccessHandlerCallback
diff --git a/src/microhttpd/digestauth.c b/src/microhttpd/digestauth.c
index a1b7bcf4..e0a26b30 100644
--- a/src/microhttpd/digestauth.c
+++ b/src/microhttpd/digestauth.c
@@ -1326,11 +1326,12 @@ MHD_digest_auth_check_digest (struct MHD_Connection *connection,
1326 * @param opaque string to user for opaque value 1326 * @param opaque string to user for opaque value
1327 * @param response reply to send; should contain the "access denied" 1327 * @param response reply to send; should contain the "access denied"
1328 * body; note that this function will set the "WWW Authenticate" 1328 * body; note that this function will set the "WWW Authenticate"
1329 * header and that the caller should not do this 1329 * header and that the caller should not do this; the NULL is tolerated
1330 * @param signal_stale #MHD_YES if the nonce is invalid to add 1330 * @param signal_stale #MHD_YES if the nonce is invalid to add
1331 * 'stale=true' to the authentication header 1331 * 'stale=true' to the authentication header
1332 * @param algo digest algorithm to use 1332 * @param algo digest algorithm to use
1333 * @return #MHD_YES on success, #MHD_NO otherwise 1333 * @return #MHD_YES on success, #MHD_NO otherwise
1334 * @note Available since #MHD_VERSION 0x00096200
1334 * @ingroup authentication 1335 * @ingroup authentication
1335 */ 1336 */
1336enum MHD_Result 1337enum MHD_Result
@@ -1345,6 +1346,10 @@ MHD_queue_auth_fail_response2 (struct MHD_Connection *connection,
1345 int hlen; 1346 int hlen;
1346 SETUP_DA (algo, da); 1347 SETUP_DA (algo, da);
1347 1348
1349 if (NULL == response)
1350 return MHD_NO;
1351
1352 if (1)
1348 { 1353 {
1349 char nonce[NONCE_STD_LEN (VLA_ARRAY_LEN_DIGEST (da.digest_size)) + 1]; 1354 char nonce[NONCE_STD_LEN (VLA_ARRAY_LEN_DIGEST (da.digest_size)) + 1];
1350 1355