Date: Mon, 5 Feb 2007 10:25:27 GMT From: Michael Bushkov <bushman@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 114038 for review Message-ID: <200702051025.l15APRsA096349@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=114038 Change 114038 by bushman@bushman_nss_ldap_cached on 2007/02/05 10:24:49 nss_ldap now works correctly, when the processor forks() Affected files ... .. //depot/projects/soc2006/nss_ldap_cached/src/lib/nss_ldap/ldapconn.c#16 edit Differences ... ==== //depot/projects/soc2006/nss_ldap_cached/src/lib/nss_ldap/ldapconn.c#16 (text+ko) ==== @@ -100,7 +100,11 @@ { struct nss_ldap_connection_error conn_err; int dummy_fd, backup_fd, rv; - + + /* + * If we can't get the socket from ldap connection, then don't + * close it gracefully and just ignore it. + */ if (conn->sock_fd == -1) return (NSS_LDAP_CONNECTION_ERROR); @@ -114,7 +118,7 @@ if (dummy_fd != conn->sock_fd) { backup_fd = dup(conn->sock_fd); dup2(dummy_fd, conn->sock_fd); - close (conn->sock_fd); + close(conn->sock_fd); } memset(&conn_err, 0, sizeof(struct nss_ldap_connection_error)); rv = __nss_ldap_disconnect(&__nss_ldap_conf->connection_method, conn, @@ -138,13 +142,9 @@ struct nss_ldap_connection_error conn_err_; int rv; - if (check_connection_socket(conn) != 0) { + if (check_connection_socket(conn) != 0 || conn->last_pid != getpid()) { rv = close_lost_connection(conn); return (NSS_LDAP_CONNECTION_ERROR); - } else if (conn->last_pid != getpid()) { - (void)__nss_ldap_disconnect(&__nss_ldap_conf->connection_method, - conn, __nss_ldap_conf, &conn_err_); - return (NSS_LDAP_CONNECTION_ERROR); } else return (NSS_LDAP_SUCCESS); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200702051025.l15APRsA096349>