summaryrefslogtreecommitdiff
path: root/devel/cvs/patches/patch-ar
blob: 09533fb395890844428593049cdeeddc6d2dc936 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
$NetBSD: patch-ar,v 1.5 2002/11/24 21:31:25 hubertf Exp $

--- src/server.c.orig	Tue Mar 19 20:15:45 2002
+++ src/server.c
@@ -782,6 +782,7 @@
        nothing.  But for rsh, we need to do it now.  */
     parse_config (current_parsed_root->directory);
 
+    if (!nolock) {
     path = malloc (strlen (current_parsed_root->directory)
 		   + sizeof (CVSROOTADM)
 		   + 2);
@@ -799,6 +800,7 @@
 	pending_error = save_errno;
     }
     free (path);
+    }
 
 #ifdef HAVE_PUTENV
     env = malloc (strlen (CVSROOT_ENV) + strlen (current_parsed_root->directory) + 2);
@@ -2181,6 +2183,8 @@
     {
 	case 'n':
 	    noexec = 1;
+	case 'u':
+	    nolock = 1;
 	    break;
 	case 'q':
 	    quiet = 1;
@@ -5283,6 +5287,7 @@
     const char *username;
 {
     struct passwd *pw;
+    int rc;
 
     pw = getpwnam (username);
     if (pw == NULL)
@@ -5342,7 +5347,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