aboutsummaryrefslogtreecommitdiff
path: root/doc/examples/basicauthentication.c
diff options
context:
space:
mode:
Diffstat (limited to 'doc/examples/basicauthentication.c')
-rw-r--r--doc/examples/basicauthentication.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/doc/examples/basicauthentication.c b/doc/examples/basicauthentication.c
index 0e13a2ee..88cb79b7 100644
--- a/doc/examples/basicauthentication.c
+++ b/doc/examples/basicauthentication.c
@@ -42,12 +42,13 @@ answer_to_connection (void *cls, struct MHD_Connection *connection,
42 return MHD_YES; 42 return MHD_YES;
43 } 43 }
44 pass = NULL; 44 pass = NULL;
45 user = MHD_basic_auth_get_username_password (connection, &pass); 45 user = MHD_basic_auth_get_username_password (connection,
46 fail = ( (user == NULL) || 46 &pass);
47 fail = ( (NULL == user) ||
47 (0 != strcmp (user, "root")) || 48 (0 != strcmp (user, "root")) ||
48 (0 != strcmp (pass, "pa$$w0rd") ) ); 49 (0 != strcmp (pass, "pa$$w0rd") ) );
49 if (user != NULL) free (user); 50 if (NULL != user) MHD_free (user);
50 if (pass != NULL) free (pass); 51 if (NULL != pass) MHD_free (pass);
51 if (fail) 52 if (fail)
52 { 53 {
53 const char *page = "<html><body>Go away.</body></html>"; 54 const char *page = "<html><body>Go away.</body></html>";