From 0024a9d4a996b876d6604df02255bd4df92f8176 Mon Sep 17 00:00:00 2001 From: Nikos Mavrogiannopoulos Date: Sat, 11 Jan 2014 23:19:40 +0100 Subject: [PATCH] Added more debugging messages. --- src/html.c | 2 ++ src/worker-auth.c | 14 +++++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/html.c b/src/html.c index f4557572..b9c8d965 100644 --- a/src/html.c +++ b/src/html.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include "html.h" @@ -89,6 +90,7 @@ char *unescape_url(const char *url, unsigned len, unsigned *out_len) if (sscanf(b, "%02x", &u) <= 0) { free(msg); + syslog(LOG_ERR, "%s: error parsing URL: %s", __func__, url); return NULL; } diff --git a/src/worker-auth.c b/src/worker-auth.c index 61ec8713..e8141119 100644 --- a/src/worker-auth.c +++ b/src/worker-auth.c @@ -460,6 +460,7 @@ int read_user_pass(worker_st *ws, char* body, unsigned body_length, char** usern /* body should contain testtest */ *username = memmem(body, body_length, XMLUSER, sizeof(XMLUSER)-1); if (*username == NULL) { + oclog(ws, LOG_ERR, "cannot find username in client XML message"); return -1; } *username += sizeof(XMLUSER)-1; @@ -468,6 +469,7 @@ int read_user_pass(worker_st *ws, char* body, unsigned body_length, char** usern if (password != NULL) { *password = memmem(body, body_length, XMLPASS, sizeof(XMLPASS)-1); if (*password == NULL) { + oclog(ws, LOG_ERR, "cannot find password in client XML message"); return -1; } *password += sizeof(XMLPASS)-1; @@ -500,12 +502,13 @@ int read_user_pass(worker_st *ws, char* body, unsigned body_length, char** usern *password = unescape_html(*password, strlen(*password), NULL); } - + } else { /* non-xml version */ /* body should be "username=test&password=test" */ if (username != NULL) { *username = memmem(body, body_length, "username=", sizeof("username=")-1); if (*username == NULL) { + oclog(ws, LOG_ERR, "cannot find username in client message"); return -1; } *username += sizeof("username=")-1; @@ -514,6 +517,7 @@ int read_user_pass(worker_st *ws, char* body, unsigned body_length, char** usern if (password != NULL) { *password = memmem(body, body_length, "password=", sizeof("password=")-1); if (*password == NULL) { + oclog(ws, LOG_ERR, "cannot find password in client message"); return -1; } *password += sizeof("password=")-1; @@ -547,11 +551,15 @@ int read_user_pass(worker_st *ws, char* body, unsigned body_length, char** usern } } - if (username != NULL && *username == NULL) + if (username != NULL && *username == NULL) { + oclog(ws, LOG_ERR, "username requested but no username in client message"); return -1; + } - if (password != NULL && *password == NULL) + if (password != NULL && *password == NULL) { + oclog(ws, LOG_ERR, "password requested but no password in client message"); return -1; + } return 0; }