[Pkg-owncloud-commits] [owncloud-client] 79/333: csync: Remove time_sync_required
Sandro Knauß
hefee-guest at moszumanska.debian.org
Thu Apr 17 23:16:36 UTC 2014
This is an automated email from the git hooks/post-receive script.
hefee-guest pushed a commit to branch master
in repository owncloud-client.
commit eff2427a034c3840131da51b253c4951b3a7ff24
Author: Markus Goetz <markus at woboq.com>
Date: Thu Feb 27 13:12:21 2014 +0100
csync: Remove time_sync_required
---
csync/src/csync.c | 19 -------
csync/src/csync_owncloud.c | 3 +-
csync/src/csync_time.c | 111 ---------------------------------------
csync/src/csync_time.h | 1 -
csync/src/vio/csync_vio.c | 3 --
csync/src/vio/csync_vio_method.h | 1 -
6 files changed, 1 insertion(+), 137 deletions(-)
diff --git a/csync/src/csync.c b/csync/src/csync.c
index 2a2a56c..6ac8c27 100644
--- a/csync/src/csync.c
+++ b/csync/src/csync.c
@@ -225,25 +225,6 @@ retry_vio_init:
}
if(!ctx->options.local_only_mode) {
- if(ctx->module.capabilities.time_sync_required) {
- timediff = csync_timediff(ctx);
- if (timediff > ctx->options.max_time_difference) {
- CSYNC_LOG(CSYNC_LOG_PRIORITY_FATAL,
- "Clock skew detected. The time difference is greater than %d seconds!",
- ctx->options.max_time_difference);
- ctx->status_code = CSYNC_STATUS_TIMESKEW;
- rc = -1;
- goto out;
- } else if (timediff < 0) {
- CSYNC_LOG(CSYNC_LOG_PRIORITY_FATAL, "Synchronisation is not possible!");
- ctx->status_code = CSYNC_STATUS_TIMESKEW;
- rc = -1;
- goto out;
- }
- } else {
- CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "Module does not need time synchronization.");
- }
-
if(ctx->module.capabilities.unix_extensions == -1) { /* detect */
if (csync_unix_extensions(ctx) < 0) {
CSYNC_LOG(CSYNC_LOG_PRIORITY_FATAL, "Could not detect filesystem type.");
diff --git a/csync/src/csync_owncloud.c b/csync/src/csync_owncloud.c
index 6243323..33a49a6 100644
--- a/csync/src/csync_owncloud.c
+++ b/csync/src/csync_owncloud.c
@@ -894,11 +894,10 @@ static int owncloud_stat(const char *uri, csync_vio_file_stat_t *buf) {
/* capabilities are currently:
* bool atomar_copy_support - oC provides atomar copy
* bool do_post_copy_stat - oC does not want the post copy check
- * bool time_sync_required - oC does not require the time sync
* int unix_extensions - oC supports unix extensions.
* bool propagate_on_fd - oC supports the send_file method.
*/
-static csync_vio_capabilities_t _owncloud_capabilities = { true, false, false, 0, true, false, false };
+static csync_vio_capabilities_t _owncloud_capabilities = { true, false, 0, true, false, false };
static csync_vio_capabilities_t *owncloud_capabilities(void)
{
diff --git a/csync/src/csync_time.c b/csync/src/csync_time.c
index 038a264..48e33c1 100644
--- a/csync/src/csync_time.c
+++ b/csync/src/csync_time.c
@@ -62,115 +62,4 @@ int csync_gettime(struct timespec *tp)
#undef CSYNC_CLOCK
-/* check time difference between the replicas */
-time_t csync_timediff(CSYNC *ctx) {
- time_t timediff = -1;
- char errbuf[256] = {0};
- char *luri = NULL;
- char *ruri = NULL;
- csync_vio_handle_t *fp = NULL;
- csync_vio_file_stat_t *st = NULL;
- csync_vio_handle_t *dp = NULL;
-
- /* try to open remote dir to get auth */
- ctx->replica = ctx->remote.type;
- dp = csync_vio_opendir(ctx, ctx->remote.uri);
- if (dp == NULL) {
- /*
- * To prevent problems especially with pam_csync we shouldn't try to create the
- * remote directory here. Just fail!
- */
- C_STRERROR(errno, errbuf, sizeof(errbuf));
- CSYNC_LOG(CSYNC_LOG_PRIORITY_FATAL,
- "Access dienied to remote uri: %s - %s",
- ctx->remote.uri,
- errbuf);
- ctx->status_code = CSYNC_STATUS_REMOTE_ACCESS_ERROR;
- return -1;
- }
- csync_vio_closedir(ctx, dp);
-
- if (asprintf(&luri, "%s/.csync_timediff.ctmp", ctx->local.uri) < 0) {
- goto out;
- }
-
- if (asprintf(&ruri, "%s/.csync_timediff.ctmp", ctx->remote.uri) < 0) {
- goto out;
- }
-
- /* create temporary file on local */
- ctx->replica = ctx->local.type;
- fp = csync_vio_creat(ctx, luri, 0644);
- if (fp == NULL) {
- C_STRERROR(errno, errbuf, sizeof(errbuf));
- CSYNC_LOG(CSYNC_LOG_PRIORITY_FATAL,
- "Unable to create temporary file: %s - %s",
- luri,
- errbuf);
- ctx->status_code = CSYNC_STATUS_LOCAL_CREATE_ERROR;
- goto out;
- }
- csync_vio_close(ctx, fp);
-
- /* Get the modification time */
- st = csync_vio_file_stat_new();
- if (csync_vio_stat(ctx, luri, st) < 0) {
- C_STRERROR(errno, errbuf, sizeof(errbuf));
- CSYNC_LOG(CSYNC_LOG_PRIORITY_FATAL,
- "Synchronisation is not possible! %s - %s",
- luri,
- errbuf);
- ctx->status_code = CSYNC_STATUS_LOCAL_STAT_ERROR;
- goto out;
- }
- timediff = st->mtime;
- csync_vio_file_stat_destroy(st);
- st = NULL;
-
- /* create temporary file on remote replica */
- ctx->replica = ctx->remote.type;
-
- fp = csync_vio_creat(ctx, ruri, 0644);
- if (fp == NULL) {
- C_STRERROR(errno, errbuf, sizeof(errbuf));
- CSYNC_LOG(CSYNC_LOG_PRIORITY_FATAL,
- "Unable to create temporary file: %s - %s",
- ruri,
- errbuf);
- ctx->status_code = CSYNC_STATUS_REMOTE_CREATE_ERROR;
- goto out;
- }
- csync_vio_close(ctx, fp);
-
- /* Get the modification time */
- st = csync_vio_file_stat_new();
- if (csync_vio_stat(ctx, ruri, st) < 0) {
- C_STRERROR(errno, errbuf, sizeof(errbuf));
- CSYNC_LOG(CSYNC_LOG_PRIORITY_FATAL,
- "Synchronisation is not possible! %s - %s",
- ruri,
- errbuf);
- ctx->status_code = CSYNC_STATUS_REMOTE_STAT_ERROR;
- goto out;
- }
-
- /* calc time difference */
- timediff = llabs(timediff - st->mtime);
- CSYNC_LOG(CSYNC_LOG_PRIORITY_DEBUG, "Time difference: %ld seconds", timediff);
-
-out:
- csync_vio_file_stat_destroy(st);
-
- ctx->replica = ctx->local.type;
- csync_vio_unlink(ctx, luri);
- SAFE_FREE(luri);
-
- ctx->replica = ctx->remote.type;
- csync_vio_unlink(ctx, ruri);
- SAFE_FREE(ruri);
-
- return timediff;
-}
-
-
/* vim: set ts=8 sw=2 et cindent: */
diff --git a/csync/src/csync_time.h b/csync/src/csync_time.h
index b0b423a..fe91bab 100644
--- a/csync/src/csync_time.h
+++ b/csync/src/csync_time.h
@@ -26,6 +26,5 @@
#include "csync_private.h"
int csync_gettime(struct timespec *tp);
-time_t csync_timediff(CSYNC *ctx);
#endif /* _CSYNC_TIME_H */
diff --git a/csync/src/vio/csync_vio.c b/csync/src/vio/csync_vio.c
index 9265bac..0318f0d 100644
--- a/csync/src/vio/csync_vio.c
+++ b/csync/src/vio/csync_vio.c
@@ -73,7 +73,6 @@ int csync_vio_init(CSYNC *ctx, const char *module, const char *args) {
/* Useful defaults to the module capabilities */
ctx->module.capabilities.atomar_copy_support = false;
ctx->module.capabilities.do_post_copy_stat = true;
- ctx->module.capabilities.time_sync_required = true;
ctx->module.capabilities.unix_extensions = -1; /* detect automatically */
ctx->module.capabilities.use_send_file_to_propagate = false; /* do use read/write by default */
@@ -86,8 +85,6 @@ int csync_vio_init(CSYNC *ctx, const char *module, const char *args) {
ctx->module.capabilities.atomar_copy_support ? "yes": "no");
CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "capabilities: post copy stat: %s",
ctx->module.capabilities.do_post_copy_stat ? "yes": "no");
- CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "capabilities: time sync required: %s",
- ctx->module.capabilities.time_sync_required ? "yes": "no");
CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "capabilities: unix extensions: %d",
ctx->module.capabilities.unix_extensions );
CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "capabilities: use send_file: %s",
diff --git a/csync/src/vio/csync_vio_method.h b/csync/src/vio/csync_vio_method.h
index dbd91b2..931ba42 100644
--- a/csync/src/vio/csync_vio_method.h
+++ b/csync/src/vio/csync_vio_method.h
@@ -38,7 +38,6 @@ typedef struct csync_vio_method_s csync_vio_method_t;
struct csync_vio_capabilities_s {
bool atomar_copy_support; /* set to true if the backend provides atomar copy */
bool do_post_copy_stat; /* true if csync should check the copy afterwards */
- bool time_sync_required; /* true if local and remote need to be time synced */
int unix_extensions; /* -1: do csync detection, 0: no unix extensions,
1: extensions available */
bool use_send_file_to_propagate; /* if set, the module rather copies files using send_file than read and write */
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git
More information about the Pkg-owncloud-commits
mailing list