[PATCH] (trivial) some better log messages in gw/smsbox.c

Guillaume Cottenceau <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <[email protected]>
Here's a proposed patch to enhance the log and output messages
when gw/smsbox.c encounters a message without a recipient field.
I bumped into that problem (because of a missing '&' before
'to=..' in an SMS push URL) but the log and output messages were
insufficient to easily track down the problem without looking in
the source code.


-- 
Guillaume Cottenceau
gw-smsbox-better-logging-for-missing-recipient.diff (text/x-patch, 1.4 KB)
Index: gw/smsbox.c
===================================================================
RCS file: /home/cvs/gateway/gw/smsbox.c,v
retrieving revision 1.245
diff -u -r1.245 smsbox.c
--- gw/smsbox.c	24 Feb 2004 13:17:45 -0000	1.245
+++ gw/smsbox.c	16 Apr 2004 09:28:05 -0000
@@ -2414,9 +2414,10 @@
      * we required "to" to be defined
      */
     if (to == NULL) {
-	error(0, "%s got insufficient headers",octstr_get_cstr(sendsms_url));
+	error(0, "%s got insufficient headers (<to> is NULL)",
+	      octstr_get_cstr(sendsms_url));
 	*status = HTTP_BAD_REQUEST;
-	return octstr_create("Insufficient headers, rejected");
+	return octstr_create("Missing receiver number, rejected");
     } 
     else if (octstr_len(to) == 0) {
 	error(0, "%s got empty <to> cgi variable", octstr_get_cstr(sendsms_url));
@@ -2506,9 +2507,10 @@
 	ret = octstr_create("Authorization failed for sendsms");
     }
     else if (to == NULL && tolist == NULL) {
-	error(0, "%s got insufficient headers", octstr_get_cstr(sendsms_url));
+	error(0, "%s got insufficient headers (<to> and <tolist> are NULL)",
+	      octstr_get_cstr(sendsms_url));
 	*status = HTTP_BAD_REQUEST;
-	ret = octstr_create("Insufficient headers, rejected");
+	ret = octstr_create("Missing receiver(s) number(s), rejected");
     } 
     else if (to != NULL && octstr_len(to) == 0) {
 	error(0, "%s got empty <to> cgi variable", octstr_get_cstr(sendsms_url));
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.