fix source so that '-Wformat -Werror=format-security' doesn't stop us from compiling
authorWilfried Goesgens <dothebart@citadel.org>
Thu, 12 May 2011 20:18:03 +0000 (20:18 +0000)
committerWilfried Goesgens <dothebart@citadel.org>
Thu, 12 May 2011 20:52:25 +0000 (20:52 +0000)
12 files changed:
citadel/debian/rules
citadel/ecrash.c
citadel/modules/extnotify/funambol65.c
citadel/modules/managesieve/serv_managesieve.c
citadel/modules/network/serv_network.c
citadel/serv_extensions.c
citadel/utillib/citadel_ipc.c
citadel/utils/sendcommand.c
libcitadel/debian/rules
webcit/debian/po/templates.pot
webcit/debian/rules
webcit/subst.c

index d1b3731e6fd10c58be722beeb73a445d0802c088..3193f092829e41179d8132316d38c3bbc669c99f 100755 (executable)
@@ -11,7 +11,7 @@ export DH_OPTIONS
 
 DEB_DESTDIR = $(CURDIR)/debian/tmp
 
-CFLAGS = -Wall -g
+CFLAGS = -Wall -g -Werror=format-security 
 
 
 EXTRA_ARGS=
index b03e2fe10545fdc709651eb400c1483062f008bd..30fcfcdad2b42f64f916bf93f5d3e5660c2a8dcd 100644 (file)
@@ -185,8 +185,7 @@ static void outputPrintf(char *format, ...)
 
        va_start(ap, format);
 
-       snprintf (StaticBuf, SIZ, format, ap);
-       syslog( LOG_CRIT|LOG_NDELAY|LOG_MAIL, StaticBuf);
+       vsyslog(LOG_CRIT|LOG_NDELAY|LOG_MAIL, format, ap);
 } // outputPrintf
 
 
@@ -204,16 +203,12 @@ static void createGlobalBacktrace( void )
        size = backtrace(stack_frames, sizeof(stack_frames) / sizeof(void*));
        for (NThread = 0; NThread < size; NThread++) 
        {
-               snprintf (StaticBuf, SIZ, "RAW: %p  ", stack_frames[NThread]);
-               syslog( LOG_CRIT|LOG_NDELAY|LOG_MAIL, StaticBuf);
+               syslog(LOG_CRIT|LOG_NDELAY|LOG_MAIL, "RAW: %p  ", stack_frames[NThread]);
        }
-       
        strings = backtrace_symbols(stack_frames, size);
        for (NThread = 0; NThread < size; NThread++) {
                if (strings != NULL) {
-                       // vsyslogs printf compliance sucks.
-                       snprintf (StaticBuf, SIZ, "RAW: %p  ", strings[NThread]);
-                       syslog( LOG_CRIT|LOG_NDELAY|LOG_MAIL, StaticBuf);
+                       syslog(LOG_CRIT|LOG_NDELAY|LOG_MAIL, "RAW: %p  ", strings[NThread]);
                }
        }
 } /* createGlobalBacktrace */
@@ -223,8 +218,7 @@ static void outputRawtrace( void )
        size = backtrace(stack_frames, sizeof(stack_frames) / sizeof(void*));
        for (NThread = 0; NThread < size; NThread++) 
        {
-               snprintf (StaticBuf, SIZ, "RAW: %p  ", stack_frames[NThread]);
-               syslog( LOG_CRIT|LOG_NDELAY|LOG_MAIL, StaticBuf);
+               syslog(LOG_CRIT|LOG_NDELAY|LOG_MAIL, "RAW: %p  ", stack_frames[NThread]);
        }
 } /* createGlobalBacktrace */
 
index 4985700adc7055b63e1a68969e6ca8abbad6f099..8f4c14a42eecb18ad48e682e9c631e0316316c1e 100644 (file)
@@ -128,7 +128,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 free;
@@ -153,7 +153,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 free;
index 965cff9648d71169db9c7a0f862f091365d4f991..680f26d89fdf802d6f9b4ab53620427573f9e80e 100644 (file)
@@ -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]);
index b9476f5bb80920f16dfa6eff88f9d76f497fba34..90bdd6904d09d1d2b5159cefdd2ec2dfae36a215 100644 (file)
@@ -2439,7 +2439,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;
@@ -2450,7 +2450,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;
index a94239573bb64c44585c768e16eae976a24510f2..33c83f73887f9003c19a288aa036daf88884e5a1 100644 (file)
@@ -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;
index fb90f33d0c80f69966e62c8c2efc3588ba2c67a5..52da9167e10a1d34860421f3fc05247e0b5a9b14 100644 (file)
@@ -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");
index c259a5b685e44d7eb327bee0aa19eeda85c3a400..52d05258da58e69da24eb60a8f285ea842e9d2e6 100644 (file)
@@ -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);
                                }
                        }
index 36f994c38aee7f24003e942520a9891957a9d714..5a280ac159c75a19636b12daa15aed91d3b3699c 100755 (executable)
@@ -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
index 28a4d829dccb0756d78403006c6ea47f43159c1f..bca6d4290592307348b275db5777408529b6c4f0 100644 (file)
@@ -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 <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\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
index f97e5d04ebb25b4f843cd43fe856a8315b67aec4..2631d682c5347b9b8d8a0869b5f3c088d7d87f6e 100755 (executable)
@@ -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/ \
index dce5de89671ca107231b52381851085c20dd71a6..8f906076950f20b3ced933f30a498a4855b6e19f 100644 (file)
@@ -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);
 }