2 * radiusd.h Structures, prototypes and global variables
3 * for the Cistron Radius server.
18 typedef pthread_t child_pid_t ;
19 #define child_kill pthread_kill
21 typedef pid_t child_pid_t;
22 #define child_kill kill
25 #define NO_SUCH_CHILD_PID (0)
27 typedef struct auth_req {
28 RADIUS_PACKET *packet;
31 VALUE_PAIR *config_items;
35 child_pid_t child_pid;
38 /* Could almost keep a const char * here instead of a _copy_ of the
39 * secret... but what if the RADCLIENT structure is freed because it was
40 * taken out of the config file and SIGHUPed? */
42 int proxy_is_replicate;
44 time_t proxy_next_try;
47 struct auth_req *prev;
48 struct auth_req *next;
51 typedef struct radclient {
56 struct radclient *next;
67 typedef struct realm {
79 typedef struct pair_list {
84 struct pair_list *next;
87 #define DEBUG if(debug_flag)log_debug
88 #define DEBUG2 if (debug_flag > 1)log_debug
90 #define SECONDS_PER_DAY 86400
91 #define MAX_REQUEST_TIME 30
92 #define CLEANUP_DELAY 5
93 #define MAX_REQUESTS 255
94 /* FIXME: these two should be command-line options */
112 /* for paircompare_register */
113 typedef int (*COMPARE)(VALUE_PAIR *, VALUE_PAIR *, VALUE_PAIR *, VALUE_PAIR **);
118 extern const char *progname;
119 extern int debug_flag;
120 extern const char *radacct_dir;
121 extern const char *radlog_dir;
122 extern const char *radius_dir;
123 extern const char *radius_libdir;
124 extern uint32_t expiration_seconds;
125 extern int radius_pid;
127 extern int log_stripped_names;
128 extern int cache_passwd;
129 extern uint32_t myip;
130 extern int log_auth_detail;
132 extern int log_auth_pass;
133 extern int auth_port;
134 extern int acct_port;
135 extern int proxy_port;
139 * Function prototypes.
143 int rad_accounting(REQUEST *);
146 int radutmp_add(REQUEST *);
147 int radutmp_zap(uint32_t nas, int port, char *user, time_t t);
148 int radutmp_checksimul(char *name, VALUE_PAIR *, int maxsimul);
151 void debug_pair(FILE *, VALUE_PAIR *);
152 int log_err (char *);
153 void sig_cleanup(int);
154 void remove_from_request_list(REQUEST *);
157 struct passwd *rad_getpwnam(const char *);
158 void (*reset_signal(int signo, void (*func)(int)))(int);
159 void request_free(REQUEST *request);
160 RADIUS_PACKET * build_reply(int code, REQUEST *request,
161 VALUE_PAIR *vps, const char *user_msg);
164 RADCLIENT *client_find(uint32_t ipno);
165 char *client_name(uint32_t ipno);
166 REALM *realm_find(const char *);
167 PAIR_LIST *pairlist_read(const char *file, int complain);
168 void pairlist_free(PAIR_LIST **);
169 int read_config_files(void);
172 int read_naslist_file(char *);
173 NAS *nas_find(uint32_t ipno);
174 char *nas_name(uint32_t ipno);
175 char *nas_name2(RADIUS_PACKET *r);
176 NAS *nas_findbyname(char *nasname);
182 int log(int, const char *, ...);
183 int log_debug(const char *, ...);
187 int pam_pass(char *name, char *passwd, const char *pamauth);
188 #define PAM_DEFAULT_TYPE "radius"
192 int proxy_send(REQUEST *request);
193 int proxy_receive(REQUEST *request);
194 struct timeval *proxy_setuptimeout(struct timeval *);
195 void proxy_retry(void);
198 char *auth_name(REQUEST *request, int do_cli);
199 int rad_authenticate (REQUEST *);
202 char *radius_xlate(char *output, size_t outputlen,
204 VALUE_PAIR *req, VALUE_PAIR *reply);
205 int radius_exec_program(const char *, VALUE_PAIR *, VALUE_PAIR **,
206 int, const char **user_msg);
209 int timestr_match(char *, time_t);
212 int paircompare_register(int attr, int otherattr, COMPARE func);
213 void paircompare_unregister(int attr, COMPARE func);
214 int paircmp(VALUE_PAIR *request, VALUE_PAIR *check,
216 void pair_builtincompare_init(void);
219 int radius_xlat2(char * out, int outlen, char *str,
220 REQUEST * request, VALUE_PAIR *reply);