From owner-svn-src-all@FreeBSD.ORG Thu Dec 22 19:58:59 2011 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EFC5A106566B; Thu, 22 Dec 2011 19:58:59 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebius.int.ru (glebius.int.ru [81.19.64.117]) by mx1.freebsd.org (Postfix) with ESMTP id 6DC9C8FC12; Thu, 22 Dec 2011 19:58:59 +0000 (UTC) Received: from cell.glebius.int.ru (localhost [127.0.0.1]) by cell.glebius.int.ru (8.14.5/8.14.5) with ESMTP id pBMJvfxS093598; Thu, 22 Dec 2011 23:57:41 +0400 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.14.5/8.14.5/Submit) id pBMJvf7S093597; Thu, 22 Dec 2011 23:57:41 +0400 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebius.int.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Thu, 22 Dec 2011 23:57:41 +0400 From: Gleb Smirnoff To: Dag-Erling Sm??rgrav Message-ID: <20111222195741.GB80057@FreeBSD.org> References: <201112221810.pBMIAFlo028054@svn.freebsd.org> <20111222182219.GS80057@FreeBSD.org> <86bor0sbra.fsf@ds4.des.no> <867h1osbgl.fsf@ds4.des.no> <20111222184258.GU80057@FreeBSD.org> <8639ccs8my.fsf@ds4.des.no> <20111222195053.GA80057@FreeBSD.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="7J16OGEJ/mt06A90" Content-Disposition: inline In-Reply-To: <20111222195053.GA80057@FreeBSD.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, svn-src-vendor@FreeBSD.org Subject: Re: svn commit: r228809 - vendor/openpam/dist/lib X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Dec 2011 19:59:00 -0000 --7J16OGEJ/mt06A90 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline On Thu, Dec 22, 2011 at 11:50:53PM +0400, Gleb Smirnoff wrote: T> Here is my variant attached. Sorry, this one is correct. -- Totus tuus, Glebius. --7J16OGEJ/mt06A90 Content-Type: text/x-diff; charset=koi8-r Content-Disposition: attachment; filename="openpam_dynamic.c.diff" Index: openpam_dynamic.c =================================================================== --- openpam_dynamic.c (revision 228816) +++ openpam_dynamic.c (working copy) @@ -63,12 +63,17 @@ static void * try_dlopen(const char *modfn) { + void *dlh; if (openpam_check_path_owner_perms(modfn) != 0) return (NULL); - return (dlopen(modfn, RTLD_NOW)); + if ((dlh = dlopen(modfn, RTLD_NOW)) == NULL) { + openpam_log(PAM_LOG_ERROR, "%s: %s", modfn, dlerror()); + errno = 0; + } + return (dlh); } - + /* * OpenPAM internal * @@ -83,7 +88,7 @@ const char *prefix; char *vpath; void *dlh; - int i, serrno; + int i; dlh = NULL; @@ -100,9 +105,6 @@ *strrchr(vpath, '.') = '\0'; dlh = try_dlopen(vpath); } - serrno = errno; - FREE(vpath); - errno = serrno; if (dlh == NULL) goto err; if ((module = calloc(1, sizeof *module)) == NULL) @@ -118,13 +120,16 @@ openpam_log(PAM_LOG_DEBUG, "%s: %s(): %s", path, pam_sm_func_name[i], dlerror()); } + FREE(vpath); return (module); buf_err: if (dlh != NULL) dlclose(dlh); FREE(module); err: - openpam_log(PAM_LOG_ERROR, "%m"); + if (errno != 0) + openpam_log(PAM_LOG_ERROR, "%s: %m", vpath); + FREE(vpath); return (NULL); } --7J16OGEJ/mt06A90--