add option to force login name to be system account name

This commit is contained in:
Richard Frith-Macdonald 2022-06-07 12:33:01 +01:00
parent 2ce70c02e3
commit 0194f1d5bf
3 changed files with 19 additions and 4 deletions

View file

@ -1,9 +1,12 @@
2022-06-07 Richard Frith-Macdonald <rfm@gnu.org>
* 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 <rfm@gnu.org>

View file

@ -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)
{

View file

@ -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 ...