59 lines
1.5 KiB
Plaintext
59 lines
1.5 KiB
Plaintext
$NetBSD: patch-ar,v 1.3 2011/09/22 15:16:26 ryoon Exp $
|
|
|
|
--- src/server.c.orig 2008-05-07 15:57:34.000000000 +0000
|
|
+++ src/server.c
|
|
@@ -801,6 +801,7 @@ E Protocol error: Root says \"%s\" but p
|
|
nothing. But for rsh, we need to do it now. */
|
|
parse_config (current_parsed_root->directory);
|
|
|
|
+ if (!nolock) {
|
|
path = xmalloc (strlen (current_parsed_root->directory)
|
|
+ sizeof (CVSROOTADM)
|
|
+ 2);
|
|
@@ -818,6 +819,7 @@ E Protocol error: Root says \"%s\" but p
|
|
pending_error = save_errno;
|
|
}
|
|
free (path);
|
|
+ }
|
|
|
|
#ifdef HAVE_PUTENV
|
|
env = xmalloc (strlen (CVSROOT_ENV) + strlen (current_parsed_root->directory) + 2);
|
|
@@ -2308,8 +2310,12 @@ serve_global_option (arg)
|
|
break;
|
|
case 'n':
|
|
noexec = 1;
|
|
+ nolock = 1;
|
|
logoff = 1;
|
|
break;
|
|
+ case 'u':
|
|
+ nolock = 1;
|
|
+ break;
|
|
case 'q':
|
|
quiet = 1;
|
|
break;
|
|
@@ -5368,6 +5374,7 @@ switch_to_user (cvs_username, username)
|
|
const char *username;
|
|
{
|
|
struct passwd *pw;
|
|
+ int rc;
|
|
|
|
pw = getpwnam (username);
|
|
if (pw == NULL)
|
|
@@ -5446,7 +5453,15 @@ error 0 %s: no such system user\n", user
|
|
}
|
|
}
|
|
|
|
- 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
|