summaryrefslogtreecommitdiff
path: root/source3/modules/vfs_netatalk.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/modules/vfs_netatalk.c')
-rw-r--r--source3/modules/vfs_netatalk.c79
1 files changed, 38 insertions, 41 deletions
diff --git a/source3/modules/vfs_netatalk.c b/source3/modules/vfs_netatalk.c
index 8d2c9b7ab1..ff16ae301f 100644
--- a/source3/modules/vfs_netatalk.c
+++ b/source3/modules/vfs_netatalk.c
@@ -34,8 +34,7 @@ static int atalk_build_paths(TALLOC_CTX *ctx, const char *path,
const char *fname,
char **adbl_path, char **orig_path,
SMB_STRUCT_STAT *adbl_info,
- SMB_STRUCT_STAT *orig_info,
- bool fake_dir_create_times);
+ SMB_STRUCT_STAT *orig_info);
static int atalk_unlink_file(const char *path);
@@ -61,8 +60,7 @@ static int atalk_build_paths(TALLOC_CTX *ctx, const char *path,
const char *fname,
char **adbl_path, char **orig_path,
SMB_STRUCT_STAT *adbl_info,
- SMB_STRUCT_STAT *orig_info,
- bool fake_dir_create_times)
+ SMB_STRUCT_STAT *orig_info)
{
int ptr0 = 0;
int ptr1 = 0;
@@ -75,7 +73,7 @@ static int atalk_build_paths(TALLOC_CTX *ctx, const char *path,
#if 0
DEBUG(3, ("ATALK: PATH: %s[%s]\n", path, fname));
#endif
- if (strstr(path, APPLEDOUBLE) || strstr(fname, APPLEDOUBLE)) {
+ if (strstr_m(path, APPLEDOUBLE) || strstr_m(fname, APPLEDOUBLE)) {
DEBUG(3, ("ATALK: path %s[%s] already contains %s\n", path, fname, APPLEDOUBLE));
return -1;
}
@@ -88,7 +86,7 @@ static int atalk_build_paths(TALLOC_CTX *ctx, const char *path,
/* get pointer to last '/' */
ptr1 = atalk_get_path_ptr(*orig_path);
- sys_lstat(*orig_path, orig_info, fake_dir_create_times);
+ sys_lstat(*orig_path, orig_info, false);
if (S_ISDIR(orig_info->st_ex_mode)) {
*adbl_path = talloc_asprintf(ctx, "%s/%s/%s/",
@@ -103,7 +101,7 @@ static int atalk_build_paths(TALLOC_CTX *ctx, const char *path,
#if 0
DEBUG(3, ("ATALK: DEBUG:\n%s\n%s\n", *orig_path, *adbl_path));
#endif
- sys_lstat(*adbl_path, adbl_info, fake_dir_create_times);
+ sys_lstat(*adbl_path, adbl_info, false);
return 0;
}
@@ -128,7 +126,7 @@ static void atalk_add_to_list(name_compare_entry **list)
if (cur_list) {
for (i = 0, count = 0; cur_list[i].name; i ++, count ++) {
- if (strstr(cur_list[i].name, APPLEDOUBLE))
+ if (strstr_m(cur_list[i].name, APPLEDOUBLE))
return;
}
}
@@ -154,15 +152,15 @@ static void atalk_add_to_list(name_compare_entry **list)
static void atalk_rrmdir(TALLOC_CTX *ctx, char *path)
{
char *dpath;
- SMB_STRUCT_DIRENT *dent = 0;
- SMB_STRUCT_DIR *dir;
+ struct dirent *dent = 0;
+ DIR *dir;
if (!path) return;
- dir = sys_opendir(path);
+ dir = opendir(path);
if (!dir) return;
- while (NULL != (dent = sys_readdir(dir))) {
+ while (NULL != (dent = readdir(dir))) {
if (strcmp(dent->d_name, ".") == 0 ||
strcmp(dent->d_name, "..") == 0)
continue;
@@ -172,16 +170,16 @@ static void atalk_rrmdir(TALLOC_CTX *ctx, char *path)
atalk_unlink_file(dpath);
}
- sys_closedir(dir);
+ closedir(dir);
}
/* Disk operations */
/* Directory operations */
-static SMB_STRUCT_DIR *atalk_opendir(struct vfs_handle_struct *handle, const char *fname, const char *mask, uint32 attr)
+static DIR *atalk_opendir(struct vfs_handle_struct *handle, const char *fname, const char *mask, uint32 attr)
{
- SMB_STRUCT_DIR *ret = 0;
+ DIR *ret = 0;
ret = SMB_VFS_NEXT_OPENDIR(handle, fname, mask, attr);
@@ -200,9 +198,9 @@ static SMB_STRUCT_DIR *atalk_opendir(struct vfs_handle_struct *handle, const cha
return ret;
}
-static SMB_STRUCT_DIR *atalk_fdopendir(struct vfs_handle_struct *handle, files_struct *fsp, const char *mask, uint32 attr)
+static DIR *atalk_fdopendir(struct vfs_handle_struct *handle, files_struct *fsp, const char *mask, uint32 attr)
{
- SMB_STRUCT_DIR *ret = 0;
+ DIR *ret = 0;
ret = SMB_VFS_NEXT_FDOPENDIR(handle, fsp, mask, attr);
@@ -231,19 +229,19 @@ static int atalk_rmdir(struct vfs_handle_struct *handle, const char *path)
TALLOC_CTX *ctx = 0;
char *dpath;
- if (!handle->conn->origpath || !path) goto exit_rmdir;
+ if (!handle->conn->cwd || !path) goto exit_rmdir;
/* due to there is no way to change bDeleteVetoFiles variable
* from this module, gotta use talloc stuff..
*/
- strstr(path, APPLEDOUBLE) ? (add = False) : (add = True);
+ strstr_m(path, APPLEDOUBLE) ? (add = False) : (add = True);
if (!(ctx = talloc_init("remove_directory")))
goto exit_rmdir;
if (!(dpath = talloc_asprintf(ctx, "%s/%s%s",
- handle->conn->origpath, path, add ? "/"APPLEDOUBLE : "")))
+ handle->conn->cwd, path, add ? "/"APPLEDOUBLE : "")))
goto exit_rmdir;
atalk_rrmdir(ctx, dpath);
@@ -274,9 +272,9 @@ static int atalk_rename(struct vfs_handle_struct *handle,
return ret;
}
- if (atalk_build_paths(talloc_tos(), handle->conn->origpath, oldname,
+ if (atalk_build_paths(talloc_tos(), handle->conn->cwd, oldname,
&adbl_path, &orig_path, &adbl_info,
- &orig_info, false) != 0)
+ &orig_info) != 0)
goto exit_rename;
if (S_ISDIR(orig_info.st_ex_mode) || S_ISREG(orig_info.st_ex_mode)) {
@@ -319,13 +317,13 @@ static int atalk_unlink(struct vfs_handle_struct *handle,
if (!handle->conn->hide_list) return ret;
for (i = 0; handle->conn->veto_list[i].name; i ++) {
- if (strstr(handle->conn->veto_list[i].name, APPLEDOUBLE))
+ if (strstr_m(handle->conn->veto_list[i].name, APPLEDOUBLE))
break;
}
if (!handle->conn->veto_list[i].name) {
for (i = 0; handle->conn->hide_list[i].name; i ++) {
- if (strstr(handle->conn->hide_list[i].name, APPLEDOUBLE))
+ if (strstr_m(handle->conn->hide_list[i].name, APPLEDOUBLE))
break;
else {
DEBUG(3, ("ATALK: %s is not hidden, skipped..\n",
@@ -335,9 +333,9 @@ static int atalk_unlink(struct vfs_handle_struct *handle,
}
}
- if (atalk_build_paths(talloc_tos(), handle->conn->origpath, path,
+ if (atalk_build_paths(talloc_tos(), handle->conn->cwd, path,
&adbl_path, &orig_path,
- &adbl_info, &orig_info, false) != 0)
+ &adbl_info, &orig_info) != 0)
goto exit_unlink;
if (S_ISDIR(orig_info.st_ex_mode) || S_ISREG(orig_info.st_ex_mode)) {
@@ -370,9 +368,8 @@ static int atalk_chmod(struct vfs_handle_struct *handle, const char *path, mode_
if (!(ctx = talloc_init("chmod_file")))
return ret;
- if (atalk_build_paths(ctx, handle->conn->origpath, path, &adbl_path,
- &orig_path, &adbl_info, &orig_info,
- false) != 0)
+ if (atalk_build_paths(ctx, handle->conn->cwd, path, &adbl_path,
+ &orig_path, &adbl_info, &orig_info) != 0)
goto exit_chmod;
if (!S_ISDIR(orig_info.st_ex_mode) && !S_ISREG(orig_info.st_ex_mode)) {
@@ -403,9 +400,9 @@ static int atalk_chown(struct vfs_handle_struct *handle, const char *path, uid_t
if (!(ctx = talloc_init("chown_file")))
return ret;
- if (atalk_build_paths(ctx, handle->conn->origpath, path,
+ if (atalk_build_paths(ctx, handle->conn->cwd, path,
&adbl_path, &orig_path,
- &adbl_info, &orig_info, false) != 0)
+ &adbl_info, &orig_info) != 0)
goto exit_chown;
if (!S_ISDIR(orig_info.st_ex_mode) && !S_ISREG(orig_info.st_ex_mode)) {
@@ -438,9 +435,9 @@ static int atalk_lchown(struct vfs_handle_struct *handle, const char *path, uid_
if (!(ctx = talloc_init("lchown_file")))
return ret;
- if (atalk_build_paths(ctx, handle->conn->origpath, path,
+ if (atalk_build_paths(ctx, handle->conn->cwd, path,
&adbl_path, &orig_path,
- &adbl_info, &orig_info, false) != 0)
+ &adbl_info, &orig_info) != 0)
goto exit_lchown;
if (!S_ISDIR(orig_info.st_ex_mode) && !S_ISREG(orig_info.st_ex_mode)) {
@@ -458,14 +455,14 @@ exit_lchown:
}
static struct vfs_fn_pointers vfs_netatalk_fns = {
- .opendir = atalk_opendir,
- .fdopendir = atalk_fdopendir,
- .rmdir = atalk_rmdir,
- .rename = atalk_rename,
- .unlink = atalk_unlink,
- .chmod = atalk_chmod,
- .chown = atalk_chown,
- .lchown = atalk_lchown,
+ .opendir_fn = atalk_opendir,
+ .fdopendir_fn = atalk_fdopendir,
+ .rmdir_fn = atalk_rmdir,
+ .rename_fn = atalk_rename,
+ .unlink_fn = atalk_unlink,
+ .chmod_fn = atalk_chmod,
+ .chown_fn = atalk_chown,
+ .lchown_fn = atalk_lchown,
};
NTSTATUS vfs_netatalk_init(void);