staticint gssp_call(struct net *net, struct rpc_message *msg)
{ struct sunrpc_net *sn = net_generic(net, sunrpc_net_id); struct rpc_clnt *clnt; int status;
clnt = get_gssp_clnt(sn); if (!clnt) return -EIO;
status = rpc_call_sync(clnt, msg, 0); if (status < 0) {
dprintk("gssp: rpc_call returned error %d\n", -status); switch (status) { case -EPROTONOSUPPORT:
status = -EINVAL; break; case -ECONNREFUSED: case -ETIMEDOUT: case -ENOTCONN:
status = -EAGAIN; break; case -ERESTARTSYS: if (signalled ())
status = -EINTR; break; default: break;
}
}
rpc_release_client(clnt); return status;
}
/* terminate and remove realm part */
c = strchr(*principal, '@'); if (c) {
*c = '\0';
/* change service-hostname delimiter */
c = strchr(*principal, '/'); if (c)
*c = '@';
} if (!c) { /* not a service principal */
kfree(*principal);
*principal = NULL;
}
}
/* *Publicfunctions
*/
/* numbers somewhat arbitrary but large enough for current needs */ #define GSSX_MAX_OUT_HANDLE 128 #define GSSX_MAX_SRC_PRINC 256 #define GSSX_KMEMBUF (GSSX_max_output_handle_sz + \
GSSX_max_oid_sz + \
GSSX_max_princ_sz + \ sizeof(struct svc_cred))
if (data->in_handle.len != 0)
arg.context_handle = &ctxh;
res.output_token->len = GSSX_max_output_token_sz;
ret = gssp_alloc_receive_pages(&arg); if (ret) return ret;
ret = gssp_call(net, &msg);
gssp_free_receive_pages(&arg);
/* we need to fetch all data even in case of error so
* that we can free special strctures is they have been allocated */
data->major_status = res.status.major_status;
data->minor_status = res.status.minor_status; if (res.context_handle) {
data->out_handle = rctxh.exported_context_token;
data->mech_oid.len = rctxh.mech.len; if (rctxh.mech.data) {
memcpy(data->mech_oid.data, rctxh.mech.data,
data->mech_oid.len);
kfree(rctxh.mech.data);
}
client_name = rctxh.src_name.display_name;
target_name = rctxh.targ_name.display_name;
}
if (res.options.count == 1) {
gssx_buffer *value = &res.options.data[0].value; /* Currently we only decode CREDS_VALUE, if we add *anythingelsewe'llhavetoloopandmatchonthe
* option name */ if (value->len == 1) { /* steal group info from struct svc_cred */
data->creds = *(struct svc_cred *)value->data;
data->found_creds = 1;
} /* whether we use it or not, free data */
kfree(value->data);
}
if (res.options.count != 0) {
kfree(res.options.data);
}
/* convert to GSS_NT_HOSTBASED_SERVICE form and set into creds */ if (data->found_creds) { if (client_name.data) {
data->creds.cr_raw_principal =
gssp_stringify(&client_name);
data->creds.cr_principal =
gssp_stringify(&client_name);
gssp_hostbased_service(&data->creds.cr_principal);
} if (target_name.data) {
data->creds.cr_targ_princ =
gssp_stringify(&target_name);
gssp_hostbased_service(&data->creds.cr_targ_princ);
}
}
kfree(client_name.data);
kfree(target_name.data);
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.