From 1bc21e7a70eb9f1f69c179bb251e612c7aecd655 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Tue, 28 Jul 1998 20:47:08 +0000 Subject: [PATCH] Update. * resolv/nss_dns/dns-host.c (getanswer_r): Lower the priority of warnings when DNSSEC related records are received. * resolv/gethnamaddr.c (getanswer): Likewise. Patch by Brian Wellington . * signal/signal.h: Add prototype for sysv_signal. * math/libm-test.c (tgamma_test): Remove redundant tests. * posix/glob.h: Add GLOB_TILDE_CHECK. * sysdeps/generic/glob.c: Implement GLOB_TILDE_CHECK. * posix/globtest.c: Add option T to enable GLOB_TILDE_CHECK. * posix/globtest.sh: Re-enable test with ~ and non-existing user name. --- ChangeLog | 14 ++++++++++++-- io/sys/statfs.h | 4 ++-- io/sys/statvfs.h | 4 ++-- manual/pattern.texi | 21 ++++++++++++++++++++- posix/glob.h | 4 +++- posix/globtest.c | 5 ++++- posix/globtest.sh | 12 ++++++------ resolv/gethnamaddr.c | 12 ++++++++++++ resolv/nss_dns/dns-host.c | 10 ++++++++++ signal/signal.h | 3 +++ sysdeps/generic/glob.c | 14 +++++++++++--- 11 files changed, 85 insertions(+), 18 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3ada154100..70eeb0ecb3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,8 +1,13 @@ 1998-07-28 Ulrich Drepper - * math/libm-test.c (tgamma_test): Remove redundant tests. + * resolv/nss_dns/dns-host.c (getanswer_r): Lower the priority of + warnings when DNSSEC related records are received. + * resolv/gethnamaddr.c (getanswer): Likewise. + Patch by Brian Wellington . -1998-07-28 16:20 Ulrich Drepper + * signal/signal.h: Add prototype for sysv_signal. + + * math/libm-test.c (tgamma_test): Remove redundant tests. * sysdeps/generic/glob.c: Correct problems with */foo and GLOB_NOCHECK where foo does not exist in any of the subdirectories. @@ -10,6 +15,11 @@ * posix/globtest.sh: Add test for this bug. + * posix/glob.h: Add GLOB_TILDE_CHECK. + * sysdeps/generic/glob.c: Implement GLOB_TILDE_CHECK. + * posix/globtest.c: Add option T to enable GLOB_TILDE_CHECK. + * posix/globtest.sh: Re-enable test with ~ and non-existing user name. + 1998-07-28 Mark Kettenis * io/sys/statfs.h: Fix typos. diff --git a/io/sys/statfs.h b/io/sys/statfs.h index 6d9d00f92f..436668b590 100644 --- a/io/sys/statfs.h +++ b/io/sys/statfs.h @@ -1,5 +1,5 @@ /* Definitions for getting information about a filesystem. - Copyright (C) 1996, 1997 Free Software Foundation, Inc. + Copyright (C) 1996, 1997, 1998 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 @@ -53,7 +53,7 @@ extern int fstatfs __P ((int __fildes, struct statfs *__buf)); extern int __REDIRECT (fstatfs, __P ((int __fildes, struct statfs *__buf)), fstatfs64); # else -# define statfs statfs64 +# define fstatfs fstatfs64 # endif #endif #ifdef __USE_LARGEFILE64 diff --git a/io/sys/statvfs.h b/io/sys/statvfs.h index 856d3c93ca..73a2fa7df7 100644 --- a/io/sys/statvfs.h +++ b/io/sys/statvfs.h @@ -37,7 +37,7 @@ extern int __REDIRECT (statvfs, __P ((__const char *__file, struct statvfs *__buf)), statvfs64); # else -# define statfs statfs64 +# define statvfs statvfs64 # endif #endif #ifdef __USE_LARGEFILE64 @@ -54,7 +54,7 @@ extern int fstatvfs __P ((int __fildes, struct statvfs *__buf)); extern int __REDIRECT (fstatvfs, __P ((int __fildes, struct statvfs *__buf)), fstatvfs64); # else -# define statfs statfs64 +# define fstatvfs fstatvfs64 # endif #endif #ifdef __USE_LARGEFILE64 diff --git a/manual/pattern.texi b/manual/pattern.texi index 24e8e4c612..f2c3f8e584 100644 --- a/manual/pattern.texi +++ b/manual/pattern.texi @@ -466,7 +466,26 @@ user name after the tilde character. So the contents of user glob ("~homer/bin/*", GLOB_TILDE, NULL, &result) @end smallexample -This functionality is equivalent to what is available in C-shells. +If the user name is not valid or the home directory cannot be determined +for some reason the pattern is left untouched and itself used as the +result. I.e., if in the last example @code{home} is not available the +tilde expansion yields to @code{"~homer/bin/*"} and @code{glob} is not +looking for a directory named @code{~homer}. + +This functionality is equivalent to what is available in C-shells if the +@code{nonomatch} flag is set. + +@comment glob.h +@comment GNU +@item GLOB_TILDE_CHECK +If this flag is used @code{glob} behaves like as if @code{GLOB_TILDE} is +given. The only difference is that if the user name is not available or +the home directory cannot be determined for other reasons this leads to +an error. @code{glob} will return @code{GLOB_NOMATCH} instead of using +the pattern itself as the name. + +This funcationality is equivalent to what is available in C-shells if +@code{nonomatch} flag is not set. @comment glob.h @comment GNU diff --git a/posix/glob.h b/posix/glob.h index 91d95494e7..da719c2a45 100644 --- a/posix/glob.h +++ b/posix/glob.h @@ -61,10 +61,12 @@ extern "C" { # define GLOB_NOMAGIC (1 << 11)/* If no magic chars, return the pattern. */ # define GLOB_TILDE (1 << 12)/* Expand ~user and ~ to home directories. */ # define GLOB_ONLYDIR (1 << 13)/* Match only directories. */ +# define GLOB_TILDE_CHECK (1 << 14)/* Like GLOB_TILDE but return an error + if the user name is not available. */ # define __GLOB_FLAGS (GLOB_ERR|GLOB_MARK|GLOB_NOSORT|GLOB_DOOFFS| \ GLOB_NOESCAPE|GLOB_NOCHECK|GLOB_APPEND| \ GLOB_PERIOD|GLOB_ALTDIRFUNC|GLOB_BRACE| \ - GLOB_NOMAGIC|GLOB_TILDE|GLOB_ONLYDIR) + GLOB_NOMAGIC|GLOB_TILDE|GLOB_ONLYDIR|GLOB_TILDE_CHECK) #else # define __GLOB_FLAGS (GLOB_ERR|GLOB_MARK|GLOB_NOSORT|GLOB_DOOFFS| \ GLOB_NOESCAPE|GLOB_NOCHECK|GLOB_APPEND| \ diff --git a/posix/globtest.c b/posix/globtest.c index 37b1fd07e9..970d90a31c 100644 --- a/posix/globtest.c +++ b/posix/globtest.c @@ -29,7 +29,7 @@ main (int argc, char *argv[]) glob_t g; int quotes = 1; - while ((i = getopt (argc, argv, "bcdegmopqst")) != -1) + while ((i = getopt (argc, argv, "bcdegmopqstT")) != -1) switch(i) { case 'b': @@ -66,6 +66,9 @@ main (int argc, char *argv[]) case 't': glob_flags |= GLOB_TILDE; break; + case 'T': + glob_flags |= GLOB_TILDE_CHECK; + break; default: exit (-1); } diff --git a/posix/globtest.sh b/posix/globtest.sh index ba41fc4896..12635b76d9 100755 --- a/posix/globtest.sh +++ b/posix/globtest.sh @@ -215,12 +215,12 @@ eval echo ~$USER > $testout2 cmp $testout2 $testout || result=1 # Tilde expansion shouldn't match a file -#${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \ -#${common_objpfx}posix/globtest -t "$testdir" "~file4" | -#sort > $testout -#cat <<"EOF" | cmp - $testout || result=1 -#GLOB_NOMATCH -#EOF +${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \ +${common_objpfx}posix/globtest -T "$testdir" "~file4" | +sort > $testout +cat <<"EOF" | cmp - $testout || result=1 +GLOB_NOMATCH +EOF # Matching \** should only find *file6 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \ diff --git a/resolv/gethnamaddr.c b/resolv/gethnamaddr.c index 3272dbd591..16d7509f23 100644 --- a/resolv/gethnamaddr.c +++ b/resolv/gethnamaddr.c @@ -333,6 +333,18 @@ getanswer(answer, anslen, qname, qtype) buflen -= n; continue; } + if ((type == T_SIG) || (type == T_KEY) || (type == T_NXT)) { + /* We don't support DNSSEC yet. For now, ignore + * the record and send a low priority message + * to syslog. + */ + syslog(LOG_DEBUG|LOG_AUTH, + "gethostby*.getanswer: asked for \"%s %s %s\", got type \"%s\"", + qname, p_class(C_IN), p_type(qtype), + p_type(type)); + cp += n; + continue; + } if (type != qtype) { syslog(LOG_NOTICE|LOG_AUTH, "gethostby*.getanswer: asked for \"%s %s %s\", got type \"%s\"", diff --git a/resolv/nss_dns/dns-host.c b/resolv/nss_dns/dns-host.c index f8345bb591..ed4be67337 100644 --- a/resolv/nss_dns/dns-host.c +++ b/resolv/nss_dns/dns-host.c @@ -456,6 +456,16 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype, linebuflen -= n; continue; } + if (type == T_SIG || type == T_KEY || type == T_NXT) + { + /* We don't support DNSSEC yet. For now, ignore the record + and send a low priority message to syslog. */ + syslog (LOG_DEBUG | LOG_AUTH, + "gethostby*.getanswer: asked for \"%s %s %s\", got type \"%s\"", + qname, p_class (C_IN), p_type(qtype), p_type (type)); + cp += n; + continue; + } if (type != qtype) { syslog (LOG_NOTICE | LOG_AUTH, diff --git a/signal/signal.h b/signal/signal.h index 5d63375947..8a37dde0c1 100644 --- a/signal/signal.h +++ b/signal/signal.h @@ -58,6 +58,9 @@ typedef void (*__sighandler_t) __PMT ((int)); requested. */ extern __sighandler_t __sysv_signal __P ((int __sig, __sighandler_t __handler)); +#ifdef __USE_GNU +extern __sighandler_t sysv_signal __P ((int __sig, __sighandler_t __handler)); +#endif /* Set the handler for the signal SIG to HANDLER, returning the old handler, or SIG_ERR on error. diff --git a/sysdeps/generic/glob.c b/sysdeps/generic/glob.c index c9744fc46f..f54c3b3d21 100644 --- a/sysdeps/generic/glob.c +++ b/sysdeps/generic/glob.c @@ -493,7 +493,7 @@ glob (pattern, flags, errfunc, pglob) { /* This can mean two things: a simple name or "~name". The later case is nothing but a notation for a directory. */ - if ((flags & GLOB_TILDE) && pattern[0] == '~') + if ((flags & (GLOB_TILDE|GLOB_TILDE_CHECK)) && pattern[0] == '~') { dirname = (char *) pattern; dirlen = strlen (pattern); @@ -553,7 +553,7 @@ glob (pattern, flags, errfunc, pglob) oldcount = pglob->gl_pathc; #ifndef VMS - if ((flags & GLOB_TILDE) && dirname[0] == '~') + if ((flags & (GLOB_TILDE|GLOB_TILDE_CHECK)) && dirname[0] == '~') { if (dirname[1] == '\0' || dirname[1] == '/') { @@ -608,7 +608,10 @@ glob (pattern, flags, errfunc, pglob) } } if (home_dir == NULL || home_dir[0] == '\0') - home_dir = (char *) "~"; /* No luck. */ + if (flags & GLOB_TILDE_CHECK) + return GLOB_NOMATCH; + else + home_dir = (char *) "~"; /* No luck. */ # endif /* WINDOWS32 */ # endif /* Now construct the full directory. */ @@ -685,6 +688,11 @@ glob (pattern, flags, errfunc, pglob) # endif dirname = newp; } + else + if (flags & GLOB_TILDE_CHECK) + /* We have to regard it as an error if we cannot find the + home directory. */ + return GLOB_NOMATCH; } # endif /* Not Amiga && not WINDOWS32. */ } -- 2.11.4.GIT