From b9400d5817a7292d42a7e8fb56ee6534538eb395 Mon Sep 17 00:00:00 2001
From: Per Cederqvist <ceder@lysator.liu.se>
Date: Sat, 23 Aug 2003 15:18:09 +0000
Subject: [PATCH] Make all requests that takes a BOOL argument return bad-bool
 if something besides 0 or 1 is sent by the client.  Make statement-like
 macros more robust.

---
 ChangeLog | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 9a3b66b48..4c947c71c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,53 @@
 2003-08-23  Per Cederqvist  <ceder@ceder.dyndns.org>
 
+	Make all requests that takes a BOOL argument return bad-bool if
+	something besides 0 or 1 is sent by the client.
+	* doc/Protocol-A.texi (get-membership-old): Added error code
+	bad-bool.
+	(login): Ditto.
+	(re-z-lookup): Ditto.
+	(lookup-z-name): Ditto.
+	(who-is-on-dynamic): Ditto.
+	(get-membership-10): Ditto.
+	(query-read-texts): Ditto.
+	(get-membership): Ditto.
+	(set-connection-time-format): Ditto.
+	(Error Codes): Document error code bad-bool.
+	(Protocol Version History): Mention bad-bool.
+	(Document Edition History): Mention bad-bool.
+	* src/include/kom-errno.h (enum kom_err): Added KOM_BAD_BOOL.
+	* src/server/manipulate.h (CHK_BOOL): New macro.
+	* src/server/session.c (login): Call CHK_BOOL for invisible.
+	(who_is_on_dynamic): Call CHK_BOOL for want_visible and
+	want_invisible.
+	(set_connection_time_format): Call CHK_BOOL for use_utc.  Don't
+	use KOM_INDEX_OUT_OF_RANGE for that error.
+	* src/server/regex-match.c (re_z_lookup): Call CHK_BOOL for
+	want_persons and want_confs.
+	* src/server/person.c (query_read_texts): Call CHK_BOOL for
+	want_read_ranges.
+	* src/server/membership.c (get_membership_old): Call CHK_BOOL for
+	want_read_texts.
+	(get_membership_10): Ditto.
+	(get_membership): Call CHK_BOOL for want_read_ranges.
+	* src/server/conference.c (lookup_z_name): Call CHK_BOOL for
+	want_persons and want_confs.
+	* src/server/testsuite/lyskomd.0/48.exp: New file: Test the
+	bad-bool error code.
+
+	Make statement-like macros more robust.
+	* src/server/manipulate.h (CHK_CONNECTION): Use the "do ... while
+	(0)" construct to make this macro expand to exactly one statement.
+	(CHK_LOGIN): Ditto.
+	(CONF_ZERO): Ditto.
+	(CHK_EXIST): Ditto.
+	(GET_P_STAT): Ditto.
+	(VOID_GET_P_STAT): Ditto.
+	(GET_C_STAT): Ditto.
+	(VOID_GET_C_STAT): Ditto.
+	(GET_T_STAT): Ditto.
+	(VOID_GET_T_STAT): Ditto.
+
 	"make distcheck" lint.
 	* src/server/testsuite/lyskomd.0/Makefile.am (MOSTLYCLEANFILES):
 	Added aux-items-35.conf and aux-items-46.conf.
-- 
GitLab