Commit graph

960 commits

Author SHA1 Message Date
Klaas Freitag
bcdd8b95bf Allow empty MD5 sum on save, happens with directoires. 2013-05-22 12:33:09 +02:00
Klaas Freitag
69d251630f Code cleanups, move closedb out of if statements. 2013-05-22 12:33:09 +02:00
Klaas Freitag
02f93ec4d5 Free allocted memory of local and remote list. 2013-05-22 12:33:09 +02:00
Klaas Freitag
dd8ceacf75 Avoid compile warning due to non-top variable declaration. 2013-05-22 12:33:09 +02:00
Klaas Freitag
673ca36db8 More efficient database writing, do integrity check on db. 2013-05-22 12:33:09 +02:00
Klaas Freitag
68e0dbb18f Use wide character unlink. 2013-05-22 12:32:25 +02:00
Klaas Freitag
4ad01b35ce Switch on full synchronous mode for sqlite. 2013-05-20 11:10:27 +02:00
Klaas Freitag
053a9b7da0 Add neon includes to httpbf build 2013-05-17 12:45:39 +02:00
Klaas Freitag
4f47aba1e2 Allow user aborting in chunked uploads 2013-05-16 17:37:30 +02:00
Klaas Freitag
2385bbcf55 Add an abort callback. 2013-05-16 17:37:00 +02:00
Olivier Goffart
d8d4f118d7 Fix possible leak 2013-05-15 17:59:13 +02:00
Olivier Goffart
00d27d0e9c Fix HTTPBF again
it really needs to be %u because if it is signed, then we have -- in the
URL which the server can't understand
2013-05-14 15:30:56 +02:00
Olivier Goffart
6735b82326 Fix leak 2013-05-14 15:30:56 +02:00
Klaas Freitag
1a648a612e Merge remote-tracking branch 'ogoffart/rename_folders_merged' into dav 2013-05-13 16:28:31 +02:00
Klaas Freitag
f2f12a5629 Use %d for int variables in sprintf. 2013-05-13 15:30:01 +02:00
Klaas Freitag
885eaad729 Removed goto from code. 2013-05-13 15:29:29 +02:00
Klaas Freitag
cb0e06e7f8 Merge remote-tracking branch 'ogoffart/dav' into dav 2013-05-13 15:10:29 +02:00
Klaas Freitag
7b060a7af6 Do not create lock for ownCloud Client any more. 2013-05-13 14:03:33 +02:00
Olivier Goffart
28942e3051 Recreates the statedb if it was corrupted
Fixes: https://github.com/owncloud/mirall/issues/595

Some corruptions do not happen when the database is opened, but only on
some querries.
In that case, recreates the database if querries such as DROP or
CREATE fails.
2013-05-13 11:57:25 +02:00
Olivier Goffart
8f3e260ede fix typo
This broke the new propagator
2013-05-10 13:13:02 +02:00
Klaas Freitag
276ccd3fb6 Fix setting of csync error code in updater. 2013-05-09 14:12:26 +02:00
Daniel Molkentin
a75376e6a7 Rename csync_abort -> async_request_abort. Add csync_resume. 2013-05-08 17:33:50 +02:00
Daniel Molkentin
ee5aaf76c5 Introduce csync_abort()
If called, it will set a bool in the context,
which will be respected by all expensive visitors.
2013-05-08 16:57:12 +02:00
Olivier Goffart
3c87cd71d7 Merge branch 'rename_folders' into dav
Conflicts:
	modules/csync_owncloud.c
	src/csync.c
	src/csync.h
	src/csync_propagate.c
	src/csync_propagate.h
	src/csync_statedb.c
	src/csync_statedb.h
	src/csync_util.c
	src/std/c_path.h
2013-05-07 15:24:12 +02:00
Olivier Goffart
79818924b3 Fix httpbf when resuming uploads 2013-05-07 11:45:02 +02:00
Olivier Goffart
b1ac67ce8b Always consider that the conflict should happen on the locale
Don't take in account which file is newer, the conflict file will always
be on the locale side.

