From 613aa4c10d0ec1928a5e5b90b6381b2098612f09 Mon Sep 17 00:00:00 2001 From: Wilfried Goesgens Date: Thu, 12 May 2011 20:18:03 +0000 Subject: [PATCH] fix source so that '-Wformat -Werror=format-security' doesn't stop us from compiling --- citadel/debian/rules | 2 +- citadel/modules/extnotify/funambol65.c | 4 ++-- citadel/modules/managesieve/serv_managesieve.c | 2 +- citadel/modules/network/serv_network.c | 4 ++-- citadel/serv_extensions.c | 4 ++-- citadel/utillib/citadel_ipc.c | 2 +- citadel/utils/sendcommand.c | 2 +- libcitadel/debian/rules | 2 +- webcit/debian/po/templates.pot | 7 ++++--- webcit/debian/rules | 3 ++- webcit/subst.c | 4 ++-- 11 files changed, 19 insertions(+), 17 deletions(-) diff --git a/citadel/debian/rules b/citadel/debian/rules index 85489575c..9217bc55a 100755 --- a/citadel/debian/rules +++ b/citadel/debian/rules @@ -11,7 +11,7 @@ export DH_OPTIONS DEB_DESTDIR = $(CURDIR)/debian/tmp -CFLAGS = -Wall -g +CFLAGS = -Wall -g -Werror=format-security COMPILER= EXTRA_ARGS= diff --git a/citadel/modules/extnotify/funambol65.c b/citadel/modules/extnotify/funambol65.c index 5cd7c4d9e..1d3e7e4db 100644 --- a/citadel/modules/extnotify/funambol65.c +++ b/citadel/modules/extnotify/funambol65.c @@ -90,7 +90,7 @@ int notify_http_server(char *remoteurl, snprintf(buf, SIZ, "Cannot load template file %s [%s]won't send notification\r\n", file_funambol_msg, strerror(errno)); - syslog(LOG_ERR, buf); + syslog(LOG_ERR, "%s", buf); CtdlAideMessage(buf, "External notifier unable to find message template!"); goto abort; @@ -113,7 +113,7 @@ int notify_http_server(char *remoteurl, snprintf(buf, SIZ, "Cannot load template file %s; won't send notification\r\n", file_funambol_msg); - syslog(LOG_ERR, buf); + syslog(LOG_ERR, "%s", buf); CtdlAideMessage(buf, "External notifier unable to load message template!"); goto abort; diff --git a/citadel/modules/managesieve/serv_managesieve.c b/citadel/modules/managesieve/serv_managesieve.c index 965cff964..680f26d89 100644 --- a/citadel/modules/managesieve/serv_managesieve.c +++ b/citadel/modules/managesieve/serv_managesieve.c @@ -464,7 +464,7 @@ void cmd_mgsve_getscript(int num_parms, char **parms, struct sdm_userdata *u) slen = strlen(script_content); outbuf = malloc (slen + 64); snprintf(outbuf, slen + 64, "{%ld+}\r\n%s\r\nOK\r\n",slen, script_content); - cprintf(outbuf); + cprintf("%s", outbuf); } else cprintf("No \"there is no script by that name %s \"\r\n", parms[1]); diff --git a/citadel/modules/network/serv_network.c b/citadel/modules/network/serv_network.c index 4518740bf..1187cfe58 100644 --- a/citadel/modules/network/serv_network.c +++ b/citadel/modules/network/serv_network.c @@ -2436,7 +2436,7 @@ void cmd_netp(char *cmdbuf) "An unknown Citadel server called \"%s\" attempted to connect from %s [%s].\n", node, CC->cs_host, CC->cs_addr ); - syslog(LOG_WARNING, err_buf); + syslog(LOG_WARNING, "%s", err_buf); cprintf("%d authentication failed\n", ERROR + PASSWORD_REQUIRED); CtdlAideMessage(err_buf, "IGNet Networking."); return; @@ -2447,7 +2447,7 @@ void cmd_netp(char *cmdbuf) "A Citadel server at %s [%s] failed to authenticate as network node \"%s\".\n", CC->cs_host, CC->cs_addr, node ); - syslog(LOG_WARNING, err_buf); + syslog(LOG_WARNING, "%s", err_buf); cprintf("%d authentication failed\n", ERROR + PASSWORD_REQUIRED); CtdlAideMessage(err_buf, "IGNet Networking."); return; diff --git a/citadel/serv_extensions.c b/citadel/serv_extensions.c index a94239573..33c83f738 100644 --- a/citadel/serv_extensions.c +++ b/citadel/serv_extensions.c @@ -126,8 +126,8 @@ void LogPrintMessages(long err) snprintf(Message, n * SIZ, ErrGeneral, Short, Where, List, Hint, DetailList); - syslog(LOG_EMERG,Message); - syslog(LOG_EMERG,ErrSubject); + syslog(LOG_EMERG, "%s", Message); + syslog(LOG_EMERG, "%s", ErrSubject); quickie_message("Citadel", NULL, NULL, AIDEROOM, Message, FMT_FIXED, ErrSubject); if (errormessages!=NULL) free (errormessages); errormessages = NULL; diff --git a/citadel/utillib/citadel_ipc.c b/citadel/utillib/citadel_ipc.c index fb90f33d0..52da9167e 100644 --- a/citadel/utillib/citadel_ipc.c +++ b/citadel/utillib/citadel_ipc.c @@ -3251,7 +3251,7 @@ CtdlIPC* CtdlIPC_new(int argc, char **argv, char *hostbuf, char *portbuf) /* If we're using a unix domain socket we can do a bunch of stuff */ if (!strcmp(cithost, UDS)) { if (!strcasecmp(citport, DEFAULT_PORT)) { - snprintf(sockpath, sizeof sockpath, file_citadel_socket); + snprintf(sockpath, sizeof sockpath, "%s", file_citadel_socket); } else { snprintf(sockpath, sizeof sockpath, "%s/%s", citport, "citadel.socket"); diff --git a/citadel/utils/sendcommand.c b/citadel/utils/sendcommand.c index c259a5b68..52d05258d 100644 --- a/citadel/utils/sendcommand.c +++ b/citadel/utils/sendcommand.c @@ -289,7 +289,7 @@ int main(int argc, char **argv) n = read(ipc->sock, rbuf, SIZ); if (n>0) { rbuf[n]='\0'; - fprintf(stderr, rbuf); + fprintf(stderr, "%s", rbuf); fflush (stdout); } } diff --git a/libcitadel/debian/rules b/libcitadel/debian/rules index a0cddd79e..7bfdf7efc 100755 --- a/libcitadel/debian/rules +++ b/libcitadel/debian/rules @@ -9,7 +9,7 @@ export DH_COMPAT = 5 DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) -CFLAGS = -Wall -g +CFLAGS = -Wall -g -Wformat -Werror=format-security #-finline-functions LDFALGS = # -finline-functions diff --git a/webcit/debian/po/templates.pot b/webcit/debian/po/templates.pot index 28a4d829d..bca6d4290 100644 --- a/webcit/debian/po/templates.pot +++ b/webcit/debian/po/templates.pot @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: webcit@packages.debian.org\n" -"POT-Creation-Date: 2009-02-28 11:20+0100\n" +"POT-Creation-Date: 2011-05-12 20:13+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" @@ -62,8 +63,8 @@ msgstr "" #. Description #: ../citadel-webcit.templates:3001 msgid "" -"Select the port which the SSL HTTP Webcit server should listen on or enter -" -"1 to disable it." +"Select the port which the SSL HTTP Webcit server should listen on or enter " +"-1 to disable it." msgstr "" #. Type: select diff --git a/webcit/debian/rules b/webcit/debian/rules index f97e5d04e..2631d682c 100755 --- a/webcit/debian/rules +++ b/webcit/debian/rules @@ -18,6 +18,7 @@ DESTDIR=$(CURDIR)/debian/citadel-webcit EXTRA_ARGS= PROFILE_ARGS= COMPILER= +CFLAGS= #to enable debugging: export DEB_BUILD_OPTIONS="debug profiling compression urldebug iodbg clang" ifneq (,$(findstring clang,$(DEB_BUILD_OPTIONS))) @@ -51,7 +52,7 @@ endif ifneq "$(wildcard /usr/share/misc/config.guess)" "" cp -f /usr/share/misc/config.guess config.guess endif - CC=$(COMPILER) CFLAGS="$(CFLAGS)" ./configure \ + CC=$(COMPILER) CFLAGS=" -Wformat -Werror=format-security $(CFLAGS)" ./configure \ --host=$(DEB_HOST_GNU_TYPE) \ --build=$(DEB_BUILD_GNU_TYPE) \ --prefix=/usr/sbin/ \ diff --git a/webcit/subst.c b/webcit/subst.c index dce5de896..8f9060769 100644 --- a/webcit/subst.c +++ b/webcit/subst.c @@ -256,7 +256,7 @@ void LogError (StrBuf *Target, const char *Type, const char *Format, ...) StrBufVAppendPrintf(Error, Format, arg_ptr); va_end(arg_ptr); - syslog(1, ChrPtr(Error)); + syslog(1, "%s", ChrPtr(Error)); WCC = WC; if (WCC->WFBuf == NULL) WCC->WFBuf = NewStrBuf(); @@ -2629,7 +2629,7 @@ void dbg_print_longvector(long *LongVector) StrBufAppendPrintf(Buf, "%d: %ld]\n", i, LongVector[i]); } - syslog(1, ChrPtr(Buf)); + syslog(1, "%s", ChrPtr(Buf)); FreeStrBuf(&Buf); } -- 2.30.2