diff options
Diffstat (limited to 'source3/modules')
-rw-r--r-- | source3/modules/vfs_cap.c | 4 | ||||
-rw-r--r-- | source3/modules/vfs_catia.c | 5 | ||||
-rw-r--r-- | source3/modules/vfs_default.c | 17 | ||||
-rw-r--r-- | source3/modules/vfs_full_audit.c | 4 | ||||
-rw-r--r-- | source3/modules/vfs_onefs_shadow_copy.c | 5 | ||||
-rw-r--r-- | source3/modules/vfs_shadow_copy2.c | 6 | ||||
-rw-r--r-- | source3/modules/vfs_time_audit.c | 4 |
7 files changed, 28 insertions, 17 deletions
diff --git a/source3/modules/vfs_cap.c b/source3/modules/vfs_cap.c index 35fa740dd0..89f16891a9 100644 --- a/source3/modules/vfs_cap.c +++ b/source3/modules/vfs_cap.c @@ -384,7 +384,7 @@ static int cap_mknod(vfs_handle_struct *handle, const char *path, mode_t mode, S return SMB_VFS_NEXT_MKNOD(handle, cappath, mode, dev); } -static char *cap_realpath(vfs_handle_struct *handle, const char *path, char *resolved_path) +static char *cap_realpath(vfs_handle_struct *handle, const char *path) { /* monyo need capencode'ed and capdecode'ed? */ char *cappath = capencode(talloc_tos(), path); @@ -393,7 +393,7 @@ static char *cap_realpath(vfs_handle_struct *handle, const char *path, char *res errno = ENOMEM; return NULL; } - return SMB_VFS_NEXT_REALPATH(handle, path, resolved_path); + return SMB_VFS_NEXT_REALPATH(handle, cappath); } static int cap_chmod_acl(vfs_handle_struct *handle, const char *path, mode_t mode) diff --git a/source3/modules/vfs_catia.c b/source3/modules/vfs_catia.c index 177458bce2..af6efd28df 100644 --- a/source3/modules/vfs_catia.c +++ b/source3/modules/vfs_catia.c @@ -634,8 +634,7 @@ static int catia_ntimes(vfs_handle_struct *handle, } static char * -catia_realpath(vfs_handle_struct *handle, const char *path, - char *resolved_path) +catia_realpath(vfs_handle_struct *handle, const char *path) { char *mapped_name = NULL; NTSTATUS status; @@ -648,7 +647,7 @@ catia_realpath(vfs_handle_struct *handle, const char *path, return NULL; } - ret = SMB_VFS_NEXT_REALPATH(handle, mapped_name, resolved_path); + ret = SMB_VFS_NEXT_REALPATH(handle, mapped_name); TALLOC_FREE(mapped_name); return ret; diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index 6f5b09a5a9..eb0e0b95a6 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -1064,12 +1064,25 @@ static int vfswrap_mknod(vfs_handle_struct *handle, const char *pathname, mode_ return result; } -static char *vfswrap_realpath(vfs_handle_struct *handle, const char *path, char *resolved_path) +static char *vfswrap_realpath(vfs_handle_struct *handle, const char *path) { char *result; START_PROFILE(syscall_realpath); - result = realpath(path, resolved_path); +#ifdef REALPATH_TAKES_NULL + result = realpath(path, NULL); +#else + result = SMB_MALLOC_ARRAY(char, PATH_MAX+1); + if (result) { + char *resolved_path = realpath(path, result); + if (!resolved_path) { + SAFE_FREE(result); + } else { + /* SMB_ASSERT(result == resovled_path) ? */ + result = resolved_path; + } + } +#endif END_PROFILE(syscall_realpath); return result; } diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c index 23ca1496bf..3328128d86 100644 --- a/source3/modules/vfs_full_audit.c +++ b/source3/modules/vfs_full_audit.c @@ -1324,11 +1324,11 @@ static int smb_full_audit_mknod(vfs_handle_struct *handle, } static char *smb_full_audit_realpath(vfs_handle_struct *handle, - const char *path, char *resolved_path) + const char *path) { char *result; - result = SMB_VFS_NEXT_REALPATH(handle, path, resolved_path); + result = SMB_VFS_NEXT_REALPATH(handle, path); do_log(SMB_VFS_OP_REALPATH, (result != NULL), handle, "%s", path); diff --git a/source3/modules/vfs_onefs_shadow_copy.c b/source3/modules/vfs_onefs_shadow_copy.c index cf84e58171..bcc40f0d9f 100644 --- a/source3/modules/vfs_onefs_shadow_copy.c +++ b/source3/modules/vfs_onefs_shadow_copy.c @@ -471,11 +471,10 @@ onefs_shadow_copy_mknod(vfs_handle_struct *handle, const char *path, } static char * -onefs_shadow_copy_realpath(vfs_handle_struct *handle, const char *path, - char *resolved_path) +onefs_shadow_copy_realpath(vfs_handle_struct *handle, const char *path) { SHADOW_NEXT(REALPATH, - (handle, cpath ?: path, resolved_path), + (handle, cpath ?: path), char *); } diff --git a/source3/modules/vfs_shadow_copy2.c b/source3/modules/vfs_shadow_copy2.c index 502f815235..ba6b3441b8 100644 --- a/source3/modules/vfs_shadow_copy2.c +++ b/source3/modules/vfs_shadow_copy2.c @@ -653,7 +653,7 @@ static int shadow_copy2_mknod(vfs_handle_struct *handle, } static char *shadow_copy2_realpath(vfs_handle_struct *handle, - const char *fname, char *resolved_path) + const char *fname) { const char *gmt; @@ -671,10 +671,10 @@ static char *shadow_copy2_realpath(vfs_handle_struct *handle, copy[gmt - fname + 1] = '\0'; DEBUG(10, ("calling NEXT_REALPATH with %s\n", copy)); - SHADOW2_NEXT(REALPATH, (handle, name, resolved_path), char *, + SHADOW2_NEXT(REALPATH, (handle, copy), char *, NULL); } - SHADOW2_NEXT(REALPATH, (handle, name, resolved_path), char *, NULL); + SHADOW2_NEXT(REALPATH, (handle, name), char *, NULL); } static const char *shadow_copy2_connectpath(struct vfs_handle_struct *handle, diff --git a/source3/modules/vfs_time_audit.c b/source3/modules/vfs_time_audit.c index 84e41753ed..af4fd3313a 100644 --- a/source3/modules/vfs_time_audit.c +++ b/source3/modules/vfs_time_audit.c @@ -1066,14 +1066,14 @@ static int smb_time_audit_mknod(vfs_handle_struct *handle, } static char *smb_time_audit_realpath(vfs_handle_struct *handle, - const char *path, char *resolved_path) + const char *path) { char *result; struct timespec ts1,ts2; double timediff; clock_gettime_mono(&ts1); - result = SMB_VFS_NEXT_REALPATH(handle, path, resolved_path); + result = SMB_VFS_NEXT_REALPATH(handle, path); clock_gettime_mono(&ts2); timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9; |