diff options
Diffstat (limited to 'fs/nfsd/nfs4state.c')
-rw-r--r-- | fs/nfsd/nfs4state.c | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 9295c4b56bce..bfc14d879ea1 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c | |||
@@ -55,6 +55,7 @@ | |||
55 | #include <linux/lockd/bind.h> | 55 | #include <linux/lockd/bind.h> |
56 | #include <linux/module.h> | 56 | #include <linux/module.h> |
57 | #include <linux/sunrpc/svcauth_gss.h> | 57 | #include <linux/sunrpc/svcauth_gss.h> |
58 | #include <linux/sunrpc/clnt.h> | ||
58 | 59 | ||
59 | #define NFSDDBG_FACILITY NFSDDBG_PROC | 60 | #define NFSDDBG_FACILITY NFSDDBG_PROC |
60 | 61 | ||
@@ -1220,13 +1221,15 @@ nfsd4_exchange_id(struct svc_rqst *rqstp, | |||
1220 | int status; | 1221 | int status; |
1221 | unsigned int strhashval; | 1222 | unsigned int strhashval; |
1222 | char dname[HEXDIR_LEN]; | 1223 | char dname[HEXDIR_LEN]; |
1224 | char addr_str[INET6_ADDRSTRLEN]; | ||
1223 | nfs4_verifier verf = exid->verifier; | 1225 | nfs4_verifier verf = exid->verifier; |
1224 | u32 ip_addr = svc_addr_in(rqstp)->sin_addr.s_addr; | 1226 | struct sockaddr *sa = svc_addr(rqstp); |
1225 | 1227 | ||
1228 | rpc_ntop(sa, addr_str, sizeof(addr_str)); | ||
1226 | dprintk("%s rqstp=%p exid=%p clname.len=%u clname.data=%p " | 1229 | dprintk("%s rqstp=%p exid=%p clname.len=%u clname.data=%p " |
1227 | " ip_addr=%u flags %x, spa_how %d\n", | 1230 | "ip_addr=%s flags %x, spa_how %d\n", |
1228 | __func__, rqstp, exid, exid->clname.len, exid->clname.data, | 1231 | __func__, rqstp, exid, exid->clname.len, exid->clname.data, |
1229 | ip_addr, exid->flags, exid->spa_how); | 1232 | addr_str, exid->flags, exid->spa_how); |
1230 | 1233 | ||
1231 | if (!check_name(exid->clname) || (exid->flags & ~EXCHGID4_FLAG_MASK_A)) | 1234 | if (!check_name(exid->clname) || (exid->flags & ~EXCHGID4_FLAG_MASK_A)) |
1232 | return nfserr_inval; | 1235 | return nfserr_inval; |
@@ -1315,7 +1318,7 @@ out_new: | |||
1315 | 1318 | ||
1316 | copy_verf(new, &verf); | 1319 | copy_verf(new, &verf); |
1317 | copy_cred(&new->cl_cred, &rqstp->rq_cred); | 1320 | copy_cred(&new->cl_cred, &rqstp->rq_cred); |
1318 | new->cl_addr = ip_addr; | 1321 | rpc_copy_addr((struct sockaddr *) &new->cl_addr, sa); |
1319 | gen_clid(new); | 1322 | gen_clid(new); |
1320 | gen_confirm(new); | 1323 | gen_confirm(new); |
1321 | add_to_unconfirmed(new, strhashval); | 1324 | add_to_unconfirmed(new, strhashval); |
@@ -1389,7 +1392,7 @@ nfsd4_create_session(struct svc_rqst *rqstp, | |||
1389 | struct nfsd4_compound_state *cstate, | 1392 | struct nfsd4_compound_state *cstate, |
1390 | struct nfsd4_create_session *cr_ses) | 1393 | struct nfsd4_create_session *cr_ses) |
1391 | { | 1394 | { |
1392 | u32 ip_addr = svc_addr_in(rqstp)->sin_addr.s_addr; | 1395 | struct sockaddr *sa = svc_addr(rqstp); |
1393 | struct nfs4_client *conf, *unconf; | 1396 | struct nfs4_client *conf, *unconf; |
1394 | struct nfsd4_clid_slot *cs_slot = NULL; | 1397 | struct nfsd4_clid_slot *cs_slot = NULL; |
1395 | int status = 0; | 1398 | int status = 0; |
@@ -1417,7 +1420,7 @@ nfsd4_create_session(struct svc_rqst *rqstp, | |||
1417 | cs_slot->sl_seqid++; | 1420 | cs_slot->sl_seqid++; |
1418 | } else if (unconf) { | 1421 | } else if (unconf) { |
1419 | if (!same_creds(&unconf->cl_cred, &rqstp->rq_cred) || | 1422 | if (!same_creds(&unconf->cl_cred, &rqstp->rq_cred) || |
1420 | (ip_addr != unconf->cl_addr)) { | 1423 | !rpc_cmp_addr(sa, (struct sockaddr *) &unconf->cl_addr)) { |
1421 | status = nfserr_clid_inuse; | 1424 | status = nfserr_clid_inuse; |
1422 | goto out; | 1425 | goto out; |
1423 | } | 1426 | } |
@@ -1564,7 +1567,7 @@ __be32 | |||
1564 | nfsd4_setclientid(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | 1567 | nfsd4_setclientid(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, |
1565 | struct nfsd4_setclientid *setclid) | 1568 | struct nfsd4_setclientid *setclid) |
1566 | { | 1569 | { |
1567 | struct sockaddr_in *sin = svc_addr_in(rqstp); | 1570 | struct sockaddr *sa = svc_addr(rqstp); |
1568 | struct xdr_netobj clname = { | 1571 | struct xdr_netobj clname = { |
1569 | .len = setclid->se_namelen, | 1572 | .len = setclid->se_namelen, |
1570 | .data = setclid->se_name, | 1573 | .data = setclid->se_name, |
@@ -1596,8 +1599,11 @@ nfsd4_setclientid(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | |||
1596 | /* RFC 3530 14.2.33 CASE 0: */ | 1599 | /* RFC 3530 14.2.33 CASE 0: */ |
1597 | status = nfserr_clid_inuse; | 1600 | status = nfserr_clid_inuse; |
1598 | if (!same_creds(&conf->cl_cred, &rqstp->rq_cred)) { | 1601 | if (!same_creds(&conf->cl_cred, &rqstp->rq_cred)) { |
1599 | dprintk("NFSD: setclientid: string in use by client" | 1602 | char addr_str[INET6_ADDRSTRLEN]; |
1600 | " at %pI4\n", &conf->cl_addr); | 1603 | rpc_ntop((struct sockaddr *) &conf->cl_addr, addr_str, |
1604 | sizeof(addr_str)); | ||
1605 | dprintk("NFSD: setclientid: string in use by client " | ||
1606 | "at %s\n", addr_str); | ||
1601 | goto out; | 1607 | goto out; |
1602 | } | 1608 | } |
1603 | } | 1609 | } |
@@ -1659,7 +1665,7 @@ nfsd4_setclientid(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | |||
1659 | gen_clid(new); | 1665 | gen_clid(new); |
1660 | } | 1666 | } |
1661 | copy_verf(new, &clverifier); | 1667 | copy_verf(new, &clverifier); |
1662 | new->cl_addr = sin->sin_addr.s_addr; | 1668 | rpc_copy_addr((struct sockaddr *) &new->cl_addr, sa); |
1663 | new->cl_flavor = rqstp->rq_flavor; | 1669 | new->cl_flavor = rqstp->rq_flavor; |
1664 | princ = svc_gss_principal(rqstp); | 1670 | princ = svc_gss_principal(rqstp); |
1665 | if (princ) { | 1671 | if (princ) { |
@@ -1693,7 +1699,7 @@ nfsd4_setclientid_confirm(struct svc_rqst *rqstp, | |||
1693 | struct nfsd4_compound_state *cstate, | 1699 | struct nfsd4_compound_state *cstate, |
1694 | struct nfsd4_setclientid_confirm *setclientid_confirm) | 1700 | struct nfsd4_setclientid_confirm *setclientid_confirm) |
1695 | { | 1701 | { |
1696 | struct sockaddr_in *sin = svc_addr_in(rqstp); | 1702 | struct sockaddr *sa = svc_addr(rqstp); |
1697 | struct nfs4_client *conf, *unconf; | 1703 | struct nfs4_client *conf, *unconf; |
1698 | nfs4_verifier confirm = setclientid_confirm->sc_confirm; | 1704 | nfs4_verifier confirm = setclientid_confirm->sc_confirm; |
1699 | clientid_t * clid = &setclientid_confirm->sc_clientid; | 1705 | clientid_t * clid = &setclientid_confirm->sc_clientid; |
@@ -1712,9 +1718,9 @@ nfsd4_setclientid_confirm(struct svc_rqst *rqstp, | |||
1712 | unconf = find_unconfirmed_client(clid); | 1718 | unconf = find_unconfirmed_client(clid); |
1713 | 1719 | ||
1714 | status = nfserr_clid_inuse; | 1720 | status = nfserr_clid_inuse; |
1715 | if (conf && conf->cl_addr != sin->sin_addr.s_addr) | 1721 | if (conf && !rpc_cmp_addr((struct sockaddr *) &conf->cl_addr, sa)) |
1716 | goto out; | 1722 | goto out; |
1717 | if (unconf && unconf->cl_addr != sin->sin_addr.s_addr) | 1723 | if (unconf && !rpc_cmp_addr((struct sockaddr *) &unconf->cl_addr, sa)) |
1718 | goto out; | 1724 | goto out; |
1719 | 1725 | ||
1720 | /* | 1726 | /* |