#include "afs/sysincludes.h"
#include "afsincludes.h"
#include "nfsclient.h"
-#include <linux/smp_lock.h>
#include <linux/sunrpc/svc.h>
#include <linux/sunrpc/svcauth.h>
static unsigned long authtab_addr = 0;
-#if defined(module_param) && LINUX_VERSION_CODE > KERNEL_VERSION(2,6,9)
module_param(authtab_addr, long, 0);
-#else
-MODULE_PARM(authtab_addr, "l");
-#endif
MODULE_PARM_DESC(authtab_addr, "Address of the authtab array.");
extern struct auth_ops *authtab[] __attribute__((weak));
/* XXX maybe we should fail this with rpc_system_err? */
return SVC_OK;
}
-#if HAVE_SVC_ADDR_IN
+#if HAVE_LINUX_SVC_ADDR_IN
addr = svc_addr_in(rqstp);
#else
addr = &rqstp->rq_addr;
ns->code = EACCES;
ns->client_addr = *addr;
ns->client_addrlen = rqstp->rq_addrlen;
- ns->client_uid = cr_uid(&rqstp->rq_cred);
- ns->client_gid = cr_gid(&rqstp->rq_cred);
- if (cr_group_info(&rqstp->rq_cred)->ngroups > 0)
- ns->client_g0 = GROUP_AT(cr_group_info(&rqstp->rq_cred), 0);
+ ns->client_uid = afs_cr_uid(&rqstp->rq_cred);
+ ns->client_gid = afs_cr_gid(&rqstp->rq_cred);
+ if (afs_cr_group_info(&rqstp->rq_cred)->ngroups > 0)
+ ns->client_g0 = GROUP_AT(afs_cr_group_info(&rqstp->rq_cred), 0);
else
ns->client_g0 = -1;
- if (cr_group_info(&rqstp->rq_cred)->ngroups > 1)
- ns->client_g1 = GROUP_AT(cr_group_info(&rqstp->rq_cred), 1);
+ if (afs_cr_group_info(&rqstp->rq_cred)->ngroups > 1)
+ ns->client_g1 = GROUP_AT(afs_cr_group_info(&rqstp->rq_cred), 1);
else
ns->client_g1 = -1;
}
credp = crget();
- set_cr_uid(credp, cr_uid(&rqstp->rq_cred));
- set_cr_gid(credp, cr_gid(&rqstp->rq_cred));
- get_group_info(cr_group_info(&rqstp->rq_cred));
- set_cr_group_info(credp, cr_group_info(&rqstp->rq_cred));
+ afs_set_cr_uid(credp, afs_cr_uid(&rqstp->rq_cred));
+ afs_set_cr_gid(credp, afs_cr_gid(&rqstp->rq_cred));
+ get_group_info(afs_cr_group_info(&rqstp->rq_cred));
+ afs_set_cr_group_info(credp, afs_cr_group_info(&rqstp->rq_cred));
/* avoid creating wildcard entries by mapping anonymous
* clients to afs_nobody */
- if (cr_uid(credp) == -1)
- set_cr_uid(credp, -2);
+ if (afs_cr_uid(credp) == -1)
+ afs_set_cr_uid(credp, -2);
code = afs_nfsclient_reqhandler(0, &credp, addr->sin_addr.s_addr,
&ns->uid, &outexp);
if (!code && outexp) EXP_RELE(outexp);
}
-#if 0
-/* This doesn't work, because they helpfully NULL out rqstp->authop
- * before calling us, so we have no way to tell what the original
- * auth flavor was.
- */
-static int
-svcauth_afs_release(struct svc_rqst *rqstp)
-{
- struct nfs_server_thread *ns;
-
- AFS_GLOCK();
- ns = find_nfs_thread(0);
- if (ns) ns->active = 0;
- AFS_GUNLOCK();
-
- return afs_orig_authtab[rqstp->rq_authop->flavour]->release(rqstp);
-}
-#endif
-
-
int osi_linux_nfs_initreq(struct vrequest *av, afs_ucred_t *cr, int *code)
{
struct nfs_server_thread *ns;
*code = ns->code;
if (!ns->code) {
- cr_ruid(cr) = NFSXLATOR_CRED;
+ afs_cr_ruid(cr) = NFSXLATOR_CRED;
av->uid = ns->uid;
}
return 1;
}
afs_new_authtab[i] = afs_osi_Alloc(sizeof(struct auth_ops));
+ osi_Assert(afs_new_authtab[i] != NULL);
*(afs_new_authtab[i]) = *(afs_orig_authtab[i]);
afs_new_authtab[i]->owner = THIS_MODULE;
afs_new_authtab[i]->accept = svcauth_afs_accept;