* 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.
This commit is contained in:
Ulrich Drepper 2005-06-20 15:49:08 +00:00
parent 24c709d1af
commit 64d64de628
5 changed files with 30 additions and 14 deletions

View File

@ -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

View File

@ -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);
}
}

View File

@ -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 ();

View File

@ -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=$?

View File

@ -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 ();