This patch also consider that INSTRUCTION_NEW and INSTRUCTION_EVAL means
the same.
2013-05-07 10:48:44 +02:00
Olivier Goffart
698edcc1c0 Revert "Fix httpbf test."
This reverts commit 460c5b067d.

We need to use %u for unsigned in otder to avoid the '-' to many to
appear in the transferid
2013-05-06 16:13:58 +02:00
Klaas Freitag
c61035f767 Put the lock file into the sync dir. 2013-05-04 16:10:11 +02:00
Klaas Freitag
54ed522bbe Check for null argument. 2013-05-04 16:08:49 +02:00
Klaas Freitag
84a28fa8f7 Merge remote-tracking branch 'ogoffart/dav' into dav 2013-05-04 13:24:21 +02:00
Klaas Freitag
cca965e288 get etag header out of PUT reply. 2013-05-04 13:23:05 +02:00
Klaas Freitag
1561032973 Handle http error code correctly, even if neon reports success. 2013-05-04 12:16:35 +02:00
Olivier Goffart
8c0dbb03e1 Install httpbf and make it possible to include the header in C++ code 2013-05-03 19:23:26 +02:00
Olivier Goffart
10443fc1e3 in walk tree, we can now change the md5
Also also in commit always assume that the propagate is done. it might
have been done by someone else
2013-05-03 19:23:26 +02:00
Olivier Goffart
b1fc9b2a64 Don't reset the md5 if the mtime change locally.
Consider this case when one creates a file with an invalid filename (for
the server) in a directory in the local side.
say: foo/bar/%invalid%.txt

The following would happen:
- in the update for the local parent folder  foo/bar/, the md5 is 0
  because the mtime has changed
- During the reconcile, we try to send %invalid%, but there will be an
  error and nothing will be changed on the server, the etags stay the
  same
- We do not do any PROPFIND at the end so we do not fetch the etag
  anymore.  The md5 is still 0 and will be saved like that in the DB
- Next run, since the etags have  not changed on the server, we read
  from the DB.  But a md5 of 0 in the DB means the folder was removed on
  the server.  That would remove the local folder (BAD!)

So we load the md5 from the db even if the local mtime change.
That means we need to compare the mtime in the local case rather than
the md5 to see if something has changed.
2013-05-03 19:21:21 +02:00
Olivier Goffart
b49aaaabfc Fix too many PROPFIND when starting a sync
csync would not update the etag (md5) for directoru in the database if
the etag has changed, but none of the files within that directory
actually changed
2013-05-03 19:21:21 +02:00
Olivier Goffart
cf23799e78 Only mark a folder as modified if files within it are modified. 2013-05-03 19:21:21 +02:00
Olivier Goffart
0b648dc669 Do not fetch folder id after propagation.
Delay that for the next sync.
2013-05-03 19:21:21 +02:00
Klaas Freitag
8ac8701c10 Fix httpbf upload of zero size files, incl. test for that case. 2013-04-26 17:40:24 +02:00
Klaas Freitag
ab17e2aa8b Revert "Don't include csync_version.h from csync.h"
This reverts commit 5cda5d523c.
2013-04-26 10:45:14 +02:00
Klaas Freitag
5cda5d523c Don't include csync_version.h from csync.h 2013-04-26 10:37:45 +02:00
Klaas Freitag
a1271a1db2 Rather store a ptr to the ptr to st for propagation_cleanup 2013-04-26 10:31:41 +02:00
Daniel Molkentin
776d5dfe37 Generate csync version from CMake variables 2013-04-25 12:32:01 +02:00
Olivier Goffart
959c987749 Fix storing the error of renames 2013-04-24 14:53:31 +02:00
Olivier Goffart
844c2bbafa Avoid double free 2013-04-24 14:53:31 +02:00
Olivier Goffart
eb38f5beb1 Don't reset the md5 if the mtime change locally.
Consider this case when one creates a file with an invalid filename (for
the server) in a directory in the local side.
say: foo/bar/%invalid%.txt

The following would happen:
- in the update for the local parent folder  foo/bar/, the md5 is 0
  because the mtime has changed
- During the reconcile, we try to send %invalid%, but there will be an
  error and nothing will be changed on the server, the etags stay the
  same
- We do not do any PROPFIND at the end so we do not fetch the etag
  anymore.  The md5 is still 0 and will be saved like that in the DB
- Next run, since the etags have  not changed on the server, we read
  from the DB.  But a md5 of 0 in the DB means the folder was removed on
  the server.  That would remove the local folder (BAD!)

So we load the md5 from the db even if the local mtime change.
That means we need to compare the mtime in the local case rather than
the md5 to see if something has changed.
2013-04-24 14:09:20 +02:00
Klaas Freitag
460c5b067d Fix httpbf test. 2013-04-23 17:17:31 +02:00
Klaas Freitag
374d9b0a8c Merge from feature branch csync_commit. 2013-04-22 15:39:43 +02:00
Klaas Freitag
2f6441afb0 Do not use asprintf any more, added missing header. 2013-04-22 14:30:57 +02:00
Klaas Freitag
c46371b469 Push WIN32 preprocessor derectives to csync_lock.c. 2013-04-22 14:30:12 +02:00
Klaas Freitag
072edefc7b Use __mingw_asprintf if asprintf is not available. 2013-04-22 13:51:53 +02:00
Klaas Freitag
4bdabb7f46 Added a module commit function. 2013-04-22 13:51:44 +02:00
Klaas Freitag
19f6b919af Use __mingw_asprintf if asprintf is not available. 2013-04-22 13:50:59 +02:00
Klaas Freitag
64927899af Use pointer to stat struct for id_list. 2013-04-22 10:22:20 +02:00
Klaas Freitag
a496bb0e13 Fix memleak with id_list - WIP 2013-04-20 13:06:59 +03:00
Klaas Freitag
275c18df82 Added csync_commit to be able to reuse the csync context. 2013-04-20 12:11:16 +03:00
Klaas Freitag
0d238ae1fe Allow to set progress- and log-callback any time. 2013-04-20 12:10:45 +03:00
Klaas Freitag
66d8f8b0db Added csync_commit to be able to reuse the csync context. 2013-04-20 11:51:27 +03:00
Klaas Freitag
0c5cdc2105 Allow to set progress- and log-callback any time. 2013-04-20 11:50:13 +03:00
Klaas Freitag
84f425a326 Remove WIN32 preprocessor directive from csync.c. 2013-04-20 11:38:25 +03:00
Olivier Goffart
112285c9aa Fix too many PROPFIND when starting a sync
csync would not update the etag (md5) for directoru in the database if
the etag has changed, but none of the files within that directory
actually changed
2013-04-17 16:25:52 +02:00
Klaas Freitag
2b971a09f3 Make httpbf tests functional. 2013-04-17 15:21:38 +02:00
Klaas Freitag
35aaddda87 Added check on changes on the source file when uploading. 2013-04-16 16:27:40 +02:00
Klaas Freitag
24a562da49 More meaningful logging of read db fails. 2013-04-15 17:50:40 +02:00
Klaas Freitag
847c223408 More meaningful logging of read db fails. 2013-04-15 17:47:50 +02:00
Klaas Freitag
84febf4b77 Merge branch 'dav_0.70.5' into dav 2013-04-15 15:37:17 +02:00
Klaas Freitag
da52acbec6 Add FindPackage to httpbf module. 2013-04-15 15:32:21 +02:00
Klaas Freitag
8b52387c1a Fix temp file name generation for Win32. 2013-04-15 13:24:46 +02:00
Klaas Freitag
7171da53e8 Check that file is unchanged before copying in propagator. 2013-04-09 16:43:21 +02:00
Klaas Freitag
2a5c403d63 Default timeout to 300 seconds. 2013-04-09 15:18:26 +02:00
Klaas Freitag
c38514934c A good word. 2013-04-09 14:41:36 +02:00
Klaas Freitag
90c4f52b34 Handle IGNORE status correctly. 2013-04-09 11:12:17 +02:00
Klaas Freitag
e93bf9fa0a Fix for Coverity CID #996823 2013-04-09 09:42:38 +02:00
Daniel Molkentin
aa390dd17e Set path and phash for ignored files 2013-04-08 14:21:00 +02:00
Klaas Freitag
1585cab673 Compare to explicit NULL for clearer code. 2013-04-08 09:11:25 +02:00
Klaas Freitag
5de0173804 Fix for Coverity CID #996824 2013-04-05 15:08:28 +02:00
Klaas Freitag
5d5ee328b0 Fix for Coverity CID #996825 2013-04-05 15:05:44 +02:00
Daniel Molkentin
28aa1448c1 Remove superfluous frees. 2013-04-04 18:31:01 +02:00
Klaas Freitag
ec51a6933a Improve c_tmpname function to generate tmp name properly. 2013-04-04 12:59:39 +02:00
Klaas Freitag
093b166319 Rename pi to progress_info. 2013-04-04 12:58:29 +02:00
Klaas Freitag
815f652f08 Move tmpname generation to utility function c_tmpname for cleander code. 2013-04-04 12:57:44 +02:00
Klaas Freitag
0bea2ea8f9 Push len computing to the right place. 2013-04-03 16:38:35 +02:00
Olivier Goffart
9939e325cf Fix crash when setting a NULL error 2013-04-03 10:53:20 +02:00
Klaas Freitag
34668e42b3 Merge branch 'dav_0.70.5' into dav - WIP
Conflicts:
	CMakeLists.txt
	CPackConfig.cmake
	src/csync.h
	src/csync_update.c
	tests/ownCloud/t1.pl
