diff options
author | Jeremy Allison <jra@samba.org> | 2009-10-17 10:36:33 -0700 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2009-10-17 10:36:33 -0700 |
commit | 7c51fa6d699a653cafa90df8e44911b576118ebd (patch) | |
tree | 543bf9ca698e03eff81104898b33e77f1abed319 /source3/modules | |
parent | cc3a6770c77ec8fe1cd63bf4c682853c56201f0c (diff) | |
parent | 3e3214fd91471bca5b6c4d3782e922d252d588fb (diff) | |
download | samba-7c51fa6d699a653cafa90df8e44911b576118ebd.tar.gz samba-7c51fa6d699a653cafa90df8e44911b576118ebd.tar.bz2 samba-7c51fa6d699a653cafa90df8e44911b576118ebd.zip |
Merge branch 'master' of ssh://jra@git.samba.org/data/git/samba
Diffstat (limited to 'source3/modules')
-rw-r--r-- | source3/modules/nfs4_acls.c | 2 | ||||
-rw-r--r-- | source3/modules/onefs_open.c | 2 | ||||
-rw-r--r-- | source3/modules/vfs_acl_common.c | 30 | ||||
-rw-r--r-- | source3/modules/vfs_acl_tdb.c | 50 | ||||
-rw-r--r-- | source3/modules/vfs_afsacl.c | 9 | ||||
-rw-r--r-- | source3/modules/vfs_default.c | 10 | ||||
-rw-r--r-- | source3/modules/vfs_full_audit.c | 4 | ||||
-rw-r--r-- | source3/modules/vfs_gpfs.c | 6 | ||||
-rw-r--r-- | source3/modules/vfs_hpuxacl.c | 7 | ||||
-rw-r--r-- | source3/modules/vfs_shadow_copy2.c | 147 | ||||
-rw-r--r-- | source3/modules/vfs_streams_xattr.c | 7 | ||||
-rw-r--r-- | source3/modules/vfs_xattr_tdb.c | 8 |
12 files changed, 198 insertions, 84 deletions
diff --git a/source3/modules/nfs4_acls.c b/source3/modules/nfs4_acls.c index cf96061ea6..658f2b4e8d 100644 --- a/source3/modules/nfs4_acls.c +++ b/source3/modules/nfs4_acls.c @@ -170,7 +170,7 @@ static int smbacl4_GetFileOwner(struct connection_struct *conn, /* Get the stat struct for the owner info. */ if (vfs_stat_smb_fname(conn, filename, psbuf) != 0) { - DEBUG(8, ("SMB_VFS_STAT failed with error %s\n", + DEBUG(8, ("vfs_stat_smb_fname failed with error %s\n", strerror(errno))); return -1; } diff --git a/source3/modules/onefs_open.c b/source3/modules/onefs_open.c index b9a2c30734..d90f165cd7 100644 --- a/source3/modules/onefs_open.c +++ b/source3/modules/onefs_open.c @@ -1253,7 +1253,7 @@ NTSTATUS onefs_open_file_ntcreate(connection_struct *conn, note that GPFS supports it as well - jmcd */ if (fsp->fh->fd != -1) { - ret_flock = SMB_VFS_KERNEL_FLOCK(fsp, share_access); + ret_flock = SMB_VFS_KERNEL_FLOCK(fsp, share_access, access_mask); if(ret_flock == -1 ){ TALLOC_FREE(lck); diff --git a/source3/modules/vfs_acl_common.c b/source3/modules/vfs_acl_common.c index 5fdd2b4725..39fd2ad0ed 100644 --- a/source3/modules/vfs_acl_common.c +++ b/source3/modules/vfs_acl_common.c @@ -380,21 +380,26 @@ static NTSTATUS inherit_new_acl(vfs_handle_struct *handle, } if (!psd || psd->dacl == NULL) { - int ret; TALLOC_FREE(psd); - if (fsp && !fsp->is_directory && fsp->fh->fd != -1) { - ret = SMB_VFS_FSTAT(fsp, &smb_fname->st); + if (fsp) { + status = vfs_stat_fsp(fsp); + smb_fname->st = fsp->fsp_name->st; } else { - if (fsp && fsp->posix_open) { + int ret; + if (lp_posix_pathnames()) { ret = SMB_VFS_LSTAT(handle->conn, smb_fname); } else { ret = SMB_VFS_STAT(handle->conn, smb_fname); } + if (ret == -1) { + status = map_nt_error_from_unix(errno); + } } - if (ret == -1) { - return map_nt_error_from_unix(errno); + if (!NT_STATUS_IS_OK(status)) { + return status; } + psd = default_file_sd(ctx, &smb_fname->st); if (!psd) { return NT_STATUS_NO_MEMORY; @@ -580,23 +585,14 @@ static NTSTATUS fset_nt_acl_common(vfs_handle_struct *handle, files_struct *fsp, /* Ensure owner and group are set. */ if (!psd->owner_sid || !psd->group_sid) { - int ret; DOM_SID owner_sid, group_sid; struct security_descriptor *nc_psd = dup_sec_desc(talloc_tos(), psd); if (!nc_psd) { return NT_STATUS_OK; } - if (fsp->is_directory || fsp->fh->fd == -1) { - if (fsp->posix_open) { - ret = SMB_VFS_LSTAT(fsp->conn, fsp->fsp_name); - } else { - ret = SMB_VFS_STAT(fsp->conn, fsp->fsp_name); - } - } else { - ret = SMB_VFS_FSTAT(fsp, &fsp->fsp_name->st); - } - if (ret == -1) { + status = vfs_stat_fsp(fsp); + if (!NT_STATUS_IS_OK(status)) { /* Lower level acl set succeeded, * so still return OK. */ return NT_STATUS_OK; diff --git a/source3/modules/vfs_acl_tdb.c b/source3/modules/vfs_acl_tdb.c index 285c58ed9d..424ecbf65b 100644 --- a/source3/modules/vfs_acl_tdb.c +++ b/source3/modules/vfs_acl_tdb.c @@ -147,24 +147,26 @@ static NTSTATUS get_acl_blob(TALLOC_CTX *ctx, TDB_DATA data; struct file_id id; struct db_context *db; - int ret = -1; + NTSTATUS status; SMB_STRUCT_STAT sbuf; SMB_VFS_HANDLE_GET_DATA(handle, db, struct db_context, return NT_STATUS_INTERNAL_DB_CORRUPTION); - if (fsp && fsp->fh->fd != -1) { - ret = SMB_VFS_FSTAT(fsp, &sbuf); + ZERO_STRUCT(sbuf); + + if (fsp) { + status = vfs_stat_fsp(fsp); + sbuf = fsp->fsp_name->st; } else { - if (fsp && fsp->posix_open) { - ret = vfs_lstat_smb_fname(handle->conn, name, &sbuf); - } else { - ret = vfs_stat_smb_fname(handle->conn, name, &sbuf); + int ret = vfs_stat_smb_fname(handle->conn, name, &sbuf); + if (ret == -1) { + status = map_nt_error_from_unix(errno); } } - if (ret == -1) { - return map_nt_error_from_unix(errno); + if (!NT_STATUS_IS_OK(status)) { + return status; } id = vfs_file_id_from_sbuf(handle->conn, &sbuf); @@ -204,7 +206,7 @@ static NTSTATUS store_acl_blob_fsp(vfs_handle_struct *handle, TDB_DATA data; struct db_context *db; struct db_record *rec; - int ret = -1; + NTSTATUS status; DEBUG(10,("store_acl_blob_fsp: storing blob length %u on file %s\n", (unsigned int)pblob->length, fsp_str_dbg(fsp))); @@ -212,18 +214,9 @@ static NTSTATUS store_acl_blob_fsp(vfs_handle_struct *handle, SMB_VFS_HANDLE_GET_DATA(handle, db, struct db_context, return NT_STATUS_INTERNAL_DB_CORRUPTION); - if (fsp->fh->fd != -1) { - ret = SMB_VFS_FSTAT(fsp, &fsp->fsp_name->st); - } else { - if (fsp->posix_open) { - ret = SMB_VFS_LSTAT(handle->conn, fsp->fsp_name); - } else { - ret = SMB_VFS_STAT(handle->conn, fsp->fsp_name); - } - } - - if (ret == -1) { - return map_nt_error_from_unix(errno); + status = vfs_stat_fsp(fsp); + if (!NT_STATUS_IS_OK(status)) { + return status; } id = vfs_file_id_from_sbuf(handle->conn, &fsp->fsp_name->st); @@ -438,20 +431,13 @@ static int sys_acl_set_fd_tdb(vfs_handle_struct *handle, SMB_ACL_T theacl) { struct db_context *db; + NTSTATUS status; int ret; SMB_VFS_HANDLE_GET_DATA(handle, db, struct db_context, return -1); - if (fsp->is_directory || fsp->fh->fd == -1) { - if (fsp->posix_open) { - ret = SMB_VFS_LSTAT(fsp->conn, fsp->fsp_name); - } else { - ret = SMB_VFS_STAT(fsp->conn, fsp->fsp_name); - } - } else { - ret = SMB_VFS_FSTAT(fsp, &fsp->fsp_name->st); - } - if (ret == -1) { + status = vfs_stat_fsp(fsp); + if (!NT_STATUS_IS_OK(status)) { return -1; } diff --git a/source3/modules/vfs_afsacl.c b/source3/modules/vfs_afsacl.c index 1c310c7185..4666be2aa3 100644 --- a/source3/modules/vfs_afsacl.c +++ b/source3/modules/vfs_afsacl.c @@ -659,8 +659,15 @@ static size_t afs_to_nt_acl(struct afs_acl *afs_acl, uint32 security_info, struct security_descriptor **ppdesc) { + int ret; + /* Get the stat struct for the owner info. */ - if(SMB_VFS_STAT(conn, smb_fname) != 0) { + if (lp_posix_pathnames()) { + ret = SMB_VFS_LSTAT(conn, smb_fname); + } else { + ret = SMB_VFS_STAT(conn, smb_fname); + } + if (ret == -1) { return 0; } diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index c92bc8ec21..036a438002 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -1057,10 +1057,10 @@ static bool vfswrap_lock(vfs_handle_struct *handle, files_struct *fsp, int op, S } static int vfswrap_kernel_flock(vfs_handle_struct *handle, files_struct *fsp, - uint32 share_mode) + uint32 share_mode, uint32 access_mask) { START_PROFILE(syscall_kernel_flock); - kernel_flock(fsp->fh->fd, share_mode); + kernel_flock(fsp->fh->fd, share_mode, access_mask); END_PROFILE(syscall_kernel_flock); return 0; } @@ -1231,7 +1231,11 @@ static NTSTATUS vfswrap_streaminfo(vfs_handle_struct *handle, if (!NT_STATUS_IS_OK(status)) { return status; } - ret = SMB_VFS_STAT(handle->conn, smb_fname); + if (lp_posix_pathnames()) { + ret = SMB_VFS_LSTAT(handle->conn, smb_fname); + } else { + ret = SMB_VFS_STAT(handle->conn, smb_fname); + } sbuf = smb_fname->st; TALLOC_FREE(smb_fname); } diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c index 22abee416c..5305af4832 100644 --- a/source3/modules/vfs_full_audit.c +++ b/source3/modules/vfs_full_audit.c @@ -1245,11 +1245,11 @@ static bool smb_full_audit_lock(vfs_handle_struct *handle, files_struct *fsp, static int smb_full_audit_kernel_flock(struct vfs_handle_struct *handle, struct files_struct *fsp, - uint32 share_mode) + uint32 share_mode, uint32 access_mask) { int result; - result = SMB_VFS_NEXT_KERNEL_FLOCK(handle, fsp, share_mode); + result = SMB_VFS_NEXT_KERNEL_FLOCK(handle, fsp, share_mode, access_mask); do_log(SMB_VFS_OP_KERNEL_FLOCK, (result >= 0), handle, "%s", fsp_str_do_log(fsp)); diff --git a/source3/modules/vfs_gpfs.c b/source3/modules/vfs_gpfs.c index c1131a92b9..7c481d6ba0 100644 --- a/source3/modules/vfs_gpfs.c +++ b/source3/modules/vfs_gpfs.c @@ -31,14 +31,14 @@ #include "vfs_gpfs.h" static int vfs_gpfs_kernel_flock(vfs_handle_struct *handle, files_struct *fsp, - uint32 share_mode) + uint32 share_mode, uint32 access_mask) { START_PROFILE(syscall_kernel_flock); - kernel_flock(fsp->fh->fd, share_mode); + kernel_flock(fsp->fh->fd, share_mode, access_mask); - if (!set_gpfs_sharemode(fsp, fsp->access_mask, fsp->share_access)) { + if (!set_gpfs_sharemode(fsp, access_mask, fsp->share_access)) { return -1; diff --git a/source3/modules/vfs_hpuxacl.c b/source3/modules/vfs_hpuxacl.c index df70f1ea08..5a54f79da3 100644 --- a/source3/modules/vfs_hpuxacl.c +++ b/source3/modules/vfs_hpuxacl.c @@ -255,7 +255,12 @@ int hpuxacl_sys_acl_set_file(vfs_handle_struct *handle, * that has _not_ been specified in "type" from the file first * and concatenate it with the acl provided. */ - if (SMB_VFS_STAT(handle->conn, smb_fname) != 0) { + if (lp_posix_pathnames()) { + ret = SMB_VFS_LSTAT(handle->conn, smb_fname); + } else { + ret = SMB_VFS_STAT(handle->conn, smb_fname); + } + if (ret != 0) { DEBUG(10, ("Error in stat call: %s\n", strerror(errno))); goto done; } diff --git a/source3/modules/vfs_shadow_copy2.c b/source3/modules/vfs_shadow_copy2.c index eac83fca74..61f71b7bbc 100644 --- a/source3/modules/vfs_shadow_copy2.c +++ b/source3/modules/vfs_shadow_copy2.c @@ -76,31 +76,99 @@ static int vfs_shadow_copy2_debug_level = DBGC_VFS; /* make very sure it is one of our special names */ -static inline bool shadow_copy2_match_name(const char *name) +static inline bool shadow_copy2_match_name(const char *name, const char **gmt_start) { unsigned year, month, day, hr, min, sec; - if (name[0] != '@') return False; - if (strncmp(name, "@GMT-", 5) != 0) return False; - if (sscanf(name, "@GMT-%04u.%02u.%02u-%02u.%02u.%02u", &year, &month, + const char *p; + if (gmt_start) { + (*gmt_start) = NULL; + } + p = strstr_m(name, "@GMT-"); + if (p == NULL) return false; + if (p > name && p[-1] != '/') return False; + if (sscanf(p, "@GMT-%04u.%02u.%02u-%02u.%02u.%02u", &year, &month, &day, &hr, &min, &sec) != 6) { return False; } - if (name[24] != 0 && name[24] != '/') { + if (p[24] != 0 && p[24] != '/') { return False; } + if (gmt_start) { + (*gmt_start) = p; + } return True; } /* + shadow copy paths can also come into the server in this form: + + /foo/bar/@GMT-XXXXX/some/file + + This function normalises the filename to be of the form: + + @GMT-XXXX/foo/bar/some/file + */ +static const char *shadow_copy2_normalise_path(TALLOC_CTX *mem_ctx, const char *path, const char *gmt_start) +{ + char *pcopy; + char buf[GMT_NAME_LEN]; + size_t prefix_len; + + if (path == gmt_start) { + return path; + } + + prefix_len = gmt_start - path - 1; + + DEBUG(10, ("path=%s, gmt_start=%s, prefix_len=%d\n", path, gmt_start, + (int)prefix_len)); + + /* + * We've got a/b/c/@GMT-YYYY.MM.DD-HH.MM.SS/d/e. convert to + * @GMT-YYYY.MM.DD-HH.MM.SS/a/b/c/d/e before further + * processing. As many VFS calls provide a const char *, + * unfortunately we have to make a copy. + */ + + pcopy = talloc_strdup(talloc_tos(), path); + if (pcopy == NULL) { + return NULL; + } + + gmt_start = pcopy + prefix_len; + + /* + * Copy away "@GMT-YYYY.MM.DD-HH.MM.SS" + */ + memcpy(buf, gmt_start+1, GMT_NAME_LEN); + + /* + * Make space for it including a trailing / + */ + memmove(pcopy + GMT_NAME_LEN + 1, pcopy, prefix_len); + + /* + * Move in "@GMT-YYYY.MM.DD-HH.MM.SS/" at the beginning again + */ + memcpy(pcopy, buf, GMT_NAME_LEN); + pcopy[GMT_NAME_LEN] = '/'; + + DEBUG(10, ("shadow_copy2_normalise_path: %s -> %s\n", path, pcopy)); + + return pcopy; +} + +/* convert a name to the shadow directory */ #define _SHADOW2_NEXT(op, args, rtype, eret, extra) do { \ const char *name = fname; \ - if (shadow_copy2_match_name(fname)) { \ + const char *gmt_start; \ + if (shadow_copy2_match_name(fname, &gmt_start)) { \ char *name2; \ rtype ret; \ - name2 = convert_shadow2_name(handle, fname); \ + name2 = convert_shadow2_name(handle, fname, gmt_start); \ if (name2 == NULL) { \ errno = EINVAL; \ return eret; \ @@ -116,11 +184,12 @@ static inline bool shadow_copy2_match_name(const char *name) } while (0) #define _SHADOW2_NEXT_SMB_FNAME(op, args, rtype, eret, extra) do { \ - if (shadow_copy2_match_name(smb_fname->base_name)) { \ + const char *gmt_start; \ + if (shadow_copy2_match_name(smb_fname->base_name, &gmt_start)) { \ char *name2; \ char *smb_base_name_tmp = NULL; \ rtype ret; \ - name2 = convert_shadow2_name(handle, smb_fname->base_name); \ + name2 = convert_shadow2_name(handle, smb_fname->base_name, gmt_start); \ if (name2 == NULL) { \ errno = EINVAL; \ return eret; \ @@ -143,10 +212,11 @@ static inline bool shadow_copy2_match_name(const char *name) #define _SHADOW2_NTSTATUS_NEXT(op, args, eret, extra) do { \ const char *name = fname; \ - if (shadow_copy2_match_name(fname)) { \ + const char *gmt_start; \ + if (shadow_copy2_match_name(fname, &gmt_start)) { \ char *name2; \ NTSTATUS ret; \ - name2 = convert_shadow2_name(handle, fname); \ + name2 = convert_shadow2_name(handle, fname, gmt_start); \ if (name2 == NULL) { \ errno = EINVAL; \ return eret; \ @@ -168,7 +238,9 @@ static inline bool shadow_copy2_match_name(const char *name) #define SHADOW2_NEXT_SMB_FNAME(op, args, rtype, eret) _SHADOW2_NEXT_SMB_FNAME(op, args, rtype, eret, ) #define SHADOW2_NEXT2(op, args) do { \ - if (shadow_copy2_match_name(oldname) || shadow_copy2_match_name(newname)) { \ + const char *gmt_start1, *gmt_start2; \ + if (shadow_copy2_match_name(oldname, &gmt_start1) || \ + shadow_copy2_match_name(newname, &gmt_start2)) { \ errno = EROFS; \ return -1; \ } else { \ @@ -177,8 +249,9 @@ static inline bool shadow_copy2_match_name(const char *name) } while (0) #define SHADOW2_NEXT2_SMB_FNAME(op, args) do { \ - if (shadow_copy2_match_name(smb_fname_src->base_name) || \ - shadow_copy2_match_name(smb_fname_dst->base_name)) { \ + const char *gmt_start1, *gmt_start2; \ + if (shadow_copy2_match_name(smb_fname_src->base_name, &gmt_start1) || \ + shadow_copy2_match_name(smb_fname_dst->base_name, &gmt_start2)) { \ errno = EROFS; \ return -1; \ } else { \ @@ -267,7 +340,7 @@ static const char *shadow_copy2_find_basedir(TALLOC_CTX *mem_ctx, vfs_handle_str convert a filename from a share relative path, to a path in the snapshot directory */ -static char *convert_shadow2_name(vfs_handle_struct *handle, const char *fname) +static char *convert_shadow2_name(vfs_handle_struct *handle, const char *fname, const char *gmt_path) { TALLOC_CTX *tmp_ctx = talloc_new(handle->data); const char *snapdir, *relpath, *baseoffset, *basedir; @@ -288,6 +361,14 @@ static char *convert_shadow2_name(vfs_handle_struct *handle, const char *fname) return NULL; } + if (strncmp(fname, "@GMT-", 5) != 0) { + fname = shadow_copy2_normalise_path(tmp_ctx, fname, gmt_path); + if (fname == NULL) { + talloc_free(tmp_ctx); + return NULL; + } + } + relpath = fname + GMT_NAME_LEN; baselen = strlen(basedir); baseoffset = handle->conn->connectpath + baselen; @@ -406,7 +487,7 @@ static int shadow_copy2_lstat(vfs_handle_struct *handle, static int shadow_copy2_fstat(vfs_handle_struct *handle, files_struct *fsp, SMB_STRUCT_STAT *sbuf) { int ret = SMB_VFS_NEXT_FSTAT(handle, fsp, sbuf); - if (ret == 0 && shadow_copy2_match_name(fsp->fsp_name->base_name)) { + if (ret == 0 && shadow_copy2_match_name(fsp->fsp_name->base_name, NULL)) { convert_sbuf(handle, fsp->fsp_name->base_name, sbuf); } return ret; @@ -476,8 +557,24 @@ static int shadow_copy2_mknod(vfs_handle_struct *handle, static char *shadow_copy2_realpath(vfs_handle_struct *handle, const char *fname, char *resolved_path) { - if (shadow_copy2_match_name(fname) && (fname[GMT_NAME_LEN] == '\0')) { - return SMB_VFS_NEXT_REALPATH(handle, ".", resolved_path); + const char *gmt; + + if (shadow_copy2_match_name(fname, &gmt) + && (gmt[GMT_NAME_LEN] == '\0')) { + char *copy, *result; + + copy = talloc_strdup(talloc_tos(), fname); + if (copy == NULL) { + errno = ENOMEM; + return NULL; + } + + copy[gmt - fname] = '.'; + + DEBUG(10, ("calling NEXT_REALPATH with %s\n", copy)); + result = SMB_VFS_NEXT_REALPATH(handle, copy, resolved_path); + TALLOC_FREE(copy); + return result; } SHADOW2_NEXT(REALPATH, (handle, name, resolved_path), char *, NULL); } @@ -486,14 +583,22 @@ static const char *shadow_copy2_connectpath(struct vfs_handle_struct *handle, const char *fname) { TALLOC_CTX *tmp_ctx = talloc_stackframe(); - const char *snapdir, *baseoffset, *basedir; + const char *snapdir, *baseoffset, *basedir, *gmt_start; size_t baselen; char *ret; - if (!shadow_copy2_match_name(fname)) { + DEBUG(10, ("shadow_copy2_connectpath called with %s\n", fname)); + + if (!shadow_copy2_match_name(fname, &gmt_start)) { return handle->conn->connectpath; } + fname = shadow_copy2_normalise_path(talloc_tos(), fname, gmt_start); + if (fname == NULL) { + TALLOC_FREE(tmp_ctx); + return NULL; + } + snapdir = shadow_copy2_find_snapdir(tmp_ctx, handle); if (snapdir == NULL) { DEBUG(2,("no snapdir found for share at %s\n", @@ -644,7 +749,7 @@ static int shadow_copy2_get_shadow_copy2_data(vfs_handle_struct *handle, SHADOW_COPY_LABEL *tlabels; /* ignore names not of the right form in the snapshot directory */ - if (!shadow_copy2_match_name(d->d_name)) { + if (!shadow_copy2_match_name(d->d_name, NULL)) { continue; } diff --git a/source3/modules/vfs_streams_xattr.c b/source3/modules/vfs_streams_xattr.c index b68fa02a35..d7c0a834c0 100644 --- a/source3/modules/vfs_streams_xattr.c +++ b/source3/modules/vfs_streams_xattr.c @@ -253,6 +253,11 @@ static int streams_xattr_stat(vfs_handle_struct *handle, return SMB_VFS_NEXT_STAT(handle, smb_fname); } + /* Note if lp_posix_paths() is true, we can never + * get here as is_ntfs_stream_smb_fname() is + * always false. So we never need worry about + * not following links here. */ + /* If the default stream is requested, just stat the base file. */ if (is_ntfs_default_stream_smb_fname(smb_fname)) { return streams_xattr_stat_base(handle, smb_fname, true); @@ -304,7 +309,7 @@ static int streams_xattr_lstat(vfs_handle_struct *handle, return SMB_VFS_NEXT_LSTAT(handle, smb_fname); } - /* If the default stream is requested, just stat the base file. */ + /* If the default stream is requested, just stat the base file. */ if (is_ntfs_default_stream_smb_fname(smb_fname)) { return streams_xattr_stat_base(handle, smb_fname, false); } diff --git a/source3/modules/vfs_xattr_tdb.c b/source3/modules/vfs_xattr_tdb.c index 55fb1417b7..f7fbfce4cb 100644 --- a/source3/modules/vfs_xattr_tdb.c +++ b/source3/modules/vfs_xattr_tdb.c @@ -630,9 +630,15 @@ static int xattr_tdb_unlink(vfs_handle_struct *handle, return -1; } - if (SMB_VFS_STAT(handle->conn, smb_fname_tmp) == -1) { + if (lp_posix_pathnames()) { + ret = SMB_VFS_LSTAT(handle->conn, smb_fname_tmp); + } else { + ret = SMB_VFS_STAT(handle->conn, smb_fname_tmp); + } + if (ret == -1) { goto out; } + if (smb_fname_tmp->st.st_ex_nlink == 1) { /* Only remove record on last link to file. */ remove_record = true; |