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.
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);
}
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"