Date: Sat, 2 Jun 2007 12:30:13 GMT From: Simun Mikecin <numisemis@yahoo.com> To: freebsd-ports-bugs@FreeBSD.org Subject: Re: ports/113235: [patch] dns/maradns problem with startup during boot Message-ID: <200706021230.l52CUDiT090238@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR ports/113235; it has been noted by GNATS. From: Simun Mikecin <numisemis@yahoo.com> To: Alex Kapranoff <alex@kapranoff.ru> Cc: bug-followup@FreeBSD.org Subject: Re: ports/113235: [patch] dns/maradns problem with startup during boot Date: Sat, 2 Jun 2007 04:58:45 -0700 (PDT) --0-504501549-1180785525=:70425 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Content-Id: Content-Disposition: inline Here is a patch that should solve all the mentioned problems. - changed duende source to create PID file by itself - maradns.sh and zoneserver.sh now use PID file - changed default MaraDNS UID from 99 to bind(53) - changed default maraDNS GID from 99 to bind(53) - changed default duende logger process UID from 66 to nobody(65534) ____________________________________________________________________________________ Be a better Globetrotter. Get better travel answers from someone who knows. Yahoo! Answers - Check it out. http://answers.yahoo.com/dir/?link=list&sid=396545469 --0-504501549-1180785525=:70425 Content-Type: text/plain; name="maradns-diff2.txt" Content-Description: 2334080097-maradns-diff2.txt Content-Disposition: inline; filename="maradns-diff2.txt" diff -urN maradns.old/Makefile maradns/Makefile --- maradns.old/Makefile Sat May 26 00:11:42 2007 +++ maradns/Makefile Sat Jun 2 13:42:52 2007 @@ -7,6 +7,7 @@ PORTNAME= maradns PORTVERSION= 1.2.12.06 +PORTREVISION= 1 CATEGORIES= dns MASTER_SITES= http://www.maradns.org/download/1.2/${PORTVERSION}/ \ http://kapranoff.ru/~kappa/files/ @@ -57,6 +58,7 @@ ${MKDIR} ${PREFIX}/etc/maradns ${INSTALL_DATA} ${WRKSRC}/doc/en/examples/example_csv2 \ ${PREFIX}/etc/maradns/example_csv2 + ${MKDIR} ${PREFIX}/etc/maradns/logger @${SED} ${RC_SCRIPTS_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \ '-e s!%%SERVICE%%!maradns!g' \ ${FILESDIR}/rc_d.sh > ${PREFIX}/etc/rc.d/maradns.sh diff -urN maradns.old/files/patch-MaraDns.h maradns/files/patch-MaraDns.h --- maradns.old/files/patch-MaraDns.h Thu Jan 1 01:00:00 1970 +++ maradns/files/patch-MaraDns.h Sat Jun 2 13:47:33 2007 @@ -0,0 +1,22 @@ +--- MaraDns.h.orig Sat Jun 2 13:46:12 2007 ++++ MaraDns.h Sat Jun 2 13:47:12 2007 +@@ -75,16 +75,16 @@ + line to point to Bash + */ + +-#define MARADNS_DEFAULT_UID 99 ++#define MARADNS_DEFAULT_UID 53 + + /* The default GID (Group ID) that MaraDNS has; see the default UID notes + above. Again: CHANGE THE MARARC MAN PAGE IF YOU CHANGE THIS VALUE */ +-#define MARADNS_DEFAULT_GID 99 ++#define MARADNS_DEFAULT_GID 53 + + /* The UID that the Duende logging process uses. CHANGE THE DUENDE MAN + PAGE IF YOU CHANGE THIS VALUE (same general process as changing the + mararc man page; the source file for the duende man page is duende.ej) */ +-#define DUENDE_LOGGER_UID 66 ++#define DUENDE_LOGGER_UID 65534 + + /* The directory that Duende runs in. This directory has to exist for + Duende to be able to run. Again, IF YOU CHANGE THIS, CHANGE THE diff -urN maradns.old/files/patch-tools_Makefile maradns/files/patch-tools_Makefile --- maradns.old/files/patch-tools_Makefile Thu Jan 1 01:00:00 1970 +++ maradns/files/patch-tools_Makefile Sat Jun 2 13:38:29 2007 @@ -0,0 +1,11 @@ +--- tools/Makefile.orig Sat Jun 2 13:33:56 2007 ++++ tools/Makefile Sat Jun 2 13:38:09 2007 +@@ -27,7 +27,7 @@ + $(CC) $(FLAGS) -o benchmark benchmark.c $(OBJECTS) $(POBJECTS) + + duende: duende.c +- $(CC) $(FLAGS) -o duende duende.c ++ $(CC) $(FLAGS) -o duende duende.c -lutil + + strip.control: strip.control.c + $(CC) $(FLAGS) -o strip.control strip.control.c diff -urN maradns.old/files/patch-tools_duende.c maradns/files/patch-tools_duende.c --- maradns.old/files/patch-tools_duende.c Thu Jan 1 01:00:00 1970 +++ maradns/files/patch-tools_duende.c Sat Jun 2 13:41:25 2007 @@ -0,0 +1,52 @@ +--- tools/duende.c.orig Sat Jun 2 13:40:35 2007 ++++ tools/duende.c Sat Jun 2 13:41:01 2007 +@@ -35,10 +35,13 @@ + #include <signal.h> + #include <stdio.h> + #include <stdlib.h> ++#include <string.h> + #include <syslog.h> ++#include <sys/param.h> + #include <sys/time.h> + #include <sys/types.h> + #include <sys/wait.h> ++#include <libutil.h> + #include <unistd.h> + #include "../MaraDns.h" + +@@ -139,6 +142,9 @@ + int exit_status; + pid_t pid, log_pid; + int stream1[2]; /* Used for piping */ ++ struct pidfh *pfh; ++ char *name; ++ char *pidfile; + if(argv[0] == NULL || argv[1] == NULL) { + printf("Usage: duende [program] [arguments]\n"); + exit(1); +@@ -202,7 +208,24 @@ + log_helper(argv[1],stream1[0]); + syslog(LOG_ALERT,"log_helper finished, terminating\n"); + exit(1); +- } ++ } ++ ++ name = strrchr(argv[1], '/'); ++ if (name && *name != '\0') { ++ pidfile = malloc(strlen("/var/run/") + strlen(name) + strlen(".pid") + 1); ++ if (pidfile) { ++ strcpy(pidfile, "/var/run/"); ++ strcat(pidfile, name); ++ strcat(pidfile, ".pid"); ++ remove(pidfile); ++ pfh = pidfile_open(pidfile, 0600, &pid); ++ if (pfh) { ++ pidfile_write(pfh); ++ pidfile_close(pfh); ++ } ++ free(pidfile); ++ } ++ } + for(;;) { + /* If we got a HUP signal, send it to the child */ + if(got_hup_signal == 1) { diff -urN maradns.old/files/rc_d.sh maradns/files/rc_d.sh --- maradns.old/files/rc_d.sh Mon Feb 20 21:46:57 2006 +++ maradns/files/rc_d.sh Sat Jun 2 13:14:49 2007 @@ -28,11 +28,11 @@ name="%%SERVICE%%" rcvar=`set_rcvar` -command="${prefix}/sbin/${name}" -command_args="| /usr/bin/logger -p daemon.notice -t %%SERVICE%% &" +command="${prefix}/bin/duende" +pidfile="/var/run/${name}.pid" load_rc_config $name -flags="${%%SERVICE%%_flags}" +flags="${prefix}/sbin/${name} ${%%SERVICE%%_flags}" run_rc_command "$1" diff -urN maradns.old/pkg-plist maradns/pkg-plist --- maradns.old/pkg-plist Thu Dec 14 14:45:02 2006 +++ maradns/pkg-plist Fri Jun 1 21:51:52 2007 @@ -7,6 +7,7 @@ etc/rc.d/maradns.sh etc/rc.d/zoneserver.sh etc/maradns/example_csv2 +@dirrmtry etc/maradns/logger @dirrmtry etc/maradns sbin/maradns sbin/zoneserver --0-504501549-1180785525=:70425--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200706021230.l52CUDiT090238>