From c5c4e4e804cf322582d80c08baba26663e8207bc Mon Sep 17 00:00:00 2001 From: John Safranek Date: Thu, 24 Sep 2026 10:24:54 -0700 Subject: [PATCH] Leave the server SCP code out of client builds A client-only library still built and exported wolfSSH_SCP_accept(). The server SCP entry points now sit under NO_WOLFSSH_SERVER, the way the client ones already sit under NO_WOLFSSH_CLIENT. - guard wolfSSH_SCP_accept(), DoScpRequest() and ParseScpCommand() - guard the DoScpRequest() and ParseScpCommand() prototypes in internal.h --- src/wolfscp.c | 6 +++++- wolfssh/internal.h | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/wolfscp.c b/src/wolfscp.c index 21eb2146..6a3f8822 100644 --- a/src/wolfscp.c +++ b/src/wolfscp.c @@ -894,6 +894,7 @@ int DoScpSource(WOLFSSH* ssh) return ret; } +#ifndef NO_WOLFSSH_SERVER /* Contract is in wolfssh/wolfscp.h. */ int wolfSSH_SCP_accept(WOLFSSH* ssh) { @@ -999,6 +1000,7 @@ int DoScpRequest(WOLFSSH* ssh) return ret; } +#endif /* !NO_WOLFSSH_SERVER */ /* Sets the error message that is sent back to the peer when an error or fatal * confirmation message is sent. Expected to be used inside the scp @@ -1623,6 +1625,7 @@ static int ParseBasePathHelper(WOLFSSH* ssh) return ret; }*/ +#ifndef NO_WOLFSSH_SERVER /* Parse scp command received, currently only looks for and stores the * SCP base path being written to. * @@ -1742,6 +1745,7 @@ int ParseScpCommand(WOLFSSH* ssh) return ret; } +#endif /* !NO_WOLFSSH_SERVER */ /* Reads and parses SCP protocol control messages * @@ -2228,7 +2232,7 @@ int wolfSSH_SCP_from(WOLFSSH* ssh, const char* src, const char* dst) return ret; } -#endif /* ! NO_WOLFSSH_CLIENT */ +#endif /* !NO_WOLFSSH_CLIENT */ #if !defined(WOLFSSH_SCP_USER_CALLBACKS) diff --git a/wolfssh/internal.h b/wolfssh/internal.h index cd32096c..95f6fafc 100644 --- a/wolfssh/internal.h +++ b/wolfssh/internal.h @@ -2361,10 +2361,12 @@ enum WS_ScpDirection { WOLFSSH_SCP_FROM }; +#ifndef NO_WOLFSSH_SERVER WOLFSSH_LOCAL int DoScpRequest(WOLFSSH* ssh); +WOLFSSH_LOCAL int ParseScpCommand(WOLFSSH* ssh); +#endif /* !NO_WOLFSSH_SERVER */ WOLFSSH_LOCAL int DoScpSink(WOLFSSH* ssh); WOLFSSH_LOCAL int DoScpSource(WOLFSSH* ssh); -WOLFSSH_LOCAL int ParseScpCommand(WOLFSSH* ssh); WOLFSSH_LOCAL int ReceiveScpMessage(WOLFSSH* ssh); WOLFSSH_LOCAL int ReceiveScpFile(WOLFSSH* ssh); WOLFSSH_LOCAL int SendScpConfirmation(WOLFSSH* ssh);