From b9aa0a0baa33efb06a773de18f2b45c12c15cbaf Mon Sep 17 00:00:00 2001 From: Darren Tucker Date: Tue, 8 Jul 2003 22:59:59 +1000 Subject: - (dtucker) [auth-passwd.c auth.c session.c sshd.c port-aix.c port-aix.h] Convert aixloginmsg into platform-independant Buffer loginmsg. --- auth-passwd.c | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) (limited to 'auth-passwd.c') diff --git a/auth-passwd.c b/auth-passwd.c index ea65a012..f078eddd 100644 --- a/auth-passwd.c +++ b/auth-passwd.c @@ -42,6 +42,8 @@ RCSID("$OpenBSD: auth-passwd.c,v 1.27 2002/05/24 16:45:16 stevesk Exp $"); #include "log.h" #include "servconf.h" #include "auth.h" +#include "buffer.h" +#include "xmalloc.h" #include "canohost.h" #if !defined(HAVE_OSF_SIA) @@ -79,9 +81,7 @@ RCSID("$OpenBSD: auth-passwd.c,v 1.27 2002/05/24 16:45:16 stevesk Exp $"); #endif /* !HAVE_OSF_SIA */ extern ServerOptions options; -#ifdef WITH_AIXAUTHENTICATE -extern char *aixloginmsg; -#endif +extern Buffer loginmsg; /* * Tries to authenticate the user using password. Returns true if @@ -149,15 +149,29 @@ auth_password(Authctxt *authctxt, const char *password) # endif # ifdef WITH_AIXAUTHENTICATE authsuccess = (authenticate(pw->pw_name,password,&reenter,&authmsg) == 0); + aix_remove_embedded_newlines(authmsg); if (authsuccess) { + char *msg; + char *host = (char *)get_canonical_hostname(options.use_dns); + + debug3("AIX/authenticate succeeded for user %s: %.100s", + pw->pw_name, authmsg); + /* We don't have a pty yet, so just label the line as "ssh" */ - if (loginsuccess(authctxt->user, - get_canonical_hostname(options.use_dns), - "ssh", &aixloginmsg) < 0) { - aixloginmsg = NULL; + if (loginsuccess(authctxt->user, host, "ssh", &msg) == 0){ + if (msg != NULL) { + debug("%s: msg %s", __func__, msg); + buffer_append(&loginmsg, msg, strlen(msg)); + xfree(msg); + } } + } else { + debug3("AIX/authenticate failed for user %s: %.100s", + pw->pw_name, authmsg); } + if (authmsg != NULL) + xfree(authmsg); return (authsuccess); # endif -- cgit v1.2.1