- recbin = talloc(ctx,sizeof(recycle_bin_struct));
- if ( recbin == NULL) {
- DEBUG(0, ("Failed to allocate memory in VFS module recycle_bin\n"));
- return -1;
- }
- recbin->ctx = ctx;
-
- /* Set defaults */
- recbin->repository = talloc_strdup(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 */
- servicename = talloc_strdup(recbin->ctx, lp_servicename(SNUM(conn)));
- DEBUG(10, ("servicename = %s\n",servicename));
- if ((tmp_str = lp_parm_string(servicename, "vfs_recycle_bin", "repository")) != NULL) {
- recbin->repository = talloc_sub_conn(ctx, conn, tmp_str);
- ALLOC_CHECK(recbin->repository, error);
- trim_string(recbin->repository, "/", "/");
- DEBUG(5, ("recycle.bin: repository = %s\n", recbin->repository));
- }
- if ((tmp_str = lp_parm_string(servicename, "vfs_recycle_bin", "keeptree")) != NULL) {
- if (check_bool_param(tmp_str) == True)
- recbin->keep_dir_tree = True;
- DEBUG(5, ("recycle.bin: keeptree = %s\n", tmp_str));
- }
- if ((tmp_str = lp_parm_string(servicename, "vfs_recycle_bin", "versions")) != NULL) {
- if (check_bool_param(tmp_str) == True)
- recbin->versions = True;
- DEBUG(5, ("recycle.bin: versions = %s\n", tmp_str));
- }
- if ((tmp_str = lp_parm_string(servicename, "vfs_recycle_bin", "touch")) != NULL) {
- if (check_bool_param(tmp_str) == True)
- recbin->touch = True;
- DEBUG(5, ("recycle.bin: touch = %s\n", tmp_str));
- }
- if ((tmp_str = lp_parm_string(servicename, "vfs_recycle_bin", "maxsize")) != NULL) {
- recbin->maxsize = strtoul(tmp_str, NULL, 10);
- if (recbin->maxsize == 0) {
- recbin->maxsize = -1;
- DEBUG(5, ("recycle.bin: maxsize = -infinite-\n"));
- } else {
- DEBUG(5, ("recycle.bin: maxsize = %ld\n", (long int)recbin->maxsize));
- }
- }
- if ((tmp_str = lp_parm_string(servicename, "vfs_recycle_bin", "exclude")) != NULL) {
- recbin->exclude = talloc_strdup(ctx, tmp_str);
- ALLOC_CHECK(recbin->exclude, error);
- DEBUG(5, ("recycle.bin: exclude = %s\n", recbin->exclude));
- }
- if ((tmp_str = lp_parm_string(servicename,"vfs_recycle_bin", "exclude_dir")) != NULL) {
- recbin->exclude_dir = talloc_strdup(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(servicename,"vfs_recycle_bin", "noversions")) != NULL) {
- recbin->noversions = talloc_strdup(ctx, tmp_str);
- ALLOC_CHECK(recbin->noversions, error);
- DEBUG(5, ("recycle.bin: noversions = %s\n", recbin->noversions));
- }