diff options
author | Jeremy Allison <jra@samba.org> | 2002-03-19 02:32:39 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2002-03-19 02:32:39 +0000 |
commit | ffadd471b9664018b3010ab5d74e6d05b8886e66 (patch) | |
tree | eaf1c0c83d1f11f2eb6f68d1201f745722f33dfe /source3/smbd | |
parent | cdc9931bb2f53272159b04ef7b1b057ce837ed4b (diff) | |
download | samba-ffadd471b9664018b3010ab5d74e6d05b8886e66.tar.gz samba-ffadd471b9664018b3010ab5d74e6d05b8886e66.tar.bz2 samba-ffadd471b9664018b3010ab5d74e6d05b8886e66.zip |
Sync up vfs changes from 2.2.x.
Jeremy.
(This used to be commit ad1e858d8e72adf924ff435eab8da3e60842e2e6)
Diffstat (limited to 'source3/smbd')
-rw-r--r-- | source3/smbd/reply.c | 2 | ||||
-rw-r--r-- | source3/smbd/vfs-wrap.c | 166 | ||||
-rw-r--r-- | source3/smbd/vfs.c | 52 |
3 files changed, 39 insertions, 181 deletions
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index 1b7db5f0a7..0af2ea3716 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -1261,7 +1261,7 @@ NTSTATUS unlink_internals(connection_struct *conn, int dirtype, char *name) p = strrchr_m(name,'/'); if (!p) { - pstrcpy(directory,"./"); + pstrcpy(directory,"."); pstrcpy(mask,name); } else { *p = 0; diff --git a/source3/smbd/vfs-wrap.c b/source3/smbd/vfs-wrap.c index 73b070d3f8..1d94e18e5b 100644 --- a/source3/smbd/vfs-wrap.c +++ b/source3/smbd/vfs-wrap.c @@ -22,8 +22,6 @@ /* Check for NULL pointer parameters in vfswrap_* functions */ -#define VFS_CHECK_NULL - /* We don't want to have NULL function pointers lying around. Someone is sure to try and execute them. These stubs are used to prevent this possibility. */ @@ -44,14 +42,6 @@ SMB_BIG_UINT vfswrap_disk_free(connection_struct *conn, const char *path, BOOL s { SMB_BIG_UINT result; -#ifdef VFS_CHECK_NULL - if ((path == NULL) || (bsize == NULL) || (dfree == NULL) || - (dsize == NULL)) { - - smb_panic("NULL pointer passed to vfswrap_disk_free() function\n"); - } -#endif - result = sys_disk_free(path, small_query, bsize, dfree, dsize); return result; } @@ -63,13 +53,6 @@ DIR *vfswrap_opendir(connection_struct *conn, const char *fname) DIR *result; START_PROFILE(syscall_opendir); - -#ifdef VFS_CHECK_NULL - if (fname == NULL) { - smb_panic("NULL pointer passed to vfswrap_opendir()\n"); - } -#endif - result = opendir(fname); END_PROFILE(syscall_opendir); return result; @@ -80,13 +63,6 @@ struct dirent *vfswrap_readdir(connection_struct *conn, DIR *dirp) struct dirent *result; START_PROFILE(syscall_readdir); - -#ifdef VFS_CHECK_NULL - if (dirp == NULL) { - smb_panic("NULL pointer passed to vfswrap_readdir()\n"); - } -#endif - result = readdir(dirp); END_PROFILE(syscall_readdir); return result; @@ -99,12 +75,6 @@ int vfswrap_mkdir(connection_struct *conn, const char *path, mode_t mode) START_PROFILE(syscall_mkdir); -#ifdef VFS_CHECK_NULL - if (path == NULL) { - smb_panic("NULL pointer passed to vfswrap_mkdir()\n"); - } -#endif - if (lp_inherit_acls(SNUM(conn)) && (has_dacl = directory_has_default_acl(conn, parent_dirname(path)))) mode = 0777; @@ -134,13 +104,6 @@ int vfswrap_rmdir(connection_struct *conn, const char *path) int result; START_PROFILE(syscall_rmdir); - -#ifdef VFS_CHECK_NULL - if (path == NULL) { - smb_panic("NULL pointer passed to vfswrap_rmdir()\n"); - } -#endif - result = rmdir(path); END_PROFILE(syscall_rmdir); return result; @@ -151,13 +114,6 @@ int vfswrap_closedir(connection_struct *conn, DIR *dirp) int result; START_PROFILE(syscall_closedir); - -#ifdef VFS_CHECK_NULL - if (dirp == NULL) { - smb_panic("NULL pointer passed to vfswrap_closedir()\n"); - } -#endif - result = closedir(dirp); END_PROFILE(syscall_closedir); return result; @@ -170,13 +126,6 @@ int vfswrap_open(connection_struct *conn, const char *fname, int flags, mode_t m int result; START_PROFILE(syscall_open); - -#ifdef VFS_CHECK_NULL - if (fname == NULL) { - smb_panic("NULL pointer passed to vfswrap_open()\n"); - } -#endif - result = sys_open(fname, flags, mode); END_PROFILE(syscall_open); return result; @@ -198,13 +147,6 @@ ssize_t vfswrap_read(files_struct *fsp, int fd, void *data, size_t n) ssize_t result; START_PROFILE_BYTES(syscall_read, n); - -#ifdef VFS_CHECK_NULL - if (data == NULL) { - smb_panic("NULL pointer passed to vfswrap_read()\n"); - } -#endif - result = read(fd, data, n); END_PROFILE(syscall_read); return result; @@ -215,13 +157,6 @@ ssize_t vfswrap_write(files_struct *fsp, int fd, const void *data, size_t n) ssize_t result; START_PROFILE_BYTES(syscall_write, n); - -#ifdef VFS_CHECK_NULL - if (data == NULL) { - smb_panic("NULL pointer passed to vfswrap_write()\n"); - } -#endif - result = write(fd, data, n); END_PROFILE(syscall_write); return result; @@ -256,13 +191,6 @@ int vfswrap_rename(connection_struct *conn, const char *old, const char *new) int result; START_PROFILE(syscall_rename); - -#ifdef VFS_CHECK_NULL - if ((old == NULL) || (new == NULL)) { - smb_panic("NULL pointer passed to vfswrap_rename()\n"); - } -#endif - result = rename(old, new); END_PROFILE(syscall_rename); return result; @@ -288,13 +216,6 @@ int vfswrap_stat(connection_struct *conn, const char *fname, SMB_STRUCT_STAT *sb int result; START_PROFILE(syscall_stat); - -#ifdef VFS_CHECK_NULL - if ((fname == NULL) || (sbuf == NULL)) { - smb_panic("NULL pointer passed to vfswrap_stat()\n"); - } -#endif - result = sys_stat(fname, sbuf); END_PROFILE(syscall_stat); return result; @@ -305,13 +226,6 @@ int vfswrap_fstat(files_struct *fsp, int fd, SMB_STRUCT_STAT *sbuf) int result; START_PROFILE(syscall_fstat); - -#ifdef VFS_CHECK_NULL - if (sbuf == NULL) { - smb_panic("NULL pointer passed to vfswrap_fstat()\n"); - } -#endif - result = sys_fstat(fd, sbuf); END_PROFILE(syscall_fstat); return result; @@ -322,13 +236,6 @@ int vfswrap_lstat(connection_struct *conn, const char *path, SMB_STRUCT_STAT *sb int result; START_PROFILE(syscall_lstat); - -#ifdef VFS_CHECK_NULL - if ((path == NULL) || (sbuf == NULL)) { - smb_panic("NULL pointer passed to vfswrap_lstat()\n"); - } -#endif - result = sys_lstat(path, sbuf); END_PROFILE(syscall_lstat); return result; @@ -339,13 +246,6 @@ int vfswrap_unlink(connection_struct *conn, const char *path) int result; START_PROFILE(syscall_unlink); - -#ifdef VFS_CHECK_NULL - if (path == NULL) { - smb_panic("NULL pointer passed to vfswrap_unlink()\n"); - } -#endif - result = unlink(path); END_PROFILE(syscall_unlink); return result; @@ -357,12 +257,6 @@ int vfswrap_chmod(connection_struct *conn, const char *path, mode_t mode) START_PROFILE(syscall_chmod); -#ifdef VFS_CHECK_NULL - if (path == NULL) { - smb_panic("NULL pointer passed to vfswrap_chmod()\n"); - } -#endif - /* * We need to do this due to the fact that the default POSIX ACL * chmod modifies the ACL *mask* for the group owner, not the @@ -418,13 +312,6 @@ int vfswrap_chown(connection_struct *conn, const char *path, uid_t uid, gid_t gi int result; START_PROFILE(syscall_chown); - -#ifdef VFS_CHECK_NULL - if (path == NULL) { - smb_panic("NULL pointer passed to vfswrap_chown()\n"); - } -#endif - result = sys_chown(path, uid, gid); END_PROFILE(syscall_chown); return result; @@ -446,13 +333,6 @@ int vfswrap_chdir(connection_struct *conn, const char *path) int result; START_PROFILE(syscall_chdir); - -#ifdef VFS_CHECK_NULL - if (path == NULL) { - smb_panic("NULL pointer passed to vfswrap_chdir()\n"); - } -#endif - result = chdir(path); END_PROFILE(syscall_chdir); return result; @@ -463,13 +343,6 @@ char *vfswrap_getwd(connection_struct *conn, char *path) char *result; START_PROFILE(syscall_getwd); - -#ifdef VFS_CHECK_NULL - if (path == NULL) { - smb_panic("NULL pointer passed to vfswrap_getwd()\n"); - } -#endif - result = sys_getwd(path); END_PROFILE(syscall_getwd); return result; @@ -480,13 +353,6 @@ int vfswrap_utime(connection_struct *conn, const char *path, struct utimbuf *tim int result; START_PROFILE(syscall_utime); - -#ifdef VFS_CHECK_NULL - if ((path == NULL) || (times == NULL)) { - smb_panic("NULL pointer passed to vfswrap_utime()\n"); - } -#endif - result = utime(path, times); END_PROFILE(syscall_utime); return result; @@ -642,12 +508,6 @@ int vfswrap_symlink(connection_struct *conn, const char *oldpath, const char *ne int result; START_PROFILE(syscall_symlink); - -#ifdef VFS_CHECK_NULL - if ((oldpath == NULL) || (newpath == NULL)) - smb_panic("NULL pointer passed to vfswrap_symlink()\n"); -#endif - result = sys_symlink(oldpath, newpath); END_PROFILE(syscall_symlink); return result; @@ -658,12 +518,6 @@ int vfswrap_readlink(connection_struct *conn, const char *path, char *buf, size_ int result; START_PROFILE(syscall_readlink); - -#ifdef VFS_CHECK_NULL - if ((path == NULL) || (buf == NULL)) - smb_panic("NULL pointer passed to vfswrap_readlink()\n"); -#endif - result = sys_readlink(path, buf, bufsiz); END_PROFILE(syscall_readlink); return result; @@ -674,11 +528,6 @@ int vfswrap_link(connection_struct *conn, const char *oldpath, const char *newpa int result; START_PROFILE(syscall_link); - -#ifdef VFS_CHECK_NULL - if ((oldpath == NULL) || (newpath == NULL)) - smb_panic("NULL pointer passed to vfswrap_link()\n"); -#endif result = sys_link(oldpath, newpath); END_PROFILE(syscall_link); return result; @@ -689,16 +538,21 @@ int vfswrap_mknod(connection_struct *conn, const char *pathname, mode_t mode, SM int result; START_PROFILE(syscall_mknod); - -#ifdef VFS_CHECK_NULL - if (pathname == NULL) - smb_panic("NULL pointer passed to vfswrap_mknod()\n"); -#endif result = sys_mknod(pathname, mode, dev); END_PROFILE(syscall_mknod); return result; } +char *vfswrap_realpath(connection_struct *conn, const char *path, char *resolved_path) +{ + char *result; + + START_PROFILE(syscall_realpath); + result = sys_realpath(path, resolved_path); + END_PROFILE(syscall_realpath); + return result; +} + size_t vfswrap_fget_nt_acl(files_struct *fsp, int fd, SEC_DESC **ppdesc) { size_t result; diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c index 8d7ee2b075..6416d8e73e 100644 --- a/source3/smbd/vfs.c +++ b/source3/smbd/vfs.c @@ -1,5 +1,6 @@ /* - Unix SMB/CIFS implementation. + Unix SMB/Netbios implementation. + Version 1.9. VFS initialisation and support functions Copyright (C) Tim Potter 1999 @@ -31,7 +32,7 @@ struct vfs_syminfo { very important. They must be in the same order as defined in vfs.h. Change at your own peril. */ -static struct vfs_ops default_vfs_ops = { +struct vfs_ops default_vfs_ops = { /* Disk operations */ @@ -73,6 +74,7 @@ static struct vfs_ops default_vfs_ops = { vfswrap_readlink, vfswrap_link, vfswrap_mknod, + vfswrap_realpath, vfswrap_fget_nt_acl, vfswrap_get_nt_acl, @@ -131,46 +133,48 @@ static BOOL vfs_init_default(connection_struct *conn) static BOOL vfs_init_custom(connection_struct *conn) { int vfs_version = -1; - struct vfs_ops *ops, *(*init_fptr)(int *, struct vfs_ops *); + struct vfs_ops *ops, *(*init_fptr)(int *, struct vfs_ops *); - DEBUG(3, ("Initialising custom vfs hooks from %s\n", - lp_vfsobj(SNUM(conn)))); + DEBUG(3, ("Initialising custom vfs hooks from %s\n", + lp_vfsobj(SNUM(conn)))); + + /* Open object file */ - /* Open object file */ - if ((conn->dl_handle = sys_dlopen(lp_vfsobj(SNUM(conn)), - RTLD_NOW | RTLD_GLOBAL)) == NULL) { - DEBUG(0, ("Error opening %s: %s\n", lp_vfsobj(SNUM(conn)), sys_dlerror())); + if ((conn->dl_handle = sys_dlopen(lp_vfsobj(SNUM(conn)), RTLD_NOW | RTLD_GLOBAL)) == NULL) { + DEBUG(0, ("Error opening %s: %s\n", lp_vfsobj(SNUM(conn)), dlerror())); return False; - } + } + + /* Get handle on vfs_init() symbol */ - /* Get handle on vfs_init() symbol */ - init_fptr = (struct vfs_ops *(*)(int *, struct vfs_ops *))sys_dlsym(conn->dl_handle, "vfs_init"); + init_fptr = (struct vfs_ops *(*)(int *, struct vfs_ops *))sys_dlsym(conn->dl_handle, "vfs_init"); - if (init_fptr == NULL) { + if (init_fptr == NULL) { DEBUG(0, ("No vfs_init() symbol found in %s\n", - lp_vfsobj(SNUM(conn)))); + lp_vfsobj(SNUM(conn)))); return False; - } + } + + /* Initialise vfs_ops structure */ - /* Initialise vfs_ops structure */ conn->vfs_ops = default_vfs_ops; - if ((ops = init_fptr(&vfs_version, &conn->vfs_ops)) == NULL) { - DEBUG(0, ("vfs_init function from %s failed\n", lp_vfsobj(SNUM(conn)))); + if ((ops = init_fptr(&vfs_version, &default_vfs_ops)) == NULL) { + DEBUG(0, ("vfs_init function from %s failed\n", lp_vfsobj(SNUM(conn)))); return False; - } - + } + if (vfs_version != SMB_VFS_INTERFACE_VERSION) { DEBUG(0, ("vfs_init returned wrong interface version info (was %d, should be %d)\n", - vfs_version, SMB_VFS_INTERFACE_VERSION )); + vfs_version, SMB_VFS_INTERFACE_VERSION )); return False; } - + if (ops != &conn->vfs_ops) { memcpy(&conn->vfs_ops, ops, sizeof(struct vfs_ops)); } - return True; + return True; } #endif @@ -276,7 +280,7 @@ BOOL vfs_object_exist(connection_struct *conn,const char *fname,SMB_STRUCT_STAT Check if a file exists in the vfs. ********************************************************************/ -BOOL vfs_file_exist(connection_struct *conn,char *fname,SMB_STRUCT_STAT *sbuf) +BOOL vfs_file_exist(connection_struct *conn, const char *fname,SMB_STRUCT_STAT *sbuf) { SMB_STRUCT_STAT st; |