Menu

#2227 Open a given database on startup

KeePass_2.x
closed
nobody
None
5
2017-01-28
2017-01-23
Gingko
No

In the "Advanced" section of the "Options" dialog, there is an option named "Remember and automatically open last used database on startup".
I would like to know if it could be possible to add a mean to open one given data base on startup, rather than the last used one.
I currently have three databases that I open concurrently, and I use the KeeAutoExec plugin for opening them concurrently while having to open myself only one: that way, the opening of the two others databases is automatically cascaded when I open the main one.
But using this option, this works correctly only if I take care to always close KeePass with this main database active. If any other database was active on closing, I have to cancel the opening and go to the main database manually.
I don't want any secondary database to be configured to open the main one because these ones are shared, and I don't want a shared database to be able to open my private one.
So, if more than one database are remembered by KeePass, I suggest introducing a mean to pin one of these ones to be open on startup, even if it was not the last used one.

Gingko

Discussion

  • Paul

    Paul - 2017-01-23

    You need a trigger to give the required database focus before closing. See the trigger examples.
    http://keepass.info/help/kb/trigger_examples.html#multidb

    cheers, Paul

     
  • Gingko

    Gingko - 2017-01-25

    Hello,
    I tried to use triggers for getting the behavious I was expected.
    But after having tried some tweaks, I was running in a case where this made KeePass crashing (with a stack overflow error) on startup making it becoming completely unable to start.

    In order to recover (because KeePass was crashing before even giving access to its user interface), I had to edit the KeePass.config.xml and remove all nodes under the "TriggerSystem" tag.

    Here is a copy of the removed tag (with some munging on personal data). I will not post the entire KeePass.config.xml because almost all contents of this file is sensitive.

    <TriggerSystem>
      <Triggers>
        <Trigger>
          <Guid>GA3a8kVvFESRjHL0Z1BHPw==</Guid>
          <Name>Activer la base MyFile</Name>
          <Events>
            <Event>
              <TypeGuid>jRLUmvLLT/eo78/arGJomQ==</TypeGuid>
              <Parameters />
            </Event>
          </Events>
          <Conditions />
          <Actions>
            <Action>
              <TypeGuid>P7gzLdYWToeZBWTbFkzWJg==</TypeGuid>
              <Parameters>
                <Parameter>MyFile.kdbx</Parameter>
                <Parameter>0</Parameter>
              </Parameters>
            </Action>
          </Actions>
        </Trigger>
      </Triggers>
    </TriggerSystem>
    

    I also join a text copy of the KeePass stack frame at the time of the crash (that I got using the Visual Studio 2010 debugger).

    Gingko

     

    Last edit: Gingko 2017-01-26
  • Paul

    Paul - 2017-01-25

    When I paste your trigger the trigger shows up with the correct name, but I get nothing under event or action.
    Change these lines to turn the trigger off, then fire up KeePass, edit the trigger, Tools > Copy selected triggers to the clipboard, paste here.

                <Enabled>false</Enabled>
                <InitiallyOn>false</InitiallyOn>
    

    cheers, Paul

     
  • Gingko

    Gingko - 2017-01-25

    I also munged the <guid> and <typeguid>s, so depending of their usage, I can't assure you that what you see in the UI could conform to what a was seeing myself (nor even that you would get the stack overflow error that I got).</typeguid></guid>

    Nevertheless, as I said to you, with my triggers, KeePass was crashing on startup with a stack overflow error, so I couldn't start with the triggers that I had before (because I couldn't even expect to be able to open their interface).

    In any case, I think that this crash problem should be fixed before I try to use the triggers in any way.

    Gingko

     
  • Paul

    Paul - 2017-01-26

    We need the GUIDs for triggers to work - they are used to tell the trigger system what action or event to use. They are not specific to your system.

    cheers, Paul

     
  • Gingko

    Gingko - 2017-01-26

    I just edited my post above, restoring the proper GUIDs.
    You may want to try again pasting them in the KeePass.config.xml file

    Gingko

     
  • Paul

    Paul - 2017-01-26

    That's better.

    I see you activate the database every time the user interface is updated, which updates the user interface, which activates the database, which....
    Try using the event "Application Exit".

    cheers, Paul

     
  • Dominik Reichl

    Dominik Reichl - 2017-01-28
    • status: open --> closed
     
  • Dominik Reichl

    Dominik Reichl - 2017-01-28

    The 'User interface state updated' trigger event is not suitable here. Activating a tab within such a trigger clearly results in an infinite recursion (until the stack overflows); I don't consider this as a KeePass bug. Although there are ways to prevent such a recursion (see the trigger examples page), my suggestion would instead be to use the trigger event 'Application started and ready' and the action 'Open database file' (and the remembering option turned off).

    There exist multiple solutions for opening one or more specific database at KeePass startup, see the FAQ:
    http://keepass.info/help/kb/faq.html#openspec

    Best regards,
    Dominik

     
  • Gingko

    Gingko - 2017-01-28

    This is a bug in the sense it should not be possible to crash the application that way.
    As I told previously, the only way I had to recover was deleting (or editing as I had knowledge for it) the KeePass.config.xml. Any attempt to restart the application resulted as a new crash. This can not be seen as a normal situation.
    You could for example implement some kind of stack recursion detection (before the system does) and trigger an exception if the stack becomes too deep, allowing for a graceful recovery with a proper error message and giving a chance to return in the trigger editor in order to fix the problem.

    Gingko

     

Log in to post a comment.

MongoDB Logo MongoDB