Fixes for mbtask

This commit is contained in:
Michiel Broek 2003-01-27 21:55:42 +00:00
parent d200e2c1b4
commit 8c5034f00f
4 changed files with 164 additions and 144 deletions

View File

@ -29,6 +29,9 @@ v0.37.01 14-Jan-2003.
Fixed a bug where one of the nodelists was node closed with Fixed a bug where one of the nodelists was node closed with
each outbound scan and was causing mbtask to stop functioning each outbound scan and was causing mbtask to stop functioning
after a few days. after a few days.
After forking the daemon, the stdin, stdout and stderr are
reopend to /dev/null.
Zero the daily status counters finally works again.
mbfile: mbfile:
In the import function several bugfixes for reading files.bbs. In the import function several bugfixes for reading files.bbs.

4
TODO
View File

@ -93,6 +93,10 @@ mbfido:
N: Let mbfido areas with a special switch update area descriptions. N: Let mbfido areas with a special switch update area descriptions.
N: Send rulefile via netmail for each new connected mail area.
N: Send notifications to downlinks about changed areas from uplink.
mbcico: mbcico:
N: Implement MD5 crypt in binkp protocol driver. N: Implement MD5 crypt in binkp protocol driver.

View File

@ -1290,13 +1290,13 @@ int main(int argc, char **argv)
pw = getpwnam((char *)"mbse"); pw = getpwnam((char *)"mbse");
if (setuid(pw->pw_uid)) { if (setuid(pw->pw_uid)) {
perror(""); perror("");
printf("can't setuid to mbse\n"); fprintf(stderr, "can't setuid to mbse\n");
close(ping_isocket); close(ping_isocket);
exit(MBERR_INIT_ERROR); exit(MBERR_INIT_ERROR);
} }
if (setgid(pw->pw_gid)) { if (setgid(pw->pw_gid)) {
perror(""); perror("");
printf("can't setgid to bbs\n"); fprintf(stderr, "can't setgid to bbs\n");
close(ping_isocket); close(ping_isocket);
exit(MBERR_INIT_ERROR); exit(MBERR_INIT_ERROR);
} }
@ -1356,8 +1356,20 @@ int main(int argc, char **argv)
* Starting the deamon child process here. * Starting the deamon child process here.
*/ */
fclose(stdin); fclose(stdin);
if (open("/dev/null", O_RDONLY) != 0) {
Syslog('?', "$Reopen of stdin to /dev/null failed");
_exit(MBERR_EXEC_FAILED);
}
fclose(stdout); fclose(stdout);
if (open("/dev/null", O_WRONLY | O_APPEND | O_CREAT,0600) != 1) {
Syslog('?', "$Reopen of stdout to /dev/null failed");
_exit(MBERR_EXEC_FAILED);
}
fclose(stderr); fclose(stderr);
if (open("/dev/null", O_WRONLY | O_APPEND | O_CREAT,0600) != 2) {
Syslog('?', "$Reopen of stderr to /dev/null failed");
_exit(MBERR_EXEC_FAILED);
}
scheduler(); scheduler();
/* Not reached */ /* Not reached */
default: default:

View File

@ -143,19 +143,20 @@ void status_init()
void status_write(void); void status_write(void);
void status_write(void) void status_write(void)
{ {
int d, stat_fd; int d, stat_fd, yday;
struct tm *ttm, *ytm; struct tm *ttm;
time_t temp; time_t temp;
temp = time(NULL); temp = time(NULL);
ttm = localtime(&temp); ttm = localtime(&temp);
yday = ttm->tm_yday;
temp = status.daily; // On a Sparc, first put the time in temp, then pass it to locattime. temp = status.daily; // On a Sparc, first put the time in temp, then pass it to locattime.
ytm = localtime(&temp); ttm = localtime(&temp);
/* /*
* If we passed to the next day, zero the today counters * If we passed to the next day, zero the today counters
*/ */
if (ttm->tm_yday != ytm->tm_yday) { if (yday != ttm->tm_yday) {
Syslog('+', "Last days statistics:"); Syslog('+', "Last days statistics:");
Syslog('+', "Total clients : %lu", status.today.tot_clt); Syslog('+', "Total clients : %lu", status.today.tot_clt);
Syslog('+', "Peak clients : %lu", status.today.peak_clt); Syslog('+', "Peak clients : %lu", status.today.peak_clt);