mirror of
https://gitlab.com/openconnect/ocserv.git
synced 2026-02-10 08:46:58 +08:00
Forward the appropriate DNS and NBNS values when using a per-user/group config.
This commit is contained in:
@@ -584,37 +584,47 @@ static int recv_cookie_auth_reply(worker_st * ws)
|
||||
ws->config->udp_port = 0;
|
||||
|
||||
/* routes */
|
||||
ws->routes_size = msg->n_routes;
|
||||
ws->routes = talloc_size(ws, msg->n_routes*sizeof(char*));
|
||||
if (ws->routes != NULL) {
|
||||
ws->routes_size = msg->n_routes;
|
||||
for (i = 0; i < ws->routes_size; i++) {
|
||||
ws->routes[i] =
|
||||
talloc_strdup(ws, msg->routes[i]);
|
||||
|
||||
for (i = 0; i < ws->routes_size; i++) {
|
||||
ws->routes[i] =
|
||||
talloc_strdup(ws, msg->routes[i]);
|
||||
/* If a default route is detected */
|
||||
if (ws->routes[i] != NULL &&
|
||||
(strcmp(ws->routes[i], "default") == 0 ||
|
||||
strcmp(ws->routes[i], "0.0.0.0/0") == 0)) {
|
||||
|
||||
/* If a default route is detected */
|
||||
if (ws->routes[i] != NULL &&
|
||||
(strcmp(ws->routes[i], "default") == 0 ||
|
||||
strcmp(ws->routes[i], "0.0.0.0/0") == 0)) {
|
||||
|
||||
/* disable all routes */
|
||||
ws->routes_size = 0;
|
||||
ws->default_route = 1;
|
||||
break;
|
||||
/* disable all routes */
|
||||
ws->routes_size = 0;
|
||||
ws->default_route = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (check_if_default_route(ws->routes, ws->routes_size))
|
||||
ws->default_route = 1;
|
||||
|
||||
ws->dns_size = msg->n_dns;
|
||||
|
||||
for (i = 0; i < ws->dns_size; i++) {
|
||||
ws->dns[i] = talloc_strdup(ws, msg->dns[i]);
|
||||
ws->dns = talloc_size(ws, msg->n_dns*sizeof(char*));
|
||||
if (ws->dns != NULL) {
|
||||
ws->dns_size = msg->n_dns;
|
||||
for (i = 0; i < ws->dns_size; i++) {
|
||||
ws->dns[i] = talloc_strdup(ws, msg->dns[i]);
|
||||
}
|
||||
ws->vinfo.dns = ws->dns;
|
||||
ws->vinfo.dns_size = ws->dns_size;
|
||||
}
|
||||
|
||||
ws->nbns_size = msg->n_nbns;
|
||||
|
||||
for (i = 0; i < ws->nbns_size; i++) {
|
||||
ws->nbns[i] = talloc_strdup(ws, msg->nbns[i]);
|
||||
ws->nbns = talloc_size(ws, msg->n_nbns*sizeof(char*));
|
||||
if (ws->nbns != NULL) {
|
||||
ws->nbns_size = msg->n_nbns;
|
||||
for (i = 0; i < ws->nbns_size; i++) {
|
||||
ws->nbns[i] = talloc_strdup(ws, msg->nbns[i]);
|
||||
}
|
||||
ws->vinfo.nbns = ws->nbns;
|
||||
ws->vinfo.nbns_size = ws->nbns_size;
|
||||
}
|
||||
} else {
|
||||
oclog(ws, LOG_ERR, "error in received message");
|
||||
|
||||
@@ -225,11 +225,11 @@ typedef struct worker_st {
|
||||
|
||||
/* additional data - received per user or per group */
|
||||
unsigned routes_size;
|
||||
char* routes[MAX_ROUTES];
|
||||
char** routes;
|
||||
unsigned dns_size;
|
||||
char* dns[MAX_ROUTES];
|
||||
char** dns;
|
||||
unsigned nbns_size;
|
||||
char* nbns[MAX_ROUTES];
|
||||
char** nbns;
|
||||
|
||||
void *main_pool; /* to be used only on deinitialization */
|
||||
} worker_st;
|
||||
|
||||
Reference in New Issue
Block a user