Bug 398409 - KMyMoney does not prompt for password when connecting to database
Summary: KMyMoney does not prompt for password when connecting to database
Status: RESOLVED FIXED
Alias: None
Product: kmymoney
Classification: Applications
Component: general (show other bugs)
Version: git (master)
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: KMyMoney Devel Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-09-09 00:30 UTC by Eleazar
Modified: 2018-09-22 19:48 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 5.0.2
Sentry Crash Report:


Attachments
Temporary patch to force password dialog and debug output (952 bytes, patch)
2018-09-11 11:34 UTC, Thomas Baumgart
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Eleazar 2018-09-09 00:30:39 UTC
I have KMM connected to a MySQL DB backend. When I start up KMM 4.8.1-ebeeced071 it prompts me to enter my password to connect to the DB. When I start up KMM5 it does not prompt me for the password. It just errors out as it gets access denied.

My current workaround was to create an empty kmy file locally and open it. Quit KMM and then start KMM so that it automatically loads the empty kmy file. Then I select "Open Database" and I am able to use KMM normally.


OS: KUbuntu 18.04.1
KDE: 5.44.0
KDE Plasma: 5.12.6
Qt: 5.9.5
Kernel: 4.15.0-33-generic
KMM: 5.0.80-00d52935b (Debug build off master with code pulled on 09/08/2018)
Comment 1 Thomas Baumgart 2018-09-09 05:41:54 UTC
A more simple workaround which does not require an empty file would be to start KMyMoney with the command line option '-n'. This starts KMyMoney without opening the last used file.
Comment 2 Thomas Piekarski 2018-09-09 18:38:10 UTC
This issue could be related to 394384.
Comment 3 Thomas Baumgart 2018-09-10 06:52:42 UTC
Yes, at least the second part of 394384 is identical. I setup of link between these two issues. It's not a duplicate, as the initial problem was a leading slash and the missing password dialog is just a follow up.
Comment 4 Thomas Baumgart 2018-09-10 19:47:32 UTC
Git commit ac602ffdb0297706f1f39602856bbe20225e906c by Thomas Baumgart.
Committed on 10/09/2018 at 19:47.
Pushed by tbaumgart into branch '5.0'.

Ask for password when connecting to database
Related: bug 394384
FIXED-IN: 5.0.2

M  +46   -20   kmymoney/plugins/sql/sqlstorage.cpp
M  +3    -0    kmymoney/plugins/sql/sqlstorage.h

