mirror of
https://sourceware.org/git/glibc.git
synced 2025-01-03 08:11:08 +00:00
Update.
* inet/rcmd.c: Provide better error message in case of unknown host. Remove USE_IN_LIBIO. * nscd/nscd.init: Updated version, more conforming with current init file standards. * nscd/nscd-client.h (_PATH_NSCDPID): Move the file into /var/run/nscd directory. (_PATH_NSCDSOCKET): Likewise. * test-skeleton.c (timeout_handler): Fix error message.
This commit is contained in:
parent
d4b04a331c
commit
520ec963af
12
ChangeLog
12
ChangeLog
@ -1,5 +1,17 @@
|
|||||||
2003-12-31 Ulrich Drepper <drepper@redhat.com>
|
2003-12-31 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
|
* inet/rcmd.c: Provide better error message in case of unknown
|
||||||
|
host. Remove USE_IN_LIBIO.
|
||||||
|
|
||||||
|
* nscd/nscd.init: Updated version, more conforming with current
|
||||||
|
init file standards.
|
||||||
|
|
||||||
|
* nscd/nscd-client.h (_PATH_NSCDPID): Move the file into
|
||||||
|
/var/run/nscd directory.
|
||||||
|
(_PATH_NSCDSOCKET): Likewise.
|
||||||
|
|
||||||
|
* test-skeleton.c (timeout_handler): Fix error message.
|
||||||
|
|
||||||
* elf/dl-dst.h (DL_DST_REQUIRED): Avoid the complex operations if
|
* elf/dl-dst.h (DL_DST_REQUIRED): Avoid the complex operations if
|
||||||
CNT == 0.
|
CNT == 0.
|
||||||
|
|
||||||
|
48
inet/rcmd.c
48
inet/rcmd.c
@ -80,9 +80,7 @@ static char sccsid[] = "@(#)rcmd.c 8.3 (Berkeley) 3/26/94";
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <libintl.h>
|
#include <libintl.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#ifdef USE_IN_LIBIO
|
#include <wchar.h>
|
||||||
# include <wchar.h>
|
|
||||||
#endif
|
|
||||||
#include <sys/uio.h>
|
#include <sys/uio.h>
|
||||||
|
|
||||||
|
|
||||||
@ -139,14 +137,20 @@ rcmd_af(ahost, rport, locuser, remuser, cmd, fd2p, af)
|
|||||||
(void)__snprintf(num, sizeof(num), "%d", ntohs(rport));
|
(void)__snprintf(num, sizeof(num), "%d", ntohs(rport));
|
||||||
error = getaddrinfo(*ahost, num, &hints, &res);
|
error = getaddrinfo(*ahost, num, &hints, &res);
|
||||||
if (error) {
|
if (error) {
|
||||||
#ifdef USE_IN_LIBIO
|
if (error == EAI_NONAME && *ahost != NULL) {
|
||||||
if (_IO_fwide (stderr, 0) > 0)
|
if (_IO_fwide (stderr, 0) > 0)
|
||||||
__fwprintf(stderr, L"rcmd: getaddrinfo: %s\n",
|
__fwprintf(stderr, L"%s: Unknown host\n",
|
||||||
gai_strerror(error));
|
*ahost);
|
||||||
else
|
else
|
||||||
#endif
|
fprintf(stderr, "%s: Unknown host\n", *ahost);
|
||||||
fprintf(stderr, "rcmd: getaddrinfo: %s\n",
|
} else {
|
||||||
gai_strerror(error));
|
if (_IO_fwide (stderr, 0) > 0)
|
||||||
|
__fwprintf(stderr, L"rcmd: getaddrinfo: %s\n",
|
||||||
|
gai_strerror(error));
|
||||||
|
else
|
||||||
|
fprintf(stderr, "rcmd: getaddrinfo: %s\n",
|
||||||
|
gai_strerror(error));
|
||||||
|
}
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,12 +161,10 @@ rcmd_af(ahost, rport, locuser, remuser, cmd, fd2p, af)
|
|||||||
free (ahostbuf);
|
free (ahostbuf);
|
||||||
ahostbuf = strdup (res->ai_canonname);
|
ahostbuf = strdup (res->ai_canonname);
|
||||||
if (ahostbuf == NULL) {
|
if (ahostbuf == NULL) {
|
||||||
#ifdef USE_IN_LIBIO
|
|
||||||
if (_IO_fwide (stderr, 0) > 0)
|
if (_IO_fwide (stderr, 0) > 0)
|
||||||
__fwprintf(stderr, L"%s",
|
__fwprintf(stderr, L"%s",
|
||||||
_("rcmd: Cannot allocate memory\n"));
|
_("rcmd: Cannot allocate memory\n"));
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
fputs(_("rcmd: Cannot allocate memory\n"),
|
fputs(_("rcmd: Cannot allocate memory\n"),
|
||||||
stderr);
|
stderr);
|
||||||
return (-1);
|
return (-1);
|
||||||
@ -179,21 +181,17 @@ rcmd_af(ahost, rport, locuser, remuser, cmd, fd2p, af)
|
|||||||
s = rresvport_af(&lport, ai->ai_family);
|
s = rresvport_af(&lport, ai->ai_family);
|
||||||
if (s < 0) {
|
if (s < 0) {
|
||||||
if (errno == EAGAIN) {
|
if (errno == EAGAIN) {
|
||||||
#ifdef USE_IN_LIBIO
|
|
||||||
if (_IO_fwide (stderr, 0) > 0)
|
if (_IO_fwide (stderr, 0) > 0)
|
||||||
__fwprintf(stderr, L"%s",
|
__fwprintf(stderr, L"%s",
|
||||||
_("rcmd: socket: All ports in use\n"));
|
_("rcmd: socket: All ports in use\n"));
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
fputs(_("rcmd: socket: All ports in use\n"),
|
fputs(_("rcmd: socket: All ports in use\n"),
|
||||||
stderr);
|
stderr);
|
||||||
} else {
|
} else {
|
||||||
#ifdef USE_IN_LIBIO
|
|
||||||
if (_IO_fwide (stderr, 0) > 0)
|
if (_IO_fwide (stderr, 0) > 0)
|
||||||
__fwprintf(stderr,
|
__fwprintf(stderr,
|
||||||
L"rcmd: socket: %m\n");
|
L"rcmd: socket: %m\n");
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
fprintf(stderr, "rcmd: socket: %m\n");
|
fprintf(stderr, "rcmd: socket: %m\n");
|
||||||
}
|
}
|
||||||
__sigsetmask(oldmask);
|
__sigsetmask(oldmask);
|
||||||
@ -222,11 +220,9 @@ rcmd_af(ahost, rport, locuser, remuser, cmd, fd2p, af)
|
|||||||
if (__asprintf (&buf, _("connect to address %s: "),
|
if (__asprintf (&buf, _("connect to address %s: "),
|
||||||
paddr) >= 0)
|
paddr) >= 0)
|
||||||
{
|
{
|
||||||
#ifdef USE_IN_LIBIO
|
|
||||||
if (_IO_fwide (stderr, 0) > 0)
|
if (_IO_fwide (stderr, 0) > 0)
|
||||||
__fwprintf(stderr, L"%s", buf);
|
__fwprintf(stderr, L"%s", buf);
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
fputs (buf, stderr);
|
fputs (buf, stderr);
|
||||||
free (buf);
|
free (buf);
|
||||||
}
|
}
|
||||||
@ -239,11 +235,9 @@ rcmd_af(ahost, rport, locuser, remuser, cmd, fd2p, af)
|
|||||||
NI_NUMERICHOST);
|
NI_NUMERICHOST);
|
||||||
if (__asprintf (&buf, _("Trying %s...\n"), paddr) >= 0)
|
if (__asprintf (&buf, _("Trying %s...\n"), paddr) >= 0)
|
||||||
{
|
{
|
||||||
#ifdef USE_IN_LIBIO
|
|
||||||
if (_IO_fwide (stderr, 0) > 0)
|
if (_IO_fwide (stderr, 0) > 0)
|
||||||
__fwprintf (stderr, L"%s", buf);
|
__fwprintf (stderr, L"%s", buf);
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
fputs (buf, stderr);
|
fputs (buf, stderr);
|
||||||
free (buf);
|
free (buf);
|
||||||
}
|
}
|
||||||
@ -257,13 +251,11 @@ rcmd_af(ahost, rport, locuser, remuser, cmd, fd2p, af)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
freeaddrinfo(res);
|
freeaddrinfo(res);
|
||||||
#ifdef USE_IN_LIBIO
|
|
||||||
if (_IO_fwide (stderr, 0) > 0)
|
if (_IO_fwide (stderr, 0) > 0)
|
||||||
(void)__fwprintf(stderr, L"%s: %s\n", *ahost,
|
(void)__fwprintf(stderr, L"%s: %s\n", *ahost,
|
||||||
__strerror_r(errno,
|
__strerror_r(errno,
|
||||||
errbuf, sizeof (errbuf)));
|
errbuf, sizeof (errbuf)));
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
(void)fprintf(stderr, "%s: %s\n", *ahost,
|
(void)fprintf(stderr, "%s: %s\n", *ahost,
|
||||||
__strerror_r(errno,
|
__strerror_r(errno,
|
||||||
errbuf, sizeof (errbuf)));
|
errbuf, sizeof (errbuf)));
|
||||||
@ -289,11 +281,9 @@ rcmd_af(ahost, rport, locuser, remuser, cmd, fd2p, af)
|
|||||||
if (__asprintf (&buf, _("\
|
if (__asprintf (&buf, _("\
|
||||||
rcmd: write (setting up stderr): %m\n")) >= 0)
|
rcmd: write (setting up stderr): %m\n")) >= 0)
|
||||||
{
|
{
|
||||||
#ifdef USE_IN_LIBIO
|
|
||||||
if (_IO_fwide (stderr, 0) > 0)
|
if (_IO_fwide (stderr, 0) > 0)
|
||||||
__fwprintf(stderr, L"%s", buf);
|
__fwprintf(stderr, L"%s", buf);
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
fputs (buf, stderr);
|
fputs (buf, stderr);
|
||||||
free (buf);
|
free (buf);
|
||||||
}
|
}
|
||||||
@ -313,11 +303,9 @@ rcmd: poll (setting up stderr): %m\n")) >= 0)
|
|||||||
&& __asprintf(&buf, _("\
|
&& __asprintf(&buf, _("\
|
||||||
poll: protocol failure in circuit setup\n")) >= 0))
|
poll: protocol failure in circuit setup\n")) >= 0))
|
||||||
{
|
{
|
||||||
#ifdef USE_IN_LIBIO
|
|
||||||
if (_IO_fwide (stderr, 0) > 0)
|
if (_IO_fwide (stderr, 0) > 0)
|
||||||
__fwprintf (stderr, L"%s", buf);
|
__fwprintf (stderr, L"%s", buf);
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
fputs (buf, stderr);
|
fputs (buf, stderr);
|
||||||
free (buf);
|
free (buf);
|
||||||
}
|
}
|
||||||
@ -339,12 +327,10 @@ poll: protocol failure in circuit setup\n")) >= 0))
|
|||||||
}
|
}
|
||||||
(void)__close(s2);
|
(void)__close(s2);
|
||||||
if (s3 < 0) {
|
if (s3 < 0) {
|
||||||
#ifdef USE_IN_LIBIO
|
|
||||||
if (_IO_fwide (stderr, 0) > 0)
|
if (_IO_fwide (stderr, 0) > 0)
|
||||||
(void)__fwprintf(stderr,
|
(void)__fwprintf(stderr,
|
||||||
L"rcmd: accept: %m\n");
|
L"rcmd: accept: %m\n");
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
(void)fprintf(stderr,
|
(void)fprintf(stderr,
|
||||||
"rcmd: accept: %m\n");
|
"rcmd: accept: %m\n");
|
||||||
lport = 0;
|
lport = 0;
|
||||||
@ -358,11 +344,9 @@ poll: protocol failure in circuit setup\n")) >= 0))
|
|||||||
if (__asprintf(&buf, _("\
|
if (__asprintf(&buf, _("\
|
||||||
socket: protocol failure in circuit setup\n")) >= 0)
|
socket: protocol failure in circuit setup\n")) >= 0)
|
||||||
{
|
{
|
||||||
#ifdef USE_IN_LIBIO
|
|
||||||
if (_IO_fwide (stderr, 0) > 0)
|
if (_IO_fwide (stderr, 0) > 0)
|
||||||
__fwprintf (stderr, L"%s", buf);
|
__fwprintf (stderr, L"%s", buf);
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
fputs (buf, stderr);
|
fputs (buf, stderr);
|
||||||
free (buf);
|
free (buf);
|
||||||
}
|
}
|
||||||
@ -389,11 +373,9 @@ socket: protocol failure in circuit setup\n")) >= 0)
|
|||||||
|| (n != 0
|
|| (n != 0
|
||||||
&& __asprintf(&buf, "rcmd: %s: %m\n", *ahost) >= 0))
|
&& __asprintf(&buf, "rcmd: %s: %m\n", *ahost) >= 0))
|
||||||
{
|
{
|
||||||
#ifdef USE_IN_LIBIO
|
|
||||||
if (_IO_fwide (stderr, 0) > 0)
|
if (_IO_fwide (stderr, 0) > 0)
|
||||||
__fwprintf (stderr, L"%s", buf);
|
__fwprintf (stderr, L"%s", buf);
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
fputs (buf, stderr);
|
fputs (buf, stderr);
|
||||||
free (buf);
|
free (buf);
|
||||||
}
|
}
|
||||||
|
@ -29,10 +29,10 @@
|
|||||||
#define NSCD_VERSION 2
|
#define NSCD_VERSION 2
|
||||||
|
|
||||||
/* Path of the file where the PID of the running system is stored. */
|
/* Path of the file where the PID of the running system is stored. */
|
||||||
#define _PATH_NSCDPID "/var/run/nscd.pid"
|
#define _PATH_NSCDPID "/var/run/nscd/nscd.pid"
|
||||||
|
|
||||||
/* Path for the Unix domain socket. */
|
/* Path for the Unix domain socket. */
|
||||||
#define _PATH_NSCDSOCKET "/var/run/.nscd_socket"
|
#define _PATH_NSCDSOCKET "/var/run/nscd/socket"
|
||||||
|
|
||||||
/* Path for the configuration file. */
|
/* Path for the configuration file. */
|
||||||
#define _PATH_NSCDCONF "/etc/nscd.conf"
|
#define _PATH_NSCDCONF "/etc/nscd.conf"
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
#
|
#
|
||||||
# nscd: Starts the Name Switch Cache Daemon
|
# nscd: Starts the Name Switch Cache Daemon
|
||||||
#
|
#
|
||||||
# chkconfig: - 30 80
|
# chkconfig: - 30 74
|
||||||
# description: This is a daemon which handles passwd and group lookups \
|
# description: This is a daemon which handles passwd and group lookups \
|
||||||
# for running programs and cache the results for the next \
|
# for running programs and cache the results for the next \
|
||||||
# query. You should start this daemon only if you use \
|
# query. You should start this daemon if you use \
|
||||||
# slow Services like NIS or NIS+
|
# slow naming services like NIS, NIS+, LDAP, or hesiod.
|
||||||
# processname: nscd
|
# processname: /usr/sbin/nscd
|
||||||
# config: /etc/nscd.conf
|
# config: /etc/nscd.conf
|
||||||
#
|
#
|
||||||
|
|
||||||
@ -16,7 +16,7 @@
|
|||||||
[ -x /usr/sbin/nscd ] || exit 0
|
[ -x /usr/sbin/nscd ] || exit 0
|
||||||
|
|
||||||
# Source function library.
|
# Source function library.
|
||||||
. /etc/rc.d/init.d/functions
|
. /etc/init.d/functions
|
||||||
|
|
||||||
# nscd does not run on any kernel lower than 2.2.0 because of threading
|
# nscd does not run on any kernel lower than 2.2.0 because of threading
|
||||||
# problems, so we require that in first place.
|
# problems, so we require that in first place.
|
||||||
@ -34,51 +34,77 @@ case $(uname -r) in
|
|||||||
esac
|
esac
|
||||||
|
|
||||||
RETVAL=0
|
RETVAL=0
|
||||||
|
prog=nscd
|
||||||
|
|
||||||
|
start () {
|
||||||
|
[ -d /var/run/nscd ] || mkdir /var/run/nscd
|
||||||
|
secure=""
|
||||||
|
# for table in passwd group hosts
|
||||||
|
# do
|
||||||
|
# if egrep -q '^'$table':.*nisplus' /etc/nsswitch.conf; then
|
||||||
|
# /usr/lib/nscd_nischeck $table || secure="$secure -S $table,yes"
|
||||||
|
# fi
|
||||||
|
# done
|
||||||
|
echo -n $"Starting $prog: "
|
||||||
|
daemon /usr/sbin/nscd $secure
|
||||||
|
RETVAL=$?
|
||||||
|
echo
|
||||||
|
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/nscd
|
||||||
|
return $RETVAL
|
||||||
|
}
|
||||||
|
|
||||||
|
stop () {
|
||||||
|
echo -n $"Stopping $prog: "
|
||||||
|
/usr/sbin/nscd -K
|
||||||
|
RETVAL=$?
|
||||||
|
if [ $RETVAL -eq 0 ]; then
|
||||||
|
rm -f /var/lock/subsys/nscd
|
||||||
|
# nscd won't be able to remove these if it is running as
|
||||||
|
# a non-privileged user
|
||||||
|
rm -f /var/run/nscd/nscd.pid
|
||||||
|
rm -f /var/run/nscd/.socket
|
||||||
|
success $"$prog shutdown"
|
||||||
|
else
|
||||||
|
failure $"$prog shutdown"
|
||||||
|
fi
|
||||||
|
echo
|
||||||
|
return $RETVAL
|
||||||
|
}
|
||||||
|
|
||||||
|
restart() {
|
||||||
|
stop
|
||||||
|
start
|
||||||
|
}
|
||||||
|
|
||||||
# See how we were called.
|
# See how we were called.
|
||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
secure=""
|
start
|
||||||
# for table in passwd group
|
|
||||||
# do
|
|
||||||
# if egrep '^'$table':.*nisplus' /etc/nsswitch.conf >/dev/null
|
|
||||||
# then
|
|
||||||
# /usr/lib/nscd_nischeck $table ||
|
|
||||||
# secure="$secure -S $table,yes"
|
|
||||||
# fi
|
|
||||||
# done
|
|
||||||
echo -n "Starting Name Switch Cache Daemon: "
|
|
||||||
daemon nscd $secure
|
|
||||||
RETVAL=$?
|
RETVAL=$?
|
||||||
echo
|
|
||||||
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/nscd
|
|
||||||
;;
|
;;
|
||||||
stop)
|
stop)
|
||||||
echo -n "Stopping Name Switch Cache Daemon: "
|
stop
|
||||||
/usr/sbin/nscd -K
|
|
||||||
RETVAL=$?
|
RETVAL=$?
|
||||||
if [ $RETVAL -eq 0 ]; then
|
|
||||||
rm -f /var/lock/subsys/nscd
|
|
||||||
echo nscd
|
|
||||||
else
|
|
||||||
echo
|
|
||||||
fi
|
|
||||||
;;
|
;;
|
||||||
status)
|
status)
|
||||||
status nscd
|
status nscd
|
||||||
RETVAL=$?
|
RETVAL=$?
|
||||||
;;
|
;;
|
||||||
restart)
|
restart)
|
||||||
$0 stop
|
restart
|
||||||
$0 start
|
|
||||||
RETVAL=$?
|
RETVAL=$?
|
||||||
;;
|
;;
|
||||||
reload)
|
condrestart)
|
||||||
killproc -HUP nscd
|
[ -e /var/lock/subsys/nscd ] && restart
|
||||||
|
RETVAL=$?
|
||||||
|
;;
|
||||||
|
reload)
|
||||||
|
killproc /usr/sbin/nscd -HUP
|
||||||
RETVAL=$?
|
RETVAL=$?
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Usage: $0 {start|stop|status|restart}"
|
echo $"Usage: $0 {start|stop|status|restart|reload|condrestart}"
|
||||||
|
RETVAL=1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
exit $RETVAL
|
exit $RETVAL
|
||||||
|
@ -156,7 +156,7 @@ timeout_handler (int sig __attribute__ ((unused)))
|
|||||||
}
|
}
|
||||||
if (killed != 0 && killed != pid)
|
if (killed != 0 && killed != pid)
|
||||||
{
|
{
|
||||||
perror ("Failed to killed test process");
|
perror ("Failed to kill test process");
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user