From aa9b1007693277ea5d542b868e8aa2889c4f804a Mon Sep 17 00:00:00 2001 From: zribiahmed Date: Thu, 21 Feb 2013 11:32:56 +0000 Subject: [PATCH] log update --- src/cwmp.c | 2 +- src/digestauth.c | 24 +++++++----------------- src/http.c | 4 ++-- src/ubus.c | 4 ++-- src/xml.c | 26 +++++++++++++------------- 5 files changed, 25 insertions(+), 35 deletions(-) diff --git a/src/cwmp.c b/src/cwmp.c index 9a991ce..a33efd5 100644 --- a/src/cwmp.c +++ b/src/cwmp.c @@ -173,7 +173,7 @@ int cwmp_schedule_rpc (struct cwmp *cwmp, struct session *session) int error=0,e; if (http_client_init(cwmp)) { - CWMP_LOG(INFO, "initializing http client failed\n"); + CWMP_LOG(INFO, "Initializing http client failed"); goto retry; } diff --git a/src/digestauth.c b/src/digestauth.c index b19fd0c..7f7ca63 100644 --- a/src/digestauth.c +++ b/src/digestauth.c @@ -18,8 +18,6 @@ #include "md5.h" #include "digestauth.h" -#undef DIGEST_DEBUG - #define HASH_MD5_HEX_LEN (2 * MD5_DIGEST_SIZE) /** @@ -318,9 +316,8 @@ int http_digest_auth_fail_response(FILE *fp, const char *http_method, "Digest realm=\"%s\",qop=\"auth\",nonce=\"%s\",opaque=\"%s\"%s", realm, nonce, opaque, signal_stale ? ",stale=\"true\"" : ""); -#ifdef DIGEST_DEBUG - printf("%s: header: %s\n", __FUNCTION__, header); -#endif + DD(DEBUG, "%s: header: %s", __FUNCTION__, header); + fputs("WWW-Authenticate: ", fp); fputs(header, fp); return MHD_YES; @@ -362,9 +359,7 @@ int http_digest_auth_check(const char *http_method, const char *url, size_t left; /* number of characters left in 'header' for 'uri' */ unsigned long int nci; -#ifdef DIGEST_DEBUG - printf("%s: header: %s\n", __FUNCTION__, header); -#endif + DD(DEBUG, "%s: header: %s", __FUNCTION__, header); left = strlen(header); @@ -410,9 +405,8 @@ int http_digest_auth_check(const char *http_method, const char *url, if (0 != strncmp(uri, url, strlen(url))) { -#ifdef DIGEST_DEBUG - printf("Authentication failed: URI does not match.\n"); -#endif + DD(DEBUG, "Authentication failed: URI does not match."); + return MHD_NO; } @@ -440,17 +434,13 @@ int http_digest_auth_check(const char *http_method, const char *url, == lookup_sub_value(response, sizeof(response), header, "response"))) { -#ifdef DIGEST_DEBUG - printf("Authentication failed, invalid format.\n"); -#endif + DD(DEBUG, "Authentication failed, invalid format."); return MHD_NO; } nci = strtoul(nc, &end, 16); if (('\0' != *end) || ((LONG_MAX == nci) && (ERANGE == errno))) { -#ifdef DIGEST_DEBUG - printf("Authentication failed, invalid format.\n"); -#endif + DD(DEBUG, "Authentication failed, invalid format."); return MHD_NO; /* invalid nonce format */ } diff --git a/src/http.c b/src/http.c index d0a10c8..c8b8761 100644 --- a/src/http.c +++ b/src/http.c @@ -67,7 +67,7 @@ http_client_init(struct cwmp *cwmp) return -1; #endif - CWMP_LOG(INFO, "ACS url: %s\n", http_c.url); + CWMP_LOG(INFO, "ACS url: %s", http_c.url); /* TODO debug ssl config from freecwmp*/ @@ -278,7 +278,7 @@ static void http_new_client(struct uloop_fd *ufd, unsigned events) /* set one minute timeout */ if (setsockopt(ufd->fd, SOL_SOCKET, SO_RCVTIMEO, (char *)&t, sizeof t)) { - CWMP_LOG(ERROR,"setsockopt() failed\n"); + CWMP_LOG(ERROR,"setsockopt() failed"); } if (client == -1) diff --git a/src/ubus.c b/src/ubus.c index 614a3c8..08d7e5a 100644 --- a/src/ubus.c +++ b/src/ubus.c @@ -92,13 +92,13 @@ cwmp_handle_command(struct ubus_context *ctx, struct ubus_object *obj, char *info; if (!strcmp("reload_end_session", cmd)) { - CWMP_LOG(INFO, "triggered ubus reload_end_session\n"); + CWMP_LOG(INFO, "triggered ubus reload_end_session"); cwmp_set_end_session(END_SESSION_RELOAD); blobmsg_add_u32(&b, "status", 0); if (asprintf(&info, "freecwmpd config will reload at the end of the session") == -1) return -1; } else if (!strcmp("reload", cmd)) { - CWMP_LOG(INFO, "triggered ubus reload\n"); + CWMP_LOG(INFO, "triggered ubus reload"); cwmp_apply_acs_changes(); blobmsg_add_u32(&b, "status", 0); if (asprintf(&info, "freecwmp config reloaded") == -1) diff --git a/src/xml.c b/src/xml.c index b31b72f..15bfa8f 100644 --- a/src/xml.c +++ b/src/xml.c @@ -74,19 +74,19 @@ struct FAULT_CPE FAULT_CPE_ARRAY [] = { }; const struct rpc_cpe_method rpc_cpe_methods[] = { - [RPC_CPE_GET_RPC_METHODS] = {"GetRPCMethods", cwmp_handle_rpc_cpe_get_rpc_methods}, - [RPC_CPE_SET_PARAMETER_VALUES] = {"SetParameterValues", cwmp_handle_rpc_cpe_set_parameter_values}, - [RPC_CPE_GET_PARAMETER_VALUES] = {"GetParameterValues", cwmp_handle_rpc_cpe_get_parameter_values}, - [RPC_CPE_GET_PARAMETER_NAMES] = {"GetParameterNames", cwmp_handle_rpc_cpe_get_parameter_names}, - [RPC_CPE_SET_PARAMETER_ATTRIBUTES] = {"SetParameterAttributes", cwmp_handle_rpc_cpe_set_parameter_attributes}, - [RPC_CPE_GET_PARAMETER_ATTRIBUTES] = {"GetParameterAttributes", cwmp_handle_rpc_cpe_get_parameter_attributes}, - [RPC_CPE_ADD_OBJECT] = {"AddObject", cwmp_handle_rpc_cpe_add_object}, - [RPC_CPE_DELETE_OBJECT] = {"DeleteObject", cwmp_handle_rpc_cpe_delete_object}, - [RPC_CPE_REBOOT] = {"Reboot", cwmp_handle_rpc_cpe_reboot}, - [RPC_CPE_DOWNLOAD] = {"Download", cwmp_handle_rpc_cpe_download}, - [RPC_CPE_FACTORY_RESET] = {"FactoryReset", cwmp_handle_rpc_cpe_factory_reset}, - [RPC_CPE_SCHEDULE_INFORM] = {"ScheduleInform", cwmp_handle_rpc_cpe_schedule_inform}, - [RPC_CPE_FAULT] = {NULL, cwmp_handle_rpc_cpe_fault} + [RPC_CPE_GET_RPC_METHODS] = {"GetRPCMethods", cwmp_handle_rpc_cpe_get_rpc_methods}, + [RPC_CPE_SET_PARAMETER_VALUES] = {"SetParameterValues", cwmp_handle_rpc_cpe_set_parameter_values}, + [RPC_CPE_GET_PARAMETER_VALUES] = {"GetParameterValues", cwmp_handle_rpc_cpe_get_parameter_values}, + [RPC_CPE_GET_PARAMETER_NAMES] = {"GetParameterNames", cwmp_handle_rpc_cpe_get_parameter_names}, + [RPC_CPE_SET_PARAMETER_ATTRIBUTES] = {"SetParameterAttributes", cwmp_handle_rpc_cpe_set_parameter_attributes}, + [RPC_CPE_GET_PARAMETER_ATTRIBUTES] = {"GetParameterAttributes", cwmp_handle_rpc_cpe_get_parameter_attributes}, + [RPC_CPE_ADD_OBJECT] = {"AddObject", cwmp_handle_rpc_cpe_add_object}, + [RPC_CPE_DELETE_OBJECT] = {"DeleteObject", cwmp_handle_rpc_cpe_delete_object}, + [RPC_CPE_REBOOT] = {"Reboot", cwmp_handle_rpc_cpe_reboot}, + [RPC_CPE_DOWNLOAD] = {"Download", cwmp_handle_rpc_cpe_download}, + [RPC_CPE_FACTORY_RESET] = {"FactoryReset", cwmp_handle_rpc_cpe_factory_reset}, + [RPC_CPE_SCHEDULE_INFORM] = {"ScheduleInform", cwmp_handle_rpc_cpe_schedule_inform}, + [RPC_CPE_FAULT] = {"Fault", cwmp_handle_rpc_cpe_fault} }; const struct rpc_acs_method rpc_acs_methods[] = {