Ejemplo n.º 1
0
 public KeeFoxEntryUserControl(KeePassRPCExt keePassRPCPlugin, PwEntry entry,
                               CustomListViewEx advancedListView, PwEntryForm pwEntryForm, ProtectedStringDictionary strings)
 {
     KeePassRPCPlugin = keePassRPCPlugin;
     _entry           = entry;
     InitializeComponent();
     _pwEntryForm = pwEntryForm;
     _strings     = strings;
     _conf        = entry.GetKPRPCConfig(strings);
 }
Ejemplo n.º 2
0
 public KeeFoxEntryUserControl(KeePassRPCExt keePassRPCPlugin, PwEntry entry,
     CustomListViewEx advancedListView, PwEntryForm pwEntryForm, ProtectedStringDictionary strings)
 {
     KeePassRPCPlugin = keePassRPCPlugin;
     _entry = entry;
     InitializeComponent();
     _pwEntryForm = pwEntryForm;
     _strings = strings;
     _conf = entry.GetKPRPCConfig(strings);
 }
Ejemplo n.º 3
0
 public KeeEntryUserControl(KeePassRPCExt keePassRPCPlugin, PwEntry entry,
                            CustomListViewEx advancedListView, PwEntryForm pwEntryForm, ProtectedStringDictionary strings)
 {
     KeePassRPCPlugin = keePassRPCPlugin;
     _entry           = entry;
     InitializeComponent();
     _pwEntryForm = pwEntryForm;
     _strings     = strings;
     _dbConf      = KeePassRPCPlugin._host.Database.GetKPRPCConfig();
     _conf        = entry.GetKPRPCConfig(strings, _dbConf.DefaultMatchAccuracy);
 }
Ejemplo n.º 4
0
        public static MatchAccuracyMethod GetMatchAccuracyMethod(this PwEntry entry, URLSummary urlsum, DatabaseConfig dbConf)
        {
            var conf = entry.GetKPRPCConfig(MatchAccuracyMethod.Domain);
            MatchAccuracyMethod overridenMethod;

            if (urlsum.Domain != null && urlsum.Domain.RegistrableDomain != null && dbConf.MatchedURLAccuracyOverrides.TryGetValue(urlsum.Domain.RegistrableDomain, out overridenMethod))
            {
                return(overridenMethod);
            }
            else
            {
                return(conf.GetMatchAccuracyMethod());
            }
        }
Ejemplo n.º 5
0
        public static EntryConfig GetKPRPCConfig(this PwEntry entry)
        {
            List <string> dummy = null;

            return(entry.GetKPRPCConfig(null, ref dummy));
        }
Ejemplo n.º 6
0
        public static EntryConfig GetKPRPCConfig(this PwEntry entry, ProtectedStringDictionary strings)
        {
            List <string> dummy = null;

            return(entry.GetKPRPCConfig(strings, ref dummy));
        }
Ejemplo n.º 7
0
 private LightEntry GetEntryFromPwEntry(PwEntry pwe, int matchAccuracy, bool fullDetails, PwDatabase db, bool abortIfHidden)
 {
     EntryConfig conf = pwe.GetKPRPCConfig();
     if (conf == null)
         return null;
     return GetEntryFromPwEntry(pwe, conf, matchAccuracy, fullDetails, db, abortIfHidden);
 }
Ejemplo n.º 8
0
        private void MergeEntries(PwEntry destination, PwEntry source, int urlMergeMode, PwDatabase db)
        {
            EntryConfig destConfig = destination.GetKPRPCConfig();
            if (destConfig == null)
                return;

            EntryConfig sourceConfig = source.GetKPRPCConfig();
            if (sourceConfig == null)
                return;

            destination.CreateBackup(db);

            destConfig.HTTPRealm = sourceConfig.HTTPRealm;
            destination.IconId = source.IconId;
            destination.CustomIconUuid = source.CustomIconUuid;
            destination.Strings.Set("UserName", new ProtectedString(
                host.Database.MemoryProtection.ProtectUserName, source.Strings.ReadSafe("UserName")));
            destination.Strings.Set("Password", new ProtectedString(
                host.Database.MemoryProtection.ProtectPassword, source.Strings.ReadSafe("Password")));
            destConfig.FormFieldList = sourceConfig.FormFieldList;

            // This algorithm could probably be made more efficient (lots of O(n) operations
            // but we're dealing with pretty small n so I've gone with the conceptually
            // easiest approach for now).

            List<string> destURLs = new List<string>();
            destURLs.Add(destination.Strings.ReadSafe("URL"));
            if (destConfig.AltURLs != null)
                destURLs.AddRange(destConfig.AltURLs);

            List<string> sourceURLs = new List<string>();
            sourceURLs.Add(source.Strings.ReadSafe("URL"));
            if (sourceConfig.AltURLs != null)
                sourceURLs.AddRange(sourceConfig.AltURLs);

            switch (urlMergeMode)
            {
                case 1:
                    MergeInNewURLs(destURLs, sourceURLs);
                    break;
                case 2:
                    destURLs.RemoveAt(0);
                    MergeInNewURLs(destURLs, sourceURLs);
                    break;
                case 3:
                    if (sourceURLs.Count > 0)
                    {
                        foreach (string sourceUrl in sourceURLs)
                            if (!destURLs.Contains(sourceUrl))
                                destURLs.Add(sourceUrl);
                    }
                    break;
                case 4:
                default:
                    // No changes to URLs
                    break;
            }

            // These might not have changed but meh
            destination.Strings.Set("URL", new ProtectedString(host.Database.MemoryProtection.ProtectUrl, destURLs[0]));
            destConfig.AltURLs = new string[0];
            if (destURLs.Count > 1)
                destConfig.AltURLs = destURLs.GetRange(1,destURLs.Count-1).ToArray();

            destination.SetKPRPCConfig(destConfig);
            destination.Touch(true);
        }
Ejemplo n.º 9
0
        public static EntryConfig GetKPRPCConfig(this PwEntry entry, MatchAccuracyMethod mam)
        {
            List <string> dummy = null;

            return(entry.GetKPRPCConfig(null, ref dummy, mam));
        }
Ejemplo n.º 10
0
        public static EntryConfig GetKPRPCConfig(this PwEntry entry, ProtectedStringDictionary strings, MatchAccuracyMethod mam)
        {
            List <string> dummy = null;

            return(entry.GetKPRPCConfig(strings, ref dummy, mam));
        }