keepass2android icon indicating copy to clipboard operation
keepass2android copied to clipboard

Bug: can't sync from app to distant (webdav owncloud)

Open flop25 opened this issue 8 years ago • 8 comments

Hello

I have a long-standing issue that neither app updates nor the owncloud updates solved. I can't sync my kdbx from your app to the distant one ; but the over way is working. owncloud server up to date (10.0.3.3) running webdav Android 7.0 S7 Keepass2droid 1.03

I can get the file from my owncloud with the app, and if I change the distant file and do a sync from keepass2android I will get the distant modifications. BUT the local changes made in keepass2android never got uploaded. When I start the sync, I select "Yes I want to merge", then it says it's downloading the file. Then it fails saying keepass2android got an error 500 from the sever while downloading. And finally it says "successful sync" probably because keepass2android got the distant changes.

Here is relevant line of the log from keepass2android

04/12/2017 01:23:47:18 -- ReadXmlStreamed: 842ms
04/12/2017 01:23:53:503 -- Received unexpected response: Response{protocol=http/1.1, code=500, message=Internal Server Error, url=https://xxx/remote.php/webdav/PWD/PWD.kdbx}
04/12/2017 01:23:53:518 -- couldn't save to remote https://id:pwd@xxx/remote.php/webdav/PWD/PWD.kdbx
04/12/2017 01:23:53:526 -- System.Exception: Received unexpected response: Response{protocol=http/1.1, code=500, message=Internal Server Error, url=https://xxx/remote.php/webdav/PWD/PWD.kdbx} ---> Java.Lang.Exception: Received unexpected response: Response{protocol=http/1.1, code=500, message=Internal Server Error, url=https://xxx/remote.php/webdav/PWD/PWD.kdbx}
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <2b267221e4bc410096484de99ce46573>:0 
  at Java.Interop.JniEnvironment+InstanceMethods.CallVoidMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x00069] in <d8acd8f3e3204c27aabdcd07a93e0012>:0 
  at Android.Runtime.JNIEnv.CallVoidMethod (System.IntPtr jobject, System.IntPtr jmethod, Android.Runtime.JValue* parms) [0x0000e] in <4d2cb53cea504752aa28076fde8f6158>:0 
  at Keepass2android.Javafilestorage.WebDavStorage.UploadFile (System.String p0, System.Byte[] p1, System.Boolean p2) [0x00092] in <c08c4137770b460abe7991d45192500c>:0 
  at keepass2android.Io.JavaFileStorage+JavaFileStorageWriteTransaction.CommitWrite () [0x0001c] in <caf040a60ca24c7480062217b643830c>:0 
   --- End of inner exception stack trace ---
  at keepass2android.Io.JavaFileStorage+JavaFileStorageWriteTransaction.CommitWrite () [0x00036] in <caf040a60ca24c7480062217b643830c>:0 
  at keepass2android.Io.CachingFileStorage.UpdateRemoteFile (System.IO.Stream cachedData, KeePassLib.Serialization.IOConnectionInfo ioc, System.Boolean useFileTransaction, System.String hash) [0x00022] in <caf040a60ca24c7480062217b643830c>:0 
  at keepass2android.Io.CachingFileStorage.TryUpdateRemoteFile (System.IO.Stream cachedData, KeePassLib.Serialization.IOConnectionInfo ioc, System.Boolean useFileTransaction, System.String hash) [0x00000] in <caf040a60ca24c7480062217b643830c>:0 
04/12/2017 01:23:53:531 -- Xml WriteDocument: 6426ms
04/12/2017 01:23:58:924 -- GroupActivity.OnPause

and from the owncloud the only thing I can get is this but is not related to anything: that's just a debug message. Lowering the log level in owncloud makes this message disappears but not the issue.

{"reqId":"0lbQjVjnZnk8x6ZoByt1","level":0,"time":"2017-12-04T00:43:37+00:00","remoteAddr":"176.186.118.216","user":"--","app":"webdav","method":"GET","url":"\/xxx\/remote.php\/webdav\/PWD\/PWD.kdbx","message":"Exception: {\"Message\":\"HTTP\\\/1.1 401 No 'Authorization: Basic' header found. Either the client didn't send one, or the server is misconfigured, No 'Authorization: Basic' header found. Either the client didn't send one, or the server is misconfigured\",\"Exception\":\"Sabre\\\\DAV\\\\Exception\\\\NotAuthenticated\",\"Code\":0,\"Trace\":\"#0 [internal function]: Sabre\\\\DAV\\\\Auth\\\\Plugin->beforeMethod(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#1 \\\/var\\\/www\\\/clients\\\/client6\\\/web4\\\/web\\\/xxx\\\/lib\\\/composer\\\/sabre\\\/event\\\/lib\\\/EventEmitterTrait.php(105): call_user_func_array(Array, Array)\\n#2 \\\/var\\\/www\\\/clients\\\/client6\\\/web4\\\/web\\\/xxx\\\/lib\\\/composer\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(466): Sabre\\\\Event\\\\EventEmitter->emit('beforeMethod', Array)\\n#3 \\\/var\\\/www\\\/clients\\\/client6\\\/web4\\\/web\\\/xxx\\\/lib\\\/composer\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(254): Sabre\\\\DAV\\\\Server->invokeMethod(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#4 \\\/var\\\/www\\\/clients\\\/client6\\\/web4\\\/web\\\/xxx\\\/apps\\\/dav\\\/appinfo\\\/v1\\\/webdav.php(63): Sabre\\\\DAV\\\\Server->exec()\\n#5 \\\/var\\\/www\\\/clients\\\/client6\\\/web4\\\/web\\\/xxx\\\/remote.php(165): require_once('\\\/var\\\/www\\\/client...')\\n#6 {main}\",\"File\":\"\\\/var\\\/www\\\/clients\\\/client6\\\/web4\\\/web\\\/xxx\\\/lib\\\/composer\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Auth\\\/Plugin.php\",\"Line\":168,\"User\":false}"}

and for the server itself all I can get is only

37.172.218.123 - - [04/Dec/2017:01:57:37 +0100] "GET /xxx/remote.php/webdav/PWD/PWD.kdbx HTTP/1.1" 200 513409 "-" "okhttp/3.9.0"
37.172.218.123 - - [04/Dec/2017:01:57:41 +0100] "PUT /xxx/remote.php/webdav/PWD/PWD.kdbx HTTP/1.1" 500 3799 "-" "okhttp/3.9.0"

absolutely no 500 error anywhere :/

If you need more details or me doing something special, just tell me

Thank you for your great work. Just found that I never donated while I'm using it for years! I'm fixing that ^^

flop25 avatar Dec 05 '17 22:12 flop25

Hello,

I'm a kepass2android user too. In your error message you can see an http 500 error. This is an internal application error in owncloud. I use keepass2android since several years, first with owncloud, now with nextcloud (11.0.3). I sync several kdbx files between 10 windows and 6 android devices. Every change on every device is synced in both directions.

Perhaps you should consider an upgrade to nextcloud.

ulfkosack avatar Dec 24 '17 08:12 ulfkosack

Thank you But let me quote myself

"that's just a debug message. Lowering the log level in owncloud makes this message disappears but not the issue"

Le 24 déc. 2017 09:29, "BusinessTux" [email protected] a écrit :

Hello,

I'm a kepass2android user too. In your error message you can see an http 500 error. This is an internal application error in owncloud. I use keepass2android since several years, first with owncloud, now with nextcloud (11.0.3). I sync several kdbx files between 10 windows and 6 android devices. Every change on every device is synced in both directions.

Perhaps you should consider an upgrade to nextcloud.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/PhilippC/keepass2android/issues/152#issuecomment-353772270, or mute the thread https://github.com/notifications/unsubscribe-auth/AAs-jb0FRrZk9i6If7jdddLB_Vbr2P51ks5tDgthgaJpZM4Q3D-Y .

flop25 avatar Dec 24 '17 10:12 flop25

maybe your server does not allow creation of new files? If KP2A uses file transactions, it creates a temp file to upload the data to (and later renames that to the original file). You can try to disable file transactions for testing (but this is not recommended for production use)

PhilippC avatar Jan 05 '18 04:01 PhilippC

i'm using the webdav from owncloud with other software without any issue since years i also disabled file transactions (in fact it was still disabled when i checked, because i've already tried many options) thanks for you help

flop25 avatar Jan 05 '18 18:01 flop25

I have the same error with kp2a. I use "normal" Keepass on ~4 different PC's (Linux and Windows) all of them can correctly connect using webdav and write the database of the keepass file.

But instead of ownlcoud I'm using nextcloud (12.0.5 newest). Funny thing is, I have the problem only recently after changing my phone. Earlier it worked like a charm.

So sorry no ideas to solve it but maybe I was able to offer some more information.

buddakeks avatar Jan 29 '18 21:01 buddakeks

HAAAA we are getting somewhere there ; thank you!! did you use an app to migrate your applciations?

flop25 avatar Jan 29 '18 21:01 flop25

I migrated by connecting the android phones directly by cable. So all settings have been transfered and the Apps have been freshly downloaded. Since I have now a Pixel 2 the Android Version itself is now newer.

buddakeks avatar Jan 29 '18 22:01 buddakeks

I started using nextcloud and when I sync I get the error System.Exception: Received unexpected response in the debug log, then a message data synchronized, but I don't think it's syncing because my ubuntu desktop using keepassxc doesn't have the ones added just now from the phone. keepass2android.txt

aaronscientiae avatar Sep 10 '23 01:09 aaronscientiae