svn commit: r320588 - releng/11.1/usr.sbin/rpc.lockd
Xin LI
delphij at FreeBSD.org
Mon Jul 3 05:42:56 UTC 2017
Author: delphij
Date: Mon Jul 3 05:42:55 2017
New Revision: 320588
URL: https://svnweb.freebsd.org/changeset/base/320588
Log:
MFS r320586: MFC r320093: Check return value of seteuid() and bail out
if we fail.
Approved by: re (kib)
Modified:
releng/11.1/usr.sbin/rpc.lockd/lock_proc.c
Directory Properties:
releng/11.1/ (props changed)
Modified: releng/11.1/usr.sbin/rpc.lockd/lock_proc.c
==============================================================================
--- releng/11.1/usr.sbin/rpc.lockd/lock_proc.c Mon Jul 3 05:30:31 2017 (r320587)
+++ releng/11.1/usr.sbin/rpc.lockd/lock_proc.c Mon Jul 3 05:42:55 2017 (r320588)
@@ -276,7 +276,10 @@ get_client(struct sockaddr *host_addr, rpcvers_t vers)
/* Regain root privileges, for bindresvport. */
old_euid = geteuid();
- seteuid(0);
+ if (seteuid(0) != 0) {
+ syslog(LOG_ERR, "seteuid(0) failed");
+ return NULL;
+ }
/*
* Bind the client FD to a reserved port.
@@ -285,7 +288,10 @@ get_client(struct sockaddr *host_addr, rpcvers_t vers)
bindresvport(clnt_fd, NULL);
/* Drop root privileges again. */
- seteuid(old_euid);
+ if (seteuid(old_euid) != 0) {
+ syslog(LOG_ERR, "seteuid(%d) failed", old_euid);
+ return NULL;
+ }
/* Success - update the cache entry */
clnt_cache_ptr[clnt_cache_next_to_use] = client;
More information about the svn-src-releng
mailing list