system-wide configuration file

Add options SYSCF (to add a system-wide configuration file) and SYSCF_FILE
(for a file-based implementation of SYSCF) - this allows a binary distribution
to be configured at install time.  The only option supported at this time is
WIZARDS - a list of usernames which can use -D; currently only for unix-likes
but should be extendable to anything that has a concept of multiple users.
Add mac tty multiuser config using sgid.
This commit is contained in:
keni
2008-01-09 01:57:41 +00:00
parent 9c3f6f78b9
commit f2d37bac2e
17 changed files with 269 additions and 26 deletions

View File

@@ -128,6 +128,11 @@ char *argv[];
if (!strncmp(argv[1], "-s", 2) && strncmp(argv[1], "-style", 6)) {
#ifdef CHDIR
chdirx(dir,0);
#endif
#ifdef SYSCF
initoptions_init();
read_config_file(SYSCF_FILE, SET_IN_SYS);
initoptions_finish();
#endif
prscore(argc, argv);
exit(EXIT_SUCCESS);
@@ -148,7 +153,11 @@ char *argv[];
#ifdef __linux__
check_linux_console();
#endif
initoptions();
initoptions_init();
#ifdef SYSCF
read_config_file(SYSCF_FILE, SET_IN_SYS);
#endif
initoptions_finish();
exact_username = whoami();
/*
@@ -530,6 +539,22 @@ authorize_wizard_mode()
pw = getpwuid(uid);
}
}
#ifdef SYSCF
if (pw && wizards[0]) {
if(wizards[0] == '*') return TRUE; /*allow any user to be wizard*/
int pwlen = strlen(pw->pw_name);
char *eop = eos(wizards);
char *w = wizards;
while( w+pwlen <= eop ){
if( ! *w ) break;
if( isspace(*w) ){ w++; continue;}
if( !strncmp(w, pw->pw_name, pwlen) ){
if( !w[pwlen] || isspace(w[pwlen]) ) return TRUE;
}
while( *w && !isspace(*w) ) w++;
}
} else
#endif
if (pw && !strcmp(pw->pw_name, WIZARD_NAME)) return TRUE;
#endif /* WIZARD */
return FALSE;