-
Notifications
You must be signed in to change notification settings - Fork 102
No Server Guard Update #888
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -406,7 +406,9 @@ static int SendPacketType(WOLFSSH* ssh, byte type, byte* buf, word32 bufSz); | |
| static int SFTP_ParseAtributes_buffer(WOLFSSH* ssh, WS_SFTP_FILEATRB* atr, | ||
| byte* buf, word32* idx, word32 maxIdx); | ||
| static WS_SFTPNAME* wolfSSH_SFTPNAME_new(void* heap); | ||
| #if !defined(NO_WOLFSSH_SERVER) && !defined(NO_WOLFSSH_DIR) | ||
| static int SFTP_CreateLongName(WS_SFTPNAME* name); | ||
| #endif | ||
|
|
||
|
|
||
| /* A few errors are OK to get. They are a notice rather that a fault. | ||
|
|
@@ -902,6 +904,7 @@ static int SFTP_SetHeader(WOLFSSH* ssh, word32 reqId, byte type, word32 len, | |
| return WS_SUCCESS; | ||
| } | ||
|
|
||
| #ifndef NO_WOLFSSH_SERVER | ||
| static int SFTP_CreatePacket(WOLFSSH* ssh, byte type, byte* out, word32 outSz, | ||
| byte* data, word32 dataSz) | ||
| { | ||
|
|
@@ -925,6 +928,7 @@ static int SFTP_CreatePacket(WOLFSSH* ssh, byte type, byte* out, word32 outSz, | |
| } | ||
| return WS_SUCCESS; | ||
| } | ||
| #endif /* !NO_WOLFSSH_SERVER */ | ||
|
|
||
|
|
||
| /* returns the size of buffer needed to hold attributes */ | ||
|
|
@@ -1038,11 +1042,13 @@ static INLINE int SFTP_GetSz(byte* buf, word32* sz, | |
| } | ||
|
|
||
|
|
||
| #ifndef NO_WOLFSSH_SERVER | ||
|
|
||
| #if !defined(WOLFSSH_USER_FILESYSTEM) | ||
| static int SFTP_GetAttributes(void* fs, const char* fileName, | ||
| WS_SFTP_FILEATRB* atr, byte noFollow, void* heap); | ||
| #endif | ||
|
|
||
| #ifndef NO_WOLFSSH_SERVER | ||
| #if !defined(WOLFSSH_USER_FILESYSTEM) | ||
| static int SFTP_GetAttributes_Handle(WOLFSSH* ssh, byte* handle, int handleSz, | ||
| char* name, WS_SFTP_FILEATRB* atr); | ||
| #endif | ||
|
|
@@ -3380,7 +3386,9 @@ static int wolfSSH_SFTP_SendName(WOLFSSH* ssh, WS_SFTPNAME* list, word32 count, | |
|
|
||
| return WS_SUCCESS; | ||
| } | ||
| #endif /* !NO_WOLFSSH_DIR */ | ||
|
|
||
| #endif /* !NO_WOLFSSH_SERVER */ | ||
|
|
||
| int wolfSSH_SFTP_SetDefaultPath(WOLFSSH* ssh, const char* path) | ||
| { | ||
|
|
@@ -3401,6 +3409,9 @@ int wolfSSH_SFTP_SetDefaultPath(WOLFSSH* ssh, const char* path) | |
| return WS_SUCCESS; | ||
| } | ||
|
|
||
| #ifndef NO_WOLFSSH_SERVER | ||
|
|
||
| #ifndef NO_WOLFSSH_DIR | ||
|
|
||
| /* Handles packet to read a directory | ||
| * | ||
|
|
@@ -3591,6 +3602,7 @@ int wolfSSH_SFTP_RecvCloseDir(WOLFSSH* ssh, byte* handle, word32 handleSz) | |
|
|
||
| return WS_SUCCESS; | ||
| } | ||
|
|
||
| #endif /* NO_WOLFSSH_DIR */ | ||
|
|
||
| /* Handles packet to write a file | ||
|
Comment on lines
3602
to
3608
|
||
|
|
@@ -4481,6 +4493,7 @@ int SFTP_RemoveHandleNode(WOLFSSH* ssh, byte* handle, word32 handleSz) | |
| } | ||
| #endif /* WOLFSSH_STOREHANDLE */ | ||
|
|
||
| #endif /* !NO_WOLFSSH_SERVER */ | ||
|
|
||
| #if defined(WOLFSSH_USER_FILESYSTEM) | ||
| /* User-defined I/O support */ | ||
|
|
@@ -4601,6 +4614,7 @@ int SFTP_GetAttributes(void* fs, const char* fileName, WS_SFTP_FILEATRB* atr, | |
| } | ||
|
|
||
|
|
||
| #ifndef NO_WOLFSSH_SERVER | ||
| /* @TODO can be overridden by user for portability | ||
| * Gets attributes based on file descriptor | ||
| * NOTE: if atr->flags is set to a value of 0 then no attributes are set. | ||
|
|
@@ -4655,6 +4669,7 @@ int SFTP_GetAttributes_Handle(WOLFSSH* ssh, byte* handle, int handleSz, | |
| NU_Done(&stats); | ||
| return WS_SUCCESS; | ||
| } | ||
| #endif /* !NO_WOLFSSH_SERVER */ | ||
|
|
||
| #elif defined(USE_WINDOWS_API) | ||
|
|
||
|
|
@@ -4764,6 +4779,7 @@ int SFTP_GetAttributes(void* fs, const char* fileName, WS_SFTP_FILEATRB* atr, | |
| return WS_SUCCESS; | ||
| } | ||
|
|
||
| #ifndef NO_WOLFSSH_SERVER | ||
| /* @TODO can be overridden by user for portability | ||
| * Gets attributes based on file descriptor | ||
| * NOTE: if atr->flags is set to a value of 0 then no attributes are set. | ||
|
|
@@ -4815,6 +4831,7 @@ int SFTP_GetAttributes_Handle(WOLFSSH* ssh, byte* handle, int handleSz, | |
|
|
||
| return WS_SUCCESS; | ||
| } | ||
| #endif /* !NO_WOLFSSH_SERVER */ | ||
|
|
||
| #elif defined(WOLFSSH_FATFS) | ||
|
|
||
|
|
@@ -4883,6 +4900,7 @@ static int SFTP_GetAttributes(void* fs, const char* fileName, | |
| return WS_SUCCESS; | ||
| } | ||
|
|
||
| #ifndef NO_WOLFSSH_SERVER | ||
| static int SFTP_GetAttributes_Handle(WOLFSSH* ssh, byte* handle, int handleSz, | ||
| char* name, WS_SFTP_FILEATRB* atr) | ||
| { | ||
|
|
@@ -4930,6 +4948,7 @@ static int SFTP_GetAttributes_Handle(WOLFSSH* ssh, byte* handle, int handleSz, | |
| WOLFSSH_UNUSED(handleSz); | ||
| return WS_SUCCESS; | ||
| } | ||
| #endif /* !NO_WOLFSSH_SERVER */ | ||
|
|
||
| #elif defined(WOLFSSH_ZEPHYR) | ||
|
|
||
|
|
@@ -4969,6 +4988,7 @@ int SFTP_GetAttributes(void* fs, const char* fileName, WS_SFTP_FILEATRB* atr, | |
| return PopulateAttributes(atr, &stats); | ||
| } | ||
|
|
||
| #ifndef NO_WOLFSSH_SERVER | ||
| int SFTP_GetAttributes_Handle(WOLFSSH* ssh, byte* handle, int handleSz, | ||
| char* name, WS_SFTP_FILEATRB* atr) | ||
| { | ||
|
|
@@ -4981,6 +5001,7 @@ int SFTP_GetAttributes_Handle(WOLFSSH* ssh, byte* handle, int handleSz, | |
| WLOG(WS_LOG_SFTP, "SFTP_GetAttributes_Handle() not implemented yet"); | ||
| return WS_NOT_COMPILED; | ||
| } | ||
| #endif /* !NO_WOLFSSH_SERVER */ | ||
|
|
||
| #elif defined(MICROCHIP_MPLAB_HARMONY) | ||
| int SFTP_GetAttributesStat(WS_SFTP_FILEATRB* atr, WSTAT_T* stats) | ||
|
|
@@ -5068,11 +5089,13 @@ int SFTP_GetAttributes(void* fs, const char* fileName, WS_SFTP_FILEATRB* atr, | |
| * Fills out a WS_SFTP_FILEATRB structure | ||
| * returns WS_SUCCESS on success | ||
| */ | ||
| #ifndef NO_WOLFSSH_SERVER | ||
| int SFTP_GetAttributes_Handle(WOLFSSH* ssh, byte* handle, int handleSz, | ||
| char* name, WS_SFTP_FILEATRB* atr) | ||
| { | ||
| return SFTP_GetAttributesHelper(atr, name); | ||
| } | ||
| #endif /* !NO_WOLFSSH_SERVER */ | ||
|
|
||
| #else | ||
|
|
||
|
|
@@ -5125,6 +5148,7 @@ int SFTP_GetAttributes(void* fs, const char* fileName, WS_SFTP_FILEATRB* atr, | |
| } | ||
|
|
||
|
|
||
| #ifndef NO_WOLFSSH_SERVER | ||
| /* @TODO can be overridden by user for portability | ||
| * Gets attributes based on file descriptor | ||
| * NOTE: if atr->flags is set to a value of 0 then no attributes are set. | ||
|
|
@@ -5169,8 +5193,10 @@ int SFTP_GetAttributes_Handle(WOLFSSH* ssh, byte* handle, int handleSz, | |
| WOLFSSH_UNUSED(name); | ||
| return WS_SUCCESS; | ||
| } | ||
| #endif /* !NO_WOLFSSH_SERVER */ | ||
| #endif | ||
|
|
||
| #ifndef NO_WOLFSSH_SERVER | ||
|
|
||
| #ifndef USE_WINDOWS_API | ||
| /* Handles receiving fstat packet | ||
|
|
@@ -9273,7 +9299,7 @@ int wolfSSH_SFTP_free(WOLFSSH* ssh) | |
| ret = SFTP_FreeHandles(ssh); | ||
| #endif | ||
|
|
||
| #ifndef NO_WOLFSSH_DIR | ||
| #if !defined(NO_WOLFSSH_DIR) && !defined(NO_WOLFSSH_SERVER) | ||
| { | ||
| /* free all dirs if hung up on */ | ||
| WS_DIR_LIST* cur = ssh->dirList; | ||
|
|
@@ -9294,7 +9320,7 @@ int wolfSSH_SFTP_free(WOLFSSH* ssh) | |
| } | ||
| ssh->dirList = NULL; | ||
| } | ||
| #endif /* NO_WOLFSSH_DIR */ | ||
| #endif /* !NO_WOLFSSH_DIR && !NO_WOLFSSH_SERVER */ | ||
|
|
||
| wolfSSH_SFTP_ClearState(ssh, STATE_ID_ALL); | ||
| return ret; | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -88,6 +88,10 @@ extern "C" { | |||||
| * at least one algorithm to use, throw an error. | ||||||
| */ | ||||||
|
|
||||||
| #if defined(NO_WOLFSSH_SERVER) && defined(NO_WOLFSSH_CLIENT) | ||||||
| #error "You cannot disable both server and client." | ||||||
|
||||||
| #error "You cannot disable both server and client." | |
| #error "Both NO_WOLFSSH_SERVER and NO_WOLFSSH_CLIENT are defined. Enable at least one (omit one of --disable-server or --disable-client)." |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -640,7 +640,7 @@ extern "C" { | |||||
|
|
||||||
| #if (defined(WOLFSSH_SFTP) || \ | ||||||
| defined(WOLFSSH_SCP) || defined(WOLFSSH_SSHD)) && \ | ||||||
| !defined(NO_WOLFSSH_SERVER) && \ | ||||||
| (!defined(NO_WOLFSSH_SERVER) || !defined(NO_WOLFSSH_CLIENT)) && \ | ||||||
|
||||||
| (!defined(NO_WOLFSSH_SERVER) || !defined(NO_WOLFSSH_CLIENT)) && \ | |
| !(defined(NO_WOLFSSH_SERVER) && defined(NO_WOLFSSH_CLIENT)) && \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These forward declarations use
static, but later in the file there are implementations declared withoutstatic(e.g.,int SFTP_GetAttributes(...)/int SFTP_GetAttributes_Handle(...)in several platform branches). In C this is a linkage mismatch and can fail compilation (non-static declaration follows static declaration). Make the storage class consistent: either removestaticfrom the forward declarations (if these are meant to have external linkage in at least some builds), or change all corresponding definitions tostatic(if these are intended to be file-private) and expose a separate non-static wrapper only when needed.