$NetBSD: patch-ar,v 1.4 2000/10/18 03:31:16 hubertf Exp $ --- src/server.c.orig Fri Jul 28 22:18:40 2000 +++ src/server.c @@ -796,6 +796,7 @@ nothing. But for rsh, we need to do it now. */ parse_config (CVSroot_directory); + if (!nolock) { path = malloc (strlen (CVSroot_directory) + sizeof (CVSROOTADM) + 10); @@ -813,6 +814,7 @@ pending_error = save_errno; } free (path); + } #ifdef HAVE_PUTENV env = malloc (strlen (CVSROOT_ENV) + strlen (CVSroot_directory) + 1 + 1); @@ -2194,6 +2196,8 @@ { case 'n': noexec = 1; + case 'u': + nolock = 1; break; case 'q': quiet = 1; @@ -5172,6 +5176,7 @@ const char *username; { struct passwd *pw; + int rc; pw = getpwnam (username); if (pw == NULL) @@ -5231,7 +5236,15 @@ } } - if (setuid (pw->pw_uid) < 0) +#ifdef SETXID_SUPPORT + /* Honor the setuid bit iff set. */ + if (getuid() != geteuid()) + rc = setuid (geteuid ()); + else +#else + rc = setuid (pw->pw_uid); +#endif + if (rc < 0) { /* Note that this means that if run as a non-root user, CVSROOT/passwd must contain the user we are running as