Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-1-5]: src/usr.sbin/rpc.bootparamd Pull up rev. 1.36 (approved by ...



details:   https://anonhg.NetBSD.org/src/rev/e4afd531839c
branches:  netbsd-1-5
changeset: 488944:e4afd531839c
user:      enami <enami%NetBSD.org@localhost>
date:      Mon Aug 07 01:20:20 2000 +0000

description:
Pull up rev. 1.36 (approved by thorpej):
date: 2000/07/20 06:21:51;  author: thorpej;  state: Exp;  lines: +19 -16
If we don't get direct match on the token, only attempt to canonicalize
the token if it does not contain globbing characters, and just skip onto
the next line if it does.
----------------------------
This also includes following important fix (where hp = gethostbyname(word)):
-                               if (fnmatch(word, hp->h_name,
+                               if (strcasecmp(hp->h_name, client) != 0)

diffstat:

 usr.sbin/rpc.bootparamd/bootparamd.c |  35 +++++++++++++++++++----------------
 1 files changed, 19 insertions(+), 16 deletions(-)

diffs (67 lines):

diff -r f476b8a0a71c -r e4afd531839c usr.sbin/rpc.bootparamd/bootparamd.c
--- a/usr.sbin/rpc.bootparamd/bootparamd.c      Mon Aug 07 01:16:34 2000 +0000
+++ b/usr.sbin/rpc.bootparamd/bootparamd.c      Mon Aug 07 01:20:20 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bootparamd.c,v 1.33.2.2 2000/07/05 01:15:25 enami Exp $        */
+/*     $NetBSD: bootparamd.c,v 1.33.2.3 2000/08/07 01:20:20 enami Exp $        */
 
 /*
  * This code is not copyright, and is placed in the public domain.
@@ -11,7 +11,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: bootparamd.c,v 1.33.2.2 2000/07/05 01:15:25 enami Exp $");
+__RCSID("$NetBSD: bootparamd.c,v 1.33.2.3 2000/08/07 01:20:20 enami Exp $");
 #endif
 
 #include <sys/types.h>
@@ -373,31 +373,34 @@
                                else
                                        canon = word;
                        } else {
+                               struct hostent *hp;
                                /*
                                 * If it didn't match, try getting the
                                 * canonical host name of the client
-                                * on this line and comparing that to
-                                * the client we are looking for
+                                * on this line, if it's not a glob,
+                                * and comparing it to the client we
+                                * are looking up.
                                 */
-                               struct hostent *hp = gethostbyname(word);
-                               if (hp == NULL) {
+                               if (HASGLOB(word)) {
+                                       if (debug)
+                                               warnx("Skipping non-match: %s",
+                                                   word);
+                                       continue;
+                               }
+                               if ((hp = gethostbyname(word)) == NULL) {
                                        if (debug)
                                                warnx(
-                                           "Unknown bootparams host %s", word);
+                                           "Unknown bootparams host %s",
+                                           word);
                                        if (dolog)
                                                syslog(LOG_NOTICE,
-                                           "Unknown bootparams host %s", word);
+                                           "Unknown bootparams host %s",
+                                           word);
                                        continue;
                                }
-                               if (fnmatch(word, hp->h_name,
-                                   FNM_CASEFOLD) == 0) {
-                                       /* See above. */
-                                       if (HASGLOB(word))
-                                               canon = hp->h_name;
-                                       else
-                                               canon = word;
-                               } else
+                               if (strcasecmp(hp->h_name, client) != 0)
                                        continue;
+                               canon = hp->h_name;
                        }
 
 #undef HASGLOB



Home | Main Index | Thread Index | Old Index