Lines Matching refs:rstate
135 static struct radius_state rstate;
163 memset(&rstate, 0, sizeof(rstate));
165 strlcpy(rstate.config_file, "/etc/radiusclient/radiusclient.conf",
166 sizeof(rstate.config_file));
223 if (rstate.choose_ip) {
224 *addrp = rstate.ip_addr;
260 /* Put user with potentially realm added in rstate.user */
264 radius_pre_auth_hook(rstate.user,
265 &rstate.authserver,
266 &rstate.acctserver);
274 rstate.client_port = get_client_port(portnummap ? devnam : ifname);
282 rc_avpair_add(&send, PW_USER_NAME, rstate.user , 0, VENDOR_NONE);
291 if (rstate.avp)
292 rc_avpair_insert(&send, NULL, rc_avpair_copy(rstate.avp));
294 if (rstate.authserver) {
295 result = rc_auth_using_server(rstate.authserver,
296 rstate.client_port, send,
299 result = rc_auth(rstate.client_port, send, &received, radius_msg, NULL);
371 /* Put user with potentially realm added in rstate.user */
372 if (!rstate.done_chap_once) {
374 rstate.client_port = get_client_port (portnummap ? devnam : ifname);
376 radius_pre_auth_hook(rstate.user,
377 &rstate.authserver,
378 &rstate.acctserver);
390 rc_avpair_add (&send, PW_USER_NAME, rstate.user , 0, VENDOR_NONE);
467 if (rstate.avp)
468 rc_avpair_insert(&send, NULL, rc_avpair_copy(rstate.avp));
474 if (rstate.authserver) {
475 result = rc_auth_using_server(rstate.authserver,
476 rstate.client_port, send,
479 result = rc_auth(rstate.client_port, send, &received, radius_msg,
484 if (!rstate.done_chap_once) {
490 rstate.done_chap_once = 1;
507 * Copies user into rstate.user. If it lacks a realm (no "@domain" part),
516 strlcpy(rstate.user, user, sizeof(rstate.user));
518 rstate.user[0] = 0;
523 if (!strchr(rstate.user, '@') &&
526 strlcat(rstate.user, "@", sizeof(rstate.user));
527 strlcat(rstate.user, default_realm, sizeof(rstate.user));
572 vp->lvalue, rstate.user);
582 vp->lvalue, rstate.user);
603 rstate.acct_interim_interval = vp->lvalue;
606 if (rstate.acct_interim_interval &&
607 rstate.acct_interim_interval < 60) {
608 rstate.acct_interim_interval = 60;
616 rstate.any_ip_addr_ok = 1;
622 remote, rstate.user);
625 rstate.choose_ip = 1;
626 rstate.ip_addr = remote;
632 rstate.class_len=vp->lvalue;
633 memcpy(rstate.class, vp->strvalue, rstate.class_len);
858 if (!rstate.initialized) {
862 rstate.start_time = time(NULL);
864 strncpy(rstate.session_id, rc_mksid(), sizeof(rstate.session_id));
867 rstate.session_id, 0, VENDOR_NONE);
869 rstate.user, 0, VENDOR_NONE);
871 if (rstate.class_len > 0)
873 rstate.class, rstate.class_len, VENDOR_NONE);
902 if (rstate.avp)
903 rc_avpair_insert(&send, NULL, rc_avpair_copy(rstate.avp));
905 if (rstate.acctserver) {
906 result = rc_acct_using_server(rstate.acctserver,
907 rstate.client_port, send);
909 result = rc_acct(rstate.client_port, send);
917 "Accounting START failed for %s", rstate.user);
919 rstate.accounting_started = 1;
921 if (rstate.acct_interim_interval) {
922 TIMEOUT(radius_acct_interim, NULL, rstate.acct_interim_interval);
945 if (!rstate.initialized) {
949 if (!rstate.accounting_started) {
953 rstate.accounting_started = 0;
954 rc_avpair_add(&send, PW_ACCT_SESSION_ID, rstate.session_id,
957 rc_avpair_add(&send, PW_USER_NAME, rstate.user, 0, VENDOR_NONE);
1050 if (rstate.avp)
1051 rc_avpair_insert(&send, NULL, rc_avpair_copy(rstate.avp));
1053 if (rstate.acctserver) {
1054 result = rc_acct_using_server(rstate.acctserver,
1055 rstate.client_port, send);
1057 result = rc_acct(rstate.client_port, send);
1063 "Accounting STOP failed for %s", rstate.user);
1086 if (!rstate.initialized) {
1090 if (!rstate.accounting_started) {
1094 rc_avpair_add(&send, PW_ACCT_SESSION_ID, rstate.session_id,
1097 rc_avpair_add(&send, PW_USER_NAME, rstate.user, 0, VENDOR_NONE);
1147 if (rstate.avp)
1148 rc_avpair_insert(&send, NULL, rc_avpair_copy(rstate.avp));
1150 if (rstate.acctserver) {
1151 result = rc_acct_using_server(rstate.acctserver,
1152 rstate.client_port, send);
1154 result = rc_acct(rstate.client_port, send);
1160 "Interim accounting failed for %s", rstate.user);
1165 TIMEOUT(radius_acct_interim, NULL, rstate.acct_interim_interval);
1212 if (rstate.initialized) {
1217 strlcpy(rstate.config_file, config_file, MAXPATHLEN-1);
1220 rstate.initialized = 1;
1222 if (rc_read_config(rstate.config_file) != 0) {
1224 rstate.config_file);
1244 rc_avpair_parse(avpopt->vpstr, &rstate.avp);
1284 if (!rstate.choose_ip) {
1286 if (rstate.any_ip_addr_ok) {
1298 if (addr == rstate.ip_addr) return 1;
1305 return rstate.user;