mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-30 22:43:12 +03:00
Update.
1998-08-21 17:21 Ulrich Drepper <drepper@cygnus.com> * sysdeps/unix/sysv/linux/glob64.c: Define __stat using __xstat64. 1998-08-20 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * Makefile (elf/ldso_install): Put back. The problem still persists. * elf/Makefile (ldso_install): Likewise. 1998-08-20 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * db2/db/db.c (db_open) [_LIBC]: Rename to __nss_db_open and create weak alias. * include/db.h: Declare __nss_db_open. * db2/Versions: Export it. * db2/makedb.c: Convert to use db2 API. * nss/nss_db/db-XXX.c: Likewise. * nss/nss_db/db-netgrp.c: Likewise. * nss/nss_db/db-alias.c: Likewise. (_nss_db_getaliasent_r): Allow retrying with a larger buffer. 1998-08-19 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * sysdeps/unix/sysv/linux/Makefile (sysdep_routines): Remove sys_setresuid, already built automatically (or not). * sysdeps/unix/sysv/linux/syscalls.list: Define __setresuid instead of __syscall_setresuid and add back setresuid. * sysdeps/unix/sysv/linux/seteuid.c: Use __setresuid instead of __syscall_setresuid. 1998-08-21 Andreas Jaeger <aj@arthur.rhein-neckar.de> * sysdeps/unix/sysv/linux/sys/mount.h: Fix typo. * libio/libioP.c (FILEBUF_LITERAL): Also initialize new _offset
This commit is contained in:
37
ChangeLog
37
ChangeLog
@ -1,3 +1,38 @@
|
|||||||
|
1998-08-21 17:21 Ulrich Drepper <drepper@cygnus.com>
|
||||||
|
|
||||||
|
* sysdeps/unix/sysv/linux/glob64.c: Define __stat using __xstat64.
|
||||||
|
|
||||||
|
1998-08-20 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
|
||||||
|
|
||||||
|
* Makefile (elf/ldso_install): Put back. The problem still persists.
|
||||||
|
* elf/Makefile (ldso_install): Likewise.
|
||||||
|
|
||||||
|
1998-08-20 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
|
||||||
|
|
||||||
|
* db2/db/db.c (db_open) [_LIBC]: Rename to __nss_db_open and
|
||||||
|
create weak alias.
|
||||||
|
* include/db.h: Declare __nss_db_open.
|
||||||
|
* db2/Versions: Export it.
|
||||||
|
|
||||||
|
* db2/makedb.c: Convert to use db2 API.
|
||||||
|
* nss/nss_db/db-XXX.c: Likewise.
|
||||||
|
* nss/nss_db/db-netgrp.c: Likewise.
|
||||||
|
* nss/nss_db/db-alias.c: Likewise.
|
||||||
|
(_nss_db_getaliasent_r): Allow retrying with a larger buffer.
|
||||||
|
|
||||||
|
1998-08-19 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
|
||||||
|
|
||||||
|
* sysdeps/unix/sysv/linux/Makefile (sysdep_routines): Remove
|
||||||
|
sys_setresuid, already built automatically (or not).
|
||||||
|
* sysdeps/unix/sysv/linux/syscalls.list: Define __setresuid
|
||||||
|
instead of __syscall_setresuid and add back setresuid.
|
||||||
|
* sysdeps/unix/sysv/linux/seteuid.c: Use __setresuid instead of
|
||||||
|
__syscall_setresuid.
|
||||||
|
|
||||||
|
1998-08-21 Andreas Jaeger <aj@arthur.rhein-neckar.de>
|
||||||
|
|
||||||
|
* sysdeps/unix/sysv/linux/sys/mount.h: Fix typo.
|
||||||
|
|
||||||
1998-08-20 Ulrich Drepper <drepper@cygnus.com>
|
1998-08-20 Ulrich Drepper <drepper@cygnus.com>
|
||||||
|
|
||||||
* elf/Makefile (sh-ldd-rewrite): Remove expression to remove
|
* elf/Makefile (sh-ldd-rewrite): Remove expression to remove
|
||||||
@ -11,7 +46,7 @@
|
|||||||
|
|
||||||
* libio/iolibio.h (_IO_pos_BAD): Define of type _IO_fpos64_t.
|
* libio/iolibio.h (_IO_pos_BAD): Define of type _IO_fpos64_t.
|
||||||
|
|
||||||
* libio/oldfileops.c (FILEBUF_LITERAL): Also initialize new _offset
|
* libio/libioP.c (FILEBUF_LITERAL): Also initialize new _offset
|
||||||
element.
|
element.
|
||||||
|
|
||||||
1998-08-21 Roland McGrath <roland@baalperazim.frob.com>
|
1998-08-21 Roland McGrath <roland@baalperazim.frob.com>
|
||||||
|
12
FAQ
12
FAQ
@ -118,6 +118,8 @@ please let me know.
|
|||||||
3.13. When using the db-2 library which comes with glibc is used in
|
3.13. When using the db-2 library which comes with glibc is used in
|
||||||
the Perl db modules the testsuite is not passed. This did not
|
the Perl db modules the testsuite is not passed. This did not
|
||||||
happen with db-1, gdbm, or ndbm.
|
happen with db-1, gdbm, or ndbm.
|
||||||
|
3.14. The pow() inline function I get when including <math.h> is broken.
|
||||||
|
I get segmentation faults when I run the program.
|
||||||
|
|
||||||
4. Miscellaneous
|
4. Miscellaneous
|
||||||
|
|
||||||
@ -1178,6 +1180,16 @@ Paul Marquess <pmarquess@bfsec.bt.co.uk> acknowledged this change and fixed
|
|||||||
the testsuite so that if you use DB_File v1.60 or later you should not have
|
the testsuite so that if you use DB_File v1.60 or later you should not have
|
||||||
any more problems with db-2.
|
any more problems with db-2.
|
||||||
|
|
||||||
|
|
||||||
|
3.14. The pow() inline function I get when including <math.h> is broken.
|
||||||
|
I get segmentation faults when I run the program.
|
||||||
|
|
||||||
|
{UD} Nope, the implementation is correct. The problem is with egcs version
|
||||||
|
prior to 1.1. I.e., egcs 1.0 to 1.0.3 are all broken (at least on Intel).
|
||||||
|
If you have to use this compiler you must define __NO_MATH_INLINES before
|
||||||
|
including <math.h> to prevent the inline functions from being used. egcs 1.1
|
||||||
|
fixes the problem. I don't know about gcc 2.8 and 2.8.1.
|
||||||
|
|
||||||
|
|
||||||
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
||||||
|
|
||||||
|
9
FAQ.in
9
FAQ.in
@ -1012,6 +1012,15 @@ Paul Marquess <pmarquess@bfsec.bt.co.uk> acknowledged this change and fixed
|
|||||||
the testsuite so that if you use DB_File v1.60 or later you should not have
|
the testsuite so that if you use DB_File v1.60 or later you should not have
|
||||||
any more problems with db-2.
|
any more problems with db-2.
|
||||||
|
|
||||||
|
?? The pow() inline function I get when including <math.h> is broken.
|
||||||
|
I get segmentation faults when I run the program.
|
||||||
|
|
||||||
|
{UD} Nope, the implementation is correct. The problem is with egcs version
|
||||||
|
prior to 1.1. I.e., egcs 1.0 to 1.0.3 are all broken (at least on Intel).
|
||||||
|
If you have to use this compiler you must define __NO_MATH_INLINES before
|
||||||
|
including <math.h> to prevent the inline functions from being used. egcs 1.1
|
||||||
|
fixes the problem. I don't know about gcc 2.8 and 2.8.1.
|
||||||
|
|
||||||
|
|
||||||
? Miscellaneous
|
? Miscellaneous
|
||||||
|
|
||||||
|
7
Makefile
7
Makefile
@ -86,6 +86,13 @@ endif
|
|||||||
# Install from subdirectories too.
|
# Install from subdirectories too.
|
||||||
install: subdir_install
|
install: subdir_install
|
||||||
|
|
||||||
|
# Make sure that the dynamic linker is installed before libc.
|
||||||
|
$(inst_slibdir)/libc-$(version).so: elf/ldso_install
|
||||||
|
|
||||||
|
.PHONY: elf/ldso_install
|
||||||
|
elf/ldso_install:
|
||||||
|
$(MAKE) -C $(@D) $(@F)
|
||||||
|
|
||||||
# Create links for shared libraries using the `ldconfig' program is possible.
|
# Create links for shared libraries using the `ldconfig' program is possible.
|
||||||
# Ignore the error if we cannot update /etc/ld.so.cache.
|
# Ignore the error if we cannot update /etc/ld.so.cache.
|
||||||
ifeq (no,$(cross-compiling))
|
ifeq (no,$(cross-compiling))
|
||||||
|
@ -20,6 +20,9 @@ libdb {
|
|||||||
__memp_dump_region;
|
__memp_dump_region;
|
||||||
__txn_init_print;
|
__txn_init_print;
|
||||||
|
|
||||||
|
# Functions used by other libraries.
|
||||||
|
__nss_db_open;
|
||||||
|
|
||||||
# Constants
|
# Constants
|
||||||
db_rw_conflicts; db_riw_conflicts;
|
db_rw_conflicts; db_riw_conflicts;
|
||||||
|
|
||||||
|
10
db2/db/db.c
10
db2/db/db.c
@ -87,6 +87,11 @@ static int db_fd __P((DB *, int *));
|
|||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef _LIBC
|
||||||
|
#define db_open(fname, type, flags, mode, dbenv, dbinfo, dbpp) \
|
||||||
|
__nss_db_open(fname, type, flags, mode, dbenv, dbinfo, dbpp)
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* db_open --
|
* db_open --
|
||||||
* Main library interface to the DB access methods.
|
* Main library interface to the DB access methods.
|
||||||
@ -691,6 +696,11 @@ err: /* Close the file descriptor. */
|
|||||||
return (ret);
|
return (ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef _LIBC
|
||||||
|
# undef db_open
|
||||||
|
weak_alias (__nss_db_open, db_open)
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* db_close --
|
* db_close --
|
||||||
* Close a DB tree.
|
* Close a DB tree.
|
||||||
|
53
db2/makedb.c
53
db2/makedb.c
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
#include <argp.h>
|
#include <argp.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <db_185.h>
|
#include <db.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <error.h>
|
#include <error.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
@ -140,16 +140,17 @@ main (argc, argv)
|
|||||||
/* Special handling if we are asked to print the database. */
|
/* Special handling if we are asked to print the database. */
|
||||||
if (do_undo)
|
if (do_undo)
|
||||||
{
|
{
|
||||||
db_file = dbopen (input_name, O_RDONLY, 0666, DB_BTREE, NULL);
|
status = db_open (input_name, DB_BTREE, DB_RDONLY, 0666, NULL, NULL,
|
||||||
if (db_file == NULL)
|
&db_file);
|
||||||
|
if (status != 0)
|
||||||
error (EXIT_FAILURE, 0, gettext ("cannot open database file `%s': %s"),
|
error (EXIT_FAILURE, 0, gettext ("cannot open database file `%s': %s"),
|
||||||
input_name,
|
input_name,
|
||||||
errno == EINVAL ? gettext ("incorrectly formatted file")
|
(status == EINVAL ? gettext ("incorrectly formatted file")
|
||||||
: strerror (errno));
|
: strerror (status)));
|
||||||
|
|
||||||
status = print_database (db_file);
|
status = print_database (db_file);
|
||||||
|
|
||||||
db_file->close (db_file);
|
db_file->close (db_file, 0);
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
@ -174,10 +175,10 @@ main (argc, argv)
|
|||||||
|
|
||||||
/* Open output file. This must not be standard output so we don't
|
/* Open output file. This must not be standard output so we don't
|
||||||
handle "-" and "/dev/stdout" special. */
|
handle "-" and "/dev/stdout" special. */
|
||||||
db_file = dbopen (output_name, O_CREAT | O_RDWR | O_TRUNC, mode,
|
status = db_open (output_name, DB_BTREE, DB_CREATE | DB_TRUNCATE, mode,
|
||||||
DB_BTREE, NULL);
|
NULL, NULL, &db_file);
|
||||||
if (db_file == NULL)
|
if (status != 0)
|
||||||
error (EXIT_FAILURE, errno, gettext ("cannot open output file `%s'"),
|
error (EXIT_FAILURE, status, gettext ("cannot open output file `%s'"),
|
||||||
output_name);
|
output_name);
|
||||||
|
|
||||||
/* Start the real work. */
|
/* Start the real work. */
|
||||||
@ -187,7 +188,7 @@ main (argc, argv)
|
|||||||
/* Close files. */
|
/* Close files. */
|
||||||
if (input_file != stdin)
|
if (input_file != stdin)
|
||||||
fclose (input_file);
|
fclose (input_file);
|
||||||
db_file->close (db_file);
|
db_file->close (db_file, 0);
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
@ -307,18 +308,20 @@ process_input (input, inname, output, to_lowercase, be_quiet)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
key.size = cp - (char *) key.data;
|
key.size = cp - (char *) key.data;
|
||||||
|
key.flags = 0;
|
||||||
|
|
||||||
while (isspace (*cp))
|
while (isspace (*cp))
|
||||||
++cp;
|
++cp;
|
||||||
|
|
||||||
val.data = cp;
|
val.data = cp;
|
||||||
val.size = (&line[n] - cp) + 1;
|
val.size = (&line[n] - cp) + 1;
|
||||||
|
val.flags = 0;
|
||||||
|
|
||||||
/* Store the value. */
|
/* Store the value. */
|
||||||
status = output->put (output, &key, &val, R_NOOVERWRITE);
|
status = output->put (output, NULL, &key, &val, DB_NOOVERWRITE);
|
||||||
if (status != 0)
|
if (status != 0)
|
||||||
{
|
{
|
||||||
if (status == 1)
|
if (status == DB_KEYEXIST)
|
||||||
{
|
{
|
||||||
if (!be_quiet)
|
if (!be_quiet)
|
||||||
error_at_line (0, 0, inname, linenr,
|
error_at_line (0, 0, inname, linenr,
|
||||||
@ -328,7 +331,7 @@ process_input (input, inname, output, to_lowercase, be_quiet)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
error (0, errno, gettext ("while writing database file"));
|
error (0, status, gettext ("while writing database file"));
|
||||||
|
|
||||||
status = EXIT_FAILURE;
|
status = EXIT_FAILURE;
|
||||||
|
|
||||||
@ -353,20 +356,30 @@ print_database (db)
|
|||||||
{
|
{
|
||||||
DBT key;
|
DBT key;
|
||||||
DBT val;
|
DBT val;
|
||||||
int no_more;
|
DBC *cursor;
|
||||||
|
int status;
|
||||||
|
|
||||||
no_more = db->seq (db, &key, &val, R_FIRST);
|
status = db->cursor (db, NULL, &cursor);
|
||||||
while (!no_more)
|
if (status != 0)
|
||||||
|
{
|
||||||
|
error (0, status, gettext ("while reading database"));
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
key.flags = 0;
|
||||||
|
val.flags = 0;
|
||||||
|
status = cursor->c_get (cursor, &key, &val, DB_FIRST);
|
||||||
|
while (status == 0)
|
||||||
{
|
{
|
||||||
printf ("%.*s %s\n", (int) key.size, (char *) key.data,
|
printf ("%.*s %s\n", (int) key.size, (char *) key.data,
|
||||||
(char *) val.data);
|
(char *) val.data);
|
||||||
|
|
||||||
no_more = db->seq (db, &key, &val, R_NEXT);
|
status = cursor->c_get (cursor, &key, &val, DB_NEXT);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (no_more == -1)
|
if (status != DB_NOTFOUND)
|
||||||
{
|
{
|
||||||
error (0, errno, gettext ("while reading database"));
|
error (0, status, gettext ("while reading database"));
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,6 +163,10 @@ $(inst_slibdir)/$(rtld-installed-name): \
|
|||||||
$(inst_slibdir)/$(rtld-version-installed-name)
|
$(inst_slibdir)/$(rtld-version-installed-name)
|
||||||
$(make-shlib-link)
|
$(make-shlib-link)
|
||||||
|
|
||||||
|
# Special target called by parent to install just the dynamic linker.
|
||||||
|
.PHONY: ldso_install
|
||||||
|
ldso_install: $(inst_slibdir)/$(rtld-installed-name)
|
||||||
|
|
||||||
|
|
||||||
common-ldd-rewrite = -e 's%@RTLD@%$(slibdir)/$(rtld-installed-name)%g' \
|
common-ldd-rewrite = -e 's%@RTLD@%$(slibdir)/$(rtld-installed-name)%g' \
|
||||||
-e 's%@VERSION@%$(version)%g'
|
-e 's%@VERSION@%$(version)%g'
|
||||||
|
@ -1 +1,5 @@
|
|||||||
#include <db2/db.h>
|
#include <db2/db.h>
|
||||||
|
|
||||||
|
/* Internal interface for NSS. */
|
||||||
|
int __nss_db_open __P((const char *,
|
||||||
|
DBTYPE, u_int32_t, int, DB_ENV *, DB_INFO *, DB **));
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
Boston, MA 02111-1307, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#include <db_185.h>
|
#include <db.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <bits/libc-lock.h>
|
#include <bits/libc-lock.h>
|
||||||
#include "nsswitch.h"
|
#include "nsswitch.h"
|
||||||
@ -60,29 +60,41 @@ static enum nss_status
|
|||||||
internal_setent (int stayopen)
|
internal_setent (int stayopen)
|
||||||
{
|
{
|
||||||
enum nss_status status = NSS_STATUS_SUCCESS;
|
enum nss_status status = NSS_STATUS_SUCCESS;
|
||||||
|
int err;
|
||||||
|
|
||||||
if (db == NULL)
|
if (db == NULL)
|
||||||
{
|
{
|
||||||
db = __dbopen (DBFILE, O_RDONLY, 0, DB_BTREE, NULL);
|
err = __nss_db_open (DBFILE, DB_BTREE, DB_RDONLY, 0, NULL, NULL, &db);
|
||||||
|
|
||||||
if (db == NULL)
|
if (err != 0)
|
||||||
status = errno == EAGAIN ? NSS_STATUS_TRYAGAIN : NSS_STATUS_UNAVAIL;
|
{
|
||||||
|
__set_errno (err);
|
||||||
|
status = err == EAGAIN ? NSS_STATUS_TRYAGAIN : NSS_STATUS_UNAVAIL;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* We have to make sure the file is `closed on exec'. */
|
/* We have to make sure the file is `closed on exec'. */
|
||||||
|
int fd;
|
||||||
int result, flags;
|
int result, flags;
|
||||||
|
|
||||||
result = flags = fcntl ((*db->fd) (db), F_GETFD, 0);
|
err = db->fd (db, &fd);
|
||||||
|
if (err != 0)
|
||||||
|
{
|
||||||
|
__set_errno (err);
|
||||||
|
result = -1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
result = flags = fcntl (fd, F_GETFD, 0);
|
||||||
if (result >= 0)
|
if (result >= 0)
|
||||||
{
|
{
|
||||||
flags |= FD_CLOEXEC;
|
flags |= FD_CLOEXEC;
|
||||||
result = fcntl ((*db->fd) (db), F_SETFD, flags);
|
result = fcntl (fd, F_SETFD, flags);
|
||||||
}
|
}
|
||||||
if (result < 0)
|
if (result < 0)
|
||||||
{
|
{
|
||||||
/* Something went wrong. Close the stream and return a
|
/* Something went wrong. Close the stream and return a
|
||||||
failure. */
|
failure. */
|
||||||
(*db->close) (db);
|
db->close (db, 0);
|
||||||
db = NULL;
|
db = NULL;
|
||||||
status = NSS_STATUS_UNAVAIL;
|
status = NSS_STATUS_UNAVAIL;
|
||||||
}
|
}
|
||||||
@ -122,7 +134,7 @@ internal_endent (void)
|
|||||||
{
|
{
|
||||||
if (db != NULL)
|
if (db != NULL)
|
||||||
{
|
{
|
||||||
(*db->close) (db);
|
db->close (db, 0);
|
||||||
db = NULL;
|
db = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -146,7 +158,7 @@ CONCAT(_nss_db_end,ENTNAME) (void)
|
|||||||
|
|
||||||
/* Do a database lookup for KEY. */
|
/* Do a database lookup for KEY. */
|
||||||
static enum nss_status
|
static enum nss_status
|
||||||
lookup (const DBT *key, struct STRUCTURE *result,
|
lookup (DBT *key, struct STRUCTURE *result,
|
||||||
void *buffer, size_t buflen, int *errnop H_ERRNO_PROTO)
|
void *buffer, size_t buflen, int *errnop H_ERRNO_PROTO)
|
||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
@ -164,17 +176,21 @@ lookup (const DBT *key, struct STRUCTURE *result,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Succeed iff it matches a value that parses correctly. */
|
/* Succeed iff it matches a value that parses correctly. */
|
||||||
err = (*db->get) (db, key, &value, 0);
|
value.flags = 0;
|
||||||
if (err < 0)
|
err = db->get (db, NULL, key, &value, 0);
|
||||||
|
if (err != 0)
|
||||||
{
|
{
|
||||||
*errnop = errno;
|
if (err == DB_NOTFOUND)
|
||||||
H_ERRNO_SET (NETDB_INTERNAL);
|
{
|
||||||
status = NSS_STATUS_UNAVAIL;
|
H_ERRNO_SET (HOST_NOT_FOUND);
|
||||||
}
|
status = NSS_STATUS_NOTFOUND;
|
||||||
else if (err != 0)
|
}
|
||||||
{
|
else
|
||||||
H_ERRNO_SET (HOST_NOT_FOUND);
|
{
|
||||||
status = NSS_STATUS_NOTFOUND;
|
*errnop = err;
|
||||||
|
H_ERRNO_SET (NETDB_INTERNAL);
|
||||||
|
status = NSS_STATUS_UNAVAIL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (buflen < value.size)
|
else if (buflen < value.size)
|
||||||
{
|
{
|
||||||
@ -253,6 +269,7 @@ _nss_db_get##name##_r (proto, \
|
|||||||
const size_t size = (keysize) + 1; \
|
const size_t size = (keysize) + 1; \
|
||||||
key.data = __alloca (size); \
|
key.data = __alloca (size); \
|
||||||
key.size = KEYPRINTF keypattern; \
|
key.size = KEYPRINTF keypattern; \
|
||||||
|
key.flags = 0; \
|
||||||
__libc_lock_lock (lock); \
|
__libc_lock_lock (lock); \
|
||||||
status = lookup (&key, result, buffer, buflen, errnop H_ERRNO_ARG); \
|
status = lookup (&key, result, buffer, buflen, errnop H_ERRNO_ARG); \
|
||||||
__libc_lock_unlock (lock); \
|
__libc_lock_unlock (lock); \
|
||||||
@ -281,6 +298,7 @@ CONCAT(_nss_db_get,ENTNAME_r) (struct STRUCTURE *result, char *buffer,
|
|||||||
do
|
do
|
||||||
{
|
{
|
||||||
key.size = snprintf (key.data = buf, sizeof buf, "0%u", entidx++);
|
key.size = snprintf (key.data = buf, sizeof buf, "0%u", entidx++);
|
||||||
|
key.flags = 0;
|
||||||
status = lookup (&key, result, buffer, buflen, errnop H_ERRNO_ARG);
|
status = lookup (&key, result, buffer, buflen, errnop H_ERRNO_ARG);
|
||||||
if (status == NSS_STATUS_TRYAGAIN
|
if (status == NSS_STATUS_TRYAGAIN
|
||||||
#ifdef NEED_H_ERRNO
|
#ifdef NEED_H_ERRNO
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
#include <aliases.h>
|
#include <aliases.h>
|
||||||
#include <alloca.h>
|
#include <alloca.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <db_185.h>
|
#include <db.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <bits/libc-lock.h>
|
#include <bits/libc-lock.h>
|
||||||
@ -44,29 +44,42 @@ static enum nss_status
|
|||||||
internal_setent (int stayopen)
|
internal_setent (int stayopen)
|
||||||
{
|
{
|
||||||
enum nss_status status = NSS_STATUS_SUCCESS;
|
enum nss_status status = NSS_STATUS_SUCCESS;
|
||||||
|
int err;
|
||||||
|
|
||||||
if (db == NULL)
|
if (db == NULL)
|
||||||
{
|
{
|
||||||
db = __dbopen (_PATH_VARDB "aliases.db", O_RDONLY, 0, DB_BTREE, NULL);
|
err = __nss_db_open (_PATH_VARDB "aliases.db", DB_BTREE, DB_RDONLY, 0,
|
||||||
|
NULL, NULL, &db);
|
||||||
|
|
||||||
if (db == NULL)
|
if (err != 0)
|
||||||
status = NSS_STATUS_UNAVAIL;
|
{
|
||||||
|
__set_errno (err);
|
||||||
|
status = NSS_STATUS_UNAVAIL;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* We have to make sure the file is `closed on exec'. */
|
/* We have to make sure the file is `closed on exec'. */
|
||||||
|
int fd;
|
||||||
int result, flags;
|
int result, flags;
|
||||||
|
|
||||||
result = flags = fcntl ((*db->fd) (db), F_GETFD, 0);
|
err = db->fd (db, &fd);
|
||||||
|
if (err != 0)
|
||||||
|
{
|
||||||
|
__set_errno (err);
|
||||||
|
result = -1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
result = flags = fcntl (fd, F_GETFD, 0);
|
||||||
if (result >= 0)
|
if (result >= 0)
|
||||||
{
|
{
|
||||||
flags |= FD_CLOEXEC;
|
flags |= FD_CLOEXEC;
|
||||||
result = fcntl ((*db->fd) (db), F_SETFD, flags);
|
result = fcntl (fd, F_SETFD, flags);
|
||||||
}
|
}
|
||||||
if (result < 0)
|
if (result < 0)
|
||||||
{
|
{
|
||||||
/* Something went wrong. Close the stream and return a
|
/* Something went wrong. Close the stream and return a
|
||||||
failure. */
|
failure. */
|
||||||
(*db->close) (db);
|
db->close (db, 0);
|
||||||
db = NULL;
|
db = NULL;
|
||||||
status = NSS_STATUS_UNAVAIL;
|
status = NSS_STATUS_UNAVAIL;
|
||||||
}
|
}
|
||||||
@ -106,7 +119,7 @@ internal_endent (void)
|
|||||||
{
|
{
|
||||||
if (db != NULL)
|
if (db != NULL)
|
||||||
{
|
{
|
||||||
(*db->close) (db);
|
db->close (db, 0);
|
||||||
db = NULL;
|
db = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -133,7 +146,7 @@ _nss_db_endaliasent (void)
|
|||||||
:include: statements so we simply have to parse the list and store
|
:include: statements so we simply have to parse the list and store
|
||||||
the result. */
|
the result. */
|
||||||
static enum nss_status
|
static enum nss_status
|
||||||
lookup (const DBT *key, struct aliasent *result, char *buffer,
|
lookup (DBT *key, struct aliasent *result, char *buffer,
|
||||||
size_t buflen, int *errnop)
|
size_t buflen, int *errnop)
|
||||||
{
|
{
|
||||||
enum nss_status status;
|
enum nss_status status;
|
||||||
@ -142,9 +155,13 @@ lookup (const DBT *key, struct aliasent *result, char *buffer,
|
|||||||
/* Open the database. */
|
/* Open the database. */
|
||||||
status = internal_setent (keep_db);
|
status = internal_setent (keep_db);
|
||||||
if (status != NSS_STATUS_SUCCESS)
|
if (status != NSS_STATUS_SUCCESS)
|
||||||
return status;
|
{
|
||||||
|
*errnop = errno;
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
if ((*db->get) (db, key, &value, 0) == 0)
|
value.flags = 0;
|
||||||
|
if (db->get (db, NULL, key, &value, 0) == 0)
|
||||||
{
|
{
|
||||||
const char *src = value.data;
|
const char *src = value.data;
|
||||||
|
|
||||||
@ -228,7 +245,11 @@ _nss_db_getaliasent_r (struct aliasent *result, char *buffer, size_t buflen,
|
|||||||
|
|
||||||
__libc_lock_lock (lock);
|
__libc_lock_lock (lock);
|
||||||
key.size = snprintf (key.data = buf, sizeof buf, "0%u", entidx++);
|
key.size = snprintf (key.data = buf, sizeof buf, "0%u", entidx++);
|
||||||
|
key.flags = 0;
|
||||||
status = lookup (&key, result, buffer, buflen, errnop);
|
status = lookup (&key, result, buffer, buflen, errnop);
|
||||||
|
if (status == NSS_STATUS_TRYAGAIN && *errnop == ERANGE)
|
||||||
|
/* Give the user a chance to get the same entry with a larger buffer. */
|
||||||
|
--entidx;
|
||||||
__libc_lock_unlock (lock);
|
__libc_lock_unlock (lock);
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
@ -247,6 +268,7 @@ _nss_db_getaliasbyname_r (const char *name, struct aliasent *result,
|
|||||||
key.data = __alloca (key.size);
|
key.data = __alloca (key.size);
|
||||||
((char *) key.data)[0] = '.';
|
((char *) key.data)[0] = '.';
|
||||||
memcpy (&((char *) key.data)[1], name, key.size - 1);
|
memcpy (&((char *) key.data)[1], name, key.size - 1);
|
||||||
|
key.flags = 0;
|
||||||
|
|
||||||
__libc_lock_lock (lock);
|
__libc_lock_lock (lock);
|
||||||
status = lookup (&key, result, buffer, buflen, errnop);
|
status = lookup (&key, result, buffer, buflen, errnop);
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
Boston, MA 02111-1307, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#include <db_185.h>
|
#include <db.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -43,32 +43,44 @@ enum nss_status
|
|||||||
_nss_db_setnetgrent (const char *group)
|
_nss_db_setnetgrent (const char *group)
|
||||||
{
|
{
|
||||||
enum nss_status status = NSS_STATUS_SUCCESS;
|
enum nss_status status = NSS_STATUS_SUCCESS;
|
||||||
|
int err;
|
||||||
|
|
||||||
__libc_lock_lock (lock);
|
__libc_lock_lock (lock);
|
||||||
|
|
||||||
/* Make sure the data base file is open. */
|
/* Make sure the data base file is open. */
|
||||||
if (db == NULL)
|
if (db == NULL)
|
||||||
{
|
{
|
||||||
db = __dbopen (DBFILE, O_RDONLY, 0, DB_BTREE, NULL);
|
err = __nss_db_open (DBFILE, DB_BTREE, O_RDONLY, 0, NULL, NULL, &db);
|
||||||
|
|
||||||
if (db == NULL)
|
if (err != 0)
|
||||||
status = errno == EAGAIN ? NSS_STATUS_TRYAGAIN : NSS_STATUS_UNAVAIL;
|
{
|
||||||
|
__set_errno (err);
|
||||||
|
status = err == EAGAIN ? NSS_STATUS_TRYAGAIN : NSS_STATUS_UNAVAIL;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* We have to make sure the file is `closed on exec'. */
|
/* We have to make sure the file is `closed on exec'. */
|
||||||
|
int fd;
|
||||||
int result, flags;
|
int result, flags;
|
||||||
|
|
||||||
result = flags = fcntl ((*db->fd) (db), F_GETFD, 0);
|
err = db->fd (db, &fd);
|
||||||
|
if (err != 0)
|
||||||
|
{
|
||||||
|
__set_errno (err);
|
||||||
|
result = -1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
result = flags = fcntl (fd, F_GETFD, 0);
|
||||||
if (result >= 0)
|
if (result >= 0)
|
||||||
{
|
{
|
||||||
flags |= FD_CLOEXEC;
|
flags |= FD_CLOEXEC;
|
||||||
result = fcntl ((*db->fd) (db), F_SETFD, flags);
|
result = fcntl (fd, F_SETFD, flags);
|
||||||
}
|
}
|
||||||
if (result < 0)
|
if (result < 0)
|
||||||
{
|
{
|
||||||
/* Something went wrong. Close the stream and return a
|
/* Something went wrong. Close the stream and return a
|
||||||
failure. */
|
failure. */
|
||||||
(*db->close) (db);
|
db->close (db, 0);
|
||||||
db = NULL;
|
db = NULL;
|
||||||
status = NSS_STATUS_UNAVAIL;
|
status = NSS_STATUS_UNAVAIL;
|
||||||
}
|
}
|
||||||
@ -77,10 +89,11 @@ _nss_db_setnetgrent (const char *group)
|
|||||||
|
|
||||||
if (status == NSS_STATUS_SUCCESS)
|
if (status == NSS_STATUS_SUCCESS)
|
||||||
{
|
{
|
||||||
DBT key = { data: (void *) group, size: strlen (group) };
|
DBT key = { data: (void *) group, size: strlen (group), flags: 0 };
|
||||||
DBT value;
|
DBT value;
|
||||||
|
|
||||||
if ((*db->get) (db, &key, &value, 0) != 0)
|
value.flags = 0;
|
||||||
|
if (db->get (db, NULL, &key, &value, 0) != 0)
|
||||||
status = NSS_STATUS_NOTFOUND;
|
status = NSS_STATUS_NOTFOUND;
|
||||||
else
|
else
|
||||||
cursor = entry = value.data;
|
cursor = entry = value.data;
|
||||||
@ -100,7 +113,7 @@ _nss_db_endnetgrent (void)
|
|||||||
|
|
||||||
if (db != NULL)
|
if (db != NULL)
|
||||||
{
|
{
|
||||||
(*db->close) (db);
|
db->close (db, 0);
|
||||||
db = NULL;
|
db = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,8 +9,7 @@ CPPFLAGS += -DHAVE_LLSEEK=1
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(subdir),misc)
|
ifeq ($(subdir),misc)
|
||||||
sysdep_routines += sysctl clone llseek getresuid getresgid sys_setresuid \
|
sysdep_routines += sysctl clone llseek getresuid getresgid umount umount2
|
||||||
umount umount2
|
|
||||||
|
|
||||||
sysdep_headers += sys/mount.h sys/acct.h sys/sysctl.h sys/mtio.h \
|
sysdep_headers += sys/mount.h sys/acct.h sys/sysctl.h sys/mtio.h \
|
||||||
sys/io.h sys/klog.h sys/kdaemon.h \
|
sys/io.h sys/klog.h sys/kdaemon.h \
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
#undef stat
|
#undef stat
|
||||||
#define stat stat64
|
#define stat stat64
|
||||||
#undef __stat
|
#undef __stat
|
||||||
#define __stat(file, buf) stat64 (file, buf)
|
#define __stat(file, buf) __xstat64 (_STAT_VER, file, buf)
|
||||||
|
|
||||||
#define NO_GLOB_PATTERN_P 1
|
#define NO_GLOB_PATTERN_P 1
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
#ifdef __NR_setresuid
|
#ifdef __NR_setresuid
|
||||||
|
|
||||||
extern int __syscall_setresuid (uid_t ruid, uid_t euid, uid_t suid);
|
extern int __setresuid (uid_t ruid, uid_t euid, uid_t suid);
|
||||||
|
|
||||||
int
|
int
|
||||||
seteuid (uid_t uid)
|
seteuid (uid_t uid)
|
||||||
@ -37,7 +37,7 @@ seteuid (uid_t uid)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* First try the syscall. */
|
/* First try the syscall. */
|
||||||
result = __syscall_setresuid (-1, uid, -1);
|
result = __setresuid (-1, uid, -1);
|
||||||
if (result == -1 && errno == ENOSYS)
|
if (result == -1 && errno == ENOSYS)
|
||||||
/* No system call available. Use emulation. This may not work
|
/* No system call available. Use emulation. This may not work
|
||||||
since `setreuid' also sets the saved user ID when UID is not
|
since `setreuid' also sets the saved user ID when UID is not
|
||||||
|
@ -96,7 +96,7 @@ extern int mount __P ((__const char *__special_file, __const char *__dir,
|
|||||||
/* Unmount a filesystem. */
|
/* Unmount a filesystem. */
|
||||||
extern int umount __P ((__const char *__special_file));
|
extern int umount __P ((__const char *__special_file));
|
||||||
|
|
||||||
/* Unmount a filesystem. Forst unmounting if FALGS is set to MNT_FORCE. */
|
/* Unmount a filesystem. Force unmounting if FLAGS is set to MNT_FORCE. */
|
||||||
extern int umount2 __P ((__const char *__special_file, int __flags));
|
extern int umount2 __P ((__const char *__special_file, int __flags));
|
||||||
|
|
||||||
__END_DECLS
|
__END_DECLS
|
||||||
|
@ -71,13 +71,13 @@ sendfile EXTRA sendfile 4 sendfile
|
|||||||
setfsgid EXTRA setfsgid 1 setfsgid
|
setfsgid EXTRA setfsgid 1 setfsgid
|
||||||
setfsuid EXTRA setfsuid 1 setfsuid
|
setfsuid EXTRA setfsuid 1 setfsuid
|
||||||
setpgid - setpgid 2 __setpgid setpgid
|
setpgid - setpgid 2 __setpgid setpgid
|
||||||
|
setresuid EXTRA setresuid 3 __setresuid setresuid
|
||||||
setresgid EXTRA setresgid 3 setresgid
|
setresgid EXTRA setresgid 3 setresgid
|
||||||
sigaltstack - sigaltstack 2 __sigaltstack sigaltstack
|
sigaltstack - sigaltstack 2 __sigaltstack sigaltstack
|
||||||
sys_fstat fxstat fstat 2 __syscall_fstat
|
sys_fstat fxstat fstat 2 __syscall_fstat
|
||||||
sys_lstat lxstat lstat 2 __syscall_lstat
|
sys_lstat lxstat lstat 2 __syscall_lstat
|
||||||
sys_mknod xmknod mknod 3 __syscall_mknod
|
sys_mknod xmknod mknod 3 __syscall_mknod
|
||||||
sys_readv readv readv 3 __syscall_readv
|
sys_readv readv readv 3 __syscall_readv
|
||||||
sys_setresuid EXTRA setresuid 3 __syscall_setresuid
|
|
||||||
sys_stat xstat stat 2 __syscall_stat
|
sys_stat xstat stat 2 __syscall_stat
|
||||||
sys_writev writev writev 3 __syscall_writev
|
sys_writev writev writev 3 __syscall_writev
|
||||||
sysinfo EXTRA sysinfo 1 sysinfo
|
sysinfo EXTRA sysinfo 1 sysinfo
|
||||||
|
Reference in New Issue
Block a user