From owner-p4-projects@FreeBSD.ORG Mon Feb 5 10:25:42 2007 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 2195A16A40A; Mon, 5 Feb 2007 10:25:32 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 849DA16A403 for ; Mon, 5 Feb 2007 10:25:27 +0000 (UTC) (envelope-from bushman@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [69.147.83.41]) by mx1.freebsd.org (Postfix) with ESMTP id 759D013C441 for ; Mon, 5 Feb 2007 10:25:27 +0000 (UTC) (envelope-from bushman@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id l15APRH2096352 for ; Mon, 5 Feb 2007 10:25:27 GMT (envelope-from bushman@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id l15APRsA096349 for perforce@freebsd.org; Mon, 5 Feb 2007 10:25:27 GMT (envelope-from bushman@freebsd.org) Date: Mon, 5 Feb 2007 10:25:27 GMT Message-Id: <200702051025.l15APRsA096349@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to bushman@freebsd.org using -f From: Michael Bushkov To: Perforce Change Reviews Cc: Subject: PERFORCE change 114038 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Feb 2007 10:25:42 -0000 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); }