Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 294372
b: refs/heads/master
c: ccdc28f
h: refs/heads/master
v: v3
  • Loading branch information
Stanislav Kinsbursky authored and Trond Myklebust committed Jan 31, 2012
1 parent 1de5cc4 commit 9d7b582
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 23 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 0157d021d23a087eecfa830502f81cfe843f0d16
refs/heads/master: ccdc28f81c91f7ef2dc6c28d27f50264b19e4dd5
95 changes: 73 additions & 22 deletions trunk/net/sunrpc/auth_gss/auth_gss.c
Original file line number Diff line number Diff line change
Expand Up @@ -757,6 +757,73 @@ gss_pipe_destroy_msg(struct rpc_pipe_msg *msg)
}
}

static void gss_pipes_dentries_destroy(struct rpc_auth *auth)
{
struct gss_auth *gss_auth;

gss_auth = container_of(auth, struct gss_auth, rpc_auth);
rpc_unlink(gss_auth->pipe[0]->dentry);
rpc_unlink(gss_auth->pipe[1]->dentry);
}

static int gss_pipes_dentries_create(struct rpc_auth *auth)
{
int err;
struct gss_auth *gss_auth;
struct rpc_clnt *clnt;

gss_auth = container_of(auth, struct gss_auth, rpc_auth);
clnt = gss_auth->client;

gss_auth->pipe[1]->dentry = rpc_mkpipe_dentry(clnt->cl_path.dentry,
"gssd",
clnt, gss_auth->pipe[1]);
if (IS_ERR(gss_auth->pipe[1]->dentry))
return PTR_ERR(gss_auth->pipe[1]->dentry);
gss_auth->pipe[0]->dentry = rpc_mkpipe_dentry(clnt->cl_path.dentry,
gss_auth->mech->gm_name,
clnt, gss_auth->pipe[0]);
if (IS_ERR(gss_auth->pipe[0]->dentry)) {
err = PTR_ERR(gss_auth->pipe[0]->dentry);
goto err_unlink_pipe_1;
}
return 0;

err_unlink_pipe_1:
rpc_unlink(gss_auth->pipe[1]->dentry);
return err;
}

static void gss_pipes_dentries_destroy_net(struct rpc_clnt *clnt,
struct rpc_auth *auth)
{
struct net *net = clnt->cl_xprt->xprt_net;
struct super_block *sb;

sb = rpc_get_sb_net(net);
if (sb) {
if (clnt->cl_path.dentry)
gss_pipes_dentries_destroy(auth);
rpc_put_sb_net(net);
}
}

static int gss_pipes_dentries_create_net(struct rpc_clnt *clnt,
struct rpc_auth *auth)
{
struct net *net = clnt->cl_xprt->xprt_net;
struct super_block *sb;
int err = 0;

sb = rpc_get_sb_net(net);
if (sb) {
if (clnt->cl_path.dentry)
err = gss_pipes_dentries_create(auth);
rpc_put_sb_net(net);
}
return err;
}

/*
* NOTE: we have the opportunity to use different
* parameters based on the input flavor (which must be a pseudoflavor)
Expand Down Expand Up @@ -812,31 +879,16 @@ gss_create(struct rpc_clnt *clnt, rpc_authflavor_t flavor)
err = PTR_ERR(gss_auth->pipe[0]);
goto err_destroy_pipe_1;
}

gss_auth->pipe[1]->dentry = rpc_mkpipe_dentry(clnt->cl_path.dentry,
"gssd",
clnt, gss_auth->pipe[1]);
if (IS_ERR(gss_auth->pipe[1]->dentry)) {
err = PTR_ERR(gss_auth->pipe[1]->dentry);
err = gss_pipes_dentries_create_net(clnt, auth);
if (err)
goto err_destroy_pipe_0;
}

gss_auth->pipe[0]->dentry = rpc_mkpipe_dentry(clnt->cl_path.dentry,
gss_auth->mech->gm_name,
clnt, gss_auth->pipe[0]);
if (IS_ERR(gss_auth->pipe[0]->dentry)) {
err = PTR_ERR(gss_auth->pipe[0]->dentry);
goto err_unlink_pipe_1;
}
err = rpcauth_init_credcache(auth);
if (err)
goto err_unlink_pipe_0;
goto err_unlink_pipes;

return auth;
err_unlink_pipe_0:
rpc_unlink(gss_auth->pipe[0]->dentry);
err_unlink_pipe_1:
rpc_unlink(gss_auth->pipe[1]->dentry);
err_unlink_pipes:
gss_pipes_dentries_destroy_net(clnt, auth);
err_destroy_pipe_0:
rpc_destroy_pipe_data(gss_auth->pipe[0]);
err_destroy_pipe_1:
Expand All @@ -853,8 +905,7 @@ gss_create(struct rpc_clnt *clnt, rpc_authflavor_t flavor)
static void
gss_free(struct gss_auth *gss_auth)
{
rpc_unlink(gss_auth->pipe[0]->dentry);
rpc_unlink(gss_auth->pipe[1]->dentry);
gss_pipes_dentries_destroy_net(gss_auth->client, &gss_auth->rpc_auth);
rpc_destroy_pipe_data(gss_auth->pipe[0]);
rpc_destroy_pipe_data(gss_auth->pipe[1]);
gss_mech_put(gss_auth->mech);
Expand Down

0 comments on commit 9d7b582

Please sign in to comment.