From owner-freebsd-gnome@FreeBSD.ORG Fri Jan 9 08:36:31 2004 Return-Path: Delivered-To: freebsd-gnome@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B968916A4CE for ; Fri, 9 Jan 2004 08:36:31 -0800 (PST) Received: from smtp105.mail.sc5.yahoo.com (smtp105.mail.sc5.yahoo.com [66.163.169.225]) by mx1.FreeBSD.org (Postfix) with SMTP id AC8FE43D2F for ; Fri, 9 Jan 2004 08:36:24 -0800 (PST) (envelope-from kaeru@pd.jaring.my) Received: from unknown (HELO ?219.95.34.186?) (khairil?yusof@219.95.34.186 with plain) by smtp105.mail.sc5.yahoo.com with SMTP; 9 Jan 2004 16:36:23 -0000 From: Khairil Yusof To: gnome@freebsd.org Content-Type: text/plain Message-Id: <1073666176.95211.7.camel@wolverine.home.net> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.5.1FreeBSD GNOME Team Port Date: Sat, 10 Jan 2004 00:36:17 +0800 Content-Transfer-Encoding: 7bit Subject: Patch for spamassasin filter for evo 1.5.1 X-BeenThere: freebsd-gnome@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: GNOME for FreeBSD -- porting and maintaining List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Jan 2004 16:36:31 -0000 sh command strings for evo's spamassassin junk filter, are not quoted, which breaks the junk filter. This patch tries to quote the complete command string, allowing the commands to run properly. I'm not a C programmer, so please check, to see if I did anything wrong or whether it can be improved. I've tested that it compiles and runs, and it 'seems' to be working so far. If it looks ok, I'll file the bug and patch at ximian's bugzilla. Thanks to marcus for pointing me to the source file, that's causing the problems. -- snip --- --- mail/em-junk-filter.c.orig Thu Nov 13 19:33:26 2003 +++ mail/em-junk-filter.c Fri Jan 9 15:49:44 2004 @@ -189,7 +189,7 @@ static gchar *args [3] = { "/bin/sh", "-c", - "spamassassin --version" + "'spamassassin --version'" /* quoted command string */ }; if (pipe_to_sa (NULL, NULL, 3, args)) @@ -225,7 +225,7 @@ for (i = 0; i < NPORTS; i ++) { d(fprintf (stderr, "trying to run spamd at port %d\n", port)); - sad_args [2] = g_strdup_printf ("spamd --port %d --local -- daemonize", port); + sad_args [2] = g_strdup_printf ("'spamd --port %d --local -- daemonize'", port); /* quote command string */ if (!pipe_to_sa (NULL, NULL, 3, sad_args)) { g_free (sad_args [2]); em_junk_sa_use_spamc = TRUE; @@ -274,15 +274,17 @@ ? (em_junk_sa_spamd_port == -1 ? g_strdup ("spamc -c") /* Exit with a non-zero exit code if the tested message was junk */ - : g_strdup_printf ("spamc" + : g_strdup_printf ("'" + "spamc" " -c" /* Exit with a non-zero exit code if the tested message was junk */ " -p %d", em_junk_sa_spamd_port)) : g_strdup ("spamassassin" " --exit-code" /* Exit with a non-zero exit code if the tested message was junk */ - " --local"); /* Local tests only (no online tests) */ - + " --local" /* Local tests only (no online tests) */ + "'" + ); retval = pipe_to_sa (msg, NULL, 3, args); g_free (args [2]); @@ -296,11 +298,13 @@ static gchar *args [3] = { "/bin/sh", "-c", + "'" /* begin quote */ "sa-learn" " --no-rebuild" /* do not rebuild db */ " --spam" /* report junk */ " --single" /* single message */ " --local" /* local only */ + "'" /* end quote */ }; d(fprintf (stderr, "em_junk_sa_report_junk\n")); @@ -315,11 +319,13 @@ static gchar *args [3] = { "/bin/sh", "-c", + "'" /* begin quote */ "sa-learn" " --no-rebuild" /* do not rebuild db */ " --ham" /* report notjunk */ " --single" /* single message */ " --local" /* local only */ + "'" /* end quote */ }; d(fprintf (stderr, "em_junk_sa_report_notjunk\n")); @@ -334,9 +340,11 @@ static gchar *args [3] = { "/bin/sh", "-c", + "'" /* begin quote */ "sa-learn" " --rebuild" /* do not rebuild db */ " --local" /* local only */ + "'" /* end quote */ }; d(fprintf (stderr, "em_junk_sa_commit_reports\n");)