Skip to content
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

Remove old target frameworks #10

Merged
merged 4 commits into from
May 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion docker/DockerFile
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@ COPY --chown=root:root server/ssh /etc/ssh/
COPY --chown=root:root server/script /opt/sshnet
COPY --chown=sshnet:sshnet user/sshnet /home/sshnet/.ssh

RUN apk add --no-cache syslog-ng && \
RUN apk update && apk upgrade --no-cache && \
apk add --no-cache syslog-ng && \
# install and configure sshd
apk add --no-cache openssh && \
# install openssh-server-pam to allow for keyboard-interactive authentication
apk add --no-cache openssh-server-pam && \
# make sure scripts and keys have unix (LF) line endings
dos2unix /etc/ssh/* && \
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without this line, tests did not work. Don't ask how long it took me :)

Copy link
Member

@drieseng drieseng May 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I won't :p

I created them locally with LF and haven't cloned the repo since, which probably explains why they still have LF line endings here.

You may want to add a comment though (on all three dos2unix commands):

# make sure scripts and keys have unix (LF) line endings

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added comments.

Now I think that it is very difficult to detect and maybe it would be worth adding a check in the library and showing a comment. Of course in other PR.

chmod 400 /etc/ssh/ssh*key && \
sed -i 's/#PasswordAuthentication yes/PasswordAuthentication yes/' /etc/ssh/sshd_config && \
sed -i 's/#LogLevel\s*INFO/LogLevel DEBUG3/' /etc/ssh/sshd_config && \
Expand All @@ -25,6 +28,7 @@ RUN apk add --no-cache syslog-ng && \
adduser -D sshnet && \
passwd -u sshnet && \
echo 'sshnet:ssh4ever' | chpasswd && \
# make sure scripts and keys have unix (LF) line endings
dos2unix /home/sshnet/.ssh/* && \
chown -R sshnet:sshnet /home/sshnet && \
chmod -R 700 /home/sshnet/.ssh && \
Expand All @@ -34,6 +38,7 @@ RUN apk add --no-cache syslog-ng && \
passwd -u sshnetadm && \
echo 'sshnetadm:ssh4ever' | chpasswd && \
addgroup sshnetadm sudo && \
# make sure scripts and keys have unix (LF) line endings
dos2unix /opt/sshnet/* && \
# install shadow package; we use chage command in this package to expire/unexpire password of the sshnet user
apk add --no-cache shadow && \
Expand Down
3 changes: 2 additions & 1 deletion src/SshNetBenchmarks/SshNetBenchmarks.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@

<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.13.1" />
<PackageReference Include="SSH.NET" Version="2020.0.1" />
<PackageReference Include="SSH.NET" Version="2020.0.2" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\SshNetTests\SshNetTests.csproj" />
<!-- <ProjectReference Include="..\..\..\SSH.NET\src\Renci.SshNet\Renci.SshNet.csproj" /> -->
</ItemGroup>

</Project>
7 changes: 6 additions & 1 deletion src/SshNetTests/Common/AsyncSocketListener.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,14 @@ private void AcceptCallback(IAsyncResult ar)
var state = new SocketStateObject(handler);
handler.BeginReceive(state.Buffer, 0, state.Buffer.Length, 0, ReadCallback, state);
}
catch (SocketException)
{
// when the socket is closed, an SocketException is thrown since .NET 5
// by Socket.EndAccept(IAsyncResult)
}
catch (ObjectDisposedException)
{
// when the socket is closed, an ObjectDisposedException is thrown
// when the socket is closed, an ObjectDisposedException is thrown on old .NET Framework
// by Socket.EndAccept(IAsyncResult)
}
}
Expand Down
9 changes: 5 additions & 4 deletions src/SshNetTests/SshNetTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFrameworks>net45;netcoreapp2.1;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>net472;net7.0</TargetFrameworks>
<AutoGenerateBindingRedirects>false</AutoGenerateBindingRedirects>
<IsTestProject>true</IsTestProject>
</PropertyGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == 'netcoreapp2.1' or '$(TargetFramework)' == 'netcoreapp3.1' ">
<PropertyGroup Condition=" '$(TargetFramework)' == 'net7.0' ">
<DefineConstants>TRACE;FEATURE_MSTEST_DATATEST;FEATURE_SOCKET_EAP;FEATURE_ENCODING_ASCII;FEATURE_THREAD_SLEEP;FEATURE_THREAD_THREADPOOL</DefineConstants>
</PropertyGroup>

Expand All @@ -28,16 +28,17 @@
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
<PackageReference Include="MSTest.TestAdapter" Version="2.1.0" />
<PackageReference Include="MSTest.TestFramework" Version="2.1.0" />
<PackageReference Include="SSH.NET" Version="2020.0.1" />
<PackageReference Include="SSH.NET" Version="2020.0.2" />
<PackageReference Include="System.Management" Version="4.7.0" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net40' or '$(TargetFramework)' == 'net45' ">
<ItemGroup Condition=" '$(TargetFramework)' == 'net472' ">
<PackageReference Include="Tamir.SharpSSH" Version="1.1.1.13" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\SSH.NET-TestTools\src\SshNet.TestTools.OpenSSH\SshNet.TestTools.OpenSSH.csproj" />
<!-- <ProjectReference Include="..\..\..\SSH.NET\src\Renci.SshNet\Renci.SshNet.csproj" /> -->
</ItemGroup>

<ItemGroup>
Expand Down