when socket creation fails, return a relevant windows error code so the client will raise ::Rex::ConnectionError instead of just erroring out with a RequestError. This fixes some problems with backtraces when routing through a php meterp. See r9794, #3481.
git-svn-id: file:///home/svn/framework3/trunk@11532 4d416f70-5f16-0410-b530-b9f4589650da
This commit is contained in:
@@ -150,6 +150,14 @@ define("TLV_TYPE_EVENT_DATA", TLV_META_TYPE_RAW | 4013);
|
||||
define("TLV_TYPE_POWER_FLAGS", TLV_META_TYPE_UINT | 4100);
|
||||
define("TLV_TYPE_POWER_REASON", TLV_META_TYPE_UINT | 4101);
|
||||
|
||||
##
|
||||
# Errors
|
||||
##
|
||||
|
||||
# Special return value to match up with Windows error codes for network
|
||||
# errors.
|
||||
define("ERROR_CONNECTION_ERROR", 10000);
|
||||
|
||||
# Wrap everything in checks for existence of the new functions in case we get
|
||||
# eval'd twice
|
||||
my_print("Evaling stdapi");
|
||||
@@ -888,7 +896,7 @@ function channel_create_stdapi_net_tcp_client($req, &$pkt) {
|
||||
}
|
||||
|
||||
if (!$sock) {
|
||||
return ERROR_FAILURE;
|
||||
return ERROR_CONNECTION_ERROR;
|
||||
}
|
||||
|
||||
#
|
||||
@@ -919,7 +927,7 @@ function channel_create_stdapi_net_udp_client($req, &$pkt) {
|
||||
my_print("UDP channel on {$sock}");
|
||||
|
||||
if (!$sock) {
|
||||
return ERROR_FAILURE;
|
||||
return ERROR_CONNECTION_ERROR;
|
||||
}
|
||||
|
||||
#
|
||||
|
||||
Reference in New Issue
Block a user