sunrpc: Extract target name into svc_cred
NFSv4.0 callback needs to know the GSS target name the client used when it established its lease. That information is available from the GSS context created by gssproxy. Make it available in each svc_cred. Note this will also give us access to the real target service principal name (which is typically "nfs", but spec does not require that). Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
This commit is contained in:

committed by
J. Bruce Fields

parent
a1a237775e
commit
9abdda5dda
@@ -1979,8 +1979,10 @@ static int copy_cred(struct svc_cred *target, struct svc_cred *source)
|
||||
target->cr_principal = kstrdup(source->cr_principal, GFP_KERNEL);
|
||||
target->cr_raw_principal = kstrdup(source->cr_raw_principal,
|
||||
GFP_KERNEL);
|
||||
if ((source->cr_principal && ! target->cr_principal) ||
|
||||
(source->cr_raw_principal && ! target->cr_raw_principal))
|
||||
target->cr_targ_princ = kstrdup(source->cr_targ_princ, GFP_KERNEL);
|
||||
if ((source->cr_principal && !target->cr_principal) ||
|
||||
(source->cr_raw_principal && !target->cr_raw_principal) ||
|
||||
(source->cr_targ_princ && !target->cr_targ_princ))
|
||||
return -ENOMEM;
|
||||
|
||||
target->cr_flavor = source->cr_flavor;
|
||||
@@ -2057,6 +2059,7 @@ same_creds(struct svc_cred *cr1, struct svc_cred *cr2)
|
||||
|| (!gid_eq(cr1->cr_gid, cr2->cr_gid))
|
||||
|| !groups_equal(cr1->cr_group_info, cr2->cr_group_info))
|
||||
return false;
|
||||
/* XXX: check that cr_targ_princ fields match ? */
|
||||
if (cr1->cr_principal == cr2->cr_principal)
|
||||
return true;
|
||||
if (!cr1->cr_principal || !cr2->cr_principal)
|
||||
|
Reference in New Issue
Block a user