summaryrefslogtreecommitdiffstats
path: root/auth.c
diff options
context:
space:
mode:
authorBen Lindstrom <mouring@eviladmin.org>2002-05-15 16:16:14 +0000
committerBen Lindstrom <mouring@eviladmin.org>2002-05-15 16:16:14 +0000
commita574cda45b5d3c3363520ef9e4aa3aaa5888c078 (patch)
treee437d6e854db91fd3a9744d922ff942f465b249a /auth.c
parent58d4dafeb1159cebd03a2b32cb87a1970606a441 (diff)
- markus@cvs.openbsd.org 2002/05/13 20:44:58
[auth-options.c auth.c auth.h] move the packet_send_debug handling from auth-options.c to auth.c; ok provos@
Diffstat (limited to 'auth.c')
-rw-r--r--auth.c48
1 files changed, 47 insertions, 1 deletions
diff --git a/auth.c b/auth.c
index 2f1979cf..7c2faeed 100644
--- a/auth.c
+++ b/auth.c
@@ -23,7 +23,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: auth.c,v 1.41 2002/03/19 15:31:47 markus Exp $");
+RCSID("$OpenBSD: auth.c,v 1.42 2002/05/13 20:44:58 markus Exp $");
#ifdef HAVE_LOGIN_H
#include <login.h>
@@ -49,10 +49,16 @@ RCSID("$OpenBSD: auth.c,v 1.41 2002/03/19 15:31:47 markus Exp $");
#include "uidswap.h"
#include "tildexpand.h"
#include "misc.h"
+#include "bufaux.h"
+#include "packet.h"
/* import */
extern ServerOptions options;
+/* Debugging messages */
+Buffer auth_debug;
+int auth_debug_init;
+
/*
* Check if the user is allowed to log in via ssh. If user is listed
* in DenyUsers or one of user's groups is listed in DenyGroups, false
@@ -491,3 +497,43 @@ getpwnamallow(const char *user)
return (pwcopy(pw));
return (NULL);
}
+
+void
+auth_debug_add(const char *fmt,...)
+{
+ char buf[1024];
+ va_list args;
+
+ if (!auth_debug_init)
+ return;
+
+ va_start(args, fmt);
+ vsnprintf(buf, sizeof(buf), fmt, args);
+ va_end(args);
+ buffer_put_cstring(&auth_debug, buf);
+}
+
+void
+auth_debug_send(void)
+{
+ char *msg;
+
+ if (!auth_debug_init)
+ return;
+ while (buffer_len(&auth_debug)) {
+ msg = buffer_get_string(&auth_debug, NULL);
+ packet_send_debug("%s", msg);
+ xfree(msg);
+ }
+}
+
+void
+auth_debug_reset(void)
+{
+ if (auth_debug_init)
+ buffer_clear(&auth_debug);
+ else {
+ buffer_init(&auth_debug);
+ auth_debug_init = 1;
+ }
+}