Make rpc.lockd bind to a reserved port, since there are NFS clients
which ignore NLM requests not coming from a reserved port. PR: 56500 Submitted by: Jonathan Lennox <lennox@cs.columbia.edu> MFC after: 1 week
This commit is contained in:
parent
662713f2a8
commit
c0f7cd1a2a
@ -197,6 +197,8 @@ get_client(host_addr, vers)
|
||||
const char *netid;
|
||||
struct netconfig *nconf;
|
||||
char host[NI_MAXHOST];
|
||||
uid_t old_euid;
|
||||
int clnt_fd;
|
||||
|
||||
gettimeofday(&time_now, NULL);
|
||||
|
||||
@ -271,6 +273,22 @@ get_client(host_addr, vers)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Get the FD of the client, for bindresvport. */
|
||||
clnt_control(client, CLGET_FD, &clnt_fd);
|
||||
|
||||
/* Regain root privileges, for bindresvport. */
|
||||
old_euid = geteuid();
|
||||
seteuid(0);
|
||||
|
||||
/*
|
||||
* Bind the client FD to a reserved port.
|
||||
* Some NFS servers reject any NLM request from a non-reserved port.
|
||||
*/
|
||||
bindresvport(clnt_fd, NULL);
|
||||
|
||||
/* Drop root privileges again. */
|
||||
seteuid(old_euid);
|
||||
|
||||
/* Success - update the cache entry */
|
||||
clnt_cache_ptr[clnt_cache_next_to_use] = client;
|
||||
memcpy(&clnt_cache_addr[clnt_cache_next_to_use], host_addr,
|
||||
|
Loading…
Reference in New Issue
Block a user