Re: [PATCH 5/6] SUNRPC: Add RPC based upcall mechanism for RPCGSS auth

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Feb 21, 2013 at 06:35:46PM +0000, Myklebust, Trond wrote:
> On Thu, 2013-02-21 at 11:38 -0500, J. Bruce Fields wrote:
> > +int gssp_accept_sec_context_upcall(struct net *net,
> > +				struct gssp_upcall_data *data)
> > +{
> > +	struct gssx_arg_accept_sec_context arg;
> > +	struct gssx_res_accept_sec_context res;
> > +	struct gssx_ctx ctxh;
> > +	struct gssx_ctx rctxh;
> > +	struct gssx_cred delegcred;
> > +	struct rpc_message msg = {
> > +		.rpc_proc = &gssp_procedures[GSSX_ACCEPT_SEC_CONTEXT],
> > +		.rpc_argp = &arg,
> > +		.rpc_resp = &res,
> > +		.rpc_cred = NULL, /* FIXME ? */
> > +	};
> > +	struct xdr_netobj client_name = { 0 , NULL };
> > +	int ret;
> > +
> > +	/* fill in arg */
> > +	memset(&arg, 0, sizeof(arg));
> > +	if (data->in_handle.len != 0) {
> > +		memset(&ctxh, 0, sizeof(ctxh));
> > +		arg.context_handle = &ctxh;
> > +		ctxh.state = data->in_handle;
> > +	}
> > +	arg.input_token = data->in_token;
> > +
> > +	/* use nfs/ for targ_name ? */
> > +
> > +	/* prepare res */
> > +	memset(&res, 0, sizeof(res));
> > +	memset(&rctxh, 0, sizeof(rctxh));
> > +	res.context_handle = &rctxh;
> > +
> > +	/* pass in the max length we expect for each of these
> > +	 * buffers but let the xdr code kmalloc them */
> > +	rctxh.exported_context_token.len = GSSX_max_output_handle_sz;
> > +	rctxh.mech.len = GSSX_max_oid_sz;
> > +	rctxh.src_name.display_name.len = GSSX_max_princ_sz;
> > +
> > +	res.output_token = &data->out_token;
> > +	res.output_token->len = GSSX_max_output_token_sz;
> 
> 
> C99 initialisers for arg, and res would clean this up nicely... Main
> question is how much stack does all the above eat?

It's about 1k, yuch.  I don't think that's going to cause problems here
in practice, but I'll see if I can trim it down, at least some of it
doesn't look like it's really used.

> > +static int gssx_dec_buffer(struct xdr_stream *xdr,
> > +			   gssx_buffer *buf)
> > +{
> > +	u32 length;
> > +	__be32 *p;
> > +
> > +	p = xdr_inline_decode(xdr, 4);
> > +	if (unlikely(p == NULL))
> > +		return -ENOSPC;
> > +
> > +	length = be32_to_cpup(p);
> > +	p = xdr_inline_decode(xdr, length);
> 
> combine for efficiency with the 4 byte allocation above.

I don't understand what you're asking for.  If you're suggesting a
single xdr_inline_decode(xdr, 4 + length)--I don't see how we can do
that with the length not known yet.

--b.
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux