Main Page | Namespace List | Class List | Directories | File List | Class Members | File Members

auth-chall.c File Reference

#include "includes.h"
#include "auth.h"
#include "log.h"
#include "xmalloc.h"
#include "servconf.h"

Go to the source code of this file.

Functions

 RCSID ("$OpenBSD: auth-chall.c,v 1.9 2003/11/03 09:03:37 djm Exp $")
charget_challenge (Authctxt *authctxt)
int verify_response (Authctxt *authctxt, const char *response)
void abandon_challenge_response (Authctxt *authctxt)

Variables

KbdintDevicedevices []
static KbdintDevicedevice
ServerOptions options


Function Documentation

void abandon_challenge_response Authctxt authctxt  ) 
 

Definition at line 111 of file auth-chall.c.

References KbdintDevice::free_ctx, and Authctxt::kbdintctxt.

Referenced by do_authloop().

00112 {
00113         if (authctxt->kbdintctxt != NULL) {
00114                 device->free_ctx(authctxt->kbdintctxt);
00115                 authctxt->kbdintctxt = NULL;
00116         }
00117 }

char* get_challenge Authctxt authctxt  ) 
 

Definition at line 40 of file auth-chall.c.

References fatal(), KbdintDevice::free_ctx, KbdintDevice::init_ctx, Authctxt::kbdintctxt, name, KbdintDevice::query, remove_kbdint_device(), ServerOptions::use_pam, xfree(), and xstrdup().

Referenced by auth1_process_tis_challenge().

00041 {
00042         char *challenge, *name, *info, **prompts;
00043         u_int i, numprompts;
00044         u_int *echo_on;
00045 
00046 #ifdef USE_PAM
00047         if (!options.use_pam)
00048                 remove_kbdint_device("pam");
00049 #endif
00050 
00051         device = devices[0]; /* we always use the 1st device for protocol 1 */
00052         if (device == NULL)
00053                 return NULL;
00054         if ((authctxt->kbdintctxt = device->init_ctx(authctxt)) == NULL)
00055                 return NULL;
00056         if (device->query(authctxt->kbdintctxt, &name, &info,
00057             &numprompts, &prompts, &echo_on)) {
00058                 device->free_ctx(authctxt->kbdintctxt);
00059                 authctxt->kbdintctxt = NULL;
00060                 return NULL;
00061         }
00062         if (numprompts < 1)
00063                 fatal("get_challenge: numprompts < 1");
00064         challenge = xstrdup(prompts[0]);
00065         for (i = 0; i < numprompts; i++)
00066                 xfree(prompts[i]);
00067         xfree(prompts);
00068         xfree(name);
00069         xfree(echo_on);
00070         xfree(info);
00071 
00072         return (challenge);
00073 }

RCSID "$OpenBSD: auth-chall.  c,
v 1.9 2003/11/03 09:03:37 djm Exp $" 
 

int verify_response Authctxt authctxt,
const char response
 

Definition at line 75 of file auth-chall.c.

References KbdintDevice::free_ctx, Authctxt::kbdintctxt, name, KbdintDevice::query, KbdintDevice::respond, and xfree().

Referenced by auth1_process_tis_response().

00076 {
00077         char *resp[1], *name, *info, **prompts;
00078         u_int i, numprompts, *echo_on;
00079         int authenticated = 0;
00080 
00081         if (device == NULL)
00082                 return 0;
00083         if (authctxt->kbdintctxt == NULL)
00084                 return 0;
00085         resp[0] = (char *)response;
00086         switch (device->respond(authctxt->kbdintctxt, 1, resp)) {
00087         case 0: /* Success */
00088                 authenticated = 1;
00089                 break;
00090         case 1: /* Postponed - retry with empty query for PAM */
00091                 if ((device->query(authctxt->kbdintctxt, &name, &info,
00092                     &numprompts, &prompts, &echo_on)) != 0)
00093                         break;
00094                 if (numprompts == 0 &&
00095                     device->respond(authctxt->kbdintctxt, 0, resp) == 0)
00096                         authenticated = 1;
00097 
00098                 for (i = 0; i < numprompts; i++)
00099                         xfree(prompts[i]);
00100                 xfree(prompts);
00101                 xfree(name);
00102                 xfree(echo_on);
00103                 xfree(info);
00104                 break;
00105         }
00106         device->free_ctx(authctxt->kbdintctxt);
00107         authctxt->kbdintctxt = NULL;
00108         return authenticated;
00109 }


Variable Documentation

KbdintDevice* device [static]
 

Definition at line 36 of file auth-chall.c.

KbdintDevice* devices[]
 

Definition at line 55 of file auth2-chall.c.

ServerOptions options
 

Definition at line 110 of file ssh.c.

Referenced by check_ip_options(), and main().


© sourcejam.com 2005-2008