pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/security/prelude-lml Modify run-prelude-lml to properl...
details: https://anonhg.NetBSD.org/pkgsrc/rev/b9a29d277b1b
branches: trunk
changeset: 513343:b9a29d277b1b
user: shannonjr <shannonjr%pkgsrc.org@localhost>
date: Fri May 26 11:25:22 2006 +0000
description:
Modify run-prelude-lml to properly start prelude-lml as daemon. This works
around a problem where prelude-lml is not connecting to prelude-manager
when passed the -d command line argument.
diffstat:
security/prelude-lml/Makefile | 3 ++-
security/prelude-lml/files/preludelml.sh | 4 ++--
security/prelude-lml/files/run-prelude-lml.c | 21 ++++++++++++++++++---
3 files changed, 22 insertions(+), 6 deletions(-)
diffs (85 lines):
diff -r b77cb83754e7 -r b9a29d277b1b security/prelude-lml/Makefile
--- a/security/prelude-lml/Makefile Fri May 26 10:11:22 2006 +0000
+++ b/security/prelude-lml/Makefile Fri May 26 11:25:22 2006 +0000
@@ -1,7 +1,8 @@
-# $NetBSD: Makefile,v 1.10 2006/05/22 11:49:51 shannonjr Exp $
+# $NetBSD: Makefile,v 1.11 2006/05/26 11:25:22 shannonjr Exp $
#
DISTNAME= prelude-lml-0.9.5
+PKGREVISION= 1
CATEGORIES= security
MASTER_SITES= http://www.prelude-ids.org/download/releases/
diff -r b77cb83754e7 -r b9a29d277b1b security/prelude-lml/files/preludelml.sh
--- a/security/prelude-lml/files/preludelml.sh Fri May 26 10:11:22 2006 +0000
+++ b/security/prelude-lml/files/preludelml.sh Fri May 26 11:25:22 2006 +0000
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# $NetBSD: preludelml.sh,v 1.3 2006/01/31 18:25:43 shannonjr Exp $
+# $NetBSD: preludelml.sh,v 1.4 2006/05/26 11:25:22 shannonjr Exp $
#
# PROVIDE: preludelml
@@ -13,7 +13,7 @@
rcvar=${name}
required_files="@PKG_SYSCONFDIR@/prelude-lml/prelude-lml.conf"
start_precmd="preludelml_precommand"
-start_cmd="@PREFIX@/sbin/run-prelude-lml -d --pidfile @PRELUDE_LML_PID_DIR@/prelude-lml.pid"
+start_cmd="@PREFIX@/sbin/run-prelude-lml --pidfile @PRELUDE_LML_PID_DIR@/prelude-lml.pid"
pidfile="@PRELUDE_LML_PID_DIR@/prelude-lml.pid"
preludelml_precommand()
diff -r b77cb83754e7 -r b9a29d277b1b security/prelude-lml/files/run-prelude-lml.c
--- a/security/prelude-lml/files/run-prelude-lml.c Fri May 26 10:11:22 2006 +0000
+++ b/security/prelude-lml/files/run-prelude-lml.c Fri May 26 11:25:22 2006 +0000
@@ -62,6 +62,8 @@
gid_t GID;
pid_t pidwait;
int waitstat;
+ int s;
+ int max_fd;
/* Sanity check */
if (argc > MAX_ARGS)
@@ -69,13 +71,12 @@
error_sys("arg buffer too small");
exit(-1);
}
-/*
- if (getpid() != 0)
+
+ if (geteuid() != 0)
{
error_sys("must be called by root");
exit(-1);
}
-*/
/* fork child that will become prelude-lml */
if ((pid = fork()) < 0)
@@ -97,9 +98,23 @@
/* Become session leader */
setsid();
+ /* Change working directory to root directory.
+ The current working directory could be a mounted
+ filesystem; if the daemon stays on a mounted
+ filesystem it could prevent the filesystem from
+ being umounted. */
+ chdir("/");
+
/* Clear out file creation mask */
umask(0);
+ /* Close unneeded file descriptors */
+ max_fd = (int) sysconf(_SC_OPEN_MAX);
+ if (max_fd == -1)
+ max_fd = getdtablesize();
+ for (s = 3; s < max_fd; s++)
+ (void) close(s);
+
if (!obtainUIDandGID(PRELUDE_LML_USER, &UID, &GID))
exit(-1);
Home |
Main Index |
Thread Index |
Old Index