diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2013-08-26 19:23:04 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2013-08-30 09:19:36 -0400 |
commit | c2190661039b3817b4cc1cbfea620b3f7dbe5cd8 (patch) | |
tree | 61b8f6f287993f604c3a7843aa2322c36f375af9 /net/sunrpc | |
parent | bd4a3eb15bb42296e61d0fd16f2c7f8cc171b681 (diff) |
SUNRPC: Replace clnt->cl_principal
The clnt->cl_principal is being used exclusively to store the service
target name for RPCSEC_GSS/krb5 callbacks. Replace it with something that
is stored only in the RPCSEC_GSS-specific code.
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net/sunrpc')
-rw-r--r-- | net/sunrpc/auth.c | 6 | ||||
-rw-r--r-- | net/sunrpc/auth_gss/auth_gss.c | 7 | ||||
-rw-r--r-- | net/sunrpc/auth_null.c | 2 | ||||
-rw-r--r-- | net/sunrpc/auth_unix.c | 2 | ||||
-rw-r--r-- | net/sunrpc/clnt.c | 18 |
5 files changed, 14 insertions, 21 deletions
diff --git a/net/sunrpc/auth.c b/net/sunrpc/auth.c index ed2fdd210c0b..5071e435471c 100644 --- a/net/sunrpc/auth.c +++ b/net/sunrpc/auth.c | |||
@@ -250,11 +250,11 @@ rpcauth_list_flavors(rpc_authflavor_t *array, int size) | |||
250 | EXPORT_SYMBOL_GPL(rpcauth_list_flavors); | 250 | EXPORT_SYMBOL_GPL(rpcauth_list_flavors); |
251 | 251 | ||
252 | struct rpc_auth * | 252 | struct rpc_auth * |
253 | rpcauth_create(rpc_authflavor_t pseudoflavor, struct rpc_clnt *clnt) | 253 | rpcauth_create(struct rpc_auth_create_args *args, struct rpc_clnt *clnt) |
254 | { | 254 | { |
255 | struct rpc_auth *auth; | 255 | struct rpc_auth *auth; |
256 | const struct rpc_authops *ops; | 256 | const struct rpc_authops *ops; |
257 | u32 flavor = pseudoflavor_to_flavor(pseudoflavor); | 257 | u32 flavor = pseudoflavor_to_flavor(args->pseudoflavor); |
258 | 258 | ||
259 | auth = ERR_PTR(-EINVAL); | 259 | auth = ERR_PTR(-EINVAL); |
260 | if (flavor >= RPC_AUTH_MAXFLAVOR) | 260 | if (flavor >= RPC_AUTH_MAXFLAVOR) |
@@ -269,7 +269,7 @@ rpcauth_create(rpc_authflavor_t pseudoflavor, struct rpc_clnt *clnt) | |||
269 | goto out; | 269 | goto out; |
270 | } | 270 | } |
271 | spin_unlock(&rpc_authflavor_lock); | 271 | spin_unlock(&rpc_authflavor_lock); |
272 | auth = ops->create(clnt, pseudoflavor); | 272 | auth = ops->create(args, clnt); |
273 | module_put(ops->owner); | 273 | module_put(ops->owner); |
274 | if (IS_ERR(auth)) | 274 | if (IS_ERR(auth)) |
275 | return auth; | 275 | return auth; |
diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c index b62812a224a8..672a67ff6449 100644 --- a/net/sunrpc/auth_gss/auth_gss.c +++ b/net/sunrpc/auth_gss/auth_gss.c | |||
@@ -864,8 +864,9 @@ static int gss_pipes_dentries_create_net(struct rpc_clnt *clnt, | |||
864 | * parameters based on the input flavor (which must be a pseudoflavor) | 864 | * parameters based on the input flavor (which must be a pseudoflavor) |
865 | */ | 865 | */ |
866 | static struct rpc_auth * | 866 | static struct rpc_auth * |
867 | gss_create(struct rpc_clnt *clnt, rpc_authflavor_t flavor) | 867 | gss_create(struct rpc_auth_create_args *args, struct rpc_clnt *clnt) |
868 | { | 868 | { |
869 | rpc_authflavor_t flavor = args->pseudoflavor; | ||
869 | struct gss_auth *gss_auth; | 870 | struct gss_auth *gss_auth; |
870 | struct rpc_auth * auth; | 871 | struct rpc_auth * auth; |
871 | int err = -ENOMEM; /* XXX? */ | 872 | int err = -ENOMEM; /* XXX? */ |
@@ -877,8 +878,8 @@ gss_create(struct rpc_clnt *clnt, rpc_authflavor_t flavor) | |||
877 | if (!(gss_auth = kmalloc(sizeof(*gss_auth), GFP_KERNEL))) | 878 | if (!(gss_auth = kmalloc(sizeof(*gss_auth), GFP_KERNEL))) |
878 | goto out_dec; | 879 | goto out_dec; |
879 | gss_auth->target_name = NULL; | 880 | gss_auth->target_name = NULL; |
880 | if (clnt->cl_principal) { | 881 | if (args->target_name) { |
881 | gss_auth->target_name = kstrdup(clnt->cl_principal, GFP_KERNEL); | 882 | gss_auth->target_name = kstrdup(args->target_name, GFP_KERNEL); |
882 | if (gss_auth->target_name == NULL) | 883 | if (gss_auth->target_name == NULL) |
883 | goto err_free; | 884 | goto err_free; |
884 | } | 885 | } |
diff --git a/net/sunrpc/auth_null.c b/net/sunrpc/auth_null.c index a5c36c01707b..4664eb46baa0 100644 --- a/net/sunrpc/auth_null.c +++ b/net/sunrpc/auth_null.c | |||
@@ -18,7 +18,7 @@ static struct rpc_auth null_auth; | |||
18 | static struct rpc_cred null_cred; | 18 | static struct rpc_cred null_cred; |
19 | 19 | ||
20 | static struct rpc_auth * | 20 | static struct rpc_auth * |
21 | nul_create(struct rpc_clnt *clnt, rpc_authflavor_t flavor) | 21 | nul_create(struct rpc_auth_create_args *args, struct rpc_clnt *clnt) |
22 | { | 22 | { |
23 | atomic_inc(&null_auth.au_count); | 23 | atomic_inc(&null_auth.au_count); |
24 | return &null_auth; | 24 | return &null_auth; |
diff --git a/net/sunrpc/auth_unix.c b/net/sunrpc/auth_unix.c index dc37021fc3e5..e52d832f9a2a 100644 --- a/net/sunrpc/auth_unix.c +++ b/net/sunrpc/auth_unix.c | |||
@@ -33,7 +33,7 @@ static struct rpc_auth unix_auth; | |||
33 | static const struct rpc_credops unix_credops; | 33 | static const struct rpc_credops unix_credops; |
34 | 34 | ||
35 | static struct rpc_auth * | 35 | static struct rpc_auth * |
36 | unx_create(struct rpc_clnt *clnt, rpc_authflavor_t flavor) | 36 | unx_create(struct rpc_auth_create_args *args, struct rpc_clnt *clnt) |
37 | { | 37 | { |
38 | dprintk("RPC: creating UNIX authenticator for client %p\n", | 38 | dprintk("RPC: creating UNIX authenticator for client %p\n", |
39 | clnt); | 39 | clnt); |
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index 79d4bc2c316c..7407f1d86ebb 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c | |||
@@ -282,6 +282,10 @@ static void rpc_clnt_set_nodename(struct rpc_clnt *clnt, const char *nodename) | |||
282 | static int rpc_client_register(const struct rpc_create_args *args, | 282 | static int rpc_client_register(const struct rpc_create_args *args, |
283 | struct rpc_clnt *clnt) | 283 | struct rpc_clnt *clnt) |
284 | { | 284 | { |
285 | struct rpc_auth_create_args auth_args = { | ||
286 | .pseudoflavor = args->authflavor, | ||
287 | .target_name = args->client_name, | ||
288 | }; | ||
285 | struct rpc_auth *auth; | 289 | struct rpc_auth *auth; |
286 | struct net *net = rpc_net_ns(clnt); | 290 | struct net *net = rpc_net_ns(clnt); |
287 | struct super_block *pipefs_sb; | 291 | struct super_block *pipefs_sb; |
@@ -298,7 +302,7 @@ static int rpc_client_register(const struct rpc_create_args *args, | |||
298 | if (pipefs_sb) | 302 | if (pipefs_sb) |
299 | rpc_put_sb_net(net); | 303 | rpc_put_sb_net(net); |
300 | 304 | ||
301 | auth = rpcauth_create(args->authflavor, clnt); | 305 | auth = rpcauth_create(&auth_args, clnt); |
302 | if (IS_ERR(auth)) { | 306 | if (IS_ERR(auth)) { |
303 | dprintk("RPC: Couldn't create auth handle (flavor %u)\n", | 307 | dprintk("RPC: Couldn't create auth handle (flavor %u)\n", |
304 | args->authflavor); | 308 | args->authflavor); |
@@ -370,12 +374,6 @@ static struct rpc_clnt * rpc_new_client(const struct rpc_create_args *args, stru | |||
370 | 374 | ||
371 | clnt->cl_rtt = &clnt->cl_rtt_default; | 375 | clnt->cl_rtt = &clnt->cl_rtt_default; |
372 | rpc_init_rtt(&clnt->cl_rtt_default, clnt->cl_timeout->to_initval); | 376 | rpc_init_rtt(&clnt->cl_rtt_default, clnt->cl_timeout->to_initval); |
373 | clnt->cl_principal = NULL; | ||
374 | if (args->client_name) { | ||
375 | clnt->cl_principal = kstrdup(args->client_name, GFP_KERNEL); | ||
376 | if (!clnt->cl_principal) | ||
377 | goto out_no_principal; | ||
378 | } | ||
379 | 377 | ||
380 | atomic_set(&clnt->cl_count, 1); | 378 | atomic_set(&clnt->cl_count, 1); |
381 | 379 | ||
@@ -388,8 +386,6 @@ static struct rpc_clnt * rpc_new_client(const struct rpc_create_args *args, stru | |||
388 | return clnt; | 386 | return clnt; |
389 | 387 | ||
390 | out_no_path: | 388 | out_no_path: |
391 | kfree(clnt->cl_principal); | ||
392 | out_no_principal: | ||
393 | rpc_free_iostats(clnt->cl_metrics); | 389 | rpc_free_iostats(clnt->cl_metrics); |
394 | out_no_stats: | 390 | out_no_stats: |
395 | kfree(clnt); | 391 | kfree(clnt); |
@@ -559,7 +555,6 @@ struct rpc_clnt *rpc_clone_client(struct rpc_clnt *clnt) | |||
559 | .prognumber = clnt->cl_prog, | 555 | .prognumber = clnt->cl_prog, |
560 | .version = clnt->cl_vers, | 556 | .version = clnt->cl_vers, |
561 | .authflavor = clnt->cl_auth->au_flavor, | 557 | .authflavor = clnt->cl_auth->au_flavor, |
562 | .client_name = clnt->cl_principal, | ||
563 | }; | 558 | }; |
564 | return __rpc_clone_client(&args, clnt); | 559 | return __rpc_clone_client(&args, clnt); |
565 | } | 560 | } |
@@ -581,7 +576,6 @@ rpc_clone_client_set_auth(struct rpc_clnt *clnt, rpc_authflavor_t flavor) | |||
581 | .prognumber = clnt->cl_prog, | 576 | .prognumber = clnt->cl_prog, |
582 | .version = clnt->cl_vers, | 577 | .version = clnt->cl_vers, |
583 | .authflavor = flavor, | 578 | .authflavor = flavor, |
584 | .client_name = clnt->cl_principal, | ||
585 | }; | 579 | }; |
586 | return __rpc_clone_client(&args, clnt); | 580 | return __rpc_clone_client(&args, clnt); |
587 | } | 581 | } |
@@ -654,7 +648,6 @@ rpc_free_client(struct rpc_clnt *clnt) | |||
654 | rpc_clnt_remove_pipedir(clnt); | 648 | rpc_clnt_remove_pipedir(clnt); |
655 | rpc_unregister_client(clnt); | 649 | rpc_unregister_client(clnt); |
656 | rpc_free_iostats(clnt->cl_metrics); | 650 | rpc_free_iostats(clnt->cl_metrics); |
657 | kfree(clnt->cl_principal); | ||
658 | clnt->cl_metrics = NULL; | 651 | clnt->cl_metrics = NULL; |
659 | xprt_put(rcu_dereference_raw(clnt->cl_xprt)); | 652 | xprt_put(rcu_dereference_raw(clnt->cl_xprt)); |
660 | rpciod_down(); | 653 | rpciod_down(); |
@@ -718,7 +711,6 @@ struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *old, | |||
718 | .prognumber = program->number, | 711 | .prognumber = program->number, |
719 | .version = vers, | 712 | .version = vers, |
720 | .authflavor = old->cl_auth->au_flavor, | 713 | .authflavor = old->cl_auth->au_flavor, |
721 | .client_name = old->cl_principal, | ||
722 | }; | 714 | }; |
723 | struct rpc_clnt *clnt; | 715 | struct rpc_clnt *clnt; |
724 | int err; | 716 | int err; |