mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-29 11:41:21 +03:00
Update.
* nss/getXXbyYY_r.c: Return error code not -1. * nss/getXXent_r.c: Likewise. * nss/getXXbyYY.c: Expect return alue to be ERANGE if buffer is too small. * nscd/nscd_getgr_r.c: Return -1 in case nscd is not available and value > 0 for error. * nscd/nscd_gethst_r.c: Likewise. * nscd/nscd_getpw_r.c: Likewise. 1999-06-17 Andreas Jaeger <aj@arthur.rhein-neckar.de> * sysdeps/unix/sysv/linux/bits/ioctl-types.h: Add missing line disciplines. 1999-06-14 Andreas Jaeger <aj@arthur.rhein-neckar.de> * nscd/nscd_nischeck.c: Fix typos. 1999-06-17 Ulrich Drepper <drepper@cygnus.com>
This commit is contained in:
20
ChangeLog
20
ChangeLog
@ -1,3 +1,23 @@
|
||||
1999-06-17 Ulrich Drepper <drepper@cygnus.com>
|
||||
|
||||
* nss/getXXbyYY_r.c: Return error code not -1.
|
||||
* nss/getXXent_r.c: Likewise.
|
||||
* nss/getXXbyYY.c: Expect return alue to be ERANGE if buffer is too
|
||||
small.
|
||||
* nscd/nscd_getgr_r.c: Return -1 in case nscd is not available and
|
||||
value > 0 for error.
|
||||
* nscd/nscd_gethst_r.c: Likewise.
|
||||
* nscd/nscd_getpw_r.c: Likewise.
|
||||
|
||||
1999-06-17 Andreas Jaeger <aj@arthur.rhein-neckar.de>
|
||||
|
||||
* sysdeps/unix/sysv/linux/bits/ioctl-types.h: Add missing line
|
||||
disciplines.
|
||||
|
||||
1999-06-14 Andreas Jaeger <aj@arthur.rhein-neckar.de>
|
||||
|
||||
* nscd/nscd_nischeck.c: Fix typos.
|
||||
|
||||
1999-06-17 Ulrich Drepper <drepper@cygnus.com>
|
||||
|
||||
* sysdeps/unix/sysv/linux/sparc/sparc32/sigaction.c: Don't fail
|
||||
|
@ -17,6 +17,7 @@
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <wchar.h>
|
||||
|
||||
/* Write formatted output to stdout according to the
|
||||
|
@ -17,6 +17,7 @@
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <wchar.h>
|
||||
|
||||
/* Write formatted output to stdout from the format string FORMAT. */
|
||||
|
@ -1268,6 +1268,57 @@ The host database contains an entry for the name, but it doesn't have an
|
||||
associated Internet address.
|
||||
@end table
|
||||
|
||||
The lookup functions above all have one in common: they are not
|
||||
reentrant and therefore unusable in multi-threaded applications.
|
||||
Therefore provides the GNU C library a new set of functions which can be
|
||||
used in this context.
|
||||
|
||||
@comment netdb.h
|
||||
@comment GNU
|
||||
@deftypefun int gethostbyname_r (const char *restrict @var{name}, struct hostent *restrict @var{result_buf}, char *restrict @var{buf}, size_t @var{buflen}, struct hostent **restrict @var{result}, int *restrict @var{h_errnop})
|
||||
The @code{gethostbyname_r} function returns information about the host
|
||||
named @var{name}. The caller must pass a pointer to an object of type
|
||||
@code{struct hostent} in the @var{result_buf} parameter. In addition
|
||||
the function may need extra buffer space and the caller must pass an
|
||||
pointer and the size of the buffer in the @var{buf} and @var{buflen}
|
||||
parameters.
|
||||
|
||||
A pointer to the buffer, in which the result is stored, is available in
|
||||
@code{*@var{result}} after the function call successfully returned.
|
||||
Success is signalled by a zero return value. If the function failed the
|
||||
return value is an error number. In addition to the errors defined for
|
||||
@code{gethostbyname} it can also be @code{ERANGE}. In this case the
|
||||
call should be repeated with a larger buffer. Additional error
|
||||
information is not stored in the global variable @code{h_errno} but
|
||||
instead in the object pointed to by @var{h_errnop}.
|
||||
@end deftypefun
|
||||
|
||||
@comment netdb.h
|
||||
@comment GNU
|
||||
@deftypefun int gethostbyname2_r (const char *@var{name}, int @var{af}, struct hostent *restrict @var{result_buf}, char *restrict @var{buf}, size_t @var{buflen}, struct hostent **restrict @var{result}, int *restrict @var{h_errnop})
|
||||
The @code{gethostbyname2_r} function is like @code{gethostbyname_r}, but
|
||||
allows the caller to specify the desired address family (e.g.@:
|
||||
@code{AF_INET} or @code{AF_INET6}) for the result.
|
||||
@end deftypefun
|
||||
|
||||
@comment netdb.h
|
||||
@comment GNU
|
||||
@deftypefun int gethostbyaddr_r (const char *@var{addr}, int @var{length}, int @var{format}, struct hostent *restrict @var{result_buf}, char *restrict @var{buf}, size_t @var{buflen}, struct hostent **restrict @var{result}, int *restrict @var{h_errnop})
|
||||
The @code{gethostbyaddr_r} function returns information about the host
|
||||
with Internet address @var{addr}. The parameter @var{addr} is not
|
||||
really a pointer to char - it can be a pointer to an IPv4 or an IPv6
|
||||
address. The @var{length} argument is the size (in bytes) of the address
|
||||
at @var{addr}. @var{format} specifies the address format; for an IPv4
|
||||
Internet address, specify a value of @code{AF_INET}; for an IPv6
|
||||
Internet address, use @code{AF_INET6}.
|
||||
|
||||
Similar to the @code{gethostbyname_r} function, the caller must provide
|
||||
buffers for the result and memory used internally. In case of success
|
||||
the funciton returns zero. Otherwise the value is an error number where
|
||||
@code{ERANGE} has the special meaning that the caller-provided buffer is
|
||||
too small.
|
||||
@end deftypefun
|
||||
|
||||
You can also scan the entire hosts database one entry at a time using
|
||||
@code{sethostent}, @code{gethostent}, and @code{endhostent}. Be careful
|
||||
in using these functions, because they are not reentrant.
|
||||
|
@ -102,7 +102,7 @@ nscd_getgr_r (const char *key, size_t keylen, request_type type,
|
||||
if (sock == -1)
|
||||
{
|
||||
__nss_not_use_nscd_group = 1;
|
||||
return 1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
req.version = NSCD_VERSION;
|
||||
@ -117,14 +117,14 @@ nscd_getgr_r (const char *key, size_t keylen, request_type type,
|
||||
if (__writev (sock, vec, 2) != sizeof (request_header) + keylen)
|
||||
{
|
||||
__close (sock);
|
||||
return 1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
nbytes = __read (sock, &gr_resp, sizeof (gr_response_header));
|
||||
if (nbytes != sizeof (gr_response_header))
|
||||
{
|
||||
__close (sock);
|
||||
return 1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (gr_resp.found == -1)
|
||||
@ -132,7 +132,7 @@ nscd_getgr_r (const char *key, size_t keylen, request_type type,
|
||||
/* The daemon does not cache this database. */
|
||||
__close (sock);
|
||||
__nss_not_use_nscd_group = 1;
|
||||
return 1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (gr_resp.found == 1)
|
||||
@ -153,7 +153,7 @@ nscd_getgr_r (const char *key, size_t keylen, request_type type,
|
||||
no_room:
|
||||
__set_errno (ERANGE);
|
||||
__close (sock);
|
||||
return -1;
|
||||
return ERANGE;
|
||||
}
|
||||
|
||||
p += align;
|
||||
@ -186,7 +186,7 @@ nscd_getgr_r (const char *key, size_t keylen, request_type type,
|
||||
if (__readv (sock, vec, 2) != total_len)
|
||||
{
|
||||
__close (sock);
|
||||
return 1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Clear the terminating entry. */
|
||||
@ -209,7 +209,7 @@ nscd_getgr_r (const char *key, size_t keylen, request_type type,
|
||||
__close (sock);
|
||||
/* The `errno' to some value != ERANGE. */
|
||||
__set_errno (ENOENT);
|
||||
return -1;
|
||||
return ENOENT;
|
||||
}
|
||||
|
||||
__close (sock);
|
||||
@ -220,6 +220,6 @@ nscd_getgr_r (const char *key, size_t keylen, request_type type,
|
||||
__close (sock);
|
||||
/* The `errno' to some value != ERANGE. */
|
||||
__set_errno (ENOENT);
|
||||
return -1;
|
||||
return ENOENT;
|
||||
}
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ __nscd_gethostbyaddr_r (const char *addr, int len, int type,
|
||||
if (!((len == INADDRSZ && type == AF_INET)
|
||||
|| (len == IN6ADDRSZ && type == AF_INET6)))
|
||||
/* LEN and TYPE do not match. */
|
||||
return 1;
|
||||
return -1;
|
||||
|
||||
reqtype = type == AF_INET6 ? GETHOSTBYADDRv6 : GETHOSTBYADDR;
|
||||
|
||||
@ -127,7 +127,7 @@ nscd_gethst_r (const char *key, size_t keylen, request_type type,
|
||||
if (sock == -1)
|
||||
{
|
||||
__nss_not_use_nscd_group = 1;
|
||||
return 1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
req.version = NSCD_VERSION;
|
||||
@ -137,21 +137,21 @@ nscd_gethst_r (const char *key, size_t keylen, request_type type,
|
||||
if (nbytes != sizeof (request_header))
|
||||
{
|
||||
__close (sock);
|
||||
return 1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
nbytes = __write (sock, key, req.key_len);
|
||||
if (nbytes != req.key_len)
|
||||
{
|
||||
__close (sock);
|
||||
return 1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
nbytes = __read (sock, &hst_resp, sizeof (hst_response_header));
|
||||
if (nbytes != sizeof (hst_response_header))
|
||||
{
|
||||
__close (sock);
|
||||
return 1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (hst_resp.found == -1)
|
||||
@ -159,7 +159,7 @@ nscd_gethst_r (const char *key, size_t keylen, request_type type,
|
||||
/* The daemon does not cache this database. */
|
||||
__close (sock);
|
||||
__nss_not_use_nscd_hosts = 1;
|
||||
return 1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (hst_resp.found == 1)
|
||||
@ -191,7 +191,7 @@ nscd_gethst_r (const char *key, size_t keylen, request_type type,
|
||||
no_room:
|
||||
__set_errno (ERANGE);
|
||||
__close (sock);
|
||||
return -1;
|
||||
return ERANGE;
|
||||
}
|
||||
cp += align1;
|
||||
|
||||
@ -270,7 +270,7 @@ nscd_gethst_r (const char *key, size_t keylen, request_type type,
|
||||
if (__readv (sock, vec, n) != total_len)
|
||||
{
|
||||
__close (sock);
|
||||
return 1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Now we also can read the aliases. */
|
||||
@ -291,7 +291,7 @@ nscd_gethst_r (const char *key, size_t keylen, request_type type,
|
||||
if (__read (sock, resultbuf->h_aliases[0], total_len) != total_len)
|
||||
{
|
||||
__close (sock);
|
||||
return 1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
__close (sock);
|
||||
@ -305,6 +305,6 @@ nscd_gethst_r (const char *key, size_t keylen, request_type type,
|
||||
__close (sock);
|
||||
/* The `errno' to some value != ERANGE. */
|
||||
__set_errno (ENOENT);
|
||||
return -1;
|
||||
return ENOENT;
|
||||
}
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ __nscd_getpwnam_r (const char *name, struct passwd *resultbuf, char *buffer,
|
||||
size_t buflen)
|
||||
{
|
||||
if (name == NULL)
|
||||
return 1;
|
||||
return -1;
|
||||
|
||||
return nscd_getpw_r (name, strlen (name) + 1, GETPWBYNAME, resultbuf,
|
||||
buffer, buflen);
|
||||
@ -100,7 +100,7 @@ nscd_getpw_r (const char *key, size_t keylen, request_type type,
|
||||
if (sock == -1)
|
||||
{
|
||||
__nss_not_use_nscd_passwd = 1;
|
||||
return 1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
req.version = NSCD_VERSION;
|
||||
@ -110,21 +110,21 @@ nscd_getpw_r (const char *key, size_t keylen, request_type type,
|
||||
if (nbytes != sizeof (request_header))
|
||||
{
|
||||
__close (sock);
|
||||
return 1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
nbytes = __write (sock, key, keylen);
|
||||
if (nbytes != keylen)
|
||||
{
|
||||
__close (sock);
|
||||
return 1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
nbytes = __read (sock, &pw_resp, sizeof (pw_response_header));
|
||||
if (nbytes != sizeof (pw_response_header))
|
||||
{
|
||||
__close (sock);
|
||||
return 1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (pw_resp.found == -1)
|
||||
@ -132,7 +132,7 @@ nscd_getpw_r (const char *key, size_t keylen, request_type type,
|
||||
/* The daemon does not cache this database. */
|
||||
__close (sock);
|
||||
__nss_not_use_nscd_passwd = 1;
|
||||
return 1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (pw_resp.found == 1)
|
||||
@ -146,7 +146,7 @@ nscd_getpw_r (const char *key, size_t keylen, request_type type,
|
||||
{
|
||||
__set_errno (ERANGE);
|
||||
__close (sock);
|
||||
return -1;
|
||||
return ERANGE;
|
||||
}
|
||||
|
||||
/* Set the information we already have. */
|
||||
@ -172,13 +172,13 @@ nscd_getpw_r (const char *key, size_t keylen, request_type type,
|
||||
|
||||
__close (sock);
|
||||
|
||||
return nbytes == total ? 0 : 1;
|
||||
return nbytes == total ? 0 : -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
__close (sock);
|
||||
/* The `errno' to some value != ERANGE. */
|
||||
__set_errno (ENOENT);
|
||||
return -1;
|
||||
return ENOENT;
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,7 @@
|
||||
/* nscd_nischeck: Check, if everybody has read permissions for NIS+ table.
|
||||
Return value:
|
||||
0: Everybody can read the NIS+ table
|
||||
1: Only authenticated Users could read the NIS+ table */
|
||||
1: Only authenticated users could read the NIS+ table */
|
||||
|
||||
#include <argp.h>
|
||||
#include <error.h>
|
||||
@ -86,7 +86,7 @@ main (int argc, char **argv)
|
||||
static void
|
||||
print_version (FILE *stream, struct argp_state *state)
|
||||
{
|
||||
fprintf (stream, "nscd_checknis (GNU %s) %s\n", PACKAGE, VERSION);
|
||||
fprintf (stream, "nscd_nischeck (GNU %s) %s\n", PACKAGE, VERSION);
|
||||
fprintf (stream, gettext ("\
|
||||
Copyright (C) %s Free Software Foundation, Inc.\n\
|
||||
This is free software; see the source for copying conditions. There is NO\n\
|
||||
|
@ -114,12 +114,13 @@ FUNCTION_NAME (ADD_PARAMS)
|
||||
}
|
||||
|
||||
while (buffer != NULL
|
||||
&& INTERNAL (REENTRANT_NAME) (ADD_VARIABLES, &resbuf, buffer,
|
||||
buffer_size, &result H_ERRNO_VAR) != 0
|
||||
&& (INTERNAL (REENTRANT_NAME) (ADD_VARIABLES, &resbuf, buffer,
|
||||
buffer_size, &result H_ERRNO_VAR)
|
||||
== ERANGE)
|
||||
#ifdef NEED_H_ERRNO
|
||||
&& h_errno_tmp == NETDB_INTERNAL
|
||||
#endif
|
||||
&& errno == ERANGE)
|
||||
)
|
||||
{
|
||||
char *new_buf;
|
||||
buffer_size += BUFLEN;
|
||||
|
@ -122,7 +122,7 @@ INTERNAL (REENTRANT_NAME) (ADD_PARAMS, LOOKUP_TYPE *resbuf, char *buffer,
|
||||
{
|
||||
*h_errnop = NETDB_INTERNAL;
|
||||
*result = NULL;
|
||||
return -1;
|
||||
return errno;
|
||||
}
|
||||
# define resbuf (*resbuf)
|
||||
# include "digits_dots.c"
|
||||
@ -137,7 +137,7 @@ INTERNAL (REENTRANT_NAME) (ADD_PARAMS, LOOKUP_TYPE *resbuf, char *buffer,
|
||||
{
|
||||
nscd_status = NSCD_NAME (ADD_VARIABLES, resbuf, buffer, buflen
|
||||
H_ERRNO_VAR);
|
||||
if (nscd_status < 1)
|
||||
if (nscd_status >= 0)
|
||||
{
|
||||
*result = nscd_status == 0 ? resbuf : NULL;
|
||||
return nscd_status;
|
||||
@ -162,7 +162,7 @@ INTERNAL (REENTRANT_NAME) (ADD_PARAMS, LOOKUP_TYPE *resbuf, char *buffer,
|
||||
{
|
||||
*h_errnop = NETDB_INTERNAL;
|
||||
*result = NULL;
|
||||
return -1;
|
||||
return errno;
|
||||
}
|
||||
#endif /* need _res */
|
||||
#ifdef NEED__RES_HCONF
|
||||
@ -205,7 +205,7 @@ done:
|
||||
#ifdef POSTPROCESS
|
||||
POSTPROCESS;
|
||||
#endif
|
||||
return status == NSS_STATUS_SUCCESS ? 0 : -1;
|
||||
return status == NSS_STATUS_SUCCESS ? 0 : errno;
|
||||
}
|
||||
|
||||
#define do_weak_alias(n1, n2) weak_alias (n1, (n2))
|
||||
|
@ -85,11 +85,11 @@ GETFUNC_NAME (void)
|
||||
|
||||
while (buffer != NULL
|
||||
&& INTERNAL (REENTRANT_GETNAME) (&resbuf, buffer, buffer_size, &result
|
||||
H_ERRNO_VAR) != 0
|
||||
H_ERRNO_VAR) == ERANGE
|
||||
#ifdef NEED_H_ERRNO
|
||||
&& h_errno == NETDB_INTERNAL
|
||||
#endif
|
||||
&& errno == ERANGE)
|
||||
)
|
||||
{
|
||||
char *new_buf;
|
||||
buffer_size += BUFLEN;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
|
||||
|
||||
@ -228,7 +228,7 @@ INTERNAL (REENTRANT_GETNAME) (LOOKUP_TYPE *resbuf, char *buffer, size_t buflen,
|
||||
{
|
||||
__set_h_errno (NETDB_INTERNAL);
|
||||
*result = NULL;
|
||||
return -1;
|
||||
return errno;
|
||||
}
|
||||
#endif /* need _res */
|
||||
|
||||
@ -288,7 +288,7 @@ INTERNAL (REENTRANT_GETNAME) (LOOKUP_TYPE *resbuf, char *buffer, size_t buflen,
|
||||
__libc_lock_unlock (lock);
|
||||
|
||||
*result = status == NSS_STATUS_SUCCESS ? resbuf : NULL;
|
||||
return status == NSS_STATUS_SUCCESS ? 0 : -1;
|
||||
return status == NSS_STATUS_SUCCESS ? 0 : errno;
|
||||
}
|
||||
#define do_weak_alias(n1, n2) weak_alias (n1, n2)
|
||||
do_weak_alias (INTERNAL (REENTRANT_GETNAME), REENTRANT_GETNAME)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Structure types for pre-termios terminal ioctls. Linux version.
|
||||
Copyright (C) 1996, 1997 Free Software Foundation, Inc.
|
||||
Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@ -66,3 +66,11 @@ struct termio
|
||||
#define N_PPP 3
|
||||
#define N_STRIP 4
|
||||
#define N_AX25 5
|
||||
#define N_X25 6 /* X.25 async */
|
||||
#define N_6PACK 7
|
||||
#define N_MASC 8 /* Mobitex module */
|
||||
#define N_R3964 9 /* Simatic R3964 module */
|
||||
#define N_PROFIBUS_FDL 10 /* Profibus */
|
||||
#define N_IRDA 11 /* Linux IR */
|
||||
#define N_SMSBLOCK 12 /* SMS block mode */
|
||||
#define N_HDLC 13 /* synchronous HDLC */
|
||||
|
Reference in New Issue
Block a user