From f5235f0e2f22b0fb4fa28ae0541a04f3f2d15a1a Mon Sep 17 00:00:00 2001 From: Wolf3s Date: Fri, 24 Nov 2023 21:50:39 -0300 Subject: [PATCH 1/3] General code cleanup --- lib/dcerpc.c | 2 +- lib/init.c | 11 ++++------- lib/libsmb2.c | 4 ++-- lib/sync.c | 2 +- 4 files changed, 8 insertions(+), 11 deletions(-) diff --git a/lib/dcerpc.c b/lib/dcerpc.c index df7b8bbb..782b5e05 100644 --- a/lib/dcerpc.c +++ b/lib/dcerpc.c @@ -1761,7 +1761,7 @@ dcerpc_get_error(struct dcerpc_context *dce) void dcerpc_free_data(struct dcerpc_context *dce, void *data) { - return smb2_free_data(dcerpc_get_smb2_context(dce), data); + smb2_free_data(dcerpc_get_smb2_context(dce), data); } int diff --git a/lib/init.c b/lib/init.c index a0c05cde..4b366342 100644 --- a/lib/init.c +++ b/lib/init.c @@ -48,7 +48,7 @@ #include #include -#if !defined(PS2_IOP_PLATFORM) +#ifdef HAVE_TIME_H #include #endif @@ -473,7 +473,7 @@ void smb2_set_security_mode(struct smb2_context *smb2, uint16_t security_mode) smb2->security_mode = security_mode; } -#if !defined(PS2_IOP_PLATFORM) +#ifndef PS2_IOP_PLATFORM static void smb2_set_password_from_file(struct smb2_context *smb2) { char *name = NULL; @@ -549,11 +549,6 @@ static void smb2_set_password_from_file(struct smb2_context *smb2) } fclose(fh); } -#else /* !PS2_IOP_PLATFORM */ -static void smb2_set_password_from_file(struct smb2_context *smb2) -{ - return; -} #endif /* !PS2_IOP_PLATFORM */ void smb2_set_user(struct smb2_context *smb2, const char *user) @@ -566,7 +561,9 @@ void smb2_set_user(struct smb2_context *smb2, const char *user) return; } smb2->user = strdup(user); +#if !defined(PS2_IOP_PLATFORM) smb2_set_password_from_file(smb2); +#endif } void smb2_set_password(struct smb2_context *smb2, const char *password) diff --git a/lib/libsmb2.c b/lib/libsmb2.c index e5a2054a..ee5b6c57 100644 --- a/lib/libsmb2.c +++ b/lib/libsmb2.c @@ -64,7 +64,7 @@ #include #endif -#if defined(HAVE_FCNTL_H) +#ifdef HAVE_FCNTL_H #include #endif @@ -2337,7 +2337,7 @@ smb2_ftruncate_async(struct smb2_context *smb2, struct smb2fh *fh, { struct create_cb_data *create_data; struct smb2_set_info_request req; - struct smb2_file_end_of_file_info eofi; + struct smb2_file_end_of_file_info eofi _U_; struct smb2_pdu *pdu; if (smb2 == NULL) { diff --git a/lib/sync.c b/lib/sync.c index b96be5b6..7c83e8fd 100644 --- a/lib/sync.c +++ b/lib/sync.c @@ -37,7 +37,7 @@ #include -#if defined(HAVE_SYS_POLL_H) +#ifdef HAVE_SYS_POLL_H #include #endif From 8eccfd86e17c329c6d62fc429b0b370cd89464ca Mon Sep 17 00:00:00 2001 From: nop Date: Sat, 25 Nov 2023 21:37:33 +0900 Subject: [PATCH 2/3] ESP_PLATFORM is sys/poll.h, not poll.h --- lib/socket.c | 4 ++++ lib/sync.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/lib/socket.c b/lib/socket.c index 8defc039..a85fec42 100644 --- a/lib/socket.c +++ b/lib/socket.c @@ -45,8 +45,12 @@ #endif #ifdef HAVE_POLL_H +#ifdef ESP_PLATFORM +#include +#else #include #endif +#endif #ifdef HAVE_STDLIB_H #include diff --git a/lib/sync.c b/lib/sync.c index 7c83e8fd..749a1714 100644 --- a/lib/sync.c +++ b/lib/sync.c @@ -42,8 +42,12 @@ #endif #ifdef HAVE_POLL_H +#ifdef ESP_PLATFORM +#include +#else #include #endif +#endif #ifdef HAVE_STRING_H #include From f915baaa674f43d371553e1c058f2469f50ca5af Mon Sep 17 00:00:00 2001 From: Wolf3s Date: Sat, 25 Nov 2023 17:56:33 -0300 Subject: [PATCH 3/3] Comment HAVE_POLL_H --- include/esp/config.h | 2 +- lib/socket.c | 4 ---- lib/sync.c | 4 ---- 3 files changed, 1 insertion(+), 9 deletions(-) diff --git a/include/esp/config.h b/include/esp/config.h index 233b09be..f1aa2b92 100644 --- a/include/esp/config.h +++ b/include/esp/config.h @@ -41,7 +41,7 @@ /* #define HAVE_NETINET_TCP_H 1 */ /* Define to 1 if you have the header file. */ -#define HAVE_POLL_H 1 +/* #define HAVE_POLL_H 1 */ /* Whether sockaddr struct has sa_len */ /* #undef HAVE_SOCKADDR_LEN */ diff --git a/lib/socket.c b/lib/socket.c index a85fec42..8defc039 100644 --- a/lib/socket.c +++ b/lib/socket.c @@ -45,12 +45,8 @@ #endif #ifdef HAVE_POLL_H -#ifdef ESP_PLATFORM -#include -#else #include #endif -#endif #ifdef HAVE_STDLIB_H #include diff --git a/lib/sync.c b/lib/sync.c index 749a1714..7c83e8fd 100644 --- a/lib/sync.c +++ b/lib/sync.c @@ -42,12 +42,8 @@ #endif #ifdef HAVE_POLL_H -#ifdef ESP_PLATFORM -#include -#else #include #endif -#endif #ifdef HAVE_STRING_H #include