Remove support for property 'Execute'.
This commit is contained in:
parent
d18fd120ed
commit
03b620d90f
@ -1,6 +1,10 @@
|
|||||||
ChangeLog for davfs2
|
ChangeLog for davfs2
|
||||||
--------------------
|
--------------------
|
||||||
|
|
||||||
|
2013-08-12 Werner Baumann (werner.baumann@onlinehome.de)
|
||||||
|
* cache.c, webdav.c, webdav.h:
|
||||||
|
Remove support for property 'Execute'.
|
||||||
|
|
||||||
2013-08-12 Werner Baumann (werner.baumann@onlinehome.de)
|
2013-08-12 Werner Baumann (werner.baumann@onlinehome.de)
|
||||||
* cache.c, defaults.h:
|
* cache.c, defaults.h:
|
||||||
Fix default modes.
|
Fix default modes.
|
||||||
|
76
src/cache.c
76
src/cache.c
@ -753,12 +753,8 @@ dav_tidy_cache(void)
|
|||||||
&& item-> save_at <= time(NULL)) {
|
&& item-> save_at <= time(NULL)) {
|
||||||
if (debug)
|
if (debug)
|
||||||
syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "tidy: %s", node->path);
|
syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "tidy: %s", node->path);
|
||||||
int set_execute = -1;
|
|
||||||
if (is_created(node) && node->mode & (S_IXUSR | S_IXGRP | S_IXOTH))
|
|
||||||
set_execute = 1;
|
|
||||||
int ret = dav_put(node->path, node->cache_path, &node->remote_exists,
|
int ret = dav_put(node->path, node->cache_path, &node->remote_exists,
|
||||||
&node->lock_expire, &node->etag, &node->smtime,
|
&node->lock_expire, &node->etag, &node->smtime);
|
||||||
set_execute);
|
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
node->utime = time(NULL);
|
node->utime = time(NULL);
|
||||||
node->dirty = 0;
|
node->dirty = 0;
|
||||||
@ -846,12 +842,8 @@ dav_close(dav_node *node, int fd, int flags, pid_t pid, pid_t pgid)
|
|||||||
|
|
||||||
if (delay_upload == 0 && (is_dirty(node) || is_created(node))
|
if (delay_upload == 0 && (is_dirty(node) || is_created(node))
|
||||||
&& !is_open_write(node) && !is_backup(node)) {
|
&& !is_open_write(node) && !is_backup(node)) {
|
||||||
int set_execute = -1;
|
|
||||||
if (is_created(node) && node->mode & (S_IXUSR | S_IXGRP | S_IXOTH))
|
|
||||||
set_execute = 1;
|
|
||||||
int ret = dav_put(node->path, node->cache_path, &node->remote_exists,
|
int ret = dav_put(node->path, node->cache_path, &node->remote_exists,
|
||||||
&node->lock_expire, &node->etag, &node->smtime,
|
&node->lock_expire, &node->etag, &node->smtime);
|
||||||
set_execute);
|
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
node->utime = time(NULL);
|
node->utime = time(NULL);
|
||||||
node->dirty = 0;
|
node->dirty = 0;
|
||||||
@ -1410,37 +1402,8 @@ dav_setattr(dav_node *node, uid_t uid, int sm, mode_t mode, int so,
|
|||||||
if (sg)
|
if (sg)
|
||||||
node->gid = gid;
|
node->gid = gid;
|
||||||
|
|
||||||
if (sm) {
|
if (sm)
|
||||||
if (!is_backup(node) && !is_created(node)) {
|
|
||||||
int set_execute = -1;
|
|
||||||
if ((node->mode & (S_IXUSR | S_IXGRP | S_IXOTH))
|
|
||||||
&& !(mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
|
|
||||||
set_execute = 0;
|
|
||||||
if (!(node->mode & (S_IXUSR | S_IXGRP | S_IXOTH))
|
|
||||||
&& (mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
|
|
||||||
set_execute = 1;
|
|
||||||
if (set_execute != -1) {
|
|
||||||
if (is_dirty(node) && !is_locked(node)) {
|
|
||||||
int err = 0;
|
|
||||||
time_t smtime = 0;
|
|
||||||
char *etag = NULL;
|
|
||||||
dav_head(node->path, &etag, &smtime, NULL);
|
|
||||||
if (etag && node->etag && strcmp(etag, node->etag) != 0)
|
|
||||||
err = EIO;
|
|
||||||
if (smtime && smtime > node->smtime)
|
|
||||||
err = EIO;
|
|
||||||
if (etag)
|
|
||||||
free(etag);
|
|
||||||
if (err)
|
|
||||||
return EIO;
|
|
||||||
}
|
|
||||||
dav_set_execute(node->path, set_execute);
|
|
||||||
if (is_dirty(node))
|
|
||||||
dav_head(node->path, &node->etag, &node->smtime, NULL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
node->mode = (node->mode & ~DAV_A_MASK) | mode;
|
node->mode = (node->mode & ~DAV_A_MASK) | mode;
|
||||||
}
|
|
||||||
|
|
||||||
if (sat)
|
if (sat)
|
||||||
node->atime = atime;
|
node->atime = atime;
|
||||||
@ -1549,13 +1512,6 @@ add_node(dav_node *parent, dav_props *props)
|
|||||||
node = new_node(parent, default_file_mode);
|
node = new_node(parent, default_file_mode);
|
||||||
node->size = props->size;
|
node->size = props->size;
|
||||||
node->remote_exists = 1;
|
node->remote_exists = 1;
|
||||||
if (props->is_exec == 1) {
|
|
||||||
node->mode |= (node->mode & S_IRUSR) ? S_IXUSR : 0;
|
|
||||||
node->mode |= (node->mode & S_IRGRP) ? S_IXGRP : 0;
|
|
||||||
node->mode |= (node->mode & S_IROTH) ? S_IXOTH : 0;
|
|
||||||
} else if (props->is_exec == 0) {
|
|
||||||
node->mode &= ~(S_IXUSR | S_IXGRP | S_IXOTH);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
parent->mtime = node->mtime;
|
parent->mtime = node->mtime;
|
||||||
@ -1673,13 +1629,9 @@ clean_tree(dav_node *node, int upload)
|
|||||||
|
|
||||||
} else if ((is_dirty(node) || is_created(node)) && upload) {
|
} else if ((is_dirty(node) || is_created(node)) && upload) {
|
||||||
|
|
||||||
int set_execute = -1;
|
|
||||||
if (is_created(node)
|
|
||||||
&& node->mode & (S_IXUSR | S_IXGRP | S_IXOTH))
|
|
||||||
set_execute = 1;
|
|
||||||
int ret = dav_put(node->path, node->cache_path,
|
int ret = dav_put(node->path, node->cache_path,
|
||||||
&node->remote_exists, &node->lock_expire,
|
&node->remote_exists, &node->lock_expire,
|
||||||
&node->etag, &node->smtime, set_execute);
|
&node->etag, &node->smtime);
|
||||||
if (is_locked(node))
|
if (is_locked(node))
|
||||||
dav_unlock(node->path, &node->lock_expire);
|
dav_unlock(node->path, &node->lock_expire);
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
@ -1839,8 +1791,6 @@ move_no_remote(dav_node *src, dav_node *dst, dav_node *dst_parent,
|
|||||||
src->remote_exists = 0;
|
src->remote_exists = 0;
|
||||||
|
|
||||||
dav_lock(dst_path, &src->lock_expire, &src->remote_exists);
|
dav_lock(dst_path, &src->lock_expire, &src->remote_exists);
|
||||||
if (!is_created(src) && (src->mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
|
|
||||||
dav_set_execute(dst_path, 1);
|
|
||||||
|
|
||||||
free(src->name);
|
free(src->name);
|
||||||
src->name = xstrdup(dst_name);
|
src->name = xstrdup(dst_name);
|
||||||
@ -2245,20 +2195,8 @@ update_node(dav_node *node, dav_props *props)
|
|||||||
node->etag = props->etag;
|
node->etag = props->etag;
|
||||||
props->etag = NULL;
|
props->etag = NULL;
|
||||||
|
|
||||||
if (is_reg(node)) {
|
if (is_reg(node) && props->size && props->size != node->size)
|
||||||
if (props->is_exec == 1
|
node->size = props->size;
|
||||||
&& !(node->mode & (S_IXUSR | S_IXGRP | S_IXOTH))) {
|
|
||||||
node->mode |= (node->mode & S_IWUSR) ? S_IXUSR : 0;
|
|
||||||
node->mode |= (node->mode & S_IWGRP) ? S_IXGRP : 0;
|
|
||||||
node->mode |= (node->mode & S_IWOTH) ? S_IXOTH : 0;
|
|
||||||
} else if (props->is_exec == 0
|
|
||||||
&& (node->mode & (S_IXUSR | S_IXGRP | S_IXOTH))) {
|
|
||||||
node->mode &= ~(S_IXUSR | S_IXGRP | S_IXOTH);
|
|
||||||
}
|
|
||||||
if (props->size && props->size != node->size) {
|
|
||||||
node->size = props->size;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dav_delete_props(props);
|
dav_delete_props(props);
|
||||||
|
|
||||||
@ -2541,7 +2479,7 @@ update_cache_file(dav_node *node)
|
|||||||
if (get_upload_time(node) >= time(NULL))
|
if (get_upload_time(node) >= time(NULL))
|
||||||
return 0;
|
return 0;
|
||||||
ret = dav_put(node->path, node->cache_path, &node->remote_exists,
|
ret = dav_put(node->path, node->cache_path, &node->remote_exists,
|
||||||
&node->lock_expire, &node->etag, &node->smtime, -1);
|
&node->lock_expire, &node->etag, &node->smtime);
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
node->utime = time(NULL);
|
node->utime = time(NULL);
|
||||||
node->dirty = 0;
|
node->dirty = 0;
|
||||||
|
44
src/webdav.c
44
src/webdav.c
@ -118,7 +118,6 @@ enum {
|
|||||||
CREATION,
|
CREATION,
|
||||||
MODIFIED,
|
MODIFIED,
|
||||||
TYPE,
|
TYPE,
|
||||||
EXECUTE,
|
|
||||||
END
|
END
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -128,7 +127,6 @@ static const ne_propname prop_names[] = {
|
|||||||
[CREATION] ={"DAV:", "creationdate"},
|
[CREATION] ={"DAV:", "creationdate"},
|
||||||
[MODIFIED] = {"DAV:", "getlastmodified"},
|
[MODIFIED] = {"DAV:", "getlastmodified"},
|
||||||
[TYPE] = {"DAV:", "resourcetype"},
|
[TYPE] = {"DAV:", "resourcetype"},
|
||||||
[EXECUTE] = {"http://apache.org/dav/props/", "executable"},
|
|
||||||
[END] = {NULL, NULL}
|
[END] = {NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -138,7 +136,6 @@ static const ne_propname anonymous_prop_names[] = {
|
|||||||
[CREATION] ={NULL, "creationdate"},
|
[CREATION] ={NULL, "creationdate"},
|
||||||
[MODIFIED] = {NULL, "getlastmodified"},
|
[MODIFIED] = {NULL, "getlastmodified"},
|
||||||
[TYPE] = {NULL, "resourcetype"},
|
[TYPE] = {NULL, "resourcetype"},
|
||||||
[EXECUTE] = {NULL, "executable"},
|
|
||||||
[END] = {NULL, NULL}
|
[END] = {NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -927,7 +924,7 @@ dav_move(const char *src, const char *dst)
|
|||||||
|
|
||||||
int
|
int
|
||||||
dav_put(const char *path, const char *cache_path, int *exists, time_t *expire,
|
dav_put(const char *path, const char *cache_path, int *exists, time_t *expire,
|
||||||
char **etag, time_t *mtime, int execute)
|
char **etag, time_t *mtime)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
if (!initialized) {
|
if (!initialized) {
|
||||||
@ -1064,8 +1061,6 @@ dav_put(const char *path, const char *cache_path, int *exists, time_t *expire,
|
|||||||
close(fd);
|
close(fd);
|
||||||
|
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
if (execute == 1)
|
|
||||||
dav_set_execute(path, execute);
|
|
||||||
if (need_head)
|
if (need_head)
|
||||||
dav_head(path, etag, mtime, NULL);
|
dav_head(path, etag, mtime, NULL);
|
||||||
}
|
}
|
||||||
@ -1136,34 +1131,6 @@ dav_quota(const char *path, off64_t *total, off64_t *used)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
|
||||||
dav_set_execute(const char *path, int set)
|
|
||||||
{
|
|
||||||
int ret;
|
|
||||||
if (!initialized) {
|
|
||||||
ret = dav_init_connection(path);
|
|
||||||
if (ret) return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
ne_proppatch_operation op[2];
|
|
||||||
op[0].name = &prop_names[EXECUTE];
|
|
||||||
op[0].type = ne_propset;
|
|
||||||
if (set) {
|
|
||||||
op[0].value = "T";
|
|
||||||
} else {
|
|
||||||
op[0].value = "F";
|
|
||||||
}
|
|
||||||
op[1].name = NULL;
|
|
||||||
|
|
||||||
char *spath = ne_path_escape(path);
|
|
||||||
ret = ne_proppatch(session, spath, &op[0]);
|
|
||||||
ret = get_error(ret, "PROPPATCH");
|
|
||||||
free(spath);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
dav_set_no_terminal(void)
|
dav_set_no_terminal(void)
|
||||||
{
|
{
|
||||||
@ -1790,15 +1757,6 @@ prop_result(void *userdata, const ne_uri *uri, const ne_prop_result_set *set)
|
|||||||
result->mtime = 0;
|
result->mtime = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
data = ne_propset_value(set, &prop_names[EXECUTE]);
|
|
||||||
if (!data)
|
|
||||||
data = ne_propset_value(set, &anonymous_prop_names[EXECUTE]);
|
|
||||||
if (!data) {
|
|
||||||
result->is_exec = -1;
|
|
||||||
} else if (*data == 'T') {
|
|
||||||
result->is_exec = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
result->next = ctx->results;
|
result->next = ctx->results;
|
||||||
ctx->results = result;
|
ctx->results = result;
|
||||||
}
|
}
|
||||||
|
12
src/webdav.h
12
src/webdav.h
@ -39,8 +39,6 @@ struct dav_props {
|
|||||||
time_t ctime; /* Creation date. */
|
time_t ctime; /* Creation date. */
|
||||||
time_t mtime; /* Date of last modification. */
|
time_t mtime; /* Date of last modification. */
|
||||||
int is_dir; /* Boolean; 1 if a directory. */
|
int is_dir; /* Boolean; 1 if a directory. */
|
||||||
int is_exec; /* -1 if not specified; 1 is executeable;
|
|
||||||
0 not executeable. */
|
|
||||||
dav_props *next; /* Next in the list. */
|
dav_props *next; /* Next in the list. */
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -233,11 +231,10 @@ dav_move(const char *src, const char *dst);
|
|||||||
Updated on success. May be NULL.
|
Updated on success. May be NULL.
|
||||||
mtime : The Last_Modified value used to check for changes on the
|
mtime : The Last_Modified value used to check for changes on the
|
||||||
server. Updated on success. May be NULL.
|
server. Updated on success. May be NULL.
|
||||||
execute : if 1 set execute property, else no change of execute property.
|
|
||||||
return value : 0 on success; an appropriate file error code otherwise. */
|
return value : 0 on success; an appropriate file error code otherwise. */
|
||||||
int
|
int
|
||||||
dav_put(const char *path, const char *cache_path, int *exists, time_t *expire,
|
dav_put(const char *path, const char *cache_path, int *exists, time_t *expire,
|
||||||
char **etag, time_t *mtime, int execute);
|
char **etag, time_t *mtime);
|
||||||
|
|
||||||
/* Makes a PROPFIND request for path to get quota information (RFC 4331)
|
/* Makes a PROPFIND request for path to get quota information (RFC 4331)
|
||||||
and places them in total and used.
|
and places them in total and used.
|
||||||
@ -248,13 +245,6 @@ int
|
|||||||
dav_quota(const char *path, off_t *total, off_t *used);
|
dav_quota(const char *path, off_t *total, off_t *used);
|
||||||
|
|
||||||
|
|
||||||
/* Sets or resets the execute property of file path.
|
|
||||||
path : Absolute path of the file on the server.
|
|
||||||
set : boolean value; 0 reset execute property; 1 set execute property. */
|
|
||||||
int
|
|
||||||
dav_set_execute(const char *path, int set);
|
|
||||||
|
|
||||||
|
|
||||||
/* Tells webdav that no more terminal is available, so errors can only
|
/* Tells webdav that no more terminal is available, so errors can only
|
||||||
* be logged. Before this function is invoced webdav tries to
|
* be logged. Before this function is invoced webdav tries to
|
||||||
* communicate with the user when problems occur. */
|
* communicate with the user when problems occur. */
|
||||||
|
Loading…
Reference in New Issue
Block a user