added command argument to mbsetup and added user check

This commit is contained in:
Michiel Broek 2001-10-25 11:14:57 +00:00
parent b74cf42949
commit 9a2f46c324
3 changed files with 49 additions and 15 deletions

View File

@ -4149,6 +4149,12 @@ v0.33.18 27-Jul-2001
When changing the number of newfiles groups, the newfiles
reports database is converted on the fly.
All path variables now have a length of PATH_MAX.
When mbsetup is started, all databases not present are created
and when needed filled with default records.
There is now one possible commandline parameter: init. This
should be used only once (but doesn't hurt if run more then
once) on a new installation.
A check is build in that mbsetup is started by user mbse.
mbcico:
Renamed sendfile function in zmsend.c to sendzfile to prevent a

View File

@ -2,12 +2,12 @@
*
* File ..................: mbsetup.c
* Purpose ...............: Setup Program
* Last modification date : 19-Oct-2001
* Last modification date : 25-Oct-2001
*
*****************************************************************************
* Copyright (C) 1997-2001
*
* Michiel Broek FIDO: 2:280/2801
* Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10
* 1971 BV IJmuiden
* the Netherlands
@ -71,6 +71,7 @@
mode_t oldmask; /* Old umask value */
extern int do_quiet; /* Suppress log to screen */
int exp_golded = FALSE; /* Export GoldED config */
int init = FALSE; /* Run init only */
static void die(int onsig)
@ -80,6 +81,7 @@ static void die(int onsig)
int i;
signal(onsig, SIG_IGN);
if (!init)
screen_stop();
exp_golded = TRUE;
@ -326,11 +328,14 @@ void site_docs(void)
void initdatabases(void)
{
if (!init) {
clr_index();
working(1, 0, 0);
set_color(WHITE, BLACK);
mvprintw( 5, 6, " INIT DATABASES");
IsDoing("Init Databases");
}
config_read();
InitArchive();
@ -357,9 +362,11 @@ void initdatabases(void)
InitUsers();
InitVirus();
if (!init) {
working(0, 0, 0);
clr_index();
}
}
@ -375,7 +382,15 @@ int main(int argc, char *argv[])
/*
* Find out who is on the keyboard or automated the keyboard.
*/
pw = getpwuid(getuid());
pw = getpwuid(geteuid());
if (strcmp(pw->pw_name, (char *)"mbse")) {
printf("ERROR: only user \"mbse\" may use this program\n");
#ifdef MEMWATCH
mwExit();
#endif
exit(1);
}
InitClient(pw->pw_name, (char *)"mbsetup", (char *)"nowhere", (char *)"mbsetup.log", 0x1f, (char *)"error.log");
/*
@ -395,12 +410,19 @@ int main(int argc, char *argv[])
oldmask = umask(002);
if ((argc == 2) && (strncmp(tl(argv[1]), "i", 1) == 0))
init = TRUE;
else
screen_start((char *)"MBsetup");
do_quiet = TRUE;
Syslog(' ', " ");
Syslog(' ', "MBSETUP v%s started by %s", VERSION, pw->pw_name);
if (init)
Syslog('+', "Cmd: mbsetup init");
initdatabases();
if (!init) {
do {
IsDoing("Browsing Menu");
clr_index();
@ -494,6 +516,7 @@ int main(int argc, char *argv[])
break;
}
} while (loop == 1);
}
die(0);
return 0;

View File

@ -2,7 +2,7 @@
*
* File ..................: screen.c
* Purpose ...............: Screen functions for setup.
* Last modification date : 08-Oct-2000
* Last modification date : 25-Oct-2000
*
*****************************************************************************
* Copyright (C) 1997-2000
@ -36,6 +36,8 @@
#include "screen.h"
extern int init;
/*************************************************************************
*
@ -173,6 +175,9 @@ void working(int txno, int y, int x)
{
int i;
if (init)
return;
/*
* If txno not 0 there will be something written. The
* reversed attributes for mono, or white on red for