ocserv: notify back the client about the hostname accepted (if any)

That is, the server will populate X-CSTP-Hostname and send it
back the the client.
This commit is contained in:
Nikos Mavrogiannopoulos
2016-06-18 14:05:24 +02:00
parent 4124b9c089
commit ed31709e75

View File

@@ -1404,8 +1404,10 @@ static int connect_handler(worker_st * ws)
return -1;
}
if (ws->user_config->hostname)
/* override any hostname sent by the peer if we have one already configured */
if (ws->user_config->hostname) {
strlcpy(ws->req.hostname, ws->user_config->hostname, sizeof(ws->req.hostname));
}
FUZZ(ws->user_config->interim_update_secs, 5, rnd);
FUZZ(ws->config->rekey_time, 30, rnd);
@@ -1430,6 +1432,12 @@ static int connect_handler(worker_st * ws)
ws->config->idle_timeout = ws->config->mobile_idle_timeout;
}
/* Notify back the client about the accepted hostname */
if (ws->req.hostname[0] != 0) {
ret = cstp_printf(ws, "X-CSTP-Hostname: %s\r\n", ws->req.hostname);
SEND_ERR(ret);
}
oclog(ws, LOG_INFO, "suggesting DPD of %d secs", ws->user_config->dpd);
if (ws->user_config->dpd > 0) {
ret =