Completed security checks for NetBSD and OpenBSD

This commit is contained in:
Michiel Broek 2005-08-31 20:49:10 +00:00
parent da2c43d625
commit af4ab62459
2 changed files with 8 additions and 18 deletions

View File

@ -59,7 +59,7 @@
#include <userconf.h>
#endif
#if defined(__OpenBSD__)
#if defined(__OpenBSD__) || defined(__NetBSD__)
#include <sys/sysctl.h>
#endif
@ -849,7 +849,7 @@ int main(int argc, char *argv[])
#endif
pid_t ppid;
char *parent;
#if defined(__OpenBSD__)
#if defined(__OpenBSD__) || defined(__NetBSD__)
#define ARG_SIZE 60
static char **s, buf[ARG_SIZE];
size_t siz = 100;
@ -902,7 +902,7 @@ int main(int argc, char *argv[])
*/
ppid = getppid();
#if defined(__OpenBSD__)
#if defined(__OpenBSD__) || defined(__NetBSD__)
/*
* Systems that use sysctl to get process information
*/
@ -911,12 +911,12 @@ int main(int argc, char *argv[])
mib[2] = ppid;
mib[3] = KERN_PROC_ARGV;
if ((s = realloc(s, siz)) == NULL) {
fprintf(stderr, "mbuseradd: no memory\n");
fprintf(stderr, "mbpasswd: no memory\n");
exit(1);
}
if (sysctl(mib, 4, s, &siz, NULL, 0) == -1) {
perror("");
fprintf(stderr, "mbuseradd: sysctl call failed\n");
fprintf(stderr, "mbpasswd: sysctl call failed\n");
exit(1);
}
buf[0] = '\0';

View File

@ -45,7 +45,7 @@
#include <syslog.h>
#include <time.h>
#if defined(__OpenBSD__)
#if defined(__OpenBSD__) || defined(__NetBSD__)
#include <sys/sysctl.h>
#endif
@ -178,7 +178,7 @@ int main(int argc, char *argv[])
struct passwd *pwent, *pwuser;
struct group *gr;
pid_t ppid;
#if defined(__OpenBSD__)
#if defined(__OpenBSD__) || defined(__NetBSD__)
#define ARG_SIZE 60
static char **s, buf[ARG_SIZE];
size_t siz = 100;
@ -229,20 +229,13 @@ int main(int argc, char *argv[])
exit(1);
}
/*
* We don't log into MBSE BBS logfiles but to the system logfiles,
* because we are modifying system files not belonging to MBSE BBS.
*/
openlog("mbuseradd", LOG_PID|LOG_CONS|LOG_NOWAIT, LOG_AUTH);
syslog(LOG_WARNING, "mbuseradd %s %s %s %s", argv[1], argv[2], argv[3], argv[4]);
/*
* Find out the name of our parent.
*/
temp = calloc(PATH_MAX, sizeof(char));
ppid = getppid();
#if defined(__OpenBSD__)
#if defined(__OpenBSD__) || defined(__NetBSD__)
/*
* Systems that use sysctl to get process information
*/
@ -257,7 +250,6 @@ int main(int argc, char *argv[])
if (sysctl(mib, 4, s, &siz, NULL, 0) == -1) {
perror("");
fprintf(stderr, "mbuseradd: sysctl call failed\n");
syslog(LOG_WARNING, "sysctl call failed");
exit(1);
}
buf[0] = '\0';
@ -266,8 +258,6 @@ int main(int argc, char *argv[])
strlcat(buf, " ", sizeof(buf));
strlcat(buf, *p, sizeof(buf));
}
syslog(LOG_WARNING, "\"%s\"", buf);
printf("%s\n", buf);
parent = xstrcpy(buf);
#else
/*