mirror of
https://github.com/wismna/ModernKeePassLib.git
synced 2025-10-03 15:40:20 -04:00
Update Lib to version 2.44
Update nuget packages
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
KeePass Password Safe - The Open-Source Password Manager
|
||||
Copyright (C) 2003-2019 Dominik Reichl <dominik.reichl@t-online.de>
|
||||
Copyright (C) 2003-2020 Dominik Reichl <dominik.reichl@t-online.de>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -38,7 +38,7 @@ using ModernKeePassLib.Utility;
|
||||
|
||||
namespace ModernKeePassLib.Serialization
|
||||
{
|
||||
#if (!ModernKeePassLib && !KeePassLibSD && !KeePassRT)
|
||||
#if (!ModernKeePassLib && !KeePassLibSD)
|
||||
internal sealed class IOWebClient : WebClient
|
||||
{
|
||||
private IOConnectionInfo m_ioc;
|
||||
@@ -240,7 +240,7 @@ namespace ModernKeePassLib.Serialization
|
||||
|
||||
public static class IOConnection
|
||||
{
|
||||
#if (!ModernKeePassLib && !KeePassLibSD && !KeePassRT)
|
||||
#if (!ModernKeePassLib && !KeePassLibSD)
|
||||
private static ProxyServerType m_pstProxyType = ProxyServerType.System;
|
||||
private static string m_strProxyAddr = string.Empty;
|
||||
private static string m_strProxyPort = string.Empty;
|
||||
@@ -269,7 +269,7 @@ namespace ModernKeePassLib.Serialization
|
||||
|
||||
public static event EventHandler<IOAccessEventArgs> IOAccessPre;
|
||||
|
||||
#if (!ModernKeePassLib && !KeePassLibSD && !KeePassRT)
|
||||
#if (!ModernKeePassLib && !KeePassLibSD)
|
||||
// Allow self-signed certificates, expired certificates, etc.
|
||||
private static bool AcceptCertificate(object sender,
|
||||
X509Certificate certificate, X509Chain chain,
|
||||
@@ -598,12 +598,12 @@ namespace ModernKeePassLib.Serialization
|
||||
#if ModernKeePassLib
|
||||
return new MemoryStream(ioc.Bytes);
|
||||
#else
|
||||
return new FileStream(ioc.Path, FileMode.Open, FileAccess.Read,
|
||||
return new FileStream(ioc.Path, FileMode.Open, FileAccess.Read,
|
||||
FileShare.Read);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if (!ModernKeePassLib && !KeePassLibSD && !KeePassRT)
|
||||
#if (!ModernKeePassLib && !KeePassLibSD)
|
||||
public static Stream OpenWrite(IOConnectionInfo ioc)
|
||||
{
|
||||
if(ioc == null) { Debug.Assert(false); return null; }
|
||||
@@ -640,7 +640,7 @@ namespace ModernKeePassLib.Serialization
|
||||
return new FileStream(ioc.Path, FileMode.Create, FileAccess.Write,
|
||||
FileShare.None);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
public static bool FileExists(IOConnectionInfo ioc)
|
||||
{
|
||||
@@ -718,7 +718,7 @@ namespace ModernKeePassLib.Serialization
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Rename/move a file. For local file system and WebDAV, the
|
||||
@@ -740,13 +740,15 @@ namespace ModernKeePassLib.Serialization
|
||||
WebRequest req = CreateWebRequest(iocFrom);
|
||||
if(req != null)
|
||||
{
|
||||
string strToCnc = UrlUtil.GetCanonicalUri(iocTo.Path);
|
||||
|
||||
if(IsHttpWebRequest(req))
|
||||
{
|
||||
#if KeePassUAP
|
||||
throw new NotSupportedException();
|
||||
#else
|
||||
req.Method = "MOVE";
|
||||
req.Headers.Set("Destination", iocTo.Path); // Full URL supported
|
||||
req.Headers.Set("Destination", strToCnc); // Full URL supported
|
||||
#endif
|
||||
}
|
||||
else if(IsFtpWebRequest(req))
|
||||
@@ -755,13 +757,13 @@ namespace ModernKeePassLib.Serialization
|
||||
throw new NotSupportedException();
|
||||
#else
|
||||
req.Method = WebRequestMethods.Ftp.Rename;
|
||||
string strTo = UrlUtil.GetFileName(iocTo.Path);
|
||||
string strToName = UrlUtil.GetFileName(strToCnc);
|
||||
|
||||
// We're affected by .NET bug 621450:
|
||||
// https://connect.microsoft.com/VisualStudio/feedback/details/621450/problem-renaming-file-on-ftp-server-using-ftpwebrequest-in-net-framework-4-0-vs2010-only
|
||||
// Prepending "./", "%2E/" or "Dummy/../" doesn't work.
|
||||
|
||||
((FtpWebRequest)req).RenameTo = strTo;
|
||||
((FtpWebRequest)req).RenameTo = strToName;
|
||||
#endif
|
||||
}
|
||||
else if(IsFileWebRequest(req))
|
||||
@@ -776,7 +778,7 @@ namespace ModernKeePassLib.Serialization
|
||||
throw new NotSupportedException();
|
||||
#else
|
||||
req.Method = WrmMoveFile;
|
||||
req.Headers.Set(WrhMoveFileTo, iocTo.Path);
|
||||
req.Headers.Set(WrhMoveFileTo, strToCnc);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -800,7 +802,7 @@ namespace ModernKeePassLib.Serialization
|
||||
#endif
|
||||
}
|
||||
|
||||
#if (!ModernKeePassLib && !KeePassLibSD && !KeePassRT)
|
||||
#if (!ModernKeePassLib && !KeePassLibSD)
|
||||
private static bool SendCommand(IOConnectionInfo ioc, string strMethod)
|
||||
{
|
||||
try
|
||||
@@ -835,24 +837,14 @@ namespace ModernKeePassLib.Serialization
|
||||
#endif
|
||||
public static byte[] ReadFile(IOConnectionInfo ioc)
|
||||
{
|
||||
Stream sIn = null;
|
||||
MemoryStream ms = null;
|
||||
try
|
||||
{
|
||||
sIn = IOConnection.OpenRead(ioc);
|
||||
if(sIn == null) return null;
|
||||
|
||||
ms = new MemoryStream();
|
||||
MemUtil.CopyStream(sIn, ms);
|
||||
|
||||
return ms.ToArray();
|
||||
}
|
||||
catch(Exception) { }
|
||||
finally
|
||||
{
|
||||
if(sIn != null) sIn.Dispose();
|
||||
if(ms != null) ms.Dispose();
|
||||
using(Stream s = IOConnection.OpenRead(ioc))
|
||||
{
|
||||
return MemUtil.Read(s);
|
||||
}
|
||||
}
|
||||
catch(Exception) { Debug.Assert(false); }
|
||||
|
||||
return null;
|
||||
}
|
||||
|
Reference in New Issue
Block a user