1 |
/* This file is part of GNU RADIUS. |
/* This file is part of GNU Radius. |
2 |
Copyright (C) 2000, Sergey Poznyakoff |
Copyright (C) 2000,2001,2002,2003 Sergey Poznyakoff |
3 |
|
|
4 |
This program is free software; you can redistribute it and/or modify |
GNU Radius is free software; you can redistribute it and/or modify |
5 |
it under the terms of the GNU General Public License as published by |
it under the terms of the GNU General Public License as published by |
6 |
the Free Software Foundation; either version 2 of the License, or |
the Free Software Foundation; either version 2 of the License, or |
7 |
(at your option) any later version. |
(at your option) any later version. |
8 |
|
|
9 |
This program is distributed in the hope that it will be useful, |
GNU Radius is distributed in the hope that it will be useful, |
10 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 |
GNU General Public License for more details. |
GNU General Public License for more details. |
13 |
|
|
14 |
You should have received a copy of the GNU General Public License |
You should have received a copy of the GNU General Public License |
15 |
along with this program; if not, write to the Free Software Foundation, |
along with GNU Radius; if not, write to the Free Software Foundation, |
16 |
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ |
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ |
17 |
|
|
18 |
#include <sysdep.h> |
#include <sysdep.h> |
20 |
#include <mem.h> |
#include <mem.h> |
21 |
#include <pwd.h> |
#include <pwd.h> |
22 |
#include <grp.h> |
#include <grp.h> |
23 |
|
#include <list.h> |
24 |
|
#include <envar.h> |
25 |
|
|
26 |
#define DOTTED_QUAD_LEN 16 |
#define DOTTED_QUAD_LEN 16 |
27 |
|
|
129 |
|
|
130 |
typedef struct radius_server RADIUS_SERVER; |
typedef struct radius_server RADIUS_SERVER; |
131 |
struct radius_server { |
struct radius_server { |
|
RADIUS_SERVER *next; /* Next server in queue */ |
|
132 |
char *name; /* Symbolic name of this server */ |
char *name; /* Symbolic name of this server */ |
133 |
UINT4 addr; /* IP address of it */ |
UINT4 addr; /* IP address of it */ |
134 |
int port[PORT_MAX]; /* Ports to use */ |
int port[PORT_MAX]; /* Ports to use */ |
142 |
unsigned retries; /* Number of re-sends to each server before |
unsigned retries; /* Number of re-sends to each server before |
143 |
giving up */ |
giving up */ |
144 |
size_t buffer_size; /* Size of the recv buffer */ |
size_t buffer_size; /* Size of the recv buffer */ |
145 |
RADIUS_SERVER *first_server; /* List of servers */ |
LIST *servers; /* List of servers */ |
146 |
} RADIUS_SERVER_QUEUE; |
} RADIUS_SERVER_QUEUE; |
147 |
|
|
148 |
struct value_pair; |
struct value_pair; |
161 |
|
|
162 |
/* Dictionary value */ |
/* Dictionary value */ |
163 |
typedef struct dict_value { |
typedef struct dict_value { |
|
struct dict_value *next; |
|
164 |
char *name; |
char *name; |
165 |
DICT_ATTR *attr; |
DICT_ATTR *attr; |
166 |
int value; |
int value; |
168 |
|
|
169 |
/* Dictionary vendor information */ |
/* Dictionary vendor information */ |
170 |
typedef struct dict_vendor { |
typedef struct dict_vendor { |
|
struct dict_vendor *next; |
|
171 |
char *vendorname; |
char *vendorname; |
172 |
int vendorpec; |
int vendorpec; |
173 |
int vendorcode; |
int vendorcode; |
206 |
char longname[MAX_LONGNAME+1]; |
char longname[MAX_LONGNAME+1]; |
207 |
char shortname[MAX_SHORTNAME+1]; |
char shortname[MAX_SHORTNAME+1]; |
208 |
char nastype[MAX_DICTNAME+1]; |
char nastype[MAX_DICTNAME+1]; |
209 |
struct envar_t *args; |
envar_t *args; |
210 |
void *app_data; |
void *app_data; |
211 |
} NAS; |
} NAS; |
212 |
|
|
213 |
typedef struct realm { |
typedef struct realm { |
|
struct realm *next; |
|
214 |
char realm[MAX_REALMNAME+1]; |
char realm[MAX_REALMNAME+1]; |
215 |
int striprealm; |
int striprealm; |
216 |
int maxlogins; |
int maxlogins; |
236 |
/* Proxy support fields */ |
/* Proxy support fields */ |
237 |
REALM *realm; |
REALM *realm; |
238 |
int validated; /* Already md5 checked */ |
int validated; /* Already md5 checked */ |
239 |
RADIUS_SERVER *server; |
int server_no; |
240 |
int attempt_no; |
int attempt_no; |
241 |
UINT4 server_id; /* Proxy ID of the packet */ |
UINT4 server_id; /* Proxy ID of the packet */ |
242 |
char *remote_user; /* Remote username (stringobj)*/ |
char *remote_user; /* Remote username (stringobj)*/ |
400 |
struct group *rad_getgrnam(const char *name); |
struct group *rad_getgrnam(const char *name); |
401 |
|
|
402 |
/* client.c */ |
/* client.c */ |
403 |
|
RADIUS_REQ *rad_clt_send(RADIUS_SERVER_QUEUE *config, int port_type, int code, |
404 |
|
VALUE_PAIR *pairlist); |
405 |
|
unsigned rad_clt_message_id(RADIUS_SERVER *server); |
406 |
RADIUS_SERVER_QUEUE *rad_clt_create_queue(int read_cfg, |
RADIUS_SERVER_QUEUE *rad_clt_create_queue(int read_cfg, |
407 |
UINT4 source_ip, size_t bufsize); |
UINT4 source_ip, size_t bufsize); |
408 |
void rad_clt_destroy_queue(RADIUS_SERVER_QUEUE *queue); |
void rad_clt_destroy_queue(RADIUS_SERVER_QUEUE *queue); |
409 |
RADIUS_REQ *rad_clt_send(RADIUS_SERVER_QUEUE *config, int port_type, |
RADIUS_SERVER *rad_clt_alloc_server(RADIUS_SERVER *src); |
|
int code, VALUE_PAIR *pair); |
|
|
|
|
|
RADIUS_SERVER *rad_clt_alloc_server(RADIUS_SERVER *data); |
|
|
|
|
410 |
RADIUS_SERVER *rad_clt_dup_server(RADIUS_SERVER *src); |
RADIUS_SERVER *rad_clt_dup_server(RADIUS_SERVER *src); |
411 |
|
|
412 |
void rad_clt_free_server(RADIUS_SERVER *server); |
void rad_clt_free_server(RADIUS_SERVER *server); |
413 |
RADIUS_SERVER *rad_clt_append_server(RADIUS_SERVER *list, |
RADIUS_SERVER *rad_clt_append_server(RADIUS_SERVER_QUEUE *qp, |
414 |
RADIUS_SERVER *server); |
RADIUS_SERVER *server); |
415 |
void rad_clt_clear_server_list(RADIUS_SERVER *list); |
void rad_clt_clear_server_list(RADIUS_SERVER_QUEUE *qp); |
416 |
RADIUS_SERVER *rad_clt_find_server(RADIUS_SERVER *list, char *name); |
RADIUS_SERVER *rad_clt_find_server(RADIUS_SERVER_QUEUE *qp, char *name); |
|
void rad_clt_random_vector(char *vector); |
|
|
unsigned rad_clt_message_id(RADIUS_SERVER *server); |
|
417 |
|
|
418 |
/* log.c */ |
/* log.c */ |
419 |
char *rad_print_request(RADIUS_REQ *req, char *outbuf, size_t size); |
char *rad_print_request(RADIUS_REQ *req, char *outbuf, size_t size); |
482 |
typedef struct channel Channel; |
typedef struct channel Channel; |
483 |
|
|
484 |
struct channel { |
struct channel { |
|
struct channel *next; |
|
485 |
char *name; |
char *name; |
486 |
int pmask[L_NCAT]; |
int pmask[L_NCAT]; |
487 |
int mode; /* LM_ constant */ |
int mode; /* LM_ constant */ |
492 |
int options; |
int options; |
493 |
}; |
}; |
494 |
|
|
|
typedef struct chanlist Chanlist; |
|
|
struct chanlist { /* for keeping channels while parsing config file */ |
|
|
Chanlist *next; |
|
|
Channel *chan; |
|
|
}; |
|
|
|
|
495 |
/* Global variables */ |
/* Global variables */ |
496 |
extern int debug_level[]; |
extern int debug_level[]; |
497 |
|
|
539 |
Channel * log_mark(); |
Channel * log_mark(); |
540 |
void log_release(); |
void log_release(); |
541 |
|
|
|
Chanlist * make_chanlist(Channel *chan); |
|
|
void free_chanlist(Chanlist *cp); |
|
|
|
|
542 |
void register_channel(Channel *chan); |
void register_channel(Channel *chan); |
543 |
void register_category(int cat, int pri, Chanlist *chanlist); |
void register_category(int cat, int pri, LIST *chanlist); |
|
|
|
544 |
|
|
545 |
void set_debug_levels(char *str); |
void set_debug_levels(char *str); |
546 |
int set_module_debug_level(char *name, int level); |
int set_module_debug_level(char *name, int level); |