From 3c66080aa26e5121805c80728a9c801b08a7870e Mon Sep 17 00:00:00 2001 From: Darren Tucker Date: Thu, 20 Jan 2005 22:20:50 +1100 Subject: - (dtucker) [auth-chall.c auth.h auth2-chall.c] Bug #936: Remove pam from the list of available kbdint devices if UsePAM=no. ok djm@ --- auth2-chall.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'auth2-chall.c') diff --git a/auth2-chall.c b/auth2-chall.c index 29234439..384a543e 100644 --- a/auth2-chall.c +++ b/auth2-chall.c @@ -32,6 +32,10 @@ RCSID("$OpenBSD: auth2-chall.c,v 1.22 2005/01/19 13:11:47 dtucker Exp $"); #include "xmalloc.h" #include "dispatch.h" #include "log.h" +#include "servconf.h" + +/* import */ +extern ServerOptions options; static int auth2_challenge_start(Authctxt *); static int send_userauth_info_request(Authctxt *); @@ -71,6 +75,21 @@ struct KbdintAuthctxt u_int nreq; }; +#ifdef USE_PAM +void +remove_kbdint_device(const char *devname) +{ + int i, j; + + for (i = 0; devices[i] != NULL; i++) + if (strcmp(devices[i]->name, devname) == 0) { + for (j = i; devices[j] != NULL; j++) + devices[j] = devices[j+1]; + i--; + } +} +#endif + static KbdintAuthctxt * kbdint_alloc(const char *devs) { @@ -78,6 +97,11 @@ kbdint_alloc(const char *devs) Buffer b; int i; +#ifdef USE_PAM + if (!options.use_pam) + remove_kbdint_device("pam"); +#endif + kbdintctxt = xmalloc(sizeof(KbdintAuthctxt)); if (strcmp(devs, "") == 0) { buffer_init(&b); -- cgit v1.2.1