From dan@bast.unixathome.org  Thu Aug 16 18:36:58 2007
Return-Path: <dan@bast.unixathome.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E089716A417
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 16 Aug 2007 18:36:58 +0000 (UTC)
	(envelope-from dan@bast.unixathome.org)
Received: from supernews.unixathome.org (supernews.unixathome.org [216.168.29.4])
	by mx1.freebsd.org (Postfix) with ESMTP id C397B13C4B6
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 16 Aug 2007 18:36:58 +0000 (UTC)
	(envelope-from dan@bast.unixathome.org)
Received: from localhost (localhost [127.0.0.1])
	by supernews.unixathome.org (Postfix) with ESMTP id 530E81703B
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 16 Aug 2007 14:36:58 -0400 (EDT)
Received: from supernews.unixathome.org ([127.0.0.1])
	by localhost (supernews.unixathome.org [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id 8-azKnqzMeYb for <FreeBSD-gnats-submit@freebsd.org>;
	Thu, 16 Aug 2007 14:36:56 -0400 (EDT)
Received: from bast.unixathome.org (bast.unixathome.org [76.110.86.209])
	by supernews.unixathome.org (Postfix) with ESMTP id 598081703A
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 16 Aug 2007 14:36:56 -0400 (EDT)
Received: by bast.unixathome.org (Postfix, from userid 1001)
	id E0158B92C; Thu, 16 Aug 2007 14:36:55 -0400 (EDT)
Message-Id: <20070816183655.E0158B92C@bast.unixathome.org>
Date: Thu, 16 Aug 2007 14:36:55 -0400 (EDT)
From: Dan Langille <dan@langille.org>
Reply-To: Dan Langille <dan@langille.org>
To: FreeBSD-gnats-submit@freebsd.org
Cc: Dan Langille <dan@langille.org>
Subject: [MAINTAINER-UPDATE] sysutils/bacula-server - repair PID
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         115582
>Category:       ports
>Synopsis:       [MAINTAINER-UPDATE] sysutils/bacula-server - repair PID
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          maintainer-update
>Submitter-Id:   current-users
>Arrival-Date:   Thu Aug 16 18:40:02 GMT 2007
>Closed-Date:    Thu Aug 16 20:38:02 GMT 2007
>Last-Modified:  Thu Aug 16 20:40:02 GMT 2007
>Originator:     Dan Langille
>Release:        FreeBSD 6.2-STABLE i386
>Organization:
The FreeBSD Diary
>Environment:
System: FreeBSD bast.example.org 6.2-STABLE FreeBSD 6.2-STABLE #3: Wed Feb 28 22:21:12 EST 2007     dan@bast.example.org:/usr/obj/usr/src/sys/BAST  i386


	
>Description:
	
The code has a PID/priv issue.  See bug # 932 at http://bugs.bacula.org/
In short, it was dropping privs before setting PID. 
Patch the code locally to get FreeBSD users running.
While here, if PostgreSQL is not installed, ask for 8.2, not the default of 8.1.

>How-To-Repeat:
	
>Fix:

	



--- patch.bacula.diff begins here ---
diff -ruN /usr/ports/sysutils/bacula-server/Makefile bacula-server/Makefile
--- /usr/ports/sysutils/bacula-server/Makefile	Wed Aug 15 05:45:33 2007
+++ bacula-server/Makefile	Thu Aug 16 14:33:08 2007
@@ -7,6 +7,7 @@
 
 PORTNAME=	bacula
 DISTVERSION=	2.2.0
+PORTREVISION	1
 CATEGORIES=	sysutils
 MASTER_SITES=	${MASTER_SITE_SOURCEFORGE}
 MASTER_SITE_SUBDIR=	bacula
@@ -140,6 +141,7 @@
 DBTYPE=			mysql
 SUB_LIST+=		REQ_MYSQL=mysql REQ_PGSQL=""
 .elif defined(WITH_POSTGRESQL)
+DEFAULT_PGSQL_VER?=	82
 USE_PGSQL=		yes
 CONFIGURE_ARGS+=	--with-postgresql=yes
 DBTYPE=			postgresql
diff -ruN /usr/ports/sysutils/bacula-server/files/patch-src-dird-dird.c bacula-server/files/patch-src-dird-dird.c
--- /usr/ports/sysutils/bacula-server/files/patch-src-dird-dird.c	Wed Dec 31 19:00:00 1969
+++ bacula-server/files/patch-src-dird-dird.c	Thu Aug 16 14:25:40 2007
@@ -0,0 +1,33 @@
+--- src/dird/dird.c	2007-06-07 10:46:43.000000000 -0400
++++ src/dird/dird.c	2007-08-16 08:58:20.000000000 -0400
+@@ -228,6 +228,15 @@
+       Jmsg((JCR *)NULL, M_ERROR_TERM, 0, _("Please correct configuration file: %s\n"), configfile);
+    }
+ 
++   if (background) {
++      daemon_start();
++      init_stack_dump();              /* grab new pid */
++   }
++
++   /* Create pid must come after we are a daemon -- so we have our final pid */
++   create_pid_file(director->pid_directory, "bacula-dir", get_first_port_host_order(director->DIRaddrs));
++   read_state_file(director->working_directory, "bacula-dir", get_first_port_host_order(director->DIRaddrs));
++
+    drop(uid, gid);                    /* reduce privileges if requested */
+ 
+    if (!check_catalog()) {
+@@ -247,14 +256,6 @@
+    FDConnectTimeout = (int)director->FDConnectTimeout;
+    SDConnectTimeout = (int)director->SDConnectTimeout;
+ 
+-   if (background) {
+-      daemon_start();
+-      init_stack_dump();              /* grab new pid */
+-   }
+-
+-   /* Create pid must come after we are a daemon -- so we have our final pid */
+-   create_pid_file(director->pid_directory, "bacula-dir", get_first_port_host_order(director->DIRaddrs));
+-   read_state_file(director->working_directory, "bacula-dir", get_first_port_host_order(director->DIRaddrs));
+ 
+ 
+ #if !defined(HAVE_WIN32)
--- patch.bacula.diff ends here ---

>Release-Note:
>Audit-Trail:

From: "Dan Langille" <dan@langille.org>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/115582: [MAINTAINER-UPDATE] sysutils/bacula-server - repair PID
Date: Thu, 16 Aug 2007 14:53:20 -0400

 Sorry, that should be bug 923

From: "Dan Langille" <dan@langille.org>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/115582: [MAINTAINER-UPDATE] sysutils/bacula-server - repair PID
Date: Thu, 16 Aug 2007 15:33:19 -0400

 BTW, files/eotmodel-src-stored-dev.c.patch can be removed as the 
 issue has been fixed upstream.
 
 confirmed this with the original eotmodel-src-stored-dev.c.patch 
 submitter, nox.

From: "Dan Langille" <dan@langille.org>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/115582: [MAINTAINER-UPDATE] sysutils/bacula-server - repair PID
Date: Thu, 16 Aug 2007 16:09:37 -0400

 Please use this Description:
 
 The code has a PID/priv issue. See bug # 932 at 
 http://bugs.bacula.org/
 In short, it was dropping privs before setting PID.
 Patch the code locally to get FreeBSD users running.
 While here, if PostgreSQL is not installed, ask for 8.2, not the 
 default of 8.1.
 Remove EOT model patch, now in vendor code.
 Update pkg-message to reflect new version.
 
 Please use this patch instead:
 
 diff -ruN /usr/ports/sysutils/bacula-server/Makefile bacula-
 server/Makefile
 --- /usr/ports/sysutils/bacula-server/Makefile	Wed Aug 15 05:45:33 
 2007
 +++ bacula-server/Makefile	Thu Aug 16 14:33:08 2007
 @@ -7,6 +7,7 @@
  
  PORTNAME=	bacula
  DISTVERSION=	2.2.0
 +PORTREVISION	1
  CATEGORIES=	sysutils
  MASTER_SITES=	${MASTER_SITE_SOURCEFORGE}
  MASTER_SITE_SUBDIR=	bacula
 @@ -140,6 +141,7 @@
  DBTYPE=			mysql
  SUB_LIST+=		REQ_MYSQL=mysql REQ_PGSQL=""
  .elif defined(WITH_POSTGRESQL)
 +DEFAULT_PGSQL_VER?=	82
  USE_PGSQL=		yes
  CONFIGURE_ARGS+=	--with-postgresql=yes
  DBTYPE=			postgresql
 diff -ruN /usr/ports/sysutils/bacula-server/files/eotmodel-src-stored-
 dev.c.patch bacula-server/files/eotmodel-src-stored-dev.c.patch
 --- /usr/ports/sysutils/bacula-server/files/eotmodel-src-stored-
 dev.c.patch	Wed Mar  7 16:57:47 2007
 +++ bacula-server/files/eotmodel-src-stored-dev.c.patch	Wed Dec 31 
 19:00:00 1969
 @@ -1,10 +0,0 @@
 -Index: src/stored/dev.c
 -@@ -2368,7 +2368,7 @@
 -       }
 -    }
 - /* Turn this on later when fully tested */
 --#if defined(xxxMTIOCSETEOTMODEL) 
 -+#if defined(MTIOCSETEOTMODEL) 
 -    uint32_t neof;
 -    if (dev->has_cap(CAP_TWOEOF)) {
 -       neof = 2;
 diff -ruN /usr/ports/sysutils/bacula-server/files/patch-src-dird-
 dird.c bacula-server/files/patch-src-dird-dird.c
 --- /usr/ports/sysutils/bacula-server/files/patch-src-dird-dird.c	Wed 
 Dec 31 19:00:00 1969
 +++ bacula-server/files/patch-src-dird-dird.c	Thu Aug 16 14:25:40 
 2007
 @@ -0,0 +1,33 @@
 +--- src/dird/dird.c	2007-06-07 10:46:43.000000000 -0400
 ++++ src/dird/dird.c	2007-08-16 08:58:20.000000000 -0400
 +@@ -228,6 +228,15 @@
 +       Jmsg((JCR *)NULL, M_ERROR_TERM, 0, _("Please correct 
 configuration file: %s\n"), configfile);
 +    }
 + 
 ++   if (background) {
 ++      daemon_start();
 ++      init_stack_dump();              /* grab new pid */
 ++   }
 ++
 ++   /* Create pid must come after we are a daemon -- so we have our 
 final pid */
 ++   create_pid_file(director->pid_directory, "bacula-dir", 
 get_first_port_host_order(director->DIRaddrs));
 ++   read_state_file(director->working_directory, "bacula-dir", 
 get_first_port_host_order(director->DIRaddrs));
 ++
 +    drop(uid, gid);                    /* reduce privileges if 
 requested */
 + 
 +    if (!check_catalog()) {
 +@@ -247,14 +256,6 @@
 +    FDConnectTimeout = (int)director->FDConnectTimeout;
 +    SDConnectTimeout = (int)director->SDConnectTimeout;
 + 
 +-   if (background) {
 +-      daemon_start();
 +-      init_stack_dump();              /* grab new pid */
 +-   }
 +-
 +-   /* Create pid must come after we are a daemon -- so we have our 
 final pid */
 +-   create_pid_file(director->pid_directory, "bacula-dir", 
 get_first_port_host_order(director->DIRaddrs));
 +-   read_state_file(director->working_directory, "bacula-dir", 
 get_first_port_host_order(director->DIRaddrs));
 + 
 + 
 + #if !defined(HAVE_WIN32)
 diff -ruN /usr/ports/sysutils/bacula-server/files/pkg-
 message.client.in bacula-server/files/pkg-message.client.in
 --- /usr/ports/sysutils/bacula-server/files/pkg-message.client.in	Wed 
 Mar  7 16:57:47 2007
 +++ bacula-server/files/pkg-message.client.in	Thu Aug 16 16:08:48 
 2007
 @@ -10,14 +10,4 @@
  
    as installed by docs port for the upgrade procedure.
  
 -IMPORTANT UPGRADE NOTES:
 -
 -- A database upgrade is required.
 -- Your Director and SD must be simultaneously upgraded.
 -- The "Accept Any Volume" directive has been removed.
 -
 -- Lots of new features
 -
 -Read the ReleaseNotes for further information.
 -
  
 ######################################################################
 ##########
 diff -ruN /usr/ports/sysutils/bacula-server/files/pkg-
 message.server.in bacula-server/files/pkg-message.server.in
 --- /usr/ports/sysutils/bacula-server/files/pkg-message.server.in	Wed 
 Mar  7 16:57:47 2007
 +++ bacula-server/files/pkg-message.server.in	Thu Aug 16 16:01:03 
 2007
 @@ -55,11 +55,7 @@
  
  IMPORTANT UPGRADE NOTES FOR THIS RELEASE:
  
 -- A database upgrade is required.
 -- Your Director and SD must be simultaneously upgraded.
 -- The "Accept Any Volume" directive has been removed.
 -
 -- Lots of new features
 +- bacula-client and bacula-server do not need to be simultaneously 
 upgraded.
  
  Read the ReleaseNotes for further information.
  
 

From: "Dan Langille" <dan@langille.org>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/115582: [MAINTAINER-UPDATE] sysutils/bacula-server - repair PID
Date: Thu, 16 Aug 2007 16:18:36 -0400

 +PORTREVISION	1
 
 I'm sorry, that should be 
 
 +PORTREVISION=	1
State-Changed-From-To: open->closed 
State-Changed-By: itetcu 
State-Changed-When: Thu Aug 16 20:38:00 UTC 2007 
State-Changed-Why:  
Committed. Thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=115582 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/115582: commit references a PR
Date: Thu, 16 Aug 2007 20:37:48 +0000 (UTC)

 itetcu      2007-08-16 20:37:40 UTC
 
   FreeBSD ports repository
 
   Modified files:
     sysutils/bacula-server Makefile 
     sysutils/bacula-server/files pkg-message.client.in 
                                  pkg-message.server.in 
   Added files:
     sysutils/bacula-server/files patch-src-dird-dird.c 
   Removed files:
     sysutils/bacula-server/files eotmodel-src-stored-dev.c.patch 
   Log:
   - The code had a PID/priv issue. See bug # 932 at  http://bugs.bacula.org/
   In short, it was dropping privs before setting PID. Patch the code locally to
   get FreeBSD users running.
   - While here, if PostgreSQL is not installed, ask for 8.2, not the default of
   8.1.
   - Remove EOT model patch, now in vendor code.
   - Update pkg-message to reflect new version.
   
   PR:             115582
   Submitted by:   Dan Langille (maintainer)
   
   Revision  Changes    Path
   1.90      +2 -0      ports/sysutils/bacula-server/Makefile
   1.2       +0 -10     ports/sysutils/bacula-server/files/eotmodel-src-stored-dev.c.patch (dead)
   1.1       +33 -0     ports/sysutils/bacula-server/files/patch-src-dird-dird.c (new)
   1.2       +0 -8      ports/sysutils/bacula-server/files/pkg-message.client.in
   1.2       +2 -5      ports/sysutils/bacula-server/files/pkg-message.server.in
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
>Unformatted:
