Commit graph

960 commits

Author SHA1 Message Date
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
Klaas Freitag
7b7ce3a43c Remove versions table before new creation. 2013-03-22 11:04:04 +01:00
Klaas Freitag
3ce614039a Added c_compare_file function and test - WIP. 2013-03-22 10:23:17 +01:00
Klaas Freitag
19f07f9aea Handle non statable files correctly, read missing info from db. 2013-03-20 21:56:09 +01:00
Klaas Freitag
945be9438c Avoid variable name new to not confuse syntax highlighter. 2013-03-20 21:55:34 +01:00
Daniel Molkentin
abe53a8669 Do not define NDEBUG manually 2013-03-19 17:50:43 +01:00
Klaas Freitag
b82c156c7e Bump version to 0.70.5 2013-03-19 16:23:10 +01:00
Klaas Freitag
d117593fd1 Fix a const char warning. 2013-03-19 16:23:05 +01:00
Klaas Freitag
5a8d90cc25 Fix path handling in update routine. 2013-03-19 16:22:11 +01:00
Klaas Freitag
db70a3b2ae Skip files which are not statable and ignore links and such. 2013-03-19 14:20:38 +01:00
Klaas Freitag
e3a4ec453c Handle non statable files gracefully. 2013-03-19 14:20:03 +01:00
Klaas Freitag
f88e9baf15 Handle renames in read only shares correctly. 2013-03-19 14:18:34 +01:00
Andreas Schneider
df2a04b4ab misc: Include stdio.h for snprintf. 2013-03-19 14:18:12 +01:00
Andreas Schneider
061fa6cc1b misc: Correctly handle getenv().
The returned string of getenv() has an unknown size. You need to store
the result always in a char array with a certain size to make sure we
don't feed tainted data to the next function call.
2013-03-19 14:17:44 +01:00
Klaas Freitag
13c44ad25c Skip files which are not statable and ignore links and such. 2013-03-19 14:02:12 +01:00
Klaas Freitag
d943b2880a Handle non statable files gracefully. 2013-03-19 11:48:46 +01:00
Klaas Freitag
d865905743 Use proper HBF result code. 2013-03-14 13:42:02 +01:00
Klaas Freitag
7630ab5807 Moved variable declaration. 2013-03-14 13:41:27 +01:00
Klaas Freitag
c263532ba3 Merge remote-tracking branch 'ogoffart/davbf' into dav 2013-03-14 13:36:55 +01:00
Klaas Freitag
38946ed025 More detailed error handling if one chunk fails. 2013-03-14 13:15:45 +01:00
Klaas Freitag
0ab1a4aeeb Make chunk default size 10 MB 2013-03-14 13:15:21 +01:00
Klaas Freitag
dd74b12b48 Merge remote-tracking branch 'ogoffart/davbf' into dav 2013-03-13 17:13:42 +01:00
Olivier Goffart
2205c9a339 Resume chunked upload if conneciton is lost 2013-03-12 11:42:17 +01:00
Olivier Goffart
b4ec9f887c Do not fetch folder id after propagation.
Delay that for the next sync.

(cherry picked from commit 1eb534dd53)
2013-03-11 20:38:17 +01:00
Olivier Goffart
b99677f985 Only mark a folder as modified if files within it are modified. 2013-03-11 20:38:17 +01:00
Olivier Goffart
6a5ad6e81e Revert "Do not fetch folder id after propagation."
This reverts commit 1eb534dd53.

