patches!
* more changes (extracted from redhat version) courtesy of
- Harald Welte (Bugs pam_limits=436061, pam_lastlog=436060 - agmorgan)
+ Harald Welte (Bugs pam_limits=436061, pam_lastlog=436060,
+ pam_mkhomedir/pam_env=435991 - agmorgan)
* fix for legacy behavior of pam_setcred and pam_close_session in
the case that pam_authenticate and pam_open_session hadn't been
called - bug report from Seongwan Park. (Bug 468724 - agmorgan)
_log_err(LOG_ERR, "Unterminated expandable variable: <%s>", orig-2);
return PAM_ABORT;
}
- strncpy(tmpval, orig, (size_t) BUF_SIZE);
+ strncpy(tmpval, orig, sizeof(tmpval));
+ tmpval[sizeof(tmpval)-1] = '\0';
orig=ptr;
/*
* so, we know we need to expand tmpval, it is either
#define MKHOMEDIR_QUIET 040 /* keep quiet about things */
static unsigned int UMask = 0022;
-static char SkelDir[BUFSIZ] = "/etc/skel";
+static char SkelDir[BUFSIZ] = "/etc/skel"; /* THIS MODULE IS NOT THREAD SAFE */
/* some syslogging */
static void _log_err(int err, const char *format, ...)
/* step through arguments */
for (; argc-- > 0; ++argv)
{
- if (!strcmp(*argv, "silent"))
- {
+ if (!strcmp(*argv, "silent")) {
ctrl |= MKHOMEDIR_QUIET;
- }
- else if (!strncmp(*argv,"umask=",6))
+ } else if (!strncmp(*argv,"umask=",6)) {
UMask = strtol(*argv+6,0,0);
- else if (!strncmp(*argv,"skel=",5))
- strcpy(SkelDir,*argv+5);
- else
- {
+ } else if (!strncmp(*argv,"skel=",5)) {
+ strncpy(SkelDir,*argv+5,sizeof(SkelDir));
+ SkelDir[sizeof(SkelDir)-1] = '\0';
+ } else {
_log_err(LOG_ERR, "unknown option; %s", *argv);
}
}