diff options
-rw-r--r-- | src/common/socket.c | 5 | ||||
-rw-r--r-- | src/common/socket.h | 1 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking.Defs.inc | 2 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc | 4 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc | 1 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_char.Hooks.inc | 27 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_login.HPMHooksCore.inc | 4 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_login.HookingPoints.inc | 1 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_login.Hooks.inc | 27 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc | 4 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc | 1 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_map.Hooks.inc | 27 |
12 files changed, 102 insertions, 2 deletions
diff --git a/src/common/socket.c b/src/common/socket.c index 95d8bf578..2dda7d008 100644 --- a/src/common/socket.c +++ b/src/common/socket.c @@ -462,7 +462,7 @@ static int recv_to_fifo(int fd) socket_data_ci += len; } #endif // SHOW_SERVER_STATS - return 0; + return (int)len; } static int send_from_fifo(int fd) @@ -648,7 +648,7 @@ static int make_listen_bind(uint32 ip, uint16 port) if(sockt->fd_max <= fd) sockt->fd_max = fd + 1; - create_session(fd, connect_client, null_send, null_parse); + create_session(fd, sockt->connect_client, null_send, null_parse); sockt->session[fd]->client_addr = 0; // just listens sockt->session[fd]->rdata_tick = 0; // disable timeouts on this socket return fd; @@ -2177,6 +2177,7 @@ void socket_defaults(void) /* */ sockt->flush = flush_fifo; sockt->flush_fifos = flush_fifos; + sockt->connect_client = connect_client; sockt->set_nonblocking = set_nonblocking; sockt->set_defaultparse = set_defaultparse; sockt->host2ip = host2ip; diff --git a/src/common/socket.h b/src/common/socket.h index 5e4251989..01e919a89 100644 --- a/src/common/socket.h +++ b/src/common/socket.h @@ -212,6 +212,7 @@ struct socket_interface { /* */ void (*flush) (int fd); void (*flush_fifos) (void); + int (*connect_client) (int listen_fd); void (*set_nonblocking) (int fd, unsigned long yes); void (*set_defaultparse) (ParseFunc defaultparse); /* hostname/ip conversion functions */ diff --git a/src/plugins/HPMHooking/HPMHooking.Defs.inc b/src/plugins/HPMHooking/HPMHooking.Defs.inc index 7cc5ef2b1..c764d0290 100644 --- a/src/plugins/HPMHooking/HPMHooking.Defs.inc +++ b/src/plugins/HPMHooking/HPMHooking.Defs.inc @@ -7538,6 +7538,8 @@ typedef void (*HPMHOOK_pre_sockt_flush) (int *fd); typedef void (*HPMHOOK_post_sockt_flush) (int fd); typedef void (*HPMHOOK_pre_sockt_flush_fifos) (void); typedef void (*HPMHOOK_post_sockt_flush_fifos) (void); +typedef int (*HPMHOOK_pre_sockt_connect_client) (int *listen_fd); +typedef int (*HPMHOOK_post_sockt_connect_client) (int retVal___, int listen_fd); typedef void (*HPMHOOK_pre_sockt_set_nonblocking) (int *fd, unsigned long *yes); typedef void (*HPMHOOK_post_sockt_set_nonblocking) (int fd, unsigned long yes); typedef void (*HPMHOOK_pre_sockt_set_defaultparse) (ParseFunc *defaultparse); diff --git a/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc index a8b4860f3..dbabf8ed4 100644 --- a/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc @@ -1422,6 +1422,8 @@ struct { struct HPMHookPoint *HP_sockt_flush_post; struct HPMHookPoint *HP_sockt_flush_fifos_pre; struct HPMHookPoint *HP_sockt_flush_fifos_post; + struct HPMHookPoint *HP_sockt_connect_client_pre; + struct HPMHookPoint *HP_sockt_connect_client_post; struct HPMHookPoint *HP_sockt_set_nonblocking_pre; struct HPMHookPoint *HP_sockt_set_nonblocking_post; struct HPMHookPoint *HP_sockt_set_defaultparse_pre; @@ -3059,6 +3061,8 @@ struct { int HP_sockt_flush_post; int HP_sockt_flush_fifos_pre; int HP_sockt_flush_fifos_post; + int HP_sockt_connect_client_pre; + int HP_sockt_connect_client_post; int HP_sockt_set_nonblocking_pre; int HP_sockt_set_nonblocking_post; int HP_sockt_set_defaultparse_pre; diff --git a/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc index 56c5bcfb7..f666ad1fd 100644 --- a/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc @@ -758,6 +758,7 @@ struct HookingPointData HookingPoints[] = { { HP_POP(sockt->session_is_active, HP_sockt_session_is_active) }, { HP_POP(sockt->flush, HP_sockt_flush) }, { HP_POP(sockt->flush_fifos, HP_sockt_flush_fifos) }, + { HP_POP(sockt->connect_client, HP_sockt_connect_client) }, { HP_POP(sockt->set_nonblocking, HP_sockt_set_nonblocking) }, { HP_POP(sockt->set_defaultparse, HP_sockt_set_defaultparse) }, { HP_POP(sockt->host2ip, HP_sockt_host2ip) }, diff --git a/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc index 0bd61ba15..edffe7c11 100644 --- a/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc @@ -18686,6 +18686,33 @@ void HP_sockt_flush_fifos(void) { } return; } +int HP_sockt_connect_client(int listen_fd) { + int hIndex = 0; + int retVal___ = 0; + if (HPMHooks.count.HP_sockt_connect_client_pre > 0) { + int (*preHookFunc) (int *listen_fd); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_sockt_connect_client_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_sockt_connect_client_pre[hIndex].func; + retVal___ = preHookFunc(&listen_fd); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.sockt.connect_client(listen_fd); + } + if (HPMHooks.count.HP_sockt_connect_client_post > 0) { + int (*postHookFunc) (int retVal___, int listen_fd); + for (hIndex = 0; hIndex < HPMHooks.count.HP_sockt_connect_client_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_sockt_connect_client_post[hIndex].func; + retVal___ = postHookFunc(retVal___, listen_fd); + } + } + return retVal___; +} void HP_sockt_set_nonblocking(int fd, unsigned long yes) { int hIndex = 0; if (HPMHooks.count.HP_sockt_set_nonblocking_pre > 0) { diff --git a/src/plugins/HPMHooking/HPMHooking_login.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_login.HPMHooksCore.inc index 7293e8fc4..ba0fe05c2 100644 --- a/src/plugins/HPMHooking/HPMHooking_login.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_login.HPMHooksCore.inc @@ -584,6 +584,8 @@ struct { struct HPMHookPoint *HP_sockt_flush_post; struct HPMHookPoint *HP_sockt_flush_fifos_pre; struct HPMHookPoint *HP_sockt_flush_fifos_post; + struct HPMHookPoint *HP_sockt_connect_client_pre; + struct HPMHookPoint *HP_sockt_connect_client_post; struct HPMHookPoint *HP_sockt_set_nonblocking_pre; struct HPMHookPoint *HP_sockt_set_nonblocking_post; struct HPMHookPoint *HP_sockt_set_defaultparse_pre; @@ -1383,6 +1385,8 @@ struct { int HP_sockt_flush_post; int HP_sockt_flush_fifos_pre; int HP_sockt_flush_fifos_post; + int HP_sockt_connect_client_pre; + int HP_sockt_connect_client_post; int HP_sockt_set_nonblocking_pre; int HP_sockt_set_nonblocking_post; int HP_sockt_set_defaultparse_pre; diff --git a/src/plugins/HPMHooking/HPMHooking_login.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_login.HookingPoints.inc index 825e049b1..1e3548621 100644 --- a/src/plugins/HPMHooking/HPMHooking_login.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_login.HookingPoints.inc @@ -326,6 +326,7 @@ struct HookingPointData HookingPoints[] = { { HP_POP(sockt->session_is_active, HP_sockt_session_is_active) }, { HP_POP(sockt->flush, HP_sockt_flush) }, { HP_POP(sockt->flush_fifos, HP_sockt_flush_fifos) }, + { HP_POP(sockt->connect_client, HP_sockt_connect_client) }, { HP_POP(sockt->set_nonblocking, HP_sockt_set_nonblocking) }, { HP_POP(sockt->set_defaultparse, HP_sockt_set_defaultparse) }, { HP_POP(sockt->host2ip, HP_sockt_host2ip) }, diff --git a/src/plugins/HPMHooking/HPMHooking_login.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_login.Hooks.inc index 044ee2df2..080fb75ff 100644 --- a/src/plugins/HPMHooking/HPMHooking_login.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_login.Hooks.inc @@ -7495,6 +7495,33 @@ void HP_sockt_flush_fifos(void) { } return; } +int HP_sockt_connect_client(int listen_fd) { + int hIndex = 0; + int retVal___ = 0; + if (HPMHooks.count.HP_sockt_connect_client_pre > 0) { + int (*preHookFunc) (int *listen_fd); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_sockt_connect_client_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_sockt_connect_client_pre[hIndex].func; + retVal___ = preHookFunc(&listen_fd); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.sockt.connect_client(listen_fd); + } + if (HPMHooks.count.HP_sockt_connect_client_post > 0) { + int (*postHookFunc) (int retVal___, int listen_fd); + for (hIndex = 0; hIndex < HPMHooks.count.HP_sockt_connect_client_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_sockt_connect_client_post[hIndex].func; + retVal___ = postHookFunc(retVal___, listen_fd); + } + } + return retVal___; +} void HP_sockt_set_nonblocking(int fd, unsigned long yes) { int hIndex = 0; if (HPMHooks.count.HP_sockt_set_nonblocking_pre > 0) { diff --git a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc index b323d77e6..70604ff9e 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc @@ -6042,6 +6042,8 @@ struct { struct HPMHookPoint *HP_sockt_flush_post; struct HPMHookPoint *HP_sockt_flush_fifos_pre; struct HPMHookPoint *HP_sockt_flush_fifos_post; + struct HPMHookPoint *HP_sockt_connect_client_pre; + struct HPMHookPoint *HP_sockt_connect_client_post; struct HPMHookPoint *HP_sockt_set_nonblocking_pre; struct HPMHookPoint *HP_sockt_set_nonblocking_post; struct HPMHookPoint *HP_sockt_set_defaultparse_pre; @@ -12711,6 +12713,8 @@ struct { int HP_sockt_flush_post; int HP_sockt_flush_fifos_pre; int HP_sockt_flush_fifos_post; + int HP_sockt_connect_client_pre; + int HP_sockt_connect_client_post; int HP_sockt_set_nonblocking_pre; int HP_sockt_set_nonblocking_post; int HP_sockt_set_defaultparse_pre; diff --git a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc index 3c09aba59..f081fd520 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc @@ -3089,6 +3089,7 @@ struct HookingPointData HookingPoints[] = { { HP_POP(sockt->session_is_active, HP_sockt_session_is_active) }, { HP_POP(sockt->flush, HP_sockt_flush) }, { HP_POP(sockt->flush_fifos, HP_sockt_flush_fifos) }, + { HP_POP(sockt->connect_client, HP_sockt_connect_client) }, { HP_POP(sockt->set_nonblocking, HP_sockt_set_nonblocking) }, { HP_POP(sockt->set_defaultparse, HP_sockt_set_defaultparse) }, { HP_POP(sockt->host2ip, HP_sockt_host2ip) }, diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc index 8242b9797..d18b4f360 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc @@ -80816,6 +80816,33 @@ void HP_sockt_flush_fifos(void) { } return; } +int HP_sockt_connect_client(int listen_fd) { + int hIndex = 0; + int retVal___ = 0; + if (HPMHooks.count.HP_sockt_connect_client_pre > 0) { + int (*preHookFunc) (int *listen_fd); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_sockt_connect_client_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_sockt_connect_client_pre[hIndex].func; + retVal___ = preHookFunc(&listen_fd); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.sockt.connect_client(listen_fd); + } + if (HPMHooks.count.HP_sockt_connect_client_post > 0) { + int (*postHookFunc) (int retVal___, int listen_fd); + for (hIndex = 0; hIndex < HPMHooks.count.HP_sockt_connect_client_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_sockt_connect_client_post[hIndex].func; + retVal___ = postHookFunc(retVal___, listen_fd); + } + } + return retVal___; +} void HP_sockt_set_nonblocking(int fd, unsigned long yes) { int hIndex = 0; if (HPMHooks.count.HP_sockt_set_nonblocking_pre > 0) { |