0.76: please submit patches for this section with actual code/doc
patches!
+* pam_unix/support.c: sample use of reentrant NSS function. Not yet active,
+ because modules do not include _pam_aconf_h! (Bug 440107 - vorlon)
* doc/Makefile changes - use $(mandir) [courtesy Harald Welte] (Bug
435760) and add some rules to make/delete the draft rfc I've been
working on (Task 17426 - agmorgan)
struct spwd *spwdent = NULL;
char *salt = NULL;
int retval;
+#if HAVE_GETPWNAM_R
+ char *buf = NULL;
+ int bufsize = 0;
+ struct passwd pwd_buf;
+
+ pwd = &pwd_buf;
+#endif
D(("called"));
return 0; /* will fail but don't let on yet */
/* UNIX passwords area */
- pwd = getpwnam(name); /* Get password file entry... */
+
+ /* Get password file entry... */
+#if HAVE_GETPWNAM_R
+ bufsize = 1024;
+ buf = malloc(bufsize);
+
+ if ((retval = getpwnam_r(name, pwd, buf, bufsize, &pwd))) {
+ pwd = NULL;
+ }
+ while (retval == ERANGE) {
+ bufsize += 1024;
+ buf = realloc(buf, bufsize);
+ if ((retval getpwnam_r(name, pwd, buf, bufsize, &pwd))) {
+ pwd = NULL;
+ }
+ }
+#else
+ pwd = getpwnam(name);
+#endif
if (pwd != NULL) {
if (strcmp( pwd->pw_passwd, "*NP*" ) == 0)
setreuid( 0, -1 );
if(setreuid( -1, pwd->pw_uid ) == -1)
/* Will fail elsewhere. */
+#if HAVE_GETPWNAM_R
+ if (buf)
+ free(buf);
+#endif
return 0;
}
}
if (salt)
_pam_delete(salt);
+#if HAVE_GETPWNAM_R
+ if (buf)
+ free(buf);
+#endif
+
return retval;
}