View | Details | Raw Unified | Return to bug 712 | Differences between
and this patch

Collapse All | Expand All

(-)auth-passwd.c (-43 / +3 lines)
Lines 42-53 RCSID("$OpenBSD: auth-passwd.c,v 1.29 20 Link Here
42
#include "log.h"
42
#include "log.h"
43
#include "servconf.h"
43
#include "servconf.h"
44
#include "auth.h"
44
#include "auth.h"
45
#ifdef WITH_AIXAUTHENTICATE
45
#include "buffer.h"
46
# include "buffer.h"
47
# include "canohost.h"
48
extern Buffer loginmsg;
49
#endif
50
46
47
extern Buffer loginmsg;
51
extern ServerOptions options;
48
extern ServerOptions options;
52
49
53
/*
50
/*
Lines 92-135 auth_password(Authctxt *authctxt, const Link Here
92
	}
89
	}
93
# endif
90
# endif
94
# ifdef WITH_AIXAUTHENTICATE
91
# ifdef WITH_AIXAUTHENTICATE
95
	{
92
	return aix_authenticate(pw->pw_name, password);
96
		char *authmsg = NULL;
97
		int reenter = 1;
98
		int authsuccess = 0;
99
100
		if (authenticate(pw->pw_name, password, &reenter,
101
		    &authmsg) == 0 && ok) {
102
			char *msg;
103
			char *host = 
104
			    (char *)get_canonical_hostname(options.use_dns);
105
106
			authsuccess = 1;
107
			aix_remove_embedded_newlines(authmsg);	
108
109
			debug3("AIX/authenticate succeeded for user %s: %.100s",
110
				pw->pw_name, authmsg);
111
112
	        	/* No pty yet, so just label the line as "ssh" */
113
			aix_setauthdb(authctxt->user);
114
	        	if (loginsuccess(authctxt->user, host, "ssh", 
115
			    &msg) == 0) {
116
				if (msg != NULL) {
117
					debug("%s: msg %s", __func__, msg);
118
					buffer_append(&loginmsg, msg, 
119
					    strlen(msg));
120
					xfree(msg);
121
				}
122
			}
123
		} else {
124
			debug3("AIX/authenticate failed for user %s: %.100s",
125
			    pw->pw_name, authmsg);
126
		}
127
128
		if (authmsg != NULL)
129
			xfree(authmsg);
130
131
		return authsuccess;
132
	}
133
# endif
93
# endif
134
# ifdef BSD_AUTH
94
# ifdef BSD_AUTH
135
	if (auth_userokay(pw->pw_name, authctxt->style, "auth-ssh",
95
	if (auth_userokay(pw->pw_name, authctxt->style, "auth-ssh",
(-)openbsd-compat/port-aix.c (-2 / +40 lines)
Lines 29-34 Link Here
29
#include "servconf.h"
29
#include "servconf.h"
30
#include "canohost.h"
30
#include "canohost.h"
31
#include "xmalloc.h"
31
#include "xmalloc.h"
32
#include "buffer.h"
32
33
33
#ifdef _AIX
34
#ifdef _AIX
34
35
Lines 36-41 Link Here
36
#include "port-aix.h"
37
#include "port-aix.h"
37
38
38
extern ServerOptions options;
39
extern ServerOptions options;
40
extern Buffer loginmsg;
39
41
40
/*
42
/*
41
 * AIX has a "usrinfo" area where logname and other stuff is stored - 
43
 * AIX has a "usrinfo" area where logname and other stuff is stored - 
Lines 64-69 aix_usrinfo(struct passwd *pw) Link Here
64
}
66
}
65
67
66
#ifdef WITH_AIXAUTHENTICATE
68
#ifdef WITH_AIXAUTHENTICATE
69
int
70
aix_authenticate(const char *user, const char *password)
71
{
72
	char *authmsg;
73
	int success, reenter = 1;
74
75
	aix_setauthdb(user);
76
77
	/* XXX: should really loop until reenter == 0 */
78
	while (reenter) 
79
		success = (authenticate((char *)user, (char *)password,
80
		    &reenter, &authmsg) == 0);
81
	aix_remove_embedded_newlines(authmsg);	
82
	debug3("AIX/authenticate %s for user %s, reenter %d: %.100s",
83
	    success ? "succeeded" : "failed", user, reenter, authmsg);
84
85
	if (success) {
86
		char *msg, *host;
87
88
		host = (char *)get_canonical_hostname(options.use_dns);
89
90
        	/* No pty yet, so just label the line as "ssh" */
91
        	if (loginsuccess((char *)user, host, "ssh", &msg) == 0 &&
92
		    msg != NULL) {
93
			debug3("AIX/loginsuccess: %s", msg);
94
			buffer_append(&loginmsg, msg, strlen(msg));
95
			xfree(msg);
96
		}
97
	}
98
99
	if (authmsg != NULL)
100
		xfree(authmsg);
101
102
	return (success);
103
}
104
67
/*
105
/*
68
 * Remove embedded newlines in string (if any).
106
 * Remove embedded newlines in string (if any).
69
 * Used before logging messages returned by AIX authentication functions
107
 * Used before logging messages returned by AIX authentication functions
Lines 84-90 aix_remove_embedded_newlines(char *p) Link Here
84
		*p = '\0';
122
		*p = '\0';
85
}
123
}
86
#endif /* WITH_AIXAUTHENTICATE */
124
#endif /* WITH_AIXAUTHENTICATE */
87
  
125
 
88
# ifdef CUSTOM_FAILED_LOGIN
126
# ifdef CUSTOM_FAILED_LOGIN
89
/*
127
/*
90
 * record_failed_login: generic "login failed" interface function
128
 * record_failed_login: generic "login failed" interface function
Lines 92-98 aix_remove_embedded_newlines(char *p) Link Here
92
void
130
void
93
record_failed_login(const char *user, const char *ttyname)
131
record_failed_login(const char *user, const char *ttyname)
94
{
132
{
95
	char *hostname = get_canonical_hostname(options.use_dns);
133
	char *hostname = (char *)get_canonical_hostname(options.use_dns);
96
134
97
	if (geteuid() != 0)
135
	if (geteuid() != 0)
98
		return;
136
		return;
(-)openbsd-compat/port-aix.h (+1 lines)
Lines 55-60 Link Here
55
# define CUSTOM_FAILED_LOGIN 1
55
# define CUSTOM_FAILED_LOGIN 1
56
void record_failed_login(const char *, const char *);
56
void record_failed_login(const char *, const char *);
57
void aix_setauthdb(const char *);
57
void aix_setauthdb(const char *);
58
int aix_authenticate(const char *, const char *);
58
#endif
59
#endif
59
60
60
void aix_usrinfo(struct passwd *);
61
void aix_usrinfo(struct passwd *);

Return to bug 712