4545# See /COPYRIGHT in this repository for more information.
4646#
4747diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c
48- index 91c09ed..86e2f26 100644
48+ index 8d6946f8f..48325b5d0 100644
4949--- a/src/afs/LINUX/osi_vnodeops.c
5050+++ b/src/afs/LINUX/osi_vnodeops.c
51- @@ -1296 ,6 +1296 ,28 @@ afs_linux_dentry_revalidate(struct dentry *dp, int flags)
51+ @@ -1426 ,6 +1426 ,28 @@ afs_linux_dentry_revalidate(struct dentry *dp, int flags)
5252 /* should we always update the attributes at this point? */
5353 /* unlikely--the vcache entry hasn't changed */
5454
@@ -75,13 +75,13 @@ index 91c09ed..86e2f26 100644
7575+ vcp->apache_access = strncmp(dp->d_name.name, ".ht", 3) == 0;
7676+
7777 dput(parent);
78+
7879 } else {
79- #ifdef notyet
8080diff --git a/src/afs/VNOPS/afs_vnop_access.c b/src/afs/VNOPS/afs_vnop_access.c
81- index 0087073..df3e4ef 100644
81+ index 8dd885b35..a538427bd 100644
8282--- a/src/afs/VNOPS/afs_vnop_access.c
8383+++ b/src/afs/VNOPS/afs_vnop_access.c
84- @@ -130 ,6 +130 ,16 @@ afs_AccessOK(struct vcache *avc, afs_int32 arights, struct vrequest *areq,
84+ @@ -129 ,6 +129 ,16 @@ afs_AccessOK(struct vcache *avc, afs_int32 arights, struct vrequest *areq,
8585 dirBits = PRSFS_LOOKUP | PRSFS_READ;
8686 return (arights == (dirBits & arights));
8787 }
@@ -98,7 +98,7 @@ index 0087073..df3e4ef 100644
9898 return (arights == afs_GetAccessBits(avc, arights, areq));
9999 } else {
100100 /* some rights come from dir and some from file. Specifically, you
101- @@ -183 ,6 +192,20 @@ afs_AccessOK(struct vcache *avc, afs_int32 arights, struct vrequest *areq,
101+ @@ -182 ,6 +192,20 @@ afs_AccessOK(struct vcache *avc, afs_int32 arights, struct vrequest *areq,
102102 fileBits |= PRSFS_READ;
103103 }
104104 }
@@ -120,7 +120,7 @@ index 0087073..df3e4ef 100644
120120 }
121121 }
122122diff --git a/src/afs/VNOPS/afs_vnop_attrs.c b/src/afs/VNOPS/afs_vnop_attrs.c
123- index 2eb228f..d5d6e4a 100644
123+ index 7166bf3c3..6df9d644a 100644
124124--- a/src/afs/VNOPS/afs_vnop_attrs.c
125125+++ b/src/afs/VNOPS/afs_vnop_attrs.c
126126@@ -90,8 +90,8 @@ afs_CopyOutAttrs(struct vcache *avc, struct vattr *attrs)
@@ -132,13 +132,13 @@ index 2eb228f..d5d6e4a 100644
132132+ attrs->va_uid = fakedir ? 0 : avc->f.fid.Fid.Volume;
133133+ attrs->va_gid = (avc->f.m.Owner == DAEMON_SCRIPTS_PTSID ? avc->f.m.Group : avc->f.m.Owner);
134134 #if defined(AFS_SUN5_ENV)
135- attrs->va_fsid = avc->v. v_vfsp->vfs_fsid.val[0];
135+ attrs->va_fsid = AFSTOV( avc)-> v_vfsp->vfs_fsid.val[0];
136136 #elif defined(AFS_DARWIN80_ENV)
137137diff --git a/src/afs/VNOPS/afs_vnop_lookup.c b/src/afs/VNOPS/afs_vnop_lookup.c
138- index d8205b6..5010486 100644
138+ index dd585e97a..f2785eb28 100644
139139--- a/src/afs/VNOPS/afs_vnop_lookup.c
140140+++ b/src/afs/VNOPS/afs_vnop_lookup.c
141- @@ -1915 ,6 +1915 ,12 @@ afs_lookup(OSI_VC_DECL(adp), char *aname, struct vcache **avcp, afs_ucred_t *acr
141+ @@ -1947 ,6 +1947 ,12 @@ afs_lookup(OSI_VC_DECL(adp), char *aname, struct vcache **avcp, afs_ucred_t *acr
142142 }
143143
144144 done:
@@ -152,10 +152,10 @@ index d8205b6..5010486 100644
152152 if (tname != aname && tname)
153153 osi_FreeLargeSpace(tname);
154154diff --git a/src/afs/afs.h b/src/afs/afs.h
155- index 0dbc11b..ab6c0d9 100644
155+ index 407eb8902..c8a9a35bd 100644
156156--- a/src/afs/afs.h
157157+++ b/src/afs/afs.h
158- @@ -237 ,8 +237 ,16 @@ struct afs_slotlist {
158+ @@ -254 ,8 +254 ,16 @@ struct afs_slotlist {
159159 struct afs_slotlist *next;
160160 };
161161
@@ -172,7 +172,7 @@ index 0dbc11b..ab6c0d9 100644
172172 afs_int32 busyCount; /* how many busies we've seen so far */
173173 afs_int32 flags; /* things like O_SYNC, O_NONBLOCK go here */
174174 char initd; /* if non-zero, Error fields meaningful */
175- @@ -902 ,6 +910 ,7 @@ struct vcache {
175+ @@ -984 ,6 +992 ,7 @@ struct vcache {
176176 spinlock_t pagewriter_lock;
177177 struct list_head pagewriters; /* threads that are writing vm pages */
178178 #endif
@@ -181,10 +181,10 @@ index 0dbc11b..ab6c0d9 100644
181181
182182 #ifdef AFS_LINUX26_ENV
183183diff --git a/src/afs/afs_analyze.c b/src/afs/afs_analyze.c
184- index dea580b..6021cc2 100644
184+ index 4bb212ba6..e24994ed0 100644
185185--- a/src/afs/afs_analyze.c
186186+++ b/src/afs/afs_analyze.c
187- @@ -482 ,7 +482 ,7 @@ afs_Analyze(struct afs_conn *aconn, struct rx_connection *rxconn,
187+ @@ -473 ,7 +473 ,7 @@ afs_Analyze(struct afs_conn *aconn, struct rx_connection *rxconn,
188188 (afid ? afid->Fid.Volume : 0));
189189 }
190190
@@ -194,19 +194,19 @@ index dea580b..6021cc2 100644
194194 (aerrP->err_Volume)++;
195195 areq->volumeError = VOLBUSY;
196196diff --git a/src/afs/afs_osi_pag.c b/src/afs/afs_osi_pag.c
197- index afbb1cf..43ffdfd 100644
197+ index c0667d9e1..d2e736e75 100644
198198--- a/src/afs/afs_osi_pag.c
199199+++ b/src/afs/afs_osi_pag.c
200- @@ -49 ,6 +49 ,8 @@ afs_uint32 pagCounter = 0 ;
201- #endif
202- /* Local variables */
200+ @@ -42 ,6 +42 ,8 @@ afs_uint32 pagCounter = 1 ;
201+ afs_uint32 pagCounter = 0;
202+ #endif /* UKERNEL */
203203
204204+ afs_int32 globalpag = 0;
205205+
206206 /*
207207 * Pags are implemented as follows: the set of groups whose long
208208 * representation is '41XXXXXX' hex are used to represent the pags.
209- @@ -484 ,6 +486 ,15 @@ afs_InitReq(struct vrequest *av, afs_ucred_t *acred)
209+ @@ -485 ,6 +487 ,15 @@ afs_InitReq(struct vrequest *av, afs_ucred_t *acred)
210210 av->uid = afs_cr_ruid(acred); /* default when no pag is set */
211211 #endif
212212 }
@@ -223,10 +223,10 @@ index afbb1cf..43ffdfd 100644
223223 }
224224
225225diff --git a/src/afs/afs_pioctl.c b/src/afs/afs_pioctl.c
226- index e9a84e3..047b3b5 100644
226+ index 263487967..cd55bc800 100644
227227--- a/src/afs/afs_pioctl.c
228228+++ b/src/afs/afs_pioctl.c
229- @@ -1422 ,6 +1422 ,10 @@ DECL_PIOCTL(PSetAcl)
229+ @@ -1449 ,6 +1449 ,10 @@ DECL_PIOCTL(PSetAcl)
230230 struct rx_connection *rxconn;
231231 XSTATS_DECLS;
232232
@@ -237,9 +237,9 @@ index e9a84e3..047b3b5 100644
237237 AFS_STATCNT(PSetAcl);
238238 if (!avc)
239239 return EINVAL;
240- @@ -1809,6 +1813,10 @@ DECL_PIOCTL(PSetTokens)
240+ @@ -1898,6 +1902,10 @@ DECL_PIOCTL(PSetTokens)
241+ struct vrequest *treq = NULL;
241242 afs_int32 flag, set_parent_pag = 0;
242- int code;
243243
244244+ if (areq->uid == globalpag && areq->realuid != AFSAGENT_UID) {
245245+ return EACCES;
@@ -248,8 +248,8 @@ index e9a84e3..047b3b5 100644
248248 AFS_STATCNT(PSetTokens);
249249 if (!afs_resourceinit_flag) {
250250 return EIO;
251- @@ -2273 ,6 +2281 ,11 @@ DECL_PIOCTL(PGetTokens)
252- int newStyle ;
251+ @@ -2349 ,6 +2357 ,11 @@ DECL_PIOCTL(PGetTokens)
252+ int cellNum ;
253253 int code = E2BIG;
254254
255255+ if (areq->uid == globalpag && areq->realuid != AFSAGENT_UID &&
@@ -260,7 +260,7 @@ index e9a84e3..047b3b5 100644
260260 AFS_STATCNT(PGetTokens);
261261 if (!afs_resourceinit_flag) /* afs daemons haven't started yet */
262262 return EIO; /* Inappropriate ioctl for device */
263- @@ -2383 ,6 +2396 ,10 @@ DECL_PIOCTL(PUnlog)
263+ @@ -2454 ,6 +2467 ,10 @@ DECL_PIOCTL(PUnlog)
264264 afs_int32 i;
265265 struct unixuser *tu;
266266
@@ -271,3 +271,26 @@ index e9a84e3..047b3b5 100644
271271 AFS_STATCNT(PUnlog);
272272 if (!afs_resourceinit_flag) /* afs daemons haven't started yet */
273273 return EIO; /* Inappropriate ioctl for device */
274+ @@ -5355,6 +5372,10 @@ DECL_PIOCTL(PSetTokens2)
275+ struct ktc_setTokenData tokenSet;
276+ struct ktc_tokenUnion decodedToken;
277+
278+ + if (areq->uid == globalpag && areq->realuid != AFSAGENT_UID) {
279+ + return EACCES;
280+ + }
281+ +
282+ memset(&tokenSet, 0, sizeof(tokenSet));
283+
284+ AFS_STATCNT(PSetTokens2);
285+ @@ -5485,6 +5506,11 @@ DECL_PIOCTL(PGetTokens2)
286+ XDR xdrs;
287+ struct ktc_setTokenData tokenSet;
288+
289+ + if (areq->uid == globalpag && areq->realuid != AFSAGENT_UID &&
290+ + areq->realuid != 0 && areq->realuid != SIGNUP_UID) {
291+ + return EDOM;
292+ + }
293+ +
294+ AFS_STATCNT(PGetTokens);
295+ if (!afs_resourceinit_flag)
296+ return EIO;
0 commit comments