From 8121d1c243ad28a706363ee4ae5bfeb9623fe705 Mon Sep 17 00:00:00 2001 From: Ralf Haferkamp Date: Aug 11 2011 17:19:46 +0000 Subject: Allow the O_NONBLOCK flag to be reset correctly sssd set the O_NONBLOCK flag on the LDAP socket twice. First in set_fd_flags_and_opts(). And the second time in sdap_async_sys_connect_send() after storing a backup in the local state structure. The backup is later used to restore the original flags (after connect() succeeded). As NONBLOCK was already set before it didn't correctly reset that flag. https://fedorahosted.org/sssd/ticket/952 --- diff --git a/src/util/sss_ldap.c b/src/util/sss_ldap.c index 601885b..bff7c8d 100644 --- a/src/util/sss_ldap.c +++ b/src/util/sss_ldap.c @@ -258,20 +258,6 @@ static errno_t set_fd_flags_and_opts(int fd) return ret; } - flags = fcntl(fd, F_GETFL, 0); - if (flags == -1) { - ret = errno; - DEBUG(1, ("fcntl F_GETFL failed [%d][%s].\n", ret, strerror(ret))); - return ret; - } - - flags = fcntl(fd, F_SETFL, flags| O_NONBLOCK); - if (flags == -1) { - ret = errno; - DEBUG(1, ("fcntl F_SETFL failed [%d][%s].\n", ret, strerror(ret))); - return ret; - } - /* SO_KEEPALIVE and TCP_NODELAY are set by OpenLDAP client libraries but * failures are ignored.*/ ret = setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, &dummy, sizeof(dummy));