summary refs log tree commit diff
path: root/nscd
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2005-06-27 09:15:54 +0000
committerJakub Jelinek <jakub@redhat.com>2005-06-27 09:15:54 +0000
commit5570fbd25a574d54ab135e1d3cdac0bc74029689 (patch)
tree6af711ed17dd644491e68d1a85c22e51bac87179 /nscd
parente4edec582dc1fb924a2cfbfb07409fd7b3c84a26 (diff)
downloadglibc-5570fbd25a574d54ab135e1d3cdac0bc74029689.tar.gz
glibc-5570fbd25a574d54ab135e1d3cdac0bc74029689.tar.xz
glibc-5570fbd25a574d54ab135e1d3cdac0bc74029689.zip
Updated to fedora-glibc-20050627T0850
Diffstat (limited to 'nscd')
-rw-r--r--nscd/connections.c10
-rw-r--r--nscd/nscd.c6
-rw-r--r--nscd/nscd.init16
-rw-r--r--nscd/nscd_stat.c6
-rw-r--r--nscd/selinux.c6
5 files changed, 27 insertions, 17 deletions
diff --git a/nscd/connections.c b/nscd/connections.c
index 818de977d5..a9cdbd4cd8 100644
--- a/nscd/connections.c
+++ b/nscd/connections.c
@@ -209,7 +209,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
@@ -514,7 +514,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;
@@ -523,7 +523,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.  */
@@ -1628,14 +1628,14 @@ 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 3ae401f1f7..76d2080309 100644
--- a/nscd/nscd.c
+++ b/nscd/nscd.c
@@ -152,7 +152,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.  */
@@ -309,7 +309,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;
@@ -333,7 +333,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/nscd_stat.c b/nscd/nscd_stat.c
index 9231642278..8bf50f39f4 100644
--- a/nscd/nscd_stat.c
+++ b/nscd/nscd_stat.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1998, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (c) 1998, 2003, 2004, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1998.
 
@@ -143,8 +143,8 @@ receive_print_stats (void)
   int fd;
   int i;
   uid_t uid = getuid ();
-  const char *yesstr = nl_langinfo (YESSTR);
-  const char *nostr = nl_langinfo (NOSTR);
+  const char *yesstr = _("yes");
+  const char *nostr = _("no");
 
   /* Find out whether there is another user but root allowed to
      request statistics.  */
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 ();