#include <minix/drivers.h>
#include <minix/fsdriver.h>
#include <minix/vfsif.h>
+#include <minix/rs.h>
#include <assert.h>
/*
fsdriver_terminate();
}
+/*
+ * Initialize PFS.
+ */
+static int
+pfs_init(int __unused type, sef_init_info_t * __unused info)
+{
+
+ /* Drop privileges. */
+ if (setuid(SERVICE_UID) != 0)
+ printf("PFS: warning, unable to drop privileges\n");
+
+ return OK;
+}
+
/*
* Perform SEF initialization.
*/
{
/* Register initialization callbacks. */
- sef_setcb_init_fresh(sef_cb_init_null);
+ sef_setcb_init_fresh(pfs_init);
sef_setcb_init_restart(sef_cb_init_fail);
/* No live update support for now. */
#define SERVICE_LOGIN "service" /* passwd file entry for services */
+/* The following definition should be kept in sync with the actual /etc/passwd
+ * value for SERVICE_LOGIN for now, and removed altogether once we are able to
+ * obtain its value dynamically everywhere.
+ */
+#define SERVICE_UID 12 /* user ID for services */
+
/* RSS definitions. */
#define RSS_NR_IRQ 16
#define RSS_NR_IO 16
int timerand, fd;
u8_t randbits[32];
struct timeval tv;
- struct passwd *pw;
#if DEBUG
printf("Starting inet...\n");
ip_panic(("inet: can't subscribe to driver events"));
}
- /* Drop root privileges */
- if ((pw = getpwnam(SERVICE_LOGIN)) == NULL) {
- printf("inet: unable to retrieve uid of SERVICE_LOGIN, "
- "still running as root");
- } else if (setuid(pw->pw_uid) != 0) {
- ip_panic(("inet: unable to drop privileges"));
- }
+ /* Drop privileges. */
+ if (setuid(SERVICE_UID) != 0)
+ printf("inet: warning, unable to drop privileges\n");
/* Announce we are up. INET announces its presence to VFS just like
* any other character driver.