2 * Copyright (c) 1999-2001 Todd C. Miller <Todd.Miller@courtesan.com>
5 * This code is derived from software contributed by Giles Todd
6 * <giles@gt.demon.co.uk>.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
19 * 3. The name of the author may not be used to endorse or promote products
20 * derived from this software without specific prior written permission.
22 * 4. Products derived from this software may not be called "Sudo" nor
23 * may "Sudo" appear in their names without specific prior written
24 * permission from the author.
26 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
27 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
28 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
29 * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
32 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
33 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
34 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
35 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40 #include <sys/types.h>
41 #include <sys/param.h>
50 #endif /* STDC_HEADERS */
54 # ifdef HAVE_STRINGS_H
57 #endif /* HAVE_STRING_H */
60 #endif /* HAVE_UNISTD_H */
68 #include "sudo_auth.h"
71 static const char rcsid[] = "$Sudo: securid.c,v 1.8 2001/12/14 19:52:53 millert Exp $";
74 union config_record configure;
77 securid_init(pw, promptp, auth)
82 static struct SD_CLIENT sd_dat; /* SecurID data block */
84 auth->data = (VOID *) &sd_dat; /* For method-specific data */
93 securid_setup(pw, promptp, auth)
98 struct SD_CLIENT *sd = (struct SD_CLIENT *) auth->data;
100 /* Re-initialize SecurID every time. */
101 if (sd_init(sd) == 0) {
102 strcpy(sd->username, pw->pw_name);
103 return(AUTH_SUCCESS);
105 (void) fprintf(stderr, "%s: Cannot contact SecurID server\n", Argv[0]);
111 securid_verify(pw, pass, auth)
116 struct SD_CLIENT *sd = (struct SD_CLIENT *) auth->data;
122 return(AUTH_SUCCESS);
124 return(AUTH_FAILURE);