summaryrefslogtreecommitdiff
path: root/auth1.c
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2004-12-03 14:33:47 +1100
committerDarren Tucker <dtucker@zip.com.au>2004-12-03 14:33:47 +1100
commitc13866719fc39d5feebfb80ca251a7b31583d803 (patch)
tree4c74232e227c89bf87b83eafcf2165a9aeaf7374 /auth1.c
parent9c6bf325c0cf03fc40e87e51d165189dce07c594 (diff)
- (dtucker) [auth1.c auth2.c] If the user successfully authenticates but is
subsequently denied by the PAM auth stack, send the PAM message to the user via packet_disconnect (Protocol 1) or userauth_banner (Protocol 2). ok djm@
Diffstat (limited to 'auth1.c')
-rw-r--r--auth1.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/auth1.c b/auth1.c
index 3f93b9869..2a9d18b9a 100644
--- a/auth1.c
+++ b/auth1.c
@@ -25,9 +25,11 @@ RCSID("$OpenBSD: auth1.c,v 1.59 2004/07/28 09:40:29 markus Exp $");
25#include "session.h" 25#include "session.h"
26#include "uidswap.h" 26#include "uidswap.h"
27#include "monitor_wrap.h" 27#include "monitor_wrap.h"
28#include "buffer.h"
28 29
29/* import */ 30/* import */
30extern ServerOptions options; 31extern ServerOptions options;
32extern Buffer loginmsg;
31 33
32/* 34/*
33 * convert ssh auth msg type into description 35 * convert ssh auth msg type into description
@@ -251,8 +253,23 @@ do_authloop(Authctxt *authctxt)
251 253
252#ifdef USE_PAM 254#ifdef USE_PAM
253 if (options.use_pam && authenticated && 255 if (options.use_pam && authenticated &&
254 !PRIVSEP(do_pam_account())) 256 !PRIVSEP(do_pam_account())) {
255 authenticated = 0; 257 char *msg;
258 size_t len;
259
260 error("Access denied for user %s by PAM account "
261 "configuration", authctxt->user);
262 len = buffer_len(&loginmsg);
263 buffer_append(&loginmsg, "\0", 1);
264 msg = buffer_ptr(&loginmsg);
265 /* strip trailing newlines */
266 if (len > 0)
267 while (len > 0 && msg[--len] == '\n')
268 msg[len] = '\0';
269 else
270 msg = "Access denied.";
271 packet_disconnect(msg);
272 }
256#endif 273#endif
257 274
258 /* Log before sending the reply */ 275 /* Log before sending the reply */