diff options
Diffstat (limited to 'auth.c')
-rw-r--r-- | auth.c | 48 |
1 files changed, 47 insertions, 1 deletions
@@ -23,7 +23,7 @@ | |||
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include "includes.h" | 25 | #include "includes.h" |
26 | RCSID("$OpenBSD: auth.c,v 1.41 2002/03/19 15:31:47 markus Exp $"); | 26 | RCSID("$OpenBSD: auth.c,v 1.42 2002/05/13 20:44:58 markus Exp $"); |
27 | 27 | ||
28 | #ifdef HAVE_LOGIN_H | 28 | #ifdef HAVE_LOGIN_H |
29 | #include <login.h> | 29 | #include <login.h> |
@@ -49,10 +49,16 @@ RCSID("$OpenBSD: auth.c,v 1.41 2002/03/19 15:31:47 markus Exp $"); | |||
49 | #include "uidswap.h" | 49 | #include "uidswap.h" |
50 | #include "tildexpand.h" | 50 | #include "tildexpand.h" |
51 | #include "misc.h" | 51 | #include "misc.h" |
52 | #include "bufaux.h" | ||
53 | #include "packet.h" | ||
52 | 54 | ||
53 | /* import */ | 55 | /* import */ |
54 | extern ServerOptions options; | 56 | extern ServerOptions options; |
55 | 57 | ||
58 | /* Debugging messages */ | ||
59 | Buffer auth_debug; | ||
60 | int auth_debug_init; | ||
61 | |||
56 | /* | 62 | /* |
57 | * Check if the user is allowed to log in via ssh. If user is listed | 63 | * Check if the user is allowed to log in via ssh. If user is listed |
58 | * in DenyUsers or one of user's groups is listed in DenyGroups, false | 64 | * in DenyUsers or one of user's groups is listed in DenyGroups, false |
@@ -491,3 +497,43 @@ getpwnamallow(const char *user) | |||
491 | return (pwcopy(pw)); | 497 | return (pwcopy(pw)); |
492 | return (NULL); | 498 | return (NULL); |
493 | } | 499 | } |
500 | |||
501 | void | ||
502 | auth_debug_add(const char *fmt,...) | ||
503 | { | ||
504 | char buf[1024]; | ||
505 | va_list args; | ||
506 | |||
507 | if (!auth_debug_init) | ||
508 | return; | ||
509 | |||
510 | va_start(args, fmt); | ||
511 | vsnprintf(buf, sizeof(buf), fmt, args); | ||
512 | va_end(args); | ||
513 | buffer_put_cstring(&auth_debug, buf); | ||
514 | } | ||
515 | |||
516 | void | ||
517 | auth_debug_send(void) | ||
518 | { | ||
519 | char *msg; | ||
520 | |||
521 | if (!auth_debug_init) | ||
522 | return; | ||
523 | while (buffer_len(&auth_debug)) { | ||
524 | msg = buffer_get_string(&auth_debug, NULL); | ||
525 | packet_send_debug("%s", msg); | ||
526 | xfree(msg); | ||
527 | } | ||
528 | } | ||
529 | |||
530 | void | ||
531 | auth_debug_reset(void) | ||
532 | { | ||
533 | if (auth_debug_init) | ||
534 | buffer_clear(&auth_debug); | ||
535 | else { | ||
536 | buffer_init(&auth_debug); | ||
537 | auth_debug_init = 1; | ||
538 | } | ||
539 | } | ||