diff options
-rw-r--r-- | fs/nfsd/nfs4callback.c | 6 | ||||
-rw-r--r-- | include/linux/sunrpc/clnt.h | 2 | ||||
-rw-r--r-- | net/sunrpc/clnt.c | 16 |
3 files changed, 24 insertions, 0 deletions
diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c index 094747a1227c..3ca141782145 100644 --- a/fs/nfsd/nfs4callback.c +++ b/fs/nfsd/nfs4callback.c | |||
@@ -384,6 +384,7 @@ static int do_probe_callback(void *data) | |||
384 | .version = nfs_cb_version[1]->number, | 384 | .version = nfs_cb_version[1]->number, |
385 | .authflavor = RPC_AUTH_UNIX, /* XXX: need AUTH_GSS... */ | 385 | .authflavor = RPC_AUTH_UNIX, /* XXX: need AUTH_GSS... */ |
386 | .flags = (RPC_CLNT_CREATE_NOPING | RPC_CLNT_CREATE_QUIET), | 386 | .flags = (RPC_CLNT_CREATE_NOPING | RPC_CLNT_CREATE_QUIET), |
387 | .client_name = clp->cl_principal, | ||
387 | }; | 388 | }; |
388 | struct rpc_message msg = { | 389 | struct rpc_message msg = { |
389 | .rpc_proc = &nfs4_cb_procedures[NFSPROC4_CLNT_CB_NULL], | 390 | .rpc_proc = &nfs4_cb_procedures[NFSPROC4_CLNT_CB_NULL], |
@@ -392,6 +393,11 @@ static int do_probe_callback(void *data) | |||
392 | struct rpc_clnt *client; | 393 | struct rpc_clnt *client; |
393 | int status; | 394 | int status; |
394 | 395 | ||
396 | if (!clp->cl_principal && (clp->cl_flavor >= RPC_AUTH_GSS_KRB5)) { | ||
397 | status = nfserr_cb_path_down; | ||
398 | goto out_err; | ||
399 | } | ||
400 | |||
395 | /* Initialize address */ | 401 | /* Initialize address */ |
396 | memset(&addr, 0, sizeof(addr)); | 402 | memset(&addr, 0, sizeof(addr)); |
397 | addr.sin_family = AF_INET; | 403 | addr.sin_family = AF_INET; |
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h index 6f0ee1b84a4f..c39a21040dcb 100644 --- a/include/linux/sunrpc/clnt.h +++ b/include/linux/sunrpc/clnt.h | |||
@@ -58,6 +58,7 @@ struct rpc_clnt { | |||
58 | struct rpc_timeout cl_timeout_default; | 58 | struct rpc_timeout cl_timeout_default; |
59 | struct rpc_program * cl_program; | 59 | struct rpc_program * cl_program; |
60 | char cl_inline_name[32]; | 60 | char cl_inline_name[32]; |
61 | char *cl_principal; /* target to authenticate to */ | ||
61 | }; | 62 | }; |
62 | 63 | ||
63 | /* | 64 | /* |
@@ -108,6 +109,7 @@ struct rpc_create_args { | |||
108 | u32 version; | 109 | u32 version; |
109 | rpc_authflavor_t authflavor; | 110 | rpc_authflavor_t authflavor; |
110 | unsigned long flags; | 111 | unsigned long flags; |
112 | char *client_name; | ||
111 | }; | 113 | }; |
112 | 114 | ||
113 | /* Values for "flags" field */ | 115 | /* Values for "flags" field */ |
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index 4895c341e46d..347f2a25abb6 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c | |||
@@ -197,6 +197,12 @@ static struct rpc_clnt * rpc_new_client(const struct rpc_create_args *args, stru | |||
197 | 197 | ||
198 | clnt->cl_rtt = &clnt->cl_rtt_default; | 198 | clnt->cl_rtt = &clnt->cl_rtt_default; |
199 | rpc_init_rtt(&clnt->cl_rtt_default, clnt->cl_timeout->to_initval); | 199 | rpc_init_rtt(&clnt->cl_rtt_default, clnt->cl_timeout->to_initval); |
200 | clnt->cl_principal = NULL; | ||
201 | if (args->client_name) { | ||
202 | clnt->cl_principal = kstrdup(args->client_name, GFP_KERNEL); | ||
203 | if (!clnt->cl_principal) | ||
204 | goto out_no_principal; | ||
205 | } | ||
200 | 206 | ||
201 | kref_init(&clnt->cl_kref); | 207 | kref_init(&clnt->cl_kref); |
202 | 208 | ||
@@ -226,6 +232,8 @@ out_no_auth: | |||
226 | rpc_put_mount(); | 232 | rpc_put_mount(); |
227 | } | 233 | } |
228 | out_no_path: | 234 | out_no_path: |
235 | kfree(clnt->cl_principal); | ||
236 | out_no_principal: | ||
229 | rpc_free_iostats(clnt->cl_metrics); | 237 | rpc_free_iostats(clnt->cl_metrics); |
230 | out_no_stats: | 238 | out_no_stats: |
231 | if (clnt->cl_server != clnt->cl_inline_name) | 239 | if (clnt->cl_server != clnt->cl_inline_name) |
@@ -354,6 +362,11 @@ rpc_clone_client(struct rpc_clnt *clnt) | |||
354 | new->cl_metrics = rpc_alloc_iostats(clnt); | 362 | new->cl_metrics = rpc_alloc_iostats(clnt); |
355 | if (new->cl_metrics == NULL) | 363 | if (new->cl_metrics == NULL) |
356 | goto out_no_stats; | 364 | goto out_no_stats; |
365 | if (clnt->cl_principal) { | ||
366 | new->cl_principal = kstrdup(clnt->cl_principal, GFP_KERNEL); | ||
367 | if (new->cl_principal == NULL) | ||
368 | goto out_no_principal; | ||
369 | } | ||
357 | kref_init(&new->cl_kref); | 370 | kref_init(&new->cl_kref); |
358 | err = rpc_setup_pipedir(new, clnt->cl_program->pipe_dir_name); | 371 | err = rpc_setup_pipedir(new, clnt->cl_program->pipe_dir_name); |
359 | if (err != 0) | 372 | if (err != 0) |
@@ -366,6 +379,8 @@ rpc_clone_client(struct rpc_clnt *clnt) | |||
366 | rpciod_up(); | 379 | rpciod_up(); |
367 | return new; | 380 | return new; |
368 | out_no_path: | 381 | out_no_path: |
382 | kfree(new->cl_principal); | ||
383 | out_no_principal: | ||
369 | rpc_free_iostats(new->cl_metrics); | 384 | rpc_free_iostats(new->cl_metrics); |
370 | out_no_stats: | 385 | out_no_stats: |
371 | kfree(new); | 386 | kfree(new); |
@@ -417,6 +432,7 @@ rpc_free_client(struct kref *kref) | |||
417 | out_free: | 432 | out_free: |
418 | rpc_unregister_client(clnt); | 433 | rpc_unregister_client(clnt); |
419 | rpc_free_iostats(clnt->cl_metrics); | 434 | rpc_free_iostats(clnt->cl_metrics); |
435 | kfree(clnt->cl_principal); | ||
420 | clnt->cl_metrics = NULL; | 436 | clnt->cl_metrics = NULL; |
421 | xprt_put(clnt->cl_xprt); | 437 | xprt_put(clnt->cl_xprt); |
422 | rpciod_down(); | 438 | rpciod_down(); |