From patchwork Mon Apr 21 20:16:02 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bob Hockney X-Patchwork-Id: 340862 X-Patchwork-Delegate: regit@netfilter.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 145DA1401A6 for ; Tue, 22 Apr 2014 11:05:01 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753499AbaDUUYg (ORCPT ); Mon, 21 Apr 2014 16:24:36 -0400 Received: from elasmtp-masked.atl.sa.earthlink.net ([209.86.89.68]:39448 "EHLO elasmtp-masked.atl.sa.earthlink.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750891AbaDUUYg (ORCPT ); Mon, 21 Apr 2014 16:24:36 -0400 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=dk20050327; d=ix.netcom.com; b=mmBIZ4qnq9rGPh/r4a03z9RatItkzPxKT+Pp85zawhPtSIY8ISszngSvDJp1VVrQ; h=Received:Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject:Content-Type:Content-Transfer-Encoding:X-ELNK-Trace:X-Originating-IP; Received: from [24.49.174.127] (helo=server.ford-prefect.net) by elasmtp-masked.atl.sa.earthlink.net with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.67) (envelope-from ) id 1WcKdJ-0006hp-Oh; Mon, 21 Apr 2014 16:16:06 -0400 Message-ID: <53557C82.5030100@ix.netcom.com> Date: Mon, 21 Apr 2014 14:16:02 -0600 From: Bob Hockney User-Agent: Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 MIME-Version: 1.0 To: Eric Leblond CC: The netfilter developer mailinglist Subject: [ ulogd PATCH 2/2 ] fix to allow not using connstring parameter in pgsql plugin X-ELNK-Trace: 715d3caeb3cea72a705cf63f4d61a1ddd6ede3902bc99f8e270d2cd8668e3be13ae2213b9c739e35350badd9bab72f9c350badd9bab72f9c350badd9bab72f9c X-Originating-IP: 24.49.174.127 Sender: netfilter-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netfilter-devel@vger.kernel.org commit a565216f3f772514356a067d68b775331b01832a Author: Bob Hockney Date: Sat Apr 19 12:43:37 2014 -0600 Connection parameters other than connstring are ignored, forcing its use. u.string in config_keyset in conffile.h is a character array, not a pointer, and is initialized as a zero length string, not a null pointer, so the pointer assignment to connstr will always be a valid pointer, not NULL, so (! connstr) will always be false. Signed-off-by: Bob Hockney --- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/output/pgsql/ulogd_output_PGSQL.c b/output/pgsql/ulogd_output_PGSQL.c index fda289e..ac87a64 100644 --- a/output/pgsql/ulogd_output_PGSQL.c +++ b/output/pgsql/ulogd_output_PGSQL.c @@ -236,7 +236,7 @@ static int open_db_pgsql(struct ulogd_pluginstance *upi) char *schema = NULL; char pgbuf[128]; - if (!connstr) { + if (! strlen(connstr)) { char *server = host_ce(upi->config_kset).u.string; unsigned int port = port_ce(upi->config_kset).u.value; char *user = user_ce(upi->config_kset).u.string;