Updates for NetBSD

This commit is contained in:
Michiel Broek 2002-01-27 12:59:38 +00:00
parent 2e4eb31b7e
commit 7750952ad5
4 changed files with 29 additions and 13 deletions

View File

@ -87,8 +87,12 @@ int main(int argc, char **argv)
#endif
exit(1);
}
if ((setuid(pw->pw_uid) == -1) || (setgid(pw->pw_gid) == -1)) {
perror("Can't setuid() or setgid() to \"mbse\" user");
/*
* Set effective user to mbse.bbs
*/
if ((seteuid(pw->pw_uid) == -1) || (setegid(pw->pw_gid) == -1)) {
perror("Can't seteuid() or setegid() to \"mbse\" user");
#ifdef MEMWATCH
mwTerm();
#endif

View File

@ -66,6 +66,19 @@ int main(int argc, char **argv)
pTTY = calloc(15, sizeof(char));
tty = ttyname(1);
/*
* Find username from the environment
*/
sUnixName[0] = '\0';
if (getenv("LOGNAME") != NULL) {
strcpy(sUnixName, getenv("LOGNAME"));
} else if (getenv("USER") != NULL) {
strcpy(sUnixName, getenv("USER"));
} else {
WriteError("No username in environment");
Quick_Bye(0);
}
/*
* Set the users device to writable by other bbs users, so they
* can send one-line messages
@ -90,7 +103,8 @@ int main(int argc, char **argv)
* Initialize this client with the server.
*/
do_quiet = TRUE;
InitClient(getenv("LOGNAME"), (char *)"mbsebbs", (char *)"Unknown", CFG.logfile, CFG.bbs_loglevel, CFG.error_log);
InitClient(sUnixName, (char *)"mbsebbs", (char *)"Unknown",
CFG.logfile, CFG.bbs_loglevel, CFG.error_log);
IsDoing("Loging in");
Syslog(' ', " ");
@ -102,14 +116,6 @@ int main(int argc, char **argv)
if (!strncmp(p, "none", 4))
Syslog('+', "CALLER %s", p);
sUnixName[0] = '\0';
if (getenv("LOGNAME") != NULL) {
strcpy(sUnixName, getenv("LOGNAME"));
} else {
WriteError("No username in environment");
Quick_Bye(0);
}
/*
* Initialize
*/

View File

@ -215,7 +215,7 @@ void load_maincfg(void)
/*
* New Users
*/
CFG.newuser_access.level = 5;
CFG.newuser_access.level = 20;
CFG.iCapUserName = TRUE;
CFG.iAnsi = TRUE;
CFG.iDataPhone = TRUE;
@ -225,7 +225,7 @@ void load_maincfg(void)
CFG.iLocation = TRUE;
CFG.iHotkeys = TRUE;
CFG.iCapLocation = FALSE;
CFG.AskAddress = FALSE;
CFG.AskAddress = TRUE;
CFG.GiveEmail = TRUE;
/*

View File

@ -195,7 +195,13 @@ int pw_mkdb(char *username)
execl(_PATH_PWD_MKDB, "pwd_mkdb", "-p", tempname, NULL);
} else {
syslog(LOG_WARNING, "updating the database for %s...", username);
#ifdef __FreeBSD__
execl(_PATH_PWD_MKDB, "pwd_mkdb", "-p", "-u", username, tempname, NULL);
#elif __NetBSD__
execl(_PATH_PWD_MKDB, "pwd_mkdb", "-p", tempname, NULL);
#else
#error "Not FreeBSD or NetBSD - don't know what to do"
#endif
}
pw_error((char *)_PATH_PWD_MKDB, 1, 1);
}