2 * radiusd.h Structures, prototypes and global variables
3 * for the Cistron Radius server.
19 typedef pthread_t child_pid_t ;
21 typedef pid_t child_pid_t;
25 /* FIX when threading is done! */
26 typedef pid_t child_pid_t;
29 #define NO_SUCH_CHILD_PID (0)
31 typedef struct auth_req {
32 RADIUS_PACKET *packet;
35 VALUE_PAIR *config_items;
39 child_pid_t child_pid;
42 /* Could almost keep a const char * here instead of a _copy_ of the
43 * secret... but what if the CLIENT structure is freed because it was
44 * taken out of the config file and SIGHUPed? */
46 int proxy_is_replicate;
48 time_t proxy_next_try;
51 struct auth_req *prev;
52 struct auth_req *next;
55 typedef struct client {
71 typedef struct realm {
83 typedef struct pair_list {
88 struct pair_list *next;
91 #define DEBUG if(debug_flag)log_debug
92 #define DEBUG2 if (debug_flag > 1)log_debug
94 #define SECONDS_PER_DAY 86400
95 #define MAX_REQUEST_TIME 30
96 #define CLEANUP_DELAY 5
97 #define MAX_REQUESTS 255
98 /* FIXME: these two should be command-line options */
100 #define RETRY_COUNT 3
116 /* for paircompare_register */
117 typedef int (*COMPARE)(VALUE_PAIR *, VALUE_PAIR *, VALUE_PAIR *, VALUE_PAIR **);
122 extern const char *progname;
123 extern int debug_flag;
124 extern const char *radacct_dir;
125 extern const char *radlog_dir;
126 extern const char *radius_dir;
127 extern const char *radius_libdir;
128 extern UINT4 expiration_seconds;
129 extern int radius_pid;
131 extern int log_stripped_names;
132 extern int cache_passwd;
134 extern int log_auth_detail;
136 extern int log_auth_pass;
137 extern int auth_port;
138 extern int acct_port;
139 extern int proxy_port;
143 * Function prototypes.
147 int rad_accounting(REQUEST *);
150 int radutmp_add(REQUEST *);
151 int radutmp_zap(UINT4 nas, int port, char *user, time_t t);
152 int radutmp_checksimul(char *name, VALUE_PAIR *, int maxsimul);
155 void debug_pair(FILE *, VALUE_PAIR *);
156 int log_err (char *);
157 void sig_cleanup(int);
158 void remove_from_request_list(REQUEST *);
161 struct passwd *rad_getpwnam(const char *);
162 #if defined (sun) && defined(__svr4__)
163 void (*sun_signal(int signo, void (*func)(int)))(int);
164 #define signal sun_signal
166 void request_free(REQUEST *request);
167 RADIUS_PACKET * build_reply(int code, REQUEST *request,
168 VALUE_PAIR *vps, const char *user_msg);
171 CLIENT *client_find(UINT4 ipno);
172 char *client_name(UINT4 ipno);
173 int read_clients_file(const char *);
174 REALM *realm_find(const char *);
175 PAIR_LIST *pairlist_read(const char *file, int complain);
176 void pairlist_free(PAIR_LIST **);
177 int read_config_files(void);
180 int read_naslist_file(char *);
181 NAS *nas_find(UINT4 ipno);
182 char *nas_name(UINT4 ipno);
183 char *nas_name2(RADIUS_PACKET *r);
184 NAS *nas_findbyname(char *nasname);
190 int log(int, const char *, ...);
191 int log_debug(const char *, ...);
195 int pam_pass(char *name, char *passwd, const char *pamauth);
196 #define PAM_DEFAULT_TYPE "radius"
200 int proxy_send(REQUEST *request);
201 int proxy_receive(REQUEST *request);
202 struct timeval *proxy_setuptimeout(struct timeval *);
203 void proxy_retry(void);
206 char *auth_name(REQUEST *request, int do_cli);
207 int rad_authenticate (REQUEST *);
210 char *radius_xlate(const char *, VALUE_PAIR *req, VALUE_PAIR *reply);
211 int radius_exec_program(const char *, VALUE_PAIR *, VALUE_PAIR **,
212 int, const char **user_msg);
215 int timestr_match(char *, time_t);
218 int paircompare_register(int attr, int otherattr, COMPARE func);
219 void paircompare_unregister(int attr, COMPARE func);
220 int paircmp(VALUE_PAIR *request, VALUE_PAIR *check,
222 void pair_builtincompare_init(void);
225 int radius_xlat2(char * out, int outlen, char *str,
226 REQUEST * request, VALUE_PAIR *reply);