]>
Commit | Line | Data |
---|---|---|
52b7d2ce A |
1 | /* $KAME$ */ |
2 | ||
3 | /* | |
4 | * Copyright (C) 2004 Emmanuel Dreyfus | |
5 | * All rights reserved. | |
6 | * | |
7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | |
10 | * 1. Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer. | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | |
15 | * 3. Neither the name of the project nor the names of its contributors | |
16 | * may be used to endorse or promote products derived from this software | |
17 | * without specific prior written permission. | |
18 | * | |
19 | * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND | |
20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE | |
23 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
25 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
29 | * SUCH DAMAGE. | |
30 | */ | |
31 | ||
32 | /* ISAKMP mode config attribute types specific to the Xauth vendor ID */ | |
33 | #define XAUTH_TYPE 16520 | |
34 | #define XAUTH_USER_NAME 16521 | |
35 | #define XAUTH_USER_PASSWORD 16522 | |
36 | #define XAUTH_PASSCODE 16523 | |
37 | #define XAUTH_MESSAGE 16524 | |
38 | #define XAUTH_CHALLENGE 16525 | |
39 | #define XAUTH_DOMAIN 16526 | |
40 | #define XAUTH_STATUS 16527 | |
41 | #define XAUTH_NEXT_PIN 16528 | |
42 | #define XAUTH_ANSWER 16529 | |
43 | ||
44 | /* Types for XAUTH_TYPE */ | |
45 | #define XAUTH_TYPE_GENERIC 0 | |
46 | #define XAUTH_TYPE_CHAP 1 | |
47 | #define XAUTH_TYPE_OTP 2 | |
48 | #define XAUTH_TYPE_SKEY 3 | |
49 | ||
50 | /* Values for XAUTH_STATUS */ | |
51 | #define XAUTH_STATUS_FAIL 0 | |
52 | #define XAUTH_STATUS_OK 1 | |
53 | ||
54 | struct xauth_state { | |
55 | int status; | |
56 | int vendorid; | |
57 | int authtype; | |
58 | union { | |
59 | struct authgeneric { | |
60 | char *usr; | |
61 | char *pwd; | |
62 | } generic; | |
63 | } authdata; | |
64 | }; | |
65 | ||
66 | /* status */ | |
67 | #define XAUTHST_NOTYET 0 | |
68 | #define XAUTHST_REQSENT 1 | |
69 | #define XAUTHST_OK 2 | |
70 | ||
71 | struct xauth_reply_arg { | |
72 | isakmp_index index; | |
73 | int port; | |
74 | int id; | |
75 | int res; | |
76 | }; | |
77 | ||
78 | struct ph1handle; | |
79 | void xauth_sendreq(struct ph1handle *); | |
80 | void xauth_attr_reply(struct ph1handle *, struct isakmp_data *, int); | |
81 | int xauth_login_system(char *, char *); | |
82 | void xauth_sendstatus(struct ph1handle *, int, int); | |
83 | int xauth_check(struct ph1handle *); | |
84 | vchar_t *isakmp_xauth_req(struct ph1handle *, struct isakmp_data *); | |
85 | vchar_t *isakmp_xauth_set(struct ph1handle *, struct isakmp_data *); | |
86 | void xauth_rmstate(struct xauth_state *); | |
87 | void xauth_reply_stub(void *); | |
88 | void xauth_reply(struct ph1handle *, int, int, int); | |
89 | ||
90 | #ifdef HAVE_LIBRADIUS | |
91 | int xauth_login_radius(struct ph1handle *, char *, char *); | |
92 | int xauth_radius_init(void); | |
93 | #endif | |
94 | #ifdef HAVE_LIBPAM | |
95 | int xauth_login_pam(int, struct sockaddr *, char *, char *); | |
96 | #endif |