[cmaster-next] [PATCH] ldpd: add missing privilege dropping on error path

Renato Westphal renato at opensourcerouting.org
Mon Dec 19 11:09:33 EST 2016


Signed-off-by: Renato Westphal <renato at opensourcerouting.org>
---
 ldpd/socket.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/ldpd/socket.c b/ldpd/socket.c
index 1bb0837..eaea997 100644
--- a/ldpd/socket.c
+++ b/ldpd/socket.c
@@ -85,6 +85,8 @@ ldp_create_socket(int af, enum socket_type type)
 	if (ldpd_privs.change(ZPRIVS_RAISE))
 		log_warn("%s: could not raise privs", __func__);
 	if (sock_set_reuse(fd, 1) == -1) {
+		if (ldpd_privs.change(ZPRIVS_LOWER))
+			log_warn("%s: could not lower privs", __func__);
 		close(fd);
 		return (-1);
 	}
-- 
1.9.1





More information about the dev mailing list