diff options
author | tron <tron> | 1999-06-03 14:22:09 +0000 |
---|---|---|
committer | tron <tron> | 1999-06-03 14:22:09 +0000 |
commit | 63bb89d46c9e5a9f7a0a38248498c971d1ed7ebe (patch) | |
tree | 69d5cbab9a6ee719982f7d5feae4376be49eca8c /sysutils/mtools/patches/patch-ac | |
parent | 960d483b8fc01196b7278f432678f6d3a207bc5a (diff) | |
download | pkgsrc-63bb89d46c9e5a9f7a0a38248498c971d1ed7ebe.tar.gz |
Adapt this patch to version 3.9.5.
Diffstat (limited to 'sysutils/mtools/patches/patch-ac')
-rw-r--r-- | sysutils/mtools/patches/patch-ac | 97 |
1 files changed, 6 insertions, 91 deletions
diff --git a/sysutils/mtools/patches/patch-ac b/sysutils/mtools/patches/patch-ac index 485747d40c8..8371188eee5 100644 --- a/sysutils/mtools/patches/patch-ac +++ b/sysutils/mtools/patches/patch-ac @@ -1,100 +1,15 @@ -$NetBSD: patch-ac,v 1.2 1999/06/01 21:15:02 tron Exp $ +$NetBSD: patch-ac,v 1.3 1999/06/03 14:22:09 tron Exp $ ---- floppyd.cpp.orig Mon May 31 14:46:31 1999 -+++ floppyd.cpp Tue Jun 1 10:53:28 1999 -@@ -24,6 +24,7 @@ - #endif - - #define FLOPPYD_DEFAULT_PORT 5703 -+#define NOBODY "nobody" - extern int errno; - - // ######################################################################### -@@ -395,6 +396,8 @@ - - /* - * Find the userid of the specified user. -+ * Use 'nobody' if not specified and revert to 65535 only if -+ * 'nobody' cannot be determined. - */ - static uid_t getuserid(char *user) - { -@@ -411,7 +414,10 @@ - } - else - { -- uid = 65535; -+ if((pw = getpwnam(NOBODY)) != NULL) -+ uid = pw->pw_uid; -+ else -+ uid = 65535; - } - - #ifdef DEBUG -@@ -527,12 +533,12 @@ - { - int new_sock; - struct sockaddr_in addr; -- int len; -+ socklen_t len; - - /* - * Ignore dead servers so no zombies should be left hanging. - */ -- signal(SIGCLD, SIG_IGN); -+ signal(SIGCHLD, SIG_IGN); - - for (;;) - { -@@ -613,11 +619,13 @@ +--- floppyd.c.orig Thu Jun 3 15:12:56 1999 ++++ floppyd.c Thu Jun 3 15:19:46 1999 +@@ -758,8 +758,8 @@ int run_as_server = 0; ipaddr_t bind_ip = INADDR_ANY; short bind_port = FLOPPYD_DEFAULT_PORT; - uid_t run_uid = 65535; - gid_t run_gid = 65535; -+ uid_t run_uid; -+ gid_t run_gid; -+ pid_t run_pid; ++ uid_t run_uid = getuserid("nobody"); ++ gid_t run_gid = getgroupid(run_uid); int sock; int port_is_supplied = 0; int no_local = 0; -+ int ug_given = 0; - - char *server_hostname=NULL; - char* device_name = NULL; -@@ -644,6 +652,7 @@ - break; - - case 'r': -+ ug_given = 1; - run_uid = getuserid(optarg); - run_gid = getgroupid(run_uid); - break; -@@ -663,9 +672,15 @@ - break; - } - } -+ -+ if(!ug_given) { -+ run_uid = getuserid(NOBODY); -+ run_gid = getgroupid(run_uid); -+ } -+ - if(!run_as_server) { - struct sockaddr_in addr; -- int len = sizeof(addr); -+ socklen_t len = sizeof(addr); - - /* try to find out port that we are connected to */ - if(getsockname(0, (sockaddr*) &addr, &len) >= 0 && -@@ -836,8 +851,8 @@ - /* - * Start a new session and group. - */ -- setsid(); -- setpgrp(); -+ run_pid = setsid(); -+ setpgrp(0, run_pid); - - close(2); - open("/dev/null", O_WRONLY); |