summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--nscd/connections.c10
-rw-r--r--nscd/nscd.c6
-rw-r--r--nscd/nscd.init16
-rw-r--r--nscd/selinux.c6
5 files changed, 30 insertions, 14 deletions
diff --git a/ChangeLog b/ChangeLog
index 48025c6..91faf33 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2005-06-20 Ulrich Drepper <drepper@redhat.com>
+
+ * nscd/nscd.init: Get more in line with lsb3.
+ * nscd/nscd.c: Adjust some error codes to fit in better with lsb3.
+ * nscd/connections.c: Likewise.
+
2005-06-20 Jakub Jelinek <jakub@redhat.com>
* sysdeps/unix/sysv/linux/sys/quota.h: Add definitions and types for
diff --git a/nscd/connections.c b/nscd/connections.c
index 706d657..8179cb2 100644
--- a/nscd/connections.c
+++ b/nscd/connections.c
@@ -207,7 +207,7 @@ nscd_init (void)
if (server_user != NULL && secure_in_use)
{
dbg_log (_("Cannot run nscd in secure mode as unprivileged user"));
- exit (1);
+ exit (4);
}
/* Look up unprivileged uid/gid/groups before we start listening on the
@@ -512,7 +512,7 @@ cannot set socket to close on exec: %s; disabling paranoia mode"),
if (sock < 0)
{
dbg_log (_("cannot open socket: %s"), strerror (errno));
- exit (1);
+ exit (errno == EACCES ? 4 : 1);
}
/* Bind a name to the socket. */
struct sockaddr_un sock_addr;
@@ -521,7 +521,7 @@ cannot set socket to close on exec: %s; disabling paranoia mode"),
if (bind (sock, (struct sockaddr *) &sock_addr, sizeof (sock_addr)) < 0)
{
dbg_log ("%s: %s", _PATH_NSCDSOCKET, strerror (errno));
- exit (1);
+ exit (errno == EACCES ? 4 : 1);
}
/* We don't want to get stuck on accept. */
@@ -1607,13 +1607,13 @@ finish_drop_privileges (void)
{
dbg_log (_("Failed to run nscd as user '%s'"), server_user);
perror ("setgid");
- exit (1);
+ exit (4);
}
if (setuid (server_uid) == -1)
{
dbg_log (_("Failed to run nscd as user '%s'"), server_user);
perror ("setuid");
- exit (1);
+ exit (4);
}
}
diff --git a/nscd/nscd.c b/nscd/nscd.c
index 01baed8..7dd9cb7 100644
--- a/nscd/nscd.c
+++ b/nscd/nscd.c
@@ -145,7 +145,7 @@ main (int argc, char **argv)
{
error (0, 0, gettext ("wrong number of arguments"));
argp_help (&argp, stdout, ARGP_HELP_SEE, program_invocation_short_name);
- exit (EXIT_FAILURE);
+ exit (1);
}
/* Read the configuration file. */
@@ -301,7 +301,7 @@ parse_opt (int key, char *arg, struct argp_state *state)
case 'K':
if (getuid () != 0)
- error (EXIT_FAILURE, 0, _("Only root is allowed to use this option!"));
+ error (4, 0, _("Only root is allowed to use this option!"));
{
int sock = nscd_open_socket ();
request_header req;
@@ -325,7 +325,7 @@ parse_opt (int key, char *arg, struct argp_state *state)
case 'i':
if (getuid () != 0)
- error (EXIT_FAILURE, 0, _("Only root is allowed to use this option!"));
+ error (4, 0, _("Only root is allowed to use this option!"));
else
{
int sock = nscd_open_socket ();
diff --git a/nscd/nscd.init b/nscd/nscd.init
index 23e20c3..a0074b9 100644
--- a/nscd/nscd.init
+++ b/nscd/nscd.init
@@ -10,6 +10,16 @@
# processname: /usr/sbin/nscd
# config: /etc/nscd.conf
#
+### BEGIN INIT INFO
+# Provides: nscd
+# Required-Start: $syslog
+# Default-Stop: 0 1 6
+# Short-Description: Starts the Name Switch Cache Daemon
+# Description: This is a daemon which handles passwd and group lookups \
+# for running programs and cache the results for the next \
+# query. You should start this daemon if you use \
+# slow naming services like NIS, NIS+, LDAP, or hesiod.
+### END INIT INFO
# Sanity checks.
[ -f /etc/nscd.conf ] || exit 0
@@ -29,7 +39,7 @@ case $(uname -r) in
;;
*)
#this is not
- exit 0
+ exit 1
;;
esac
@@ -95,11 +105,11 @@ case "$1" in
restart
RETVAL=$?
;;
- condrestart)
+ try-restart | condrestart)
[ -e /var/lock/subsys/nscd ] && restart
RETVAL=$?
;;
- reload)
+ force-reload | reload)
echo -n $"Reloading $prog: "
killproc /usr/sbin/nscd -HUP
RETVAL=$?
diff --git a/nscd/selinux.c b/nscd/selinux.c
index 4dc4df3..91c1442 100644
--- a/nscd/selinux.c
+++ b/nscd/selinux.c
@@ -1,5 +1,5 @@
/* SELinux access controls for nscd.
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Matthew Rickard <mjricka@epoch.ncsc.mil>, 2004.
@@ -111,7 +111,7 @@ static const struct avc_lock_callback lock_cb =
static int audit_fd = -1;
/* When an avc denial occurs, log it to audit system */
-static void
+static void
log_callback (const char *fmt, ...)
{
va_list ap;
@@ -122,7 +122,7 @@ log_callback (const char *fmt, ...)
}
/* Initialize the connection to the audit system */
-static void
+static void
audit_init (void)
{
audit_fd = audit_open ();