Because folder re-appears in some cases
(IL issue #143)
2013-03-08 17:47:39 +01:00
Olivier Goffart
e05b44b06d Fix blacklist with renamed files
When renaming blacklisted files, we still need to find the other node to
mark the error
2013-03-07 11:07:38 +01:00
Klaas Freitag
47b1e64059 Handle renames in read only shares correctly. 2013-03-06 16:00:28 +01:00
Olivier Goffart
1eb534dd53 Do not fetch folder id after propagation.
Delay that for the next sync.
2013-03-05 20:33:18 +01:00
Andreas Schneider
8d43a743a1 misc: Include stdio.h for snprintf. 2013-03-05 10:49:08 +01:00
Andreas Schneider
3041e73b0a misc: Correctly handle getenv().
The returned string of getenv() has an unknown size. You need to store
the result always in a char array with a certain size to make sure we
don't feed tainted data to the next function call.
2013-03-05 10:43:28 +01:00
Olivier Goffart
d6a6fb0d67 Keep the tmp file and resume from it 2013-03-02 15:02:27 +01:00
Olivier Goffart
53ad4a910f Progress database:
Remember about errors, and don't retry if there is more than 3 errors

Conflicts:
	src/csync_propagate.c
2013-03-02 15:01:40 +01:00
Olivier Goffart
0906312c02 Merge remote-tracking branch 'freitag/dav' into davbf 2013-03-02 13:43:59 +01:00
Olivier Goffart
259b6050bf Progress database:
Remember about errors, and don't retry if there is more than 3 errors
2013-03-01 12:31:20 +01:00
Olivier Goffart
355a807775 Fix removing of folder when the folder is locked on windows.
When the folder is locked on windows, rmdir fails and the folmder is not
removed.  But on the next sync, one should try to remove that folder again, and
not upload it to the server as we did before.

There was two problems:

1- The removed folder is still in the DB, so when csync_update read from
DB, for the remote, it still finds it.  Fix that by storing an empty MD5
for directories that should have been deleted.

2- The folder is likely to be modified since its contents are gone.
Which means next sync will try to sync it back to the server.
Fix that by refreshing the mtime in the tree
2013-02-25 11:32:32 +01:00
Klaas Freitag
b216b9f546 Push version to 0.70.4 2013-02-20 17:39:16 +01:00
Klaas Freitag
3d4b426137 Removed some useless logging. 2013-02-19 09:40:14 +01:00
Olivier Goffart
ca34c4fd5f Fix removing of folder when the folder is locked on windows.
When the folder is locked on windows, rmdir fails and the folmder is not
removed.  But on the next sync, one should try to remove that folder again, and
not upload it to the server as we did before.

There was two problems:

1- The removed folder is still in the DB, so when csync_update read from
DB, for the remote, it still finds it.  Fix that by storing an empty MD5
for directories that should have been deleted.

2- The folder is likely to be modified since its contents are gone.
Which means next sync will try to sync it back to the server.
Fix that by refreshing the mtime in the tree
2013-02-13 19:20:26 +01:00
Olivier Goffart
b6a37064e9 Allow to configure the timeout in the config 2013-02-13 18:25:28 +01:00
Klaas Freitag
7d1d880a9b Return a proper error code in case the file is locked on win32. 2013-02-13 12:38:50 +02:00
Olivier Goffart
b028c64325 In case of error dirring a rename, mark the source as updated
That way, the file will be saved in the DB again, and the next try, it
will retry to rename
2013-02-12 15:11:15 +01:00
Olivier Goffart
8646246e75 Also report the error for the other node in case of error 2013-02-08 21:51:03 +01:00
Klaas Freitag
a79c380707 Remove strange _tcslen define and fixed some potential leaks. 2013-02-07 14:45:12 +02:00
Olivier Goffart
2615205adc Fix renaming folder when a file was modified by another client 2013-02-06 18:40:03 +01:00
Olivier Goffart
170e5389b3 Do not issue a rename when the file was modified localy 2013-02-06 18:40:03 +01:00
Olivier Goffart
71caa3356c Automatically creates the destination folder if it does not exist 2013-02-06 18:40:02 +01:00
Olivier Goffart
0cf770017d Do not abort when move fail 2013-02-06 18:40:02 +01:00
Olivier Goffart
77a25eafbb remove wrong comments 2013-02-06 18:40:02 +01:00
Olivier Goffart
fe756799d2 Make it work when renaming a directory and a subdirectory at the same
time
2013-02-06 18:40:02 +01:00
Olivier Goffart
0c874f0c3c fix some issues while moving. Now it works in simple cases 2013-02-06 18:40:02 +01:00
Olivier Goffart
3793d725a7 avoid double free 2013-02-06 18:40:02 +01:00
Olivier Goffart
77d77ff056 Compile the header with a C++ compiler
template is a keyword in C++
2013-02-06 18:40:02 +01:00
Olivier Goffart
d88c58deae WIP: rename folders 2013-02-06 18:40:02 +01:00
Olivier Goffart
bdd331ee08 Allow to configure the timeout in the config 2013-02-06 18:38:46 +01:00
Olivier Goffart
53b1edd1dc httpbf: Make sure to use unsigned number as the id
Else, we can have filename like  foo-chunking--1234-4-0 and the double
dash make the serverside regexp fail
2013-01-29 16:23:55 +01:00
Olivier Goffart
e75f11b87a Use httpbf in owncloud 2013-01-29 16:23:28 +01:00
Klaas Freitag
e134c85ae7 Initial checkin of the http-big-file handling. 2013-01-28 21:17:23 +01:00
Klaas Freitag
52f33de902 Set version to 0.70.3 plus ChangeLog 2013-01-24 10:39:42 +01:00
Klaas Freitag
460947a3ac Set version to 0.70.2 for release 2013-01-23 14:05:58 +01:00
Klaas Freitag
96f9c09e35 Fix a crash for the case that csync_init fails. 2013-01-22 16:48:36 +01:00
Klaas Freitag
82a3e49d82 Bump version to 0.70.1 for oCC 1.2.0 beta2 2013-01-16 16:37:09 +01:00
Klaas Freitag
ccc9419a58 Reduce the sqlite_compile errors dramatically. 2013-01-16 16:27:59 +01:00
Klaas Freitag
0752aff55a Handle 405 as EPERM rather than EEXIST 2013-01-16 11:42:13 +01:00
Klaas Freitag
23fe05604b Added new error types for service unavail, quoto and file too big. 2013-01-13 21:39:54 +01:00
Olivier Goffart
3b4b500d4f leak fix 2013-01-10 11:32:42 +01:00
Olivier Goffart
de87ed2d31 Make it a error when the file cannot be created
Mark it a an error when the file cannot be created because the folder
cannot be created.

Should display errors on windows if the file is too long
2013-01-10 11:32:42 +01:00
Olivier Goffart
97e0e75ae2 Missing errno code on mingw 2013-01-10 11:32:42 +01:00
Olivier Goffart
6f1e70aae6 Always use the db even if the mtime change localy.
As long as the md5 is the same, use the db, even if the mtime change
localy.
2013-01-10 11:32:42 +01:00
Olivier Goffart
c8e274110a Don't abort in merge_tree if the file don't exist
Scenario:
We have  A/B/C/file.txt
mv A/B/{C,C2}
start sync, and before sync ends
mv A A2
then as sync start and we try to merge, since it is no longer possible
to stat A/B/ which has been updated as C was moved, then the database
would not be synced
then start sync again and A/B/C2/file.txt is seen as new, and is
duplicated

By saving the database anyhow we work around that problem
2013-01-10 11:32:41 +01:00
Olivier Goffart
5b8917672c Only do the correctId after both the remote and the local have been processed
It is important if there are operations such as delete, which operate on
the remote tree, and thet may also invalidate the id we got on the
localtree (for example, the parent directory of a removed file)
2013-01-10 11:32:27 +01:00
Olivier Goffart
b23d15eb11 csync_tree_walk: let the visitor change the instruction 2013-01-10 11:32:20 +01:00
Olivier Goffart
9998c7cde1 Do not fetch the id in _csync_sync_dir
But rather at then end
2013-01-10 11:28:01 +01:00
Olivier Goffart
0cf1061248 Reduce the number of stat when creating new directory.
Do not do a stat before, it is unlikely that it succeed, and if it does
indeed show there is a file with the same name, the following mkdir ill
fail properly

(The only difference will be that EEXIST will be returned instead of
ENOTDIR
2013-01-10 11:27:52 +01:00
Olivier Goffart
9261f66fd8 Do not fetch the id of new directory in _csync_new_dir
Delay the id update to after when we do all the directory. When we
create ne directory it is likely that there will be something inside.
2013-01-10 11:21:12 +01:00
Olivier Goffart
00ee9f4960 leak fix 2013-01-10 11:18:54 +01:00
Klaas Freitag
96eb138410 Make big file support working for win32. 2013-01-09 15:06:03 +01:00
Klaas Freitag
5e4c0acc6b Use wide char variable to remove directory. 2013-01-09 15:02:07 +01:00
Klaas Freitag
c2844b0545 Added csync_get_error_string function to provide backend errors. 2012-12-20 20:47:10 +01:00
Klaas Freitag
70e89720d5 Some code cleanups, removed not needed stuff. 2012-12-20 17:10:03 +01:00
Klaas Freitag
d6287fb5e3 fix win32 build, ifdefed non existing errnos. 2012-12-19 20:20:26 +01:00
Klaas Freitag
3343601179 Remove temp files if GET fails, fixes owncloud/mirall#194 2012-12-19 12:41:16 +01:00
Klaas Freitag
e5b95540e7 drop not longer needed case statement. 2012-12-19 12:31:56 +01:00
Klaas Freitag
fe048f69cd Set version to upcoming version 0.70.0 2012-12-18 13:50:56 +01:00
Klaas Freitag
bbf4e07579 Proper errno to csync error conversion, more errno fixes in oC module. 2012-12-17 17:22:24 +01:00
Klaas Freitag
ecf09c4077 Added error_string handling with modules 2012-12-14 16:49:03 +01:00
Klaas Freitag
e3ef10765b Avoid a compile warning. 2012-12-14 16:49:03 +01:00
Olivier Goffart
5bc95e1667 Fix memory leak 2012-12-14 11:19:14 +01:00
Olivier Goffart
c09461a9e4 After a move, we also need to refresh the id of the destination folders
Else, the id are not good, and if we move folders like this:
 mv folderA folderB
 csync
 mv folderB folderC
 csync
we want that the first sync refresh correctly the folderB id so that the
second sync do not re-create folderB

When working on the renamed path, we are on the remote tree, but the new
folder is only on the local tree.  hence the 'tree' passed to the helper
function is not the same.
2012-12-14 00:14:44 +01:00
Olivier Goffart
10965eaa98 Fix renaming if the other file already exist on the server.
In that case, we have a conflict.  Handle it the same ways as for new
files.
2012-12-12 14:20:48 +01:00
Olivier Goffart
4e8ff9ae05 Fix end of file.
csync_util.c:347:1: error: no newline at end of file [-Werror,-pedantic,-Wnewline-eof]
2012-12-12 14:20:48 +01:00
Klaas Freitag
654e87a9d5 Fix temp name creation: Place dot correctly for hidden files. 2012-12-12 14:18:30 +01:00
Markus Goetz
316fd7b036 Exclude: Tell which file we load 2012-12-11 17:28:37 +01:00
Markus Goetz
fded216fb6 Propagate: Fix file name pattern
Starting with dot on Windows is a bad idea
2012-12-11 17:26:46 +01:00
Daniel Molkentin
1507ca2eaf Split download state 2012-12-11 12:09:33 +01:00
Klaas Freitag
8ed89bca86 Hide temp files for download to local. 2012-12-11 11:35:38 +01:00
Klaas Freitag
1705a309b2 Merge remote-tracking branch 'ogoffart/dav' into dav 2012-12-10 21:16:05 +01:00
Klaas Freitag
faa1b83e9e Fixed rename function to use TCHAR. 2012-12-10 21:15:31 +01:00
Klaas Freitag
64683332c7 Remove wrong comment. 2012-12-10 20:49:08 +01:00
Markus Goetz
42b090ec0d Propagate: Change temp file name
.. to something already in the exclude list
2012-12-10 19:15:16 +01:00
Markus Goetz
885e073b8a Win32: Hide file while downloading 2012-12-10 19:15:16 +01:00