aboutsummaryrefslogtreecommitdiff
path: root/src/examples/digest_auth_example.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/examples/digest_auth_example.c')
-rw-r--r--src/examples/digest_auth_example.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/examples/digest_auth_example.c b/src/examples/digest_auth_example.c
index 51352022..a35fa8e5 100644
--- a/src/examples/digest_auth_example.c
+++ b/src/examples/digest_auth_example.c
@@ -47,41 +47,41 @@ ahc_echo (void *cls,
47 int ret; 47 int ret;
48 48
49 username = MHD_digest_auth_get_username(connection); 49 username = MHD_digest_auth_get_username(connection);
50 if (username == NULL) 50 if (username == NULL)
51 { 51 {
52 response = MHD_create_response_from_buffer(strlen (DENIED), 52 response = MHD_create_response_from_buffer(strlen (DENIED),
53 DENIED, 53 DENIED,
54 MHD_RESPMEM_PERSISTENT); 54 MHD_RESPMEM_PERSISTENT);
55 ret = MHD_queue_auth_fail_response(connection, realm, 55 ret = MHD_queue_auth_fail_response(connection, realm,
56 MY_OPAQUE_STR, 56 MY_OPAQUE_STR,
57 response, 57 response,
58 MHD_NO); 58 MHD_NO);
59 MHD_destroy_response(response); 59 MHD_destroy_response(response);
60 return ret; 60 return ret;
61 } 61 }
62 ret = MHD_digest_auth_check(connection, realm, 62 ret = MHD_digest_auth_check(connection, realm,
63 username, 63 username,
64 password, 64 password,
65 300); 65 300);
66 free(username); 66 free(username);
67 if ( (ret == MHD_INVALID_NONCE) || 67 if ( (ret == MHD_INVALID_NONCE) ||
68 (ret == MHD_NO) ) 68 (ret == MHD_NO) )
69 { 69 {
70 response = MHD_create_response_from_buffer(strlen (DENIED), 70 response = MHD_create_response_from_buffer(strlen (DENIED),
71 DENIED, 71 DENIED,
72 MHD_RESPMEM_PERSISTENT); 72 MHD_RESPMEM_PERSISTENT);
73 if (NULL == response) 73 if (NULL == response)
74 return MHD_NO; 74 return MHD_NO;
75 ret = MHD_queue_auth_fail_response(connection, realm, 75 ret = MHD_queue_auth_fail_response(connection, realm,
76 MY_OPAQUE_STR, 76 MY_OPAQUE_STR,
77 response, 77 response,
78 (ret == MHD_INVALID_NONCE) ? MHD_YES : MHD_NO); 78 (ret == MHD_INVALID_NONCE) ? MHD_YES : MHD_NO);
79 MHD_destroy_response(response); 79 MHD_destroy_response(response);
80 return ret; 80 return ret;
81 } 81 }
82 response = MHD_create_response_from_buffer(strlen(PAGE), PAGE, 82 response = MHD_create_response_from_buffer(strlen(PAGE), PAGE,
83 MHD_RESPMEM_PERSISTENT); 83 MHD_RESPMEM_PERSISTENT);
84 ret = MHD_queue_response(connection, MHD_HTTP_OK, response); 84 ret = MHD_queue_response(connection, MHD_HTTP_OK, response);
85 MHD_destroy_response(response); 85 MHD_destroy_response(response);
86 return ret; 86 return ret;
87} 87}
@@ -91,7 +91,7 @@ main (int argc, char *const *argv)
91{ 91{
92 int fd; 92 int fd;
93 char rnd[8]; 93 char rnd[8];
94 size_t len; 94 ssize_t len;
95 size_t off; 95 size_t off;
96 struct MHD_Daemon *d; 96 struct MHD_Daemon *d;
97 97