honor sysconf SHELLERS on VMS

I was looking into adding a confirmation prompt for '!' and it
isn't very promising due to sequencing issues.  (The check for
whether '!' is allowed should happen before the prompt about
running it but the latter should take place in the core rather
than in the port code.)  In the mean time, I noticed that VMS was
ignoring the SHELLERS value from SYSCF.

Untested implementation of a SHELLERS check on VMS.  Even if it
works, it should not be using $USER as the user name to verify.

Tweaks the Unix implementation of check_user_string() but doesn't
switch the testing loop to the simpler version used by VMS which
is derived from the generic users test used by Qt.
This commit is contained in:
PatR
2020-11-15 18:28:20 -08:00
parent 126d1f6bb6
commit 5c291bc540
4 changed files with 65 additions and 16 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 unixmain.c $NHDT-Date: 1596498297 2020/08/03 23:44:57 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.87 $ */
/* NetHack 3.7 unixmain.c $NHDT-Date: 1605493691 2020/11/16 02:28:11 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.90 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2011. */
/* NetHack may be freely redistributed. See license for details. */
@@ -647,11 +647,11 @@ char *name;
boolean
check_user_string(optstr)
char *optstr;
const char *optstr;
{
struct passwd *pw;
int pwlen;
char *eop, *w;
const char *eop, *w;
char *pwname = 0;
if (optstr[0] == '*')
@@ -663,7 +663,7 @@ char *optstr;
if (!pwname || !*pwname)
return FALSE;
pwlen = (int) strlen(pwname);
eop = eos(optstr);
eop = eos((char *) optstr); /* temporarily cast away 'const' */
w = optstr;
while (w + pwlen <= eop) {
if (!*w)

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 unixunix.c $NHDT-Date: 1596498298 2020/08/03 23:44:58 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.31 $ */
/* NetHack 3.7 unixunix.c $NHDT-Date: 1605493693 2020/11/16 02:28:13 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.32 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Kenneth Lorber, Kensington, Maryland, 2015. */
/* NetHack may be freely redistributed. See license for details. */
@@ -271,9 +271,8 @@ dosh()
#ifdef SYSCF
if (!sysopt.shellers || !sysopt.shellers[0]
|| !check_user_string(sysopt.shellers)) {
/* FIXME: should no longer assume a particular command keystroke,
and perhaps ought to say "unavailable" rather than "unknown" */
Norep("Unknown command '!'.");
/* FIXME: should no longer assume a particular command keystroke */
Norep("Unavailable command '!'.");
return 0;
}
#endif