diff options
author | Ulrich Drepper <drepper@redhat.com> | 2005-06-20 15:49:08 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2005-06-20 15:49:08 +0000 |
commit | 64d64de628376b21e8eb29bdc9ef6a3651793aef (patch) | |
tree | e91fa4027fe4402d6359129f26f43081d579267a /nscd | |
parent | 24c709d1af1d603e310645b1305bb77448d69e20 (diff) | |
download | glibc-64d64de628376b21e8eb29bdc9ef6a3651793aef.tar.gz |
* nscd/nscd.init: Get more in line with lsb3.cvs/fedora-glibc-20050620T1530cvs/fedora-glibc-20050620T1522
* nscd/nscd.c: Adjust some error codes to fit in better with lsb3.
* nscd/connections.c: Likewise.
Diffstat (limited to 'nscd')
-rw-r--r-- | nscd/connections.c | 10 | ||||
-rw-r--r-- | nscd/nscd.c | 6 | ||||
-rw-r--r-- | nscd/nscd.init | 16 | ||||
-rw-r--r-- | nscd/selinux.c | 6 |
4 files changed, 24 insertions, 14 deletions
diff --git a/nscd/connections.c b/nscd/connections.c index 706d657d49..8179cb237d 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 01baed8388..7dd9cb7722 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 23e20c3a82..a0074b99e5 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 4dc4df3648..91c1442b59 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 (); |