*/
static int conversation (int num_msg,
-#ifndef SOL2
- const
-#endif
- struct pam_message **msg,
+ const struct pam_message **msg,
struct pam_response **resp, void *appdata_ptr)
{
int replies = 0;
#endif /* #ifdef USE_PAM */
int
-session_start(flags, user, passwd, ttyName, msg)
- const int flags;
- const char *user;
- const char *passwd;
- const char *ttyName;
- char **msg;
+session_start(const int flags, const char *user, const char *passwd, const char *ttyName, char **msg)
{
#ifdef USE_PAM
bool ok = 1;
bool try_session = 0;
#else /* #ifdef USE_PAM */
struct passwd *pw;
+ char *cbuf;
#ifdef HAS_SHADOW
struct spwd *spwd;
struct spwd *getspnam();
/*
* If no passwd, don't let them login if we're authenticating.
*/
- if (pw->pw_passwd == NULL || strlen(pw->pw_passwd) < 2
- || strcmp(crypt(passwd, pw->pw_passwd), pw->pw_passwd) != 0)
+ if (pw->pw_passwd == NULL || strlen(pw->pw_passwd) < 2)
+ return SESSION_FAILED;
+ cbuf = crypt(passwd, pw->pw_passwd);
+ if (!cbuf || strcmp(cbuf, pw->pw_passwd) != 0)
return SESSION_FAILED;
}
memset((void *)&ll, 0, sizeof(ll));
(void)time(&tnow);
ll.ll_time = tnow;
- (void)strncpy(ll.ll_line, ttyName, sizeof(ll.ll_line));
- (void)strncpy(ll.ll_host, ifname, sizeof(ll.ll_host));
+ strlcpy(ll.ll_line, ttyName, sizeof(ll.ll_line));
+ strlcpy(ll.ll_host, ifname, sizeof(ll.ll_host));
(void)write(fd, (char *)&ll, sizeof(ll));
(void)close(fd);
}