diff options
Diffstat (limited to 'src/examples/authorization_example.c')
-rw-r--r-- | src/examples/authorization_example.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/examples/authorization_example.c b/src/examples/authorization_example.c index d62973a2..d8a88203 100644 --- a/src/examples/authorization_example.c +++ b/src/examples/authorization_example.c | |||
@@ -70,8 +70,11 @@ ahc_echo (void *cls, | |||
70 | 70 | ||
71 | /* require: "Aladdin" with password "open sesame" */ | 71 | /* require: "Aladdin" with password "open sesame" */ |
72 | pass = NULL; | 72 | pass = NULL; |
73 | user = MHD_basic_auth_get_username_password (connection, &pass); | 73 | user = MHD_basic_auth_get_username_password (connection, |
74 | fail = ( (user == NULL) || (0 != strcmp (user, "Aladdin")) || (0 != strcmp (pass, "open sesame") ) ); | 74 | &pass); |
75 | fail = ( (NULL == user) || | ||
76 | (0 != strcmp (user, "Aladdin")) || | ||
77 | (0 != strcmp (pass, "open sesame") ) ); | ||
75 | if (fail) | 78 | if (fail) |
76 | { | 79 | { |
77 | response = MHD_create_response_from_buffer (strlen (DENIED), | 80 | response = MHD_create_response_from_buffer (strlen (DENIED), |
@@ -87,9 +90,9 @@ ahc_echo (void *cls, | |||
87 | ret = MHD_queue_response (connection, MHD_HTTP_OK, response); | 90 | ret = MHD_queue_response (connection, MHD_HTTP_OK, response); |
88 | } | 91 | } |
89 | if (NULL != user) | 92 | if (NULL != user) |
90 | free (user); | 93 | MHD_free (user); |
91 | if (NULL != pass) | 94 | if (NULL != pass) |
92 | free (pass); | 95 | MHD_free (pass); |
93 | MHD_destroy_response (response); | 96 | MHD_destroy_response (response); |
94 | return ret; | 97 | return ret; |
95 | } | 98 | } |