aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc/auth_gss
diff options
context:
space:
mode:
Diffstat (limited to 'net/sunrpc/auth_gss')
-rw-r--r--net/sunrpc/auth_gss/auth_gss.c70
-rw-r--r--net/sunrpc/auth_gss/gss_krb5_mech.c7
-rw-r--r--net/sunrpc/auth_gss/gss_mech_switch.c32
3 files changed, 59 insertions, 50 deletions
diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c
index 5daf6cc4fae..e9b76939268 100644
--- a/net/sunrpc/auth_gss/auth_gss.c
+++ b/net/sunrpc/auth_gss/auth_gss.c
@@ -603,26 +603,6 @@ out:
603 return err; 603 return err;
604} 604}
605 605
606static ssize_t
607gss_pipe_upcall(struct file *filp, struct rpc_pipe_msg *msg,
608 char __user *dst, size_t buflen)
609{
610 char *data = (char *)msg->data + msg->copied;
611 size_t mlen = min(msg->len, buflen);
612 unsigned long left;
613
614 left = copy_to_user(dst, data, mlen);
615 if (left == mlen) {
616 msg->errno = -EFAULT;
617 return -EFAULT;
618 }
619
620 mlen -= left;
621 msg->copied += mlen;
622 msg->errno = 0;
623 return mlen;
624}
625
626#define MSG_BUF_MAXSIZE 1024 606#define MSG_BUF_MAXSIZE 1024
627 607
628static ssize_t 608static ssize_t
@@ -1421,18 +1401,16 @@ gss_wrap_req(struct rpc_task *task,
1421 goto out; 1401 goto out;
1422 } 1402 }
1423 switch (gss_cred->gc_service) { 1403 switch (gss_cred->gc_service) {
1424 case RPC_GSS_SVC_NONE: 1404 case RPC_GSS_SVC_NONE:
1425 gss_wrap_req_encode(encode, rqstp, p, obj); 1405 gss_wrap_req_encode(encode, rqstp, p, obj);
1426 status = 0; 1406 status = 0;
1427 break; 1407 break;
1428 case RPC_GSS_SVC_INTEGRITY: 1408 case RPC_GSS_SVC_INTEGRITY:
1429 status = gss_wrap_req_integ(cred, ctx, encode, 1409 status = gss_wrap_req_integ(cred, ctx, encode, rqstp, p, obj);
1430 rqstp, p, obj); 1410 break;
1431 break; 1411 case RPC_GSS_SVC_PRIVACY:
1432 case RPC_GSS_SVC_PRIVACY: 1412 status = gss_wrap_req_priv(cred, ctx, encode, rqstp, p, obj);
1433 status = gss_wrap_req_priv(cred, ctx, encode, 1413 break;
1434 rqstp, p, obj);
1435 break;
1436 } 1414 }
1437out: 1415out:
1438 gss_put_ctx(ctx); 1416 gss_put_ctx(ctx);
@@ -1531,18 +1509,18 @@ gss_unwrap_resp(struct rpc_task *task,
1531 if (ctx->gc_proc != RPC_GSS_PROC_DATA) 1509 if (ctx->gc_proc != RPC_GSS_PROC_DATA)
1532 goto out_decode; 1510 goto out_decode;
1533 switch (gss_cred->gc_service) { 1511 switch (gss_cred->gc_service) {
1534 case RPC_GSS_SVC_NONE: 1512 case RPC_GSS_SVC_NONE:
1535 break; 1513 break;
1536 case RPC_GSS_SVC_INTEGRITY: 1514 case RPC_GSS_SVC_INTEGRITY:
1537 status = gss_unwrap_resp_integ(cred, ctx, rqstp, &p); 1515 status = gss_unwrap_resp_integ(cred, ctx, rqstp, &p);
1538 if (status) 1516 if (status)
1539 goto out; 1517 goto out;
1540 break; 1518 break;
1541 case RPC_GSS_SVC_PRIVACY: 1519 case RPC_GSS_SVC_PRIVACY:
1542 status = gss_unwrap_resp_priv(cred, ctx, rqstp, &p); 1520 status = gss_unwrap_resp_priv(cred, ctx, rqstp, &p);
1543 if (status) 1521 if (status)
1544 goto out; 1522 goto out;
1545 break; 1523 break;
1546 } 1524 }
1547 /* take into account extra slack for integrity and privacy cases: */ 1525 /* take into account extra slack for integrity and privacy cases: */
1548 cred->cr_auth->au_rslack = cred->cr_auth->au_verfsize + (p - savedp) 1526 cred->cr_auth->au_rslack = cred->cr_auth->au_verfsize + (p - savedp)
@@ -1592,7 +1570,7 @@ static const struct rpc_credops gss_nullops = {
1592}; 1570};
1593 1571
1594static const struct rpc_pipe_ops gss_upcall_ops_v0 = { 1572static const struct rpc_pipe_ops gss_upcall_ops_v0 = {
1595 .upcall = gss_pipe_upcall, 1573 .upcall = rpc_pipe_generic_upcall,
1596 .downcall = gss_pipe_downcall, 1574 .downcall = gss_pipe_downcall,
1597 .destroy_msg = gss_pipe_destroy_msg, 1575 .destroy_msg = gss_pipe_destroy_msg,
1598 .open_pipe = gss_pipe_open_v0, 1576 .open_pipe = gss_pipe_open_v0,
@@ -1600,7 +1578,7 @@ static const struct rpc_pipe_ops gss_upcall_ops_v0 = {
1600}; 1578};
1601 1579
1602static const struct rpc_pipe_ops gss_upcall_ops_v1 = { 1580static const struct rpc_pipe_ops gss_upcall_ops_v1 = {
1603 .upcall = gss_pipe_upcall, 1581 .upcall = rpc_pipe_generic_upcall,
1604 .downcall = gss_pipe_downcall, 1582 .downcall = gss_pipe_downcall,
1605 .destroy_msg = gss_pipe_destroy_msg, 1583 .destroy_msg = gss_pipe_destroy_msg,
1606 .open_pipe = gss_pipe_open_v1, 1584 .open_pipe = gss_pipe_open_v1,
diff --git a/net/sunrpc/auth_gss/gss_krb5_mech.c b/net/sunrpc/auth_gss/gss_krb5_mech.c
index c3b75333b82..8c67890de42 100644
--- a/net/sunrpc/auth_gss/gss_krb5_mech.c
+++ b/net/sunrpc/auth_gss/gss_krb5_mech.c
@@ -744,6 +744,13 @@ static struct pf_desc gss_kerberos_pfs[] = {
744 }, 744 },
745}; 745};
746 746
747MODULE_ALIAS("rpc-auth-gss-krb5");
748MODULE_ALIAS("rpc-auth-gss-krb5i");
749MODULE_ALIAS("rpc-auth-gss-krb5p");
750MODULE_ALIAS("rpc-auth-gss-390003");
751MODULE_ALIAS("rpc-auth-gss-390004");
752MODULE_ALIAS("rpc-auth-gss-390005");
753
747static struct gss_api_mech gss_kerberos_mech = { 754static struct gss_api_mech gss_kerberos_mech = {
748 .gm_name = "krb5", 755 .gm_name = "krb5",
749 .gm_owner = THIS_MODULE, 756 .gm_owner = THIS_MODULE,
diff --git a/net/sunrpc/auth_gss/gss_mech_switch.c b/net/sunrpc/auth_gss/gss_mech_switch.c
index e3c36a27441..ca8cad8251c 100644
--- a/net/sunrpc/auth_gss/gss_mech_switch.c
+++ b/net/sunrpc/auth_gss/gss_mech_switch.c
@@ -141,7 +141,7 @@ gss_mech_get(struct gss_api_mech *gm)
141EXPORT_SYMBOL_GPL(gss_mech_get); 141EXPORT_SYMBOL_GPL(gss_mech_get);
142 142
143struct gss_api_mech * 143struct gss_api_mech *
144gss_mech_get_by_name(const char *name) 144_gss_mech_get_by_name(const char *name)
145{ 145{
146 struct gss_api_mech *pos, *gm = NULL; 146 struct gss_api_mech *pos, *gm = NULL;
147 147
@@ -158,6 +158,17 @@ gss_mech_get_by_name(const char *name)
158 158
159} 159}
160 160
161struct gss_api_mech * gss_mech_get_by_name(const char *name)
162{
163 struct gss_api_mech *gm = NULL;
164
165 gm = _gss_mech_get_by_name(name);
166 if (!gm) {
167 request_module("rpc-auth-gss-%s", name);
168 gm = _gss_mech_get_by_name(name);
169 }
170 return gm;
171}
161EXPORT_SYMBOL_GPL(gss_mech_get_by_name); 172EXPORT_SYMBOL_GPL(gss_mech_get_by_name);
162 173
163struct gss_api_mech * 174struct gss_api_mech *
@@ -194,10 +205,9 @@ mech_supports_pseudoflavor(struct gss_api_mech *gm, u32 pseudoflavor)
194 return 0; 205 return 0;
195} 206}
196 207
197struct gss_api_mech * 208struct gss_api_mech *_gss_mech_get_by_pseudoflavor(u32 pseudoflavor)
198gss_mech_get_by_pseudoflavor(u32 pseudoflavor)
199{ 209{
200 struct gss_api_mech *pos, *gm = NULL; 210 struct gss_api_mech *gm = NULL, *pos;
201 211
202 spin_lock(&registered_mechs_lock); 212 spin_lock(&registered_mechs_lock);
203 list_for_each_entry(pos, &registered_mechs, gm_list) { 213 list_for_each_entry(pos, &registered_mechs, gm_list) {
@@ -213,6 +223,20 @@ gss_mech_get_by_pseudoflavor(u32 pseudoflavor)
213 return gm; 223 return gm;
214} 224}
215 225
226struct gss_api_mech *
227gss_mech_get_by_pseudoflavor(u32 pseudoflavor)
228{
229 struct gss_api_mech *gm;
230
231 gm = _gss_mech_get_by_pseudoflavor(pseudoflavor);
232
233 if (!gm) {
234 request_module("rpc-auth-gss-%u", pseudoflavor);
235 gm = _gss_mech_get_by_pseudoflavor(pseudoflavor);
236 }
237 return gm;
238}
239
216EXPORT_SYMBOL_GPL(gss_mech_get_by_pseudoflavor); 240EXPORT_SYMBOL_GPL(gss_mech_get_by_pseudoflavor);
217 241
218int gss_mech_list_pseudoflavors(rpc_authflavor_t *array_ptr) 242int gss_mech_list_pseudoflavors(rpc_authflavor_t *array_ptr)