e896e99863
<gr@sirius.eclipsed.net>. Also fix compilation on -current machines after removal of vm/vm_swap.h, and silence a compile time warning.
46 lines
1.2 KiB
Text
46 lines
1.2 KiB
Text
$NetBSD: patch-bo,v 1.2 2000/06/16 23:40:18 wiz Exp $
|
|
|
|
--- progs/glupart/glupart.c.orig Thu Sep 18 17:01:35 1997
|
|
+++ progs/glupart/glupart.c Tue Jun 13 14:44:12 2000
|
|
@@ -1,18 +1,40 @@
|
|
#include <stdio.h>
|
|
#include <sys/types.h>
|
|
#include <sys/socket.h>
|
|
+#include <sys/param.h>
|
|
#include <netdb.h>
|
|
#include <netinet/in.h>
|
|
#include <unistd.h>
|
|
#include <stdlib.h>
|
|
|
|
+#if (defined(BSD) && BSD >= 199306)
|
|
+#include <pwd.h>
|
|
+#include <grp.h>
|
|
+
|
|
+#define userId pwp->pw_uid
|
|
+#define groupId grp->gr_gid
|
|
+#else
|
|
#define userId GLUNIX_ACCOUNT /* This is the glunix account */
|
|
#define groupId GLUNIX_GROUP /* The glunix group */
|
|
+#endif
|
|
|
|
-#define progPath "/usr/now/bin/glupart_script"
|
|
+#define progPath "%%%NOW_ROOT%%%/bin/glupart_script"
|
|
|
|
int
|
|
main(int argc, char **argv) {
|
|
+#if (defined(BSD) && BSD >= 199306)
|
|
+ struct passwd *pwp;
|
|
+ struct group *grp;
|
|
+
|
|
+ if ((pwp = getpwnam("glunix")) == (struct passwd *) NULL) {
|
|
+ (void) fprintf(stderr, "Error: can't get uid for `%s'\n", "glunix");
|
|
+ exit(1);
|
|
+ }
|
|
+ if ((grp = getgrnam("glunix")) == (struct group *) NULL) {
|
|
+ (void) fprintf(stderr, "Error: can't get gid for `%s'\n", "glunix");
|
|
+ exit(1);
|
|
+ }
|
|
+#endif
|
|
setegid(groupId);
|
|
/* setgid(groupId); */
|
|
seteuid(userId);
|