mirror of https://github.com/wolfSSL/wolfssh.git
commit
fc23bb9a34
|
@ -16,3 +16,5 @@ EXTRA_DIST+= ide/winvs/echoserver/echoserver.vcxproj
|
|||
EXTRA_DIST+= ide/winvs/echoserver/echoserver.vcxproj.user
|
||||
EXTRA_DIST+= ide/winvs/testsuite/testsuite.vcxproj
|
||||
EXTRA_DIST+= ide/winvs/testsuite/testsuite.vcxproj.user
|
||||
EXTRA_DIST+= ide/winvs/wolfsftp-client/wolfsftp-client.vcxproj
|
||||
EXTRA_DIST+= ide/winvs/wolfsftp-client/wolfsftp-client.vcxproj.user
|
||||
|
|
|
@ -0,0 +1,335 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="DLL Debug|Win32">
|
||||
<Configuration>DLL Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="DLL Debug|x64">
|
||||
<Configuration>DLL Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="DLL Release|Win32">
|
||||
<Configuration>DLL Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="DLL Release|x64">
|
||||
<Configuration>DLL Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\..\wolfsftp\client\sftpclient.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\wolfssh\wolfssh.vcxproj">
|
||||
<Project>{7c2ccf0d-a155-4914-bd1c-9a47c0530e65}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{8DD810D6-159B-4C40-B682-FCA11F9B3680}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>wolfsftp-client</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DLL Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DLL Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DLL Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DLL Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\wolfssh.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='DLL Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\wolfssh.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\wolfssh.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='DLL Debug|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\wolfssh.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\wolfssh.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='DLL Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\wolfssh.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\wolfssh.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='DLL Release|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\wolfssh.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<IntDir>$(Configuration)\$(Platform)\obj\</IntDir>
|
||||
<OutDir>$(SolutionDir)$(Configuration)\$(Platform)\</OutDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DLL Debug|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<IntDir>$(Configuration)\$(Platform)\obj\</IntDir>
|
||||
<OutDir>$(SolutionDir)$(Configuration)\$(Platform)\</OutDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<IntDir>$(Configuration)\$(Platform)\obj\</IntDir>
|
||||
<OutDir>$(SolutionDir)$(Configuration)\$(Platform)\</OutDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DLL Debug|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<IntDir>$(Configuration)\$(Platform)\obj\</IntDir>
|
||||
<OutDir>$(SolutionDir)$(Configuration)\$(Platform)\</OutDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<OutDir>$(SolutionDir)$(Configuration)\$(Platform)\</OutDir>
|
||||
<IntDir>$(Configuration)\$(Platform)\obj\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DLL Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<OutDir>$(SolutionDir)$(Configuration)\$(Platform)\</OutDir>
|
||||
<IntDir>$(Configuration)\$(Platform)\obj\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<OutDir>$(SolutionDir)$(Configuration)\$(Platform)\</OutDir>
|
||||
<IntDir>$(Configuration)\$(Platform)\obj\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DLL Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<OutDir>$(SolutionDir)$(Configuration)\$(Platform)\</OutDir>
|
||||
<IntDir>$(Configuration)\$(Platform)\obj\</IntDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;WOLFSSL_USER_SETTINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>..;..\..\..;$(wolfCryptDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>wolfssl.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<IgnoreSpecificDefaultLibraries>msvcrt.lib</IgnoreSpecificDefaultLibraries>
|
||||
<AdditionalLibraryDirectories>$(wolfCryptDebug32)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DLL Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;WOLFSSL_USER_SETTINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>..;..\..\..;$(wolfCryptDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>wolfssl.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<IgnoreSpecificDefaultLibraries>msvcrt.lib</IgnoreSpecificDefaultLibraries>
|
||||
<AdditionalLibraryDirectories>$(wolfCryptDllDebug32)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;WOLFSSL_USER_SETTINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>..;..\..\..;$(wolfCryptDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>wolfssl.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<IgnoreSpecificDefaultLibraries>msvcrt.lib</IgnoreSpecificDefaultLibraries>
|
||||
<AdditionalLibraryDirectories>$(wolfCryptDebug64)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DLL Debug|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;WOLFSSL_USER_SETTINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>..;..\..\..;$(wolfCryptDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>wolfssl.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<IgnoreSpecificDefaultLibraries>msvcrt.lib</IgnoreSpecificDefaultLibraries>
|
||||
<AdditionalLibraryDirectories>$(wolfCryptDllDebug64)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;WOLFSSL_USER_SETTINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>..;..\..\..;$(wolfCryptDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>wolfssl.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalLibraryDirectories>$(wolfCryptRelease32)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DLL Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;WOLFSSL_USER_SETTINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>..;..\..\..;$(wolfCryptDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>wolfssl.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalLibraryDirectories>$(wolfCryptDllRelease32)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;WOLFSSL_USER_SETTINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>..;..\..\..;$(wolfCryptDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>wolfssl.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalLibraryDirectories>$(wolfCryptRelease64)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DLL Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;WOLFSSL_USER_SETTINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>..;..\..\..;$(wolfCryptDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>wolfssl.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalLibraryDirectories>$(wolfCryptDllRelease64)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DLL Debug|Win32'">
|
||||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||
<LocalDebuggerEnvironment>PATH=$(wolfCryptDllDebug32);%PATH%</LocalDebuggerEnvironment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DLL Debug|x64'">
|
||||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||
<LocalDebuggerEnvironment>PATH=$(wolfCryptDllDebug64);%PATH%</LocalDebuggerEnvironment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DLL Release|Win32'">
|
||||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||
<LocalDebuggerEnvironment>PATH=$(wolfCryptDllRelease32);%PATH%</LocalDebuggerEnvironment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DLL Release|x64'">
|
||||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||
<LocalDebuggerEnvironment>PATH=$(wolfCryptDllRelease64);%PATH%</LocalDebuggerEnvironment>
|
||||
</PropertyGroup>
|
||||
</Project>
|
|
@ -19,6 +19,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "client", "client\client.vcx
|
|||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testsuite", "testsuite\testsuite.vcxproj", "{BD09DA06-6D2E-4FB0-AE39-1BAE9FDAA9DD}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wolfsftp-client", "wolfsftp-client\wolfsftp-client.vcxproj", "{8DD810D6-159B-4C40-B682-FCA11F9B3680}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
|
@ -123,8 +125,27 @@ Global
|
|||
{BD09DA06-6D2E-4FB0-AE39-1BAE9FDAA9DD}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{BD09DA06-6D2E-4FB0-AE39-1BAE9FDAA9DD}.Release|Win32.Build.0 = Release|Win32
|
||||
{BD09DA06-6D2E-4FB0-AE39-1BAE9FDAA9DD}.Release|x64.ActiveCfg = Release|x64
|
||||
{8DD810D6-159B-4C40-B682-FCA11F9B3680}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{8DD810D6-159B-4C40-B682-FCA11F9B3680}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{8DD810D6-159B-4C40-B682-FCA11F9B3680}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{8DD810D6-159B-4C40-B682-FCA11F9B3680}.Debug|x64.Build.0 = Debug|x64
|
||||
{8DD810D6-159B-4C40-B682-FCA11F9B3680}.DLL Debug|Win32.ActiveCfg = DLL Debug|Win32
|
||||
{8DD810D6-159B-4C40-B682-FCA11F9B3680}.DLL Debug|Win32.Build.0 = DLL Debug|Win32
|
||||
{8DD810D6-159B-4C40-B682-FCA11F9B3680}.DLL Debug|x64.ActiveCfg = Debug|x64
|
||||
{8DD810D6-159B-4C40-B682-FCA11F9B3680}.DLL Debug|x64.Build.0 = Debug|x64
|
||||
{8DD810D6-159B-4C40-B682-FCA11F9B3680}.DLL Release|Win32.ActiveCfg = DLL Release|Win32
|
||||
{8DD810D6-159B-4C40-B682-FCA11F9B3680}.DLL Release|Win32.Build.0 = DLL Release|Win32
|
||||
{8DD810D6-159B-4C40-B682-FCA11F9B3680}.DLL Release|x64.ActiveCfg = Release|x64
|
||||
{8DD810D6-159B-4C40-B682-FCA11F9B3680}.DLL Release|x64.Build.0 = Release|x64
|
||||
{8DD810D6-159B-4C40-B682-FCA11F9B3680}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{8DD810D6-159B-4C40-B682-FCA11F9B3680}.Release|Win32.Build.0 = Release|Win32
|
||||
{8DD810D6-159B-4C40-B682-FCA11F9B3680}.Release|x64.ActiveCfg = Release|x64
|
||||
{8DD810D6-159B-4C40-B682-FCA11F9B3680}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {A0B37101-A4ED-4067-8240-E824A04F25C7}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
<ClCompile Include="..\..\..\src\memory.c" />
|
||||
<ClCompile Include="..\..\..\src\port.c" />
|
||||
<ClCompile Include="..\..\..\src\ssh.c" />
|
||||
<ClCompile Include="..\..\..\src\wolfsftp.c" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{7C2CCF0D-A155-4914-BD1C-9A47C0530E65}</ProjectGuid>
|
||||
|
|
|
@ -7330,7 +7330,7 @@ void clean_path(char* path)
|
|||
long sz = (long)WSTRLEN(path);
|
||||
byte found;
|
||||
|
||||
#ifdef WOLFSSL_NUCLEUS
|
||||
#if defined(WOLFSSL_NUCLEUS) || defined(USE_WINDOWS_API)
|
||||
for (i = 0; i < sz; i++) {
|
||||
if (path[i] == '/') path[i] = '\\';
|
||||
}
|
||||
|
@ -7358,9 +7358,9 @@ void clean_path(char* path)
|
|||
if (path != NULL) {
|
||||
/* go through path until no cases are found */
|
||||
do {
|
||||
sz = WSTRLEN(path);
|
||||
int prIdx = 0; /* begin of cut */
|
||||
int enIdx = 0; /* end of cut */
|
||||
sz = (long)WSTRLEN(path);
|
||||
|
||||
found = 0;
|
||||
for (i = 1; i < sz; i++) {
|
||||
|
@ -7400,8 +7400,8 @@ void clean_path(char* path)
|
|||
}
|
||||
} while (found);
|
||||
|
||||
#ifdef WOLFSSL_NUCLEUS
|
||||
sz = WSTRLEN(path);
|
||||
#if defined(WOLFSSL_NUCLEUS) || defined(USE_WINDOWS_API)
|
||||
sz = (long)WSTRLEN(path);
|
||||
|
||||
if (path[sz - 1] == ':') {
|
||||
path[sz] = WS_DELIM;
|
||||
|
@ -7411,7 +7411,7 @@ void clean_path(char* path)
|
|||
/* clean up any multiple drive listed i.e. A:/A: */
|
||||
{
|
||||
int i,j;
|
||||
sz = WSTRLEN(path);
|
||||
sz = (long)WSTRLEN(path);
|
||||
for (i = 0, j = 0; i < sz; i++) {
|
||||
if (path[i] == ':') {
|
||||
if (j == 0) j = i;
|
||||
|
@ -7427,7 +7427,7 @@ void clean_path(char* path)
|
|||
}
|
||||
|
||||
/* remove leading '/' for nucleus. Preserve case of single "/" */
|
||||
sz = WSTRLEN(path);
|
||||
sz = (long)WSTRLEN(path);
|
||||
while (sz > 2 && path[0] == WS_DELIM) {
|
||||
sz--;
|
||||
WMEMMOVE(path, path + 1, sz);
|
||||
|
|
60
src/port.c
60
src/port.c
|
@ -78,6 +78,45 @@ int wfopen(WFILE** f, const char* filename, const char* mode)
|
|||
return 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(USE_WINDOWS_API) && (defined(WOLFSSH_SFTP) || \
|
||||
defined(WOLFSSH_SCP)) && !defined(NO_WOLFSSH_SERVER)
|
||||
int wPwrite(WFD fd, unsigned char* buf, unsigned int sz, long ofst)
|
||||
{
|
||||
OVERLAPPED offset;
|
||||
DWORD bytesWritten;
|
||||
int ret;
|
||||
|
||||
WMEMSET(&offset, 0, sizeof(OVERLAPPED));
|
||||
offset.Offset = (DWORD)(ofst & 0xFFFFFFFF);
|
||||
offset.OffsetHigh = (DWORD)((ofst & 0xFFFFFFFF00000000) >> 32);
|
||||
if (WriteFile((HANDLE)_get_osfhandle(fd), buf, sz, &bytesWritten, &offset) != 0)
|
||||
ret = -1;
|
||||
else
|
||||
ret = (int)bytesWritten;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
int wPread(WFD fd, unsigned char* buf, unsigned int sz, long ofst)
|
||||
{
|
||||
OVERLAPPED offset;
|
||||
DWORD bytesRead;
|
||||
int ret;
|
||||
|
||||
WMEMSET(&offset, 0, sizeof(OVERLAPPED));
|
||||
offset.Offset = (DWORD)(ofst & 0xFFFFFFFF);
|
||||
offset.OffsetHigh = (DWORD)((ofst & 0xFFFFFFFF00000000) >> 32);
|
||||
if (ReadFile((HANDLE)_get_osfhandle(fd), buf, sz, &bytesRead, &offset) != 0)
|
||||
ret = -1;
|
||||
else
|
||||
ret = (int)bytesRead;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif /* USE_WINDOWS_API */
|
||||
#endif /* !NO_FILESYSTEM */
|
||||
|
||||
#ifndef WSTRING_USER
|
||||
|
@ -100,4 +139,25 @@ char* wstrnstr(const char* s1, const char* s2, unsigned int n)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/* Returns s1 if successful. Returns NULL if unsuccessful.
|
||||
* Copies the characters string s2 onto the end of s1. n is the size of the
|
||||
* buffer s1 is stored in. Returns NULL if s2 is too large to fit onto the
|
||||
* end of s1 including a null terminator. */
|
||||
char* wstrncat(char* s1, const char* s2, size_t n)
|
||||
{
|
||||
size_t freeSpace = n - strlen(s1) - 1;
|
||||
|
||||
if (freeSpace >= strlen(s2)) {
|
||||
#ifndef USE_WINDOWS_API
|
||||
strncat(s1, s2, freeSpace);
|
||||
#else
|
||||
strncat_s(s1, n, s2, freeSpace);
|
||||
#endif
|
||||
return s1;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#endif /* WSTRING_USER */
|
||||
|
|
|
@ -1651,8 +1651,8 @@ int wsScpRecvCallback(WOLFSSH* ssh, int state, const char* basePath,
|
|||
#ifdef WOLFSSL_NUCLEUS
|
||||
/* use absolute path */
|
||||
WSTRNCAT(abslut, (char*)basePath, WOLFSSH_MAX_FILENAME);
|
||||
WSTRNCAT(abslut, "/", sizeof("/"));
|
||||
WSTRNCAT(abslut, fileName, WSTRLEN(fileName));
|
||||
WSTRNCAT(abslut, "/", WOLFSSH_MAX_FILENAME);
|
||||
WSTRNCAT(abslut, fileName, WOLFSSH_MAX_FILENAME);
|
||||
clean_path(abslut);
|
||||
if (WFOPEN(&fp, abslut, "wb") != 0) {
|
||||
#else
|
||||
|
@ -1708,8 +1708,8 @@ int wsScpRecvCallback(WOLFSSH* ssh, int state, const char* basePath,
|
|||
#ifdef WOLFSSL_NUCLEUS
|
||||
/* get absolute path */
|
||||
WSTRNCAT(abslut, (char*)basePath, WOLFSSH_MAX_FILENAME);
|
||||
WSTRNCAT(abslut, "/", sizeof("/"));
|
||||
WSTRNCAT(abslut, fileName, WSTRLEN(fileName));
|
||||
WSTRNCAT(abslut, "/", WOLFSSH_MAX_FILENAME);
|
||||
WSTRNCAT(abslut, fileName, WOLFSSH_MAX_FILENAME);
|
||||
clean_path(abslut);
|
||||
if (WMKDIR(abslut, fileMode) != 0) {
|
||||
#else
|
||||
|
@ -2216,17 +2216,17 @@ int wsScpSendCallback(WOLFSSH* ssh, int state, const char* peerRequest,
|
|||
} else {
|
||||
WSTRNCPY(filePath, sendCtx->dirName,
|
||||
DEFAULT_SCP_FILE_NAME_SZ);
|
||||
WSTRNCAT(filePath, "/", 1);
|
||||
WSTRNCAT(filePath, "/", DEFAULT_SCP_FILE_NAME_SZ);
|
||||
|
||||
#ifdef WOLFSSL_NUCLEUS
|
||||
WSTRNCAT(filePath, sendCtx->currentDir->dir.lfname,
|
||||
DEFAULT_SCP_FILE_NAME_SZ - 1 - dirNameLen);
|
||||
DEFAULT_SCP_FILE_NAME_SZ);
|
||||
WSTRNCPY(fileName, sendCtx->currentDir->dir.lfname,
|
||||
DEFAULT_SCP_FILE_NAME_SZ);
|
||||
clean_path(filePath);
|
||||
#else
|
||||
WSTRNCAT(filePath, sendCtx->entry->d_name,
|
||||
DEFAULT_SCP_FILE_NAME_SZ - 1 - dirNameLen);
|
||||
DEFAULT_SCP_FILE_NAME_SZ);
|
||||
WSTRNCPY(fileName, sendCtx->entry->d_name,
|
||||
DEFAULT_SCP_FILE_NAME_SZ);
|
||||
#endif
|
||||
|
|
234
src/wolfsftp.c
234
src/wolfsftp.c
|
@ -22,7 +22,7 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
#include <wolfssh/wolfsftp.h>
|
||||
|
||||
#ifdef WOLFSSH_SFTP
|
||||
|
@ -356,8 +356,8 @@ static int wolfSSH_SFTP_RecvRealPath(WOLFSSH* ssh, int reqId, int maxSz)
|
|||
"Directory error", "English");
|
||||
return WS_BAD_FILE_E;
|
||||
}
|
||||
WSTRNCAT(wd, "/", sizeof("/"));
|
||||
WSTRNCAT(wd, r, WOLFSSH_MAX_FILENAME - 1);
|
||||
WSTRNCAT(wd, "/", WOLFSSH_MAX_FILENAME);
|
||||
WSTRNCAT(wd, r, WOLFSSH_MAX_FILENAME);
|
||||
WMEMCPY(r, wd, WOLFSSH_MAX_FILENAME);
|
||||
}
|
||||
|
||||
|
@ -523,10 +523,10 @@ int wolfSSH_SFTP_SendStatus(WOLFSSH* ssh, word32 status, word32 reqId,
|
|||
|
||||
maxSz = WOLFSSH_SFTP_HEADER + (UINT32_SZ * 3);
|
||||
if (reason != NULL) {
|
||||
maxSz += WSTRLEN(reason);
|
||||
maxSz += (word32)WSTRLEN(reason);
|
||||
}
|
||||
if (lang != NULL) {
|
||||
maxSz += WSTRLEN(lang);
|
||||
maxSz += (word32)WSTRLEN(lang);
|
||||
}
|
||||
|
||||
buf = (byte*)WMALLOC(maxSz, ssh->ctx->heap, DYNTYPE_BUFFER);
|
||||
|
@ -838,6 +838,8 @@ static word64 idCount = 0;
|
|||
/* @TODO add locking for thread safety */
|
||||
|
||||
|
||||
#ifndef USE_WINDOWS_API
|
||||
|
||||
/* Handles packet to open a directory
|
||||
*
|
||||
* returns WS_SUCCESS on success
|
||||
|
@ -943,6 +945,91 @@ int wolfSSH_SFTP_RecvOpenDir(WOLFSSH* ssh, int reqId, word32 maxSz)
|
|||
return WS_SUCCESS;
|
||||
}
|
||||
|
||||
#else /* USE_WINDOWS_API */
|
||||
|
||||
/* Handles packet to open a directory
|
||||
*
|
||||
* returns WS_SUCCESS on success
|
||||
*/
|
||||
int wolfSSH_SFTP_RecvOpenDir(WOLFSSH* ssh, int reqId, word32 maxSz)
|
||||
{
|
||||
word32 sz;
|
||||
byte* data;
|
||||
char* dirName;
|
||||
word32 idx = 0;
|
||||
HANDLE findHandle;
|
||||
WIN32_FIND_DATAA findData;
|
||||
|
||||
if (ssh == NULL) {
|
||||
return WS_BAD_ARGUMENT;
|
||||
}
|
||||
|
||||
WLOG(WS_LOG_SFTP, "Receiving WOLFSSH_FTP_OPENDIR");
|
||||
|
||||
data = (byte*)WMALLOC(maxSz, ssh->ctx->heap, DYNTYPE_BUFFER);
|
||||
if (data == NULL) {
|
||||
return WS_MEMORY_E;
|
||||
}
|
||||
wolfSSH_stream_read(ssh, data, maxSz);
|
||||
|
||||
/* get directory name */
|
||||
ato32(data + idx, &sz);
|
||||
idx += UINT32_SZ;
|
||||
if (sz + idx > maxSz) {
|
||||
WFREE(data, ssh->ctx->heap, DYNTYPE_BUFFER);
|
||||
return WS_BUFFER_E;
|
||||
}
|
||||
|
||||
/* plus one to make sure is null terminated */
|
||||
dirName = (char*)WMALLOC(sz + 1, ssh->ctx->heap, DYNTYPE_BUFFER);
|
||||
if (dirName == NULL) {
|
||||
WFREE(data, ssh->ctx->heap, DYNTYPE_BUFFER);
|
||||
return WS_MEMORY_E;
|
||||
}
|
||||
WMEMCPY(dirName, data + idx, sz);
|
||||
dirName[sz] = '\0';
|
||||
WFREE(data, ssh->ctx->heap, DYNTYPE_BUFFER);
|
||||
|
||||
clean_path(dirName);
|
||||
|
||||
/* get directory handle */
|
||||
findHandle = FindFirstFileA(dirName, &findData);
|
||||
if (findHandle == INVALID_HANDLE_VALUE ||
|
||||
!(findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {
|
||||
|
||||
WLOG(WS_LOG_SFTP, "Error with opening directory");
|
||||
WFREE(dirName, ssh->ctx->heap, DYNTYPE_BUFFER);
|
||||
|
||||
wolfSSH_SFTP_SendStatus(ssh, WOLFSSH_FTP_NOFILE, reqId,
|
||||
"Unable To Open Directory", "English");
|
||||
if (findHandle != INVALID_HANDLE_VALUE)
|
||||
FindClose(findHandle);
|
||||
return WS_BAD_FILE_E;
|
||||
}
|
||||
FindClose(findHandle);
|
||||
|
||||
/* add to directory list @TODO locking for thread safety */
|
||||
{
|
||||
DIR_HANDLE* cur = (DIR_HANDLE*)WMALLOC(sizeof(DIR_HANDLE),
|
||||
ssh->ctx->heap, DYNTYPE_SFTP);
|
||||
if (cur == NULL) {
|
||||
WFREE(dirName, ssh->ctx->heap, DYNTYPE_BUFFER);
|
||||
return WS_MEMORY_E;
|
||||
}
|
||||
cur->dir = INVALID_HANDLE_VALUE;
|
||||
cur->id = idCount++;
|
||||
cur->isEof = 0;
|
||||
cur->dirName = dirName; /* take over ownership of buffer */
|
||||
cur->next = dirList;
|
||||
dirList = cur;
|
||||
SendPacketType(ssh, WOLFSSH_FTP_HANDLE, (byte*)&cur->id,
|
||||
sizeof(word64));
|
||||
}
|
||||
|
||||
return WS_SUCCESS;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef WOLFSSL_NUCLEUS
|
||||
/* For Nucleus port
|
||||
|
@ -1020,7 +1107,7 @@ static int wolfSSH_SFTPNAME_readdir(WOLFSSH* ssh, WDIR* dir, WS_SFTPNAME* out,
|
|||
}
|
||||
buf[0] = '\0';
|
||||
if (!special) { /* do not add dir name in special case */
|
||||
WSTRNCAT(buf, dirName, bufSz);
|
||||
WSTRNCAT(buf, dirName, bufSz + 1);
|
||||
tmpSz = WSTRLEN(buf);
|
||||
|
||||
/* add delimiter between path and file/dir name */
|
||||
|
@ -1030,7 +1117,7 @@ static int wolfSSH_SFTPNAME_readdir(WOLFSSH* ssh, WDIR* dir, WS_SFTPNAME* out,
|
|||
}
|
||||
|
||||
}
|
||||
WSTRNCAT(buf, out->fName, bufSz);
|
||||
WSTRNCAT(buf, out->fName, bufSz + 1);
|
||||
|
||||
clean_path(buf);
|
||||
if (SFTP_GetAttributes(buf, &out->atrb, 0) != WS_SUCCESS) {
|
||||
|
@ -1045,6 +1132,99 @@ static int wolfSSH_SFTPNAME_readdir(WOLFSSH* ssh, WDIR* dir, WS_SFTPNAME* out,
|
|||
|
||||
return ret;
|
||||
}
|
||||
#elif defined(USE_WINDOWS_API)
|
||||
|
||||
/* helper function that gets file information from reading directory
|
||||
* @TODO allow user to override
|
||||
*
|
||||
* returns WS_SUCCESS on success
|
||||
*/
|
||||
static int wolfSSH_SFTPNAME_readdir(WOLFSSH* ssh, WDIR* dir, WS_SFTPNAME* out,
|
||||
char* dirName)
|
||||
{
|
||||
int sz;
|
||||
HANDLE findHandle;
|
||||
WIN32_FIND_DATAA findData;
|
||||
|
||||
if (dir == NULL || ssh == NULL || out == NULL) {
|
||||
return WS_BAD_ARGUMENT;
|
||||
}
|
||||
|
||||
if (*dir == INVALID_HANDLE_VALUE) {
|
||||
char name[MAX_PATH];
|
||||
word32 nameLen = (word32)WSTRLEN(dirName);
|
||||
|
||||
if (nameLen > MAX_PATH - 3) {
|
||||
WLOG(WS_LOG_DEBUG, "Path name is too long.");
|
||||
return WS_FATAL_ERROR;
|
||||
}
|
||||
WSTRNCPY(name, dirName, MAX_PATH);
|
||||
WSTRNCAT(name, "\\*", MAX_PATH);
|
||||
|
||||
findHandle = FindFirstFileA(name, &findData);
|
||||
|
||||
if (findHandle == INVALID_HANDLE_VALUE)
|
||||
return WS_FATAL_ERROR;
|
||||
else
|
||||
*dir = findHandle;
|
||||
}
|
||||
else {
|
||||
findHandle = *dir;
|
||||
if (FindNextFileA(findHandle, &findData) != 0)
|
||||
return WS_FATAL_ERROR;
|
||||
}
|
||||
|
||||
sz = (int)WSTRLEN(findData.cFileName);
|
||||
out->fName = (char*)WMALLOC(sz + 1, out->heap, DYNTYPE_SFTP);
|
||||
if (out->fName == NULL) {
|
||||
return WS_MEMORY_E;
|
||||
}
|
||||
out->lName = (char*)WMALLOC(sz + 1, out->heap, DYNTYPE_SFTP);
|
||||
if (out->lName == NULL) {
|
||||
WFREE(out->fName, out->heap, DYNTYPE_SFTP);
|
||||
return WS_MEMORY_E;
|
||||
}
|
||||
|
||||
WMEMCPY(out->fName, findData.cFileName, sz);
|
||||
WMEMCPY(out->lName, findData.cFileName, sz);
|
||||
out->fName[sz] = '\0';
|
||||
out->lName[sz] = '\0';
|
||||
out->fSz = sz;
|
||||
out->lSz = sz;
|
||||
|
||||
/* attempt to get file attributes. Could be directory or have none */
|
||||
{
|
||||
char* buf;
|
||||
int bufSz;
|
||||
int tmpSz;
|
||||
|
||||
bufSz = out->fSz + (int)WSTRLEN(dirName) + sizeof(WS_DELIM);
|
||||
buf = (char*)WMALLOC(bufSz + 1, out->heap, DYNTYPE_SFTP);
|
||||
if (buf == NULL) {
|
||||
return WS_MEMORY_E;
|
||||
}
|
||||
buf[0] = '\0';
|
||||
WSTRNCAT(buf, dirName, bufSz + 1);
|
||||
tmpSz = (int)WSTRLEN(buf);
|
||||
|
||||
/* add delimiter between path and file/dir name */
|
||||
if (tmpSz + 1 < bufSz) {
|
||||
buf[tmpSz] = WS_DELIM;
|
||||
buf[tmpSz + 1] = '\0';
|
||||
}
|
||||
WSTRNCAT(buf, out->fName, bufSz + 1);
|
||||
|
||||
clean_path(buf);
|
||||
if (SFTP_GetAttributes(buf, &out->atrb, 0) != WS_SUCCESS) {
|
||||
WLOG(WS_LOG_SFTP, "Unable to get attribute values for %s",
|
||||
out->fName);
|
||||
}
|
||||
WFREE(buf, out->heap, DYNTYPE_SFTP);
|
||||
}
|
||||
|
||||
return WS_SUCCESS;
|
||||
}
|
||||
|
||||
#else
|
||||
/* helper function that gets file information from reading directory
|
||||
* @TODO allow user to override
|
||||
|
@ -1096,7 +1276,7 @@ static int wolfSSH_SFTPNAME_readdir(WOLFSSH* ssh, WDIR* dir, WS_SFTPNAME* out,
|
|||
return WS_MEMORY_E;
|
||||
}
|
||||
buf[0] = '\0';
|
||||
WSTRNCAT(buf, dirName, bufSz);
|
||||
WSTRNCAT(buf, dirName, bufSz + 1);
|
||||
tmpSz = (int)WSTRLEN(buf);
|
||||
|
||||
/* add delimiter between path and file/dir name */
|
||||
|
@ -1104,7 +1284,7 @@ static int wolfSSH_SFTPNAME_readdir(WOLFSSH* ssh, WDIR* dir, WS_SFTPNAME* out,
|
|||
buf[tmpSz] = WS_DELIM;
|
||||
buf[tmpSz+1] = '\0';
|
||||
}
|
||||
WSTRNCAT(buf, out->fName, bufSz);
|
||||
WSTRNCAT(buf, out->fName, bufSz + 1);
|
||||
|
||||
clean_path(buf);
|
||||
if (SFTP_GetAttributes(buf, &out->atrb, 0) != WS_SUCCESS) {
|
||||
|
@ -1198,6 +1378,10 @@ int wolfSSH_SFTP_RecvReadDir(WOLFSSH* ssh, int reqId, word32 maxSz)
|
|||
|
||||
WLOG(WS_LOG_SFTP, "Receiving WOLFSSH_FTP_READDIR");
|
||||
|
||||
#ifdef USE_WINDOWS_API
|
||||
dir = INVALID_HANDLE_VALUE;
|
||||
#endif
|
||||
|
||||
data = (byte*)WMALLOC(maxSz, ssh->ctx->heap, DYNTYPE_BUFFER);
|
||||
if (data == NULL) {
|
||||
return WS_MEMORY_E;
|
||||
|
@ -1238,13 +1422,8 @@ int wolfSSH_SFTP_RecvReadDir(WOLFSSH* ssh, int reqId, word32 maxSz)
|
|||
count++;
|
||||
outSz += name->fSz + name->lSz + (UINT32_SZ * 2);
|
||||
outSz += SFTP_AtributesSz(ssh, &name->atrb);
|
||||
if (list != NULL) {
|
||||
name->next = list;
|
||||
list = name;
|
||||
}
|
||||
else {
|
||||
list = name;
|
||||
}
|
||||
name->next = list;
|
||||
list = name;
|
||||
}
|
||||
else {
|
||||
wolfSSH_SFTPNAME_free(name);
|
||||
|
@ -1297,7 +1476,6 @@ int wolfSSH_SFTP_RecvReadDir(WOLFSSH* ssh, int reqId, word32 maxSz)
|
|||
int wolfSSH_SFTP_RecvCloseDir(WOLFSSH* ssh, byte* handle, word32 handleSz)
|
||||
{
|
||||
DIR_HANDLE* cur = dirList;
|
||||
WDIR* dir = NULL;
|
||||
|
||||
if (ssh == NULL || handle == NULL || handleSz != sizeof(word64)) {
|
||||
return WS_BAD_ARGUMENT;
|
||||
|
@ -1308,7 +1486,6 @@ int wolfSSH_SFTP_RecvCloseDir(WOLFSSH* ssh, byte* handle, word32 handleSz)
|
|||
/* find DIR given handle */
|
||||
while (cur != NULL) {
|
||||
if (cur->id == *((word64*)handle)) {
|
||||
dir = &cur->dir;
|
||||
break;
|
||||
}
|
||||
cur = cur->next;
|
||||
|
@ -1318,7 +1495,11 @@ int wolfSSH_SFTP_RecvCloseDir(WOLFSSH* ssh, byte* handle, word32 handleSz)
|
|||
return WS_FATAL_ERROR;
|
||||
}
|
||||
|
||||
WCLOSEDIR(dir);
|
||||
#ifdef USE_WINDOWS_API
|
||||
FindClose(cur->dir);
|
||||
#else
|
||||
WCLOSEDIR(&cur->dir);
|
||||
#endif
|
||||
|
||||
/* remove directory from list */
|
||||
if (cur != NULL) {
|
||||
|
@ -1407,7 +1588,7 @@ int wolfSSH_SFTP_RecvWrite(WOLFSSH* ssh, int reqId, word32 maxSz)
|
|||
/* get length to be written */
|
||||
ato32(data + idx, &sz); idx += UINT32_SZ;
|
||||
|
||||
ret = (int)WPWRITE(fd, data + idx, sz, ofst);
|
||||
ret = (int)WPWRITE(fd, data + idx, sz, (long)ofst);
|
||||
WFREE(data, ssh->ctx->heap, DYNTYPE_BUFFER);
|
||||
if (ret < 0) {
|
||||
#if defined(WOLFSSL_NUCLEUS) && defined(DEBUG_WOLFSSH)
|
||||
|
@ -1481,7 +1662,7 @@ int wolfSSH_SFTP_RecvRead(WOLFSSH* ssh, int reqId, word32 maxSz)
|
|||
return WS_MEMORY_E;
|
||||
}
|
||||
|
||||
ret = (int)WPREAD(fd, data, sz, ofst);
|
||||
ret = (int)WPREAD(fd, data, sz, (long)ofst);
|
||||
if (ret < 0) {
|
||||
WLOG(WS_LOG_SFTP, "Error reading from file");
|
||||
WFREE(data, ssh->ctx->heap, DYNTYPE_BUFFER);
|
||||
|
@ -2021,9 +2202,10 @@ int SFTP_GetAttributes_Handle(WOLFSSH* ssh, byte* handle, int handleSz,
|
|||
*/
|
||||
int SFTP_GetAttributes(const char* fileName, WS_SFTP_FILEATRB* atr, byte link)
|
||||
{
|
||||
struct stat stats;
|
||||
WSTAT_T stats;
|
||||
|
||||
if (link) {
|
||||
/* Note, for windows, we treat WSTAT and WLSTAT the same. */
|
||||
if (WLSTAT(fileName, &stats) != 0) {
|
||||
return WS_BAD_FILE_E;
|
||||
}
|
||||
|
@ -3874,11 +4056,11 @@ int wolfSSH_SFTP_Rename(WOLFSSH* ssh, const char* old, const char* nw)
|
|||
/* add old name to the packet */
|
||||
idx = WOLFSSH_SFTP_HEADER;
|
||||
c32toa((word32)WSTRLEN(old), data + idx); idx += UINT32_SZ;
|
||||
WMEMCPY(data + idx, (byte*)old, WSTRLEN(old)); idx += WSTRLEN(old);
|
||||
WMEMCPY(data + idx, (byte*)old, WSTRLEN(old)); idx += (word32)WSTRLEN(old);
|
||||
|
||||
/* add new name to the packet */
|
||||
c32toa((word32)WSTRLEN(nw), data + idx); idx += UINT32_SZ;
|
||||
WMEMCPY(data + idx, (byte*)nw, WSTRLEN(nw)); idx += WSTRLEN(nw);
|
||||
WMEMCPY(data + idx, (byte*)nw, WSTRLEN(nw)); idx += (word32)WSTRLEN(nw);
|
||||
|
||||
/* send header and type specific data */
|
||||
ret = wolfSSH_stream_send(ssh, data, idx);
|
||||
|
@ -4162,7 +4344,7 @@ int wolfSSH_SFTP_Get(WOLFSSH* ssh, char* from,
|
|||
|
||||
/* if resuming then check for saved offset */
|
||||
if (resume) {
|
||||
gOfst = wolfSSH_SFTP_GetOfst(ssh, from, to);
|
||||
gOfst = (long)wolfSSH_SFTP_GetOfst(ssh, from, to);
|
||||
}
|
||||
|
||||
if (gOfst > 0) {
|
||||
|
@ -4237,7 +4419,7 @@ int wolfSSH_SFTP_Put(WOLFSSH* ssh, char* from, char* to, byte resume,
|
|||
|
||||
if (resume) {
|
||||
/* check if offset was stored */
|
||||
pOfst = wolfSSH_SFTP_GetOfst(ssh, from, to);
|
||||
pOfst = (long)wolfSSH_SFTP_GetOfst(ssh, from, to);
|
||||
}
|
||||
|
||||
/* open file and get handle */
|
||||
|
|
15
tests/api.c
15
tests/api.c
|
@ -212,10 +212,25 @@ static void test_wolfSSH_SCP_CB(void)
|
|||
}
|
||||
|
||||
|
||||
static void test_wstrcat(void)
|
||||
{
|
||||
#ifndef WSTRING_USER
|
||||
char dst[5];
|
||||
|
||||
WSTRNCPY(dst, "12", sizeof(dst));
|
||||
AssertNull(wstrncat(dst, "345", sizeof(dst)));
|
||||
AssertStrEQ(dst, "12");
|
||||
AssertNotNull(wstrncat(dst, "67", sizeof(dst)));
|
||||
AssertStrEQ(dst, "1267");
|
||||
#endif /* WSTRING_USER */
|
||||
}
|
||||
|
||||
|
||||
int main(void)
|
||||
{
|
||||
AssertIntEQ(wolfSSH_Init(), WS_SUCCESS);
|
||||
|
||||
test_wstrcat();
|
||||
test_wolfSSH_CTX_new();
|
||||
test_server_wolfSSH_new();
|
||||
test_client_wolfSSH_new();
|
||||
|
|
|
@ -29,6 +29,8 @@
|
|||
#include <termios.h>
|
||||
#endif
|
||||
|
||||
#ifdef WOLFSSH_SFTP
|
||||
|
||||
int doCmds(void);
|
||||
|
||||
|
||||
|
@ -904,6 +906,14 @@ THREAD_RETURN WOLFSSH_THREAD sftpclient_test(void* args)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
THREAD_RETURN WOLFSSH_THREAD sftpclient_test(void* args)
|
||||
{
|
||||
printf("Not compiled in!\nPlease recompile with WOLFSSH_SFTP or --enable-sftp");
|
||||
return -1;
|
||||
}
|
||||
#endif /* WOLFSSH_SFTP */
|
||||
|
||||
#ifndef NO_MAIN_DRIVER
|
||||
|
||||
|
|
|
@ -131,26 +131,36 @@ extern "C" {
|
|||
#define WREWIND(s) rewind((s))
|
||||
#define WSEEK_END SEEK_END
|
||||
#define WUTIMES(f,t) utimes((f),(t))
|
||||
#define WCHMOD(f,m) chmod((f),(m))
|
||||
|
||||
#ifndef USE_WINDOWS_API
|
||||
#define WCHMOD(f,m) chmod((f),(m))
|
||||
#else
|
||||
#define WCHMOD(f,m) _chmod((f),(m))
|
||||
#endif
|
||||
|
||||
#if (defined(WOLFSSH_SCP) || defined(WOLFSSH_SFTP)) && \
|
||||
!defined(WOLFSSH_SCP_USER_CALLBACKS) && \
|
||||
!defined(NO_FILESYSTEM)
|
||||
/* for chdir() */
|
||||
#include <unistd.h>
|
||||
/* for mkdir() */
|
||||
#include <sys/stat.h>
|
||||
#define WCHDIR(p) chdir((p))
|
||||
#define WMKDIR(p,m) mkdir((p),(m))
|
||||
!defined(WOLFSSH_SCP_USER_CALLBACKS)
|
||||
|
||||
#ifdef USE_WINDOWS_API
|
||||
#include <direct.h>
|
||||
#define WCHDIR(p) _chdir((p))
|
||||
#define WMKDIR(p,m) _mkdir((p))
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#include <sys/stat.h>
|
||||
#define WCHDIR(p) chdir((p))
|
||||
#define WMKDIR(p,m) mkdir((p),(m))
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif /* NO_FILESYSTEM */
|
||||
|
||||
/* setup string handling */
|
||||
#ifndef WSTRING_USER
|
||||
#include <string.h>
|
||||
|
||||
|
||||
WOLFSSH_API char* wstrnstr(const char*, const char*, unsigned int);
|
||||
WOLFSSH_API char* wstrncat(char*, const char*, size_t);
|
||||
|
||||
#define WMEMCPY(d,s,l) memcpy((d),(s),(l))
|
||||
#define WMEMSET(b,c,l) memset((b),(c),(l))
|
||||
|
@ -161,7 +171,7 @@ extern "C" {
|
|||
#define WSTRSTR(s1,s2) strstr((s1),(s2))
|
||||
#define WSTRNSTR(s1,s2,n) wstrnstr((s1),(s2),(n))
|
||||
#define WSTRNCMP(s1,s2,n) strncmp((s1),(s2),(n))
|
||||
#define WSTRNCAT(s1,s2,n) strncat((s1),(s2),(n))
|
||||
#define WSTRNCAT(s1,s2,n) wstrncat((s1),(s2),(n))
|
||||
#define WSTRSPN(s1,s2) strspn((s1),(s2))
|
||||
#define WSTRCSPN(s1,s2) strcspn((s1),(s2))
|
||||
|
||||
|
@ -201,6 +211,7 @@ extern "C" {
|
|||
#if (defined(WOLFSSH_SFTP) || defined(WOLFSSH_SCP)) && \
|
||||
!defined(NO_WOLFSSH_SERVER)
|
||||
#ifdef WOLFSSL_NUCLEUS
|
||||
#define WSTAT_T struct stat
|
||||
#define WRMDIR(d) (NU_Remove_Dir((d)) == NU_SUCCESS)?0:1
|
||||
#define WMKDIR(d,m) (NU_Make_Dir((d)) == NU_SUCCESS)?0:1
|
||||
#define WSTAT(p,b) NU_Get_First((b),(p))
|
||||
|
@ -411,12 +422,51 @@ extern "C" {
|
|||
#define WCLOSEDIR(d) NU_Done((d))
|
||||
#define WREADDIR(d) (NU_Get_Next((d)) == NU_SUCCESS)?(d):NULL
|
||||
#endif /* NO_WOLFSSH_DIR */
|
||||
#elif defined(USE_WINDOWS_API)
|
||||
|
||||
#include <windows.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <io.h>
|
||||
#include <direct.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#define WSTAT_T struct _stat
|
||||
#define WRMDIR(d) _rmdir((d))
|
||||
#define WSTAT(p,b) _stat((p),(b))
|
||||
#define WLSTAT(p,b) _stat((p),(b))
|
||||
#define WREMOVE(d) remove((d))
|
||||
#define WRENAME(o,n) rename((o),(n))
|
||||
#define WGETCWD(r,rSz) _getcwd((r),(rSz))
|
||||
#define WOPEN(f,m,p) _open((f),(m),(p))
|
||||
#define WCLOSE(fd) _close((fd))
|
||||
|
||||
#define WFD int
|
||||
int wPwrite(WFD, unsigned char*, unsigned int, long);
|
||||
int wPread(WFD, unsigned char*, unsigned int, long);
|
||||
#define WPWRITE(fd,b,s,o) wPwrite((fd),(b),(s),(o))
|
||||
#define WPREAD(fd,b,s,o) wPread((fd),(b),(s),(o))
|
||||
#define WS_DELIM '\\'
|
||||
|
||||
#define WOLFSSH_O_RDWR _O_RDWR
|
||||
#define WOLFSSH_O_RDONLY _O_RDONLY
|
||||
#define WOLFSSH_O_WRONLY _O_WRONLY
|
||||
#define WOLFSSH_O_APPEND _O_APPEND
|
||||
#define WOLFSSH_O_CREAT _O_CREAT
|
||||
#define WOLFSSH_O_TRUNC _O_TRUNC
|
||||
#define WOLFSSH_O_EXCL _O_EXCL
|
||||
|
||||
#ifndef NO_WOLFSSH_DIR
|
||||
#define WDIR HANDLE
|
||||
#endif /* NO_WOLFSSH_DIR */
|
||||
|
||||
#else
|
||||
#include <unistd.h> /* used for rmdir */
|
||||
#include <sys/stat.h> /* used for mkdir, stat, and lstat */
|
||||
#include <stdio.h> /* used for remove and rename */
|
||||
#include <dirent.h> /* used for opening directory and reading */
|
||||
|
||||
#define WSTAT_T struct stat
|
||||
#define WRMDIR(d) rmdir((d))
|
||||
#define WSTAT(p,b) stat((p),(b))
|
||||
#define WLSTAT(p,b) lstat((p),(b))
|
||||
|
|
|
@ -47,6 +47,7 @@ extern "C" {
|
|||
|
||||
#if defined (_WIN32)
|
||||
#define USE_WINDOWS_API
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
#endif
|
||||
|
||||
#ifdef WOLFSSL_NUCLEUS
|
||||
|
|
Loading…
Reference in New Issue