diff --git a/ChangeLog b/ChangeLog index 6fb2c57..6a1b4ac 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,9 +1,12 @@ 2022-06-07 Richard Frith-Macdonald * GNUMakefile: Fix to supply local flags to build libraries - * EcConsole.m: Use the EffectiveUser default or the name of the - user running the process as the default name to login with. - The user is still allowed to enter a name at the Login prompt. + * EcConsole.m: Add EC_LOGIN_NAME define set to 1 to permit the + entry of a login name with a 'Login' prompt. + Use the EffectiveUser default or the name of the user running the + process as the default name to login with. + If EC_LOGIN_NAME is not set then the name of the user running the + process is used unconditionally. 2022-02-28 Richard Frith-Macdonald diff --git a/EcConsole.m b/EcConsole.m index c5bc183..b86938f 100644 --- a/EcConsole.m +++ b/EcConsole.m @@ -1052,7 +1052,12 @@ consoleCompleter(const char *text, int start, int end) NSString *u; NSString *p; NSString *reject; - char buf[128], *line; + char buf[128], *line = buf; + +#if !defined(EC_LOGIN_NAME) +#define EC_LOGIN_NAME 0 +#endif +#if EC_LOGIN_NAME if (nil == (u = [[self cmdDefaults] stringForKey: @"EffectiveUser"])) { @@ -1090,6 +1095,9 @@ consoleCompleter(const char *text, int start, int end) continue; } } +#else + u = originalUserName; +#endif if ([u caseInsensitiveCompare: @"quit"] == NSOrderedSame) { diff --git a/local.make b/local.make index aaead83..3b0b20e 100644 --- a/local.make +++ b/local.make @@ -36,8 +36,12 @@ Command_CPPFLAGS += \ # Allow an alternative base class to be specified ... # The file containing that class will also need to be added to the build/link # flags if it's not in the standard libraries. +# The EC_LOGIN_NAME flag allows login via the Console to be done by name given +# at a login prompt. If this is not set the name of the owner of the Console +# process is used. Console_CPPFLAGS += \ '-DEC_BASE_CLASS=EcConsole'\ + '-DEC_LOGIN_NAME=1'\ # Control_CPPFLAGS ... # Allow an alternative base class to be specified ...