summaryrefslogtreecommitdiff
path: root/source3/modules/vfs_recycle.c
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2003-04-24 03:54:54 +0000
committerJelmer Vernooij <jelmer@samba.org>2003-04-24 03:54:54 +0000
commitd13f5f85feb98b28251045d88435a1af8ce3f3ba (patch)
tree5cac6506e7cc01b728f8f68566870c865c5b7be2 /source3/modules/vfs_recycle.c
parentc0960be217bbf1107843b510bb0829e9c6593e85 (diff)
downloadsamba-d13f5f85feb98b28251045d88435a1af8ce3f3ba.tar.gz
samba-d13f5f85feb98b28251045d88435a1af8ce3f3ba.tar.bz2
samba-d13f5f85feb98b28251045d88435a1af8ce3f3ba.zip
Patch from Stefan Metzmacher to add default parameters to the lp_parm()
smb.conf parameters along with some other small fixes. Binary compatible with older modules. (This used to be commit aa07b12fda732ca19d8dc41cebc7bb09e2549a30)
Diffstat (limited to 'source3/modules/vfs_recycle.c')
-rw-r--r--source3/modules/vfs_recycle.c34
1 files changed, 13 insertions, 21 deletions
diff --git a/source3/modules/vfs_recycle.c b/source3/modules/vfs_recycle.c
index 3a23e1a365..85ce257c02 100644
--- a/source3/modules/vfs_recycle.c
+++ b/source3/modules/vfs_recycle.c
@@ -126,7 +126,7 @@ static int recycle_connect(struct connection_struct *conn, const char *service,
recycle_bin_connections *recconn;
recycle_bin_connections *recconnbase;
recycle_bin_private_data *recdata;
- char *tmp_str;
+ const char *tmp_str;
DEBUG(10, ("Called for service %s (%d) as user %s\n", service, SNUM(conn), user));
@@ -142,42 +142,34 @@ static int recycle_connect(struct connection_struct *conn, const char *service,
return -1;
}
- recbin = talloc(ctx, sizeof(recycle_bin_struct));
+ recbin = talloc_zero(ctx, sizeof(recycle_bin_struct));
if (recbin == NULL) {
DEBUG(0, ("Failed to allocate memory in VFS module recycle_bin\n"));
return -1;
}
recbin->mem_ctx = ctx;
- /* Set defaults */
- recbin->repository = talloc_strdup(recbin->mem_ctx, ".recycle");
- ALLOC_CHECK(recbin->repository, error);
- recbin->keep_dir_tree = False;
- recbin->versions = False;
- recbin->touch = False;
- recbin->exclude = "";
- recbin->exclude_dir = "";
- recbin->noversions = "";
- recbin->maxsize = 0;
-
/* parse configuration options */
- if ((tmp_str = lp_parm_string(SNUM(conn), "vfs_recycle_bin", "repository")) != NULL) {
+ if ((tmp_str = lp_parm_const_string(SNUM(conn), "vfs_recycle_bin", "repository", ".recycle")) != NULL) {
recbin->repository = talloc_sub_conn(recbin->mem_ctx, conn, tmp_str);
ALLOC_CHECK(recbin->repository, error);
trim_string(recbin->repository, "/", "/");
DEBUG(5, ("recycle.bin: repository = %s\n", recbin->repository));
+ } else {
+ DEBUG(0,("recycle.bin: no repository found (fail) !\n"));
+ goto error;
}
- recbin->keep_dir_tree = lp_parm_bool(SNUM(conn), "vfs_recycle_bin", "keeptree");
+ recbin->keep_dir_tree = lp_parm_bool(SNUM(conn), "vfs_recycle_bin", "keeptree", False);
DEBUG(5, ("recycle.bin: keeptree = %d\n", recbin->keep_dir_tree));
- recbin->versions = lp_parm_bool(SNUM(conn), "vfs_recycle_bin", "versions");
+ recbin->versions = lp_parm_bool(SNUM(conn), "vfs_recycle_bin", "versions", False);
DEBUG(5, ("recycle.bin: versions = %d\n", recbin->versions));
- recbin->touch = lp_parm_bool(SNUM(conn), "vfs_recycle_bin", "touch");
+ recbin->touch = lp_parm_bool(SNUM(conn), "vfs_recycle_bin", "touch", False);
DEBUG(5, ("recycle.bin: touch = %d\n", recbin->touch));
- recbin->maxsize = lp_parm_ulong(SNUM(conn), "vfs_recycle_bin", "maxsize");
+ recbin->maxsize = lp_parm_ulong(SNUM(conn), "vfs_recycle_bin", "maxsize" , 0);
if (recbin->maxsize == 0) {
recbin->maxsize = -1;
DEBUG(5, ("recycle.bin: maxsize = -infinite-\n"));
@@ -185,17 +177,17 @@ static int recycle_connect(struct connection_struct *conn, const char *service,
DEBUG(5, ("recycle.bin: maxsize = %ld\n", (long int)recbin->maxsize));
}
- if ((tmp_str = lp_parm_string(SNUM(conn), "vfs_recycle_bin", "exclude")) != NULL) {
+ if ((tmp_str = lp_parm_const_string(SNUM(conn), "vfs_recycle_bin", "exclude", "")) != NULL) {
recbin->exclude = talloc_strdup(recbin->mem_ctx, tmp_str);
ALLOC_CHECK(recbin->exclude, error);
DEBUG(5, ("recycle.bin: exclude = %s\n", recbin->exclude));
}
- if ((tmp_str = lp_parm_string(SNUM(conn), "vfs_recycle_bin", "exclude_dir")) != NULL) {
+ if ((tmp_str = lp_parm_const_string(SNUM(conn), "vfs_recycle_bin", "exclude_dir", "")) != NULL) {
recbin->exclude_dir = talloc_strdup(recbin->mem_ctx, tmp_str);
ALLOC_CHECK(recbin->exclude_dir, error);
DEBUG(5, ("recycle.bin: exclude_dir = %s\n", recbin->exclude_dir));
}
- if ((tmp_str = lp_parm_string(SNUM(conn), "vfs_recycle_bin", "noversions")) != NULL) {
+ if ((tmp_str = lp_parm_const_string(SNUM(conn), "vfs_recycle_bin", "noversions", "")) != NULL) {
recbin->noversions = talloc_strdup(recbin->mem_ctx, tmp_str);
ALLOC_CHECK(recbin->noversions, error);
DEBUG(5, ("recycle.bin: noversions = %s\n", recbin->noversions));