sync
[bitrig.git] / usr.sbin / npppd / npppd / npppd_auth_local.h
blobd1947b77640400f511c439d5b94960111ddca377
1 /* $OpenBSD: npppd_auth_local.h,v 1.6 2012/09/18 13:14:08 yasuoka Exp $ */
3 /*-
4 * Copyright (c) 2009 Internet Initiative Japan Inc.
5 * All rights reserved.
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.
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
29 struct _npppd_auth_base {
30 /** name of realm */
31 char name[NPPPD_GENERIC_NAME_LEN];
32 /** reference indicated to parent npppd */
33 npppd *npppd;
34 /** type of authentication realm */
35 int type;
36 /** PPP suffix */
37 char pppsuffix[64];
38 /** PPP prefix */
39 char pppprefix[64];
40 uint32_t
41 /** whether initialized or not */
42 initialized:1,
43 /** in disposing */
44 disposing:1,
45 /** Is the radius configuration ready */
46 radius_ready:1,
47 /** whether EAP capable or not */
48 eap_capable:1,
49 /** whether force to strip Windows-NT domain or not */
50 strip_nt_domain:1,
51 /** whether force to strip after the '@' of PPP username or not */
52 strip_atmark_realm:1,
53 /** has users list */
54 has_users_file:1,
55 reserved:25;
57 /** path name of account list */
58 char users_file_path[64];
59 /** last load time */
60 time_t last_load;
63 #ifdef USE_NPPPD_RADIUS
64 struct _npppd_auth_radius {
65 /** parent of npppd_auth_base */
66 npppd_auth_base nar_base;
68 /** RADIUS authentication server setting */
69 radius_req_setting *rad_auth_setting;
71 /** RADIUS accounting server setting */
72 radius_req_setting *rad_acct_setting;
74 #endif
76 /** type of local authentication realm */
77 struct _npppd_auth_local {
78 /* parent npppd_auth_base */
79 npppd_auth_base nal_base;
82 static npppd_auth_user *npppd_auth_get_user (npppd_auth_base *, const char *);
83 static int npppd_auth_base_log (npppd_auth_base *, int, const char *, ...);
85 #ifdef USE_NPPPD_RADIUS
86 enum RADIUS_SERVER_TYPE {
87 RADIUS_SERVER_TYPE_AUTH,
88 RADIUS_SERVER_TYPE_ACCT
91 static int npppd_auth_radius_reload (npppd_auth_base *, struct authconf *);
92 #endif
94 #ifdef NPPPD_AUTH_DEBUG
95 #define NPPPD_AUTH_DBG(x) npppd_auth_base_log x
96 #define NPPPD_AUTH_ASSERT(x) ASSERT(x)
97 #else
98 #define NPPPD_AUTH_DBG(x)
99 #define NPPPD_AUTH_ASSERT(x)
100 #endif
102 #define DEFAULT_RADIUS_AUTH_PORT 1812
103 #define DEFAULT_RADIUS_ACCT_PORT 1813
104 #define DEFAULT_RADIUS_TIMEOUT 9
105 #define DEFAULT_RADIUS_MAX_TRIES 3
106 #define DEFAULT_RADIUS_MAX_FAILOVERS 1