Firealarm

This commit is contained in:
Kenneth_aa_cp
2011-07-04 10:58:55 +00:00
parent 18b6eafaaa
commit 0a1aa984ec
7 changed files with 106 additions and 6 deletions
@@ -97,7 +97,7 @@ namespace Renci.SshNet.Tests.Properties {
}
/// <summary>
/// Looks up a localized string similar to oleg-centos.edc.renci.org.
/// Looks up a localized string similar to home.cabalsystems.com.
/// </summary>
internal static string HOST {
get {
@@ -132,7 +132,7 @@ namespace Renci.SshNet.Tests.Properties {
}
/// <summary>
/// Looks up a localized string similar to 22.
/// Looks up a localized string similar to 64622.
/// </summary>
internal static string PORT {
get {
@@ -149,7 +149,7 @@ D8DHbFwAT2mUv1QxRXYJO1y4pENboEzT6LUqxJgE+ae/F/29g2RD9DhtwqKqWjhM
-----END DSA PRIVATE KEY-----</value>
</data>
<data name="HOST" xml:space="preserve">
<value>oleg-centos.edc.renci.org</value>
<value>home.cabalsystems.com</value>
</data>
<data name="INVALID_KEY" xml:space="preserve">
<value>-----BEGIN DSA PRIVATE KEY-----
@@ -169,7 +169,7 @@ tM7dZpB+reWl9L5e2L8=
<value>tester</value>
</data>
<data name="PORT" xml:space="preserve">
<value>22</value>
<value>64622</value>
</data>
<data name="RSA_KEY_WITHOUT_PASS" xml:space="preserve">
<value>-----BEGIN RSA PRIVATE KEY-----
@@ -78,6 +78,7 @@ namespace Renci.SshNet
/// Initializes a new instance of the <see cref="BaseClient"/> class.
/// </summary>
/// <param name="connectionInfo">The connection info.</param>
/// <exception cref="ArgumentNullException"><paramref name="connectionInfo"/> is null.</exception>
public BaseClient(ConnectionInfo connectionInfo)
{
if (connectionInfo == null)
@@ -199,6 +199,9 @@ namespace Renci.SshNet
/// <param name="host">Connection host.</param>
/// <param name="port">Connection port.</param>
/// <param name="username">Connection username.</param>
/// <exception cref="ArgumentNullException"><paramref name="password"/> is null.</exception>
/// <exception cref="ArgumentException"><paramref name="host"/> is invalid, or <paramref name="username"/> is null or contains whitespace characters.</exception>
/// <exception cref="ArgumentOutOfRangeException"><paramref name="port"/> is not within <see cref="IPEndPoint.MinPort"/> and <see cref="IPEndPoint.MaxPort"/>.</exception>
protected ConnectionInfo(string host, int port, string username)
: this()
{
@@ -57,6 +57,9 @@ namespace Renci.SshNet
/// <param name="port">Connection port.</param>
/// <param name="username">Connection username.</param>
/// <param name="password">Connection password.</param>
/// <exception cref="ArgumentNullException"><paramref name="password"/> is null.</exception>
/// <exception cref="ArgumentException"><paramref name="host"/> is invalid, or <paramref name="username"/> is null or contains whitespace characters.</exception>
/// <exception cref="ArgumentOutOfRangeException"><paramref name="port"/> is not within <see cref="IPEndPoint.MinPort"/> and <see cref="IPEndPoint.MaxPort"/>.</exception>
public PasswordConnectionInfo(string host, int port, string username, string password)
: base(host, port, username)
{
+76 -2
View File
@@ -55,6 +55,7 @@ namespace Renci.SshNet
/// Initializes a new instance of the <see cref="SftpClient"/> class.
/// </summary>
/// <param name="connectionInfo">The connection info.</param>
/// <exception cref="ArgumentNullException"><paramref name="connectionInfo"/> is null.</exception>
public SftpClient(ConnectionInfo connectionInfo)
: base(connectionInfo)
{
@@ -69,6 +70,9 @@ namespace Renci.SshNet
/// <param name="port">Connection port.</param>
/// <param name="username">Authentication username.</param>
/// <param name="password">Authentication password.</param>
/// <exception cref="ArgumentNullException"><paramref name="password"/> is null.</exception>
/// <exception cref="ArgumentException"><paramref name="host"/> is invalid, or <paramref name="username"/> is null or contains whitespace characters.</exception>
/// <exception cref="ArgumentOutOfRangeException"><paramref name="port"/> is not within <see cref="System.Net.IPEndPoint.MinPort"/> and <see cref="System.Net.IPEndPoint.MaxPort"/>.</exception>
public SftpClient(string host, int port, string username, string password)
: this(new PasswordConnectionInfo(host, port, username, password))
{
@@ -80,6 +84,8 @@ namespace Renci.SshNet
/// <param name="host">Connection host.</param>
/// <param name="username">Authentication username.</param>
/// <param name="password">Authentication password.</param>
/// <exception cref="ArgumentNullException"><paramref name="password"/> is null.</exception>
/// <exception cref="ArgumentException"><paramref name="host"/> is invalid, or <paramref name="username"/> is null or contains whitespace characters.</exception>
public SftpClient(string host, string username, string password)
: this(host, 22, username, password)
{
@@ -92,6 +98,9 @@ namespace Renci.SshNet
/// <param name="port">Connection port.</param>
/// <param name="username">Authentication username.</param>
/// <param name="keyFiles">Authentication private key file(s) .</param>
/// <exception cref="ArgumentNullException"><paramref name="keyFiles"/> is null.</exception>
/// <exception cref="ArgumentException"><paramref name="host"/> is invalid, -or- <paramref name="username"/> is null or contains whitespace characters.</exception>
/// <exception cref="ArgumentOutOfRangeException"><paramref name="port"/> is not within <see cref="System.Net.IPEndPoint.MinPort"/> and <see cref="System.Net.IPEndPoint.MaxPort"/>.</exception>
public SftpClient(string host, int port, string username, params PrivateKeyFile[] keyFiles)
: this(new PrivateKeyConnectionInfo(host, port, username, keyFiles))
{
@@ -103,6 +112,8 @@ namespace Renci.SshNet
/// <param name="host">Connection host.</param>
/// <param name="username">Authentication username.</param>
/// <param name="keyFiles">Authentication private key file(s) .</param>
/// <exception cref="ArgumentNullException"><paramref name="keyFiles"/> is null.</exception>
/// <exception cref="ArgumentException"><paramref name="host"/> is invalid, -or- <paramref name="username"/> is null or contains whitespace characters.</exception>
public SftpClient(string host, string username, params PrivateKeyFile[] keyFiles)
: this(host, 22, username, keyFiles)
{
@@ -114,6 +125,11 @@ namespace Renci.SshNet
/// Changes remote directory to path.
/// </summary>
/// <param name="path">New directory path.</param>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is null.</exception>
/// <exception cref="SshConnectionException">Client is not connected.</exception>
/// <exception cref="SftpPermissionDeniedException">Permission to change directory denied by remote host -or- a SSH command was denied by the server.</exception>
/// <exception cref="SftpPathNotFoundException">The path in <paramref name="path"/> was not found on the remote host.</exception>
/// <exception cref="SshException">A SSH error where <see cref="SshException.Message"/> is the message from the remote host.</exception>
public void ChangeDirectory(string path)
{
if (path == null)
@@ -130,6 +146,11 @@ namespace Renci.SshNet
/// </summary>
/// <param name="path">File(s) path, may match multiple files.</param>
/// <param name="mode">The mode.</param>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is null.</exception>
/// <exception cref="SshConnectionException">Client is not connected.</exception>
/// <exception cref="SftpPermissionDeniedException">Permission to change permission on the path(s) was denied by the remote host -or- a SSH command was denied by the server.</exception>
/// <exception cref="SftpPathNotFoundException">The path in <paramref name="path"/> was not found on the remote host.</exception>
/// <exception cref="SshException">A SSH error where <see cref="SshException.Message"/> is the message from the remote host.</exception>
public void ChangePermissions(string path, short mode)
{
if (path == null)
@@ -147,8 +168,10 @@ namespace Renci.SshNet
/// Creates remote directory specified by path.
/// </summary>
/// <param name="path">Directory path to create.</param>
/// <exception cref="Renci.SshNet.Common.SftpPermissionDeniedException"></exception>
/// <exception cref="Renci.SshNet.Common.SshException"></exception>
/// <exception cref="ArgumentException"><paramref name="path"/> is null or contains whitespace characters.</exception>
/// <exception cref="SshConnectionException">Client is not connected.</exception>
/// <exception cref="Renci.SshNet.Common.SftpPermissionDeniedException">Permission to create the directory was denied by the remote host -or- a SSH command was denied by the server.</exception>
/// <exception cref="Renci.SshNet.Common.SshException">A SSH error where <see cref="SshException.Message"/> is the message from the remote host.</exception>
public void CreateDirectory(string path)
{
if (string.IsNullOrWhiteSpace(path))
@@ -166,6 +189,10 @@ namespace Renci.SshNet
/// Deletes remote directory specified by path.
/// </summary>
/// <param name="path">Directory to be deleted path.</param>
/// <exception cref="ArgumentException"><paramref name="path"/> is null or contains whitespace characters.</exception>
/// <exception cref="SshConnectionException">Client is not connected.</exception>
/// <exception cref="Renci.SshNet.Common.SftpPermissionDeniedException">Permission to delete the directory was denied by the remote host -or- a SSH command was denied by the server.</exception>
/// <exception cref="Renci.SshNet.Common.SshException">A SSH error where <see cref="SshException.Message"/> is the message from the remote host.</exception>
public void DeleteDirectory(string path)
{
if (string.IsNullOrWhiteSpace(path))
@@ -183,6 +210,10 @@ namespace Renci.SshNet
/// Deletes remote file specified by path.
/// </summary>
/// <param name="path">File to be deleted path.</param>
/// <exception cref="ArgumentException"><paramref name="path"/> is null or contains whitespace characters.</exception>
/// <exception cref="SshConnectionException">Client is not connected.</exception>
/// <exception cref="Renci.SshNet.Common.SftpPermissionDeniedException">Permission to delete the file was denied by the remote host -or- a SSH command was denied by the server.</exception>
/// <exception cref="Renci.SshNet.Common.SshException">A SSH error where <see cref="SshException.Message"/> is the message from the remote host.</exception>
public void DeleteFile(string path)
{
if (string.IsNullOrWhiteSpace(path))
@@ -201,6 +232,10 @@ namespace Renci.SshNet
/// </summary>
/// <param name="oldPath">Path to the old file location.</param>
/// <param name="newPath">Path to the new file location.</param>
/// <exception cref="ArgumentNullException"><paramref name="oldPath"/> or <paramref name="newPath"/> is null.</exception>
/// <exception cref="SshConnectionException">Client is not connected.</exception>
/// <exception cref="Renci.SshNet.Common.SftpPermissionDeniedException">Permission to rename the file was denied by the remote host -or- a SSH command was denied by the server.</exception>
/// <exception cref="Renci.SshNet.Common.SshException">A SSH error where <see cref="SshException.Message"/> is the message from the remote host.</exception>
public void RenameFile(string oldPath, string newPath)
{
if (oldPath == null)
@@ -224,6 +259,10 @@ namespace Renci.SshNet
/// </summary>
/// <param name="path">The old path.</param>
/// <param name="linkPath">The new path.</param>
/// <exception cref="ArgumentException"><paramref name="path"/> or <paramref name="linkedpath"/> is null or contains whitespace characters.</exception>
/// <exception cref="SshConnectionException">Client is not connected.</exception>
/// <exception cref="Renci.SshNet.Common.SftpPermissionDeniedException">Permission to create the symbolic link was denied by the remote host -or- a SSH command was denied by the server.</exception>
/// <exception cref="Renci.SshNet.Common.SshException">A SSH error where <see cref="SshException.Message"/> is the message from the remote host.</exception>
public void SymbolicLink(string path, string linkPath)
{
if (string.IsNullOrWhiteSpace(path))
@@ -247,6 +286,10 @@ namespace Renci.SshNet
/// </summary>
/// <param name="path">The path.</param>
/// <returns>List of directory entries</returns>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is null.</exception>
/// <exception cref="SshConnectionException">Client is not connected.</exception>
/// <exception cref="Renci.SshNet.Common.SftpPermissionDeniedException">Permission to list the contents of the directory was denied by the remote host -or- a SSH command was denied by the server.</exception>
/// <exception cref="Renci.SshNet.Common.SshException">A SSH error where <see cref="SshException.Message"/> is the message from the remote host.</exception>
public IEnumerable<SftpFile> ListDirectory(string path)
{
return InternalListDirectory(path, null);
@@ -305,6 +348,7 @@ namespace Renci.SshNet
/// </summary>
/// <param name="path">The path.</param>
/// <returns></returns>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is null.</exception>
public SftpFile Get(string path)
{
if (path == null)
@@ -322,6 +366,10 @@ namespace Renci.SshNet
/// </summary>
/// <param name="path">The path.</param>
/// <returns><c>true</c> if directory or file exists; otherwise <c>false</c>.</returns>
/// <exception cref="ArgumentException"><paramref name="path"/> is null or contains whitespace characters.</exception>
/// <exception cref="SshConnectionException">Client is not connected.</exception>
/// <exception cref="Renci.SshNet.Common.SftpPermissionDeniedException">Permission to perform the operation was denied by the remote host -or- a SSH command was denied by the server.</exception>
/// <exception cref="Renci.SshNet.Common.SshException">A SSH error where <see cref="SshException.Message"/> is the message from the remote host.</exception>
public bool Exists(string path)
{
if (string.IsNullOrWhiteSpace(path))
@@ -356,6 +404,12 @@ namespace Renci.SshNet
/// </summary>
/// <param name="path">File to download.</param>
/// <param name="output">Stream to write the file into.</param>
/// <exception cref="ArgumentNullException"><paramref name="output"/> is null.</exception>
/// <exception cref="ArgumentException"><paramref name="path"/> is null or contains whitespace characters.</exception>
/// <exception cref="SshConnectionException">Client is not connected.</exception>
/// <exception cref="Renci.SshNet.Common.SftpPermissionDeniedException">Permission to perform the operation was denied by the remote host -or- a SSH command was denied by the server.</exception>
/// <exception cref="Renci.SshNet.Common.SshException">A SSH error where <see cref="SshException.Message"/> is the message from the remote host.</exception>
/// <remarks>Method calls made by this method to <paramref name="output"/>, may under certain conditions result in exceptions thrown by the stream.</remarks>
public void DownloadFile(string path, Stream output)
{
this.InternalDownloadFile(path, output, null);
@@ -369,6 +423,12 @@ namespace Renci.SshNet
/// <param name="asyncCallback">The method to be called when the asynchronous write operation is completed.</param>
/// <param name="state">A user-provided object that distinguishes this particular asynchronous write request from other requests.</param>
/// <returns>An <see cref="IAsyncResult"/> that references the asynchronous operation.</returns>
/// <exception cref="ArgumentNullException"><paramref name="output"/> is null.</exception>
/// <exception cref="ArgumentException"><paramref name="path"/> is null or contains whitespace characters.</exception>
/// <exception cref="SshConnectionException">Client is not connected.</exception>
/// <exception cref="Renci.SshNet.Common.SftpPermissionDeniedException">Permission to perform the operation was denied by the remote host -or- a SSH command was denied by the server.</exception>
/// <exception cref="Renci.SshNet.Common.SshException">A SSH error where <see cref="SshException.Message"/> is the message from the remote host.</exception>
/// <remarks>Method calls made by this method to <paramref name="output"/>, may under certain conditions result in exceptions thrown by the stream.</remarks>
public IAsyncResult BeginDownloadFile(string path, Stream output, AsyncCallback asyncCallback, object state)
{
if (string.IsNullOrWhiteSpace(path))
@@ -403,6 +463,7 @@ namespace Renci.SshNet
/// Ends an asynchronous file downloading into the stream.
/// </summary>
/// <param name="asyncResult">The pending asynchronous SFTP request.</param>
/// <exception cref="ArgumentException">Either the IAsyncResult object (<paramref name="asyncResult"/>) did not come from the corresponding async method on this type, or EndExecute was called multiple times with the same IAsyncResult.</exception>
public void EndDownloadFile(IAsyncResult asyncResult)
{
var ar = asyncResult as SftpDownloadAsyncResult;
@@ -419,6 +480,12 @@ namespace Renci.SshNet
/// </summary>
/// <param name="input">Data input stream.</param>
/// <param name="path">Remote file path.</param>
/// <exception cref="ArgumentNullException"><paramref name="input"/> is null.</exception>
/// <exception cref="ArgumentException"><paramref name="path"/> is null or contains whitespace characters.</exception>
/// <exception cref="SshConnectionException">Client is not connected.</exception>
/// <exception cref="Renci.SshNet.Common.SftpPermissionDeniedException">Permission to upload the file was denied by the remote host -or- a SSH command was denied by the server.</exception>
/// <exception cref="Renci.SshNet.Common.SshException">A SSH error where <see cref="SshException.Message"/> is the message from the remote host.</exception>
/// <remarks>Method calls made by this method to <paramref name="input"/>, may under certain conditions result in exceptions thrown by the stream.</remarks>
public void UploadFile(Stream input, string path)
{
this.InternalUploadFile(input, path, null);
@@ -432,6 +499,12 @@ namespace Renci.SshNet
/// <param name="asyncCallback">The method to be called when the asynchronous write operation is completed.</param>
/// <param name="state">A user-provided object that distinguishes this particular asynchronous write request from other requests.</param>
/// <returns>An <see cref="IAsyncResult"/> that references the asynchronous operation.</returns>
/// <exception cref="ArgumentNullException"><paramref name="input"/> is null.</exception>
/// <exception cref="ArgumentException"><paramref name="path"/> is null or contains whitespace characters.</exception>
/// <exception cref="SshConnectionException">Client is not connected.</exception>
/// <exception cref="Renci.SshNet.Common.SftpPermissionDeniedException">Permission to list the contents of the directory was denied by the remote host -or- a SSH command was denied by the server.</exception>
/// <exception cref="Renci.SshNet.Common.SshException">A SSH error where <see cref="SshException.Message"/> is the message from the remote host.</exception>
/// <remarks>Method calls made by this method to <paramref name="input"/>, may under certain conditions result in exceptions thrown by the stream.</remarks>
public IAsyncResult BeginUploadFile(Stream input, string path, AsyncCallback asyncCallback, object state)
{
if (input == null)
@@ -466,6 +539,7 @@ namespace Renci.SshNet
/// Ends an asynchronous uploading the steam into remote file.
/// </summary>
/// <param name="asyncResult">The pending asynchronous SFTP request.</param>
/// <exception cref="ArgumentException">Either the IAsyncResult object (<paramref name="asyncResult"/>) did not come from the corresponding async method on this type, or EndExecute was called multiple times with the same IAsyncResult.</exception>
public void EndUploadFile(IAsyncResult asyncResult)
{
var ar = asyncResult as SftpUploadAsyncResult;
+19
View File
@@ -33,6 +33,7 @@ namespace Renci.SshNet
/// Initializes a new instance of the <see cref="SshClient"/> class.
/// </summary>
/// <param name="connectionInfo">The connection info.</param>
/// <exception cref="ArgumentNullException"><paramref name="connectionInfo"/> is null.</exception>
public SshClient(ConnectionInfo connectionInfo)
: base(connectionInfo)
{
@@ -45,6 +46,9 @@ namespace Renci.SshNet
/// <param name="port">Connection port.</param>
/// <param name="username">Authentication username.</param>
/// <param name="password">Authentication password.</param>
/// <exception cref="ArgumentNullException"><paramref name="password"/> is null.</exception>
/// <exception cref="ArgumentException"><paramref name="host"/> is invalid, or <paramref name="username"/> is null or contains whitespace characters.</exception>
/// <exception cref="ArgumentOutOfRangeException"><paramref name="port"/> is not within <see cref="System.Net.IPEndPoint.MinPort"/> and <see cref="System.Net.IPEndPoint.MaxPort"/>.</exception>
public SshClient(string host, int port, string username, string password)
: this(new PasswordConnectionInfo(host, port, username, password))
{
@@ -56,6 +60,8 @@ namespace Renci.SshNet
/// <param name="host">Connection host.</param>
/// <param name="username">Authentication username.</param>
/// <param name="password">Authentication password.</param>
/// <exception cref="ArgumentNullException"><paramref name="password"/> is null.</exception>
/// <exception cref="ArgumentException"><paramref name="host"/> is invalid, or <paramref name="username"/> is null or contains whitespace characters.</exception>
public SshClient(string host, string username, string password)
: this(host, 22, username, password)
{
@@ -68,6 +74,9 @@ namespace Renci.SshNet
/// <param name="port">Connection port.</param>
/// <param name="username">Authentication username.</param>
/// <param name="keyFiles">Authentication private key file(s) .</param>
/// <exception cref="ArgumentNullException"><paramref name="keyFiles"/> is null.</exception>
/// <exception cref="ArgumentException"><paramref name="host"/> is invalid, -or- <paramref name="username"/> is null or contains whitespace characters.</exception>
/// <exception cref="ArgumentOutOfRangeException"><paramref name="port"/> is not within <see cref="System.Net.IPEndPoint.MinPort"/> and <see cref="System.Net.IPEndPoint.MaxPort"/>.</exception>
public SshClient(string host, int port, string username, params PrivateKeyFile[] keyFiles)
: this(new PrivateKeyConnectionInfo(host, port, username, keyFiles))
{
@@ -79,6 +88,8 @@ namespace Renci.SshNet
/// <param name="host">Connection host.</param>
/// <param name="username">Authentication username.</param>
/// <param name="keyFiles">Authentication private key file(s) .</param>
/// <exception cref="ArgumentNullException"><paramref name="keyFiles"/> is null.</exception>
/// <exception cref="ArgumentException"><paramref name="host"/> is invalid, -or- <paramref name="username"/> is null or contains whitespace characters.</exception>
public SshClient(string host, string username, params PrivateKeyFile[] keyFiles)
: this(host, 22, username, keyFiles)
{
@@ -110,6 +121,10 @@ namespace Renci.SshNet
/// <returns>
/// Forwarded port
/// </returns>
/// <exception cref="ArgumentNullException"><paramref name="boundHost"/> or <paramref name="connectedHost"/> is null.</exception>
/// <exception cref="ArgumentException"><paramref name="boundHost"/> or <paramref name="connectedHost"/> is invalid.</exception>
/// <exception cref="ArgumentOutOfRangeException"><paramref name="boundPort"/> or <paramref name="connectedPort"/> is not within <see cref="System.Net.IPEndPoint.MinPort"/> and <see cref="System.Net.IPEndPoint.MaxPort"/>.</exception>
/// <exception cref="SshConnectionException">Client is not connected.</exception>
public T AddForwardedPort<T>(string boundHost, uint boundPort, string connectedHost, uint connectedPort) where T : ForwardedPort, new()
{
if (boundHost == null)
@@ -154,6 +169,10 @@ namespace Renci.SshNet
/// <param name="connectedHost">The connected host.</param>
/// <param name="connectedPort">The connected port.</param>
/// <returns></returns>
/// <exception cref="ArgumentNullException"><paramref name="boundHost"/> or <paramref name="connectedHost"/> is null.</exception>
/// <exception cref="ArgumentException"><paramref name="boundHost"/> or <paramref name="connectedHost"/> is invalid.</exception>
/// <exception cref="ArgumentOutOfRangeException"><paramref name="boundPort"/> or <paramref name="connectedPort"/> is not within <see cref="System.Net.IPEndPoint.MinPort"/> and <see cref="System.Net.IPEndPoint.MaxPort"/>.</exception>
/// <exception cref="SshConnectionException">Client is not connected.</exception>
public T AddForwardedPort<T>(uint boundPort, string connectedHost, uint connectedPort) where T : ForwardedPort, new()
{
return this.AddForwardedPort<T>("localhost", boundPort, connectedHost, connectedPort);