1
mirror of https://github.com/rapid7/metasploit-payloads synced 2025-02-16 00:24:29 +01:00

fail if the socket couldn't connect

git-svn-id: file:///home/svn/framework3/trunk@9427 4d416f70-5f16-0410-b530-b9f4589650da
This commit is contained in:
James Lee 2010-06-04 15:28:11 +00:00
parent fea66a542c
commit 9a7d17cc3e

View File

@ -633,7 +633,7 @@ function channel_create_stdapi_net_tcp_client($req, &$pkt) {
$sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
$res = socket_connect($sock, $peer_host_tlv['value'], $peer_port_tlv['value']);
if (is_resource($sock)) {
if (is_resource($sock) && $res) {
array_push($channels, array(0 => $sock, 1 => $sock, 'type' => 'socket'));
$id = count($channels) - 1;
my_print("Created new channel $sock, with id $id");