2 * Copyright (c) 1999-2005, 2007 Todd C. Miller <Todd.Miller@courtesan.com>
4 * Permission to use, copy, modify, and distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
16 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
17 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
19 * Sponsored in part by the Defense Advanced Research Projects
20 * Agency (DARPA) and Air Force Research Laboratory, Air Force
21 * Materiel Command, USAF, under agreement number F39502-99-1-0512.
26 #include <sys/types.h>
27 #include <sys/param.h>
36 #endif /* STDC_HEADERS */
40 # ifdef HAVE_STRINGS_H
43 #endif /* HAVE_STRING_H */
46 #endif /* HAVE_UNISTD_H */
54 #include "sudo_auth.h"
57 __unused static const char rcsid[] = "$Sudo: securid.c,v 1.18 2008/11/09 14:13:13 millert Exp $";
60 union config_record configure;
63 securid_init(pw, promptp, auth)
68 static struct SD_CLIENT sd_dat; /* SecurID data block */
70 auth->data = (void *) &sd_dat; /* For method-specific data */
79 securid_setup(pw, promptp, auth)
84 struct SD_CLIENT *sd = (struct SD_CLIENT *) auth->data;
86 /* Re-initialize SecurID every time. */
87 if (sd_init(sd) == 0) {
88 /* The programmer's guide says username is 32 bytes */
89 strlcpy(sd->username, pw->pw_name, 32);
92 warningx("unable to contact the SecurID server");
98 securid_verify(pw, pass, auth)
103 struct SD_CLIENT *sd = (struct SD_CLIENT *) auth->data;
109 return(AUTH_SUCCESS);
111 return(AUTH_FAILURE);