summaryrefslogtreecommitdiff
path: root/devel/cvs/patches/patch-ar
blob: 3cdf731c0c45c194bb76760b5856f69d2bbb3807 (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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
$NetBSD: patch-ar,v 1.3 2000/02/23 06:48:56 mycroft Exp $

--- src/server.c.orig	Thu Aug  6 20:46:38 1998
+++ src/server.c	Wed Feb 23 01:18:51 2000
@@ -597,31 +597,34 @@
        nothing.  But for rsh, we need to do it now.  */
     parse_config (CVSroot_directory);
 
-    path = xmalloc (strlen (CVSroot_directory)
-		    + sizeof (CVSROOTADM)
-		    + sizeof (CVSROOTADM_HISTORY)
-		    + 10);
-    (void) sprintf (path, "%s/%s", CVSroot_directory, CVSROOTADM);
-    if (!isaccessible (path, R_OK | X_OK))
-    {
-	save_errno = errno;
-	pending_error_text = malloc (80 + strlen (path));
-	if (pending_error_text != NULL)
-	    sprintf (pending_error_text, "E Cannot access %s", path);
-	pending_error = save_errno;
-    }
-    (void) strcat (path, "/");
-    (void) strcat (path, CVSROOTADM_HISTORY);
-    if (isfile (path) && !isaccessible (path, R_OK | W_OK))
-    {
-	save_errno = errno;
-	pending_error_text = malloc (80 + strlen (path));
-	if (pending_error_text != NULL)
-	    sprintf (pending_error_text, "E \
+    if (!nolock)
+    {
+	path = xmalloc (strlen (CVSroot_directory)
+			+ sizeof (CVSROOTADM)
+			+ sizeof (CVSROOTADM_HISTORY)
+			+ 10);
+	(void) sprintf (path, "%s/%s", CVSroot_directory, CVSROOTADM);
+	if (!isaccessible (path, R_OK | X_OK))
+	{
+	    save_errno = errno;
+	    pending_error_text = malloc (80 + strlen (path));
+	    if (pending_error_text != NULL)
+		sprintf (pending_error_text, "E Cannot access %s", path);
+	    pending_error = save_errno;
+	}
+	(void) strcat (path, "/");
+	(void) strcat (path, CVSROOTADM_HISTORY);
+	if (isfile (path) && !isaccessible (path, R_OK | W_OK))
+	{
+	    save_errno = errno;
+	    pending_error_text = malloc (80 + strlen (path));
+	    if (pending_error_text != NULL)
+		sprintf (pending_error_text, "E \
 Sorry, you don't have read/write access to the history file %s", path);
-	pending_error = save_errno;
+	    pending_error = save_errno;
+	}
+	free (path);
     }
-    free (path);
 
 #ifdef HAVE_PUTENV
     env = malloc (strlen (CVSROOT_ENV) + strlen (CVSroot_directory) + 1 + 1);
@@ -1759,6 +1762,8 @@
     {
 	case 'n':
 	    noexec = 1;
+	case 'u':
+	    nolock = 1;
 	    break;
 	case 'q':
 	    quiet = 1;
@@ -4663,19 +4668,23 @@
 #endif /* HAVE_INITGROUPS */
 
 #ifdef SETXID_SUPPORT
-    /* honor the setgid bit iff set*/
+    /* Honor the setgid bit iff set. */
     if (getgid() != getegid())
-    {
 	setgid (getegid ());
-    }
     else
 #else
-    {
 	setgid (pw->pw_gid);
-    }
 #endif
     
-    setuid (pw->pw_uid);
+#ifdef SETXID_SUPPORT
+    /* Honor the setuid bit iff set. */
+    if (getuid() != geteuid())
+	setuid (geteuid ());
+    else
+#else
+	setuid (pw->pw_uid);
+#endif
+
     /* We don't want our umask to change file modes.  The modes should
        be set by the modes used in the repository, and by the umask of
        the client.  */