Lines Matching refs:rstate
137 static struct radius_state rstate; variable
165 memset(&rstate, 0, sizeof(rstate)); in plugin_init()
167 strlcpy(rstate.config_file, "/etc/radiusclient/radiusclient.conf", in plugin_init()
168 sizeof(rstate.config_file)); in plugin_init()
225 if (rstate.choose_ip) { in radius_choose_ip()
226 *addrp = rstate.ip_addr; in radius_choose_ip()
266 radius_pre_auth_hook(rstate.user, in radius_pap_auth()
267 &rstate.authserver, in radius_pap_auth()
268 &rstate.acctserver); in radius_pap_auth()
276 rstate.client_port = get_client_port(portnummap ? devnam : ifname); in radius_pap_auth()
284 rc_avpair_add(&send, PW_USER_NAME, rstate.user , 0, VENDOR_NONE); in radius_pap_auth()
293 if (rstate.avp) in radius_pap_auth()
294 rc_avpair_insert(&send, NULL, rc_avpair_copy(rstate.avp)); in radius_pap_auth()
296 if (rstate.authserver) { in radius_pap_auth()
297 result = rc_auth_using_server(rstate.authserver, in radius_pap_auth()
298 rstate.client_port, send, in radius_pap_auth()
301 result = rc_auth(rstate.client_port, send, &received, radius_msg, NULL); in radius_pap_auth()
374 if (!rstate.done_chap_once) { in radius_chap_verify()
376 rstate.client_port = get_client_port (portnummap ? devnam : ifname); in radius_chap_verify()
378 radius_pre_auth_hook(rstate.user, in radius_chap_verify()
379 &rstate.authserver, in radius_chap_verify()
380 &rstate.acctserver); in radius_chap_verify()
392 rc_avpair_add (&send, PW_USER_NAME, rstate.user , 0, VENDOR_NONE); in radius_chap_verify()
460 if (rstate.avp) in radius_chap_verify()
461 rc_avpair_insert(&send, NULL, rc_avpair_copy(rstate.avp)); in radius_chap_verify()
467 if (rstate.authserver) { in radius_chap_verify()
468 result = rc_auth_using_server(rstate.authserver, in radius_chap_verify()
469 rstate.client_port, send, in radius_chap_verify()
472 result = rc_auth(rstate.client_port, send, &received, radius_msg, in radius_chap_verify()
479 if (!rstate.done_chap_once) { in radius_chap_verify()
485 rstate.done_chap_once = 1; in radius_chap_verify()
511 strlcpy(rstate.user, user, sizeof(rstate.user)); in make_username_realm()
513 rstate.user[0] = 0; in make_username_realm()
518 if (!strchr(rstate.user, '@') && in make_username_realm()
521 strlcat(rstate.user, "@", sizeof(rstate.user)); in make_username_realm()
522 strlcat(rstate.user, default_realm, sizeof(rstate.user)); in make_username_realm()
575 vp->lvalue, rstate.user); in radius_setparams()
585 vp->lvalue, rstate.user); in radius_setparams()
618 rstate.acct_interim_interval = vp->lvalue; in radius_setparams()
621 if (rstate.acct_interim_interval && in radius_setparams()
622 rstate.acct_interim_interval < 60) { in radius_setparams()
623 rstate.acct_interim_interval = 60; in radius_setparams()
631 rstate.any_ip_addr_ok = 1; in radius_setparams()
637 remote, rstate.user); in radius_setparams()
640 rstate.choose_ip = 1; in radius_setparams()
641 rstate.ip_addr = remote; in radius_setparams()
650 rstate.class_len=vp->lvalue; in radius_setparams()
651 memcpy(rstate.class, vp->strvalue, rstate.class_len); in radius_setparams()
895 if (!rstate.initialized) { in radius_acct_start()
899 rstate.start_time = time(NULL); in radius_acct_start()
901 strncpy(rstate.session_id, rc_mksid(), sizeof(rstate.session_id)); in radius_acct_start()
904 rstate.session_id, 0, VENDOR_NONE); in radius_acct_start()
906 rstate.user, 0, VENDOR_NONE); in radius_acct_start()
908 if (rstate.class_len > 0) in radius_acct_start()
910 rstate.class, rstate.class_len, VENDOR_NONE); in radius_acct_start()
939 if (rstate.avp) in radius_acct_start()
940 rc_avpair_insert(&send, NULL, rc_avpair_copy(rstate.avp)); in radius_acct_start()
942 if (rstate.acctserver) { in radius_acct_start()
943 result = rc_acct_using_server(rstate.acctserver, in radius_acct_start()
944 rstate.client_port, send); in radius_acct_start()
946 result = rc_acct(rstate.client_port, send); in radius_acct_start()
954 "Accounting START failed for %s", rstate.user); in radius_acct_start()
956 rstate.accounting_started = 1; in radius_acct_start()
958 if (rstate.acct_interim_interval) { in radius_acct_start()
959 TIMEOUT(radius_acct_interim, NULL, rstate.acct_interim_interval); in radius_acct_start()
982 if (!rstate.initialized) { in radius_acct_stop()
986 if (!rstate.accounting_started) { in radius_acct_stop()
990 if (rstate.acct_interim_interval) in radius_acct_stop()
993 rstate.accounting_started = 0; in radius_acct_stop()
994 rc_avpair_add(&send, PW_ACCT_SESSION_ID, rstate.session_id, in radius_acct_stop()
997 rc_avpair_add(&send, PW_USER_NAME, rstate.user, 0, VENDOR_NONE); in radius_acct_stop()
1094 if (rstate.avp) in radius_acct_stop()
1095 rc_avpair_insert(&send, NULL, rc_avpair_copy(rstate.avp)); in radius_acct_stop()
1097 if (rstate.acctserver) { in radius_acct_stop()
1098 result = rc_acct_using_server(rstate.acctserver, in radius_acct_stop()
1099 rstate.client_port, send); in radius_acct_stop()
1101 result = rc_acct(rstate.client_port, send); in radius_acct_stop()
1107 "Accounting STOP failed for %s", rstate.user); in radius_acct_stop()
1130 if (!rstate.initialized) { in radius_acct_interim()
1134 if (!rstate.accounting_started) { in radius_acct_interim()
1138 rc_avpair_add(&send, PW_ACCT_SESSION_ID, rstate.session_id, in radius_acct_interim()
1141 rc_avpair_add(&send, PW_USER_NAME, rstate.user, 0, VENDOR_NONE); in radius_acct_interim()
1191 if (rstate.avp) in radius_acct_interim()
1192 rc_avpair_insert(&send, NULL, rc_avpair_copy(rstate.avp)); in radius_acct_interim()
1194 if (rstate.acctserver) { in radius_acct_interim()
1195 result = rc_acct_using_server(rstate.acctserver, in radius_acct_interim()
1196 rstate.client_port, send); in radius_acct_interim()
1198 result = rc_acct(rstate.client_port, send); in radius_acct_interim()
1204 "Interim accounting failed for %s", rstate.user); in radius_acct_interim()
1209 TIMEOUT(radius_acct_interim, NULL, rstate.acct_interim_interval); in radius_acct_interim()
1256 if (rstate.initialized) { in radius_init()
1261 strlcpy(rstate.config_file, config_file, MAXPATHLEN-1); in radius_init()
1264 rstate.initialized = 1; in radius_init()
1266 if (rc_read_config(rstate.config_file) != 0) { in radius_init()
1268 rstate.config_file); in radius_init()
1288 rc_avpair_parse(avpopt->vpstr, &rstate.avp); in radius_init()
1328 if (!rstate.choose_ip) { in radius_allowed_address()
1330 if (rstate.any_ip_addr_ok) { in radius_allowed_address()
1342 if (addr == rstate.ip_addr) return 1; in radius_allowed_address()
1349 return rstate.user; in radius_logged_in_user()