https://commits.kde.org/kmymoney/ac602ffdb0297706f1f39602856bbe20225e906c
Comment 5 Eleazar 2018-09-11 04:55:17 UTC
Just downloaded the latest master code (09/10/2018 @ 22:30 MDT build 5.0.80-90212a2b) and rebuild and deployed the code. I started it up using the -n option, connected to my DB. After it loaded I closed KMM and opened it again and I did not get prompted for a password.
Comment 6 Thomas Piekarski 2018-09-11 05:38:57 UTC
(In reply to Eleazar from comment #5)
> Just downloaded the latest master code (09/10/2018 @ 22:30 MDT build
> 5.0.80-90212a2b) and rebuild and deployed the code. I started it up using
> the -n option, connected to my DB. After it loaded I closed KMM and opened
> it again and I did not get prompted for a password.

The commit #ac602f is not yet in master, can you please checkout the 5.0 branch?
Comment 7 Eleazar 2018-09-11 06:12:28 UTC
Downloaded the 5.0 branch (build 5.0.2-ac602ffd) and built it and open with -n, connected to my DB. Closed and opened it again and was not prompted for password. I got the access denied popup.


libEGL warning: DRI2: failed to authenticate
WebConnect: Try to connect to WebConnect server
WebConnect: Connect to server failed
WebConnect: Running in server mode
Plugins: budgetview loaded
Plugins: checkprinting loaded
Plugins: csvexporter loaded
Plugins: csvimporter loaded
Plugins: forecastview loaded
Plugins: gncimporter loaded
Plugins: icalendarexporter loaded
Plugins: kbanking loaded
KBankingPlugin: No AqB4 config found.
KBankingPlugin: No AqB3 config found.
Plugins: kbanking pluged
Plugins: ofximporter loaded
Plugins: onlinejoboutboxview loaded
Plugins: qifexporter loaded
Plugins: qifimporter loaded
Plugins: reconciliation report loaded
Plugins: reportsview loaded
Plugins: sqlstorage loaded
Plugins: weboob loaded
Plugins: xmlstorage loaded
Error in function int MyMoneyStorageSql::open(const QUrl&, int, bool) : opening database
Driver = QMYSQL, Host = 192.168.0.4, User = kmymoney, Database = KMyMoney
Driver Error: QMYSQL: Unable to connect
Database Error No 1045: Access denied for user 'kmymoney'@'xxxxxxxxx' (using password: NO)
Text: Access denied for user 'kmymoney'@'xxxxxxxxxx' (using password: NO) QMYSQL: Unable to connect
Error type 1
Executed: 
Query error No -1:  
Error type 0
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
Comment 8 Thomas Baumgart 2018-09-11 11:34:38 UTC
Created attachment 114896 [details]
Temporary patch to force password dialog and debug output

Can you apply the attached patch and check the output on the console? It should print a line like

  secure = "??"

I am interested in the details of the ??-part. After applying the patch and building it will ask for a password. If that does not happen, I expect a problem with the installation of the plugins on your machine.
Comment 9 Eleazar 2018-09-11 14:24:35 UTC
I applied the patch and did a debug build but I did not see the secure=?? line. Is there a cli parameter I need to use to give a verbose output when I run it?


Build process:
cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Debugfull
make
sudo make install




libEGL warning: DRI2: failed to authenticate
WebConnect: Try to connect to WebConnect server
WebConnect: Connect to server failed
WebConnect: Running in server mode
Plugins: budgetview loaded
Plugins: checkprinting loaded
Plugins: csvexporter loaded
Plugins: csvimporter loaded
Plugins: forecastview loaded
Plugins: gncimporter loaded
Plugins: icalendarexporter loaded
Plugins: kbanking loaded
KBankingPlugin: No AqB4 config found.
KBankingPlugin: No AqB3 config found.
Plugins: kbanking pluged
Plugins: ofximporter loaded
Plugins: onlinejoboutboxview loaded
Plugins: qifexporter loaded
Plugins: qifimporter loaded
Plugins: reconciliation report loaded
Plugins: reportsview loaded
Plugins: sqlstorage loaded
Plugins: weboob loaded
Plugins: xmlstorage loaded
Error in function int MyMoneyStorageSql::open(const QUrl&, int, bool) : opening database
Driver = QMYSQL, Host = 192.168.0.4, User = kmymoney, Database = KMyMoney
Driver Error: QMYSQL: Unable to connect
Database Error No 1045: Access denied for user 'kmymoney'@'xxxxxxxxxxx' (using password: NO)
Text: Access denied for user 'kmymoney'@'xxxxxxxxx' (using password: NO) QMYSQL: Unable to connect
Error type 1
Executed: 
Query error No -1:  
Error type 0
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
Comment 10 Thomas Baumgart 2018-09-11 14:41:37 UTC
No, it will be printed like all the other stuff you see. If it does not show up, then it could be that the installation of the plugins is not correct.

Here is how you could verify if they end up in the right directory. Check the directory where a standard KDE plugin is located.

thb@thb-nb:~$ find /usr -name kcm_sddm.so 
/usr/lib64/qt5/plugins/kcm_sddm.so

Then search for a KMyMoney one. It needs to be in the same path but in a subdirectory named kmymoney.

thb@thb-nb:~$ find /usr -name sqlstorage.so
/usr/lib64/qt5/plugins/kmymoney/sqlstorage.so

If you see multiple locations, then your build needs to tweak the KDE_INSTALL_PLUGINDIR setting. I have mine set to "/usr/lib64/qt5/plugins". If I don't do that, the plugins are installed in a false location and not picked up.
Comment 11 Eleazar 2018-09-12 00:39:58 UTC
They are in the same location
/usr/lib/x86_64-linux-gnu/qt5/plugins/kcm_sddm.so

/usr/lib/x86_64-linux-gnu/qt5/plugins/kmymoney/sqlstorage.so
/usr/lib/x86_64-linux-gnu/plugins/kmymoney/sqlstorage.so

I will uninstall and reinstall with the KDE_INSTALL_PLUGINDIR tweak and report back.
Comment 12 Eleazar 2018-09-12 00:57:09 UTC
After I reinstalled it using the KDE_INSTALL_PLUGINDIR tweak I opened KMM with -n, logged in to my DB backend. Closed KMM and reopened it and it prompted me for a Password. So I am guessing that it probably worked without the patch. I will use the tweak going forward to make sure it works correctly.
Comment 13 Thomas Baumgart 2018-09-12 14:31:12 UTC
You should check that the directory

  /usr/lib/x86_64-linux-gnu/plugins/kmymoney

and all files in it are removed.
Comment 14 Eleazar 2018-09-22 19:48:32 UTC
Did as instructed and all files were removed.

Thanks for the fix.