Bump version to 2.0
This commit is contained in:
parent
844a8e38bb
commit
1ee979413f
|
@ -19,7 +19,7 @@ using System;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
[assembly:AssemblyTitle ("SparkleLib")]
|
[assembly:AssemblyTitle ("SparkleLib")]
|
||||||
[assembly:AssemblyVersion ("1.5.0")]
|
[assembly:AssemblyVersion ("2.0")]
|
||||||
[assembly:AssemblyCopyright ("Copyright (c) 2010 Hylke Bons and others")]
|
[assembly:AssemblyCopyright ("Copyright (c) 2010 Hylke Bons and others")]
|
||||||
|
|
||||||
namespace SparkleLib {
|
namespace SparkleLib {
|
||||||
|
|
124
SparkleLib/SSHAuthenticationInfo.cs
Normal file
124
SparkleLib/SSHAuthenticationInfo.cs
Normal file
|
@ -0,0 +1,124 @@
|
||||||
|
// SparkleShare, a collaboration and sharing tool.
|
||||||
|
// Copyright (C) 2010 Hylke Bons <hylkebons@gmail.com>
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU Lesser General Public License as
|
||||||
|
// published by the Free Software Foundation, either version 3 of the
|
||||||
|
// License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using System.Net;
|
||||||
|
|
||||||
|
using IO = System.IO;
|
||||||
|
|
||||||
|
namespace SparkleLib {
|
||||||
|
|
||||||
|
public class SSHAuthenticationInfo : AuthenticationInfo {
|
||||||
|
|
||||||
|
public string PrivateKeyFilePath;
|
||||||
|
public string PrivateKey;
|
||||||
|
|
||||||
|
public string PublicKeyFilePath;
|
||||||
|
public string PublicKey;
|
||||||
|
|
||||||
|
public string KnownHostsFilePath;
|
||||||
|
|
||||||
|
string Path;
|
||||||
|
|
||||||
|
|
||||||
|
public SSHAuthenticationInfo ()
|
||||||
|
{
|
||||||
|
string config_path = IO.Path.GetDirectoryName (SparkleConfig.DefaultConfig.FullPath);
|
||||||
|
Path = IO.Path.Combine (config_path, "ssh");
|
||||||
|
|
||||||
|
KnownHostsFilePath = IO.Path.Combine (Path, "known_hosts");
|
||||||
|
|
||||||
|
if (!IO.Directory.Exists (Path)) {
|
||||||
|
IO.Directory.CreateDirectory (Path);
|
||||||
|
CreateKeyPair ();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
foreach (string file_path in IO.Directory.GetFiles (Path)) {
|
||||||
|
if (file_path.EndsWith (".key")) {
|
||||||
|
PrivateKeyFilePath = file_path;
|
||||||
|
PrivateKey = IO.File.ReadAllText (file_path);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (file_path.EndsWith (".key.pub")) {
|
||||||
|
PublicKeyFilePath = file_path;
|
||||||
|
PublicKey = IO.File.ReadAllText (file_path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool CreateKeyPair ()
|
||||||
|
{
|
||||||
|
string key_file_name = DateTime.Now.ToString ("yyyy-MM-dd_HH\\hmm") + ".key";
|
||||||
|
string key_file_path = IO.Path.Combine (Path, key_file_name);
|
||||||
|
string computer_name = Dns.GetHostName ();
|
||||||
|
|
||||||
|
if (computer_name.EndsWith (".local"))
|
||||||
|
computer_name = computer_name.Substring (0, computer_name.Length - ".local".Length);
|
||||||
|
|
||||||
|
string arguments =
|
||||||
|
"-t rsa " + // Crypto type
|
||||||
|
"-b 4096 " + // Key size
|
||||||
|
"-P \"\" " + // No password
|
||||||
|
"-C \"" + computer_name + " (SparkleShare)\" " + // Key comment
|
||||||
|
"-f \"" + key_file_name + "\"";
|
||||||
|
|
||||||
|
var process = new SparkleProcess ("ssh-keygen", arguments);
|
||||||
|
process.StartInfo.WorkingDirectory = Path;
|
||||||
|
|
||||||
|
process.Start ();
|
||||||
|
process.WaitForExit ();
|
||||||
|
|
||||||
|
if (process.ExitCode == 0) {
|
||||||
|
Properties ["PrivateKeyFilePath"] = key_file_path;
|
||||||
|
Properties ["PrivateKey"] = IO.File.ReadAllText (key_file_path);
|
||||||
|
|
||||||
|
Properties ["PublicKeyFilePath"] = key_file_path + ".pub";
|
||||||
|
Properties ["PublicKey"] = IO.File.ReadAllText (key_file_path + ".pub");
|
||||||
|
|
||||||
|
SparkleLogger.LogInfo ("Auth", "Created key pair: " + key_file_name);
|
||||||
|
return true;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
SparkleLogger.LogInfo ("Auth", "Could not create key pair");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void StartKeyAgent ()
|
||||||
|
{
|
||||||
|
Process [] processes = Process.GetProcessesByName ("ssh-agent");
|
||||||
|
|
||||||
|
if (processes.Length > 1)
|
||||||
|
return;
|
||||||
|
|
||||||
|
SparkleLogger.LogInfo ("Auth", "No key agent running, starting one...");
|
||||||
|
|
||||||
|
SparkleProcess process = new SparkleProcess ("ssh-agent", "");
|
||||||
|
string output = process.StartAndReadStandardOutput ();
|
||||||
|
|
||||||
|
Match auth_sock_match = new Regex (@"SSH_AUTH_SOCK=([^;\n\r]*)").Match (output);
|
||||||
|
|
||||||
|
if (auth_sock_match.Success)
|
||||||
|
Environment.SetEnvironmentVariable ("SSH_AUTH_SOCK", auth_sock_match.Groups [1].Value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -9,9 +9,9 @@
|
||||||
<key>CFBundleName</key>
|
<key>CFBundleName</key>
|
||||||
<string>SparkleShare</string>
|
<string>SparkleShare</string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>1.5.0</string>
|
<string>2.0</string>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>1.5.0</string>
|
<string>2.0</string>
|
||||||
<key>LSApplicationCategoryType</key>
|
<key>LSApplicationCategoryType</key>
|
||||||
<string>public.app-category.productivity</string>
|
<string>public.app-category.productivity</string>
|
||||||
<key>LSMinimumSystemVersion</key>
|
<key>LSMinimumSystemVersion</key>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi' xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
|
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi' xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
|
||||||
|
|
||||||
<Product Name='SparkleShare' Id='184950D5-67F6-4D06-9717-7E2F1607A7B0' UpgradeCode='D3DF1D99-87F5-47A7-A349-863DD6E4B73A'
|
<Product Name='SparkleShare' Id='184950D5-67F6-4D06-9717-7E2F1607A7B0' UpgradeCode='D3DF1D99-87F5-47A7-A349-863DD6E4B73A'
|
||||||
Language='1033' Codepage='1252' Version='1.5.0' Manufacturer='SparkleShare'>
|
Language='1033' Codepage='1252' Version='2.0' Manufacturer='SparkleShare'>
|
||||||
|
|
||||||
<Package Id='*' Keywords='Installer' Description="SparkleShare Setup" Manufacturer='SparkleShare'
|
<Package Id='*' Keywords='Installer' Description="SparkleShare Setup" Manufacturer='SparkleShare'
|
||||||
InstallerVersion='100' Languages='1033' Compressed='yes' SummaryCodepage='1252' />
|
InstallerVersion='100' Languages='1033' Compressed='yes' SummaryCodepage='1252' />
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
dnl Process this file with autoconf to produce a configure script.
|
dnl Process this file with autoconf to produce a configure script.
|
||||||
m4_define([sparkleshare_version], [1.5.0])
|
m4_define([sparkleshare_version], [2.0])
|
||||||
|
|
||||||
AC_PREREQ([2.54])
|
AC_PREREQ([2.54])
|
||||||
AC_INIT([SparkleShare], sparkleshare_version)
|
AC_INIT([SparkleShare], sparkleshare_version)
|
||||||
|
|
Loading…
Reference in a new issue