diff --git a/SparkleShare/Common/BaseController.cs b/SparkleShare/Common/BaseController.cs index 138142231..ea57f77b6 100644 --- a/SparkleShare/Common/BaseController.cs +++ b/SparkleShare/Common/BaseController.cs @@ -224,6 +224,7 @@ public virtual void Initialize () Logger.LogInfo ("Environment", "SparkleShare " + version); Logger.LogInfo ("Environment", "Git LFS " + Sparkles.Git.GitCommand.GitLFSVersion); Logger.LogInfo ("Environment", "Git " + Sparkles.Git.GitCommand.GitVersion); + Logger.LogInfo ("Environment", Sparkles.OpenSSLCommand.OpenSSLVersion); Logger.LogInfo ("Environment", InstallationInfo.OperatingSystem + " " + InstallationInfo.OperatingSystemVersion); UserAuthenticationInfo = new SSHAuthenticationInfo (); diff --git a/Sparkles/Git/Git.Fetcher.cs b/Sparkles/Git/Git.Fetcher.cs index 052638f6a..8619734fc 100644 --- a/Sparkles/Git/Git.Fetcher.cs +++ b/Sparkles/Git/Git.Fetcher.cs @@ -244,10 +244,10 @@ public override void EnableFetchedRepoCrypto (string password) var git_config_required = new GitCommand (TargetFolder, "config filter.encryption.required true"); var git_config_smudge = new GitCommand (TargetFolder, "config filter.encryption.smudge " + - string.Format ("\"openssl enc -d -aes-256-cbc -base64 -S {0} -pass file:{1} -md sha256\"", password_salt, password_file)); + string.Format ("\"'{0}' enc -d -aes-256-cbc -base64 -S {1} -pass file:{2} -md sha256\"", OpenSSLCommand.OpenSSLCommandPath, password_salt, password_file)); var git_config_clean = new GitCommand (TargetFolder, "config filter.encryption.clean " + - string.Format ("\"openssl enc -e -aes-256-cbc -base64 -S {0} -pass file:{1} -md sha256\"", password_salt, password_file)); + string.Format ("\"'{0}' enc -e -aes-256-cbc -base64 -S {1} -pass file:{2} -md sha256\"", OpenSSLCommand.OpenSSLCommandPath, password_salt, password_file)); git_config_required.StartAndWaitForExit (); git_config_smudge.StartAndWaitForExit (); @@ -279,7 +279,7 @@ public override bool IsFetchedRepoPasswordCorrect (string password) string args = string.Format ("enc -d -aes-256-cbc -base64 -S {0} -pass pass:{1} -in \"{2}\" -md sha256", password_salt, password.SHA256 (password_salt), password_check_file_path); - var process = new Command ("openssl", args); + var process = new OpenSSLCommand (args); process.StartInfo.WorkingDirectory = TargetFolder; process.StartAndWaitForExit (); diff --git a/Sparkles/OpenSSLCommand.cs b/Sparkles/OpenSSLCommand.cs new file mode 100644 index 000000000..9a1803a80 --- /dev/null +++ b/Sparkles/OpenSSLCommand.cs @@ -0,0 +1,57 @@ +// SparkleShare, a collaboration and sharing tool. +// Copyright (C) 2010 Hylke Bons +// +// 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 . + + +using System.IO; + +namespace Sparkles +{ + public class OpenSSLCommand : Command + { + public static string OpenSSLBinary = "openssl"; + public static string OpenSSLPath = Path.GetDirectoryName(LocateCommand(OpenSSLBinary)).Replace("\\", "/"); + + public static string OpenSSLCommandPath + { + get + { + return LocateCommand(OpenSSLBinary).Replace("\\", "/"); + } + } + + + public OpenSSLCommand(string command, string args) : + base(Path.Combine(OpenSSLPath, command), args) + { + } + public OpenSSLCommand(string args) : base(OpenSSLCommandPath, args) + { + } + public static string OpenSSLVersion + { + get { + var openssl_version = new Command (OpenSSLCommandPath, "version", false); + + string [] version = openssl_version.StartAndReadStandardOutput ().Split (' '); + string version_string = version [0]; + if (version.Length >= 2) { + version_string= version [0] + " " + version [1]; + } + return version_string; + } + } + } +} diff --git a/Sparkles/Sparkles.csproj b/Sparkles/Sparkles.csproj index e9c3bc995..330090666 100644 --- a/Sparkles/Sparkles.csproj +++ b/Sparkles/Sparkles.csproj @@ -76,6 +76,9 @@ Component + + Component + Component diff --git a/Sparkles/meson.build b/Sparkles/meson.build index e4261c561..cf403186e 100644 --- a/Sparkles/meson.build +++ b/Sparkles/meson.build @@ -22,7 +22,8 @@ sparkles_src = ['AuthenticationInfo.cs', 'SSHFetcher.cs', 'TcpListener.cs', 'User.cs', - 'Watcher.cs'] + 'Watcher.cs', + 'OpenSSLCommand.cs'] sparkles = library('Sparkles',