Allow TUN_MTU command only in authenticated state

This commit is contained in:
Nikos Mavrogiannopoulos
2014-03-10 10:41:27 +01:00
parent 6028e5d81d
commit 35c31bc0b7
+7 -3
View File
@@ -516,6 +516,13 @@ int handle_commands(main_server_st * s, struct proc_st *proc)
case CMD_TUN_MTU:{ case CMD_TUN_MTU:{
TunMtuMsg *tmsg; TunMtuMsg *tmsg;
if (proc->status != PS_AUTH_COMPLETED) {
mslog(s, proc, LOG_ERR,
"received TUN MTU in unauthenticated state.");
ret = ERR_BAD_COMMAND;
goto cleanup;
}
tmsg = tun_mtu_msg__unpack(NULL, raw_len, raw); tmsg = tun_mtu_msg__unpack(NULL, raw_len, raw);
if (tmsg == NULL) { if (tmsg == NULL) {
mslog(s, proc, LOG_ERR, "error unpacking data"); mslog(s, proc, LOG_ERR, "error unpacking data");
@@ -526,7 +533,6 @@ int handle_commands(main_server_st * s, struct proc_st *proc)
set_tun_mtu(s, proc, tmsg->mtu); set_tun_mtu(s, proc, tmsg->mtu);
tun_mtu_msg__free_unpacked(tmsg, NULL); tun_mtu_msg__free_unpacked(tmsg, NULL);
} }
break; break;
@@ -578,7 +584,6 @@ int handle_commands(main_server_st * s, struct proc_st *proc)
mslog(s, proc, LOG_DEBUG, mslog(s, proc, LOG_DEBUG,
"could not store resumption data"); "could not store resumption data");
} }
} }
break; break;
@@ -753,7 +758,6 @@ int handle_commands(main_server_st * s, struct proc_st *proc)
break; break;
case AUTH_COOKIE_REQ: case AUTH_COOKIE_REQ:
if (proc->status != PS_AUTH_INACTIVE) { if (proc->status != PS_AUTH_INACTIVE) {
mslog(s, proc, LOG_ERR, mslog(s, proc, LOG_ERR,
"received unexpected cookie authentication."); "received unexpected cookie authentication.");