mirror of
https://gitlab.com/openconnect/ocserv.git
synced 2026-02-10 08:46:58 +08:00
radius: set NAS_PORT on accounting requests
This commit is contained in:
@@ -120,6 +120,13 @@ static void append_acct_standard(rc_handle *rh, const common_auth_info_st *ai, V
|
||||
}
|
||||
}
|
||||
|
||||
if (ai->id) {
|
||||
i = ai->id;
|
||||
if (rc_avpair_add(rh, send, PW_NAS_PORT, &i, -1, 0) == NULL) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (ai->our_ip[0] != 0) {
|
||||
struct in_addr in;
|
||||
struct in6_addr in6;
|
||||
|
||||
@@ -717,7 +717,7 @@ int handle_sec_auth_init(int cfd, sec_mod_st *sec, const SecAuthInitMsg *req, pi
|
||||
client_entry_st *e;
|
||||
unsigned need_continue = 0;
|
||||
|
||||
e = new_client_entry(sec, req->ip);
|
||||
e = new_client_entry(sec, req->ip, pid);
|
||||
if (e == NULL) {
|
||||
seclog(sec, LOG_ERR, "cannot initialize memory");
|
||||
return -1;
|
||||
|
||||
@@ -83,7 +83,7 @@ struct htable *db = sec->client_db;
|
||||
return 0;
|
||||
}
|
||||
|
||||
client_entry_st *new_client_entry(sec_mod_st *sec, const char *ip)
|
||||
client_entry_st *new_client_entry(sec_mod_st *sec, const char *ip, unsigned pid)
|
||||
{
|
||||
struct htable *db = sec->client_db;
|
||||
client_entry_st *e, *te;
|
||||
@@ -96,6 +96,7 @@ client_entry_st *new_client_entry(sec_mod_st *sec, const char *ip)
|
||||
}
|
||||
|
||||
strlcpy(e->auth_info.remote_ip, ip, sizeof(e->auth_info.remote_ip));
|
||||
e->auth_info.id = pid;
|
||||
|
||||
do {
|
||||
ret = gnutls_rnd(GNUTLS_RND_RANDOM, e->sid, sizeof(e->sid));
|
||||
|
||||
@@ -56,6 +56,7 @@ typedef struct common_auth_info_st {
|
||||
char our_ip[MAX_IP_STR];
|
||||
char ipv4[MAX_IP_STR];
|
||||
char ipv6[MAX_IP_STR];
|
||||
unsigned id;
|
||||
} common_auth_info_st;
|
||||
|
||||
typedef struct client_entry_st {
|
||||
@@ -100,7 +101,7 @@ typedef struct client_entry_st {
|
||||
void *sec_mod_client_db_init(sec_mod_st *sec);
|
||||
void sec_mod_client_db_deinit(sec_mod_st *sec);
|
||||
unsigned sec_mod_client_db_elems(sec_mod_st *sec);
|
||||
client_entry_st * new_client_entry(sec_mod_st *sec, const char *ip);
|
||||
client_entry_st * new_client_entry(sec_mod_st *sec, const char *ip, unsigned pid);
|
||||
client_entry_st * find_client_entry(sec_mod_st *sec, uint8_t sid[SID_SIZE]);
|
||||
void del_client_entry(sec_mod_st *sec, client_entry_st * e);
|
||||
void expire_client_entry(sec_mod_st *sec, client_entry_st * e);
|
||||
|
||||
Reference in New Issue
Block a user