2013-04-02 14:44:01 +02:00
Olivier Goffart
296011436a Store the error string in the database when blacklisting 2013-03-28 13:54:01 +01:00
Olivier Goffart
6659ee6d76 store the error string for files in the tree 2013-03-28 13:54:01 +01:00
Klaas Freitag
4b98ee0644 Pushed version to 0.70.6 2013-03-28 09:57:49 +01:00
Klaas Freitag
6f3168e88a Added function to retrieve http error code and fix return value check. 2013-03-27 18:05:50 +01:00
Klaas Freitag
b826d59925 Make VIO_METHOD_HAS_FUNC macro more robust. 2013-03-26 12:39:52 +01:00
Klaas Freitag
5e0e42baaf Make VIO_METHOD_HAS_FUNC macro more robust. 2013-03-26 12:35:35 +01:00
Klaas Freitag
5951039894 Improved C style and added more tests. 2013-03-26 12:01:48 +01:00
Klaas Freitag
a84332c910 Improved C style and added more tests. 2013-03-26 12:00:57 +01:00
Klaas Freitag
79c51540da Check for file equalness after having created a conflict file.
If the files are equal and the conflict was created because the
timestamps were screwed the conflict is removed again. This only
works on the local repository so far.

Conflicts:
	src/csync_propagate.c
2013-03-26 11:57:32 +01:00
Klaas Freitag
0baa80c235 Test added for c_compare_file. 2013-03-26 11:53:14 +01:00
Klaas Freitag
a71aef1731 Added c_compare_file function and test - WIP. 2013-03-26 11:52:46 +01:00
Klaas Freitag
6aec7f4211 Push context to module to make logging of the module work. 2013-03-26 10:05:15 +01:00
Klaas Freitag
ef7c5c261d Fix memory allocation for path. 2013-03-22 21:48:01 +01:00
Klaas Freitag
43fa6e4418 Check for file equalness after having created a conflict file.
If the files are equal and the conflict was created because the
timestamps were screwed the conflict is removed again. This only
works on the local repository so far.
2013-03-22 21:04:09 +01:00
Klaas Freitag
5657ff3d34 Fix: set path correctly. 2013-03-22 16:29:04 +01:00
Klaas Freitag
a3f29967f7 Test added for c_compare_file. 2013-03-22 13:54:46 +01:00