summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--blog.c5
-rw-r--r--blog.h4
2 files changed, 6 insertions, 3 deletions
diff --git a/blog.c b/blog.c
index b0c6cc2..6d22a10 100644
--- a/blog.c
+++ b/blog.c
@@ -16,8 +16,9 @@ int handle_post(void)
printf("Content-Type: text/plain\r\n\r\n");
read_post_data();
- if (!verify_creds(find_post_data("username"), find_post_data("password"))) {
- // handle invalid login
+ if (!authenticate(find_post_data("username"), find_post_data("password"))) {
+ printf("Bad login!");
+ return 0;
}
for (char **e = environ; e && *e; e++) {
diff --git a/blog.h b/blog.h
index 051f162..3ce3976 100644
--- a/blog.h
+++ b/blog.h
@@ -1,10 +1,12 @@
#ifndef BLOG_H
#define BLOG_H
+#define PASSWORD_FILE "/blog/password"
+
void read_post_data(void);
char *find_post_data(char *key);
-int verify_creds(const char *username, const char *password);
+int authenticate(const char *username, const char *password);
int handle_post(void);