fetcher: fix permissions on ssh config file
This commit is contained in:
parent
b84b6ba499
commit
45655d4395
|
@ -32,9 +32,13 @@ namespace SparkleLib {
|
||||||
"sparkleshare");
|
"sparkleshare");
|
||||||
|
|
||||||
public static SparkleConfig DefaultConfig = new SparkleConfig (ConfigPath, "config.xml");
|
public static SparkleConfig DefaultConfig = new SparkleConfig (ConfigPath, "config.xml");
|
||||||
|
|
||||||
public string FullPath;
|
public string FullPath;
|
||||||
public string HomePath = Environment.GetFolderPath (Environment.SpecialFolder.Personal);
|
|
||||||
|
public string HomePath {
|
||||||
|
get {
|
||||||
|
return Environment.GetFolderPath (Environment.SpecialFolder.Personal);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public string FoldersPath {
|
public string FoldersPath {
|
||||||
|
|
|
@ -22,8 +22,6 @@ using System.Security.AccessControl;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
|
||||||
using Mono.Unix;
|
|
||||||
|
|
||||||
namespace SparkleLib {
|
namespace SparkleLib {
|
||||||
|
|
||||||
// Sets up a fetcher that can get remote folders
|
// Sets up a fetcher that can get remote folders
|
||||||
|
@ -158,10 +156,7 @@ namespace SparkleLib {
|
||||||
File.WriteAllText (ssh_config_file_path, ssh_config);
|
File.WriteAllText (ssh_config_file_path, ssh_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
UnixFileSystemInfo file_info = new UnixFileInfo (ssh_config_file_path);
|
Chmod644 (ssh_config_file_path);
|
||||||
file_info.FileAccessPermissions = (FileAccessPermissions.UserRead |
|
|
||||||
FileAccessPermissions.UserWrite);
|
|
||||||
|
|
||||||
SparkleHelpers.DebugInfo ("Fetcher", "Disabled host key checking for " + host);
|
SparkleHelpers.DebugInfo ("Fetcher", "Disabled host key checking for " + host);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -208,10 +203,7 @@ namespace SparkleLib {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
File.WriteAllText (ssh_config_file_path, new_ssh_config.Trim ());
|
File.WriteAllText (ssh_config_file_path, new_ssh_config.Trim ());
|
||||||
|
Chmod644 (ssh_config_file_path);
|
||||||
UnixFileSystemInfo file_info = new UnixFileInfo (ssh_config_file_path);
|
|
||||||
file_info.FileAccessPermissions = (FileAccessPermissions.UserRead |
|
|
||||||
FileAccessPermissions.UserWrite);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -229,5 +221,15 @@ namespace SparkleLib {
|
||||||
else
|
else
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void Chmod644 (string file_path)
|
||||||
|
{
|
||||||
|
// Hack to be able to set the permissions on a file
|
||||||
|
// that OpenSSH still likes without resorting to Mono.Unix
|
||||||
|
FileInfo file_info = new FileInfo (file_path);
|
||||||
|
file_info.Attributes = FileAttributes.ReadOnly;
|
||||||
|
file_info.Attributes = FileAttributes.Normal;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue