/* * Match credentials against current the auth_cred.
*/ staticint
unx_match(struct auth_cred *acred, struct rpc_cred *cred, int flags)
{ unsignedint groups = 0; unsignedint i;
if (cred->cr_cred == acred->cred) return1;
if (!uid_eq(cred->cr_cred->fsuid, acred->cred->fsuid) || !gid_eq(cred->cr_cred->fsgid, acred->cred->fsgid)) return0;
if (acred->cred->group_info != NULL)
groups = acred->cred->group_info->ngroups; if (groups > UNX_NGROUPS)
groups = UNX_NGROUPS; if (cred->cr_cred->group_info == NULL) return groups == 0; if (groups != cred->cr_cred->group_info->ngroups) return0;
for (i = 0; i < groups ; i++) if (!gid_eq(cred->cr_cred->group_info->gid[i], acred->cred->group_info->gid[i])) return0; return1;
}
p = xdr_reserve_space(xdr, 3 * sizeof(*p)); if (!p) goto marshal_failed;
*p++ = rpc_auth_unix;
cred_len = p++;
*p++ = xdr_zero; /* stamp */ if (xdr_stream_encode_opaque(xdr, clnt->cl_nodename,
clnt->cl_nodelen) < 0) goto marshal_failed;
p = xdr_reserve_space(xdr, 3 * sizeof(*p)); if (!p) goto marshal_failed;
*p++ = cpu_to_be32(from_kuid_munged(userns, cred->cr_cred->fsuid));
*p++ = cpu_to_be32(from_kgid_munged(userns, cred->cr_cred->fsgid));
gidarr_len = p++; if (gi) for (i = 0; i < UNX_NGROUPS && i < gi->ngroups; i++)
*p++ = cpu_to_be32(from_kgid_munged(userns, gi->gid[i]));
*gidarr_len = cpu_to_be32(p - gidarr_len - 1);
*cred_len = cpu_to_be32((p - cred_len - 1) << 2);
p = xdr_reserve_space(xdr, (p - gidarr_len - 1) << 2); if (!p) goto marshal_failed;
/* Verifier */
p = xdr_reserve_space(xdr, 2 * sizeof(*p)); if (!p) goto marshal_failed;
*p++ = rpc_auth_null;
*p = xdr_zero;
return0;
marshal_failed: return -EMSGSIZE;
}
/* * Refresh credentials. This is a no-op for AUTH_UNIX
*/ staticint
unx_refresh(struct rpc_task *task)
{
set_bit(RPCAUTH_CRED_UPTODATE, &task->tk_rqstp->rq_cred->cr_flags); return0;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.