aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc
diff options
context:
space:
mode:
authorOlga Kornievskaia <aglo@citi.umich.edu>2008-12-23 16:19:26 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2008-12-23 16:19:26 -0500
commit8b1c7bf5b624c9bc91b41ae577b9fc5c21641705 (patch)
tree30189b6146999ba27581a84dfefa9a4ab0e09d69 /net/sunrpc
parent61054b14d545e257b9415d5ca0cd5f43762b4d0c (diff)
rpc: add target field to new upcall
This patch extends the new upcall by adding a "target" field communicating who we want to authenticate to (equivalently, the service principal that we want to acquire a ticket for). Signed-off: Olga Kornievskaia <aglo@citi.umich.edu> Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net/sunrpc')
-rw-r--r--net/sunrpc/auth_gss/auth_gss.c28
1 files changed, 21 insertions, 7 deletions
diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c
index 153b3e11e61a..1e8cced55ff7 100644
--- a/net/sunrpc/auth_gss/auth_gss.c
+++ b/net/sunrpc/auth_gss/auth_gss.c
@@ -368,25 +368,39 @@ static void gss_encode_v0_msg(struct gss_upcall_msg *gss_msg)
368 gss_msg->msg.len = sizeof(gss_msg->uid); 368 gss_msg->msg.len = sizeof(gss_msg->uid);
369} 369}
370 370
371static void gss_encode_v1_msg(struct gss_upcall_msg *gss_msg) 371static void gss_encode_v1_msg(struct gss_upcall_msg *gss_msg,
372 struct rpc_clnt *clnt)
372{ 373{
373 gss_msg->msg.len = sprintf(gss_msg->databuf, "mech=%s uid=%d\n", 374 char *p = gss_msg->databuf;
375 int len = 0;
376
377 gss_msg->msg.len = sprintf(gss_msg->databuf, "mech=%s uid=%d ",
374 gss_msg->auth->mech->gm_name, 378 gss_msg->auth->mech->gm_name,
375 gss_msg->uid); 379 gss_msg->uid);
380 p += gss_msg->msg.len;
381 if (clnt->cl_principal) {
382 len = sprintf(p, "target=%s ", clnt->cl_principal);
383 p += len;
384 gss_msg->msg.len += len;
385 }
386 len = sprintf(p, "\n");
387 gss_msg->msg.len += len;
388
376 gss_msg->msg.data = gss_msg->databuf; 389 gss_msg->msg.data = gss_msg->databuf;
377 BUG_ON(gss_msg->msg.len > UPCALL_BUF_LEN); 390 BUG_ON(gss_msg->msg.len > UPCALL_BUF_LEN);
378} 391}
379 392
380static void gss_encode_msg(struct gss_upcall_msg *gss_msg) 393static void gss_encode_msg(struct gss_upcall_msg *gss_msg,
394 struct rpc_clnt *clnt)
381{ 395{
382 if (pipe_version == 0) 396 if (pipe_version == 0)
383 gss_encode_v0_msg(gss_msg); 397 gss_encode_v0_msg(gss_msg);
384 else /* pipe_version == 1 */ 398 else /* pipe_version == 1 */
385 gss_encode_v1_msg(gss_msg); 399 gss_encode_v1_msg(gss_msg, clnt);
386} 400}
387 401
388static inline struct gss_upcall_msg * 402static inline struct gss_upcall_msg *
389gss_alloc_msg(struct gss_auth *gss_auth, uid_t uid) 403gss_alloc_msg(struct gss_auth *gss_auth, uid_t uid, struct rpc_clnt *clnt)
390{ 404{
391 struct gss_upcall_msg *gss_msg; 405 struct gss_upcall_msg *gss_msg;
392 int vers; 406 int vers;
@@ -406,7 +420,7 @@ gss_alloc_msg(struct gss_auth *gss_auth, uid_t uid)
406 atomic_set(&gss_msg->count, 1); 420 atomic_set(&gss_msg->count, 1);
407 gss_msg->uid = uid; 421 gss_msg->uid = uid;
408 gss_msg->auth = gss_auth; 422 gss_msg->auth = gss_auth;
409 gss_encode_msg(gss_msg); 423 gss_encode_msg(gss_msg, clnt);
410 return gss_msg; 424 return gss_msg;
411} 425}
412 426
@@ -422,7 +436,7 @@ gss_setup_upcall(struct rpc_clnt *clnt, struct gss_auth *gss_auth, struct rpc_cr
422 if (gss_cred->gc_machine_cred != 0) 436 if (gss_cred->gc_machine_cred != 0)
423 uid = 0; 437 uid = 0;
424 438
425 gss_new = gss_alloc_msg(gss_auth, uid); 439 gss_new = gss_alloc_msg(gss_auth, uid, clnt);
426 if (IS_ERR(gss_new)) 440 if (IS_ERR(gss_new))
427 return gss_new; 441 return gss_new;
428 gss_msg = gss_add_msg(gss_auth, gss_new); 442 gss_msg = gss_add_msg(gss_auth, gss_new);