From 56df3dd851f0f7493ab7b2a1ce0575a336e6e494 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Mon, 11 Mar 1996 01:15:08 +0000 Subject: [PATCH] now uses shost if FQDN --- parse.yacc | 17 ++++++++++------- visudo.c | 3 +++ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/parse.yacc b/parse.yacc index cd1740e0b..f06a71d7f 100644 --- a/parse.yacc +++ b/parse.yacc @@ -51,13 +51,17 @@ static char rcsid[] = "$Id$"; #include #endif /* HAVE_LSEARCH */ -#include "sudo.h" #include +#include "sudo.h" #ifndef HAVE_LSEARCH #include "emul/search.h" #endif /* HAVE_LSEARCH */ +#ifndef HAVE_STRCASECMP +#define strcasecmp(a,b) strcmp(a,b) +#endif /* !HAVE_STRCASECMP */ + extern int sudolineno, parse_error; int errorlineno = -1; int clearaliases = 1; @@ -195,7 +199,11 @@ hostspec : ALL { (void) free($1); } | NAME { - if (strcmp(host, $1) == 0) +#ifdef FQDN + if (strcasecmp(shost, $1) == 0) +#else + if (strcasecmp(host, $1) == 0) +#endif /* FQDN */ host_matches = TRUE; (void) free($1); } @@ -205,13 +213,8 @@ hostspec : ALL { (void) free($1); } | fqdn { -#ifdef HAVE_STRCASECMP if (strcasecmp($1, host) == 0) host_matches = TRUE; -#else - if (strcmp($1, host) == 0) - host_matches = TRUE; -#endif /* HAVE_STRCASECMP */ (void) free($1); } ; diff --git a/visudo.c b/visudo.c index 1dcf11484..31f4fdf48 100644 --- a/visudo.c +++ b/visudo.c @@ -110,6 +110,9 @@ int parse_error = FALSE; * For the parsing routines */ char host[] = ""; +#ifdef FQDN +char shost[] = ""; +#endif /* FQDN */ char *cmnd = ""; struct passwd *user_pw_ent; -- 2.49.0