Kaynağa Gözat

tls: test if conection is still active for peer verification

(cherry picked from commit 458b803efa2de5b1a3bcdd83400f6ef7c6fad2a0)
(cherry picked from commit 577536ede7321f8aea31806e825738f19ff0a948)
Daniel-Constantin Mierla 11 yıl önce
ebeveyn
işleme
9acc9fd608
1 değiştirilmiş dosya ile 6 ekleme ve 1 silme
  1. 6 1
      modules/tls/tls_mod.c

+ 6 - 1
modules/tls/tls_mod.c

@@ -421,7 +421,12 @@ static int is_peer_verified(struct sip_msg* msg, char* foo, char* foo2)
 
 	c = tcpconn_get(msg->rcv.proto_reserved1, 0, 0, 0,
 					cfg_get(tls, tls_cfg, con_lifetime));
-	if (c && c->type != PROTO_TLS) {
+	if (!c) {
+		ERR("connection no longer exits\n");
+		return -1;
+	}
+
+	if(c->type != PROTO_TLS) {
 		ERR("Connection found but is not TLS\n");
 		tcpconn_put(c);
 		return -1;