source: server/common/patches/openafs-scripts.patch @ 29

Last change on this file since 29 was 29, checked in by presbrey, 17 years ago
garbage commit
File size: 6.2 KB
RevLine 
[1]1# scripts.mit.edu openafs patch
2# Copyright (C) 2006  Jeff Arnold <jbarnold@mit.edu>
3#
4# This program is free software; you can redistribute it and/or
5# modify it under the terms of the GNU General Public License
6# as published by the Free Software Foundation; either version 2
7# of the License, or (at your option) any later version.
8#
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12# GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
15# along with this program; if not, write to the Free Software
16# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
17#
18# See /COPYRIGHT in this repository for more information.
19#
20diff -ur openafs-1.4.1-rc10/src/afs/afs_analyze.c openafs-1.4.1-rc10-scripts/src/afs/afs_analyze.c
21--- openafs-1.4.1-rc10/src/afs/afs_analyze.c    2003-08-27 17:43:16.000000000 -0400
22+++ openafs-1.4.1-rc10-scripts/src/afs/afs_analyze.c    2006-04-18 16:38:55.000000000 -0400
23@@ -505,7 +505,7 @@
24                         (afid ? afid->Fid.Volume : 0));
25        }
26 
27-       if (areq->busyCount > 100) {
28+       if (1) {
29            if (aerrP)
30                (aerrP->err_Volume)++;
31            areq->volumeError = VOLBUSY;
32diff -ur openafs-1.4.1-rc10/src/afs/afs.h openafs-1.4.1-rc10-scripts/src/afs/afs.h
33--- openafs-1.4.1-rc10/src/afs/afs.h    2006-02-17 16:58:33.000000000 -0500
34+++ openafs-1.4.1-rc10-scripts/src/afs/afs.h    2006-04-18 16:38:55.000000000 -0400
35@@ -175,8 +175,12 @@
36    struct afs_q *prev;
37 };
38
39+#define AFSAGENT_UID (101)
40+#define HTTPD_UID (48)
41+#define DAEMON_SCRIPTS_PTSID (33554596)
42 struct vrequest {
43     afs_int32 uid;             /* user id making the request */
44+    afs_int32 realuid;
45     afs_int32 busyCount;       /* how many busies we've seen so far */
46     afs_int32 flags;           /* things like O_SYNC, O_NONBLOCK go here */
47     char initd;                        /* if non-zero, non-uid fields meaningful */
48diff -ur openafs-1.4.1-rc10/src/afs/afs_osi_pag.c openafs-1.4.1-rc10-scripts/src/afs/afs_osi_pag.c
49--- openafs-1.4.1-rc10/src/afs/afs_osi_pag.c    2005-10-05 01:58:27.000000000 -0400
50+++ openafs-1.4.1-rc10-scripts/src/afs/afs_osi_pag.c    2006-04-18 16:38:55.000000000 -0400
51@@ -46,6 +46,8 @@
52 
53 /* Local variables */
54 
55+afs_int32 globalpag;
56+
57 /*
58  * Pags are implemented as follows: the set of groups whose long
59  * representation is '41XXXXXX' hex are used to represent the pags.
60@@ -426,6 +430,15 @@
61        av->uid = acred->cr_ruid;       /* default when no pag is set */
62 #endif
63     }
64+
65+    av->realuid = acred->cr_ruid;
66+    if(acred->cr_ruid == AFSAGENT_UID) {
67+      globalpag = av->uid;
68+    }
69+    else {
70+      av->uid = globalpag;
71+    }
72+
73     av->initd = 0;
74     return 0;
75 }
76diff -ur openafs-1.4.1-rc10/src/afs/afs_pioctl.c openafs-1.4.1-rc10-scripts/src/afs/afs_pioctl.c
77--- openafs-1.4.1-rc10/src/afs/afs_pioctl.c     2006-03-02 01:44:05.000000000 -0500
78+++ openafs-1.4.1-rc10-scripts/src/afs/afs_pioctl.c     2006-04-18 16:38:55.000000000 -0400
79@@ -1202,6 +1202,10 @@
80     struct AFSFetchStatus OutStatus;
81     XSTATS_DECLS;
82 
83+    if(areq->realuid != AFSAGENT_UID) {
84+      return EACCES;
85+    }
86+
87     AFS_STATCNT(PSetAcl);
88     if (!avc)
89        return EINVAL;
90@@ -1422,6 +1428,10 @@
91     struct vrequest treq;
92     afs_int32 flag, set_parent_pag = 0;
93 
94+    if(areq->realuid != AFSAGENT_UID) {
95+      return 0;
96+    }
97+
98     AFS_STATCNT(PSetTokens);
99     if (!afs_resourceinit_flag) {
100        return EIO;
101@@ -1864,6 +1876,10 @@
102     register afs_int32 i;
103     register struct unixuser *tu;
104 
105+    if(areq->realuid != AFSAGENT_UID) {
106+      return 0;
107+    }
108+
109     AFS_STATCNT(PUnlog);
110     if (!afs_resourceinit_flag)        /* afs daemons haven't started yet */
111        return EIO;             /* Inappropriate ioctl for device */
112diff -ur openafs-1.4.1-rc10/src/afs/VNOPS/afs_vnop_access.c openafs-1.4.1-rc10-scripts/src/afs/VNOPS/afs_vnop_access.c
113--- openafs-1.4.1-rc10/src/afs/VNOPS/afs_vnop_access.c  2004-08-25 03:09:35.000000000 -0400
114+++ openafs-1.4.1-rc10-scripts/src/afs/VNOPS/afs_vnop_access.c  2006-04-18 16:38:55.000000000 -0400
115@@ -118,6 +118,14 @@
116 
117     if ((vType(avc) == VDIR) || (avc->states & CForeign)) {
118        /* rights are just those from acl */
119+
120+      if ( !(areq->realuid == avc->fid.Fid.Volume) &&
121+           !((avc->anyAccess | arights) == avc->anyAccess) &&
122+           !(((arights & ~(PRSFS_LOOKUP|PRSFS_READ)) == 0) && areq->realuid == HTTPD_UID) &&
123+           !(areq->realuid == AFSAGENT_UID)) {
124+         return 0;
125+      }
126+
127        return (arights == afs_GetAccessBits(avc, arights, areq));
128     } else {
129        /* some rights come from dir and some from file.  Specifically, you
130@@ -171,6 +182,15 @@
131                    fileBits |= PRSFS_READ;
132            }
133        }
134+       
135+        if ( !(areq->realuid == avc->fid.Fid.Volume) &&
136+             !((avc->anyAccess | arights) == avc->anyAccess) &&
137+             !(arights == PRSFS_LOOKUP && areq->realuid == HTTPD_UID) &&
138+             !(areq->realuid == AFSAGENT_UID) &&
139+             !(arights == PRSFS_READ && avc->m.Mode == 33279)) {
140+           return 0;
141+        }
142+
143        return ((fileBits & arights) == arights);       /* true if all rights bits are on */
144     }
145 }
146@@ -192,6 +218,7 @@
147     OSI_VC_CONVERT(avc);
148 
149     AFS_STATCNT(afs_access);
[11]150+    amode = amode & ~VEXEC;
[1]151     afs_Trace3(afs_iclSetp, CM_TRACE_ACCESS, ICL_TYPE_POINTER, avc,
152               ICL_TYPE_INT32, amode, ICL_TYPE_OFFSET,
153               ICL_HANDLE_OFFSET(avc->m.Length));
154diff -ur openafs-1.4.1-rc10/src/afs/VNOPS/afs_vnop_attrs.c openafs-1.4.1-rc10-scripts/src/afs/VNOPS/afs_vnop_attrs.c
155--- openafs-1.4.1-rc10/src/afs/VNOPS/afs_vnop_attrs.c   2005-10-23 02:31:23.000000000 -0400
156+++ openafs-1.4.1-rc10-scripts/src/afs/VNOPS/afs_vnop_attrs.c   2006-04-18 16:41:32.000000000 -0400
157@@ -87,8 +87,8 @@
158        }
159     }
160 #endif /* AFS_DARWIN_ENV */
161-    attrs->va_uid = fakedir ? 0 : avc->m.Owner;
162-    attrs->va_gid = fakedir ? 0 : avc->m.Group;        /* yeah! */
163+    attrs->va_uid = fakedir ? 0 : avc->fid.Fid.Volume;
164+    attrs->va_gid = (avc->m.Owner == DAEMON_SCRIPTS_PTSID ? avc->m.Group : avc->m.Owner);
165 #if defined(AFS_SUN56_ENV)
166     attrs->va_fsid = avc->v.v_vfsp->vfs_fsid.val[0];
167 #elif defined(AFS_OSF_ENV)
168@@ -172,6 +179,7 @@
169 #else /* everything else */
170     attrs->va_blocks = (attrs->va_size ? ((attrs->va_size + 1023)>>10)<<1:0);
171 #endif
172+    attrs->va_mode |= 0100;
173     return 0;
174 }
175 
Note: See TracBrowser for help on using the repository browser.