aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc/rpcb_clnt.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/sunrpc/rpcb_clnt.c')
-rw-r--r--net/sunrpc/rpcb_clnt.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/net/sunrpc/rpcb_clnt.c b/net/sunrpc/rpcb_clnt.c
index 35c1ded1fc47..691bd216f469 100644
--- a/net/sunrpc/rpcb_clnt.c
+++ b/net/sunrpc/rpcb_clnt.c
@@ -140,8 +140,7 @@ static struct rpc_clnt *rpcb_create_local(struct sockaddr *addr,
140} 140}
141 141
142static struct rpc_clnt *rpcb_create(char *hostname, struct sockaddr *srvaddr, 142static struct rpc_clnt *rpcb_create(char *hostname, struct sockaddr *srvaddr,
143 size_t salen, int proto, u32 version, 143 size_t salen, int proto, u32 version)
144 int privileged)
145{ 144{
146 struct rpc_create_args args = { 145 struct rpc_create_args args = {
147 .protocol = proto, 146 .protocol = proto,
@@ -151,7 +150,8 @@ static struct rpc_clnt *rpcb_create(char *hostname, struct sockaddr *srvaddr,
151 .program = &rpcb_program, 150 .program = &rpcb_program,
152 .version = version, 151 .version = version,
153 .authflavor = RPC_AUTH_UNIX, 152 .authflavor = RPC_AUTH_UNIX,
154 .flags = RPC_CLNT_CREATE_NOPING, 153 .flags = (RPC_CLNT_CREATE_NOPING |
154 RPC_CLNT_CREATE_NONPRIVPORT),
155 }; 155 };
156 156
157 switch (srvaddr->sa_family) { 157 switch (srvaddr->sa_family) {
@@ -165,8 +165,6 @@ static struct rpc_clnt *rpcb_create(char *hostname, struct sockaddr *srvaddr,
165 return NULL; 165 return NULL;
166 } 166 }
167 167
168 if (!privileged)
169 args.flags |= RPC_CLNT_CREATE_NONPRIVPORT;
170 return rpc_create(&args); 168 return rpc_create(&args);
171} 169}
172 170
@@ -255,7 +253,7 @@ int rpcb_getport_sync(struct sockaddr_in *sin, u32 prog, u32 vers, int prot)
255 __func__, NIPQUAD(sin->sin_addr.s_addr), prog, vers, prot); 253 __func__, NIPQUAD(sin->sin_addr.s_addr), prog, vers, prot);
256 254
257 rpcb_clnt = rpcb_create(NULL, (struct sockaddr *)sin, 255 rpcb_clnt = rpcb_create(NULL, (struct sockaddr *)sin,
258 sizeof(*sin), prot, RPCBVERS_2, 0); 256 sizeof(*sin), prot, RPCBVERS_2);
259 if (IS_ERR(rpcb_clnt)) 257 if (IS_ERR(rpcb_clnt))
260 return PTR_ERR(rpcb_clnt); 258 return PTR_ERR(rpcb_clnt);
261 259
@@ -365,7 +363,7 @@ void rpcb_getport_async(struct rpc_task *task)
365 task->tk_pid, __func__, bind_version); 363 task->tk_pid, __func__, bind_version);
366 364
367 rpcb_clnt = rpcb_create(clnt->cl_server, sap, salen, xprt->prot, 365 rpcb_clnt = rpcb_create(clnt->cl_server, sap, salen, xprt->prot,
368 bind_version, 0); 366 bind_version);
369 if (IS_ERR(rpcb_clnt)) { 367 if (IS_ERR(rpcb_clnt)) {
370 status = PTR_ERR(rpcb_clnt); 368 status = PTR_ERR(rpcb_clnt);
371 dprintk("RPC: %5u %s: rpcb_create failed, error %ld\n", 369 dprintk("RPC: %5u %s: rpcb_create failed, error %ld\n",