summaryrefslogtreecommitdiff
path: root/auth.c
diff options
context:
space:
mode:
Diffstat (limited to 'auth.c')
-rw-r--r--auth.c30
1 files changed, 26 insertions, 4 deletions
diff --git a/auth.c b/auth.c
index ac126e6f3..9a36f1dac 100644
--- a/auth.c
+++ b/auth.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: auth.c,v 1.102 2013/05/17 00:13:13 djm Exp $ */ 1/* $OpenBSD: auth.c,v 1.103 2013/05/19 02:42:42 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2000 Markus Friedl. All rights reserved. 3 * Copyright (c) 2000 Markus Friedl. All rights reserved.
4 * 4 *
@@ -72,6 +72,7 @@
72#include "authfile.h" 72#include "authfile.h"
73#include "monitor_wrap.h" 73#include "monitor_wrap.h"
74#include "krl.h" 74#include "krl.h"
75#include "compat.h"
75 76
76/* import */ 77/* import */
77extern ServerOptions options; 78extern ServerOptions options;
@@ -252,8 +253,25 @@ allowed_user(struct passwd * pw)
252} 253}
253 254
254void 255void
256auth_info(Authctxt *authctxt, const char *fmt, ...)
257{
258 va_list ap;
259 int i;
260
261 free(authctxt->info);
262 authctxt->info = NULL;
263
264 va_start(ap, fmt);
265 i = vasprintf(&authctxt->info, fmt, ap);
266 va_end(ap);
267
268 if (i < 0 || authctxt->info == NULL)
269 fatal("vasprintf failed");
270}
271
272void
255auth_log(Authctxt *authctxt, int authenticated, int partial, 273auth_log(Authctxt *authctxt, int authenticated, int partial,
256 const char *method, const char *submethod, const char *info) 274 const char *method, const char *submethod)
257{ 275{
258 void (*authlog) (const char *fmt,...) = verbose; 276 void (*authlog) (const char *fmt,...) = verbose;
259 char *authmsg; 277 char *authmsg;
@@ -275,7 +293,7 @@ auth_log(Authctxt *authctxt, int authenticated, int partial,
275 else 293 else
276 authmsg = authenticated ? "Accepted" : "Failed"; 294 authmsg = authenticated ? "Accepted" : "Failed";
277 295
278 authlog("%s %s%s%s for %s%.100s from %.200s port %d%s", 296 authlog("%s %s%s%s for %s%.100s from %.200s port %d %s%s%s",
279 authmsg, 297 authmsg,
280 method, 298 method,
281 submethod != NULL ? "/" : "", submethod == NULL ? "" : submethod, 299 submethod != NULL ? "/" : "", submethod == NULL ? "" : submethod,
@@ -283,7 +301,11 @@ auth_log(Authctxt *authctxt, int authenticated, int partial,
283 authctxt->user, 301 authctxt->user,
284 get_remote_ipaddr(), 302 get_remote_ipaddr(),
285 get_remote_port(), 303 get_remote_port(),
286 info); 304 compat20 ? "ssh2" : "ssh1",
305 authctxt->info != NULL ? ": " : "",
306 authctxt->info != NULL ? authctxt->info : "");
307 free(authctxt->info);
308 authctxt->info = NULL;
287 309
288#ifdef CUSTOM_FAILED_LOGIN 310#ifdef CUSTOM_FAILED_LOGIN
289 if (authenticated == 0 && !authctxt->postponed && 311 if (authenticated == 0 && !authctxt->postponed &&