Merge branch 'v3-2-test' of ssh://git.samba.org/data/git/samba into v3-2-test
authorJelmer Vernooij <jelmer@samba.org>
Tue, 8 Jan 2008 14:43:11 +0000 (15:43 +0100)
committerJelmer Vernooij <jelmer@samba.org>
Tue, 8 Jan 2008 14:43:11 +0000 (15:43 +0100)
65 files changed:
examples/VFS/skel_opaque.c
examples/VFS/skel_transparent.c
packaging/Example/setup.sh
source/Makefile.in
source/client/mount.cifs.c
source/include/vfs.h
source/include/vfs_macros.h
source/lib/dbwrap_tdb.c
source/lib/debug.c
source/lib/netapi/examples/netdomjoin-gui/netdomjoin-gui.c
source/lib/netapi/examples/netdomjoin/netdomjoin.c
source/lib/netapi/joindomain.c
source/lib/netapi/netapi.c
source/lib/netapi/netapi.h
source/lib/substitute.c
source/lib/sysacls.c
source/lib/talloc_stack.c
source/lib/util.c
source/libads/ldap.c
source/libgpo/gpo_filesync.c
source/libnet/libnet_join.c
source/libnet/libnet_join.h
source/libsmb/dsgetdcname.c
source/locking/locking.c
source/locking/posix.c
source/modules/nfs4_acls.c
source/modules/vfs_afsacl.c
source/modules/vfs_aixacl.c
source/modules/vfs_aixacl2.c
source/modules/vfs_audit.c
source/modules/vfs_cacheprime.c
source/modules/vfs_cap.c
source/modules/vfs_commit.c
source/modules/vfs_default.c
source/modules/vfs_extd_audit.c
source/modules/vfs_fake_perms.c
source/modules/vfs_full_audit.c
source/modules/vfs_gpfs.c
source/modules/vfs_hpuxacl.c
source/modules/vfs_irixacl.c
source/modules/vfs_posixacl.c
source/modules/vfs_prealloc.c
source/modules/vfs_readahead.c
source/modules/vfs_solarisacl.c
source/modules/vfs_tru64acl.c
source/modules/vfs_zfsacl.c
source/passdb/secrets.c
source/printing/nt_printing.c
source/printing/printfsp.c
source/smbd/aio.c
source/smbd/dir.c
source/smbd/dosmode.c
source/smbd/fileio.c
source/smbd/nttrans.c
source/smbd/open.c
source/smbd/oplock_linux.c
source/smbd/posix_acls.c
source/smbd/reply.c
source/smbd/trans2.c
source/smbd/vfs.c
source/torture/cmd_vfs.c
source/utils/net_ads.c
source/winbindd/winbindd.c
source/winbindd/winbindd_cache.c
source/winbindd/winbindd_cm.c

index fd4b20618514c68550aec3d96b75ac4bbc35c0a4..d5cedaf5d2258ea458cdfe0180b20b14006c8397 100644 (file)
@@ -135,9 +135,9 @@ static ssize_t skel_read(vfs_handle_struct *handle, files_struct *fsp, int fd, v
        return vfswrap_read(NULL, fsp, fd, data, n);
 }
 
-static ssize_t skel_pread(vfs_handle_struct *handle, struct files_struct *fsp, int fd, void *data, size_t n, SMB_OFF_T offset)
+static ssize_t skel_pread(vfs_handle_struct *handle, struct files_struct *fsp, void *data, size_t n, SMB_OFF_T offset)
 {
-       return vfswrap_pread(NULL, fsp, fd, data, n, offset);
+       return vfswrap_pread(NULL, fsp, data, n, offset);
 }
 
 static ssize_t skel_write(vfs_handle_struct *handle, files_struct *fsp, int fd, const void *data, size_t n)
@@ -145,14 +145,14 @@ static ssize_t skel_write(vfs_handle_struct *handle, files_struct *fsp, int fd,
        return vfswrap_write(NULL, fsp, fd, data, n);
 }
 
-ssize_t skel_pwrite(vfs_handle_struct *handle, struct files_struct *fsp, int fd, const void *data, size_t n, SMB_OFF_T offset)
+ssize_t skel_pwrite(vfs_handle_struct *handle, struct files_struct *fsp, const void *data, size_t n, SMB_OFF_T offset)
 {
-       return vfswrap_pwrite(NULL, fsp, fd, data, n, offset);
+       return vfswrap_pwrite(NULL, fsp, data, n, offset);
 }
 
-static SMB_OFF_T skel_lseek(vfs_handle_struct *handle, files_struct *fsp, int filedes, SMB_OFF_T offset, int whence)
+static SMB_OFF_T skel_lseek(vfs_handle_struct *handle, files_struct *fsp, SMB_OFF_T offset, int whence)
 {
-       return vfswrap_lseek(NULL, fsp, filedes, offset, whence);
+       return vfswrap_lseek(NULL, fsp, offset, whence);
 }
 
 static ssize_t skel_sendfile(vfs_handle_struct *handle, int tofd, files_struct *fsp, int fromfd, const DATA_BLOB *hdr,
@@ -171,9 +171,9 @@ static int skel_rename(vfs_handle_struct *handle,  const char *oldname, const ch
        return vfswrap_rename(NULL,  oldname, newname);
 }
 
-static int skel_fsync(vfs_handle_struct *handle, files_struct *fsp, int fd)
+static int skel_fsync(vfs_handle_struct *handle, files_struct *fsp)
 {
-       return vfswrap_fsync(NULL, fsp, fd);
+       return vfswrap_fsync(NULL, fsp);
 }
 
 static int skel_stat(vfs_handle_struct *handle,  const char *fname, SMB_STRUCT_STAT *sbuf)
@@ -181,9 +181,9 @@ static int skel_stat(vfs_handle_struct *handle,  const char *fname, SMB_STRUCT_S
        return vfswrap_stat(NULL,  fname, sbuf);
 }
 
-static int skel_fstat(vfs_handle_struct *handle, files_struct *fsp, int fd, SMB_STRUCT_STAT *sbuf)
+static int skel_fstat(vfs_handle_struct *handle, files_struct *fsp, SMB_STRUCT_STAT *sbuf)
 {
-       return vfswrap_fstat(NULL, fsp, fd, sbuf);
+       return vfswrap_fstat(NULL, fsp, sbuf);
 }
 
 static int skel_lstat(vfs_handle_struct *handle,  const char *path, SMB_STRUCT_STAT *sbuf)
@@ -201,9 +201,9 @@ static int skel_chmod(vfs_handle_struct *handle,  const char *path, mode_t mode)
        return vfswrap_chmod(NULL,  path, mode);
 }
 
-static int skel_fchmod(vfs_handle_struct *handle, files_struct *fsp, int fd, mode_t mode)
+static int skel_fchmod(vfs_handle_struct *handle, files_struct *fsp, mode_t mode)
 {
-       return vfswrap_fchmod(NULL, fsp, fd, mode);
+       return vfswrap_fchmod(NULL, fsp, mode);
 }
 
 static int skel_chown(vfs_handle_struct *handle,  const char *path, uid_t uid, gid_t gid)
@@ -211,9 +211,9 @@ static int skel_chown(vfs_handle_struct *handle,  const char *path, uid_t uid, g
        return vfswrap_chown(NULL,  path, uid, gid);
 }
 
-static int skel_fchown(vfs_handle_struct *handle, files_struct *fsp, int fd, uid_t uid, gid_t gid)
+static int skel_fchown(vfs_handle_struct *handle, files_struct *fsp, uid_t uid, gid_t gid)
 {
-       return vfswrap_fchown(NULL, fsp, fd, uid, gid);
+       return vfswrap_fchown(NULL, fsp, uid, gid);
 }
 
 static int skel_lchown(vfs_handle_struct *handle,  const char *path, uid_t uid, gid_t gid)
@@ -236,14 +236,14 @@ static int skel_ntimes(vfs_handle_struct *handle,  const char *path, const struc
        return vfswrap_ntimes(NULL,  path, ts);
 }
 
-static int skel_ftruncate(vfs_handle_struct *handle, files_struct *fsp, int fd, SMB_OFF_T offset)
+static int skel_ftruncate(vfs_handle_struct *handle, files_struct *fsp, SMB_OFF_T offset)
 {
-       return vfswrap_ftruncate(NULL, fsp, fd, offset);
+       return vfswrap_ftruncate(NULL, fsp, offset);
 }
 
-static bool skel_lock(vfs_handle_struct *handle, files_struct *fsp, int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type)
+static bool skel_lock(vfs_handle_struct *handle, files_struct *fsp, int op, SMB_OFF_T offset, SMB_OFF_T count, int type)
 {
-       return vfswrap_lock(NULL, fsp, fd, op, offset, count, type);
+       return vfswrap_lock(NULL, fsp, op, offset, count, type);
 }
 
 static bool skel_getlock(vfs_handle_struct *handle, files_struct *fsp, int fd, SMB_OFF_T *poffset, SMB_OFF_T *pcount, int *ptype, pid_t *ppid)
@@ -301,7 +301,7 @@ static struct file_id skel_file_id_create(vfs_handle_struct *handle,
 }
 
 static size_t skel_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
-       int fd, uint32 security_info, SEC_DESC **ppdesc)
+       uint32 security_info, SEC_DESC **ppdesc)
 {
        errno = ENOSYS;
        return 0;
@@ -314,8 +314,8 @@ static size_t skel_get_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
        return 0;
 }
 
-static NTSTATUS skel_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp, int
-       fd, uint32 security_info_sent, SEC_DESC *psd)
+static NTSTATUS skel_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
+       uint32 security_info_sent, SEC_DESC *psd)
 {
        errno = ENOSYS;
        return NT_STATUS_NOT_IMPLEMENTED;
index 2512f4d6dbdddd6bcd3fa1ceddc16b8db9489a94..37570b8ab0da0a5b644514d488751a0c34c71b9d 100644 (file)
@@ -129,9 +129,9 @@ static ssize_t skel_read(vfs_handle_struct *handle, files_struct *fsp, int fd, v
        return SMB_VFS_NEXT_READ(handle, fsp, fd, data, n);
 }
 
-static ssize_t skel_pread(vfs_handle_struct *handle, files_struct *fsp, int fd, void *data, size_t n, SMB_OFF_T offset)
+static ssize_t skel_pread(vfs_handle_struct *handle, files_struct *fsp, void *data, size_t n, SMB_OFF_T offset)
 {
-       return SMB_VFS_NEXT_PREAD(handle, fsp, fd, data, n, offset);
+       return SMB_VFS_NEXT_PREAD(handle, fsp, data, n, offset);
 }
 
 static ssize_t skel_write(vfs_handle_struct *handle, files_struct *fsp, int fd, const void *data, size_t n)
@@ -139,14 +139,14 @@ static ssize_t skel_write(vfs_handle_struct *handle, files_struct *fsp, int fd,
        return SMB_VFS_NEXT_WRITE(handle, fsp, fd, data, n);
 }
 
-static ssize_t skel_pwrite(vfs_handle_struct *handle, files_struct *fsp, int fd, const void *data, size_t n, SMB_OFF_T offset)
+static ssize_t skel_pwrite(vfs_handle_struct *handle, files_struct *fsp, const void *data, size_t n, SMB_OFF_T offset)
 {
-       return SMB_VFS_NEXT_PWRITE(handle, fsp, fd, data, n, offset);
+       return SMB_VFS_NEXT_PWRITE(handle, fsp, data, n, offset);
 }
 
-static SMB_OFF_T skel_lseek(vfs_handle_struct *handle, files_struct *fsp, int filedes, SMB_OFF_T offset, int whence)
+static SMB_OFF_T skel_lseek(vfs_handle_struct *handle, files_struct *fsp, SMB_OFF_T offset, int whence)
 {
-       return SMB_VFS_NEXT_LSEEK(handle, fsp, filedes, offset, whence);
+       return SMB_VFS_NEXT_LSEEK(handle, fsp, offset, whence);
 }
 
 static ssize_t skel_sendfile(vfs_handle_struct *handle, int tofd, files_struct *fsp, int fromfd, const DATA_BLOB *hdr, SMB_OFF_T offset, size_t n)
@@ -164,9 +164,9 @@ static int skel_rename(vfs_handle_struct *handle,  const char *oldname, const ch
        return SMB_VFS_NEXT_RENAME(handle, oldname, newname);
 }
 
-static int skel_fsync(vfs_handle_struct *handle, files_struct *fsp, int fd)
+static int skel_fsync(vfs_handle_struct *handle, files_struct *fsp)
 {
-       return SMB_VFS_NEXT_FSYNC(handle, fsp, fd);
+       return SMB_VFS_NEXT_FSYNC(handle, fsp);
 }
 
 static int skel_stat(vfs_handle_struct *handle,  const char *fname, SMB_STRUCT_STAT *sbuf)
@@ -174,9 +174,9 @@ static int skel_stat(vfs_handle_struct *handle,  const char *fname, SMB_STRUCT_S
        return SMB_VFS_NEXT_STAT(handle, fname, sbuf);
 }
 
-static int skel_fstat(vfs_handle_struct *handle, files_struct *fsp, int fd, SMB_STRUCT_STAT *sbuf)
+static int skel_fstat(vfs_handle_struct *handle, files_struct *fsp, SMB_STRUCT_STAT *sbuf)
 {
-       return SMB_VFS_NEXT_FSTAT(handle, fsp, fd, sbuf);
+       return SMB_VFS_NEXT_FSTAT(handle, fsp, sbuf);
 }
 
 static int skel_lstat(vfs_handle_struct *handle,  const char *path, SMB_STRUCT_STAT *sbuf)
@@ -194,9 +194,9 @@ static int skel_chmod(vfs_handle_struct *handle,  const char *path, mode_t mode)
        return SMB_VFS_NEXT_CHMOD(handle, path, mode);
 }
 
-static int skel_fchmod(vfs_handle_struct *handle, files_struct *fsp, int fd, mode_t mode)
+static int skel_fchmod(vfs_handle_struct *handle, files_struct *fsp, mode_t mode)
 {
-       return SMB_VFS_NEXT_FCHMOD(handle, fsp, fd, mode);
+       return SMB_VFS_NEXT_FCHMOD(handle, fsp, mode);
 }
 
 static int skel_chown(vfs_handle_struct *handle,  const char *path, uid_t uid, gid_t gid)
@@ -204,9 +204,9 @@ static int skel_chown(vfs_handle_struct *handle,  const char *path, uid_t uid, g
        return SMB_VFS_NEXT_CHOWN(handle, path, uid, gid);
 }
 
-static int skel_fchown(vfs_handle_struct *handle, files_struct *fsp, int fd, uid_t uid, gid_t gid)
+static int skel_fchown(vfs_handle_struct *handle, files_struct *fsp, uid_t uid, gid_t gid)
 {
-       return SMB_VFS_NEXT_FCHOWN(handle, fsp, fd, uid, gid);
+       return SMB_VFS_NEXT_FCHOWN(handle, fsp, uid, gid);
 }
 
 static int skel_lchown(vfs_handle_struct *handle,  const char *path, uid_t uid, gid_t gid)
@@ -229,14 +229,14 @@ static int skel_ntimes(vfs_handle_struct *handle,  const char *path, const struc
        return SMB_VFS_NEXT_NTIMES(handle, path, ts);
 }
 
-static int skel_ftruncate(vfs_handle_struct *handle, files_struct *fsp, int fd, SMB_OFF_T offset)
+static int skel_ftruncate(vfs_handle_struct *handle, files_struct *fsp, SMB_OFF_T offset)
 {
-       return SMB_VFS_NEXT_FTRUNCATE(handle, fsp, fd, offset);
+       return SMB_VFS_NEXT_FTRUNCATE(handle, fsp, offset);
 }
 
-static bool skel_lock(vfs_handle_struct *handle, files_struct *fsp, int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type)
+static bool skel_lock(vfs_handle_struct *handle, files_struct *fsp, int op, SMB_OFF_T offset, SMB_OFF_T count, int type)
 {
-       return SMB_VFS_NEXT_LOCK(handle, fsp, fd, op, offset, count, type);
+       return SMB_VFS_NEXT_LOCK(handle, fsp, op, offset, count, type);
 }
 
 static bool skel_getlock(vfs_handle_struct *handle, files_struct *fsp, int fd, SMB_OFF_T *poffset, SMB_OFF_T *pcount, int *ptype, pid_t *ppid)
@@ -290,9 +290,9 @@ static struct file_id skel_file_id_create(vfs_handle_struct *handle,
 }
 
 static size_t skel_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
-       int fd, uint32 security_info, SEC_DESC **ppdesc)
+       uint32 security_info, SEC_DESC **ppdesc)
 {
-       return SMB_VFS_NEXT_FGET_NT_ACL(handle, fsp, fd, security_info, ppdesc);
+       return SMB_VFS_NEXT_FGET_NT_ACL(handle, fsp, security_info, ppdesc);
 }
 
 static size_t skel_get_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
@@ -302,9 +302,9 @@ static size_t skel_get_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
 }
 
 static NTSTATUS skel_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
-       int fd, uint32 security_info_sent, SEC_DESC *psd)
+       uint32 security_info_sent, SEC_DESC *psd)
 {
-       return SMB_VFS_NEXT_FSET_NT_ACL(handle, fsp, fd, security_info_sent, psd);
+       return SMB_VFS_NEXT_FSET_NT_ACL(handle, fsp, security_info_sent, psd);
 }
 
 static NTSTATUS skel_set_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
index 994b16d5ef0fae3b1e6d95bfe7da61d785322008..7fd8fc41105f77708cb72d373c29b21071b03433 100755 (executable)
@@ -24,4 +24,4 @@ echo "Done. Now settting up samba command"
 ln /sbin/init.d/samba.init /sbin/samba
 echo "Done."
 echo "To start / stop samba:"
-echo " execute:  samba [start | stop]
+echo " execute:  samba [start | stop]"
index b10425b934095215da7cf4258ed8bdd641fc5ccc..a3a7e5628f43a7f8070dc6a9ffeee41bd8c7a755 100644 (file)
@@ -1993,6 +1993,7 @@ clean: delheaders
        -rm -f $(PRECOMPILED_HEADER)
        -rm -f core */*~ *~ \
                */*.o */*/*.o */*/*/*.o \
+               ../testsuite/*/*.o \
                */*.@SHLIBEXT@ */*/*.@SHLIBEXT@ */*/*/*.@SHLIBEXT@ \
                $(TOPFILES) $(BIN_PROGS) $(SBIN_PROGS) $(ROOT_SBIN_PROGS) \
                $(MODULES) $(TORTURE_PROGS) $(LIBSMBCLIENT) $(LIBADDNS) \
index a25ccc54de5cb1ab856df912d973cd1e2a4fe7b4..79f402a7d486cc6ae2d09a0cd81dbbfba459d553 100644 (file)
@@ -39,7 +39,7 @@
 #include <fcntl.h>
 
 #define MOUNT_CIFS_VERSION_MAJOR "1"
-#define MOUNT_CIFS_VERSION_MINOR "10"
+#define MOUNT_CIFS_VERSION_MINOR "11"
 
 #ifndef MOUNT_CIFS_VENDOR_SUFFIX
  #ifdef _SAMBA_BUILD_
@@ -136,14 +136,16 @@ static void mount_cifs_usage(void)
        printf("\nLess commonly used options:");
        printf("\n\tcredentials=<filename>,guest,perm,noperm,setuids,nosetuids,rw,ro,");
        printf("\n\tsep=<char>,iocharset=<codepage>,suid,nosuid,exec,noexec,serverino,");
-       printf("\n\tdirectio,mapchars,nomapchars,nolock,servernetbiosname=<SRV_RFC1001NAME>");
+       printf("\n\tmapchars,nomapchars,nolock,servernetbiosname=<SRV_RFC1001NAME>");
+       printf("\n\tdirectio,nounix,cifsacl,sec=<authentication mechanism>,sign");
        printf("\n\nOptions not needed for servers supporting CIFS Unix extensions");
        printf("\n\t(e.g. unneeded for mounts to most Samba versions):");
        printf("\n\tuid=<uid>,gid=<gid>,dir_mode=<mode>,file_mode=<mode>,sfu");
        printf("\n\nRarely used options:");
        printf("\n\tport=<tcpport>,rsize=<size>,wsize=<size>,unc=<unc_name>,ip=<ip_address>,");
        printf("\n\tdev,nodev,nouser_xattr,netbiosname=<OUR_RFC1001NAME>,hard,soft,intr,");
-       printf("\n\tnointr,ignorecase,noposixpaths,noacl");
+       printf("\n\tnointr,ignorecase,noposixpaths,noacl,prefixpath=<path>,nobrl");
+       printf("\n\tin6_addr");
        printf("\n\nOptions are described in more detail in the manual page");
        printf("\n\tman 8 mount.cifs\n");
        printf("\nTo display the version number of the mount helper:");
index 5a3ec58b7a17d986fc0eb5eb177081a34de77329..02cfb12836fa77477636c32a1b749a568e442622 100644 (file)
 /* Leave at 22 - not yet released. Change get_nt_acl to return NTSTATUS - vl */
 /* Leave at 22 - not yet released. Change get_nt_acl to *not* take a
  * files_struct. - obnox.*/
+/* Leave at 22 - not yet released. Remove parameter fd from fget_nt_acl. - obnox */
+/* Leave at 22 - not yet released. Remove parameter fd from gset_nt_acl. - obnox */
+/* Leave at 22 - not yet released. Remove parameter fd from pread. - obnox */
+/* Leave at 22 - not yet released. Remove parameter fd from pwrite. - obnox */
+/* Leave at 22 - not yet released. Remove parameter fd from lseek. - obnox */
+/* Leave at 22 - not yet released. Remove parameter fd from fsync. - obnox */
+/* Leave at 22 - not yet released. Remove parameter fd from fstat. - obnox */
+/* Leave at 22 - not yet released. Remove parameter fd from fchmod. - obnox */
+/* Leave at 22 - not yet released. Remove parameter fd from fchown. - obnox */
+/* Leave at 22 - not yet released. Remove parameter fd from ftruncate. - obnox */
+/* Leave at 22 - not yet released. Remove parameter fd from lock. - obnox */
+/* Leave at 22 - not yet released. Remove parameter fd from kernel_flock. - obnox */
+/* Leave at 22 - not yet released. Remove parameter fd from linux_setlease. - obnox */
+/* Leave at 22 - not yet released. Remove parameter fd from getlock. - obnox */
+/* Leave at 22 - not yet released. Remove parameter fd from sys_acl_get_fd. - obnox */
+/* Leave at 22 - not yet released. Remove parameter fd from fchmod_acl. - obnox */
+/* Leave at 22 - not yet released. Remove parameter fd from sys_acl_set_fd. - obnox */
+/* Leave at 22 - not yet released. Remove parameter fd from fgetxattr. - obnox */
+/* Leave at 22 - not yet released. Remove parameter fd from flistxattr. - obnox */
+/* Leave at 22 - not yet released. Remove parameter fd from fremovexattr. - obnox */
+/* Leave at 22 - not yet released. Remove parameter fd from fsetxattr. - obnox */
+/* Leave at 22 - not yet released. Remove parameter fd from aio_cancel. - obnox */
+
+
 
 #define SMB_VFS_INTERFACE_VERSION 22
 
@@ -267,31 +291,31 @@ struct vfs_ops {
                int (*open)(struct vfs_handle_struct *handle, const char *fname, files_struct *fsp, int flags, mode_t mode);
                int (*close_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd);
                ssize_t (*read)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, void *data, size_t n);
-               ssize_t (*pread)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, void *data, size_t n, SMB_OFF_T offset);
+               ssize_t (*pread)(struct vfs_handle_struct *handle, struct files_struct *fsp, void *data, size_t n, SMB_OFF_T offset);
                ssize_t (*write)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, const void *data, size_t n);
-               ssize_t (*pwrite)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, const void *data, size_t n, SMB_OFF_T offset);
-               SMB_OFF_T (*lseek)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, SMB_OFF_T offset, int whence);
+               ssize_t (*pwrite)(struct vfs_handle_struct *handle, struct files_struct *fsp, const void *data, size_t n, SMB_OFF_T offset);
+               SMB_OFF_T (*lseek)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_OFF_T offset, int whence);
                ssize_t (*sendfile)(struct vfs_handle_struct *handle, int tofd, files_struct *fsp, int fromfd, const DATA_BLOB *header, SMB_OFF_T offset, size_t count);
                ssize_t (*recvfile)(struct vfs_handle_struct *handle, int fromfd, files_struct *fsp, int tofd, SMB_OFF_T offset, size_t count);
                int (*rename)(struct vfs_handle_struct *handle, const char *oldname, const char *newname);
-               int (*fsync)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd);
+               int (*fsync)(struct vfs_handle_struct *handle, struct files_struct *fsp);
                int (*stat)(struct vfs_handle_struct *handle, const char *fname, SMB_STRUCT_STAT *sbuf);
-               int (*fstat)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, SMB_STRUCT_STAT *sbuf);
+               int (*fstat)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_STAT *sbuf);
                int (*lstat)(struct vfs_handle_struct *handle, const char *path, SMB_STRUCT_STAT *sbuf);
                int (*unlink)(struct vfs_handle_struct *handle, const char *path);
                int (*chmod)(struct vfs_handle_struct *handle, const char *path, mode_t mode);
-               int (*fchmod)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, mode_t mode);
+               int (*fchmod)(struct vfs_handle_struct *handle, struct files_struct *fsp, mode_t mode);
                int (*chown)(struct vfs_handle_struct *handle, const char *path, uid_t uid, gid_t gid);
-               int (*fchown)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, uid_t uid, gid_t gid);
+               int (*fchown)(struct vfs_handle_struct *handle, struct files_struct *fsp, uid_t uid, gid_t gid);
                int (*lchown)(struct vfs_handle_struct *handle, const char *path, uid_t uid, gid_t gid);
                int (*chdir)(struct vfs_handle_struct *handle, const char *path);
                char *(*getwd)(struct vfs_handle_struct *handle, char *buf);
                int (*ntimes)(struct vfs_handle_struct *handle, const char *path, const struct timespec ts[2]);
-               int (*ftruncate)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, SMB_OFF_T offset);
-               bool (*lock)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type);
-               int (*kernel_flock)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, uint32 share_mode);
-               int (*linux_setlease)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, int leasetype);
-               bool (*getlock)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, SMB_OFF_T *poffset, SMB_OFF_T *pcount, int *ptype, pid_t *ppid);
+               int (*ftruncate)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_OFF_T offset);
+               bool (*lock)(struct vfs_handle_struct *handle, struct files_struct *fsp, int op, SMB_OFF_T offset, SMB_OFF_T count, int type);
+               int (*kernel_flock)(struct vfs_handle_struct *handle, struct files_struct *fsp, uint32 share_mode);
+               int (*linux_setlease)(struct vfs_handle_struct *handle, struct files_struct *fsp, int leasetype);
+               bool (*getlock)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_OFF_T *poffset, SMB_OFF_T *pcount, int *ptype, pid_t *ppid);
                int (*symlink)(struct vfs_handle_struct *handle, const char *oldpath, const char *newpath);
                int (*readlink)(struct vfs_handle_struct *handle, const char *path, char *buf, size_t bufsiz);
                int (*link)(struct vfs_handle_struct *handle, const char *oldpath, const char *newpath);
@@ -310,27 +334,34 @@ struct vfs_ops {
                /* NT ACL operations. */
                
                NTSTATUS (*fget_nt_acl)(struct vfs_handle_struct *handle,
-                                       struct files_struct *fsp, int fd,
+                                       struct files_struct *fsp,
                                        uint32 security_info,
                                        struct security_descriptor **ppdesc);
                NTSTATUS (*get_nt_acl)(struct vfs_handle_struct *handle,
                                       const char *name,
                                       uint32 security_info,
                                       struct security_descriptor **ppdesc);
-               NTSTATUS (*fset_nt_acl)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, uint32 security_info_sent, struct security_descriptor *psd);
-               NTSTATUS (*set_nt_acl)(struct vfs_handle_struct *handle, struct files_struct *fsp, const char *name, uint32 security_info_sent, struct security_descriptor *psd);
+               NTSTATUS (*fset_nt_acl)(struct vfs_handle_struct *handle,
+                                       struct files_struct *fsp,
+                                       uint32 security_info_sent,
+                                       struct security_descriptor *psd);
+               NTSTATUS (*set_nt_acl)(struct vfs_handle_struct *handle,
+                                      struct files_struct *fsp,
+                                      const char *name,
+                                      uint32 security_info_sent,
+                                      struct security_descriptor *psd);
                
                /* POSIX ACL operations. */
                
                int (*chmod_acl)(struct vfs_handle_struct *handle, const char *name, mode_t mode);
-               int (*fchmod_acl)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, mode_t mode);
+               int (*fchmod_acl)(struct vfs_handle_struct *handle, struct files_struct *fsp, mode_t mode);
                
                int (*sys_acl_get_entry)(struct vfs_handle_struct *handle, SMB_ACL_T theacl, int entry_id, SMB_ACL_ENTRY_T *entry_p);
                int (*sys_acl_get_tag_type)(struct vfs_handle_struct *handle, SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T *tag_type_p);
                int (*sys_acl_get_permset)(struct vfs_handle_struct *handle, SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T *permset_p);
                void * (*sys_acl_get_qualifier)(struct vfs_handle_struct *handle, SMB_ACL_ENTRY_T entry_d);
                SMB_ACL_T (*sys_acl_get_file)(struct vfs_handle_struct *handle, const char *path_p, SMB_ACL_TYPE_T type);
-               SMB_ACL_T (*sys_acl_get_fd)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd);
+               SMB_ACL_T (*sys_acl_get_fd)(struct vfs_handle_struct *handle, struct files_struct *fsp);
                int (*sys_acl_clear_perms)(struct vfs_handle_struct *handle, SMB_ACL_PERMSET_T permset);
                int (*sys_acl_add_perm)(struct vfs_handle_struct *handle, SMB_ACL_PERMSET_T permset, SMB_ACL_PERM_T perm);
                char * (*sys_acl_to_text)(struct vfs_handle_struct *handle, SMB_ACL_T theacl, ssize_t *plen);
@@ -341,7 +372,7 @@ struct vfs_ops {
                int (*sys_acl_set_permset)(struct vfs_handle_struct *handle, SMB_ACL_ENTRY_T entry, SMB_ACL_PERMSET_T permset);
                int (*sys_acl_valid)(struct vfs_handle_struct *handle, SMB_ACL_T theacl );
                int (*sys_acl_set_file)(struct vfs_handle_struct *handle, const char *name, SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl);
-               int (*sys_acl_set_fd)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, SMB_ACL_T theacl);
+               int (*sys_acl_set_fd)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_ACL_T theacl);
                int (*sys_acl_delete_def_file)(struct vfs_handle_struct *handle, const char *path);
                int (*sys_acl_get_perm)(struct vfs_handle_struct *handle, SMB_ACL_PERMSET_T permset, SMB_ACL_PERM_T perm);
                int (*sys_acl_free_text)(struct vfs_handle_struct *handle, char *text);
@@ -351,22 +382,22 @@ struct vfs_ops {
                /* EA operations. */
                ssize_t (*getxattr)(struct vfs_handle_struct *handle,const char *path, const char *name, void *value, size_t size);
                ssize_t (*lgetxattr)(struct vfs_handle_struct *handle,const char *path, const char *name, void *value, size_t size);
-               ssize_t (*fgetxattr)(struct vfs_handle_struct *handle, struct files_struct *fsp,int fd, const char *name, void *value, size_t size);
+               ssize_t (*fgetxattr)(struct vfs_handle_struct *handle, struct files_struct *fsp, const char *name, void *value, size_t size);
                ssize_t (*listxattr)(struct vfs_handle_struct *handle, const char *path, char *list, size_t size);
                ssize_t (*llistxattr)(struct vfs_handle_struct *handle, const char *path, char *list, size_t size);
-               ssize_t (*flistxattr)(struct vfs_handle_struct *handle, struct files_struct *fsp,int fd, char *list, size_t size);
+               ssize_t (*flistxattr)(struct vfs_handle_struct *handle, struct files_struct *fsp, char *list, size_t size);
                int (*removexattr)(struct vfs_handle_struct *handle, const char *path, const char *name);
                int (*lremovexattr)(struct vfs_handle_struct *handle, const char *path, const char *name);
-               int (*fremovexattr)(struct vfs_handle_struct *handle, struct files_struct *fsp,int filedes, const char *name);
+               int (*fremovexattr)(struct vfs_handle_struct *handle, struct files_struct *fsp, const char *name);
                int (*setxattr)(struct vfs_handle_struct *handle, const char *path, const char *name, const void *value, size_t size, int flags);
                int (*lsetxattr)(struct vfs_handle_struct *handle, const char *path, const char *name, const void *value, size_t size, int flags);
-               int (*fsetxattr)(struct vfs_handle_struct *handle, struct files_struct *fsp,int filedes, const char *name, const void *value, size_t size, int flags);
+               int (*fsetxattr)(struct vfs_handle_struct *handle, struct files_struct *fsp, const char *name, const void *value, size_t size, int flags);
 
                /* aio operations */
                int (*aio_read)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb);
                int (*aio_write)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb);
                ssize_t (*aio_return_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb);
-               int (*aio_cancel)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, SMB_STRUCT_AIOCB *aiocb);
+               int (*aio_cancel)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb);
                int (*aio_error_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb);
                int (*aio_fsync)(struct vfs_handle_struct *handle, struct files_struct *fsp, int op, SMB_STRUCT_AIOCB *aiocb);
                int (*aio_suspend)(struct vfs_handle_struct *handle, struct files_struct *fsp, const SMB_STRUCT_AIOCB * const aiocb[], int n, const struct timespec *timeout);
index c31d6cfc67a75ae36fd16323f36c3f5b9dc80b2b..63e566b33457df652f1496c30e441a7e2153bf7b 100644 (file)
 #define SMB_VFS_OPEN(conn, fname, fsp, flags, mode) (((conn)->vfs.ops.open)((conn)->vfs.handles.open, (fname), (fsp), (flags), (mode)))
 #define SMB_VFS_CLOSE(fsp, fd) ((fsp)->conn->vfs.ops.close_fn((fsp)->conn->vfs.handles.close_hnd, (fsp), (fd)))
 #define SMB_VFS_READ(fsp, fd, data, n) ((fsp)->conn->vfs.ops.read((fsp)->conn->vfs.handles.read, (fsp), (fd), (data), (n)))
-#define SMB_VFS_PREAD(fsp, fd, data, n, off) ((fsp)->conn->vfs.ops.pread((fsp)->conn->vfs.handles.pread, (fsp), (fd), (data), (n), (off)))
+#define SMB_VFS_PREAD(fsp, data, n, off) ((fsp)->conn->vfs.ops.pread((fsp)->conn->vfs.handles.pread, (fsp), (data), (n), (off)))
 #define SMB_VFS_WRITE(fsp, fd, data, n) ((fsp)->conn->vfs.ops.write((fsp)->conn->vfs.handles.write, (fsp), (fd), (data), (n)))
-#define SMB_VFS_PWRITE(fsp, fd, data, n, off) ((fsp)->conn->vfs.ops.pwrite((fsp)->conn->vfs.handles.pwrite, (fsp), (fd), (data), (n), (off)))
-#define SMB_VFS_LSEEK(fsp, fd, offset, whence) ((fsp)->conn->vfs.ops.lseek((fsp)->conn->vfs.handles.lseek, (fsp), (fd), (offset), (whence)))
+#define SMB_VFS_PWRITE(fsp, data, n, off) ((fsp)->conn->vfs.ops.pwrite((fsp)->conn->vfs.handles.pwrite, (fsp), (data), (n), (off)))
+#define SMB_VFS_LSEEK(fsp, offset, whence) ((fsp)->conn->vfs.ops.lseek((fsp)->conn->vfs.handles.lseek, (fsp), (offset), (whence)))
 #define SMB_VFS_SENDFILE(tofd, fsp, fromfd, header, offset, count) ((fsp)->conn->vfs.ops.sendfile((fsp)->conn->vfs.handles.sendfile, (tofd), (fsp), (fromfd), (header), (offset), (count)))
 #define SMB_VFS_RECVFILE(fromfd, fsp, tofd, offset, count) ((fsp)->conn->vfs.ops.recvfile((fsp)->conn->vfs.handles.recvfile, (fromfd), (fsp), (tofd), (offset), (count)))
 #define SMB_VFS_RENAME(conn, old, new) ((conn)->vfs.ops.rename((conn)->vfs.handles.rename, (old), (new)))
-#define SMB_VFS_FSYNC(fsp, fd) ((fsp)->conn->vfs.ops.fsync((fsp)->conn->vfs.handles.fsync, (fsp), (fd)))
+#define SMB_VFS_FSYNC(fsp) ((fsp)->conn->vfs.ops.fsync((fsp)->conn->vfs.handles.fsync, (fsp)))
 #define SMB_VFS_STAT(conn, fname, sbuf) ((conn)->vfs.ops.stat((conn)->vfs.handles.stat, (fname), (sbuf)))
-#define SMB_VFS_FSTAT(fsp, fd, sbuf) ((fsp)->conn->vfs.ops.fstat((fsp)->conn->vfs.handles.fstat, (fsp) ,(fd) ,(sbuf)))
+#define SMB_VFS_FSTAT(fsp, sbuf) ((fsp)->conn->vfs.ops.fstat((fsp)->conn->vfs.handles.fstat, (fsp), (sbuf)))
 #define SMB_VFS_LSTAT(conn, path, sbuf) ((conn)->vfs.ops.lstat((conn)->vfs.handles.lstat, (path), (sbuf)))
 #define SMB_VFS_UNLINK(conn, path) ((conn)->vfs.ops.unlink((conn)->vfs.handles.unlink, (path)))
 #define SMB_VFS_CHMOD(conn, path, mode) ((conn)->vfs.ops.chmod((conn)->vfs.handles.chmod, (path), (mode)))
-#define SMB_VFS_FCHMOD(fsp, fd, mode) ((fsp)->conn->vfs.ops.fchmod((fsp)->conn->vfs.handles.fchmod, (fsp), (fd), (mode)))
+#define SMB_VFS_FCHMOD(fsp, mode) ((fsp)->conn->vfs.ops.fchmod((fsp)->conn->vfs.handles.fchmod, (fsp), (mode)))
 #define SMB_VFS_CHOWN(conn, path, uid, gid) ((conn)->vfs.ops.chown((conn)->vfs.handles.chown, (path), (uid), (gid)))
-#define SMB_VFS_FCHOWN(fsp, fd, uid, gid) ((fsp)->conn->vfs.ops.fchown((fsp)->conn->vfs.handles.fchown, (fsp), (fd), (uid), (gid)))
+#define SMB_VFS_FCHOWN(fsp, uid, gid) ((fsp)->conn->vfs.ops.fchown((fsp)->conn->vfs.handles.fchown, (fsp), (uid), (gid)))
 #define SMB_VFS_LCHOWN(conn, path, uid, gid) ((conn)->vfs.ops.lchown((conn)->vfs.handles.lchown, (path), (uid), (gid)))
 #define SMB_VFS_CHDIR(conn, path) ((conn)->vfs.ops.chdir((conn)->vfs.handles.chdir, (path)))
 #define SMB_VFS_GETWD(conn, buf) ((conn)->vfs.ops.getwd((conn)->vfs.handles.getwd, (buf)))
 #define SMB_VFS_NTIMES(conn, path, ts) ((conn)->vfs.ops.ntimes((conn)->vfs.handles.ntimes, (path), (ts)))
-#define SMB_VFS_FTRUNCATE(fsp, fd, offset) ((fsp)->conn->vfs.ops.ftruncate((fsp)->conn->vfs.handles.ftruncate, (fsp), (fd), (offset)))
-#define SMB_VFS_LOCK(fsp, fd, op, offset, count, type) ((fsp)->conn->vfs.ops.lock((fsp)->conn->vfs.handles.lock, (fsp), (fd) ,(op), (offset), (count), (type)))
-#define SMB_VFS_KERNEL_FLOCK(fsp, fd, share_mode) ((fsp)->conn->vfs.ops.kernel_flock((fsp)->conn->vfs.handles.kernel_flock, (fsp), (fd), (share_mode)))
-#define SMB_VFS_LINUX_SETLEASE(fsp, fd, leasetype) ((fsp)->conn->vfs.ops.linux_setlease((fsp)->conn->vfs.handles.linux_setlease, (fsp), (fd), (leasetype)))
-#define SMB_VFS_GETLOCK(fsp, fd, poffset, pcount, ptype, ppid) ((fsp)->conn->vfs.ops.getlock((fsp)->conn->vfs.handles.getlock, (fsp), (fd) ,(poffset), (pcount), (ptype), (ppid)))
+#define SMB_VFS_FTRUNCATE(fsp, offset) ((fsp)->conn->vfs.ops.ftruncate((fsp)->conn->vfs.handles.ftruncate, (fsp), (offset)))
+#define SMB_VFS_LOCK(fsp, op, offset, count, type) ((fsp)->conn->vfs.ops.lock((fsp)->conn->vfs.handles.lock, (fsp), (op), (offset), (count), (type)))
+#define SMB_VFS_KERNEL_FLOCK(fsp, share_mode) ((fsp)->conn->vfs.ops.kernel_flock((fsp)->conn->vfs.handles.kernel_flock, (fsp), (share_mode)))
+#define SMB_VFS_LINUX_SETLEASE(fsp, leasetype) ((fsp)->conn->vfs.ops.linux_setlease((fsp)->conn->vfs.handles.linux_setlease, (fsp), (leasetype)))
+#define SMB_VFS_GETLOCK(fsp, poffset, pcount, ptype, ppid) ((fsp)->conn->vfs.ops.getlock((fsp)->conn->vfs.handles.getlock, (fsp), (poffset), (pcount), (ptype), (ppid)))
 #define SMB_VFS_SYMLINK(conn, oldpath, newpath) ((conn)->vfs.ops.symlink((conn)->vfs.handles.symlink, (oldpath), (newpath)))
 #define SMB_VFS_READLINK(conn, path, buf, bufsiz) ((conn)->vfs.ops.readlink((conn)->vfs.handles.readlink, (path), (buf), (bufsiz)))
 #define SMB_VFS_LINK(conn, oldpath, newpath) ((conn)->vfs.ops.link((conn)->vfs.handles.link, (oldpath), (newpath)))
 #define SMB_VFS_FILE_ID_CREATE(conn, dev, inode) ((conn)->vfs.ops.file_id_create((conn)->vfs.handles.file_id_create, (dev), (inode)))
 
 /* NT ACL operations. */
-#define SMB_VFS_FGET_NT_ACL(fsp, fd, security_info, ppdesc) ((fsp)->conn->vfs.ops.fget_nt_acl((fsp)->conn->vfs.handles.fget_nt_acl, (fsp), (fd), (security_info), (ppdesc)))
+#define SMB_VFS_FGET_NT_ACL(fsp, security_info, ppdesc) ((fsp)->conn->vfs.ops.fget_nt_acl((fsp)->conn->vfs.handles.fget_nt_acl, (fsp), (security_info), (ppdesc)))
 #define SMB_VFS_GET_NT_ACL(conn, name, security_info, ppdesc) ((conn)->vfs.ops.get_nt_acl((conn)->vfs.handles.get_nt_acl, (name), (security_info), (ppdesc)))
-#define SMB_VFS_FSET_NT_ACL(fsp, fd, security_info_sent, psd) ((fsp)->conn->vfs.ops.fset_nt_acl((fsp)->conn->vfs.handles.fset_nt_acl, (fsp), (fd), (security_info_sent), (psd)))
+#define SMB_VFS_FSET_NT_ACL(fsp, security_info_sent, psd) ((fsp)->conn->vfs.ops.fset_nt_acl((fsp)->conn->vfs.handles.fset_nt_acl, (fsp), (security_info_sent), (psd)))
 #define SMB_VFS_SET_NT_ACL(fsp, name, security_info_sent, psd) ((fsp)->conn->vfs.ops.set_nt_acl((fsp)->conn->vfs.handles.set_nt_acl, (fsp), (name), (security_info_sent), (psd)))
 
 /* POSIX ACL operations. */
 #define SMB_VFS_CHMOD_ACL(conn, name, mode) ((conn)->vfs.ops.chmod_acl((conn)->vfs.handles.chmod_acl, (name), (mode)))
-#define SMB_VFS_FCHMOD_ACL(fsp, fd, mode) ((fsp)->conn->vfs.ops.fchmod_acl((fsp)->conn->vfs.handles.chmod_acl, (fsp), (fd), (mode)))
+#define SMB_VFS_FCHMOD_ACL(fsp, mode) ((fsp)->conn->vfs.ops.fchmod_acl((fsp)->conn->vfs.handles.chmod_acl, (fsp), (mode)))
 
 #define SMB_VFS_SYS_ACL_GET_ENTRY(conn, theacl, entry_id, entry_p) ((conn)->vfs.ops.sys_acl_get_entry((conn)->vfs.handles.sys_acl_get_entry, (theacl), (entry_id), (entry_p)))
 #define SMB_VFS_SYS_ACL_GET_TAG_TYPE(conn, entry_d, tag_type_p) ((conn)->vfs.ops.sys_acl_get_tag_type((conn)->vfs.handles.sys_acl_get_tag_type, (entry_d), (tag_type_p)))
 #define SMB_VFS_SYS_ACL_GET_PERMSET(conn, entry_d, permset_p) ((conn)->vfs.ops.sys_acl_get_permset((conn)->vfs.handles.sys_acl_get_permset, (entry_d), (permset_p)))
 #define SMB_VFS_SYS_ACL_GET_QUALIFIER(conn, entry_d) ((conn)->vfs.ops.sys_acl_get_qualifier((conn)->vfs.handles.sys_acl_get_qualifier, (entry_d)))
 #define SMB_VFS_SYS_ACL_GET_FILE(conn, path_p, type) ((conn)->vfs.ops.sys_acl_get_file((conn)->vfs.handles.sys_acl_get_file, (path_p), (type)))
-#define SMB_VFS_SYS_ACL_GET_FD(fsp, fd) ((fsp)->conn->vfs.ops.sys_acl_get_fd((fsp)->conn->vfs.handles.sys_acl_get_fd, (fsp), (fd)))
+#define SMB_VFS_SYS_ACL_GET_FD(fsp) ((fsp)->conn->vfs.ops.sys_acl_get_fd((fsp)->conn->vfs.handles.sys_acl_get_fd, (fsp)))
 #define SMB_VFS_SYS_ACL_CLEAR_PERMS(conn, permset) ((conn)->vfs.ops.sys_acl_clear_perms((conn)->vfs.handles.sys_acl_clear_perms, (permset)))
 #define SMB_VFS_SYS_ACL_ADD_PERM(conn, permset, perm) ((conn)->vfs.ops.sys_acl_add_perm((conn)->vfs.handles.sys_acl_add_perm, (permset), (perm)))
 #define SMB_VFS_SYS_ACL_TO_TEXT(conn, theacl, plen) ((conn)->vfs.ops.sys_acl_to_text((conn)->vfs.handles.sys_acl_to_text, (theacl), (plen)))
 #define SMB_VFS_SYS_ACL_SET_PERMSET(conn, entry, permset) ((conn)->vfs.ops.sys_acl_set_permset((conn)->vfs.handles.sys_acl_set_permset, (entry), (permset)))
 #define SMB_VFS_SYS_ACL_VALID(conn, theacl) ((conn)->vfs.ops.sys_acl_valid((conn)->vfs.handles.sys_acl_valid, (theacl)))
 #define SMB_VFS_SYS_ACL_SET_FILE(conn, name, acltype, theacl) ((conn)->vfs.ops.sys_acl_set_file((conn)->vfs.handles.sys_acl_set_file, (name), (acltype), (theacl)))
-#define SMB_VFS_SYS_ACL_SET_FD(fsp, fd, theacl) ((fsp)->conn->vfs.ops.sys_acl_set_fd((fsp)->conn->vfs.handles.sys_acl_set_fd, (fsp), (fd), (theacl)))
+#define SMB_VFS_SYS_ACL_SET_FD(fsp, theacl) ((fsp)->conn->vfs.ops.sys_acl_set_fd((fsp)->conn->vfs.handles.sys_acl_set_fd, (fsp), (theacl)))
 #define SMB_VFS_SYS_ACL_DELETE_DEF_FILE(conn, path) ((conn)->vfs.ops.sys_acl_delete_def_file((conn)->vfs.handles.sys_acl_delete_def_file, (path)))
 #define SMB_VFS_SYS_ACL_GET_PERM(conn, permset, perm) ((conn)->vfs.ops.sys_acl_get_perm((conn)->vfs.handles.sys_acl_get_perm, (permset), (perm)))
 #define SMB_VFS_SYS_ACL_FREE_TEXT(conn, text) ((conn)->vfs.ops.sys_acl_free_text((conn)->vfs.handles.sys_acl_free_text, (text)))
 /* EA operations. */
 #define SMB_VFS_GETXATTR(conn,path,name,value,size) ((conn)->vfs.ops.getxattr((conn)->vfs.handles.getxattr,(path),(name),(value),(size)))
 #define SMB_VFS_LGETXATTR(conn,path,name,value,size) ((conn)->vfs.ops.lgetxattr((conn)->vfs.handles.lgetxattr,(path),(name),(value),(size)))
-#define SMB_VFS_FGETXATTR(fsp,fd,name,value,size) ((fsp)->conn->vfs.ops.fgetxattr((fsp)->conn->vfs.handles.fgetxattr,(fsp),(fd),(name),(value),(size)))
+#define SMB_VFS_FGETXATTR(fsp,name,value,size) ((fsp)->conn->vfs.ops.fgetxattr((fsp)->conn->vfs.handles.fgetxattr,(fsp),(name),(value),(size)))
 #define SMB_VFS_LISTXATTR(conn,path,list,size) ((conn)->vfs.ops.listxattr((conn)->vfs.handles.listxattr,(path),(list),(size)))
 #define SMB_VFS_LLISTXATTR(conn,path,list,size) ((conn)->vfs.ops.llistxattr((conn)->vfs.handles.llistxattr,(path),(list),(size)))
-#define SMB_VFS_FLISTXATTR(fsp,fd,list,size) ((fsp)->conn->vfs.ops.flistxattr((fsp)->conn->vfs.handles.flistxattr,(fsp),(fd),(list),(size)))
+#define SMB_VFS_FLISTXATTR(fsp,list,size) ((fsp)->conn->vfs.ops.flistxattr((fsp)->conn->vfs.handles.flistxattr,(fsp),(list),(size)))
 #define SMB_VFS_REMOVEXATTR(conn,path,name) ((conn)->vfs.ops.removexattr((conn)->vfs.handles.removexattr,(path),(name)))
 #define SMB_VFS_LREMOVEXATTR(conn,path,name) ((conn)->vfs.ops.lremovexattr((conn)->vfs.handles.lremovexattr,(path),(name)))
-#define SMB_VFS_FREMOVEXATTR(fsp,fd,name) ((fsp)->conn->vfs.ops.fremovexattr((fsp)->conn->vfs.handles.fremovexattr,(fsp),(fd),(name)))
+#define SMB_VFS_FREMOVEXATTR(fsp,name) ((fsp)->conn->vfs.ops.fremovexattr((fsp)->conn->vfs.handles.fremovexattr,(fsp),(name)))
 #define SMB_VFS_SETXATTR(conn,path,name,value,size,flags) ((conn)->vfs.ops.setxattr((conn)->vfs.handles.setxattr,(path),(name),(value),(size),(flags)))
 #define SMB_VFS_LSETXATTR(conn,path,name,value,size,flags) ((conn)->vfs.ops.lsetxattr((conn)->vfs.handles.lsetxattr,(path),(name),(value),(size),(flags)))
-#define SMB_VFS_FSETXATTR(fsp,fd,name,value,size,flags) ((fsp)->conn->vfs.ops.fsetxattr((fsp)->conn->vfs.handles.fsetxattr,(fsp),(fd),(name),(value),(size),(flags)))
+#define SMB_VFS_FSETXATTR(fsp,name,value,size,flags) ((fsp)->conn->vfs.ops.fsetxattr((fsp)->conn->vfs.handles.fsetxattr,(fsp),(name),(value),(size),(flags)))
 
 /* AIO operations. */
 #define SMB_VFS_AIO_READ(fsp,aiocb) ((fsp)->conn->vfs.ops.aio_read((fsp)->conn->vfs.handles.aio_read,(fsp),(aiocb)))
 #define SMB_VFS_AIO_WRITE(fsp,aiocb) ((fsp)->conn->vfs.ops.aio_write((fsp)->conn->vfs.handles.aio_write,(fsp),(aiocb)))
 #define SMB_VFS_AIO_RETURN(fsp,aiocb) ((fsp)->conn->vfs.ops.aio_return_fn((fsp)->conn->vfs.handles.aio_return,(fsp),(aiocb)))
-#define SMB_VFS_AIO_CANCEL(fsp,fd,aiocb) ((fsp)->conn->vfs.ops.aio_cancel((fsp)->conn->vfs.handles.aio_cancel,(fsp),(fd),(aiocb)))
+#define SMB_VFS_AIO_CANCEL(fsp,aiocb) ((fsp)->conn->vfs.ops.aio_cancel((fsp)->conn->vfs.handles.aio_cancel,(fsp),(aiocb)))
 #define SMB_VFS_AIO_ERROR(fsp,aiocb) ((fsp)->conn->vfs.ops.aio_error_fn((fsp)->conn->vfs.handles.aio_error,(fsp),(aiocb)))
 #define SMB_VFS_AIO_FSYNC(fsp,op,aiocb) ((fsp)->conn->vfs.ops.aio_fsync((fsp)->conn->vfs.handles.aio_fsync,(fsp),(op),(aiocb)))
 #define SMB_VFS_AIO_SUSPEND(fsp,aiocb,n,ts) ((fsp)->conn->vfs.ops.aio_suspend((fsp)->conn->vfs.handles.aio_suspend,(fsp),(aiocb),(n),(ts)))
 #define SMB_VFS_OPAQUE_OPEN(conn, fname, fsp, flags, mode) (((conn)->vfs_opaque.ops.open)((conn)->vfs_opaque.handles.open, (fname), (fsp), (flags), (mode)))
 #define SMB_VFS_OPAQUE_CLOSE(fsp, fd) ((fsp)->conn->vfs_opaque.ops.close_fn((fsp)->conn->vfs_opaque.handles.close_hnd, (fsp), (fd)))
 #define SMB_VFS_OPAQUE_READ(fsp, fd, data, n) ((fsp)->conn->vfs_opaque.ops.read((fsp)->conn->vfs_opaque.handles.read, (fsp), (fd), (data), (n)))
-#define SMB_VFS_OPAQUE_PREAD(fsp, fd, data, n, off) ((fsp)->conn->vfs_opaque.ops.pread((fsp)->conn->vfs_opaque.handles.pread, (fsp), (fd), (data), (n), (off)))
+#define SMB_VFS_OPAQUE_PREAD(fsp, data, n, off) ((fsp)->conn->vfs_opaque.ops.pread((fsp)->conn->vfs_opaque.handles.pread, (fsp), (data), (n), (off)))
 #define SMB_VFS_OPAQUE_WRITE(fsp, fd, data, n) ((fsp)->conn->vfs_opaque.ops.write((fsp)->conn->vfs_opaque.handles.write, (fsp), (fd), (data), (n)))
-#define SMB_VFS_OPAQUE_PWRITE(fsp, fd, data, n, off) ((fsp)->conn->vfs_opaque.ops.pwrite((fsp)->conn->vfs_opaque.handles.pwrite, (fsp), (fd), (data), (n), (off)))
-#define SMB_VFS_OPAQUE_LSEEK(fsp, fd, offset, whence) ((fsp)->conn->vfs_opaque.ops.lseek((fsp)->conn->vfs_opaque.handles.lseek, (fsp), (fd), (offset), (whence)))
+#define SMB_VFS_OPAQUE_PWRITE(fsp, data, n, off) ((fsp)->conn->vfs_opaque.ops.pwrite((fsp)->conn->vfs_opaque.handles.pwrite, (fsp), (data), (n), (off)))
+#define SMB_VFS_OPAQUE_LSEEK(fsp, offset, whence) ((fsp)->conn->vfs_opaque.ops.lseek((fsp)->conn->vfs_opaque.handles.lseek, (fsp), (offset), (whence)))
 #define SMB_VFS_OPAQUE_SENDFILE(tofd, fsp, fromfd, header, offset, count) ((fsp)->conn->vfs_opaque.ops.sendfile((fsp)->conn->vfs_opaque.handles.sendfile, (tofd), (fsp), (fromfd), (header), (offset), (count)))
 #define SMB_VFS_OPAQUE_RECVFILE(fromfd, fsp, tofd, offset, count) ((fsp)->conn->vfs_opaque.ops.recvfile((fsp)->conn->vfs_opaque.handles.recvfile, (fromfd), (fsp), (tofd), (offset), (count)))
 #define SMB_VFS_OPAQUE_RENAME(conn, old, new) ((conn)->vfs_opaque.ops.rename((conn)->vfs_opaque.handles.rename, (old), (new)))
-#define SMB_VFS_OPAQUE_FSYNC(fsp, fd) ((fsp)->conn->vfs_opaque.ops.fsync((fsp)->conn->vfs_opaque.handles.fsync, (fsp), (fd)))
+#define SMB_VFS_OPAQUE_FSYNC(fsp) ((fsp)->conn->vfs_opaque.ops.fsync((fsp)->conn->vfs_opaque.handles.fsync, (fsp)))
 #define SMB_VFS_OPAQUE_STAT(conn, fname, sbuf) ((conn)->vfs_opaque.ops.stat((conn)->vfs_opaque.handles.stat, (fname), (sbuf)))
-#define SMB_VFS_OPAQUE_FSTAT(fsp, fd, sbuf) ((fsp)->conn->vfs_opaque.ops.fstat((fsp)->conn->vfs_opaque.handles.fstat, (fsp) ,(fd) ,(sbuf)))
+#define SMB_VFS_OPAQUE_FSTAT(fsp, sbuf) ((fsp)->conn->vfs_opaque.ops.fstat((fsp)->conn->vfs_opaque.handles.fstat, (fsp), (sbuf)))
 #define SMB_VFS_OPAQUE_LSTAT(conn, path, sbuf) ((conn)->vfs_opaque.ops.lstat((conn)->vfs_opaque.handles.lstat, (path), (sbuf)))
 #define SMB_VFS_OPAQUE_UNLINK(conn, path) ((conn)->vfs_opaque.ops.unlink((conn)->vfs_opaque.handles.unlink, (path)))
 #define SMB_VFS_OPAQUE_CHMOD(conn, path, mode) ((conn)->vfs_opaque.ops.chmod((conn)->vfs_opaque.handles.chmod, (path), (mode)))
-#define SMB_VFS_OPAQUE_FCHMOD(fsp, fd, mode) ((fsp)->conn->vfs_opaque.ops.fchmod((fsp)->conn->vfs_opaque.handles.fchmod, (fsp), (fd), (mode)))
+#define SMB_VFS_OPAQUE_FCHMOD(fsp, mode) ((fsp)->conn->vfs_opaque.ops.fchmod((fsp)->conn->vfs_opaque.handles.fchmod, (fsp), (mode)))
 #define SMB_VFS_OPAQUE_CHOWN(conn, path, uid, gid) ((conn)->vfs_opaque.ops.chown((conn)->vfs_opaque.handles.chown, (path), (uid), (gid)))
-#define SMB_VFS_OPAQUE_FCHOWN(fsp, fd, uid, gid) ((fsp)->conn->vfs_opaque.ops.fchown((fsp)->conn->vfs_opaque.handles.fchown, (fsp), (fd), (uid), (gid)))
+#define SMB_VFS_OPAQUE_FCHOWN(fsp, uid, gid) ((fsp)->conn->vfs_opaque.ops.fchown((fsp)->conn->vfs_opaque.handles.fchown, (fsp), (uid), (gid)))
 #define SMB_VFS_OPAQUE_LCHOWN(conn, path, uid, gid) ((conn)->vfs_opaque.ops.lchown((conn)->vfs_opaque.handles.lchown, (path), (uid), (gid)))
 #define SMB_VFS_OPAQUE_CHDIR(conn, path) ((conn)->vfs_opaque.ops.chdir((conn)->vfs_opaque.handles.chdir, (path)))
 #define SMB_VFS_OPAQUE_GETWD(conn, buf) ((conn)->vfs_opaque.ops.getwd((conn)->vfs_opaque.handles.getwd, (buf)))
 #define SMB_VFS_OPAQUE_NTIMES(conn, path, ts) ((conn)->vfs_opaque.ops.ntimes((conn)->vfs_opaque.handles.ntimes, (path), (ts)))
-#define SMB_VFS_OPAQUE_FTRUNCATE(fsp, fd, offset) ((fsp)->conn->vfs_opaque.ops.ftruncate((fsp)->conn->vfs_opaque.handles.ftruncate, (fsp), (fd), (offset)))
-#define SMB_VFS_OPAQUE_LOCK(fsp, fd, op, offset, count, type) ((fsp)->conn->vfs_opaque.ops.lock((fsp)->conn->vfs_opaque.handles.lock, (fsp), (fd) ,(op), (offset), (count), (type)))
-#define SMB_VFS_OPAQUE_FLOCK(fsp, fd, share_mode) ((fsp)->conn->vfs_opaque.ops.lock((fsp)->conn->vfs_opaque.handles.kernel_flock, (fsp), (fd), (share_mode)))
-#define SMB_VFS_OPAQUE_LINUX_SETLEASE(fsp, fd, leasetype) ((fsp)->conn->vfs_opaque.ops.linux_setlease((fsp)->conn->vfs_opaque.handles.linux_setlease, (fsp), (fd), (leasetype)))
-#define SMB_VFS_OPAQUE_GETLOCK(fsp, fd, poffset, pcount, ptype, ppid) ((fsp)->conn->vfs_opaque.ops.getlock((fsp)->conn->vfs_opaque.handles.getlock, (fsp), (fd), (poffset), (pcount), (ptype), (ppid)))
+#define SMB_VFS_OPAQUE_FTRUNCATE(fsp, offset) ((fsp)->conn->vfs_opaque.ops.ftruncate((fsp)->conn->vfs_opaque.handles.ftruncate, (fsp), (offset)))
+#define SMB_VFS_OPAQUE_LOCK(fsp, op, offset, count, type) ((fsp)->conn->vfs_opaque.ops.lock((fsp)->conn->vfs_opaque.handles.lock, (fsp), (op), (offset), (count), (type)))
+#define SMB_VFS_OPAQUE_KERNEL_FLOCK(fsp, share_mode) ((fsp)->conn->vfs_opaque.ops.kernel_flock((fsp)->conn->vfs_opaque.handles.kernel_flock, (fsp), (share_mode)))
+#define SMB_VFS_OPAQUE_LINUX_SETLEASE(fsp, leasetype) ((fsp)->conn->vfs_opaque.ops.linux_setlease((fsp)->conn->vfs_opaque.handles.linux_setlease, (fsp), (leasetype)))
+#define SMB_VFS_OPAQUE_GETLOCK(fsp, poffset, pcount, ptype, ppid) ((fsp)->conn->vfs_opaque.ops.getlock((fsp)->conn->vfs_opaque.handles.getlock, (fsp), (poffset), (pcount), (ptype), (ppid)))
 #define SMB_VFS_OPAQUE_SYMLINK(conn, oldpath, newpath) ((conn)->vfs_opaque.ops.symlink((conn)->vfs_opaque.handles.symlink, (oldpath), (newpath)))
 #define SMB_VFS_OPAQUE_READLINK(conn, path, buf, bufsiz) ((conn)->vfs_opaque.ops.readlink((conn)->vfs_opaque.handles.readlink, (path), (buf), (bufsiz)))
 #define SMB_VFS_OPAQUE_LINK(conn, oldpath, newpath) ((conn)->vfs_opaque.ops.link((conn)->vfs_opaque.handles.link, (oldpath), (newpath)))
 #define SMB_VFS_OPAQUE_FILE_ID_CREATE(conn, dev, inode) ((conn)->vfs.ops_opaque.file_id_create((conn)->vfs_opaque.handles.file_id_create, (dev), (inode)))
 
 /* NT ACL operations. */
-#define SMB_VFS_OPAQUE_FGET_NT_ACL(fsp, fd, security_info, ppdesc) ((fsp)->conn->vfs_opaque.ops.fget_nt_acl((fsp)->conn->vfs_opaque.handles.fget_nt_acl, (fsp), (fd), (security_info), (ppdesc)))
+#define SMB_VFS_OPAQUE_FGET_NT_ACL(fsp, security_info, ppdesc) ((fsp)->conn->vfs_opaque.ops.fget_nt_acl((fsp)->conn->vfs_opaque.handles.fget_nt_acl, (fsp), (security_info), (ppdesc)))
 #define SMB_VFS_OPAQUE_GET_NT_ACL(conn, name, security_info, ppdesc) ((conn)->vfs_opaque.ops.get_nt_acl((conn)->vfs_opaque.handles.get_nt_acl, (name), (security_info), (ppdesc)))
-#define SMB_VFS_OPAQUE_FSET_NT_ACL(fsp, fd, security_info_sent, psd) ((fsp)->conn->vfs_opaque.ops.fset_nt_acl((fsp)->conn->vfs_opaque.handles.fset_nt_acl, (fsp), (fd), (security_info_sent), (psd)))
+#define SMB_VFS_OPAQUE_FSET_NT_ACL(fsp, security_info_sent, psd) ((fsp)->conn->vfs_opaque.ops.fset_nt_acl((fsp)->conn->vfs_opaque.handles.fset_nt_acl, (fsp), (security_info_sent), (psd)))
 #define SMB_VFS_OPAQUE_SET_NT_ACL(fsp, name, security_info_sent, psd) ((fsp)->conn->vfs_opaque.ops.set_nt_acl((fsp)->conn->vfs_opaque.handles.set_nt_acl, (fsp), (name), (security_info_sent), (psd)))
 
 /* POSIX ACL operations. */
 #define SMB_VFS_OPAQUE_CHMOD_ACL(conn, name, mode) ((conn)->vfs_opaque.ops.chmod_acl((conn)->vfs_opaque.handles.chmod_acl, (name), (mode)))
-#define SMB_VFS_OPAQUE_FCHMOD_ACL(fsp, fd, mode) ((fsp)->conn->vfs_opaque.ops.fchmod_acl((fsp)->conn->vfs_opaque.handles.chmod_acl, (fsp), (fd), (mode)))
+#define SMB_VFS_OPAQUE_FCHMOD_ACL(fsp, mode) ((fsp)->conn->vfs_opaque.ops.fchmod_acl((fsp)->conn->vfs_opaque.handles.chmod_acl, (fsp), (mode)))
 
 #define SMB_VFS_OPAQUE_SYS_ACL_GET_ENTRY(conn, theacl, entry_id, entry_p) ((conn)->vfs_opaque.ops.sys_acl_get_entry((conn)->vfs_opaque.handles.sys_acl_get_entry, (theacl), (entry_id), (entry_p)))
 #define SMB_VFS_OPAQUE_SYS_ACL_GET_TAG_TYPE(conn, entry_d, tag_type_p) ((conn)->vfs_opaque.ops.sys_acl_get_tag_type((conn)->vfs_opaque.handles.sys_acl_get_tag_type, (entry_d), (tag_type_p)))
 #define SMB_VFS_OPAQUE_SYS_ACL_GET_PERMSET(conn, entry_d, permset_p) ((conn)->vfs_opaque.ops.sys_acl_get_permset((conn)->vfs_opaque.handles.sys_acl_get_permset, (entry_d), (permset_p)))
 #define SMB_VFS_OPAQUE_SYS_ACL_GET_QUALIFIER(conn, entry_d) ((conn)->vfs_opaque.ops.sys_acl_get_qualifier((conn)->vfs_opaque.handles.sys_acl_get_qualifier, (entry_d)))
 #define SMB_VFS_OPAQUE_SYS_ACL_GET_FILE(conn, path_p, type) ((conn)->vfs_opaque.ops.sys_acl_get_file((conn)->vfs_opaque.handles.sys_acl_get_file, (path_p), (type)))
-#define SMB_VFS_OPAQUE_SYS_ACL_GET_FD(fsp, fd) ((fsp)->conn->vfs_opaque.ops.sys_acl_get_fd((fsp)->conn->vfs_opaque.handles.sys_acl_get_fd, (fsp), (fd)))
+#define SMB_VFS_OPAQUE_SYS_ACL_GET_FD(fsp) ((fsp)->conn->vfs_opaque.ops.sys_acl_get_fd((fsp)->conn->vfs_opaque.handles.sys_acl_get_fd, (fsp)))
 #define SMB_VFS_OPAQUE_SYS_ACL_CLEAR_PERMS(conn, permset) ((conn)->vfs_opaque.ops.sys_acl_clear_perms((conn)->vfs_opaque.handles.sys_acl_clear_perms, (permset)))
 #define SMB_VFS_OPAQUE_SYS_ACL_ADD_PERM(conn, permset, perm) ((conn)->vfs_opaque.ops.sys_acl_add_perm((conn)->vfs_opaque.handles.sys_acl_add_perm, (permset), (perm)))
 #define SMB_VFS_OPAQUE_SYS_ACL_TO_TEXT(conn, theacl, plen) ((conn)->vfs_opaque.ops.sys_acl_to_text((conn)->vfs_opaque.handles.sys_acl_to_text, (theacl), (plen)))
 #define SMB_VFS_OPAQUE_SYS_ACL_SET_PERMSET(conn, entry, permset) ((conn)->vfs_opaque.ops.sys_acl_set_permset((conn)->vfs_opaque.handles.sys_acl_set_permset, (entry), (permset)))
 #define SMB_VFS_OPAQUE_SYS_ACL_VALID(conn, theacl) ((conn)->vfs_opaque.ops.sys_acl_valid((conn)->vfs_opaque.handles.sys_acl_valid, (theacl)))
 #define SMB_VFS_OPAQUE_SYS_ACL_SET_FILE(conn, name, acltype, theacl) ((conn)->vfs_opaque.ops.sys_acl_set_file((conn)->vfs_opaque.handles.sys_acl_set_file, (name), (acltype), (theacl)))
-#define SMB_VFS_OPAQUE_SYS_ACL_SET_FD(fsp, fd, theacl) ((fsp)->conn->vfs_opaque.ops.sys_acl_set_fd((fsp)->conn->vfs_opaque.handles.sys_acl_set_fd, (fsp), (fd), (theacl)))
+#define SMB_VFS_OPAQUE_SYS_ACL_SET_FD(fsp, theacl) ((fsp)->conn->vfs_opaque.ops.sys_acl_set_fd((fsp)->conn->vfs_opaque.handles.sys_acl_set_fd, (fsp), (theacl)))
 #define SMB_VFS_OPAQUE_SYS_ACL_DELETE_DEF_FILE(conn, path) ((conn)->vfs_opaque.ops.sys_acl_delete_def_file((conn)->vfs_opaque.handles.sys_acl_delete_def_file, (path)))
 #define SMB_VFS_OPAQUE_SYS_ACL_GET_PERM(conn, permset, perm) ((conn)->vfs_opaque.ops.sys_acl_get_perm((conn)->vfs_opaque.handles.sys_acl_get_perm, (permset), (perm)))
 #define SMB_VFS_OPAQUE_SYS_ACL_FREE_TEXT(conn, text) ((conn)->vfs_opaque.ops.sys_acl_free_text((conn)->vfs_opaque.handles.sys_acl_free_text, (text)))
 /* EA operations. */
 #define SMB_VFS_OPAQUE_GETXATTR(conn,path,name,value,size) ((conn)->vfs_opaque.ops.getxattr((conn)->vfs_opaque.handles.getxattr,(path),(name),(value),(size)))
 #define SMB_VFS_OPAQUE_LGETXATTR(conn,path,name,value,size) ((conn)->vfs_opaque.ops.lgetxattr((conn)->vfs_opaque.handles.lgetxattr,(path),(name),(value),(size)))
-#define SMB_VFS_OPAQUE_FGETXATTR(fsp,fd,name,value,size) ((fsp)->conn->vfs_opaque.ops.fgetxattr((fsp)->conn->vfs_opaque.handles.fgetxattr,(fsp),(fd),(name),(value),(size)))
+#define SMB_VFS_OPAQUE_FGETXATTR(fsp,name,value,size) ((fsp)->conn->vfs_opaque.ops.fgetxattr((fsp)->conn->vfs_opaque.handles.fgetxattr,(fsp),(name),(value),(size)))
 #define SMB_VFS_OPAQUE_LISTXATTR(conn,path,list,size) ((conn)->vfs_opaque.ops.listxattr((conn)->vfs_opaque.handles.listxattr,(path),(list),(size)))
 #define SMB_VFS_OPAQUE_LLISTXATTR(conn,path,list,size) ((conn)->vfs_opaque.ops.llistxattr((conn)->vfs_opaque.handles.llistxattr,(path),(list),(size)))
-#define SMB_VFS_OPAQUE_FLISTXATTR(fsp,fd,list,size) ((fsp)->conn->vfs_opaque.ops.flistxattr((fsp)->conn->vfs_opaque.handles.flistxattr,(fsp),(fd),(list),(size)))
+#define SMB_VFS_OPAQUE_FLISTXATTR(fsp,list,size) ((fsp)->conn->vfs_opaque.ops.flistxattr((fsp)->conn->vfs_opaque.handles.flistxattr,(fsp),(list),(size)))
 #define SMB_VFS_OPAQUE_REMOVEXATTR(conn,path,name) ((conn)->vfs_opaque.ops.removexattr((conn)->vfs_opaque.handles.removexattr,(path),(name)))
 #define SMB_VFS_OPAQUE_LREMOVEXATTR(conn,path,name) ((conn)->vfs_opaque.ops.lremovexattr((conn)->vfs_opaque.handles.lremovexattr,(path),(name)))
-#define SMB_VFS_OPAQUE_FREMOVEXATTR(fsp,fd,name) ((fsp)->conn->vfs_opaque.ops.fremovexattr((fsp)->conn->vfs_opaque.handles.fremovexattr,(fsp),(fd),(name)))
+#define SMB_VFS_OPAQUE_FREMOVEXATTR(fsp,name) ((fsp)->conn->vfs_opaque.ops.fremovexattr((fsp)->conn->vfs_opaque.handles.fremovexattr,(fsp),(name)))
 #define SMB_VFS_OPAQUE_SETXATTR(conn,path,name,value,size,flags) ((conn)->vfs_opaque.ops.setxattr((conn)->vfs_opaque.handles.setxattr,(path),(name),(value),(size),(flags)))
 #define SMB_VFS_OPAQUE_LSETXATTR(conn,path,name,value,size,flags) ((conn)->vfs_opaque.ops.lsetxattr((conn)->vfs_opaque.handles.lsetxattr,(path),(name),(value),(size),(flags)))
-#define SMB_VFS_OPAQUE_FSETXATTR(fsp,fd,name,value,size,flags) ((fsp)->conn->vfs_opaque.ops.fsetxattr((fsp)->conn->vfs_opaque.handles.fsetxattr,(fsp),(fd),(name),(value),(size),(flags)))
+#define SMB_VFS_OPAQUE_FSETXATTR(fsp,name,value,size,flags) ((fsp)->conn->vfs_opaque.ops.fsetxattr((fsp)->conn->vfs_opaque.handles.fsetxattr,(fsp),(name),(value),(size),(flags)))
 
 /* AIO operations. */
 #define SMB_VFS_OPAQUE_AIO_READ(fsp,aiocb) ((fsp)->conn->vfs_opaque.ops.aio_read((fsp)->conn->vfs_opaque.handles.aio_read,(fsp),(aiocb)))
 #define SMB_VFS_OPAQUE_AIO_WRITE(fsp,aiocb) ((fsp)->conn->vfs_opaque.ops.aio_write((fsp)->conn->vfs_opaque.handles.aio_write,(fsp),(aiocb)))
 #define SMB_VFS_OPAQUE_AIO_RETURN(fsp,aiocb) ((fsp)->conn->vfs_opaque.ops.aio_return_fn((fsp)->conn->vfs_opaque.handles.aio_return,(fsp),(aiocb)))
-#define SMB_VFS_OPAQUE_AIO_CANCEL(fsp,fd,aiocb) ((fsp)->conn->vfs_opaque.ops.aio_cancel((fsp)->conn->vfs_opaque.handles.cancel,(fsp),(fd),(aiocb)))
+#define SMB_VFS_OPAQUE_AIO_CANCEL(fsp,aiocb) ((fsp)->conn->vfs_opaque.ops.aio_cancel((fsp)->conn->vfs_opaque.handles.cancel,(fsp),(aiocb)))
 #define SMB_VFS_OPAQUE_AIO_ERROR(fsp,aiocb) ((fsp)->conn->vfs_opaque.ops.aio_error_fn((fsp)->conn->vfs_opaque.handles.aio_error,(fsp),(aiocb)))
 #define SMB_VFS_OPAQUE_AIO_FSYNC(fsp,op,aiocb) ((fsp)->conn->vfs_opaque.ops.aio_fsync((fsp)->conn->vfs_opaque.handles.aio_fsync,(fsp),(op),(aiocb)))
 #define SMB_VFS_OPAQUE_AIO_SUSPEND(fsp,aiocb,n,ts) ((fsp)->conn->vfs_opaque.ops.aio_suspend((fsp)->conn->vfs_opaque.handles.aio_suspend,(fsp),(aiocb),(n),(ts)))
 #define SMB_VFS_NEXT_OPEN(handle, fname, fsp, flags, mode) (((handle)->vfs_next.ops.open)((handle)->vfs_next.handles.open, (fname), (fsp), (flags), (mode)))
 #define SMB_VFS_NEXT_CLOSE(handle, fsp, fd) ((handle)->vfs_next.ops.close_fn((handle)->vfs_next.handles.close_hnd, (fsp), (fd)))
 #define SMB_VFS_NEXT_READ(handle, fsp, fd, data, n) ((handle)->vfs_next.ops.read((handle)->vfs_next.handles.read, (fsp), (fd), (data), (n)))
-#define SMB_VFS_NEXT_PREAD(handle, fsp, fd, data, n, off) ((handle)->vfs_next.ops.pread((handle)->vfs_next.handles.pread, (fsp), (fd), (data), (n), (off)))
+#define SMB_VFS_NEXT_PREAD(handle, fsp, data, n, off) ((handle)->vfs_next.ops.pread((handle)->vfs_next.handles.pread, (fsp), (data), (n), (off)))
 #define SMB_VFS_NEXT_WRITE(handle, fsp, fd, data, n) ((handle)->vfs_next.ops.write((handle)->vfs_next.handles.write, (fsp), (fd), (data), (n)))
-#define SMB_VFS_NEXT_PWRITE(handle, fsp, fd, data, n, off) ((handle)->vfs_next.ops.pwrite((handle)->vfs_next.handles.pwrite, (fsp), (fd), (data), (n), (off)))
-#define SMB_VFS_NEXT_LSEEK(handle, fsp, fd, offset, whence) ((handle)->vfs_next.ops.lseek((handle)->vfs_next.handles.lseek, (fsp), (fd), (offset), (whence)))
+#define SMB_VFS_NEXT_PWRITE(handle, fsp, data, n, off) ((handle)->vfs_next.ops.pwrite((handle)->vfs_next.handles.pwrite, (fsp), (data), (n), (off)))
+#define SMB_VFS_NEXT_LSEEK(handle, fsp, offset, whence) ((handle)->vfs_next.ops.lseek((handle)->vfs_next.handles.lseek, (fsp), (offset), (whence)))
 #define SMB_VFS_NEXT_SENDFILE(handle, tofd, fsp, fromfd, header, offset, count) ((handle)->vfs_next.ops.sendfile((handle)->vfs_next.handles.sendfile, (tofd), (fsp), (fromfd), (header), (offset), (count)))
 #define SMB_VFS_NEXT_RECVFILE(handle, fromfd, fsp, tofd, offset, count) ((handle)->vfs_next.ops.recvfile((handle)->vfs_next.handles.recvfile, (fromfd), (fsp), (tofd), (offset), (count)))
 #define SMB_VFS_NEXT_RENAME(handle, old, new) ((handle)->vfs_next.ops.rename((handle)->vfs_next.handles.rename, (old), (new)))
-#define SMB_VFS_NEXT_FSYNC(handle, fsp, fd) ((handle)->vfs_next.ops.fsync((handle)->vfs_next.handles.fsync, (fsp), (fd)))
+#define SMB_VFS_NEXT_FSYNC(handle, fsp) ((handle)->vfs_next.ops.fsync((handle)->vfs_next.handles.fsync, (fsp)))
 #define SMB_VFS_NEXT_STAT(handle, fname, sbuf) ((handle)->vfs_next.ops.stat((handle)->vfs_next.handles.stat, (fname), (sbuf)))
-#define SMB_VFS_NEXT_FSTAT(handle, fsp, fd, sbuf) ((handle)->vfs_next.ops.fstat((handle)->vfs_next.handles.fstat, (fsp) ,(fd) ,(sbuf)))
+#define SMB_VFS_NEXT_FSTAT(handle, fsp, sbuf) ((handle)->vfs_next.ops.fstat((handle)->vfs_next.handles.fstat, (fsp), (sbuf)))
 #define SMB_VFS_NEXT_LSTAT(handle, path, sbuf) ((handle)->vfs_next.ops.lstat((handle)->vfs_next.handles.lstat, (path), (sbuf)))
 #define SMB_VFS_NEXT_UNLINK(handle, path) ((handle)->vfs_next.ops.unlink((handle)->vfs_next.handles.unlink, (path)))
 #define SMB_VFS_NEXT_CHMOD(handle, path, mode) ((handle)->vfs_next.ops.chmod((handle)->vfs_next.handles.chmod, (path), (mode)))
-#define SMB_VFS_NEXT_FCHMOD(handle, fsp, fd, mode) ((handle)->vfs_next.ops.fchmod((handle)->vfs_next.handles.fchmod, (fsp), (fd), (mode)))
+#define SMB_VFS_NEXT_FCHMOD(handle, fsp, mode) ((handle)->vfs_next.ops.fchmod((handle)->vfs_next.handles.fchmod, (fsp), (mode)))
 #define SMB_VFS_NEXT_CHOWN(handle, path, uid, gid) ((handle)->vfs_next.ops.chown((handle)->vfs_next.handles.chown, (path), (uid), (gid)))
-#define SMB_VFS_NEXT_FCHOWN(handle, fsp, fd, uid, gid) ((handle)->vfs_next.ops.fchown((handle)->vfs_next.handles.fchown, (fsp), (fd), (uid), (gid)))
+#define SMB_VFS_NEXT_FCHOWN(handle, fsp, uid, gid) ((handle)->vfs_next.ops.fchown((handle)->vfs_next.handles.fchown, (fsp), (uid), (gid)))
 #define SMB_VFS_NEXT_LCHOWN(handle, path, uid, gid) ((handle)->vfs_next.ops.lchown((handle)->vfs_next.handles.lchown, (path), (uid), (gid)))
 #define SMB_VFS_NEXT_CHDIR(handle, path) ((handle)->vfs_next.ops.chdir((handle)->vfs_next.handles.chdir, (path)))
 #define SMB_VFS_NEXT_GETWD(handle, buf) ((handle)->vfs_next.ops.getwd((handle)->vfs_next.handles.getwd, (buf)))
 #define SMB_VFS_NEXT_NTIMES(handle, path, ts) ((handle)->vfs_next.ops.ntimes((handle)->vfs_next.handles.ntimes, (path), (ts)))
-#define SMB_VFS_NEXT_FTRUNCATE(handle, fsp, fd, offset) ((handle)->vfs_next.ops.ftruncate((handle)->vfs_next.handles.ftruncate, (fsp), (fd), (offset)))
-#define SMB_VFS_NEXT_LOCK(handle, fsp, fd, op, offset, count, type) ((handle)->vfs_next.ops.lock((handle)->vfs_next.handles.lock, (fsp), (fd) ,(op), (offset), (count), (type)))
-#define SMB_VFS_NEXT_KERNEL_FLOCK(handle, fsp, fd, share_mode)((handle)->vfs_next.ops.kernel_flock((handle)->vfs_next.handles.kernel_flock, (fsp), (fd), (share_mode)))
-#define SMB_VFS_NEXT_LINUX_SETLEASE(handle, fsp, fd, leasetype)((handle)->vfs_next.ops.linux_setlease((handle)->vfs_next.handles.linux_setlease, (fsp), (fd), (leasetype)))
-#define SMB_VFS_NEXT_GETLOCK(handle, fsp, fd, poffset, pcount, ptype, ppid) ((handle)->vfs_next.ops.getlock((handle)->vfs_next.handles.getlock, (fsp), (fd), (poffset), (pcount), (ptype), (ppid)))
+#define SMB_VFS_NEXT_FTRUNCATE(handle, fsp, offset) ((handle)->vfs_next.ops.ftruncate((handle)->vfs_next.handles.ftruncate, (fsp), (offset)))
+#define SMB_VFS_NEXT_LOCK(handle, fsp, op, offset, count, type) ((handle)->vfs_next.ops.lock((handle)->vfs_next.handles.lock, (fsp), (op), (offset), (count), (type)))
+#define SMB_VFS_NEXT_KERNEL_FLOCK(handle, fsp, share_mode)((handle)->vfs_next.ops.kernel_flock((handle)->vfs_next.handles.kernel_flock, (fsp), (share_mode)))
+#define SMB_VFS_NEXT_LINUX_SETLEASE(handle, fsp, leasetype)((handle)->vfs_next.ops.linux_setlease((handle)->vfs_next.handles.linux_setlease, (fsp), (leasetype)))
+#define SMB_VFS_NEXT_GETLOCK(handle, fsp, poffset, pcount, ptype, ppid) ((handle)->vfs_next.ops.getlock((handle)->vfs_next.handles.getlock, (fsp), (poffset), (pcount), (ptype), (ppid)))
 #define SMB_VFS_NEXT_SYMLINK(handle, oldpath, newpath) ((handle)->vfs_next.ops.symlink((handle)->vfs_next.handles.symlink, (oldpath), (newpath)))
 #define SMB_VFS_NEXT_READLINK(handle, path, buf, bufsiz) ((handle)->vfs_next.ops.readlink((handle)->vfs_next.handles.readlink, (path), (buf), (bufsiz)))
 #define SMB_VFS_NEXT_LINK(handle, oldpath, newpath) ((handle)->vfs_next.ops.link((handle)->vfs_next.handles.link, (oldpath), (newpath)))
 #define SMB_VFS_NEXT_FILE_ID_CREATE(handle, dev, inode) ((handle)->vfs_next.ops.file_id_create((handle)->vfs_next.handles.file_id_create, (dev), (inode)))
 
 /* NT ACL operations. */
-#define SMB_VFS_NEXT_FGET_NT_ACL(handle, fsp, fd, security_info, ppdesc) ((handle)->vfs_next.ops.fget_nt_acl((handle)->vfs_next.handles.fget_nt_acl, (fsp), (fd), (security_info), (ppdesc)))
+#define SMB_VFS_NEXT_FGET_NT_ACL(handle, fsp, security_info, ppdesc) ((handle)->vfs_next.ops.fget_nt_acl((handle)->vfs_next.handles.fget_nt_acl, (fsp), (security_info), (ppdesc)))
 #define SMB_VFS_NEXT_GET_NT_ACL(handle, name, security_info, ppdesc) ((handle)->vfs_next.ops.get_nt_acl((handle)->vfs_next.handles.get_nt_acl, (name), (security_info), (ppdesc)))
-#define SMB_VFS_NEXT_FSET_NT_ACL(handle, fsp, fd, security_info_sent, psd) ((handle)->vfs_next.ops.fset_nt_acl((handle)->vfs_next.handles.fset_nt_acl, (fsp), (fd), (security_info_sent), (psd)))
+#define SMB_VFS_NEXT_FSET_NT_ACL(handle, fsp, security_info_sent, psd) ((handle)->vfs_next.ops.fset_nt_acl((handle)->vfs_next.handles.fset_nt_acl, (fsp), (security_info_sent), (psd)))
 #define SMB_VFS_NEXT_SET_NT_ACL(handle, fsp, name, security_info_sent, psd) ((handle)->vfs_next.ops.set_nt_acl((handle)->vfs_next.handles.set_nt_acl, (fsp), (name), (security_info_sent), (psd)))
 
 /* POSIX ACL operations. */
 #define SMB_VFS_NEXT_CHMOD_ACL(handle, name, mode) ((handle)->vfs_next.ops.chmod_acl((handle)->vfs_next.handles.chmod_acl, (name), (mode)))
-#define SMB_VFS_NEXT_FCHMOD_ACL(handle, fsp, fd, mode) ((handle)->vfs_next.ops.fchmod_acl((handle)->vfs_next.handles.chmod_acl, (fsp), (fd), (mode)))
+#define SMB_VFS_NEXT_FCHMOD_ACL(handle, fsp, mode) ((handle)->vfs_next.ops.fchmod_acl((handle)->vfs_next.handles.chmod_acl, (fsp), (mode)))
 
 #define SMB_VFS_NEXT_SYS_ACL_GET_ENTRY(handle, theacl, entry_id, entry_p) ((handle)->vfs_next.ops.sys_acl_get_entry((handle)->vfs_next.handles.sys_acl_get_entry, (theacl), (entry_id), (entry_p)))
 #define SMB_VFS_NEXT_SYS_ACL_GET_TAG_TYPE(handle, entry_d, tag_type_p) ((handle)->vfs_next.ops.sys_acl_get_tag_type((handle)->vfs_next.handles.sys_acl_get_tag_type, (entry_d), (tag_type_p)))
 #define SMB_VFS_NEXT_SYS_ACL_GET_PERMSET(handle, entry_d, permset_p) ((handle)->vfs_next.ops.sys_acl_get_permset((handle)->vfs_next.handles.sys_acl_get_permset, (entry_d), (permset_p)))
 #define SMB_VFS_NEXT_SYS_ACL_GET_QUALIFIER(handle, entry_d) ((handle)->vfs_next.ops.sys_acl_get_qualifier((handle)->vfs_next.handles.sys_acl_get_qualifier, (entry_d)))
 #define SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, path_p, type) ((handle)->vfs_next.ops.sys_acl_get_file((handle)->vfs_next.handles.sys_acl_get_file, (path_p), (type)))
-#define SMB_VFS_NEXT_SYS_ACL_GET_FD(handle, fsp, fd) ((handle)->vfs_next.ops.sys_acl_get_fd((handle)->vfs_next.handles.sys_acl_get_fd, (fsp), (fd)))
+#define SMB_VFS_NEXT_SYS_ACL_GET_FD(handle, fsp) ((handle)->vfs_next.ops.sys_acl_get_fd((handle)->vfs_next.handles.sys_acl_get_fd, (fsp)))
 #define SMB_VFS_NEXT_SYS_ACL_CLEAR_PERMS(handle, permset) ((handle)->vfs_next.ops.sys_acl_clear_perms((handle)->vfs_next.handles.sys_acl_clear_perms, (permset)))
 #define SMB_VFS_NEXT_SYS_ACL_ADD_PERM(handle, permset, perm) ((handle)->vfs_next.ops.sys_acl_add_perm((handle)->vfs_next.handles.sys_acl_add_perm, (permset), (perm)))
 #define SMB_VFS_NEXT_SYS_ACL_TO_TEXT(handle, theacl, plen) ((handle)->vfs_next.ops.sys_acl_to_text((handle)->vfs_next.handles.sys_acl_to_text, (theacl), (plen)))
 #define SMB_VFS_NEXT_SYS_ACL_SET_PERMSET(handle, entry, permset) ((handle)->vfs_next.ops.sys_acl_set_permset((handle)->vfs_next.handles.sys_acl_set_permset, (entry), (permset)))
 #define SMB_VFS_NEXT_SYS_ACL_VALID(handle, theacl) ((handle)->vfs_next.ops.sys_acl_valid((handle)->vfs_next.handles.sys_acl_valid, (theacl)))
 #define SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, name, acltype, theacl) ((handle)->vfs_next.ops.sys_acl_set_file((handle)->vfs_next.handles.sys_acl_set_file, (name), (acltype), (theacl)))
-#define SMB_VFS_NEXT_SYS_ACL_SET_FD(handle, fsp, fd, theacl) ((handle)->vfs_next.ops.sys_acl_set_fd((handle)->vfs_next.handles.sys_acl_set_fd, (fsp), (fd), (theacl)))
+#define SMB_VFS_NEXT_SYS_ACL_SET_FD(handle, fsp, theacl) ((handle)->vfs_next.ops.sys_acl_set_fd((handle)->vfs_next.handles.sys_acl_set_fd, (fsp), (theacl)))
 #define SMB_VFS_NEXT_SYS_ACL_DELETE_DEF_FILE(handle, path) ((handle)->vfs_next.ops.sys_acl_delete_def_file((handle)->vfs_next.handles.sys_acl_delete_def_file, (path)))
 #define SMB_VFS_NEXT_SYS_ACL_GET_PERM(handle, permset, perm) ((handle)->vfs_next.ops.sys_acl_get_perm((handle)->vfs_next.handles.sys_acl_get_perm, (permset), (perm)))
 #define SMB_VFS_NEXT_SYS_ACL_FREE_TEXT(handle, text) ((handle)->vfs_next.ops.sys_acl_free_text((handle)->vfs_next.handles.sys_acl_free_text, (text)))
 /* EA operations. */
 #define SMB_VFS_NEXT_GETXATTR(handle,path,name,value,size) ((handle)->vfs_next.ops.getxattr((handle)->vfs_next.handles.getxattr,(path),(name),(value),(size)))
 #define SMB_VFS_NEXT_LGETXATTR(handle,path,name,value,size) ((handle)->vfs_next.ops.lgetxattr((handle)->vfs_next.handles.lgetxattr,(path),(name),(value),(size)))
-#define SMB_VFS_NEXT_FGETXATTR(handle,fsp,fd,name,value,size) ((handle)->vfs_next.ops.fgetxattr((handle)->vfs_next.handles.fgetxattr,(fsp),(fd),(name),(value),(size)))
+#define SMB_VFS_NEXT_FGETXATTR(handle,fsp,name,value,size) ((handle)->vfs_next.ops.fgetxattr((handle)->vfs_next.handles.fgetxattr,(fsp),(name),(value),(size)))
 #define SMB_VFS_NEXT_LISTXATTR(handle,path,list,size) ((handle)->vfs_next.ops.listxattr((handle)->vfs_next.handles.listxattr,(path),(list),(size)))
 #define SMB_VFS_NEXT_LLISTXATTR(handle,path,list,size) ((handle)->vfs_next.ops.llistxattr((handle)->vfs_next.handles.llistxattr,(path),(list),(size)))
-#define SMB_VFS_NEXT_FLISTXATTR(handle,fsp,fd,list,size) ((handle)->vfs_next.ops.flistxattr((handle)->vfs_next.handles.flistxattr,(fsp),(fd),(list),(size)))
+#define SMB_VFS_NEXT_FLISTXATTR(handle,fsp,list,size) ((handle)->vfs_next.ops.flistxattr((handle)->vfs_next.handles.flistxattr,(fsp),(list),(size)))
 #define SMB_VFS_NEXT_REMOVEXATTR(handle,path,name) ((handle)->vfs_next.ops.removexattr((handle)->vfs_next.handles.removexattr,(path),(name)))
 #define SMB_VFS_NEXT_LREMOVEXATTR(handle,path,name) ((handle)->vfs_next.ops.lremovexattr((handle)->vfs_next.handles.lremovexattr,(path),(name)))
-#define SMB_VFS_NEXT_FREMOVEXATTR(handle,fsp,fd,name) ((handle)->vfs_next.ops.fremovexattr((handle)->vfs_next.handles.fremovexattr,(fsp),(fd),(name)))
+#define SMB_VFS_NEXT_FREMOVEXATTR(handle,fsp,name) ((handle)->vfs_next.ops.fremovexattr((handle)->vfs_next.handles.fremovexattr,(fsp),(name)))
 #define SMB_VFS_NEXT_SETXATTR(handle,path,name,value,size,flags) ((handle)->vfs_next.ops.setxattr((handle)->vfs_next.handles.setxattr,(path),(name),(value),(size),(flags)))
 #define SMB_VFS_NEXT_LSETXATTR(handle,path,name,value,size,flags) ((handle)->vfs_next.ops.lsetxattr((handle)->vfs_next.handles.lsetxattr,(path),(name),(value),(size),(flags)))
-#define SMB_VFS_NEXT_FSETXATTR(handle,fsp,fd,name,value,size,flags) ((handle)->vfs_next.ops.fsetxattr((handle)->vfs_next.handles.fsetxattr,(fsp),(fd),(name),(value),(size),(flags)))
+#define SMB_VFS_NEXT_FSETXATTR(handle,fsp,name,value,size,flags) ((handle)->vfs_next.ops.fsetxattr((handle)->vfs_next.handles.fsetxattr,(fsp),(name),(value),(size),(flags)))
 
 /* AIO operations. */
 #define SMB_VFS_NEXT_AIO_READ(handle,fsp,aiocb) ((handle)->vfs_next.ops.aio_read((handle)->vfs_next.handles.aio_read,(fsp),(aiocb)))
 #define SMB_VFS_NEXT_AIO_WRITE(handle,fsp,aiocb) ((handle)->vfs_next.ops.aio_write((handle)->vfs_next.handles.aio_write,(fsp),(aiocb)))
 #define SMB_VFS_NEXT_AIO_RETURN(handle,fsp,aiocb) ((handle)->vfs_next.ops.aio_return_fn((handle)->vfs_next.handles.aio_return,(fsp),(aiocb)))
-#define SMB_VFS_NEXT_AIO_CANCEL(handle,fsp,fd,aiocb) ((handle)->vfs_next.ops.aio_cancel((handle)->vfs_next.handles.aio_cancel,(fsp),(fd),(aiocb)))
+#define SMB_VFS_NEXT_AIO_CANCEL(handle,fsp,aiocb) ((handle)->vfs_next.ops.aio_cancel((handle)->vfs_next.handles.aio_cancel,(fsp),(aiocb)))
 #define SMB_VFS_NEXT_AIO_ERROR(handle,fsp,aiocb) ((handle)->vfs_next.ops.aio_error_fn((handle)->vfs_next.handles.aio_error,(fsp),(aiocb)))
 #define SMB_VFS_NEXT_AIO_FSYNC(handle,fsp,op,aiocb) ((handle)->vfs_next.ops.aio_fsync((handle)->vfs_next.handles.aio_fsync,(fsp),(op),(aiocb)))
 #define SMB_VFS_NEXT_AIO_SUSPEND(handle,fsp,aiocb,n,ts) ((handle)->vfs_next.ops.aio_suspend((handle)->vfs_next.handles.aio_suspend,(fsp),(aiocb),(n),(ts)))
index b24fd0618a47885428a12c0bdce7c003dcae76be..83a0d111aa7926fd0e77cb6393788e77a8fc5f36 100644 (file)
@@ -43,33 +43,50 @@ static int db_tdb_record_destr(struct db_record* data)
        return 0;
 }
 
-static struct db_record *db_tdb_fetch_locked(struct db_context *db,
-                                    TALLOC_CTX *mem_ctx, TDB_DATA key)
-{
-       struct db_tdb_ctx *ctx = talloc_get_type_abort(db->private_data,
-                                                      struct db_tdb_ctx);
+struct tdb_fetch_locked_state {
+       TALLOC_CTX *mem_ctx;
        struct db_record *result;
-       TDB_DATA value;
+};
 
-       result = TALLOC_P(mem_ctx, struct db_record);
-       if (result == NULL) {
-               DEBUG(0, ("talloc failed\n"));
-               return NULL;
+static int db_tdb_fetchlock_parse(TDB_DATA key, TDB_DATA data,
+                                 void *private_data)
+{
+       struct tdb_fetch_locked_state *state =
+               (struct tdb_fetch_locked_state *)private_data;
+
+       state->result = (struct db_record *)talloc_size(
+               state->mem_ctx,
+               sizeof(struct db_record) + key.dsize + data.dsize);
+
+       if (state->result == NULL) {
+               return 0;
        }
 
-       result->key.dsize = key.dsize;
-       result->key.dptr = (uint8 *)talloc_memdup(result, key.dptr, key.dsize);
-       if (result->key.dptr == NULL) {
-               DEBUG(0, ("talloc failed\n"));
-               TALLOC_FREE(result);
-               return NULL;
+       state->result->key.dsize = key.dsize;
+       state->result->key.dptr = ((uint8 *)state->result)
+               + sizeof(struct db_record);
+       memcpy(state->result->key.dptr, key.dptr, key.dsize);
+
+       state->result->value.dsize = data.dsize;
+
+       if (data.dsize > 0) {
+               state->result->value.dptr = state->result->key.dptr+key.dsize;
+               memcpy(state->result->value.dptr, data.dptr, data.dsize);
        }
+       else {
+               state->result->value.dptr = NULL;
+       }
+
+       return 0;
+}
 
-       result->value.dptr = NULL;
-       result->value.dsize = 0;
-       result->private_data = talloc_reference(result, ctx);
-       result->store = db_tdb_store;
-       result->delete_rec = db_tdb_delete;
+static struct db_record *db_tdb_fetch_locked(struct db_context *db,
+                                    TALLOC_CTX *mem_ctx, TDB_DATA key)
+{
+       struct db_tdb_ctx *ctx = talloc_get_type_abort(db->private_data,
+                                                      struct db_tdb_ctx);
+       struct tdb_fetch_locked_state state;
+       int res;
 
        if (DEBUGLEVEL >= 10) {
                char *keystr = hex_encode(NULL, key.dptr, key.dsize);
@@ -81,32 +98,56 @@ static struct db_record *db_tdb_fetch_locked(struct db_context *db,
 
        if (tdb_chainlock(ctx->wtdb->tdb, key) != 0) {
                DEBUG(3, ("tdb_chainlock failed\n"));
-               TALLOC_FREE(result);
                return NULL;
        }
 
-       talloc_set_destructor(result, db_tdb_record_destr);
+       state.mem_ctx = mem_ctx;
+       state.result = NULL;
 
-       value = tdb_fetch(ctx->wtdb->tdb, key);
+       res = tdb_parse_record(ctx->wtdb->tdb, key, db_tdb_fetchlock_parse,
+                              &state);
 
-       if (value.dptr == NULL) {
-               return result;
+       if (state.result == NULL) {
+               db_tdb_fetchlock_parse(key, tdb_null, &state);
        }
 
-       result->value.dsize = value.dsize;
-       result->value.dptr = (uint8 *)talloc_memdup(result, value.dptr,
-                                                   value.dsize);
-       if (result->value.dptr == NULL) {
-               DEBUG(3, ("talloc failed\n"));
-               TALLOC_FREE(result);
+       if (state.result == NULL) {
+               tdb_chainunlock(ctx->wtdb->tdb, key);
                return NULL;
        }
 
-       SAFE_FREE(value.dptr);
+       talloc_set_destructor(state.result, db_tdb_record_destr);
 
-       DEBUG(10, ("Allocated locked data 0x%p\n", result));
+       state.result->private_data = talloc_reference(state.result, ctx);
+       state.result->store = db_tdb_store;
+       state.result->delete_rec = db_tdb_delete;
 
-       return result;
+       DEBUG(10, ("Allocated locked data 0x%p\n", state.result));
+
+       return state.result;
+}
+
+struct tdb_fetch_state {
+       TALLOC_CTX *mem_ctx;
+       int result;
+       TDB_DATA data;
+};
+
+static int db_tdb_fetch_parse(TDB_DATA key, TDB_DATA data,
+                             void *private_data)
+{
+       struct tdb_fetch_state *state =
+               (struct tdb_fetch_state *)private_data;
+
+       state->data.dptr = (uint8 *)talloc_memdup(state->mem_ctx, data.dptr,
+                                                 data.dsize);
+       if (state->data.dptr == NULL) {
+               state->result = -1;
+               return 0;
+       }
+
+       state->data.dsize = data.dsize;
+       return 0;
 }
 
 static int db_tdb_fetch(struct db_context *db, TALLOC_CTX *mem_ctx,
@@ -115,23 +156,20 @@ static int db_tdb_fetch(struct db_context *db, TALLOC_CTX *mem_ctx,
        struct db_tdb_ctx *ctx = talloc_get_type_abort(
                db->private_data, struct db_tdb_ctx);
 
-       TDB_DATA data;
-
-       data = tdb_fetch(ctx->wtdb->tdb, key);
+       struct tdb_fetch_state state;
 
-       if (data.dptr == NULL) {
-               pdata->dptr = NULL;
-               pdata->dsize = 0;
-               return 0;
-       }
+       state.mem_ctx = mem_ctx;
+       state.result = 0;
+       state.data.dptr = NULL;
+       state.data.dsize = 0;
 
-       pdata->dptr = (uint8 *)talloc_memdup(mem_ctx, data.dptr, data.dsize);
-       SAFE_FREE(data.dptr);
+       tdb_parse_record(ctx->wtdb->tdb, key, db_tdb_fetch_parse, &state);
 
-       if (pdata->dptr == NULL) {
+       if (state.result == -1) {
                return -1;
        }
-       pdata->dsize = data.dsize;
+
+       *pdata = state.data;
        return 0;
 }
 
index 9ea2dc151afd1d3b6c82c499f9e38afd5a399f3c..6c1bfea04f74fa2a7ba421218b7cf648ae5f6161 100644 (file)
@@ -199,6 +199,8 @@ void gfree_debugsyms(void)
 
        if ( DEBUGLEVEL_CLASS_ISSET != &debug_all_class_isset_hack )
                SAFE_FREE( DEBUGLEVEL_CLASS_ISSET );
+
+       SAFE_FREE(format_bufr);
 }
 
 /****************************************************************************
index d12e66bb26372a924bc441498ee6a8aa7a2ff966..4a3588e9abae1dddf959a1e1fd82d035adcfdb91 100644 (file)
@@ -249,6 +249,8 @@ static void callback_do_reboot(GtkWidget *widget,
                SAFE_FREE(buffer);
                state->name_type_new = type;
 #endif
+               NetApiBufferFree((void *)buffer);
+
                gtk_label_set_text(GTK_LABEL(state->label_current_name_buffer),
                                   state->name_buffer_new);
                if (state->name_type_new == NetSetupDomainName) {
@@ -449,14 +451,8 @@ static void callback_do_join(GtkWidget *widget,
                                                        initial_workgroup_type,
                                                        state->name_buffer_initial,
                                                        err_str);
-
-                       g_signal_connect_swapped(dialog, "response",
-                                                G_CALLBACK(gtk_widget_destroy),
-                                                dialog);
-
-                       gtk_widget_show(dialog);
-
-                       return;
+                       gtk_dialog_run(GTK_DIALOG(dialog));
+                       gtk_widget_destroy(dialog);
                }
 
        }
@@ -1298,8 +1294,12 @@ static int initialize_join_state(struct join_state *state,
                if (status) {
                        return status;
                }
-               state->name_buffer_initial = (char *)buffer;
+               state->name_buffer_initial = strdup(buffer);
+               if (!state->name_buffer_initial) {
+                       return -1;
+               }
                state->name_type_initial = type;
+               NetApiBufferFree((void *)buffer);
        }
 
        {
@@ -1317,6 +1317,7 @@ static int initialize_join_state(struct join_state *state,
                if (!state->comment) {
                        return -1;
                }
+               NetApiBufferFree(buffer);
        }
 #if 0
        {
index 634d265597236b126033250b70a9d1dea02c6002..a0ac0b1e5618fa325849526403d4cf96c15d06d8 100644 (file)
@@ -104,7 +104,12 @@ int main(int argc, char **argv)
                               password,
                               join_flags);
        if (status != 0) {
-               printf("Join failed with: %s\n", libnetapi_errstr(ctx, status));
+               const char *errstr = NULL;
+               errstr = libnetapi_get_error_string(ctx);
+               if (!errstr) {
+                       errstr = libnetapi_errstr(ctx, status);
+               }
+               printf("Join failed with: %s\n", errstr);
        } else {
                printf("Successfully joined\n");
        }
index c7849c952fac366716070484c7352e527c38a2d5..e4fb63eebb55541743aef65b0fb10ed552d403be 100644 (file)
@@ -33,13 +33,13 @@ static WERROR NetJoinDomainLocal(struct libnetapi_ctx *mem_ctx,
        struct libnet_JoinCtx *r = NULL;
        WERROR werr;
 
-       werr = libnet_init_JoinCtx(mem_ctx, &r);
-       W_ERROR_NOT_OK_RETURN(werr);
-
        if (!domain_name) {
                return WERR_INVALID_PARAM;
        }
 
+       werr = libnet_init_JoinCtx(mem_ctx, &r);
+       W_ERROR_NOT_OK_RETURN(werr);
+
        r->in.domain_name = talloc_strdup(mem_ctx, domain_name);
        W_ERROR_HAVE_NO_MEMORY(r->in.domain_name);
 
@@ -77,7 +77,13 @@ static WERROR NetJoinDomainLocal(struct libnetapi_ctx *mem_ctx,
        r->in.join_flags = join_flags;
        r->in.modify_config = true;
 
-       return libnet_Join(mem_ctx, r);
+       werr = libnet_Join(mem_ctx, r);
+       if (!W_ERROR_IS_OK(werr) && r->out.error_string) {
+               libnetapi_set_error_string(mem_ctx, r->out.error_string);
+       }
+       TALLOC_FREE(r);
+
+       return werr;
 }
 
 static WERROR NetJoinDomainRemote(struct libnetapi_ctx *ctx,
@@ -431,9 +437,9 @@ static WERROR NetGetJoinInformationLocal(struct libnetapi_ctx *ctx,
                                         uint16_t *name_type)
 {
        if ((lp_security() == SEC_ADS) && lp_realm()) {
-               *name_buffer = SMB_STRDUP(lp_realm());
+               *name_buffer = talloc_strdup(ctx, lp_realm());
        } else {
-               *name_buffer = SMB_STRDUP(lp_workgroup());
+               *name_buffer = talloc_strdup(ctx, lp_workgroup());
        }
        if (!*name_buffer) {
                return WERR_NOMEM;
index 032798d0f973e40de96bcb25a2857f50809d5182..d4cb3a9fe2f2d7c14f29915a9f9ac9fb23765384 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *  Unix SMB/CIFS implementation.
  *  NetApi Support
- *  Copyright (C) Guenther Deschner 2007
+ *  Copyright (C) Guenther Deschner 2007-2008
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -26,15 +26,22 @@ struct libnetapi_ctx *stat_ctx = NULL;
 TALLOC_CTX *frame = NULL;
 static bool libnetapi_initialized = false;
 
+/****************************************************************
+****************************************************************/
+
 NET_API_STATUS libnetapi_init(struct libnetapi_ctx **context)
 {
        struct libnetapi_ctx *ctx = NULL;
+       char *krb5_cc_env = NULL;
 
        if (stat_ctx && libnetapi_initialized) {
                *context = stat_ctx;
-               return W_ERROR_V(WERR_OK);
+               return NET_API_STATUS_SUCCESS;
        }
 
+#ifdef DEVELOPER
+       talloc_enable_leak_report();
+#endif
        frame = talloc_stackframe();
 
        ctx = talloc_zero(frame, struct libnetapi_ctx);
@@ -65,57 +72,90 @@ NET_API_STATUS libnetapi_init(struct libnetapi_ctx **context)
 
        BlockSignals(True, SIGPIPE);
 
+       krb5_cc_env = getenv(KRB5_ENV_CCNAME);
+       if (!krb5_cc_env || (strlen(krb5_cc_env) == 0)) {
+               ctx->krb5_cc_env = talloc_strdup(frame, "MEMORY:libnetapi");
+               setenv(KRB5_ENV_CCNAME, ctx->krb5_cc_env, 1);
+       }
+
        libnetapi_initialized = true;
 
        *context = stat_ctx = ctx;
 
-       return W_ERROR_V(WERR_OK);
+       return NET_API_STATUS_SUCCESS;
 }
 
+/****************************************************************
+****************************************************************/
+
 NET_API_STATUS libnetapi_getctx(struct libnetapi_ctx **ctx)
 {
        if (stat_ctx) {
                *ctx = stat_ctx;
-               return W_ERROR_V(WERR_OK);
+               return NET_API_STATUS_SUCCESS;
        }
 
        return libnetapi_init(ctx);
 }
 
+/****************************************************************
+****************************************************************/
+
 NET_API_STATUS libnetapi_free(struct libnetapi_ctx *ctx)
 {
+
+       if (ctx->krb5_cc_env) {
+               char *env = getenv(KRB5_ENV_CCNAME);
+               if (env && (strequal(ctx->krb5_cc_env, env))) {
+                       unsetenv(KRB5_ENV_CCNAME);
+               }
+       }
+
        gfree_names();
        gfree_loadparm();
        gfree_case_tables();
        gfree_charcnv();
        gfree_interfaces();
 
+       gencache_shutdown();
+       secrets_shutdown();
+       regdb_close();
+
        TALLOC_FREE(ctx);
        TALLOC_FREE(frame);
 
        gfree_debugsyms();
 
-       return W_ERROR_V(WERR_OK);
+       return NET_API_STATUS_SUCCESS;
 }
 
+/****************************************************************
+****************************************************************/
+
 NET_API_STATUS libnetapi_set_debuglevel(struct libnetapi_ctx *ctx,
                                        const char *debuglevel)
 {
        AllowDebugChange = true;
-       ctx->debuglevel = debuglevel;
+       ctx->debuglevel = talloc_strdup(ctx, debuglevel);
        if (!debug_parse_levels(debuglevel)) {
                return W_ERROR_V(WERR_GENERAL_FAILURE);
        }
-       return W_ERROR_V(WERR_OK);
+       return NET_API_STATUS_SUCCESS;
 }
 
+/****************************************************************
+****************************************************************/
+
 NET_API_STATUS libnetapi_get_debuglevel(struct libnetapi_ctx *ctx,
-                                       const char **debuglevel)
+                                       char **debuglevel)
 {
        *debuglevel = ctx->debuglevel;
-       return W_ERROR_V(WERR_OK);
+       return NET_API_STATUS_SUCCESS;
 }
 
+/****************************************************************
+****************************************************************/
+
 NET_API_STATUS libnetapi_set_username(struct libnetapi_ctx *ctx,
                                      const char *username)
 {
@@ -124,7 +164,7 @@ NET_API_STATUS libnetapi_set_username(struct libnetapi_ctx *ctx,
        if (!ctx->username) {
                return W_ERROR_V(WERR_NOMEM);
        }
-       return W_ERROR_V(WERR_OK);
+       return NET_API_STATUS_SUCCESS;
 }
 
 NET_API_STATUS libnetapi_set_password(struct libnetapi_ctx *ctx,
@@ -135,7 +175,7 @@ NET_API_STATUS libnetapi_set_password(struct libnetapi_ctx *ctx,
        if (!ctx->password) {
                return W_ERROR_V(WERR_NOMEM);
        }
-       return W_ERROR_V(WERR_OK);
+       return NET_API_STATUS_SUCCESS;
 }
 
 NET_API_STATUS libnetapi_set_workgroup(struct libnetapi_ctx *ctx,
@@ -146,9 +186,12 @@ NET_API_STATUS libnetapi_set_workgroup(struct libnetapi_ctx *ctx,
        if (!ctx->workgroup) {
                return W_ERROR_V(WERR_NOMEM);
        }
-       return W_ERROR_V(WERR_OK);
+       return NET_API_STATUS_SUCCESS;
 }
 
+/****************************************************************
+****************************************************************/
+
 const char *libnetapi_errstr(struct libnetapi_ctx *ctx,
                             NET_API_STATUS status)
 {
@@ -158,3 +201,40 @@ const char *libnetapi_errstr(struct libnetapi_ctx *ctx,
 
        return get_friendly_werror_msg(W_ERROR(status));
 }
+
+/****************************************************************
+****************************************************************/
+
+NET_API_STATUS libnetapi_set_error_string(struct libnetapi_ctx *ctx,
+                                         const char *error_string)
+{
+       TALLOC_FREE(ctx->error_string);
+       ctx->error_string = talloc_strdup(ctx, error_string);
+       if (!ctx->error_string) {
+               return W_ERROR_V(WERR_NOMEM);
+       }
+       return NET_API_STATUS_SUCCESS;
+
+}
+
+/****************************************************************
+****************************************************************/
+
+const char *libnetapi_get_error_string(struct libnetapi_ctx *ctx)
+{
+       return ctx->error_string;
+}
+
+/****************************************************************
+****************************************************************/
+
+NET_API_STATUS NetApiBufferFree(void *buffer)
+{
+       if (!buffer) {
+               return W_ERROR_V(WERR_INSUFFICIENT_BUFFER);
+       }
+
+       talloc_free(buffer);
+
+       return NET_API_STATUS_SUCCESS;
+}
index 0dd6d95ceb17459f0ed54f224d5dac474f2f64ba..4a40b32fc95d4239cbc4200d54db21f4321bea58 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *  Unix SMB/CIFS implementation.
  *  NetApi Support
- *  Copyright (C) Guenther Deschner 2007
+ *  Copyright (C) Guenther Deschner 2007-2008
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
 #define __LIB_NETAPI_H__
 
 #define NET_API_STATUS uint32_t
+#define NET_API_STATUS_SUCCESS 0
+
+/****************************************************************
+****************************************************************/
 
 struct libnetapi_ctx {
-       const char *debuglevel;
+       char *debuglevel;
+       char *error_string;
        char *username;
        char *workgroup;
        char *password;
+       char *krb5_cc_env;
 };
 
+/****************************************************************
+****************************************************************/
+
 NET_API_STATUS libnetapi_init(struct libnetapi_ctx **ctx);
 NET_API_STATUS libnetapi_getctx(struct libnetapi_ctx **ctx);
 NET_API_STATUS libnetapi_free(struct libnetapi_ctx *ctx);
 NET_API_STATUS libnetapi_set_debuglevel(struct libnetapi_ctx *ctx, const char *debuglevel);
-NET_API_STATUS libnetapi_get_debuglevel(struct libnetapi_ctx *ctx, const char **debuglevel);
+NET_API_STATUS libnetapi_get_debuglevel(struct libnetapi_ctx *ctx, char **debuglevel);
 NET_API_STATUS libnetapi_set_username(struct libnetapi_ctx *ctx, const char *username);
 NET_API_STATUS libnetapi_set_password(struct libnetapi_ctx *ctx, const char *password);
 NET_API_STATUS libnetapi_set_workgroup(struct libnetapi_ctx *ctx, const char *workgroup);
 const char *libnetapi_errstr(struct libnetapi_ctx *ctx, NET_API_STATUS status);
+NET_API_STATUS libnetapi_set_error_string(struct libnetapi_ctx *ctx, const char *error_string);
+const char *libnetapi_get_error_string(struct libnetapi_ctx *ctx);
+
+/****************************************************************
+****************************************************************/
+
+NET_API_STATUS NetApiBufferFree(void *buffer);
+
+/****************************************************************
+****************************************************************/
 
 /* wkssvc */
 NET_API_STATUS NetJoinDomain(const char *server,
index 80feee95790d4323d418d3d263837827fa8b6cf8..59b54c4dff00b06875ebfef8cad2e56a5987746f 100644 (file)
@@ -34,6 +34,11 @@ fstring remote_proto="UNKNOWN";
 
 static char *local_machine;
 
+void free_local_machine_name(void)
+{
+       SAFE_FREE(local_machine);
+}
+
 bool set_local_machine_name(const char *local_name, bool perm)
 {
        static bool already_perm = false;
index 3e61f42aa52ac889da8fa451887a2f137ce692e5..9c1256ed650039d8a4c895f9aa9b4f5a9a6dab60 100644 (file)
@@ -3,7 +3,7 @@
    Samba system utilities for ACL support.
    Copyright (C) Jeremy Allison 2000.
    Copyright (C) Volker Lendecke 2006
-   Copyright (C) Michael Adam 2006
+   Copyright (C) Michael Adam 2006,2008
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -364,9 +364,9 @@ SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
        return posixacl_sys_acl_get_file(handle, path_p, type);
 }
  
-SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp, int fd)
+SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp)
 {
-       return posixacl_sys_acl_get_fd(handle, fsp, fd);
+       return posixacl_sys_acl_get_fd(handle, fsp);
 }
  
 int sys_acl_set_file(vfs_handle_struct *handle,
@@ -376,9 +376,9 @@ int sys_acl_set_file(vfs_handle_struct *handle,
 }
  
 int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
-                  int fd, SMB_ACL_T acl_d)
+                  SMB_ACL_T acl_d)
 {
-       return posixacl_sys_acl_set_fd(handle, fsp, fd, acl_d);
+       return posixacl_sys_acl_set_fd(handle, fsp, acl_d);
 }
 
 int sys_acl_delete_def_file(vfs_handle_struct *handle,
@@ -395,9 +395,9 @@ SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
        return aixacl_sys_acl_get_file(handle, path_p, type);
 }
 
-SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp, int fd)
+SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp)
 {
-       return aixacl_sys_acl_get_fd(handle, fsp, fd);
+       return aixacl_sys_acl_get_fd(handle, fsp);
 }
 
 int sys_acl_set_file(vfs_handle_struct *handle,
@@ -407,9 +407,9 @@ int sys_acl_set_file(vfs_handle_struct *handle,
 }
 
 int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
-                  int fd, SMB_ACL_T acl_d)
+                  SMB_ACL_T acl_d)
 {
-       return aixacl_sys_acl_set_fd(handle, fsp, fd, acl_d);
+       return aixacl_sys_acl_set_fd(handle, fsp, acl_d);
 }
 
 int sys_acl_delete_def_file(vfs_handle_struct *handle,
@@ -426,9 +426,9 @@ SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
        return tru64acl_sys_acl_get_file(handle, path_p, type);
 }
 
-SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp, int fd)
+SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp)
 {
-       return tru64acl_sys_acl_get_fd(handle, fsp, fd);
+       return tru64acl_sys_acl_get_fd(handle, fsp);
 }
 
 int sys_acl_set_file(vfs_handle_struct *handle,
@@ -438,9 +438,9 @@ int sys_acl_set_file(vfs_handle_struct *handle,
 }
 
 int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
-                  int fd, SMB_ACL_T acl_d)
+                  SMB_ACL_T acl_d)
 {
-       return tru64acl_sys_acl_set_fd(handle, fsp, fd, acl_d);
+       return tru64acl_sys_acl_set_fd(handle, fsp, acl_d);
 }
 
 int sys_acl_delete_def_file(vfs_handle_struct *handle,
@@ -457,9 +457,9 @@ SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
        return solarisacl_sys_acl_get_file(handle, path_p, type);
 }
 
-SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp, int fd)
+SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp)
 {
-       return solarisacl_sys_acl_get_fd(handle, fsp, fd);
+       return solarisacl_sys_acl_get_fd(handle, fsp);
 }
 
 int sys_acl_set_file(vfs_handle_struct *handle,
@@ -469,9 +469,9 @@ int sys_acl_set_file(vfs_handle_struct *handle,
 }
 
 int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
-                  int fd, SMB_ACL_T acl_d)
+                  SMB_ACL_T acl_d)
 {
-       return solarisacl_sys_acl_set_fd(handle, fsp, fd, acl_d);
+       return solarisacl_sys_acl_set_fd(handle, fsp, acl_d);
 }
 
 int sys_acl_delete_def_file(vfs_handle_struct *handle,
@@ -488,9 +488,9 @@ SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
        return hpuxacl_sys_acl_get_file(handle, path_p, type);
 }
 
-SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp, int fd)
+SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp)
 {
-       return hpuxacl_sys_acl_get_fd(handle, fsp, fd);
+       return hpuxacl_sys_acl_get_fd(handle, fsp);
 }
 
 int sys_acl_set_file(vfs_handle_struct *handle,
@@ -500,9 +500,9 @@ int sys_acl_set_file(vfs_handle_struct *handle,
 }
 
 int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
-                  int fd, SMB_ACL_T acl_d)
+                  SMB_ACL_T acl_d)
 {
-       return hpuxacl_sys_acl_set_fd(handle, fsp, fd, acl_d);
+       return hpuxacl_sys_acl_set_fd(handle, fsp, acl_d);
 }
 
 int sys_acl_delete_def_file(vfs_handle_struct *handle,
@@ -519,9 +519,9 @@ SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
        return irixacl_sys_acl_get_file(handle, path_p, type);
 }
 
-SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp, int fd)
+SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp)
 {
-       return irixacl_sys_acl_get_fd(handle, fsp, fd);
+       return irixacl_sys_acl_get_fd(handle, fsp);
 }
 
 int sys_acl_set_file(vfs_handle_struct *handle,
@@ -531,9 +531,9 @@ int sys_acl_set_file(vfs_handle_struct *handle,
 }
 
 int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
-                  int fd, SMB_ACL_T acl_d)
+                  SMB_ACL_T acl_d)
 {
-       return irixacl_sys_acl_set_fd(handle, fsp, fd, acl_d);
+       return irixacl_sys_acl_set_fd(handle, fsp, acl_d);
 }
 
 int sys_acl_delete_def_file(vfs_handle_struct *handle,
@@ -555,7 +555,7 @@ SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
        return NULL;
 }
 
-SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp, int fd)
+SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp)
 {
 #ifdef ENOTSUP
        errno = ENOTSUP;
@@ -577,7 +577,7 @@ int sys_acl_set_file(vfs_handle_struct *handle,
 }
 
 int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
-                  int fd, SMB_ACL_T acl_d)
+                  SMB_ACL_T acl_d)
 {
 #ifdef ENOTSUP
        errno = ENOTSUP;
index e6e4ed321a52a08956e652f943f5452b81f4bbac..cc7ce3a51873b34b78eeb2bae2610bde3b0c4f10 100644 (file)
 static int talloc_stacksize;
 static TALLOC_CTX **talloc_stack;
 
-static int talloc_pop(int *ptr)
+static int talloc_pop(TALLOC_CTX *frame)
 {
-       int tos = *ptr;
        int i;
 
-       for (i=talloc_stacksize-1; i>=tos; i--) {
+       for (i=talloc_stacksize-1; i>0; i--) {
+               if (frame == talloc_stack[i]) {
+                       break;
+               }
                talloc_free(talloc_stack[i]);
        }
 
-       talloc_stacksize = tos;
+       talloc_stacksize = i;
        return 0;
 }
 
@@ -64,7 +66,6 @@ static int talloc_pop(int *ptr)
 TALLOC_CTX *talloc_stackframe(void)
 {
        TALLOC_CTX **tmp, *top;
-       int *cleanup;
 
        if (!(tmp = TALLOC_REALLOC_ARRAY(NULL, talloc_stack, TALLOC_CTX *,
                                         talloc_stacksize + 1))) {
@@ -77,12 +78,7 @@ TALLOC_CTX *talloc_stackframe(void)
                goto fail;
        }
 
-       if (!(cleanup = talloc(top, int))) {
-               goto fail;
-       }
-
-       *cleanup = talloc_stacksize;
-       talloc_set_destructor(cleanup, talloc_pop);
+       talloc_set_destructor(top, talloc_pop);
 
        talloc_stack[talloc_stacksize++] = top;
 
index c69a1450a0ff37af93e490778e2a24a7a9105825..25b2700ae3db688a020310a4cf56db8e678a8b28 100644 (file)
@@ -183,6 +183,7 @@ void gfree_names(void)
        SAFE_FREE( smb_myworkgroup );
        SAFE_FREE( smb_scope );
        free_netbios_names_array();
+       free_local_machine_name();
 }
 
 void gfree_all( void )
index 975e9268649a7f866217000ae648e02c42e08465..28bc7793d726b70bf9d8a3e6914987a542fe19ff 100644 (file)
@@ -3026,26 +3026,26 @@ char* ads_get_upn( ADS_STRUCT *ads, TALLOC_CTX *ctx, const char *machine_name )
        ADS_STATUS status;
        int count = 0;
        char *name = NULL;
-       
-       status = ads_find_machine_acct(ads, &res, global_myname());
+
+       status = ads_find_machine_acct(ads, &res, machine_name);
        if (!ADS_ERR_OK(status)) {
                DEBUG(0,("ads_get_upn: Failed to find account for %s\n",
                        global_myname()));
                goto out;
        }
-               
+
        if ( (count = ads_count_replies(ads, res)) != 1 ) {
                DEBUG(1,("ads_get_upn: %d entries returned!\n", count));
                goto out;
        }
-               
+
        if ( (name = ads_pull_string(ads, ctx, res, "userPrincipalName")) == NULL ) {
                DEBUG(2,("ads_get_upn: No userPrincipalName attribute!\n"));
        }
 
 out:
        ads_msgfree(ads, res);
-       
+
        return name;
 }
 
index 9f6557ef32e6cbbdf9eec8773b0fd427d28f512d..03d5286fae4c779937a8c792292c10cd15b43f01 100644 (file)
@@ -166,7 +166,7 @@ static void gpo_sync_func(const char *mnt,
                }
 
                old_nt_dir = ctx->remote_path;
-               ctx->remote_path = nt_dir;
+               ctx->remote_path = talloc_strdup(ctx->mem_ctx, nt_dir);
 
                old_unix_dir = ctx->local_path;
                ctx->local_path = talloc_strdup(ctx->mem_ctx, unix_dir);
@@ -174,7 +174,7 @@ static void gpo_sync_func(const char *mnt,
                ctx->mask = talloc_asprintf(ctx->mem_ctx,
                                        "%s\\*",
                                        nt_dir);
-               if (!ctx->local_path || !ctx->mask) {
+               if (!ctx->local_path || !ctx->mask || !ctx->remote_path) {
                        DEBUG(0,("gpo_sync_func: ENOMEM\n"));
                        return;
                }
index 95b643ffa6805b873cc2d26e4a59c81a70775354..454c1f29fb55e8ce9e655f319adbad2b2bade525 100644 (file)
 #include "libnet/libnet_join.h"
 #include "libnet/libnet_proto.h"
 
+/****************************************************************
+****************************************************************/
+
+static void libnet_join_set_error_string(TALLOC_CTX *mem_ctx,
+                                        struct libnet_JoinCtx *r,
+                                        const char *format, ...)
+{
+       va_list args;
+       char *tmp = NULL;
+
+       va_start(args, format);
+       tmp = talloc_vasprintf(mem_ctx, format, args);
+       va_end(args);
+
+       TALLOC_FREE(r->out.error_string);
+       r->out.error_string = tmp;
+}
+
+/****************************************************************
+****************************************************************/
+
+static void libnet_unjoin_set_error_string(TALLOC_CTX *mem_ctx,
+                                          struct libnet_UnjoinCtx *r,
+                                          const char *format, ...)
+{
+       va_list args;
+       char *tmp = NULL;
+
+       va_start(args, format);
+       tmp = talloc_vasprintf(mem_ctx, format, args);
+       va_end(args);
+
+       TALLOC_FREE(r->out.error_string);
+       r->out.error_string = tmp;
+}
+
+#ifdef HAVE_LDAP
+
+/****************************************************************
+****************************************************************/
+
+static ADS_STATUS libnet_connect_ads(const char *dns_domain_name,
+                                    const char *netbios_domain_name,
+                                    const char *dc_name,
+                                    const char *user_name,
+                                    const char *password,
+                                    ADS_STRUCT **ads)
+{
+       ADS_STATUS status;
+       ADS_STRUCT *my_ads = NULL;
+
+       my_ads = ads_init(dns_domain_name,
+                         netbios_domain_name,
+                         dc_name);
+       if (!my_ads) {
+               return ADS_ERROR_LDAP(LDAP_NO_MEMORY);
+       }
+
+       if (user_name) {
+               SAFE_FREE(my_ads->auth.user_name);
+               my_ads->auth.user_name = SMB_STRDUP(user_name);
+       }
+
+       if (password) {
+               SAFE_FREE(my_ads->auth.password);
+               my_ads->auth.password = SMB_STRDUP(password);
+       }
+
+       status = ads_connect(my_ads);
+       if (!ADS_ERR_OK(status)) {
+               ads_destroy(&my_ads);
+               return status;
+       }
+
+       *ads = my_ads;
+       return ADS_SUCCESS;
+}
+
+/****************************************************************
+****************************************************************/
+
+static ADS_STATUS libnet_join_connect_ads(TALLOC_CTX *mem_ctx,
+                                         struct libnet_JoinCtx *r)
+{
+       ADS_STATUS status;
+
+       if (r->in.ads) {
+               ads_destroy(&r->in.ads);
+       }
+
+       status = libnet_connect_ads(r->in.domain_name,
+                                   r->in.domain_name,
+                                   r->in.dc_name,
+                                   r->in.admin_account,
+                                   r->in.admin_password,
+                                   &r->in.ads);
+       if (!ADS_ERR_OK(status)) {
+               libnet_join_set_error_string(mem_ctx, r,
+                       "failed to connect to AD: %s\n",
+                       ads_errstr(status));
+       }
+
+       return status;
+}
+
+/****************************************************************
+****************************************************************/
+
+static ADS_STATUS libnet_unjoin_connect_ads(TALLOC_CTX *mem_ctx,
+                                           struct libnet_UnjoinCtx *r)
+{
+       ADS_STATUS status;
+
+       if (r->in.ads) {
+               ads_destroy(&r->in.ads);
+       }
+
+       status = libnet_connect_ads(r->in.domain_name,
+                                   r->in.domain_name,
+                                   r->in.dc_name,
+                                   r->in.admin_account,
+                                   r->in.admin_password,
+                                   &r->in.ads);
+       if (!ADS_ERR_OK(status)) {
+               libnet_unjoin_set_error_string(mem_ctx, r,
+                       "failed to connect to AD: %s\n",
+                       ads_errstr(status));
+       }
+
+       return status;
+}
+
+/****************************************************************
+****************************************************************/
+
+static ADS_STATUS libnet_join_precreate_machine_acct(TALLOC_CTX *mem_ctx,
+                                                    struct libnet_JoinCtx *r)
+{
+       ADS_STATUS status;
+       LDAPMessage *res = NULL;
+       const char *attrs[] = { "dn", NULL };
+
+       status = ads_search_dn(r->in.ads, &res, r->in.account_ou, attrs);
+       if (!ADS_ERR_OK(status)) {
+               return status;
+       }
+
+       if (ads_count_replies(r->in.ads, res) != 1) {
+               ads_msgfree(r->in.ads, res);
+               return ADS_ERROR_LDAP(LDAP_NO_SUCH_OBJECT);
+       }
+
+       status = ads_create_machine_acct(r->in.ads,
+                                        r->in.machine_name,
+                                        r->in.account_ou);
+       ads_msgfree(r->in.ads, res);
+
+       if ((status.error_type == ENUM_ADS_ERROR_LDAP) &&
+           (status.err.rc == LDAP_ALREADY_EXISTS)) {
+               status = ADS_SUCCESS;
+       }
+
+       return status;
+}
+
+/****************************************************************
+****************************************************************/
+
+static ADS_STATUS libnet_unjoin_remove_machine_acct(TALLOC_CTX *mem_ctx,
+                                                   struct libnet_UnjoinCtx *r)
+{
+       ADS_STATUS status;
+
+       if (!r->in.ads) {
+               status = libnet_unjoin_connect_ads(mem_ctx, r);
+               if (!ADS_ERR_OK(status)) {
+                       return status;
+               }
+       }
+
+       return ads_leave_realm(r->in.ads, r->in.machine_name);
+}
+
+/****************************************************************
+****************************************************************/
+
+static ADS_STATUS libnet_join_find_machine_acct(TALLOC_CTX *mem_ctx,
+                                               struct libnet_JoinCtx *r)
+{
+       ADS_STATUS status;
+       LDAPMessage *res = NULL;
+       char *dn = NULL;
+
+       if (!r->in.machine_name) {
+               return ADS_ERROR(LDAP_NO_MEMORY);
+       }
+
+       status = ads_find_machine_acct(r->in.ads,
+                                      &res,
+                                      r->in.machine_name);
+       if (!ADS_ERR_OK(status)) {
+               return status;
+       }
+
+       if (ads_count_replies(r->in.ads, res) != 1) {
+               status = ADS_ERROR_LDAP(LDAP_NO_MEMORY);
+               goto done;
+       }
+
+       dn = ads_get_dn(r->in.ads, res);
+       if (!dn) {
+               status = ADS_ERROR_LDAP(LDAP_NO_MEMORY);
+               goto done;
+       }
+
+       TALLOC_FREE(r->out.dn);
+       r->out.dn = talloc_strdup(mem_ctx, dn);
+       if (!r->out.dn) {
+               status = ADS_ERROR_LDAP(LDAP_NO_MEMORY);
+               goto done;
+       }
+
+ done:
+       ads_msgfree(r->in.ads, res);
+       ads_memfree(r->in.ads, dn);
+
+       return status;
+}
+
+/****************************************************************
+****************************************************************/
+
+static ADS_STATUS libnet_join_set_machine_spn(TALLOC_CTX *mem_ctx,
+                                             struct libnet_JoinCtx *r)
+{
+       ADS_STATUS status;
+       ADS_MODLIST mods;
+       fstring my_fqdn;
+       const char *spn_array[3] = {NULL, NULL, NULL};
+       char *spn = NULL;
+
+       if (!r->in.ads) {
+               status = libnet_join_connect_ads(mem_ctx, r);
+               if (!ADS_ERR_OK(status)) {
+                       return status;
+               }
+       }
+
+       status = libnet_join_find_machine_acct(mem_ctx, r);
+       if (!ADS_ERR_OK(status)) {
+               return status;
+       }
+
+       spn = talloc_asprintf(mem_ctx, "HOST/%s", r->in.machine_name);
+       if (!spn) {
+               return ADS_ERROR_LDAP(LDAP_NO_MEMORY);
+       }
+       strupper_m(spn);
+       spn_array[0] = spn;
+
+       if (name_to_fqdn(my_fqdn, r->in.machine_name) &&
+           !strequal(my_fqdn, r->in.machine_name)) {
+
+               strlower_m(my_fqdn);
+               spn = talloc_asprintf(mem_ctx, "HOST/%s", my_fqdn);
+               if (!spn) {
+                       return ADS_ERROR_LDAP(LDAP_NO_MEMORY);
+               }
+               spn_array[1] = spn;
+       }
+
+       mods = ads_init_mods(mem_ctx);
+       if (!mods) {
+               return ADS_ERROR_LDAP(LDAP_NO_MEMORY);
+       }
+
+       status = ads_mod_str(mem_ctx, &mods, "dNSHostName", my_fqdn);
+       if (!ADS_ERR_OK(status)) {
+               return ADS_ERROR_LDAP(LDAP_NO_MEMORY);
+       }
+
+       status = ads_mod_strlist(mem_ctx, &mods, "servicePrincipalName",
+                                spn_array);
+       if (!ADS_ERR_OK(status)) {
+               return ADS_ERROR_LDAP(LDAP_NO_MEMORY);
+       }
+
+       return ads_gen_mod(r->in.ads, r->out.dn, mods);
+}
+
+/****************************************************************
+****************************************************************/
+
+static ADS_STATUS libnet_join_set_machine_upn(TALLOC_CTX *mem_ctx,
+                                             struct libnet_JoinCtx *r)
+{
+       ADS_STATUS status;
+       ADS_MODLIST mods;
+
+       if (!r->in.create_upn) {
+               return ADS_SUCCESS;
+       }
+
+       if (!r->in.ads) {
+               status = libnet_join_connect_ads(mem_ctx, r);
+               if (!ADS_ERR_OK(status)) {
+                       return status;
+               }
+       }
+
+       status = libnet_join_find_machine_acct(mem_ctx, r);
+       if (!ADS_ERR_OK(status)) {
+               return status;
+       }
+
+       if (!r->in.upn) {
+               r->in.upn = talloc_asprintf(mem_ctx,
+                                           "host/%s@%s",
+                                           r->in.machine_name,
+                                           r->out.dns_domain_name);
+               if (!r->in.upn) {
+                       return ADS_ERROR(LDAP_NO_MEMORY);
+               }
+       }
+
+       mods = ads_init_mods(mem_ctx);
+       if (!mods) {
+               return ADS_ERROR_LDAP(LDAP_NO_MEMORY);
+       }
+
+       status = ads_mod_str(mem_ctx, &mods, "userPrincipalName", r->in.upn);
+       if (!ADS_ERR_OK(status)) {
+               return ADS_ERROR_LDAP(LDAP_NO_MEMORY);
+       }
+
+       return ads_gen_mod(r->in.ads, r->out.dn, mods);
+}
+
+
+/****************************************************************
+****************************************************************/
+
+static ADS_STATUS libnet_join_set_os_attributes(TALLOC_CTX *mem_ctx,
+                                               struct libnet_JoinCtx *r)
+{
+       ADS_STATUS status;
+       ADS_MODLIST mods;
+       char *os_sp = NULL;
+
+       if (!r->in.os_name || !r->in.os_version ) {
+               return ADS_SUCCESS;
+       }
+
+       if (!r->in.ads) {
+               status = libnet_join_connect_ads(mem_ctx, r);
+               if (!ADS_ERR_OK(status)) {
+                       return status;
+               }
+       }
+
+       status = libnet_join_find_machine_acct(mem_ctx, r);
+       if (!ADS_ERR_OK(status)) {
+               return status;
+       }
+
+       mods = ads_init_mods(mem_ctx);
+       if (!mods) {
+               return ADS_ERROR(LDAP_NO_MEMORY);
+       }
+
+       os_sp = talloc_asprintf(mem_ctx, "Samba %s", SAMBA_VERSION_STRING);
+       if (!os_sp) {
+               return ADS_ERROR(LDAP_NO_MEMORY);
+       }
+
+       status = ads_mod_str(mem_ctx, &mods, "operatingSystem",
+                            r->in.os_name);
+       if (!ADS_ERR_OK(status)) {
+               return status;
+       }
+
+       status = ads_mod_str(mem_ctx, &mods, "operatingSystemVersion",
+                            r->in.os_version);
+       if (!ADS_ERR_OK(status)) {
+               return status;
+       }
+
+       status = ads_mod_str(mem_ctx, &mods, "operatingSystemServicePack",
+                            os_sp);
+       if (!ADS_ERR_OK(status)) {
+               return status;
+       }
+
+       return ads_gen_mod(r->in.ads, r->out.dn, mods);
+}
+
+#endif
+
+/****************************************************************
+****************************************************************/
+
+static bool libnet_join_create_keytab(TALLOC_CTX *mem_ctx,
+                                     struct libnet_JoinCtx *r)
+{
+       if (!lp_use_kerberos_keytab()) {
+               return true;
+       }
+
+#ifdef WITH_KRB5
+       if (!ads_keytab_create_default(r->in.ads)) {
+               return false;
+       }
+#endif
+       return true;
+}
+
+/****************************************************************
+****************************************************************/
+
 static bool libnet_join_joindomain_store_secrets(TALLOC_CTX *mem_ctx,
                                                 struct libnet_JoinCtx *r)
 {
@@ -41,6 +460,9 @@ static bool libnet_join_joindomain_store_secrets(TALLOC_CTX *mem_ctx,
        return true;
 }
 
+/****************************************************************
+****************************************************************/
+
 static NTSTATUS libnet_join_joindomain_rpc(TALLOC_CTX *mem_ctx,
                                           struct libnet_JoinCtx *r)
 {
@@ -138,17 +560,21 @@ static NTSTATUS libnet_join_joindomain_rpc(TALLOC_CTX *mem_ctx,
        strlower_m(acct_name);
        const_acct_name = acct_name;
 
-       status = rpccli_samr_create_dom_user(pipe_hnd, mem_ctx, &domain_pol,
-                                            acct_name, ACB_WSTRUST,
-                                            0xe005000b, &user_pol, &user_rid);
-       if (NT_STATUS_EQUAL(status, NT_STATUS_USER_EXISTS)) {
-               if (!(r->in.join_flags & WKSSVC_JOIN_FLAGS_DOMAIN_JOIN_IF_JOINED)) {
-                       goto done;
+       if (r->in.join_flags & WKSSVC_JOIN_FLAGS_ACCOUNT_CREATE) {
+               status = rpccli_samr_create_dom_user(pipe_hnd, mem_ctx,
+                                                    &domain_pol,
+                                                    acct_name, ACB_WSTRUST,
+                                                    0xe005000b, &user_pol,
+                                                    &user_rid);
+               if (NT_STATUS_EQUAL(status, NT_STATUS_USER_EXISTS)) {
+                       if (!(r->in.join_flags & WKSSVC_JOIN_FLAGS_DOMAIN_JOIN_IF_JOINED)) {
+                               goto done;
+                       }
                }
-       }
 
-       if (NT_STATUS_IS_OK(status)) {
-               rpccli_samr_close(pipe_hnd, mem_ctx, &user_pol);
+               if (NT_STATUS_IS_OK(status)) {
+                       rpccli_samr_close(pipe_hnd, mem_ctx, &user_pol);
+               }
        }
 
        status = rpccli_samr_lookup_names(pipe_hnd, mem_ctx,
@@ -225,6 +651,9 @@ static NTSTATUS libnet_join_joindomain_rpc(TALLOC_CTX *mem_ctx,
        return status;
 }
 
+/****************************************************************
+****************************************************************/
+
 static bool libnet_join_unjoindomain_remove_secrets(TALLOC_CTX *mem_ctx,
                                                    struct libnet_UnjoinCtx *r)
 {
@@ -239,6 +668,9 @@ static bool libnet_join_unjoindomain_remove_secrets(TALLOC_CTX *mem_ctx,
        return true;
 }
 
+/****************************************************************
+****************************************************************/
+
 static NTSTATUS libnet_join_unjoindomain_rpc(TALLOC_CTX *mem_ctx,
                                             struct libnet_UnjoinCtx *r)
 {
@@ -344,6 +776,9 @@ done:
        return status;
 }
 
+/****************************************************************
+****************************************************************/
+
 static WERROR do_join_modify_vals_config(struct libnet_JoinCtx *r)
 {
        WERROR werr;
@@ -382,6 +817,9 @@ static WERROR do_join_modify_vals_config(struct libnet_JoinCtx *r)
        return werr;
 }
 
+/****************************************************************
+****************************************************************/
+
 static WERROR do_unjoin_modify_vals_config(struct libnet_UnjoinCtx *r)
 {
        WERROR werr = WERR_OK;
@@ -397,6 +835,8 @@ static WERROR do_unjoin_modify_vals_config(struct libnet_UnjoinCtx *r)
        return werr;
 }
 
+/****************************************************************
+****************************************************************/
 
 static WERROR do_JoinConfig(struct libnet_JoinCtx *r)
 {
@@ -421,6 +861,9 @@ static WERROR do_JoinConfig(struct libnet_JoinCtx *r)
        return werr;
 }
 
+/****************************************************************
+****************************************************************/
+
 static WERROR do_UnjoinConfig(struct libnet_UnjoinCtx *r)
 {
        WERROR werr;
@@ -444,6 +887,33 @@ static WERROR do_UnjoinConfig(struct libnet_UnjoinCtx *r)
        return werr;
 }
 
+/****************************************************************
+****************************************************************/
+
+static int libnet_destroy_JoinCtx(struct libnet_JoinCtx *r)
+{
+       if (r->in.ads) {
+               ads_destroy(&r->in.ads);
+       }
+
+       return 0;
+}
+
+/****************************************************************
+****************************************************************/
+
+static int libnet_destroy_UnjoinCtx(struct libnet_UnjoinCtx *r)
+{
+       if (r->in.ads) {
+               ads_destroy(&r->in.ads);
+       }
+
+       return 0;
+}
+
+/****************************************************************
+****************************************************************/
+
 WERROR libnet_init_JoinCtx(TALLOC_CTX *mem_ctx,
                           struct libnet_JoinCtx **r)
 {
@@ -454,11 +924,19 @@ WERROR libnet_init_JoinCtx(TALLOC_CTX *mem_ctx,
                return WERR_NOMEM;
        }
 
+       talloc_set_destructor(ctx, libnet_destroy_JoinCtx);
+
+       ctx->in.machine_name = talloc_strdup(mem_ctx, global_myname());
+       W_ERROR_HAVE_NO_MEMORY(ctx->in.machine_name);
+
        *r = ctx;
 
        return WERR_OK;
 }
 
+/****************************************************************
+****************************************************************/
+
 WERROR libnet_init_UnjoinCtx(TALLOC_CTX *mem_ctx,
                             struct libnet_UnjoinCtx **r)
 {
@@ -469,16 +947,96 @@ WERROR libnet_init_UnjoinCtx(TALLOC_CTX *mem_ctx,
                return WERR_NOMEM;
        }
 
+       talloc_set_destructor(ctx, libnet_destroy_UnjoinCtx);
+
+       ctx->in.machine_name = talloc_strdup(mem_ctx, global_myname());
+       W_ERROR_HAVE_NO_MEMORY(ctx->in.machine_name);
+
        *r = ctx;
 
        return WERR_OK;
 }
 
+/****************************************************************
+****************************************************************/
+
+static WERROR libnet_DomainJoin(TALLOC_CTX *mem_ctx,
+                               struct libnet_JoinCtx *r)
+{
+       NTSTATUS status;
+#ifdef HAVE_LDAP
+       ADS_STATUS ads_status;
+
+       if (r->in.account_ou) {
+               ads_status = libnet_join_connect_ads(mem_ctx, r);
+               if (!ADS_ERR_OK(ads_status)) {
+                       return WERR_GENERAL_FAILURE;
+               }
+               ads_status = libnet_join_precreate_machine_acct(mem_ctx, r);
+               if (!ADS_ERR_OK(ads_status)) {
+                       libnet_join_set_error_string(mem_ctx, r,
+                               "failed to precreate account in ou %s: %s\n",
+                               r->in.account_ou,
+                               ads_errstr(ads_status));
+                       return WERR_GENERAL_FAILURE;
+               }
+
+               r->in.join_flags &= ~WKSSVC_JOIN_FLAGS_ACCOUNT_CREATE;
+       }
+#endif
+       status = libnet_join_joindomain_rpc(mem_ctx, r);
+       if (!NT_STATUS_IS_OK(status)) {
+               if (NT_STATUS_EQUAL(status, NT_STATUS_USER_EXISTS)) {
+                       return WERR_SETUP_ALREADY_JOINED;
+               }
+               return ntstatus_to_werror(status);
+       }
+
+       if (!libnet_join_joindomain_store_secrets(mem_ctx, r)) {
+               return WERR_SETUP_NOT_JOINED;
+       }
+
+#ifdef HAVE_LDAP
+       ads_status = libnet_join_set_machine_spn(mem_ctx, r);
+       if (!ADS_ERR_OK(ads_status)) {
+               libnet_join_set_error_string(mem_ctx, r,
+                       "failed to set machine spn: %s\n",
+                       ads_errstr(ads_status));
+               return WERR_GENERAL_FAILURE;
+       }
+
+       ads_status = libnet_join_set_os_attributes(mem_ctx, r);
+       if (!ADS_ERR_OK(ads_status)) {
+               libnet_join_set_error_string(mem_ctx, r,
+                       "failed to set machine os attributes: %s\n",
+                       ads_errstr(ads_status));
+               return WERR_GENERAL_FAILURE;
+       }
+
+       ads_status = libnet_join_set_machine_upn(mem_ctx, r);
+       if (!ADS_ERR_OK(ads_status)) {
+               libnet_join_set_error_string(mem_ctx, r,
+                       "failed to set machine upn: %s\n",
+                       ads_errstr(ads_status));
+               return WERR_GENERAL_FAILURE;
+       }
+#endif
+       if (!libnet_join_create_keytab(mem_ctx, r)) {
+               libnet_join_set_error_string(mem_ctx, r,
+                       "failed to create kerberos keytab\n");
+               return WERR_GENERAL_FAILURE;
+       }
+
+       return WERR_OK;
+}
+
+/****************************************************************
+****************************************************************/
+
 WERROR libnet_Join(TALLOC_CTX *mem_ctx,
                   struct libnet_JoinCtx *r)
 {
        WERROR werr;
-       NTSTATUS status;
 
        if (!r->in.domain_name) {
                return WERR_INVALID_PARAM;
@@ -493,17 +1051,9 @@ WERROR libnet_Join(TALLOC_CTX *mem_ctx,
        }
 
        if (r->in.join_flags & WKSSVC_JOIN_FLAGS_JOIN_TYPE) {
-
-               status = libnet_join_joindomain_rpc(mem_ctx, r);
-               if (!NT_STATUS_IS_OK(status)) {
-                       if (NT_STATUS_EQUAL(status, NT_STATUS_USER_EXISTS)) {
-                               return WERR_SETUP_ALREADY_JOINED;
-                       }
-                       return ntstatus_to_werror(status);
-               }
-
-               if (!libnet_join_joindomain_store_secrets(mem_ctx, r)) {
-                       return WERR_SETUP_NOT_JOINED;
+               werr = libnet_DomainJoin(mem_ctx, r);
+               if (!W_ERROR_IS_OK(werr)) {
+                       return werr;
                }
        }
 
@@ -515,27 +1065,60 @@ WERROR libnet_Join(TALLOC_CTX *mem_ctx,
        return werr;
 }
 
+/****************************************************************
+****************************************************************/
+
+static WERROR libnet_DomainUnjoin(TALLOC_CTX *mem_ctx,
+                                 struct libnet_UnjoinCtx *r)
+{
+       NTSTATUS status;
+
+       status = libnet_join_unjoindomain_rpc(mem_ctx, r);
+       if (!NT_STATUS_IS_OK(status)) {
+               libnet_unjoin_set_error_string(mem_ctx, r,
+                       "failed to unjoin domain: %s\n",
+                       nt_errstr(status));
+               if (NT_STATUS_EQUAL(status, NT_STATUS_NO_SUCH_USER)) {
+                       return WERR_SETUP_NOT_JOINED;
+               }
+               return ntstatus_to_werror(status);
+       }
+
+#ifdef HAVE_LDAP
+       if (r->in.unjoin_flags & WKSSVC_JOIN_FLAGS_ACCOUNT_DELETE) {
+               ADS_STATUS ads_status;
+               libnet_unjoin_connect_ads(mem_ctx, r);
+               ads_status = libnet_unjoin_remove_machine_acct(mem_ctx, r);
+               if (!ADS_ERR_OK(ads_status)) {
+                       libnet_unjoin_set_error_string(mem_ctx, r,
+                               "failed to remove machine account from AD: %s\n",
+                               ads_errstr(ads_status));
+               }
+       }
+#endif
+       libnet_join_unjoindomain_remove_secrets(mem_ctx, r);
+
+       return WERR_OK;
+}
+
+/****************************************************************
+****************************************************************/
+
 WERROR libnet_Unjoin(TALLOC_CTX *mem_ctx,
                     struct libnet_UnjoinCtx *r)
 {
        WERROR werr;
-       NTSTATUS status;
 
        if (r->in.modify_config && !lp_include_registry_globals()) {
                return WERR_NOT_SUPPORTED;
        }
 
        if (r->in.unjoin_flags & WKSSVC_JOIN_FLAGS_JOIN_TYPE) {
-
-               status = libnet_join_unjoindomain_rpc(mem_ctx, r);
-               if (!NT_STATUS_IS_OK(status)) {
-                       if (NT_STATUS_EQUAL(status, NT_STATUS_NO_SUCH_USER)) {
-                               return WERR_SETUP_NOT_JOINED;
-                       }
-                       return ntstatus_to_werror(status);
+               werr = libnet_DomainUnjoin(mem_ctx, r);
+               if (!W_ERROR_IS_OK(werr)) {
+                       do_UnjoinConfig(r);
+                       return werr;
                }
-
-               libnet_join_unjoindomain_remove_secrets(mem_ctx, r);
        }
 
        werr = do_UnjoinConfig(r);
index 9e7b8a9813bf022c9cabb0dd18f34b760b5e7f26..c6a0cd183cfc35cad6069a85bfde2a586361f5f6 100644 (file)
@@ -31,9 +31,11 @@ struct libnet_JoinCtx {
                const char *machine_password;
                uint32_t join_flags;
                const char *os_version;
-               const char *os_string;
+               const char *os_name;
+               bool create_upn;
                const char *upn;
                bool modify_config;
+               struct ads_struct *ads;
        } in;
 
        struct {
@@ -44,23 +46,27 @@ struct libnet_JoinCtx {
                struct dom_sid *domain_sid;
                bool modified_config;
                WERROR result;
+               char *error_string;
        } out;
 };
 
 struct libnet_UnjoinCtx {
        struct {
                const char *dc_name;
+               const char *machine_name;
                const char *domain_name;
                const char *admin_account;
                const char *admin_password;
                uint32_t unjoin_flags;
                bool modify_config;
                struct dom_sid *domain_sid;
+               struct ads_struct *ads;
        } in;
 
        struct {
                bool modified_config;
                WERROR result;
+               char *error_string;
        } out;
 };
 
index f8089cbd6a579691d5c7207efd154972ec8a32b0..fa6cbe146f68df85a2576c0e537f6457bd89674a 100644 (file)
@@ -4,7 +4,7 @@
    DsGetDcname
 
    Copyright (C) Gerald Carter 2006
-   Copyright (C) Guenther Deschner 2007
+   Copyright (C) Guenther Deschner 2007-2008
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -891,28 +891,72 @@ static NTSTATUS DsGetDcName_rediscover(TALLOC_CTX *mem_ctx,
 }
 
 /********************************************************************
- DsGetDcName.
+********************************************************************/
 
- This will be the only public function here.
+NTSTATUS DsGetDcName_remote(TALLOC_CTX *mem_ctx,
+                           const char *computer_name,
+                           const char *domain_name,
+                           struct GUID *domain_guid,
+                           const char *site_name,
+                           uint32_t flags,
+                           struct DS_DOMAIN_CONTROLLER_INFO **info)
+{
+       WERROR werr;
+       NTSTATUS status = NT_STATUS_DOMAIN_CONTROLLER_NOT_FOUND;
+       struct cli_state *cli = NULL;
+       struct rpc_pipe_client *pipe_cli = NULL;
+
+       status = cli_full_connection(&cli, NULL, computer_name,
+                                    NULL, 0,
+                                    "IPC$", "IPC",
+                                    "",
+                                    "",
+                                    "",
+                                    0, Undefined, NULL);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               goto done;
+       }
+
+       pipe_cli = cli_rpc_pipe_open_noauth(cli, PI_NETLOGON,
+                                           &status);
+       if (!pipe_cli) {
+               goto done;
+       }
+
+       werr = rpccli_netlogon_dsr_getdcname(pipe_cli,
+                                            mem_ctx,
+                                            computer_name,
+                                            domain_name,
+                                            domain_guid,
+                                            NULL,
+                                            flags,
+                                            info);
+       status = werror_to_ntstatus(werr);
+
+ done:
+       cli_rpc_pipe_close(pipe_cli);
+       if (cli) {
+               cli_shutdown(cli);
+       }
+
+       return status;
+}
+
+/********************************************************************
 ********************************************************************/
 
-NTSTATUS DsGetDcName(TALLOC_CTX *mem_ctx,
-                    const char *computer_name,
-                    const char *domain_name,
-                    struct GUID *domain_guid,
-                    const char *site_name,
-                    uint32_t flags,
-                    struct DS_DOMAIN_CONTROLLER_INFO **info)
+NTSTATUS DsGetDcName_local(TALLOC_CTX *mem_ctx,
+                          const char *computer_name,
+                          const char *domain_name,
+                          struct GUID *domain_guid,
+                          const char *site_name,
+                          uint32_t flags,
+                          struct DS_DOMAIN_CONTROLLER_INFO **info)
 {
        NTSTATUS status = NT_STATUS_DOMAIN_CONTROLLER_NOT_FOUND;
        struct DS_DOMAIN_CONTROLLER_INFO *myinfo = NULL;
 
-       DEBUG(10,("DsGetDcName: computer_name: %s, domain_name: %s, "
-                 "domain_guid: %s, site_name: %s, flags: 0x%08x\n",
-                 computer_name, domain_name,
-                 domain_guid ? GUID_string(mem_ctx, domain_guid) : "(null)",
-                 site_name, flags));
-
        *info = NULL;
 
        if (!check_allowed_required_flags(flags)) {
@@ -947,3 +991,44 @@ NTSTATUS DsGetDcName(TALLOC_CTX *mem_ctx,
 
        return status;
 }
+
+/********************************************************************
+ DsGetDcName.
+
+ This will be the only public function here.
+********************************************************************/
+
+NTSTATUS DsGetDcName(TALLOC_CTX *mem_ctx,
+                    const char *computer_name,
+                    const char *domain_name,
+                    struct GUID *domain_guid,
+                    const char *site_name,
+                    uint32_t flags,
+                    struct DS_DOMAIN_CONTROLLER_INFO **info)
+{
+       DEBUG(10,("DsGetDcName: computer_name: %s, domain_name: %s, "
+                 "domain_guid: %s, site_name: %s, flags: 0x%08x\n",
+                 computer_name, domain_name,
+                 domain_guid ? GUID_string(mem_ctx, domain_guid) : "(null)",
+                 site_name, flags));
+
+       *info = NULL;
+
+       if (computer_name) {
+               return DsGetDcName_remote(mem_ctx,
+                                         computer_name,
+                                         domain_name,
+                                         domain_guid,
+                                         site_name,
+                                         flags,
+                                         info);
+       }
+
+       return DsGetDcName_local(mem_ctx,
+                                computer_name,
+                                domain_name,
+                                domain_guid,
+                                site_name,
+                                flags,
+                                info);
+}
index 270c6d22610a092ed8d6e087da429c795790c25c..2ec8cd29386d404cc8dc426ab065951c8caa3d8b 100644 (file)
@@ -585,22 +585,14 @@ static bool parse_share_modes(TDB_DATA dbuf, struct share_mode_lock *lck)
        }
 
        /* Save off the associated service path and filename. */
-       lck->servicepath = talloc_strdup(lck, (const char *)dbuf.dptr + sizeof(*data) +
-                                       (lck->num_share_modes *
-                                       sizeof(struct share_mode_entry)) +
-                                       data->u.s.delete_token_size );
-       if (lck->servicepath == NULL) {
-               smb_panic("parse_share_modes: talloc_strdup failed");
-       }
-
-       lck->filename = talloc_strdup(lck, (const char *)dbuf.dptr + sizeof(*data) +
-                                       (lck->num_share_modes *
-                                       sizeof(struct share_mode_entry)) +
-                                       data->u.s.delete_token_size +
-                                       strlen(lck->servicepath) + 1 );
-       if (lck->filename == NULL) {
-               smb_panic("parse_share_modes: talloc_strdup failed");
-       }
+       lck->servicepath = (const char *)dbuf.dptr + sizeof(*data) +
+               (lck->num_share_modes * sizeof(struct share_mode_entry)) +
+               data->u.s.delete_token_size;
+
+       lck->filename = (const char *)dbuf.dptr + sizeof(*data) +
+               (lck->num_share_modes * sizeof(struct share_mode_entry)) +
+               data->u.s.delete_token_size +
+               strlen(lck->servicepath) + 1;
 
        /*
         * Ensure that each entry has a real process attached.
index 207ee57ce1caa06d40c828aa093b5f8d84641bb6..1b88c472b0ea9492d7342f30ef0154077f8fcfc7 100644 (file)
@@ -188,7 +188,7 @@ static bool posix_fcntl_lock(files_struct *fsp, int op, SMB_OFF_T offset, SMB_OF
 
        DEBUG(8,("posix_fcntl_lock %d %d %.0f %.0f %d\n",fsp->fh->fd,op,(double)offset,(double)count,type));
 
-       ret = SMB_VFS_LOCK(fsp,fsp->fh->fd,op,offset,count,type);
+       ret = SMB_VFS_LOCK(fsp, op, offset, count, type);
 
        if (!ret && ((errno == EFBIG) || (errno == ENOLCK) || (errno ==  EINVAL))) {
 
@@ -212,7 +212,7 @@ static bool posix_fcntl_lock(files_struct *fsp, int op, SMB_OFF_T offset, SMB_OF
                        DEBUG(0,("Count greater than 31 bits - retrying with 31 bit truncated length.\n"));
                        errno = 0;
                        count &= 0x7fffffff;
-                       ret = SMB_VFS_LOCK(fsp,fsp->fh->fd,op,offset,count,type);
+                       ret = SMB_VFS_LOCK(fsp, op, offset, count, type);
                }
        }
 
@@ -233,7 +233,7 @@ static bool posix_fcntl_getlock(files_struct *fsp, SMB_OFF_T *poffset, SMB_OFF_T
        DEBUG(8,("posix_fcntl_getlock %d %.0f %.0f %d\n",
                fsp->fh->fd,(double)*poffset,(double)*pcount,*ptype));
 
-       ret = SMB_VFS_GETLOCK(fsp,fsp->fh->fd,poffset,pcount,ptype,&pid);
+       ret = SMB_VFS_GETLOCK(fsp, poffset, pcount, ptype, &pid);
 
        if (!ret && ((errno == EFBIG) || (errno == ENOLCK) || (errno ==  EINVAL))) {
 
@@ -257,7 +257,7 @@ static bool posix_fcntl_getlock(files_struct *fsp, SMB_OFF_T *poffset, SMB_OFF_T
                        DEBUG(0,("Count greater than 31 bits - retrying with 31 bit truncated length.\n"));
                        errno = 0;
                        *pcount &= 0x7fffffff;
-                       ret = SMB_VFS_GETLOCK(fsp,fsp->fh->fd,poffset,pcount,ptype,&pid);
+                       ret = SMB_VFS_GETLOCK(fsp,poffset,pcount,ptype,&pid);
                }
        }
 
index 6d2972d8ed91d9e547d688cfa9305070ba5f7347..52d3983fff7ee43239b5742b16fe98dfe67ede78 100644 (file)
@@ -185,7 +185,7 @@ static int smbacl4_fGetFileOwner(files_struct *fsp, SMB_STRUCT_STAT *psbuf)
        if (fsp->is_directory || fsp->fh->fd == -1) {
                return smbacl4_GetFileOwner(fsp->conn, fsp->fsp_name, psbuf);
        }
-       if (SMB_VFS_FSTAT(fsp,fsp->fh->fd, psbuf) != 0)
+       if (SMB_VFS_FSTAT(fsp, psbuf) != 0)
        {
                DEBUG(8, ("SMB_VFS_FSTAT failed with error %s\n",
                        strerror(errno)));
index a14a1172298cd21d69ca5a103b4e91952e41c0e8..e35bfabb8c7a8df88b33c4d152c814989b42eabc 100644 (file)
@@ -684,7 +684,7 @@ static size_t afs_fto_nt_acl(struct afs_acl *afs_acl,
                                     security_info, ppdesc);
        }
 
-       if(SMB_VFS_FSTAT(fsp,fsp->fh->fd,&sbuf) != 0) {
+       if(SMB_VFS_FSTAT(fsp, &sbuf) != 0) {
                return 0;
        }
 
@@ -993,7 +993,7 @@ static NTSTATUS afs_set_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
 
 static NTSTATUS afsacl_fget_nt_acl(struct vfs_handle_struct *handle,
                                   struct files_struct *fsp,
-                                  int fd,  uint32 security_info,
+                                  uint32 security_info,
                                   struct security_descriptor **ppdesc)
 {
        struct afs_acl acl;
@@ -1039,7 +1039,7 @@ static NTSTATUS afsacl_get_nt_acl(struct vfs_handle_struct *handle,
 
 NTSTATUS afsacl_fset_nt_acl(vfs_handle_struct *handle,
                         files_struct *fsp,
-                        int fd, uint32 security_info_sent,
+                        uint32 security_info_sent,
                         SEC_DESC *psd)
 {
        return afs_set_nt_acl(handle, fsp, security_info_sent, psd);
index a60470ffc9528537f98c91c0b7e51ff1cc95e747..726a7f485e84e7218d93f153d431c182b68f2fb8 100644 (file)
@@ -80,8 +80,7 @@ SMB_ACL_T aixacl_sys_acl_get_file(vfs_handle_struct *handle,
 }
 
 SMB_ACL_T aixacl_sys_acl_get_fd(vfs_handle_struct *handle,
-                                 files_struct *fsp,
-                                 int fd)
+                               files_struct *fsp)
 {
 
        struct acl *file_acl = (struct acl *)NULL;
@@ -93,7 +92,7 @@ SMB_ACL_T aixacl_sys_acl_get_fd(vfs_handle_struct *handle,
        /* Get the acl using fstatacl */
    
        DEBUG(10,("Entering AIX sys_acl_get_fd\n"));
-       DEBUG(10,("fd is %d\n",fd));
+       DEBUG(10,("fd is %d\n",fsp->fh->fd));
        file_acl = (struct acl *)SMB_MALLOC(BUFSIZ);
 
        if(file_acl == NULL) {
@@ -104,7 +103,7 @@ SMB_ACL_T aixacl_sys_acl_get_fd(vfs_handle_struct *handle,
 
        memset(file_acl,0,BUFSIZ);
 
-       rc = fstatacl(fd,0,file_acl,BUFSIZ);
+       rc = fstatacl(fsp->fh->fd,0,file_acl,BUFSIZ);
        if( (rc == -1) && (errno == ENOSPC)) {
                struct acl *new_acl = SMB_MALLOC(file_acl->acl_len + sizeof(struct acl));
                if( new_acl == NULL) {
@@ -113,7 +112,7 @@ SMB_ACL_T aixacl_sys_acl_get_fd(vfs_handle_struct *handle,
                        return NULL;
                }
                file_acl = new_acl;
-               rc = fstatacl(fd,0,file_acl,file_acl->acl_len + sizeof(struct acl));
+               rc = fstatacl(fsp->fh->fd,0,file_acl,file_acl->acl_len + sizeof(struct acl));
                if( rc == -1) {
                        DEBUG(0,("fstatacl returned %d with errno %d\n",rc,errno));
                        SAFE_FREE(file_acl);
@@ -154,7 +153,7 @@ int aixacl_sys_acl_set_file(vfs_handle_struct *handle,
 
 int aixacl_sys_acl_set_fd(vfs_handle_struct *handle,
                            files_struct *fsp,
-                           int fd, SMB_ACL_T theacl)
+                           SMB_ACL_T theacl)
 {
        struct acl *file_acl = NULL;
        unsigned int rc;
@@ -163,7 +162,7 @@ int aixacl_sys_acl_set_fd(vfs_handle_struct *handle,
        if (!file_acl)
                return -1;
 
-       rc = fchacl(fd,file_acl,file_acl->acl_len);
+       rc = fchacl(fsp->fh->fd,file_acl,file_acl->acl_len);
        DEBUG(10,("errno is %d\n",errno));
        DEBUG(10,("return code is %d\n",rc));
        SAFE_FREE(file_acl);
index d28efa55c6568a371f795b3901576f63ee11e436..996adbbdfe3b2c185776b7ad1da5a5987fc9ce6e 100644 (file)
@@ -159,7 +159,7 @@ static bool aixjfs2_get_nfs4_acl(const char *name,
 }
 
 static NTSTATUS aixjfs2_fget_nt_acl(vfs_handle_struct *handle,
-       files_struct *fsp, int fd, uint32 security_info,
+       files_struct *fsp, uint32 security_info,
        SEC_DESC **ppdesc)
 {
        SMB4ACL_T *pacl = NULL;
@@ -258,8 +258,7 @@ SMB_ACL_T aixjfs2_sys_acl_get_file(vfs_handle_struct *handle,
 }
 
 SMB_ACL_T aixjfs2_sys_acl_get_fd(vfs_handle_struct *handle,
-                                  files_struct *fsp,
-                                  int fd)
+                                  files_struct *fsp)
 {
         acl_type_t aixjfs2_type;
         aixjfs2_type.u64 = ACL_AIXC;
@@ -399,7 +398,7 @@ static NTSTATUS aixjfs2_set_nt_acl_common(files_struct *fsp, uint32 security_inf
        return result;
 }
 
-NTSTATUS aixjfs2_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp, int fd, uint32 security_info_sent, SEC_DESC *psd)
+NTSTATUS aixjfs2_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp, uint32 security_info_sent, SEC_DESC *psd)
 {
        return aixjfs2_set_nt_acl_common(fsp, security_info_sent, psd);
 }
@@ -449,7 +448,7 @@ int aixjfs2_sys_acl_set_file(vfs_handle_struct *handle,
 
 int aixjfs2_sys_acl_set_fd(vfs_handle_struct *handle,
                            files_struct *fsp,
-                           int fd, SMB_ACL_T theacl)
+                           SMB_ACL_T theacl)
 {
        struct acl      *acl_aixc;
        acl_type_t      acl_type_info;
@@ -468,7 +467,7 @@ int aixjfs2_sys_acl_set_fd(vfs_handle_struct *handle,
                return -1;
 
        rc = aclx_fput(
-               fd,
+               fsp->fh->fd,
                SET_ACL, /* set only the ACL, not mode bits */
                acl_type_info,
                acl_aixc,
index 91993a47d72119b1382f318c153469e63b0bd6e1..a63bf4f67261e50ed551c439ec4748d98ada45d2 100644 (file)
@@ -39,8 +39,8 @@ static int audit_rename(vfs_handle_struct *handle, const char *oldname, const ch
 static int audit_unlink(vfs_handle_struct *handle, const char *path);
 static int audit_chmod(vfs_handle_struct *handle, const char *path, mode_t mode);
 static int audit_chmod_acl(vfs_handle_struct *handle, const char *name, mode_t mode);
-static int audit_fchmod(vfs_handle_struct *handle, files_struct *fsp, int fd, mode_t mode);
-static int audit_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp, int fd, mode_t mode);
+static int audit_fchmod(vfs_handle_struct *handle, files_struct *fsp, mode_t mode);
+static int audit_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp, mode_t mode);
 
 /* VFS operations */
 
@@ -268,11 +268,11 @@ static int audit_chmod_acl(vfs_handle_struct *handle, const char *path, mode_t m
        return result;
 }
 
-static int audit_fchmod(vfs_handle_struct *handle, files_struct *fsp, int fd, mode_t mode)
+static int audit_fchmod(vfs_handle_struct *handle, files_struct *fsp, mode_t mode)
 {
        int result;
 
-       result = SMB_VFS_NEXT_FCHMOD(handle, fsp, fd, mode);
+       result = SMB_VFS_NEXT_FCHMOD(handle, fsp, mode);
 
        syslog(audit_syslog_priority(handle), "fchmod %s mode 0x%x %s%s\n",
               fsp->fsp_name, mode,
@@ -282,11 +282,11 @@ static int audit_fchmod(vfs_handle_struct *handle, files_struct *fsp, int fd, mo
        return result;
 }
 
-static int audit_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp, int fd, mode_t mode)
+static int audit_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp, mode_t mode)
 {
        int result;
 
-       result = SMB_VFS_NEXT_FCHMOD_ACL(handle, fsp, fd, mode);
+       result = SMB_VFS_NEXT_FCHMOD_ACL(handle, fsp, mode);
 
        syslog(audit_syslog_priority(handle), "fchmod_acl %s mode 0x%x %s%s\n",
               fsp->fsp_name, mode,
index 9574087d9d3a5307fb413d0d176d339198c3effd..6eb74e66edd8a547a42407109d19f93f929cdfc3 100644 (file)
@@ -160,16 +160,15 @@ static ssize_t cprime_read(
 static ssize_t cprime_pread(
                 vfs_handle_struct * handle,
                 files_struct *      fsp,
-                int                 fd,
                 void *              data,
                        size_t              count,
                 SMB_OFF_T           offset)
 {
         if (g_readbuf) {
-                prime_cache(handle, fsp, fd, offset, count);
+                prime_cache(handle, fsp, fsp->fh->fd, offset, count);
         }
 
-        return SMB_VFS_NEXT_PREAD(handle, fsp, fd, data, count, offset);
+        return SMB_VFS_NEXT_PREAD(handle, fsp, data, count, offset);
 }
 
 static vfs_op_tuple cprime_ops [] =
index f99891cb329ee62687d71003622f2ebc1f6494ee..2f2d6a718264aca27aacccf7f173125663a17e53 100644 (file)
@@ -363,7 +363,7 @@ size)
         return SMB_VFS_NEXT_LGETXATTR(handle, cappath, capname, value, size);
 }
 
-static ssize_t cap_fgetxattr(vfs_handle_struct *handle, struct files_struct *fsp,int fd, const char *path, void *value, size_t size)
+static ssize_t cap_fgetxattr(vfs_handle_struct *handle, struct files_struct *fsp, const char *path, void *value, size_t size)
 {
        char *cappath = capencode(talloc_tos(), path);
 
@@ -371,7 +371,7 @@ static ssize_t cap_fgetxattr(vfs_handle_struct *handle, struct files_struct *fsp
                errno = ENOMEM;
                return -1;
        }
-        return SMB_VFS_NEXT_FGETXATTR(handle, fsp, fd, cappath, value, size);
+        return SMB_VFS_NEXT_FGETXATTR(handle, fsp, cappath, value, size);
 }
 
 static ssize_t cap_listxattr(vfs_handle_struct *handle, const char *path, char *list, size_t size)
@@ -420,7 +420,7 @@ static int cap_lremovexattr(vfs_handle_struct *handle, const char *path, const c
         return SMB_VFS_NEXT_LREMOVEXATTR(handle, cappath, capname);
 }
 
-static int cap_fremovexattr(vfs_handle_struct *handle, struct files_struct *fsp,int fd, const char *path)
+static int cap_fremovexattr(vfs_handle_struct *handle, struct files_struct *fsp, const char *path)
 {
        char *cappath = capencode(talloc_tos(), path);
 
@@ -428,7 +428,7 @@ static int cap_fremovexattr(vfs_handle_struct *handle, struct files_struct *fsp,
                errno = ENOMEM;
                return -1;
        }
-        return SMB_VFS_NEXT_FREMOVEXATTR(handle, fsp, fd, cappath);
+        return SMB_VFS_NEXT_FREMOVEXATTR(handle, fsp, cappath);
 }
 
 static int cap_setxattr(vfs_handle_struct *handle, const char *path, const char *name, const void *value, size_t size, int flags)
@@ -455,7 +455,7 @@ static int cap_lsetxattr(vfs_handle_struct *handle, const char *path, const char
         return SMB_VFS_NEXT_LSETXATTR(handle, cappath, capname, value, size, flags);
 }
 
-static int cap_fsetxattr(vfs_handle_struct *handle, struct files_struct *fsp,int fd, const char *path, const void *value, size_t size, int flags)
+static int cap_fsetxattr(vfs_handle_struct *handle, struct files_struct *fsp, const char *path, const void *value, size_t size, int flags)
 {
        char *cappath = capencode(talloc_tos(), path);
 
@@ -463,7 +463,7 @@ static int cap_fsetxattr(vfs_handle_struct *handle, struct files_struct *fsp,int
                errno = ENOMEM;
                return -1;
        }
-        return SMB_VFS_NEXT_FSETXATTR(handle, fsp, fd, cappath, value, size, flags);
+        return SMB_VFS_NEXT_FSETXATTR(handle, fsp, cappath, value, size, flags);
 }
 
 /* VFS operations structure */
index d7d81924f1864e0b2003333dd84fa48ac3af3caf..fe7324122f7403499d47717e23c1584dbac9bd90 100644 (file)
@@ -217,7 +217,7 @@ static int commit_open(
         /* EOF commit modes require us to know the initial file size. */
         if (c && (c->on_eof != EOF_NONE)) {
                 SMB_STRUCT_STAT st;
-                if (SMB_VFS_FSTAT(fsp, fd, &st) == -1) {
+                if (SMB_VFS_FSTAT(fsp, &st) == -1) {
                         return -1;
                 }
                c->eof = st.st_size;
@@ -248,14 +248,13 @@ static ssize_t commit_write(
 static ssize_t commit_pwrite(
         vfs_handle_struct * handle,
         files_struct *      fsp,
-        int                 fd,
         void *              data,
         size_t              count,
        SMB_OFF_T           offset)
 {
         ssize_t ret;
 
-        ret = SMB_VFS_NEXT_PWRITE(handle, fsp, fd, data, count, offset);
+        ret = SMB_VFS_NEXT_PWRITE(handle, fsp, data, count, offset);
         if (ret > 0) {
                 if (commit(handle, fsp, offset, ret) == -1) {
                         return -1;
@@ -278,12 +277,11 @@ static int commit_close(
 static int commit_ftruncate(
         vfs_handle_struct * handle,
         files_struct *      fsp,
-        int                 fd,
         SMB_OFF_T           len)
 {
         int result;
 
-        result = SMB_VFS_NEXT_FTRUNCATE(handle, fsp, fd, len);
+        result = SMB_VFS_NEXT_FTRUNCATE(handle, fsp, len);
         if (result == 0) {
                struct commit_info *c;
                if ((c = VFS_FETCH_FSP_EXTENSION(handle, fsp))) {
index 17b183600a6bbb4fdf2fbcc2fba6face8b0592b0..97138bdacf041b3bc6317e347f9af433421a66cf 100644 (file)
@@ -218,19 +218,19 @@ static ssize_t vfswrap_read(vfs_handle_struct *handle, files_struct *fsp, int fd
        return result;
 }
 
-static ssize_t vfswrap_pread(vfs_handle_struct *handle, files_struct *fsp, int fd, void *data,
+static ssize_t vfswrap_pread(vfs_handle_struct *handle, files_struct *fsp, void *data,
                        size_t n, SMB_OFF_T offset)
 {
        ssize_t result;
 
 #if defined(HAVE_PREAD) || defined(HAVE_PREAD64)
        START_PROFILE_BYTES(syscall_pread, n);
-       result = sys_pread(fd, data, n, offset);
+       result = sys_pread(fsp->fh->fd, data, n, offset);
        END_PROFILE(syscall_pread);
 
        if (result == -1 && errno == ESPIPE) {
                /* Maintain the fiction that pipes can be seeked (sought?) on. */
-               result = SMB_VFS_READ(fsp, fd, data, n);
+               result = SMB_VFS_READ(fsp, fsp->fh->fd, data, n);
                fsp->fh->pos = 0;
        }
 
@@ -238,23 +238,23 @@ static ssize_t vfswrap_pread(vfs_handle_struct *handle, files_struct *fsp, int f
        SMB_OFF_T   curr;
        int lerrno;
 
-       curr = SMB_VFS_LSEEK(fsp, fd, 0, SEEK_CUR);
+       curr = SMB_VFS_LSEEK(fsp, 0, SEEK_CUR);
        if (curr == -1 && errno == ESPIPE) {
                /* Maintain the fiction that pipes can be seeked (sought?) on. */
-               result = SMB_VFS_READ(fsp, fd, data, n);
+               result = SMB_VFS_READ(fsp, fsp->fh->fd, data, n);
                fsp->fh->pos = 0;
                return result;
        }
 
-       if (SMB_VFS_LSEEK(fsp, fd, offset, SEEK_SET) == -1) {
+       if (SMB_VFS_LSEEK(fsp, offset, SEEK_SET) == -1) {
                return -1;
        }
 
        errno = 0;
-       result = SMB_VFS_READ(fsp, fd, data, n);
+       result = SMB_VFS_READ(fsp, fsp->fh->fd, data, n);
        lerrno = errno;
 
-       SMB_VFS_LSEEK(fsp, fd, curr, SEEK_SET);
+       SMB_VFS_LSEEK(fsp, curr, SEEK_SET);
        errno = lerrno;
 
 #endif /* HAVE_PREAD */
@@ -272,38 +272,38 @@ static ssize_t vfswrap_write(vfs_handle_struct *handle, files_struct *fsp, int f
        return result;
 }
 
-static ssize_t vfswrap_pwrite(vfs_handle_struct *handle, files_struct *fsp, int fd, const void *data,
+static ssize_t vfswrap_pwrite(vfs_handle_struct *handle, files_struct *fsp, const void *data,
                        size_t n, SMB_OFF_T offset)
 {
        ssize_t result;
 
 #if defined(HAVE_PWRITE) || defined(HAVE_PRWITE64)
        START_PROFILE_BYTES(syscall_pwrite, n);
-       result = sys_pwrite(fd, data, n, offset);
+       result = sys_pwrite(fsp->fh->fd, data, n, offset);
        END_PROFILE(syscall_pwrite);
 
        if (result == -1 && errno == ESPIPE) {
                /* Maintain the fiction that pipes can be sought on. */
-               result = SMB_VFS_WRITE(fsp, fd, data, n);
+               result = SMB_VFS_WRITE(fsp, fsp->fh->fd, data, n);
        }
 
 #else /* HAVE_PWRITE */
        SMB_OFF_T   curr;
        int         lerrno;
 
-       curr = SMB_VFS_LSEEK(fsp, fd, 0, SEEK_CUR);
+       curr = SMB_VFS_LSEEK(fsp, 0, SEEK_CUR);
        if (curr == -1) {
                return -1;
        }
 
-       if (SMB_VFS_LSEEK(fsp, fd, offset, SEEK_SET) == -1) {
+       if (SMB_VFS_LSEEK(fsp, offset, SEEK_SET) == -1) {
                return -1;
        }
 
-       result = SMB_VFS_WRITE(fsp, fd, data, n);
+       result = SMB_VFS_WRITE(fsp, fsp->fh->fd, data, n);
        lerrno = errno;
 
-       SMB_VFS_LSEEK(fsp, fd, curr, SEEK_SET);
+       SMB_VFS_LSEEK(fsp, curr, SEEK_SET);
        errno = lerrno;
 
 #endif /* HAVE_PWRITE */
@@ -311,15 +311,15 @@ static ssize_t vfswrap_pwrite(vfs_handle_struct *handle, files_struct *fsp, int
        return result;
 }
 
-static SMB_OFF_T vfswrap_lseek(vfs_handle_struct *handle, files_struct *fsp, int filedes, SMB_OFF_T offset, int whence)
+static SMB_OFF_T vfswrap_lseek(vfs_handle_struct *handle, files_struct *fsp, SMB_OFF_T offset, int whence)
 {
        SMB_OFF_T result = 0;
 
        START_PROFILE(syscall_lseek);
 
        /* Cope with 'stat' file opens. */
-       if (filedes != -1)
-               result = sys_lseek(filedes, offset, whence);
+       if (fsp->fh->fd != -1)
+               result = sys_lseek(fsp->fh->fd, offset, whence);
 
        /*
         * We want to maintain the fiction that we can seek
@@ -467,13 +467,13 @@ static int vfswrap_rename(vfs_handle_struct *handle,  const char *oldname, const
        return result;
 }
 
-static int vfswrap_fsync(vfs_handle_struct *handle, files_struct *fsp, int fd)
+static int vfswrap_fsync(vfs_handle_struct *handle, files_struct *fsp)
 {
 #ifdef HAVE_FSYNC
        int result;
 
        START_PROFILE(syscall_fsync);
-       result = fsync(fd);
+       result = fsync(fsp->fh->fd);
        END_PROFILE(syscall_fsync);
        return result;
 #else
@@ -491,12 +491,12 @@ static int vfswrap_stat(vfs_handle_struct *handle,  const char *fname, SMB_STRUC
        return result;
 }
 
-static int vfswrap_fstat(vfs_handle_struct *handle, files_struct *fsp, int fd, SMB_STRUCT_STAT *sbuf)
+static int vfswrap_fstat(vfs_handle_struct *handle, files_struct *fsp, SMB_STRUCT_STAT *sbuf)
 {
        int result;
 
        START_PROFILE(syscall_fstat);
-       result = sys_fstat(fd, sbuf);
+       result = sys_fstat(fsp->fh->fd, sbuf);
        END_PROFILE(syscall_fstat);
        return result;
 }
@@ -549,7 +549,7 @@ static int vfswrap_chmod(vfs_handle_struct *handle,  const char *path, mode_t mo
        return result;
 }
 
-static int vfswrap_fchmod(vfs_handle_struct *handle, files_struct *fsp, int fd, mode_t mode)
+static int vfswrap_fchmod(vfs_handle_struct *handle, files_struct *fsp, mode_t mode)
 {
        int result;
 
@@ -563,7 +563,7 @@ static int vfswrap_fchmod(vfs_handle_struct *handle, files_struct *fsp, int fd,
 
        {
                int saved_errno = errno; /* We might get ENOSYS */
-               if ((result = SMB_VFS_FCHMOD_ACL(fsp, fd, mode)) == 0) {
+               if ((result = SMB_VFS_FCHMOD_ACL(fsp, mode)) == 0) {
                        END_PROFILE(syscall_fchmod);
                        return result;
                }
@@ -572,7 +572,7 @@ static int vfswrap_fchmod(vfs_handle_struct *handle, files_struct *fsp, int fd,
        }
 
 #if defined(HAVE_FCHMOD)
-       result = fchmod(fd, mode);
+       result = fchmod(fsp->fh->fd, mode);
 #else
        result = -1;
        errno = ENOSYS;
@@ -592,13 +592,13 @@ static int vfswrap_chown(vfs_handle_struct *handle, const char *path, uid_t uid,
        return result;
 }
 
-static int vfswrap_fchown(vfs_handle_struct *handle, files_struct *fsp, int fd, uid_t uid, gid_t gid)
+static int vfswrap_fchown(vfs_handle_struct *handle, files_struct *fsp, uid_t uid, gid_t gid)
 {
 #ifdef HAVE_FCHOWN
        int result;
 
        START_PROFILE(syscall_fchown);
-       result = fchown(fd, uid, gid);
+       result = fchown(fsp->fh->fd, uid, gid);
        END_PROFILE(syscall_fchown);
        return result;
 #else
@@ -674,17 +674,17 @@ static int vfswrap_ntimes(vfs_handle_struct *handle, const char *path, const str
  allocate is set.
 **********************************************************************/
 
-static int strict_allocate_ftruncate(vfs_handle_struct *handle, files_struct *fsp, int fd, SMB_OFF_T len)
+static int strict_allocate_ftruncate(vfs_handle_struct *handle, files_struct *fsp, SMB_OFF_T len)
 {
        SMB_STRUCT_STAT st;
-       SMB_OFF_T currpos = SMB_VFS_LSEEK(fsp, fd, 0, SEEK_CUR);
+       SMB_OFF_T currpos = SMB_VFS_LSEEK(fsp, 0, SEEK_CUR);
        unsigned char zero_space[4096];
        SMB_OFF_T space_to_write;
 
        if (currpos == -1)
                return -1;
 
-       if (SMB_VFS_FSTAT(fsp, fd, &st) == -1)
+       if (SMB_VFS_FSTAT(fsp, &st) == -1)
                return -1;
 
        space_to_write = len - st.st_size;
@@ -699,10 +699,10 @@ static int strict_allocate_ftruncate(vfs_handle_struct *handle, files_struct *fs
 
        /* Shrink - just ftruncate. */
        if (st.st_size > len)
-               return sys_ftruncate(fd, len);
+               return sys_ftruncate(fsp->fh->fd, len);
 
        /* Write out the real space on disk. */
-       if (SMB_VFS_LSEEK(fsp, fd, st.st_size, SEEK_SET) != st.st_size)
+       if (SMB_VFS_LSEEK(fsp, st.st_size, SEEK_SET) != st.st_size)
                return -1;
 
        space_to_write = len - st.st_size;
@@ -720,13 +720,13 @@ static int strict_allocate_ftruncate(vfs_handle_struct *handle, files_struct *fs
        }
 
        /* Seek to where we were */
-       if (SMB_VFS_LSEEK(fsp, fd, currpos, SEEK_SET) != currpos)
+       if (SMB_VFS_LSEEK(fsp, currpos, SEEK_SET) != currpos)
                return -1;
 
        return 0;
 }
 
-static int vfswrap_ftruncate(vfs_handle_struct *handle, files_struct *fsp, int fd, SMB_OFF_T len)
+static int vfswrap_ftruncate(vfs_handle_struct *handle, files_struct *fsp, SMB_OFF_T len)
 {
        int result = -1;
        SMB_STRUCT_STAT st;
@@ -736,7 +736,7 @@ static int vfswrap_ftruncate(vfs_handle_struct *handle, files_struct *fsp, int f
        START_PROFILE(syscall_ftruncate);
 
        if (lp_strict_allocate(SNUM(fsp->conn))) {
-               result = strict_allocate_ftruncate(handle, fsp, fd, len);
+               result = strict_allocate_ftruncate(handle, fsp, len);
                END_PROFILE(syscall_ftruncate);
                return result;
        }
@@ -747,14 +747,14 @@ static int vfswrap_ftruncate(vfs_handle_struct *handle, files_struct *fsp, int f
           expansion and some that don't! On Linux fat can't do
           ftruncate extend but ext2 can. */
 
-       result = sys_ftruncate(fd, len);
+       result = sys_ftruncate(fsp->fh->fd, len);
        if (result == 0)
                goto done;
 
        /* According to W. R. Stevens advanced UNIX prog. Pure 4.3 BSD cannot
           extend a file with ftruncate. Provide alternate implementation
           for this */
-       currpos = SMB_VFS_LSEEK(fsp, fd, 0, SEEK_CUR);
+       currpos = SMB_VFS_LSEEK(fsp, 0, SEEK_CUR);
        if (currpos == -1) {
                goto done;
        }
@@ -763,7 +763,7 @@ static int vfswrap_ftruncate(vfs_handle_struct *handle, files_struct *fsp, int f
           size in which case the ftruncate above should have
           succeeded or shorter, in which case seek to len - 1 and
           write 1 byte of zero */
-       if (SMB_VFS_FSTAT(fsp, fd, &st) == -1) {
+       if (SMB_VFS_FSTAT(fsp, &st) == -1) {
                goto done;
        }
 
@@ -784,14 +784,14 @@ static int vfswrap_ftruncate(vfs_handle_struct *handle, files_struct *fsp, int f
                goto done;
        }
 
-       if (SMB_VFS_LSEEK(fsp, fd, len-1, SEEK_SET) != len -1)
+       if (SMB_VFS_LSEEK(fsp, len-1, SEEK_SET) != len -1)
                goto done;
 
-       if (SMB_VFS_WRITE(fsp, fd, &c, 1)!=1)
+       if (SMB_VFS_WRITE(fsp, fsp->fh->fd, &c, 1)!=1)
                goto done;
 
        /* Seek to where we were */
-       if (SMB_VFS_LSEEK(fsp, fd, currpos, SEEK_SET) != currpos)
+       if (SMB_VFS_LSEEK(fsp, currpos, SEEK_SET) != currpos)
                goto done;
        result = 0;
 
@@ -801,36 +801,36 @@ static int vfswrap_ftruncate(vfs_handle_struct *handle, files_struct *fsp, int f
        return result;
 }
 
-static bool vfswrap_lock(vfs_handle_struct *handle, files_struct *fsp, int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type)
+static bool vfswrap_lock(vfs_handle_struct *handle, files_struct *fsp, int op, SMB_OFF_T offset, SMB_OFF_T count, int type)
 {
        bool result;
 
        START_PROFILE(syscall_fcntl_lock);
-       result =  fcntl_lock(fd, op, offset, count, type);
+       result =  fcntl_lock(fsp->fh->fd, op, offset, count, type);
        END_PROFILE(syscall_fcntl_lock);
        return result;
 }
 
-static int vfswrap_kernel_flock(vfs_handle_struct *handle, files_struct *fsp, int fd,
+static int vfswrap_kernel_flock(vfs_handle_struct *handle, files_struct *fsp,
                                uint32 share_mode)
 {
        START_PROFILE(syscall_kernel_flock);
-       kernel_flock(fd, share_mode);
+       kernel_flock(fsp->fh->fd, share_mode);
        END_PROFILE(syscall_kernel_flock);
        return 0;
 }
 
-static bool vfswrap_getlock(vfs_handle_struct *handle, files_struct *fsp, int fd, SMB_OFF_T *poffset, SMB_OFF_T *pcount, int *ptype, pid_t *ppid)
+static bool vfswrap_getlock(vfs_handle_struct *handle, files_struct *fsp, SMB_OFF_T *poffset, SMB_OFF_T *pcount, int *ptype, pid_t *ppid)
 {
        bool result;
 
        START_PROFILE(syscall_fcntl_getlock);
-       result =  fcntl_getlock(fd, poffset, pcount, ptype, ppid);
+       result =  fcntl_getlock(fsp->fh->fd, poffset, pcount, ptype, ppid);
        END_PROFILE(syscall_fcntl_getlock);
        return result;
 }
 
-static int vfswrap_linux_setlease(vfs_handle_struct *handle, files_struct *fsp, int fd,
+static int vfswrap_linux_setlease(vfs_handle_struct *handle, files_struct *fsp,
                                int leasetype)
 {
        int result = -1;
@@ -839,11 +839,11 @@ static int vfswrap_linux_setlease(vfs_handle_struct *handle, files_struct *fsp,
 
 #ifdef HAVE_KERNEL_OPLOCKS_LINUX
        /* first set the signal handler */
-       if(linux_set_lease_sighandler(fd) == -1) {
+       if(linux_set_lease_sighandler(fsp->fh->fd) == -1) {
                return -1;
        }
 
-       result = linux_setlease(fd, leasetype);
+       result = linux_setlease(fsp->fh->fd, leasetype);
 #else
        errno = ENOSYS;
 #endif
@@ -944,7 +944,7 @@ static struct file_id vfswrap_file_id_create(struct vfs_handle_struct *handle, S
 }
 
 static NTSTATUS vfswrap_fget_nt_acl(vfs_handle_struct *handle,
-                                   files_struct *fsp, int fd,
+                                   files_struct *fsp,
                                    uint32 security_info, SEC_DESC **ppdesc)
 {
        NTSTATUS result;
@@ -967,7 +967,7 @@ static NTSTATUS vfswrap_get_nt_acl(vfs_handle_struct *handle,
        return result;
 }
 
-static NTSTATUS vfswrap_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp, int fd, uint32 security_info_sent, SEC_DESC *psd)
+static NTSTATUS vfswrap_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp, uint32 security_info_sent, SEC_DESC *psd)
 {
        NTSTATUS result;
 
@@ -1002,7 +1002,7 @@ static int vfswrap_chmod_acl(vfs_handle_struct *handle,  const char *name, mode_
 #endif
 }
 
-static int vfswrap_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp, int fd, mode_t mode)
+static int vfswrap_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp, mode_t mode)
 {
 #ifdef HAVE_NO_ACL
        errno = ENOSYS;
@@ -1011,7 +1011,7 @@ static int vfswrap_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp, int
        int result;
 
        START_PROFILE(fchmod_acl);
-       result = fchmod_acl(fsp, fd, mode);
+       result = fchmod_acl(fsp, mode);
        END_PROFILE(fchmod_acl);
        return result;
 #endif
@@ -1042,9 +1042,9 @@ static SMB_ACL_T vfswrap_sys_acl_get_file(vfs_handle_struct *handle,  const char
        return sys_acl_get_file(handle, path_p, type);
 }
 
-static SMB_ACL_T vfswrap_sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp, int fd)
+static SMB_ACL_T vfswrap_sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp)
 {
-       return sys_acl_get_fd(handle, fsp, fd);
+       return sys_acl_get_fd(handle, fsp);
 }
 
 static int vfswrap_sys_acl_clear_perms(vfs_handle_struct *handle,  SMB_ACL_PERMSET_T permset)
@@ -1097,9 +1097,9 @@ static int vfswrap_sys_acl_set_file(vfs_handle_struct *handle,  const char *name
        return sys_acl_set_file(handle, name, acltype, theacl);
 }
 
-static int vfswrap_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp, int fd, SMB_ACL_T theacl)
+static int vfswrap_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp, SMB_ACL_T theacl)
 {
-       return sys_acl_set_fd(handle, fsp, fd, theacl);
+       return sys_acl_set_fd(handle, fsp, theacl);
 }
 
 static int vfswrap_sys_acl_delete_def_file(vfs_handle_struct *handle,  const char *path)
@@ -1141,9 +1141,9 @@ static ssize_t vfswrap_lgetxattr(struct vfs_handle_struct *handle,const char *pa
        return sys_lgetxattr(path, name, value, size);
 }
 
-static ssize_t vfswrap_fgetxattr(struct vfs_handle_struct *handle, struct files_struct *fsp,int fd, const char *name, void *value, size_t size)
+static ssize_t vfswrap_fgetxattr(struct vfs_handle_struct *handle, struct files_struct *fsp, const char *name, void *value, size_t size)
 {
-       return sys_fgetxattr(fd, name, value, size);
+       return sys_fgetxattr(fsp->fh->fd, name, value, size);
 }
 
 static ssize_t vfswrap_listxattr(struct vfs_handle_struct *handle, const char *path, char *list, size_t size)
@@ -1156,9 +1156,9 @@ ssize_t vfswrap_llistxattr(struct vfs_handle_struct *handle, const char *path, c
        return sys_llistxattr(path, list, size);
 }
 
-ssize_t vfswrap_flistxattr(struct vfs_handle_struct *handle, struct files_struct *fsp,int fd, char *list, size_t size)
+ssize_t vfswrap_flistxattr(struct vfs_handle_struct *handle, struct files_struct *fsp, char *list, size_t size)
 {
-       return sys_flistxattr(fd, list, size);
+       return sys_flistxattr(fsp->fh->fd, list, size);
 }
 
 static int vfswrap_removexattr(struct vfs_handle_struct *handle, const char *path, const char *name)
@@ -1171,9 +1171,9 @@ static int vfswrap_lremovexattr(struct vfs_handle_struct *handle, const char *pa
        return sys_lremovexattr(path, name);
 }
 
-static int vfswrap_fremovexattr(struct vfs_handle_struct *handle, struct files_struct *fsp,int fd, const char *name)
+static int vfswrap_fremovexattr(struct vfs_handle_struct *handle, struct files_struct *fsp, const char *name)
 {
-       return sys_fremovexattr(fd, name);
+       return sys_fremovexattr(fsp->fh->fd, name);
 }
 
 static int vfswrap_setxattr(struct vfs_handle_struct *handle, const char *path, const char *name, const void *value, size_t size, int flags)
@@ -1186,9 +1186,9 @@ static int vfswrap_lsetxattr(struct vfs_handle_struct *handle, const char *path,
        return sys_lsetxattr(path, name, value, size, flags);
 }
 
-static int vfswrap_fsetxattr(struct vfs_handle_struct *handle, struct files_struct *fsp,int fd, const char *name, const void *value, size_t size, int flags)
+static int vfswrap_fsetxattr(struct vfs_handle_struct *handle, struct files_struct *fsp, const char *name, const void *value, size_t size, int flags)
 {
-       return sys_fsetxattr(fd, name, value, size, flags);
+       return sys_fsetxattr(fsp->fh->fd, name, value, size, flags);
 }
 
 static int vfswrap_aio_read(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb)
@@ -1206,9 +1206,9 @@ static ssize_t vfswrap_aio_return(struct vfs_handle_struct *handle, struct files
        return sys_aio_return(aiocb);
 }
 
-static int vfswrap_aio_cancel(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, SMB_STRUCT_AIOCB *aiocb)
+static int vfswrap_aio_cancel(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb)
 {
-       return sys_aio_cancel(fd, aiocb);
+       return sys_aio_cancel(fsp->fh->fd, aiocb);
 }
 
 static int vfswrap_aio_error(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb)
index 552c64016ea6445de62181f6ac5bdf119855b73a..a21e281e2ca6b09cd10f228837c81bc016a0a9a4 100644 (file)
@@ -42,8 +42,8 @@ static int audit_rename(vfs_handle_struct *handle, const char *oldname, const ch
 static int audit_unlink(vfs_handle_struct *handle, const char *path);
 static int audit_chmod(vfs_handle_struct *handle, const char *path, mode_t mode);
 static int audit_chmod_acl(vfs_handle_struct *handle, const char *name, mode_t mode);
-static int audit_fchmod(vfs_handle_struct *handle, files_struct *fsp, int fd, mode_t mode);
-static int audit_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp, int fd, mode_t mode);
+static int audit_fchmod(vfs_handle_struct *handle, files_struct *fsp, mode_t mode);
+static int audit_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp, mode_t mode);
 
 /* VFS operations */
 
@@ -310,11 +310,11 @@ static int audit_chmod_acl(vfs_handle_struct *handle, const char *path, mode_t m
        return result;
 }
 
-static int audit_fchmod(vfs_handle_struct *handle, files_struct *fsp, int fd, mode_t mode)
+static int audit_fchmod(vfs_handle_struct *handle, files_struct *fsp, mode_t mode)
 {
        int result;
        
-       result = SMB_VFS_NEXT_FCHMOD(handle, fsp, fd, mode);
+       result = SMB_VFS_NEXT_FCHMOD(handle, fsp, mode);
 
        syslog(audit_syslog_priority(handle), "fchmod %s mode 0x%x %s%s\n",
               fsp->fsp_name, mode,
@@ -328,11 +328,11 @@ static int audit_fchmod(vfs_handle_struct *handle, files_struct *fsp, int fd, mo
        return result;
 }
 
-static int audit_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp, int fd, mode_t mode)
+static int audit_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp, mode_t mode)
 {
        int result;
        
-       result = SMB_VFS_NEXT_FCHMOD_ACL(handle, fsp, fd, mode);
+       result = SMB_VFS_NEXT_FCHMOD_ACL(handle, fsp, mode);
 
        syslog(audit_syslog_priority(handle), "fchmod_acl %s mode 0x%x %s%s\n",
               fsp->fsp_name, mode,
index 8157f05d52eb4ce107aff238ce71e05ebcfc454e..ddad0008a7ef55d1a8a3763b5e9b19f3690dbac4 100644 (file)
@@ -46,11 +46,11 @@ static int fake_perms_stat(vfs_handle_struct *handle, const char *fname, SMB_STR
        return ret;
 }
 
-static int fake_perms_fstat(vfs_handle_struct *handle, files_struct *fsp, int fd, SMB_STRUCT_STAT *sbuf)
+static int fake_perms_fstat(vfs_handle_struct *handle, files_struct *fsp, SMB_STRUCT_STAT *sbuf)
 {
        int ret = -1;
 
-       ret = SMB_VFS_NEXT_FSTAT(handle, fsp, fd, sbuf);
+       ret = SMB_VFS_NEXT_FSTAT(handle, fsp, sbuf);
        if (ret == 0) {
                if (S_ISDIR(sbuf->st_mode)) {
                        sbuf->st_mode = S_IFDIR | S_IRWXU;
index f6b6e858374b75fe0fa22798a49ee799163caa8b..95fdc17d56109c83a2f71a7d70d57b80c795dc41 100644 (file)
@@ -115,14 +115,14 @@ static int smb_full_audit_close(vfs_handle_struct *handle, files_struct *fsp, in
 static ssize_t smb_full_audit_read(vfs_handle_struct *handle, files_struct *fsp,
                          int fd, void *data, size_t n);
 static ssize_t smb_full_audit_pread(vfs_handle_struct *handle, files_struct *fsp,
-                          int fd, void *data, size_t n, SMB_OFF_T offset);
+                          void *data, size_t n, SMB_OFF_T offset);
 static ssize_t smb_full_audit_write(vfs_handle_struct *handle, files_struct *fsp,
                           int fd, const void *data, size_t n);
 static ssize_t smb_full_audit_pwrite(vfs_handle_struct *handle, files_struct *fsp,
-                           int fd, const void *data, size_t n,
+                           const void *data, size_t n,
                            SMB_OFF_T offset);
 static SMB_OFF_T smb_full_audit_lseek(vfs_handle_struct *handle, files_struct *fsp,
-                            int filedes, SMB_OFF_T offset, int whence);
+                            SMB_OFF_T offset, int whence);
 static ssize_t smb_full_audit_sendfile(vfs_handle_struct *handle, int tofd,
                              files_struct *fsp, int fromfd,
                              const DATA_BLOB *hdr, SMB_OFF_T offset,
@@ -133,10 +133,10 @@ static ssize_t smb_full_audit_recvfile(vfs_handle_struct *handle, int fromfd,
                              size_t n);
 static int smb_full_audit_rename(vfs_handle_struct *handle,
                        const char *oldname, const char *newname);
-static int smb_full_audit_fsync(vfs_handle_struct *handle, files_struct *fsp, int fd);
+static int smb_full_audit_fsync(vfs_handle_struct *handle, files_struct *fsp);
 static int smb_full_audit_stat(vfs_handle_struct *handle,
                      const char *fname, SMB_STRUCT_STAT *sbuf);
-static int smb_full_audit_fstat(vfs_handle_struct *handle, files_struct *fsp, int fd,
+static int smb_full_audit_fstat(vfs_handle_struct *handle, files_struct *fsp,
                       SMB_STRUCT_STAT *sbuf);
 static int smb_full_audit_lstat(vfs_handle_struct *handle,
                       const char *path, SMB_STRUCT_STAT *sbuf);
@@ -144,11 +144,11 @@ static int smb_full_audit_unlink(vfs_handle_struct *handle,
                        const char *path);
 static int smb_full_audit_chmod(vfs_handle_struct *handle,
                       const char *path, mode_t mode);
-static int smb_full_audit_fchmod(vfs_handle_struct *handle, files_struct *fsp, int fd,
+static int smb_full_audit_fchmod(vfs_handle_struct *handle, files_struct *fsp,
                        mode_t mode);
 static int smb_full_audit_chown(vfs_handle_struct *handle,
                       const char *path, uid_t uid, gid_t gid);
-static int smb_full_audit_fchown(vfs_handle_struct *handle, files_struct *fsp, int fd,
+static int smb_full_audit_fchown(vfs_handle_struct *handle, files_struct *fsp,
                        uid_t uid, gid_t gid);
 static int smb_full_audit_lchown(vfs_handle_struct *handle,
                       const char *path, uid_t uid, gid_t gid);
@@ -159,15 +159,15 @@ static char *smb_full_audit_getwd(vfs_handle_struct *handle,
 static int smb_full_audit_ntimes(vfs_handle_struct *handle,
                       const char *path, const struct timespec ts[2]);
 static int smb_full_audit_ftruncate(vfs_handle_struct *handle, files_struct *fsp,
-                          int fd, SMB_OFF_T len);
-static bool smb_full_audit_lock(vfs_handle_struct *handle, files_struct *fsp, int fd,
+                          SMB_OFF_T len);
+static bool smb_full_audit_lock(vfs_handle_struct *handle, files_struct *fsp,
                       int op, SMB_OFF_T offset, SMB_OFF_T count, int type);
 static int smb_full_audit_kernel_flock(struct vfs_handle_struct *handle,
-                                      struct files_struct *fsp, int fd,
+                                      struct files_struct *fsp,
                                       uint32 share_mode);
 static int smb_full_audit_linux_setlease(vfs_handle_struct *handle, files_struct *fsp,
-                                       int fd, int leasetype);
-static bool smb_full_audit_getlock(vfs_handle_struct *handle, files_struct *fsp, int fd,
+                                       int leasetype);
+static bool smb_full_audit_getlock(vfs_handle_struct *handle, files_struct *fsp,
                       SMB_OFF_T *poffset, SMB_OFF_T *pcount, int *ptype, pid_t *ppid);
 static int smb_full_audit_symlink(vfs_handle_struct *handle,
                         const char *oldpath, const char *newpath);
@@ -191,13 +191,13 @@ static int smb_full_audit_chflags(vfs_handle_struct *handle,
 static struct file_id smb_full_audit_file_id_create(struct vfs_handle_struct *handle,
                                                    SMB_DEV_T dev, SMB_INO_T inode);
 static NTSTATUS smb_full_audit_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
-                               int fd, uint32 security_info,
+                               uint32 security_info,
                                SEC_DESC **ppdesc);
 static NTSTATUS smb_full_audit_get_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
                               const char *name, uint32 security_info,
                               SEC_DESC **ppdesc);
 static NTSTATUS smb_full_audit_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
-                             int fd, uint32 security_info_sent,
+                             uint32 security_info_sent,
                              SEC_DESC *psd);
 static NTSTATUS smb_full_audit_set_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
                             const char *name, uint32 security_info_sent,
@@ -205,7 +205,7 @@ static NTSTATUS smb_full_audit_set_nt_acl(vfs_handle_struct *handle, files_struc
 static int smb_full_audit_chmod_acl(vfs_handle_struct *handle,
                           const char *path, mode_t mode);
 static int smb_full_audit_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp,
-                           int fd, mode_t mode);
+                                    mode_t mode);
 static int smb_full_audit_sys_acl_get_entry(vfs_handle_struct *handle,
                                   SMB_ACL_T theacl, int entry_id,
                                   SMB_ACL_ENTRY_T *entry_p);
@@ -221,8 +221,7 @@ static SMB_ACL_T smb_full_audit_sys_acl_get_file(vfs_handle_struct *handle,
                                        const char *path_p,
                                        SMB_ACL_TYPE_T type);
 static SMB_ACL_T smb_full_audit_sys_acl_get_fd(vfs_handle_struct *handle,
-                                     files_struct *fsp,
-                                     int fd);
+                                     files_struct *fsp);
 static int smb_full_audit_sys_acl_clear_perms(vfs_handle_struct *handle,
                                     SMB_ACL_PERMSET_T permset);
 static int smb_full_audit_sys_acl_add_perm(vfs_handle_struct *handle,
@@ -251,7 +250,7 @@ static int smb_full_audit_sys_acl_set_file(vfs_handle_struct *handle,
                                  const char *name, SMB_ACL_TYPE_T acltype,
                                  SMB_ACL_T theacl);
 static int smb_full_audit_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
-                               int fd, SMB_ACL_T theacl);
+                               SMB_ACL_T theacl);
 static int smb_full_audit_sys_acl_delete_def_file(vfs_handle_struct *handle,
                                         const char *path);
 static int smb_full_audit_sys_acl_get_perm(vfs_handle_struct *handle,
@@ -271,14 +270,14 @@ static ssize_t smb_full_audit_lgetxattr(struct vfs_handle_struct *handle,
                               const char *path, const char *name,
                               void *value, size_t size);
 static ssize_t smb_full_audit_fgetxattr(struct vfs_handle_struct *handle,
-                              struct files_struct *fsp, int fd,
+                              struct files_struct *fsp,
                               const char *name, void *value, size_t size);
 static ssize_t smb_full_audit_listxattr(struct vfs_handle_struct *handle,
                               const char *path, char *list, size_t size);
 static ssize_t smb_full_audit_llistxattr(struct vfs_handle_struct *handle,
                                const char *path, char *list, size_t size);
 static ssize_t smb_full_audit_flistxattr(struct vfs_handle_struct *handle,
-                               struct files_struct *fsp, int fd, char *list,
+                               struct files_struct *fsp, char *list,
                                size_t size);
 static int smb_full_audit_removexattr(struct vfs_handle_struct *handle,
                             const char *path,
@@ -287,7 +286,7 @@ static int smb_full_audit_lremovexattr(struct vfs_handle_struct *handle,
                              const char *path,
                              const char *name);
 static int smb_full_audit_fremovexattr(struct vfs_handle_struct *handle,
-                             struct files_struct *fsp, int fd,
+                             struct files_struct *fsp,
                              const char *name);
 static int smb_full_audit_setxattr(struct vfs_handle_struct *handle,
                          const char *path,
@@ -298,13 +297,13 @@ static int smb_full_audit_lsetxattr(struct vfs_handle_struct *handle,
                           const char *name, const void *value, size_t size,
                           int flags);
 static int smb_full_audit_fsetxattr(struct vfs_handle_struct *handle,
-                          struct files_struct *fsp, int fd, const char *name,
+                          struct files_struct *fsp, const char *name,
                           const void *value, size_t size, int flags);
 
 static int smb_full_audit_aio_read(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb);
 static int smb_full_audit_aio_write(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb);
 static ssize_t smb_full_audit_aio_return(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb);
-static int smb_full_audit_aio_cancel(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, SMB_STRUCT_AIOCB *aiocb);
+static int smb_full_audit_aio_cancel(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb);
 static int smb_full_audit_aio_error(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb);
 static int smb_full_audit_aio_fsync(struct vfs_handle_struct *handle, struct files_struct *fsp, int op, SMB_STRUCT_AIOCB *aiocb);
 static int smb_full_audit_aio_suspend(struct vfs_handle_struct *handle, struct files_struct *fsp, const SMB_STRUCT_AIOCB * const aiocb[], int n, const struct timespec *ts);
@@ -451,7 +450,7 @@ static vfs_op_tuple audit_op_tuples[] = {
         SMB_VFS_LAYER_LOGGER},
        {SMB_VFS_OP(smb_full_audit_sys_acl_get_file),   SMB_VFS_OP_SYS_ACL_GET_FILE,
         SMB_VFS_LAYER_LOGGER},
-       {SMB_VFS_OP(smb_full_audit_sys_acl_get_fd),     SMB_VFS_OP_SYS_ACL_GET_FD,
+{SMB_VFS_OP(smb_full_audit_sys_acl_get_fd),    SMB_VFS_OP_SYS_ACL_GET_FD,
         SMB_VFS_LAYER_LOGGER},
        {SMB_VFS_OP(smb_full_audit_sys_acl_clear_perms),        SMB_VFS_OP_SYS_ACL_CLEAR_PERMS,
         SMB_VFS_LAYER_LOGGER},
@@ -1100,11 +1099,11 @@ static ssize_t smb_full_audit_read(vfs_handle_struct *handle, files_struct *fsp,
 }
 
 static ssize_t smb_full_audit_pread(vfs_handle_struct *handle, files_struct *fsp,
-                          int fd, void *data, size_t n, SMB_OFF_T offset)
+                          void *data, size_t n, SMB_OFF_T offset)
 {
        ssize_t result;
 
-       result = SMB_VFS_NEXT_PREAD(handle, fsp, fd, data, n, offset);
+       result = SMB_VFS_NEXT_PREAD(handle, fsp, data, n, offset);
 
        do_log(SMB_VFS_OP_PREAD, (result >= 0), handle, "%s", fsp->fsp_name);
 
@@ -1124,12 +1123,12 @@ static ssize_t smb_full_audit_write(vfs_handle_struct *handle, files_struct *fsp
 }
 
 static ssize_t smb_full_audit_pwrite(vfs_handle_struct *handle, files_struct *fsp,
-                           int fd, const void *data, size_t n,
+                           const void *data, size_t n,
                            SMB_OFF_T offset)
 {
        ssize_t result;
 
-       result = SMB_VFS_NEXT_PWRITE(handle, fsp, fd, data, n, offset);
+       result = SMB_VFS_NEXT_PWRITE(handle, fsp, data, n, offset);
 
        do_log(SMB_VFS_OP_PWRITE, (result >= 0), handle, "%s", fsp->fsp_name);
 
@@ -1137,11 +1136,11 @@ static ssize_t smb_full_audit_pwrite(vfs_handle_struct *handle, files_struct *fs
 }
 
 static SMB_OFF_T smb_full_audit_lseek(vfs_handle_struct *handle, files_struct *fsp,
-                            int filedes, SMB_OFF_T offset, int whence)
+                            SMB_OFF_T offset, int whence)
 {
        ssize_t result;
 
-       result = SMB_VFS_NEXT_LSEEK(handle, fsp, filedes, offset, whence);
+       result = SMB_VFS_NEXT_LSEEK(handle, fsp, offset, whence);
 
        do_log(SMB_VFS_OP_LSEEK, (result != (ssize_t)-1), handle,
               "%s", fsp->fsp_name);
@@ -1193,11 +1192,11 @@ static int smb_full_audit_rename(vfs_handle_struct *handle,
        return result;    
 }
 
-static int smb_full_audit_fsync(vfs_handle_struct *handle, files_struct *fsp, int fd)
+static int smb_full_audit_fsync(vfs_handle_struct *handle, files_struct *fsp)
 {
        int result;
        
-       result = SMB_VFS_NEXT_FSYNC(handle, fsp, fd);
+       result = SMB_VFS_NEXT_FSYNC(handle, fsp);
 
        do_log(SMB_VFS_OP_FSYNC, (result >= 0), handle, "%s", fsp->fsp_name);
 
@@ -1216,12 +1215,12 @@ static int smb_full_audit_stat(vfs_handle_struct *handle,
        return result;    
 }
 
-static int smb_full_audit_fstat(vfs_handle_struct *handle, files_struct *fsp, int fd,
+static int smb_full_audit_fstat(vfs_handle_struct *handle, files_struct *fsp,
                       SMB_STRUCT_STAT *sbuf)
 {
        int result;
        
-       result = SMB_VFS_NEXT_FSTAT(handle, fsp, fd, sbuf);
+       result = SMB_VFS_NEXT_FSTAT(handle, fsp, sbuf);
 
        do_log(SMB_VFS_OP_FSTAT, (result >= 0), handle, "%s", fsp->fsp_name);
 
@@ -1264,12 +1263,12 @@ static int smb_full_audit_chmod(vfs_handle_struct *handle,
        return result;
 }
 
-static int smb_full_audit_fchmod(vfs_handle_struct *handle, files_struct *fsp, int fd,
+static int smb_full_audit_fchmod(vfs_handle_struct *handle, files_struct *fsp,
                        mode_t mode)
 {
        int result;
        
-       result = SMB_VFS_NEXT_FCHMOD(handle, fsp, fd, mode);
+       result = SMB_VFS_NEXT_FCHMOD(handle, fsp, mode);
 
        do_log(SMB_VFS_OP_FCHMOD, (result >= 0), handle,
               "%s|%o", fsp->fsp_name, mode);
@@ -1290,12 +1289,12 @@ static int smb_full_audit_chown(vfs_handle_struct *handle,
        return result;
 }
 
-static int smb_full_audit_fchown(vfs_handle_struct *handle, files_struct *fsp, int fd,
+static int smb_full_audit_fchown(vfs_handle_struct *handle, files_struct *fsp,
                        uid_t uid, gid_t gid)
 {
        int result;
 
-       result = SMB_VFS_NEXT_FCHOWN(handle, fsp, fd, uid, gid);
+       result = SMB_VFS_NEXT_FCHOWN(handle, fsp, uid, gid);
 
        do_log(SMB_VFS_OP_FCHOWN, (result >= 0), handle, "%s|%ld|%ld",
               fsp->fsp_name, (long int)uid, (long int)gid);
@@ -1353,11 +1352,11 @@ static int smb_full_audit_ntimes(vfs_handle_struct *handle,
 }
 
 static int smb_full_audit_ftruncate(vfs_handle_struct *handle, files_struct *fsp,
-                          int fd, SMB_OFF_T len)
+                          SMB_OFF_T len)
 {
        int result;
 
-       result = SMB_VFS_NEXT_FTRUNCATE(handle, fsp, fd, len);
+       result = SMB_VFS_NEXT_FTRUNCATE(handle, fsp, len);
 
        do_log(SMB_VFS_OP_FTRUNCATE, (result >= 0), handle,
               "%s", fsp->fsp_name);
@@ -1365,12 +1364,12 @@ static int smb_full_audit_ftruncate(vfs_handle_struct *handle, files_struct *fsp
        return result;
 }
 
-static bool smb_full_audit_lock(vfs_handle_struct *handle, files_struct *fsp, int fd,
+static bool smb_full_audit_lock(vfs_handle_struct *handle, files_struct *fsp,
                       int op, SMB_OFF_T offset, SMB_OFF_T count, int type)
 {
        bool result;
 
-       result = SMB_VFS_NEXT_LOCK(handle, fsp, fd, op, offset, count, type);
+       result = SMB_VFS_NEXT_LOCK(handle, fsp, op, offset, count, type);
 
        do_log(SMB_VFS_OP_LOCK, result, handle, "%s", fsp->fsp_name);
 
@@ -1378,12 +1377,12 @@ static bool smb_full_audit_lock(vfs_handle_struct *handle, files_struct *fsp, in
 }
 
 static int smb_full_audit_kernel_flock(struct vfs_handle_struct *handle,
-                                      struct files_struct *fsp, int fd,
+                                      struct files_struct *fsp,
                                       uint32 share_mode)
 {
        int result;
 
-       result = SMB_VFS_NEXT_KERNEL_FLOCK(handle, fsp, fd, share_mode);
+       result = SMB_VFS_NEXT_KERNEL_FLOCK(handle, fsp, share_mode);
 
        do_log(SMB_VFS_OP_KERNEL_FLOCK, (result >= 0), handle, "%s",
               fsp->fsp_name);
@@ -1392,11 +1391,11 @@ static int smb_full_audit_kernel_flock(struct vfs_handle_struct *handle,
 }
 
 static int smb_full_audit_linux_setlease(vfs_handle_struct *handle, files_struct *fsp,
-                                 int fd, int leasetype)
+                                 int leasetype)
 {
         int result;
 
-        result = SMB_VFS_NEXT_LINUX_SETLEASE(handle, fsp, fd, leasetype);
+        result = SMB_VFS_NEXT_LINUX_SETLEASE(handle, fsp, leasetype);
 
         do_log(SMB_VFS_OP_LINUX_SETLEASE, (result >= 0), handle, "%s",
                fsp->fsp_name);
@@ -1404,12 +1403,12 @@ static int smb_full_audit_linux_setlease(vfs_handle_struct *handle, files_struct
         return result;
 }
 
-static bool smb_full_audit_getlock(vfs_handle_struct *handle, files_struct *fsp, int fd,
+static bool smb_full_audit_getlock(vfs_handle_struct *handle, files_struct *fsp,
                       SMB_OFF_T *poffset, SMB_OFF_T *pcount, int *ptype, pid_t *ppid)
 {
        bool result;
 
-       result = SMB_VFS_NEXT_GETLOCK(handle, fsp, fd, poffset, pcount, ptype, ppid);
+       result = SMB_VFS_NEXT_GETLOCK(handle, fsp, poffset, pcount, ptype, ppid);
 
        do_log(SMB_VFS_OP_GETLOCK, result, handle, "%s", fsp->fsp_name);
 
@@ -1525,13 +1524,12 @@ static struct file_id smb_full_audit_file_id_create(struct vfs_handle_struct *ha
 }
 
 static NTSTATUS smb_full_audit_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
-                               int fd, uint32 security_info,
+                               uint32 security_info,
                                SEC_DESC **ppdesc)
 {
        NTSTATUS result;
 
-       result = SMB_VFS_NEXT_FGET_NT_ACL(handle, fsp, fd, security_info,
-                                         ppdesc);
+       result = SMB_VFS_NEXT_FGET_NT_ACL(handle, fsp, security_info, ppdesc);
 
        do_log(SMB_VFS_OP_FGET_NT_ACL, NT_STATUS_IS_OK(result), handle,
               "%s", fsp->fsp_name);
@@ -1556,13 +1554,12 @@ static NTSTATUS smb_full_audit_get_nt_acl(vfs_handle_struct *handle,
 }
 
 static NTSTATUS smb_full_audit_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
-                             int fd, uint32 security_info_sent,
+                             uint32 security_info_sent,
                              SEC_DESC *psd)
 {
        NTSTATUS result;
 
-       result = SMB_VFS_NEXT_FSET_NT_ACL(handle, fsp, fd, security_info_sent,
-                                         psd);
+       result = SMB_VFS_NEXT_FSET_NT_ACL(handle, fsp, security_info_sent, psd);
 
        do_log(SMB_VFS_OP_FSET_NT_ACL, NT_STATUS_IS_OK(result), handle, "%s", fsp->fsp_name);
 
@@ -1597,11 +1594,11 @@ static int smb_full_audit_chmod_acl(vfs_handle_struct *handle,
 }
 
 static int smb_full_audit_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp,
-                           int fd, mode_t mode)
+                                    mode_t mode)
 {
        int result;
        
-       result = SMB_VFS_NEXT_FCHMOD_ACL(handle, fsp, fd, mode);
+       result = SMB_VFS_NEXT_FCHMOD_ACL(handle, fsp, mode);
 
        do_log(SMB_VFS_OP_FCHMOD_ACL, (result >= 0), handle,
               "%s|%o", fsp->fsp_name, mode);
@@ -1686,11 +1683,11 @@ static SMB_ACL_T smb_full_audit_sys_acl_get_file(vfs_handle_struct *handle,
 }
 
 static SMB_ACL_T smb_full_audit_sys_acl_get_fd(vfs_handle_struct *handle,
-                                     files_struct *fsp, int fd)
+                                     files_struct *fsp)
 {
        SMB_ACL_T result;
 
-       result = SMB_VFS_NEXT_SYS_ACL_GET_FD(handle, fsp, fd);
+       result = SMB_VFS_NEXT_SYS_ACL_GET_FD(handle, fsp);
 
        do_log(SMB_VFS_OP_SYS_ACL_GET_FD, (result != NULL), handle,
               "%s", fsp->fsp_name);
@@ -1846,11 +1843,11 @@ static int smb_full_audit_sys_acl_set_file(vfs_handle_struct *handle,
 }
 
 static int smb_full_audit_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
-                               int fd, SMB_ACL_T theacl)
+                               SMB_ACL_T theacl)
 {
        int result;
 
-       result = SMB_VFS_NEXT_SYS_ACL_SET_FD(handle, fsp, fd, theacl);
+       result = SMB_VFS_NEXT_SYS_ACL_SET_FD(handle, fsp, theacl);
 
        do_log(SMB_VFS_OP_SYS_ACL_SET_FD, (result >= 0), handle,
               "%s", fsp->fsp_name);
@@ -1959,12 +1956,12 @@ static ssize_t smb_full_audit_lgetxattr(struct vfs_handle_struct *handle,
 }
 
 static ssize_t smb_full_audit_fgetxattr(struct vfs_handle_struct *handle,
-                              struct files_struct *fsp, int fd,
+                              struct files_struct *fsp,
                               const char *name, void *value, size_t size)
 {
        ssize_t result;
 
-       result = SMB_VFS_NEXT_FGETXATTR(handle, fsp, fd, name, value, size);
+       result = SMB_VFS_NEXT_FGETXATTR(handle, fsp, name, value, size);
 
        do_log(SMB_VFS_OP_FGETXATTR, (result >= 0), handle,
               "%s|%s", fsp->fsp_name, name);
@@ -1997,12 +1994,12 @@ static ssize_t smb_full_audit_llistxattr(struct vfs_handle_struct *handle,
 }
 
 static ssize_t smb_full_audit_flistxattr(struct vfs_handle_struct *handle,
-                               struct files_struct *fsp, int fd, char *list,
+                               struct files_struct *fsp, char *list,
                                size_t size)
 {
        ssize_t result;
 
-       result = SMB_VFS_NEXT_FLISTXATTR(handle, fsp, fd, list, size);
+       result = SMB_VFS_NEXT_FLISTXATTR(handle, fsp, list, size);
 
        do_log(SMB_VFS_OP_FLISTXATTR, (result >= 0), handle,
               "%s", fsp->fsp_name);
@@ -2039,12 +2036,12 @@ static int smb_full_audit_lremovexattr(struct vfs_handle_struct *handle,
 }
 
 static int smb_full_audit_fremovexattr(struct vfs_handle_struct *handle,
-                             struct files_struct *fsp, int fd,
+                             struct files_struct *fsp,
                              const char *name)
 {
        int result;
 
-       result = SMB_VFS_NEXT_FREMOVEXATTR(handle, fsp, fd, name);
+       result = SMB_VFS_NEXT_FREMOVEXATTR(handle, fsp, name);
 
        do_log(SMB_VFS_OP_FREMOVEXATTR, (result >= 0), handle,
               "%s|%s", fsp->fsp_name, name);
@@ -2085,13 +2082,12 @@ static int smb_full_audit_lsetxattr(struct vfs_handle_struct *handle,
 }
 
 static int smb_full_audit_fsetxattr(struct vfs_handle_struct *handle,
-                          struct files_struct *fsp, int fd, const char *name,
+                          struct files_struct *fsp, const char *name,
                           const void *value, size_t size, int flags)
 {
        int result;
 
-       result = SMB_VFS_NEXT_FSETXATTR(handle, fsp, fd, name, value, size,
-                                       flags);
+       result = SMB_VFS_NEXT_FSETXATTR(handle, fsp, name, value, size, flags);
 
        do_log(SMB_VFS_OP_FSETXATTR, (result >= 0), handle,
               "%s|%s", fsp->fsp_name, name);
@@ -2132,11 +2128,11 @@ static ssize_t smb_full_audit_aio_return(struct vfs_handle_struct *handle, struc
        return result;
 }
 
-static int smb_full_audit_aio_cancel(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, SMB_STRUCT_AIOCB *aiocb)
+static int smb_full_audit_aio_cancel(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb)
 {
        int result;
 
-       result = SMB_VFS_NEXT_AIO_CANCEL(handle, fsp, fd, aiocb);
+       result = SMB_VFS_NEXT_AIO_CANCEL(handle, fsp, aiocb);
        do_log(SMB_VFS_OP_AIO_CANCEL, (result >= 0), handle,
                "%s", fsp->fsp_name);
 
index 24ca3d5e423c3082e72919e3da10bc54d45a5f97..bcf61f3bc75f6a49ef91e7ddb853a5c68998458a 100644 (file)
@@ -33,7 +33,7 @@
 
 
 static int vfs_gpfs_kernel_flock(vfs_handle_struct *handle, files_struct *fsp, 
-                                int fd, uint32 share_mode)
+                                uint32 share_mode)
 {
 
        START_PROFILE(syscall_kernel_flock);
@@ -52,21 +52,21 @@ static int vfs_gpfs_kernel_flock(vfs_handle_struct *handle, files_struct *fsp,
 }
 
 static int vfs_gpfs_setlease(vfs_handle_struct *handle, files_struct *fsp, 
-                                int fd, int leasetype)
+                            int leasetype)
 {
        int ret;
        
        START_PROFILE(syscall_linux_setlease);
        
-       if ( linux_set_lease_sighandler(fd) == -1)
+       if ( linux_set_lease_sighandler(fsp->fh->fd) == -1)
                return -1;
 
-       ret = set_gpfs_lease(fd,leasetype);
+       ret = set_gpfs_lease(fsp->fh->fd,leasetype);
        
        if ( ret < 0 ) {
                /* This must have come from GPFS not being available */
                /* or some other error, hence call the default */
-               ret = linux_setlease(fd, leasetype);
+               ret = linux_setlease(fsp->fh->fd, leasetype);
        }
 
        END_PROFILE(syscall_linux_setlease);
@@ -227,7 +227,7 @@ static int gpfs_get_nfs4_acl(const char *fname, SMB4ACL_T **ppacl)
 }
 
 static NTSTATUS gpfsacl_fget_nt_acl(vfs_handle_struct *handle,
-       files_struct *fsp, int fd, uint32 security_info,
+       files_struct *fsp, uint32 security_info,
        SEC_DESC **ppdesc)
 {
        SMB4ACL_T *pacl = NULL;
@@ -363,7 +363,7 @@ static NTSTATUS gpfsacl_set_nt_acl_internal(files_struct *fsp, uint32 security_i
        return result;
 }
 
-static NTSTATUS gpfsacl_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp, int fd, uint32 security_info_sent, SEC_DESC *psd)
+static NTSTATUS gpfsacl_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp, uint32 security_info_sent, SEC_DESC *psd)
 {
        return gpfsacl_set_nt_acl_internal(fsp, security_info_sent, psd);
 }
@@ -501,8 +501,7 @@ SMB_ACL_T gpfsacl_sys_acl_get_file(vfs_handle_struct *handle,
 }
 
 SMB_ACL_T gpfsacl_sys_acl_get_fd(vfs_handle_struct *handle,
-                                 files_struct *fsp,
-                                 int fd)
+                                files_struct *fsp)
 {
        return gpfsacl_get_posix_acl(fsp->fsp_name, GPFS_ACL_TYPE_ACCESS);
 }
@@ -616,7 +615,7 @@ int gpfsacl_sys_acl_set_file(vfs_handle_struct *handle,
 
 int gpfsacl_sys_acl_set_fd(vfs_handle_struct *handle,
                            files_struct *fsp,
-                           int fd, SMB_ACL_T theacl)
+                           SMB_ACL_T theacl)
 {
        return gpfsacl_sys_acl_set_file(handle, fsp->fsp_name, SMB_ACL_TYPE_ACCESS, theacl);
 }
@@ -642,17 +641,17 @@ static int vfs_gpfs_chmod(vfs_handle_struct *handle, const char *path, mode_t mo
                 return SMB_VFS_NEXT_CHMOD(handle, path, mode);
 }
 
-static int vfs_gpfs_fchmod(vfs_handle_struct *handle, files_struct *fsp, int fd, mode_t mode)
+static int vfs_gpfs_fchmod(vfs_handle_struct *handle, files_struct *fsp, mode_t mode)
 {
                 SMB_STRUCT_STAT st;
-                if (SMB_VFS_NEXT_FSTAT(handle, fsp, fd, &st) != 0) {
+                if (SMB_VFS_NEXT_FSTAT(handle, fsp, &st) != 0) {
                                 return -1;
                 }
                 /* avoid chmod() if possible, to preserve acls */
                 if ((st.st_mode & ~S_IFMT) == mode) {
                                 return 0;
                 }
-                return SMB_VFS_NEXT_FCHMOD(handle, fsp, fd, mode);
+                return SMB_VFS_NEXT_FCHMOD(handle, fsp, mode);
 }
 
 /* VFS operations structure */
index edce161c19eb215a728055bd956189b289db240e..e101886450b191d93af72ec27cd0f978bc76c6da 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Unix SMB/Netbios implementation.
  * VFS module to get and set HP-UX ACLs
- * Copyright (C) Michael Adam 2006
+ * Copyright (C) Michael Adam 2006,2008
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -182,15 +182,14 @@ SMB_ACL_T hpuxacl_sys_acl_get_file(vfs_handle_struct *handle,
  * get the access ACL of a file referred to by a fd
  */
 SMB_ACL_T hpuxacl_sys_acl_get_fd(vfs_handle_struct *handle,
-                                files_struct *fsp,
-                                int fd)
+                                files_struct *fsp)
 {
         /* 
         * HPUX doesn't have the facl call. Fake it using the path.... JRA. 
         */
        /* For all I see, the info should already be in the fsp
         * parameter, but get it again to be safe --- necessary? */
-        files_struct *file_struct_p = file_find_fd(fd);
+        files_struct *file_struct_p = file_find_fd(fsp->fh->fd);
         if (file_struct_p == NULL) {
                 errno = EBADF;
                 return NULL;
@@ -307,14 +306,14 @@ int hpuxacl_sys_acl_set_file(vfs_handle_struct *handle,
  */
 int hpuxacl_sys_acl_set_fd(vfs_handle_struct *handle,
                              files_struct *fsp,
-                             int fd, SMB_ACL_T theacl)
+                             SMB_ACL_T theacl)
 {
         /*
          * HPUX doesn't have the facl call. Fake it using the path.... JRA.
          */
        /* For all I see, the info should already be in the fsp
         * parameter, but get it again to be safe --- necessary? */
-        files_struct *file_struct_p = file_find_fd(fd);
+        files_struct *file_struct_p = file_find_fd(fsp->fh->fd);
         if (file_struct_p == NULL) {
                 errno = EBADF;
                 return -1;
index dab6deb747eed806c073cc1dc7ab83ad3c54b625..6484e8f3eb927e246d3eaec0e8bab63ab2cc539a 100644 (file)
@@ -1,7 +1,7 @@
 /*
    Unix SMB/Netbios implementation.
    VFS module to get and set irix acls
-   Copyright (C) Michael Adam 2006
+   Copyright (C) Michael Adam 2006,2008
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -32,8 +32,7 @@ SMB_ACL_T irixacl_sys_acl_get_file(vfs_handle_struct *handle,
 }
 
 SMB_ACL_T irixacl_sys_acl_get_fd(vfs_handle_struct *handle,
-                                 files_struct *fsp,
-                                 int fd)
+                                files_struct *fsp)
 {
        errno = ENOTSUP;
        return NULL;
@@ -50,7 +49,7 @@ int irixacl_sys_acl_set_file(vfs_handle_struct *handle,
 
 int irixacl_sys_acl_set_fd(vfs_handle_struct *handle,
                            files_struct *fsp,
-                           int fd, SMB_ACL_T theacl)
+                           SMB_ACL_T theacl)
 {
        errno = ENOTSUP;
        return -1;
index fb0c0bc8e906cf176f43ed2cf2028756ccd10d3e..21fb2ada3196d2f2903ee0b7a608edb088b0040c 100644 (file)
@@ -63,11 +63,10 @@ SMB_ACL_T posixacl_sys_acl_get_file(vfs_handle_struct *handle,
 }
 
 SMB_ACL_T posixacl_sys_acl_get_fd(vfs_handle_struct *handle,
-                                 files_struct *fsp,
-                                 int fd)
+                                 files_struct *fsp)
 {
        struct smb_acl_t *result;
-       acl_t acl = acl_get_fd(fd);
+       acl_t acl = acl_get_fd(fsp->fh->fd);
 
        if (acl == NULL) {
                return NULL;
@@ -114,14 +113,14 @@ int posixacl_sys_acl_set_file(vfs_handle_struct *handle,
 
 int posixacl_sys_acl_set_fd(vfs_handle_struct *handle,
                            files_struct *fsp,
-                           int fd, SMB_ACL_T theacl)
+                           SMB_ACL_T theacl)
 {
        int res;
        acl_t acl = smb_acl_to_posix(theacl);
        if (acl == NULL) {
                return -1;
        }
-       res =  acl_set_fd(fd, acl);
+       res =  acl_set_fd(fsp->fh->fd, acl);
        acl_free(acl);
        return res;
 }
index cebf3a3933747a1281813ae6e67e2bbdbfbde0b9..2d64bc0184ded75357642f30c1881eb52e983fe4 100644 (file)
@@ -184,11 +184,10 @@ normal_open:
 
 static int prealloc_ftruncate(vfs_handle_struct * handle,
                        files_struct *  fsp,
-                       int             fd,
                        SMB_OFF_T       offset)
 {
        SMB_OFF_T *psize;
-       int ret = SMB_VFS_NEXT_FTRUNCATE(handle, fsp, fd, offset);
+       int ret = SMB_VFS_NEXT_FTRUNCATE(handle, fsp, offset);
 
        /* Maintain the allocated space even in the face of truncates. */
        if ((psize = VFS_FETCH_FSP_EXTENSION(handle, fsp))) {
index 8fdd6168feaeb41c69974cbe796c6725882b5926..b3642d558fe307a4537647ac6e2506c97477f2ac 100644 (file)
@@ -80,7 +80,6 @@ static ssize_t readahead_sendfile(struct vfs_handle_struct *handle,
 
 static ssize_t readahead_pread(vfs_handle_struct *handle,
                                files_struct *fsp,
-                               int fd,
                                void *data,
                                size_t count,
                                SMB_OFF_T offset)
@@ -89,16 +88,16 @@ static ssize_t readahead_pread(vfs_handle_struct *handle,
 
        if ( offset % rhd->off_bound == 0) {
 #if defined(HAVE_LINUX_READAHEAD)
-               int err = readahead(fd, offset, (size_t)rhd->len);
+               int err = readahead(fsp->fh->fd, offset, (size_t)rhd->len);
                DEBUG(10,("readahead_pread: readahead on fd %u, offset %llu, len %u returned %d\n",
-                       (unsigned int)fd,
+                       (unsigned int)fsp->fh->fd,
                        (unsigned long long)offset,
                        (unsigned int)rhd->len,
                        err ));
 #elif defined(HAVE_POSIX_FADVISE)
-               int err = posix_fadvise(fd, offset, (off_t)rhd->len, POSIX_FADV_WILLNEED);
+               int err = posix_fadvise(fsp->fh->fd, offset, (off_t)rhd->len, POSIX_FADV_WILLNEED);
                DEBUG(10,("readahead_pread: posix_fadvise on fd %u, offset %llu, len %u returned %d\n",
-                       (unsigned int)fd,
+                       (unsigned int)fsp->fh->fd,
                        (unsigned long long)offset,
                        (unsigned int)rhd->len,
                        err ));
@@ -109,7 +108,7 @@ static ssize_t readahead_pread(vfs_handle_struct *handle,
                }
 #endif
         }
-        return SMB_VFS_NEXT_PREAD(handle, fsp, fd, data, count, offset);
+        return SMB_VFS_NEXT_PREAD(handle, fsp, data, count, offset);
 }
 
 /*******************************************************************
index cda243f8c15fd5deb544ecaeda2f29e936abea9e..7bdfe8465b1bbdba5380c6bc68ef17cf49980ef8 100644 (file)
@@ -1,7 +1,7 @@
 /*
    Unix SMB/Netbios implementation.
    VFS module to get and set Solaris ACLs
-   Copyright (C) Michael Adam 2006
+   Copyright (C) Michael Adam 2006,2008
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -100,8 +100,7 @@ SMB_ACL_T solarisacl_sys_acl_get_file(vfs_handle_struct *handle,
  * get the access ACL of a file referred to by a fd
  */
 SMB_ACL_T solarisacl_sys_acl_get_fd(vfs_handle_struct *handle,
-                                   files_struct *fsp,
-                                   int fd)
+                                   files_struct *fsp)
 {
        SMB_ACL_T result = NULL;
        int count;
@@ -109,7 +108,7 @@ SMB_ACL_T solarisacl_sys_acl_get_fd(vfs_handle_struct *handle,
 
        DEBUG(10, ("entering solarisacl_sys_acl_get_fd.\n"));
 
-       if (!solaris_acl_get_fd(fd, &solaris_acl, &count)) {
+       if (!solaris_acl_get_fd(fsp->fh->fd, &solaris_acl, &count)) {
                goto done;
        }
        /* 
@@ -219,7 +218,7 @@ int solarisacl_sys_acl_set_file(vfs_handle_struct *handle,
  */
 int solarisacl_sys_acl_set_fd(vfs_handle_struct *handle,
                              files_struct *fsp,
-                             int fd, SMB_ACL_T theacl)
+                             SMB_ACL_T theacl)
 {
        SOLARIS_ACL_T solaris_acl = NULL;
        SOLARIS_ACL_T default_acl = NULL;
@@ -242,7 +241,7 @@ int solarisacl_sys_acl_set_fd(vfs_handle_struct *handle,
                           strerror(errno)));
                goto done;
        }
-       if (!solaris_acl_get_fd(fd, &default_acl, &default_count)) {
+       if (!solaris_acl_get_fd(fsp->fh->fd, &default_acl, &default_count)) {
                DEBUG(10, ("error getting (default) acl from fd\n"));
                goto done;
        }
@@ -258,7 +257,7 @@ int solarisacl_sys_acl_set_fd(vfs_handle_struct *handle,
                goto done;
        }
 
-       ret = facl(fd, SETACL, count, solaris_acl);
+       ret = facl(fsp->fh->fd, SETACL, count, solaris_acl);
        if (ret != 0) {
                DEBUG(10, ("call of facl failed (%s).\n", strerror(errno)));
        }
index 43cae0f8266b3a96f1d4ab128b65249e25216b04..b23a7ddcfab2d85402518486cf3e3aa10a88c943 100644 (file)
@@ -1,7 +1,7 @@
 /*
    Unix SMB/Netbios implementation.
    VFS module to get and set Tru64 acls
-   Copyright (C) Michael Adam 2006
+   Copyright (C) Michael Adam 2006,2008
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -67,11 +67,10 @@ SMB_ACL_T tru64acl_sys_acl_get_file(vfs_handle_struct *handle,
 }
 
 SMB_ACL_T tru64acl_sys_acl_get_fd(vfs_handle_struct *handle,
-                                 files_struct *fsp,
-                                 int fd)
+                                 files_struct *fsp)
 {
        struct smb_acl_t *result;
-       acl_t tru64_acl = acl_get_fd(fd, ACL_TYPE_ACCESS);
+       acl_t tru64_acl = acl_get_fd(fsp->fh->fd, ACL_TYPE_ACCESS);
 
        if (tru64_acl == NULL) {
                return NULL;
@@ -129,14 +128,14 @@ fail:
 
 int tru64acl_sys_acl_set_fd(vfs_handle_struct *handle,
                            files_struct *fsp,
-                           int fd, SMB_ACL_T theacl)
+                           SMB_ACL_T theacl)
 {
         int res;
         acl_t tru64_acl = smb_acl_to_tru64_acl(theacl);
         if (tru64_acl == NULL) {
                 return -1;
         }
-        res =  acl_set_fd(fd, ACL_TYPE_ACCESS, tru64_acl);
+        res =  acl_set_fd(fsp->fh->fd, ACL_TYPE_ACCESS, tru64_acl);
         acl_free(tru64_acl);
         return res;
 
index 060d64cffbbce7a58618dcfdab24794e3952c197..ce2e28771f7ca1193b6c037dd4d379602250b26a 100644 (file)
@@ -174,7 +174,7 @@ static NTSTATUS zfs_set_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
 
 static NTSTATUS zfsacl_fget_nt_acl(struct vfs_handle_struct *handle,
                                 struct files_struct *fsp,
-                                int fd,  uint32 security_info,
+                                uint32 security_info,
                                 struct security_descriptor **ppdesc)
 {
        SMB4ACL_T *pacl;
@@ -206,7 +206,7 @@ static NTSTATUS zfsacl_get_nt_acl(struct vfs_handle_struct *handle,
 
 static NTSTATUS zfsacl_fset_nt_acl(vfs_handle_struct *handle,
                         files_struct *fsp,
-                        int fd, uint32 security_info_sent,
+                        uint32 security_info_sent,
                         SEC_DESC *psd)
 {
        return zfs_set_nt_acl(handle, fsp, security_info_sent, psd);
index 8e0afe7c32c9696ad847e014b69d4b42f885a80a..330ffbc853261c65d7dcce411d1d42d45ec9fa1d 100644 (file)
@@ -94,6 +94,19 @@ bool secrets_init(void)
        return True;
 }
 
+/*
+ * close secrets.tdb
+ */
+void secrets_shutdown(void)
+{
+       if (!tdb) {
+               return;
+       }
+
+       tdb_close(tdb);
+       tdb = NULL;
+}
+
 /* read a entry from the secrets database - the caller must free the result
    if size is non-null then the size of the entry is put in there
  */
index bae32e89f75a4edded53f52bc839ab8417f648dd..1a4a26ee6f2c226e8177d14f666dd5bbf16d1a46 100644 (file)
@@ -1097,7 +1097,7 @@ static int get_file_version(files_struct *fsp, char *fname,uint32 *major, uint32
        }
 
        /* Skip OEM header (if any) and the DOS stub to start of Windows header */
-       if (SMB_VFS_LSEEK(fsp, fsp->fh->fd, SVAL(buf,DOS_HEADER_LFANEW_OFFSET), SEEK_SET) == (SMB_OFF_T)-1) {
+       if (SMB_VFS_LSEEK(fsp, SVAL(buf,DOS_HEADER_LFANEW_OFFSET), SEEK_SET) == (SMB_OFF_T)-1) {
                DEBUG(3,("get_file_version: File [%s] too short, errno = %d\n",
                                fname, errno));
                /* Assume this isn't an error... the file just looks sort of like a PE/NE file */
@@ -1118,7 +1118,7 @@ static int get_file_version(files_struct *fsp, char *fname,uint32 *major, uint32
                unsigned int section_table_bytes;
 
                /* Just skip over optional header to get to section table */
-               if (SMB_VFS_LSEEK(fsp, fsp->fh->fd,
+               if (SMB_VFS_LSEEK(fsp,
                                SVAL(buf,PE_HEADER_OPTIONAL_HEADER_SIZE)-(NE_HEADER_SIZE-PE_HEADER_SIZE),
                                SEEK_CUR) == (SMB_OFF_T)-1) {
                        DEBUG(3,("get_file_version: File [%s] Windows optional header too short, errno = %d\n",
@@ -1164,7 +1164,7 @@ static int get_file_version(files_struct *fsp, char *fname,uint32 *major, uint32
                                }
 
                                /* Seek to the start of the .rsrc section info */
-                               if (SMB_VFS_LSEEK(fsp, fsp->fh->fd, section_pos, SEEK_SET) == (SMB_OFF_T)-1) {
+                               if (SMB_VFS_LSEEK(fsp, section_pos, SEEK_SET) == (SMB_OFF_T)-1) {
                                        DEBUG(3,("get_file_version: PE file [%s] too short for section info, errno = %d\n",
                                                        fname, errno));
                                        goto error_exit;
@@ -1260,7 +1260,7 @@ static int get_file_version(files_struct *fsp, char *fname,uint32 *major, uint32
                                 * twice, as it is simpler to read the code. */
                                if (strcmp(&buf[i], VS_SIGNATURE) == 0) {
                                        /* Compute skip alignment to next long address */
-                                       int skip = -(SMB_VFS_LSEEK(fsp, fsp->fh->fd, 0, SEEK_CUR) - (byte_count - i) +
+                                       int skip = -(SMB_VFS_LSEEK(fsp, 0, SEEK_CUR) - (byte_count - i) +
                                                                 sizeof(VS_SIGNATURE)) & 3;
                                        if (IVAL(buf,i+sizeof(VS_SIGNATURE)+skip) != 0xfeef04bd) continue;
 
@@ -1360,7 +1360,7 @@ static int file_version_is_newer(connection_struct *conn, fstring new_file, fstr
                        DEBUG(6,("file_version_is_newer: Version info not found [%s], use mod time\n",
                                         old_file));
                        use_version = false;
-                       if (SMB_VFS_FSTAT(fsp, fsp->fh->fd, &st) == -1) {
+                       if (SMB_VFS_FSTAT(fsp, &st) == -1) {
                                 goto error_exit;
                        }
                        old_create_time = st.st_mtime;
@@ -1400,7 +1400,7 @@ static int file_version_is_newer(connection_struct *conn, fstring new_file, fstr
                        DEBUG(6,("file_version_is_newer: Version info not found [%s], use mod time\n",
                                         new_file));
                        use_version = false;
-                       if (SMB_VFS_FSTAT(fsp, fsp->fh->fd, &st) == -1) {
+                       if (SMB_VFS_FSTAT(fsp, &st) == -1) {
                                goto error_exit;
                        }
                        new_create_time = st.st_mtime;
index 337fd4f74b4cb63b71c00960a729a7ba638955f7..1fde16b802d79040876246cd542b308dbc9c37f2 100644 (file)
@@ -83,7 +83,7 @@ NTSTATUS print_fsp_open(connection_struct *conn, const char *fname,
        fsp->is_directory = False;
        string_set(&fsp->fsp_name,print_job_fname(lp_const_servicename(SNUM(conn)),jobid));
        fsp->wcp = NULL; 
-       SMB_VFS_FSTAT(fsp,fsp->fh->fd, &sbuf);
+       SMB_VFS_FSTAT(fsp, &sbuf);
        fsp->mode = sbuf.st_mode;
        fsp->file_id = vfs_file_id_from_sbuf(conn, &sbuf);
 
index bc1761b0fdaded0c8615e00ab966010c82dbdb85..c8175f77acee8407fb6e2e30bf29d3e6f4535f8b 100644 (file)
@@ -746,7 +746,7 @@ void cancel_aio_by_fsp(files_struct *fsp)
                        /* Don't delete the aio_extra record as we may have
                           completed and don't yet know it. Just do the
                           aio_cancel call and return. */
-                       SMB_VFS_AIO_CANCEL(fsp,fsp->fh->fd, &aio_ex->acb);
+                       SMB_VFS_AIO_CANCEL(fsp, &aio_ex->acb);
                        aio_ex->fsp = NULL; /* fsp will be closed when we
                                             * return. */
                }
index ccf91fe57dd05f7f345d3c984a33cb7b09292d61..ab6e12f20f713fb4452c67fa2114526f28217b37 100644 (file)
@@ -948,7 +948,7 @@ static bool user_can_read_file(connection_struct *conn, char *name, SMB_STRUCT_S
        }
 
        /* Get NT ACL -allocated in main loop talloc context. No free needed here. */
-       status = SMB_VFS_FGET_NT_ACL(fsp, fsp->fh->fd,
+       status = SMB_VFS_FGET_NT_ACL(fsp,
                        (OWNER_SECURITY_INFORMATION|GROUP_SECURITY_INFORMATION|DACL_SECURITY_INFORMATION), &psd);
        close_file(fsp, NORMAL_CLOSE);
 
@@ -1007,7 +1007,7 @@ static bool user_can_write_file(connection_struct *conn, char *name, SMB_STRUCT_
        }
 
        /* Get NT ACL -allocated in main loop talloc context. No free needed here. */
-       status = SMB_VFS_FGET_NT_ACL(fsp, fsp->fh->fd,
+       status = SMB_VFS_FGET_NT_ACL(fsp,
                        (OWNER_SECURITY_INFORMATION|GROUP_SECURITY_INFORMATION|DACL_SECURITY_INFORMATION), &psd);
        close_file(fsp, NORMAL_CLOSE);
 
index a96f80ee0eb15fe5c7e37401ea5f549c25a0870a..d3813f9b41b0af24c85733dd7c2f1713f666b114 100644 (file)
@@ -538,7 +538,7 @@ int file_set_dosmode(connection_struct *conn, const char *fname,
                if (!NT_STATUS_IS_OK(open_file_fchmod(conn,fname,st,&fsp)))
                        return -1;
                become_root();
-               ret = SMB_VFS_FCHMOD(fsp, fsp->fh->fd, unixmode);
+               ret = SMB_VFS_FCHMOD(fsp, unixmode);
                unbecome_root();
                close_file_fchmod(fsp);
                if (!newfile) {
index 8037510d8058b8240e5ac497b3beba6cbed83b51..8cea4989f5b4dd16f5d3ad26208e951094a1e908 100644 (file)
@@ -77,7 +77,7 @@ ssize_t read_file(files_struct *fsp,char *data,SMB_OFF_T pos,size_t n)
 #ifdef DMF_FIX
                int numretries = 3;
 tryagain:
-               readret = SMB_VFS_PREAD(fsp,fsp->fh->fd,data,n,pos);
+               readret = SMB_VFS_PREAD(fsp,data,n,pos);
 
                if (readret == -1) {
                        if ((errno == EAGAIN) && numretries) {
@@ -89,7 +89,7 @@ tryagain:
                        return -1;
                }
 #else /* NO DMF fix. */
-               readret = SMB_VFS_PREAD(fsp,fsp->fh->fd,data,n,pos);
+               readret = SMB_VFS_PREAD(fsp,data,n,pos);
 
                if (readret == -1) {
                        return -1;
@@ -184,7 +184,7 @@ static int wcp_file_size_change(files_struct *fsp)
        write_cache *wcp = fsp->wcp;
 
        wcp->file_size = wcp->offset + wcp->data_size;
-       ret = SMB_VFS_FTRUNCATE(fsp, fsp->fh->fd, wcp->file_size);
+       ret = SMB_VFS_FTRUNCATE(fsp, wcp->file_size);
        if (ret == -1) {
                DEBUG(0,("wcp_file_size_change (%s): ftruncate of size %.0f error %s\n",
                        fsp->fsp_name, (double)wcp->file_size, strerror(errno) ));
@@ -229,7 +229,7 @@ ssize_t write_file(struct smb_request *req,
                SMB_STRUCT_STAT st;
                fsp->modified = True;
 
-               if (SMB_VFS_FSTAT(fsp,fsp->fh->fd,&st) == 0) {
+               if (SMB_VFS_FSTAT(fsp, &st) == 0) {
                        int dosmode = dos_mode(fsp->conn,fsp->fsp_name,&st);
                        if ((lp_store_dos_attributes(SNUM(fsp->conn)) ||
                                        MAP_ARCHIVE(fsp->conn)) &&
@@ -879,7 +879,7 @@ NTSTATUS sync_file(connection_struct *conn, files_struct *fsp, bool write_throug
                if (ret == -1) {
                        return map_nt_error_from_unix(errno);
                }
-               ret = SMB_VFS_FSYNC(fsp,fsp->fh->fd);
+               ret = SMB_VFS_FSYNC(fsp);
                if (ret == -1) {
                        return map_nt_error_from_unix(errno);
                }
@@ -896,6 +896,6 @@ int fsp_stat(files_struct *fsp, SMB_STRUCT_STAT *pst)
        if (fsp->fh->fd == -1) {
                return SMB_VFS_STAT(fsp->conn, fsp->fsp_name, pst);
        } else {
-               return SMB_VFS_FSTAT(fsp,fsp->fh->fd, pst);
+               return SMB_VFS_FSTAT(fsp, pst);
        }
 }
index a51f3afd82749715a109677990368fc0f14c4ee5..ae64c06215687d9982d3e018941dee9456d32ae3 100644 (file)
@@ -769,8 +769,7 @@ static NTSTATUS set_sd(files_struct *fsp, uint8 *data, uint32 sd_len,
        }
 
        if (fsp->fh->fd != -1) {
-               status = SMB_VFS_FSET_NT_ACL(fsp, fsp->fh->fd,
-                                            security_info_sent, psd);
+               status = SMB_VFS_FSET_NT_ACL(fsp, security_info_sent, psd);
        }
        else {
                status = SMB_VFS_SET_NT_ACL(fsp, fsp->fsp_name,
@@ -1643,7 +1642,7 @@ static void call_nt_transact_query_security_desc(connection_struct *conn,
        } else {
                if (fsp->fh->fd != -1) {
                        status = SMB_VFS_FGET_NT_ACL(
-                               fsp, fsp->fh->fd, security_info_wanted, &psd);
+                               fsp, security_info_wanted, &psd);
                }
                else {
                        status = SMB_VFS_GET_NT_ACL(
index f178102fdd7f93c130435a2e4d383615825371d0..4abe01738063fb62f9f4a0cdf42b038becd2ee43 100644 (file)
@@ -102,7 +102,7 @@ static void change_file_owner_to_parent(connection_struct *conn,
        }
 
        become_root();
-       ret = SMB_VFS_FCHOWN(fsp, fsp->fh->fd, parent_st.st_uid, (gid_t)-1);
+       ret = SMB_VFS_FCHOWN(fsp, parent_st.st_uid, (gid_t)-1);
        unbecome_root();
        if (ret == -1) {
                DEBUG(0,("change_file_owner_to_parent: failed to fchown "
@@ -342,7 +342,7 @@ static NTSTATUS open_file(files_struct *fsp,
                if (fsp->fh->fd == -1) {
                        ret = SMB_VFS_STAT(conn, path, psbuf);
                } else {
-                       ret = SMB_VFS_FSTAT(fsp,fsp->fh->fd,psbuf);
+                       ret = SMB_VFS_FSTAT(fsp, psbuf);
                        /* If we have an fd, this stat should succeed. */
                        if (ret == -1) {
                                DEBUG(0,("Error doing fstat on open file %s "
@@ -1764,7 +1764,7 @@ NTSTATUS open_file_ntcreate(connection_struct *conn,
            the kernel refuses the operations then the kernel is wrong.
           note that GPFS supports it as well - jmcd */
 
-       ret_flock = SMB_VFS_KERNEL_FLOCK(fsp, fsp->fh->fd, share_access);
+       ret_flock = SMB_VFS_KERNEL_FLOCK(fsp, share_access);
        if(ret_flock == -1 ){
 
                TALLOC_FREE(lck);
@@ -1789,8 +1789,8 @@ NTSTATUS open_file_ntcreate(connection_struct *conn,
                 * We are modifing the file after open - update the stat
                 * struct..
                 */
-               if ((SMB_VFS_FTRUNCATE(fsp,fsp->fh->fd,0) == -1) ||
-                   (SMB_VFS_FSTAT(fsp,fsp->fh->fd,psbuf)==-1)) {
+               if ((SMB_VFS_FTRUNCATE(fsp, 0) == -1) ||
+                   (SMB_VFS_FSTAT(fsp, psbuf)==-1)) {
                        status = map_nt_error_from_unix(errno);
                        TALLOC_FREE(lck);
                        fd_close(fsp);
@@ -1887,7 +1887,7 @@ NTSTATUS open_file_ntcreate(connection_struct *conn,
                int saved_errno = errno; /* We might get ENOSYS in the next
                                          * call.. */
 
-               if (SMB_VFS_FCHMOD_ACL(fsp, fsp->fh->fd, unx_mode) == -1 &&
+               if (SMB_VFS_FCHMOD_ACL(fsp, unx_mode) == -1 &&
                    errno == ENOSYS) {
                        errno = saved_errno; /* Ignore ENOSYS */
                }
@@ -1901,8 +1901,7 @@ NTSTATUS open_file_ntcreate(connection_struct *conn,
                {
                        int saved_errno = errno; /* We might get ENOSYS in the
                                                  * next call.. */
-                       ret = SMB_VFS_FCHMOD_ACL(fsp, fsp->fh->fd,
-                                                new_unx_mode);
+                       ret = SMB_VFS_FCHMOD_ACL(fsp, new_unx_mode);
 
                        if (ret == -1 && errno == ENOSYS) {
                                errno = saved_errno; /* Ignore ENOSYS */
@@ -1915,7 +1914,7 @@ NTSTATUS open_file_ntcreate(connection_struct *conn,
                }
 
                if ((ret == -1) &&
-                   (SMB_VFS_FCHMOD(fsp, fsp->fh->fd, new_unx_mode) == -1))
+                   (SMB_VFS_FCHMOD(fsp, new_unx_mode) == -1))
                        DEBUG(5, ("open_file_ntcreate: failed to reset "
                                  "attributes of file %s to 0%o\n",
                                  fname, (unsigned int)new_unx_mode));
@@ -2621,8 +2620,7 @@ NTSTATUS create_file_unixpath(connection_struct *conn,
 
                fsp->access_mask = FILE_GENERIC_ALL;
 
-               status = SMB_VFS_FSET_NT_ACL(
-                       fsp, fsp->fh->fd, sec_info_sent, sd);
+               status = SMB_VFS_FSET_NT_ACL(fsp, sec_info_sent, sd);
 
                fsp->access_mask = saved_access_mask;
 
@@ -2676,7 +2674,7 @@ NTSTATUS create_file_unixpath(connection_struct *conn,
                        *psbuf = sbuf;
                }
                else {
-                       SMB_VFS_FSTAT(fsp, fsp->fh->fd, psbuf);
+                       SMB_VFS_FSTAT(fsp, psbuf);
                }
        }
        return NT_STATUS_OK;
index 086f105b892e2d4d3a0fb07d7ec73dfe5c41468b..05021b6c74e30f039a19bf33c80055271050a64a 100644 (file)
@@ -164,7 +164,7 @@ static files_struct *linux_oplock_receive_message(fd_set *fds)
 
 static bool linux_set_kernel_oplock(files_struct *fsp, int oplock_type)
 {
-       if ( SMB_VFS_LINUX_SETLEASE(fsp,fsp->fh->fd, F_WRLCK) == -1) {
+       if ( SMB_VFS_LINUX_SETLEASE(fsp, F_WRLCK) == -1) {
                DEBUG(3,("linux_set_kernel_oplock: Refused oplock on file %s, "
                         "fd = %d, file_id = %s. (%s)\n",
                         fsp->fsp_name, fsp->fh->fd, 
@@ -202,7 +202,7 @@ static void linux_release_kernel_oplock(files_struct *fsp)
        /*
         * Remove the kernel oplock on this file.
         */
-       if ( SMB_VFS_LINUX_SETLEASE(fsp,fsp->fh->fd, F_UNLCK) == -1) {
+       if ( SMB_VFS_LINUX_SETLEASE(fsp, F_UNLCK) == -1) {
                if (DEBUGLVL(0)) {
                        dbgtext("linux_release_kernel_oplock: Error when "
                                "removing kernel oplock on file " );
index 2810b5e587c77e2114bf859d1f1f84460d6a300b..5f18615f6651e731219efff2cd65e0c2d80f6d22 100644 (file)
@@ -229,7 +229,7 @@ static void store_inheritance_attributes(files_struct *fsp, canon_ace *file_ace_
        if (!pai_protected && num_inherited_entries(file_ace_list) == 0 && num_inherited_entries(dir_ace_list) == 0) {
                /* Instead just remove the attribute if it exists. */
                if (fsp->fh->fd != -1)
-                       SMB_VFS_FREMOVEXATTR(fsp, fsp->fh->fd, SAMBA_POSIX_INHERITANCE_EA_NAME);
+                       SMB_VFS_FREMOVEXATTR(fsp, SAMBA_POSIX_INHERITANCE_EA_NAME);
                else
                        SMB_VFS_REMOVEXATTR(fsp->conn, fsp->fsp_name, SAMBA_POSIX_INHERITANCE_EA_NAME);
                return;
@@ -238,7 +238,7 @@ static void store_inheritance_attributes(files_struct *fsp, canon_ace *file_ace_
        pai_buf = create_pai_buf(file_ace_list, dir_ace_list, pai_protected, &store_size);
 
        if (fsp->fh->fd != -1)
-               ret = SMB_VFS_FSETXATTR(fsp, fsp->fh->fd, SAMBA_POSIX_INHERITANCE_EA_NAME,
+               ret = SMB_VFS_FSETXATTR(fsp, SAMBA_POSIX_INHERITANCE_EA_NAME,
                                pai_buf, store_size, 0);
        else
                ret = SMB_VFS_SETXATTR(fsp->conn,fsp->fsp_name, SAMBA_POSIX_INHERITANCE_EA_NAME,
@@ -445,7 +445,7 @@ static struct pai_val *fload_inherited_info(files_struct *fsp)
 
        do {
                if (fsp->fh->fd != -1)
-                       ret = SMB_VFS_FGETXATTR(fsp, fsp->fh->fd, SAMBA_POSIX_INHERITANCE_EA_NAME,
+                       ret = SMB_VFS_FGETXATTR(fsp, SAMBA_POSIX_INHERITANCE_EA_NAME,
                                        pai_buf, pai_buf_size);
                else
                        ret = SMB_VFS_GETXATTR(fsp->conn,fsp->fsp_name,SAMBA_POSIX_INHERITANCE_EA_NAME,
@@ -2573,7 +2573,7 @@ static bool set_canon_ace_list(files_struct *fsp, canon_ace *the_ace, bool defau
                        }
                }
        } else {
-               if (SMB_VFS_SYS_ACL_SET_FD(fsp, fsp->fh->fd, the_acl) == -1) {
+               if (SMB_VFS_SYS_ACL_SET_FD(fsp, the_acl) == -1) {
                        /*
                         * Some systems allow all the above calls and only fail with no ACL support
                         * when attempting to apply the acl. HPUX with HFS is an example of this. JRA.
@@ -2589,7 +2589,7 @@ static bool set_canon_ace_list(files_struct *fsp, canon_ace *the_ace, bool defau
                                        fsp->fsp_name ));
 
                                become_root();
-                               sret = SMB_VFS_SYS_ACL_SET_FD(fsp, fsp->fh->fd, the_acl);
+                               sret = SMB_VFS_SYS_ACL_SET_FD(fsp, the_acl);
                                unbecome_root();
                                if (sret == 0) {
                                        ret = True;
@@ -3080,12 +3080,12 @@ NTSTATUS posix_fget_nt_acl(struct files_struct *fsp, uint32_t security_info,
        }
 
        /* Get the stat struct for the owner info. */
-       if(SMB_VFS_FSTAT(fsp,fsp->fh->fd,&sbuf) != 0) {
+       if(SMB_VFS_FSTAT(fsp, &sbuf) != 0) {
                return map_nt_error_from_unix(errno);
        }
 
        /* Get the ACL from the fd. */
-       posix_acl = SMB_VFS_SYS_ACL_GET_FD(fsp, fsp->fh->fd);
+       posix_acl = SMB_VFS_SYS_ACL_GET_FD(fsp);
 
        pal = fload_inherited_info(fsp);
 
@@ -3194,7 +3194,7 @@ int try_chown(connection_struct *conn, const char *fname, uid_t uid, gid_t gid)
 
        become_root();
        /* Keep the current file gid the same. */
-       ret = SMB_VFS_FCHOWN(fsp, fsp->fh->fd, uid, (gid_t)-1);
+       ret = SMB_VFS_FCHOWN(fsp, uid, (gid_t)-1);
        unbecome_root();
 
        close_file_fchmod(fsp);
@@ -3429,7 +3429,7 @@ NTSTATUS set_nt_acl(files_struct *fsp, uint32 security_info_sent, SEC_DESC *psd)
                if(SMB_VFS_STAT(fsp->conn,fsp->fsp_name, &sbuf) != 0)
                        return map_nt_error_from_unix(errno);
        } else {
-               if(SMB_VFS_FSTAT(fsp,fsp->fh->fd,&sbuf) != 0)
+               if(SMB_VFS_FSTAT(fsp, &sbuf) != 0)
                        return map_nt_error_from_unix(errno);
        }
 
@@ -3479,7 +3479,7 @@ NTSTATUS set_nt_acl(files_struct *fsp, uint32 security_info_sent, SEC_DESC *psd)
                        if(fsp->fh->fd == -1)
                                ret = SMB_VFS_STAT(fsp->conn, fsp->fsp_name, &sbuf);
                        else
-                               ret = SMB_VFS_FSTAT(fsp,fsp->fh->fd,&sbuf);
+                               ret = SMB_VFS_FSTAT(fsp, &sbuf);
 
                        if(ret != 0)
                                return map_nt_error_from_unix(errno);
@@ -3802,19 +3802,19 @@ int inherit_access_acl(connection_struct *conn, const char *inherit_from_dir,
  and set the mask to rwx. Needed to preserve complex ACLs set by NT.
 ****************************************************************************/
 
-int fchmod_acl(files_struct *fsp, int fd, mode_t mode)
+int fchmod_acl(files_struct *fsp, mode_t mode)
 {
        connection_struct *conn = fsp->conn;
        SMB_ACL_T posix_acl = NULL;
        int ret = -1;
 
-       if ((posix_acl = SMB_VFS_SYS_ACL_GET_FD(fsp, fd)) == NULL)
+       if ((posix_acl = SMB_VFS_SYS_ACL_GET_FD(fsp)) == NULL)
                return -1;
 
        if ((ret = chmod_acl_internals(conn, posix_acl, mode)) == -1)
                goto done;
 
-       ret = SMB_VFS_SYS_ACL_SET_FD(fsp, fd, posix_acl);
+       ret = SMB_VFS_SYS_ACL_SET_FD(fsp, posix_acl);
 
   done:
 
@@ -4099,7 +4099,7 @@ static bool remove_posix_acl(connection_struct *conn, files_struct *fsp, const c
 
        /* Get the current file ACL. */
        if (fsp && fsp->fh->fd != -1) {
-               file_acl = SMB_VFS_SYS_ACL_GET_FD(fsp, fsp->fh->fd);
+               file_acl = SMB_VFS_SYS_ACL_GET_FD(fsp);
        } else {
                file_acl = SMB_VFS_SYS_ACL_GET_FILE( conn, fname, SMB_ACL_TYPE_ACCESS);
        }
@@ -4152,7 +4152,7 @@ static bool remove_posix_acl(connection_struct *conn, files_struct *fsp, const c
 
        /* Set the new empty file ACL. */
        if (fsp && fsp->fh->fd != -1) {
-               if (SMB_VFS_SYS_ACL_SET_FD(fsp, fsp->fh->fd, new_file_acl) == -1) {
+               if (SMB_VFS_SYS_ACL_SET_FD(fsp, new_file_acl) == -1) {
                        DEBUG(5,("remove_posix_acl: acl_set_file failed on %s (%s)\n",
                                fname, strerror(errno) ));
                        goto done;
@@ -4199,7 +4199,7 @@ bool set_unix_posix_acl(connection_struct *conn, files_struct *fsp, const char *
 
        if (fsp && fsp->fh->fd != -1) {
                /* The preferred way - use an open fd. */
-               if (SMB_VFS_SYS_ACL_SET_FD(fsp, fsp->fh->fd, file_acl) == -1) {
+               if (SMB_VFS_SYS_ACL_SET_FD(fsp, file_acl) == -1) {
                        DEBUG(5,("set_unix_posix_acl: acl_set_file failed on %s (%s)\n",
                                fname, strerror(errno) ));
                        SMB_VFS_SYS_ACL_FREE_ACL(conn, file_acl);
index d5e683ca3cbf85153970d8be4b79bb44037e8238..27f380a627592c670e8433061db0afba1fc44d92 100644 (file)
@@ -2835,7 +2835,7 @@ void reply_readbraw(struct smb_request *req)
                return;
        }
 
-       if (SMB_VFS_FSTAT(fsp,fsp->fh->fd,&st) == 0) {
+       if (SMB_VFS_FSTAT(fsp, &st) == 0) {
                size = st.st_size;
        }
 
@@ -3096,7 +3096,7 @@ static void send_file_readX(connection_struct *conn, struct smb_request *req,
        SMB_STRUCT_STAT sbuf;
        ssize_t nread = -1;
 
-       if(SMB_VFS_FSTAT(fsp,fsp->fh->fd, &sbuf) == -1) {
+       if(SMB_VFS_FSTAT(fsp, &sbuf) == -1) {
                reply_unixerror(req, ERRDOS, ERRnoaccess);
                return;
        }
@@ -4091,12 +4091,12 @@ void reply_lseek(struct smb_request *req)
        }
 
        if (umode == SEEK_END) {
-               if((res = SMB_VFS_LSEEK(fsp,fsp->fh->fd,startpos,umode)) == -1) {
+               if((res = SMB_VFS_LSEEK(fsp,startpos,umode)) == -1) {
                        if(errno == EINVAL) {
                                SMB_OFF_T current_pos = startpos;
                                SMB_STRUCT_STAT sbuf;
 
-                               if(SMB_VFS_FSTAT(fsp,fsp->fh->fd, &sbuf) == -1) {
+                               if(SMB_VFS_FSTAT(fsp, &sbuf) == -1) {
                                        reply_unixerror(req, ERRDOS,
                                                        ERRnoaccess);
                                        END_PROFILE(SMBlseek);
@@ -4105,7 +4105,7 @@ void reply_lseek(struct smb_request *req)
 
                                current_pos += sbuf.st_size;
                                if(current_pos < 0)
-                                       res = SMB_VFS_LSEEK(fsp,fsp->fh->fd,0,SEEK_SET);
+                                       res = SMB_VFS_LSEEK(fsp,0,SEEK_SET);
                        }
                }
 
@@ -5485,7 +5485,7 @@ NTSTATUS rename_internals_fsp(connection_struct *conn,
 
        /* Ensure we have a valid stat struct for the source. */
        if (fsp->fh->fd != -1) {
-               if (SMB_VFS_FSTAT(fsp,fsp->fh->fd,&sbuf) == -1) {
+               if (SMB_VFS_FSTAT(fsp, &sbuf) == -1) {
                        return map_nt_error_from_unix(errno);
                }
        } else {
@@ -6052,7 +6052,7 @@ NTSTATUS copy_file(TALLOC_CTX *ctx,
        }
 
        if ((ofun&3) == 1) {
-               if(SMB_VFS_LSEEK(fsp2,fsp2->fh->fd,0,SEEK_END) == -1) {
+               if(SMB_VFS_LSEEK(fsp2,0,SEEK_END) == -1) {
                        DEBUG(0,("copy_file: error - vfs lseek returned error %s\n", strerror(errno) ));
                        /*
                         * Stop the copy from occurring.
index c3b5f9fa2f02d50ea13f4a96a7393d56d2ba7721..485513c734395ef1d09df0da86a3c16c4f02b040 100644 (file)
@@ -130,7 +130,7 @@ static bool get_ea_value(TALLOC_CTX *mem_ctx, connection_struct *conn, files_str
        }
 
        if (fsp && fsp->fh->fd != -1) {
-               sizeret = SMB_VFS_FGETXATTR(fsp, fsp->fh->fd, ea_name, val, attr_size);
+               sizeret = SMB_VFS_FGETXATTR(fsp, ea_name, val, attr_size);
        } else {
                sizeret = SMB_VFS_GETXATTR(conn, fname, ea_name, val, attr_size);
        }
@@ -187,7 +187,7 @@ static struct ea_list *get_ea_list_from_file(TALLOC_CTX *mem_ctx, connection_str
                }
 
                if (fsp && fsp->fh->fd != -1) {
-                       sizeret = SMB_VFS_FLISTXATTR(fsp, fsp->fh->fd, ea_namelist, ea_namelist_size);
+                       sizeret = SMB_VFS_FLISTXATTR(fsp, ea_namelist, ea_namelist_size);
                } else {
                        sizeret = SMB_VFS_LISTXATTR(conn, fname, ea_namelist, ea_namelist_size);
                }
@@ -355,7 +355,7 @@ NTSTATUS set_ea(connection_struct *conn, files_struct *fsp, const char *fname, s
                        if (fsp && (fsp->fh->fd != -1)) {
                                DEBUG(10,("set_ea: deleting ea name %s on file %s by file descriptor.\n",
                                        unix_ea_name, fsp->fsp_name));
-                               ret = SMB_VFS_FREMOVEXATTR(fsp, fsp->fh->fd, unix_ea_name);
+                               ret = SMB_VFS_FREMOVEXATTR(fsp, unix_ea_name);
                        } else {
                                DEBUG(10,("set_ea: deleting ea name %s on file %s.\n",
                                        unix_ea_name, fname));
@@ -373,7 +373,7 @@ NTSTATUS set_ea(connection_struct *conn, files_struct *fsp, const char *fname, s
                        if (fsp && (fsp->fh->fd != -1)) {
                                DEBUG(10,("set_ea: setting ea name %s on file %s by file descriptor.\n",
                                        unix_ea_name, fsp->fsp_name));
-                               ret = SMB_VFS_FSETXATTR(fsp, fsp->fh->fd, unix_ea_name,
+                               ret = SMB_VFS_FSETXATTR(fsp, unix_ea_name,
                                                        ea_list->ea.value.data, ea_list->ea.value.length, 0);
                        } else {
                                DEBUG(10,("set_ea: setting ea name %s on file %s.\n",
@@ -3663,7 +3663,7 @@ static void call_trans2qfilepathinfo(connection_struct *conn,
                                return;
                        }
 
-                       if (SMB_VFS_FSTAT(fsp,fsp->fh->fd,&sbuf) != 0) {
+                       if (SMB_VFS_FSTAT(fsp, &sbuf) != 0) {
                                DEBUG(3,("fstat of fnum %d failed (%s)\n", fsp->fnum, strerror(errno)));
                                reply_unixerror(req, ERRDOS, ERRbadfid);
                                return;
@@ -4305,7 +4305,7 @@ total_data=%u (should be %u)\n", (unsigned int)total_data, (unsigned int)IVAL(pd
                                uint16 num_def_acls = 0;
 
                                if (fsp && !fsp->is_directory && (fsp->fh->fd != -1)) {
-                                       file_acl = SMB_VFS_SYS_ACL_GET_FD(fsp, fsp->fh->fd);
+                                       file_acl = SMB_VFS_SYS_ACL_GET_FD(fsp);
                                } else {
                                        file_acl = SMB_VFS_SYS_ACL_GET_FILE(conn, fname, SMB_ACL_TYPE_ACCESS);
                                }
@@ -6346,7 +6346,7 @@ static void call_trans2setfilepathinfo(connection_struct *conn,
                                return;
                        }
 
-                       if (SMB_VFS_FSTAT(fsp, fsp->fh->fd, &sbuf) != 0) {
+                       if (SMB_VFS_FSTAT(fsp, &sbuf) != 0) {
                                DEBUG(3,("call_trans2setfilepathinfo: fstat of fnum %d failed (%s)\n",fsp->fnum, strerror(errno)));
                                reply_unixerror(req, ERRDOS, ERRbadfid);
                                return;
index ed0406211d5a34cfc6d27aca2f59ae793841a280..9a5e0aff60ccb9a78640483f6fe238e0c4399b0e 100644 (file)
@@ -411,7 +411,7 @@ ssize_t vfs_pread_data(files_struct *fsp, char *buf,
 
        while (total < byte_count)
        {
-               ssize_t ret = SMB_VFS_PREAD(fsp, fsp->fh->fd, buf + total,
+               ssize_t ret = SMB_VFS_PREAD(fsp, buf + total,
                                        byte_count - total, offset + total);
 
                if (ret == 0) return total;
@@ -485,8 +485,8 @@ ssize_t vfs_pwrite_data(struct smb_request *req,
        }
 
        while (total < N) {
-               ret = SMB_VFS_PWRITE(fsp, fsp->fh->fd, buffer + total,
-                                N - total, offset + total);
+               ret = SMB_VFS_PWRITE(fsp, buffer + total, N - total,
+                                    offset + total);
 
                if (ret == -1)
                        return -1;
@@ -525,7 +525,7 @@ int vfs_allocate_file_space(files_struct *fsp, SMB_BIG_UINT len)
                return -1;
        }
 
-       ret = SMB_VFS_FSTAT(fsp,fsp->fh->fd,&st);
+       ret = SMB_VFS_FSTAT(fsp, &st);
        if (ret == -1)
                return ret;
 
@@ -539,7 +539,7 @@ int vfs_allocate_file_space(files_struct *fsp, SMB_BIG_UINT len)
                                fsp->fsp_name, (double)st.st_size ));
 
                flush_write_cache(fsp, SIZECHANGE_FLUSH);
-               if ((ret = SMB_VFS_FTRUNCATE(fsp, fsp->fh->fd, (SMB_OFF_T)len)) != -1) {
+               if ((ret = SMB_VFS_FTRUNCATE(fsp, (SMB_OFF_T)len)) != -1) {
                        set_filelen_write_cache(fsp, len);
                }
                return ret;
@@ -581,7 +581,7 @@ int vfs_set_filelen(files_struct *fsp, SMB_OFF_T len)
        release_level_2_oplocks_on_change(fsp);
        DEBUG(10,("vfs_set_filelen: ftruncate %s to len %.0f\n", fsp->fsp_name, (double)len));
        flush_write_cache(fsp, SIZECHANGE_FLUSH);
-       if ((ret = SMB_VFS_FTRUNCATE(fsp, fsp->fh->fd, len)) != -1) {
+       if ((ret = SMB_VFS_FTRUNCATE(fsp, len)) != -1) {
                set_filelen_write_cache(fsp, len);
                notify_fname(fsp->conn, NOTIFY_ACTION_MODIFIED,
                             FILE_NOTIFY_CHANGE_SIZE
@@ -612,7 +612,7 @@ int vfs_fill_sparse(files_struct *fsp, SMB_OFF_T len)
        ssize_t pwrite_ret;
 
        release_level_2_oplocks_on_change(fsp);
-       ret = SMB_VFS_FSTAT(fsp,fsp->fh->fd,&st);
+       ret = SMB_VFS_FSTAT(fsp, &st);
        if (ret == -1) {
                return ret;
        }
@@ -641,7 +641,7 @@ int vfs_fill_sparse(files_struct *fsp, SMB_OFF_T len)
        while (total < num_to_write) {
                size_t curr_write_size = MIN(SPARSE_BUF_WRITE_SIZE, (num_to_write - total));
 
-               pwrite_ret = SMB_VFS_PWRITE(fsp, fsp->fh->fd, sparse_buf, curr_write_size, offset + total);
+               pwrite_ret = SMB_VFS_PWRITE(fsp, sparse_buf, curr_write_size, offset + total);
                if (pwrite_ret == -1) {
                        DEBUG(10,("vfs_fill_sparse: SMB_VFS_PWRITE for file %s failed with error %s\n",
                                fsp->fsp_name, strerror(errno) ));
index 02bee835b0872d1c74f201165e788c6478c88da5..fbf9c3c9e383562931fc26bfd423c038e24fb550 100644 (file)
@@ -440,7 +440,7 @@ static NTSTATUS cmd_lseek(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc,
                default:        whence = SEEK_END;
        }
 
-       pos = SMB_VFS_LSEEK(vfs->files[fd], fd, offset, whence);
+       pos = SMB_VFS_LSEEK(vfs->files[fd], offset, whence);
        if (pos == (SMB_OFF_T)-1) {
                printf("lseek: error=%d (%s)\n", errno, strerror(errno));
                return NT_STATUS_UNSUCCESSFUL;
@@ -479,7 +479,7 @@ static NTSTATUS cmd_fsync(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc,
        }
 
        fd = atoi(argv[1]);
-       ret = SMB_VFS_FSYNC(vfs->files[fd], fd);
+       ret = SMB_VFS_FSYNC(vfs->files[fd]);
        if (ret == -1) {
                printf("fsync: error=%d (%s)\n", errno, strerror(errno));
                return NT_STATUS_UNSUCCESSFUL;
@@ -572,7 +572,7 @@ static NTSTATUS cmd_fstat(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc,
                return NT_STATUS_OK;
        }
 
-       if (SMB_VFS_FSTAT(vfs->files[fd], fd, &st) == -1) {
+       if (SMB_VFS_FSTAT(vfs->files[fd], &st) == -1) {
                printf("fstat: error=%d (%s)\n", errno, strerror(errno));
                return NT_STATUS_UNSUCCESSFUL;
        }
@@ -706,7 +706,7 @@ static NTSTATUS cmd_fchmod(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc,
                return NT_STATUS_OK;
        }
 
-       if (SMB_VFS_FCHMOD(vfs->files[fd], fd, mode) == -1) {
+       if (SMB_VFS_FCHMOD(vfs->files[fd], mode) == -1) {
                printf("fchmod: error=%d (%s)\n", errno, strerror(errno));
                return NT_STATUS_UNSUCCESSFUL;
        }
@@ -758,7 +758,7 @@ static NTSTATUS cmd_fchown(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc,
                printf("fchown: error=%d (invalid file descriptor)\n", EBADF);
                return NT_STATUS_OK;
        }
-       if (SMB_VFS_FCHOWN(vfs->files[fd], fd, uid, gid) == -1) {
+       if (SMB_VFS_FCHOWN(vfs->files[fd], uid, gid) == -1) {
                printf("fchown error=%d (%s)\n", errno, strerror(errno));
                return NT_STATUS_UNSUCCESSFUL;
        }
@@ -818,7 +818,7 @@ static NTSTATUS cmd_ftruncate(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int ar
                return NT_STATUS_OK;
        }
 
-       if (SMB_VFS_FTRUNCATE(vfs->files[fd], fd, off) == -1) {
+       if (SMB_VFS_FTRUNCATE(vfs->files[fd], off) == -1) {
                printf("ftruncate: error=%d (%s)\n", errno, strerror(errno));
                return NT_STATUS_UNSUCCESSFUL;
        }
@@ -901,7 +901,7 @@ static NTSTATUS cmd_lock(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, c
 
        printf("lock: debug lock(fd=%d, op=%d, offset=%ld, count=%ld, type=%d))\n", fd, op, offset, count, type);
 
-       if ((ret = SMB_VFS_LOCK(vfs->files[fd], fd, op, offset, count, type)) == False) {
+       if ((ret = SMB_VFS_LOCK(vfs->files[fd], op, offset, count, type)) == False) {
                printf("lock: error=%d (%s)\n", errno, strerror(errno));
                return NT_STATUS_UNSUCCESSFUL;
        }
index 141031dacb29c19b732e5ca6dfe56b4a8e89a3d5..310af82beba289949a1f0df3081ef364d9fba2bc 100644 (file)
@@ -1255,7 +1255,6 @@ static bool net_derive_salting_principal( TALLOC_CTX *ctx, ADS_STRUCT *ads )
        ADS_STATUS status;
        fstring salt;
        char *std_salt;
-       LDAPMessage *res = NULL;
        const char *machine_name = global_myname();
 
        status = ads_domain_func_level( ads, &domain_func );
@@ -1278,24 +1277,11 @@ static bool net_derive_salting_principal( TALLOC_CTX *ctx, ADS_STRUCT *ads )
 
        if ( domain_func == DS_DOMAIN_FUNCTION_2000 ) {
                char *upn;
-               int count;
-
-               status = ads_find_machine_acct(ads, &res, machine_name);
-               if (!ADS_ERR_OK(status)) {
-                       return False;
-               }
 
-               if ( (count = ads_count_replies(ads, res)) != 1 ) {
-                       DEBUG(1,("net_set_machine_spn: %d entries returned!\n", count));
-                       return False;
-               }
-
-               upn = ads_pull_string(ads, ctx, res, "userPrincipalName");
+               upn = ads_get_upn(ads, ctx, machine_name);
                if ( upn ) {
                        fstrcpy( salt, upn );
                }
-
-               ads_msgfree(ads, res);
        }
 
        return kerberos_secrets_store_des_salt( salt );
index 07cf22618e4a37b678876857363e176c103a4cb3..5e9900d1d65c53c8c57064a4109f2471622a1128 100644 (file)
@@ -121,7 +121,24 @@ static void flush_caches(void)
            otherwise cached access denied errors due to restrict anonymous
            hang around until the sequence number changes. */
 
-       wcache_invalidate_cache();
+       if (!wcache_invalidate_cache()) {
+               DEBUG(0, ("invalidating the cache failed; revalidate the cache\n"));
+               /* Close the cache to be able to valdite the cache */
+               close_winbindd_cache();
+               /*
+                * Ensure all cache and idmap caches are consistent
+                * before we initialize the cache again.
+                */
+               if (winbindd_validate_cache() < 0) {
+                       DEBUG(0, ("winbindd cache tdb corrupt and no backup "
+                                 "could be restore.\n"));
+               }
+
+               /* Initialize cache again. */
+               if (!initialize_winbindd_cache()) {
+                       exit(1);
+               }
+       }
 }
 
 /* Handle the signal by unlinking socket and exiting */
index f63c7a5b2f7185b9384fa9e3b9bcbdf81fd572a5..fc71868517b8cb81b59fd1fe4d0081c1bd747237 100644 (file)
@@ -62,7 +62,7 @@ static bool is_non_centry_key(TDB_DATA kbuf)
        int i;
 
        if (kbuf.dptr == NULL || kbuf.dsize == 0) {
-               return False;
+               return false;
        }
        for (i = 0; non_centry_keys[i] != NULL; i++) {
                size_t namelen = strlen(non_centry_keys[i]);
@@ -70,10 +70,10 @@ static bool is_non_centry_key(TDB_DATA kbuf)
                        continue;
                }
                if (strncmp(non_centry_keys[i], (const char *)kbuf.dptr, namelen) == 0) {
-                       return True;
+                       return true;
                }
        }
-       return False;
+       return false;
 }
 
 /* Global online/offline state - False when online. winbindd starts up online
@@ -210,9 +210,9 @@ static bool centry_check_bytes(struct cache_entry *centry, size_t nbytes)
                DEBUG(0,("centry corruption? needed %u bytes, have %d\n", 
                         (unsigned int)nbytes,
                         centry->len - centry->ofs));
-               return False;
+               return false;
        }
-       return True;
+       return true;
 }
 
 /*
@@ -348,9 +348,9 @@ static bool centry_sid(struct cache_entry *centry, TALLOC_CTX *mem_ctx, DOM_SID
        char *sid_string;
        sid_string = centry_string(centry, mem_ctx);
        if ((sid_string == NULL) || (!string_to_sid(sid, sid_string))) {
-               return False;
+               return false;
        }
-       return True;
+       return true;
 }
 
 
@@ -372,7 +372,7 @@ static bool wcache_server_down(struct winbindd_domain *domain)
        bool ret;
 
        if (!wcache->tdb)
-               return False;
+               return false;
 
        ret = (domain->sequence_number == DOM_SEQUENCE_NONE);
 
@@ -454,7 +454,7 @@ static NTSTATUS store_cache_seqnum( struct winbindd_domain *domain )
 }
 
 /*
-  refresh the domain sequence number. If force is True
+  refresh the domain sequence number. If force is true
   then always refresh it, no matter how recently we fetched it
 */
 
@@ -538,7 +538,7 @@ static bool centry_expired(struct winbindd_domain *domain, const char *keystr, s
        if (lp_winbind_offline_logon() && global_winbindd_offline_state) {
                DEBUG(10,("centry_expired: Key %s for domain %s valid as winbindd is globally offline.\n",
                        keystr, domain->name ));
-               return False;
+               return false;
        }
 
        /* when the domain is offline return the cached entry.
@@ -547,7 +547,7 @@ static bool centry_expired(struct winbindd_domain *domain, const char *keystr, s
        if (!domain->online) {
                DEBUG(10,("centry_expired: Key %s for domain %s valid as domain is offline.\n",
                        keystr, domain->name ));
-               return False;
+               return false;
        }
 
        /* if the server is OK and our cache entry came from when it was down then
@@ -556,7 +556,7 @@ static bool centry_expired(struct winbindd_domain *domain, const char *keystr, s
            (centry->sequence_number == DOM_SEQUENCE_NONE)) {
                DEBUG(10,("centry_expired: Key %s for domain %s invalid sequence.\n",
                        keystr, domain->name ));
-               return True;
+               return true;
        }
 
        /* if the server is down or the cache entry is not older than the
@@ -565,14 +565,14 @@ static bool centry_expired(struct winbindd_domain *domain, const char *keystr, s
            centry->sequence_number == domain->sequence_number) {
                DEBUG(10,("centry_expired: Key %s for domain %s is good.\n",
                        keystr, domain->name ));
-               return False;
+               return false;
        }
 
        DEBUG(10,("centry_expired: Key %s for domain %s expired\n",
                keystr, domain->name ));
 
        /* it's expired */
-       return True;
+       return true;
 }
 
 static struct cache_entry *wcache_fetch_raw(char *kstr)
@@ -625,7 +625,7 @@ static struct cache_entry *wcache_fetch(struct winbind_cache *cache,
                return NULL;
        }
 
-       refresh_sequence_number(domain, False);
+       refresh_sequence_number(domain, false);
 
        va_start(ap, format);
        smb_xvasprintf(&kstr, format, ap);
@@ -1189,7 +1189,7 @@ do_query:
                 (retry++ < 5));
 
        /* and save it */
-       refresh_sequence_number(domain, False);
+       refresh_sequence_number(domain, false);
        centry = centry_start(domain, status);
        if (!centry)
                goto skip_save;
@@ -1280,7 +1280,7 @@ do_query:
        status = domain->backend->enum_dom_groups(domain, mem_ctx, num_entries, info);
 
        /* and save it */
-       refresh_sequence_number(domain, False);
+       refresh_sequence_number(domain, false);
        centry = centry_start(domain, status);
        if (!centry)
                goto skip_save;
@@ -1364,7 +1364,7 @@ do_query:
        status = domain->backend->enum_local_groups(domain, mem_ctx, num_entries, info);
 
        /* and save it */
-       refresh_sequence_number(domain, False);
+       refresh_sequence_number(domain, false);
        centry = centry_start(domain, status);
        if (!centry)
                goto skip_save;
@@ -1437,7 +1437,7 @@ do_query:
                                              domain_name, name, sid, type);
 
        /* and save it */
-       refresh_sequence_number(domain, False);
+       refresh_sequence_number(domain, false);
 
        if (domain->online &&
            (NT_STATUS_IS_OK(status) || NT_STATUS_EQUAL(status, NT_STATUS_NONE_MAPPED))) {
@@ -1510,7 +1510,7 @@ do_query:
        status = domain->backend->sid_to_name(domain, mem_ctx, sid, domain_name, name, type);
 
        /* and save it */
-       refresh_sequence_number(domain, False);
+       refresh_sequence_number(domain, false);
        wcache_save_sid_to_name(domain, status, sid, *domain_name, *name, *type);
 
        /* We can't save the name to sid mapping here, as with sid history a
@@ -1554,7 +1554,7 @@ static NTSTATUS rids_to_names(struct winbindd_domain *domain,
                goto error;
        }
 
-       have_mapped = have_unmapped = False;
+       have_mapped = have_unmapped = false;
 
        for (i=0; i<num_rids; i++) {
                DOM_SID sid;
@@ -1577,7 +1577,7 @@ static NTSTATUS rids_to_names(struct winbindd_domain *domain,
 
                if (NT_STATUS_IS_OK(centry->status)) {
                        char *dom;
-                       have_mapped = True;
+                       have_mapped = true;
                        (*types)[i] = (enum lsa_SidType)centry_uint32(centry);
 
                        dom = centry_string(centry, mem_ctx);
@@ -1590,7 +1590,7 @@ static NTSTATUS rids_to_names(struct winbindd_domain *domain,
                        (*names)[i] = centry_string(centry, *names);
 
                } else if (NT_STATUS_EQUAL(centry->status, NT_STATUS_NONE_MAPPED)) {
-                       have_unmapped = True;
+                       have_unmapped = true;
 
                } else {
                        /* something's definitely wrong */
@@ -1647,7 +1647,7 @@ static NTSTATUS rids_to_names(struct winbindd_domain *domain,
                return result;
        }
 
-       refresh_sequence_number(domain, False);
+       refresh_sequence_number(domain, false);
 
        for (i=0; i<num_rids; i++) {
                DOM_SID sid;
@@ -1739,7 +1739,7 @@ do_query:
        status = domain->backend->query_user(domain, mem_ctx, user_sid, info);
 
        /* and save it */
-       refresh_sequence_number(domain, False);
+       refresh_sequence_number(domain, false);
        wcache_save_user(domain, status, info);
 
        return status;
@@ -1819,7 +1819,7 @@ do_query:
                goto skip_save;
        
        /* and save it */
-       refresh_sequence_number(domain, False);
+       refresh_sequence_number(domain, false);
        centry = centry_start(domain, status);
        if (!centry)
                goto skip_save;
@@ -1912,7 +1912,7 @@ static NTSTATUS lookup_useraliases(struct winbindd_domain *domain,
                                                     num_aliases, alias_rids);
 
        /* and save it */
-       refresh_sequence_number(domain, False);
+       refresh_sequence_number(domain, false);
        centry = centry_start(domain, status);
        if (!centry)
                goto skip_save;
@@ -1993,7 +1993,7 @@ do_query:
                                                  sid_mem, names, name_types);
 
        /* and save it */
-       refresh_sequence_number(domain, False);
+       refresh_sequence_number(domain, false);
        centry = centry_start(domain, status);
        if (!centry)
                goto skip_save;
@@ -2013,7 +2013,7 @@ skip_save:
 /* find the sequence number for a domain */
 static NTSTATUS sequence_number(struct winbindd_domain *domain, uint32 *seq)
 {
-       refresh_sequence_number(domain, False);
+       refresh_sequence_number(domain, false);
 
        *seq = domain->sequence_number;
 
@@ -2104,7 +2104,7 @@ do_query:
            the main parent and always to make the query.  --jerry */
 
        /* and save it */
-       refresh_sequence_number(domain, False);
+       refresh_sequence_number(domain, false);
  
        centry = centry_start(domain, status);
        if (!centry)
@@ -2170,7 +2170,7 @@ do_query:
        status = domain->backend->lockout_policy(domain, mem_ctx, policy); 
  
        /* and save it */
-       refresh_sequence_number(domain, False);
+       refresh_sequence_number(domain, false);
        wcache_save_lockout_policy(domain, status, policy);
  
        return status;
@@ -2221,7 +2221,7 @@ do_query:
        status = domain->backend->password_policy(domain, mem_ctx, policy); 
 
        /* and save it */
-       refresh_sequence_number(domain, False);
+       refresh_sequence_number(domain, false);
        wcache_save_password_policy(domain, status, policy);
 
        return status;
@@ -2261,7 +2261,7 @@ void wcache_invalidate_samlogon(struct winbindd_domain *domain,
        netsamlogon_clear_cached_user(cache->tdb, info3);
 }
 
-void wcache_invalidate_cache(void)
+bool wcache_invalidate_cache(void)
 {
        struct winbindd_domain *domain;
 
@@ -2270,9 +2270,15 @@ void wcache_invalidate_cache(void)
 
                DEBUG(10, ("wcache_invalidate_cache: invalidating cache "
                           "entries for %s\n", domain->name));
-               if (cache)
-                       tdb_traverse(cache->tdb, traverse_fn, NULL);
+               if (cache) {
+                       if (cache->tdb) {
+                               tdb_traverse(cache->tdb, traverse_fn, NULL);
+                       } else {
+                               return false;
+                       }
+               }
        }
+       return true;
 }
 
 bool init_wcache(void)
@@ -2283,7 +2289,7 @@ bool init_wcache(void)
        }
 
        if (wcache->tdb != NULL)
-               return True;
+               return true;
 
        /* when working offline we must not clear the cache on restart */
        wcache->tdb = tdb_open_log(lock_path("winbindd_cache.tdb"),
@@ -2293,10 +2299,10 @@ bool init_wcache(void)
 
        if (wcache->tdb == NULL) {
                DEBUG(0,("Failed to open winbindd_cache.tdb!\n"));
-               return False;
+               return false;
        }
 
-       return True;
+       return true;
 }
 
 /************************************************************************
@@ -2307,18 +2313,18 @@ bool init_wcache(void)
 
 bool initialize_winbindd_cache(void)
 {
-       bool cache_bad = True;
+       bool cache_bad = true;
        uint32 vers;
 
        if (!init_wcache()) {
                DEBUG(0,("initialize_winbindd_cache: init_wcache failed.\n"));
-               return False;
+               return false;
        }
 
        /* Check version number. */
        if (tdb_fetch_uint32(wcache->tdb, WINBINDD_CACHE_VERSION_KEYSTR, &vers) &&
                        vers == WINBINDD_CACHE_VERSION) {
-               cache_bad = False;
+               cache_bad = false;
        }
 
        if (cache_bad) {
@@ -2333,25 +2339,36 @@ bool initialize_winbindd_cache(void)
                        DEBUG(0,("initialize_winbindd_cache: unlink %s failed %s ",
                                lock_path("winbindd_cache.tdb"),
                                strerror(errno) ));
-                       return False;
+                       return false;
                }
                if (!init_wcache()) {
                        DEBUG(0,("initialize_winbindd_cache: re-initialization "
                                        "init_wcache failed.\n"));
-                       return False;
+                       return false;
                }
 
                /* Write the version. */
                if (!tdb_store_uint32(wcache->tdb, WINBINDD_CACHE_VERSION_KEYSTR, WINBINDD_CACHE_VERSION)) {
                        DEBUG(0,("initialize_winbindd_cache: version number store failed %s\n",
                                tdb_errorstr(wcache->tdb) ));
-                       return False;
+                       return false;
                }
        }
 
        tdb_close(wcache->tdb);
        wcache->tdb = NULL;
-       return True;
+       return true;
+}
+
+void close_winbindd_cache()
+{
+       if (!wcache) {
+               return;
+       }
+       if (wcache->tdb) {
+               tdb_close(wcache->tdb);
+               wcache->tdb = NULL;
+       }
 }
 
 void cache_store_response(pid_t pid, struct winbindd_response *response)
@@ -2400,7 +2417,7 @@ bool cache_retrieve_response(pid_t pid, struct winbindd_response * response)
        fstring key_str;
 
        if (!init_wcache())
-               return False;
+               return false;
 
        DEBUG(10, ("Retrieving response for pid %d\n", pid));
 
@@ -2408,17 +2425,17 @@ bool cache_retrieve_response(pid_t pid, struct winbindd_response * response)
        data = tdb_fetch(wcache->tdb, string_tdb_data(key_str));
 
        if (data.dptr == NULL)
-               return False;
+               return false;
 
        if (data.dsize != sizeof(*response))
-               return False;
+               return false;
 
        memcpy(response, data.dptr, data.dsize);
        SAFE_FREE(data.dptr);
 
        if (response->length == sizeof(*response)) {
                response->extra_data.data = NULL;
-               return True;
+               return true;
        }
 
        /* There's extra data */
@@ -2431,19 +2448,19 @@ bool cache_retrieve_response(pid_t pid, struct winbindd_response * response)
 
        if (data.dptr == NULL) {
                DEBUG(0, ("Did not find extra data\n"));
-               return False;
+               return false;
        }
 
        if (data.dsize != (response->length - sizeof(*response))) {
                DEBUG(0, ("Invalid extra data length: %d\n", (int)data.dsize));
                SAFE_FREE(data.dptr);
-               return False;
+               return false;
        }
 
        dump_data(11, (uint8 *)data.dptr, data.dsize);
 
        response->extra_data.data = data.dptr;
-       return True;
+       return true;
 }
 
 void cache_cleanup_response(pid_t pid)
@@ -2475,19 +2492,19 @@ bool lookup_cached_sid(TALLOC_CTX *mem_ctx, const DOM_SID *sid,
 
        domain = find_lookup_domain_from_sid(sid);
        if (domain == NULL) {
-               return False;
+               return false;
        }
 
        cache = get_cache(domain);
 
        if (cache->tdb == NULL) {
-               return False;
+               return false;
        }
 
        centry = wcache_fetch(cache, domain, "SN/%s",
                              sid_to_fstring(tmp, sid));
        if (centry == NULL) {
-               return False;
+               return false;
        }
 
        if (NT_STATUS_IS_OK(centry->status)) {
@@ -2516,13 +2533,13 @@ bool lookup_cached_name(TALLOC_CTX *mem_ctx,
 
        domain = find_lookup_domain_from_name(domain_name);
        if (domain == NULL) {
-               return False;
+               return false;
        }
 
        cache = get_cache(domain);
 
        if (cache->tdb == NULL) {
-               return False;
+               return false;
        }
 
        fstrcpy(uname, name);
@@ -2532,12 +2549,12 @@ bool lookup_cached_name(TALLOC_CTX *mem_ctx,
           offline so the cache won't expire the entry */
        
        original_online_state = domain->online;
-       domain->online = False;
+       domain->online = false;
        centry = wcache_fetch(cache, domain, "NS/%s/%s", domain_name, uname);
        domain->online = original_online_state;
        
        if (centry == NULL) {
-               return False;
+               return false;
        }
 
        if (NT_STATUS_IS_OK(centry->status)) {
@@ -2555,7 +2572,7 @@ void cache_name2sid(struct winbindd_domain *domain,
                    const char *domain_name, const char *name,
                    enum lsa_SidType type, const DOM_SID *sid)
 {
-       refresh_sequence_number(domain, False);
+       refresh_sequence_number(domain, false);
        wcache_save_name_to_sid(domain, NT_STATUS_OK, domain_name, name,
                                sid, type);
 }
@@ -2769,17 +2786,17 @@ bool set_global_winbindd_state_offline(void)
 
        if (wcache == NULL || wcache->tdb == NULL) {
                DEBUG(10,("set_global_winbindd_state_offline: wcache not open yet.\n"));
-               return False;
+               return false;
        }
 
        if (!lp_winbind_offline_logon()) {
                DEBUG(10,("set_global_winbindd_state_offline: rejecting.\n"));
-               return False;
+               return false;
        }
 
        if (global_winbindd_offline_state) {
                /* Already offline. */
-               return True;
+               return true;
        }
 
        data = tdb_fetch_bystring( wcache->tdb, "WINBINDD_OFFLINE" );
@@ -2787,12 +2804,12 @@ bool set_global_winbindd_state_offline(void)
        if (!data.dptr || data.dsize != 4) {
                DEBUG(10,("set_global_winbindd_state_offline: offline state not set.\n"));
                SAFE_FREE(data.dptr);
-               return False;
+               return false;
        } else {
                DEBUG(10,("set_global_winbindd_state_offline: offline state set.\n"));
-               global_winbindd_offline_state = True;
+               global_winbindd_offline_state = true;
                SAFE_FREE(data.dptr);
-               return True;
+               return true;
        }
 }
 
@@ -2809,7 +2826,7 @@ void set_global_winbindd_state_online(void)
                /* Already online. */
                return;
        }
-       global_winbindd_offline_state = False;
+       global_winbindd_offline_state = false;
 
        if (!wcache->tdb) {
                return;
@@ -2846,8 +2863,8 @@ static struct cache_entry *create_centry_validate(const char *kstr, TDB_DATA dat
                /* huh? corrupt cache? */
                DEBUG(0,("create_centry_validate: Corrupt cache for key %s (len < 8) ?\n", kstr));
                centry_free(centry);
-               state->bad_entry = True;
-               state->success = False;
+               state->bad_entry = true;
+               state->success = false;
                return NULL;
        }
 
@@ -2862,7 +2879,7 @@ static int validate_seqnum(TALLOC_CTX *mem_ctx, const char *keystr, TDB_DATA dbu
        if (dbuf.dsize != 8) {
                DEBUG(0,("validate_seqnum: Corrupt cache for key %s (len %u != 8) ?\n",
                                keystr, (unsigned int)dbuf.dsize ));
-               state->bad_entry = True;
+               state->bad_entry = true;
                return 1;
        }
        return 0;
@@ -3157,8 +3174,8 @@ static int validate_dr(TALLOC_CTX *mem_ctx, const char *keystr, TDB_DATA dbuf,
        if (dbuf.dsize == 0) {
                DEBUG(0,("validate_dr: Corrupt cache for key %s (len == 0) ?\n",
                                keystr));
-               state->bad_entry = True;
-               state->success = False;
+               state->bad_entry = true;
+               state->success = false;
                return 1;
        }
 
@@ -3173,8 +3190,8 @@ static int validate_de(TALLOC_CTX *mem_ctx, const char *keystr, TDB_DATA dbuf,
        if (dbuf.dsize == 0) {
                DEBUG(0,("validate_de: Corrupt cache for key %s (len == 0) ?\n",
                                keystr));
-               state->bad_entry = True;
-               state->success = False;
+               state->bad_entry = true;
+               state->success = false;
                return 1;
        }
 
@@ -3217,8 +3234,8 @@ static int validate_trustdomcache(TALLOC_CTX *mem_ctx, const char *keystr,
        if (dbuf.dsize == 0) {
                DEBUG(0, ("validate_trustdomcache: Corrupt cache for "
                          "key %s (len ==0) ?\n", keystr));
-               state->bad_entry = True;
-               state->success = False;
+               state->bad_entry = true;
+               state->success = false;
                return 1;
        }
 
@@ -3233,8 +3250,8 @@ static int validate_offline(TALLOC_CTX *mem_ctx, const char *keystr, TDB_DATA db
        if (dbuf.dsize != 4) {
                DEBUG(0,("validate_offline: Corrupt cache for key %s (len %u != 4) ?\n",
                                keystr, (unsigned int)dbuf.dsize ));
-               state->bad_entry = True;
-               state->success = False;
+               state->bad_entry = true;
+               state->success = false;
                return 1;
        }
        DEBUG(10,("validate_offline: %s ok\n", keystr));
@@ -3248,8 +3265,8 @@ static int validate_cache_version(TALLOC_CTX *mem_ctx, const char *keystr, TDB_D
                DEBUG(0, ("validate_cache_version: Corrupt cache for "
                          "key %s (len %u != 4) ?\n", 
                          keystr, (unsigned int)dbuf.dsize));
-               state->bad_entry = True;
-               state->success = False;
+               state->bad_entry = true;
+               state->success = false;
                return 1;
        }
 
@@ -3338,8 +3355,8 @@ static int cache_traverse_validate_fn(TDB_CONTEXT *the_tdb, TDB_DATA kbuf, TDB_D
        dump_data(0, (uint8 *)kbuf.dptr, kbuf.dsize);
        DEBUG(0,("data :\n"));
        dump_data(0, (uint8 *)dbuf.dptr, dbuf.dsize);
-       v_state->unknown_key = True;
-       v_state->success = False;
+       v_state->unknown_key = true;
+       v_state->success = false;
        return 1; /* terminate. */
 }
 
@@ -3433,7 +3450,7 @@ static bool add_wbdomain_to_tdc_array( struct winbindd_domain *new_dom,
        struct winbindd_tdc_domain *list = NULL;
        size_t idx;
        int i;
-       bool set_only = False;  
+       bool set_only = false;
        
        /* don't allow duplicates */
 
@@ -3445,7 +3462,7 @@ static bool add_wbdomain_to_tdc_array( struct winbindd_domain *new_dom,
                        DEBUG(10,("add_wbdomain_to_tdc_array: Found existing record for %s\n",
                                  new_dom->name));
                        idx = i;
-                       set_only = True;
+                       set_only = true;
                        
                        break;
                }
@@ -3466,7 +3483,7 @@ static bool add_wbdomain_to_tdc_array( struct winbindd_domain *new_dom,
        }
 
        if ( !list )
-               return False;
+               return false;
 
        list[idx].domain_name = talloc_strdup( list, new_dom->name );
        list[idx].dns_name = talloc_strdup( list, new_dom->alt_name );
@@ -3488,7 +3505,7 @@ static bool add_wbdomain_to_tdc_array( struct winbindd_domain *new_dom,
                *num_domains = idx + 1; 
        }
 
-       return True;    
+       return true;
 }
 
 /*********************************************************************
@@ -3644,7 +3661,7 @@ static bool wcache_tdc_store_list( struct winbindd_tdc_domain *domains, size_t n
        int ret;
        
        if ( !key.dptr )
-               return False;
+               return false;
        
        /* See if we were asked to delete the cache entry */
 
@@ -3681,23 +3698,23 @@ bool wcache_tdc_fetch_list( struct winbindd_tdc_domain **domains, size_t *num_do
        *num_domains = 0;       
 
        if ( !key.dptr )
-               return False;
+               return false;
        
        data = tdb_fetch( wcache->tdb, key );
 
        SAFE_FREE( key.dptr );
        
        if ( !data.dptr ) 
-               return False;
+               return false;
        
        *num_domains = unpack_tdc_domains( data.dptr, data.dsize, domains );
 
        SAFE_FREE( data.dptr );
        
        if ( !*domains )
-               return False;
+               return false;
 
-       return True;    
+       return true;
 }
 
 /*********************************************************************
@@ -3707,7 +3724,7 @@ bool wcache_tdc_add_domain( struct winbindd_domain *domain )
 {
        struct winbindd_tdc_domain *dom_list = NULL;
        size_t num_domains = 0;
-       bool ret = False;       
+       bool ret = false;
 
        DEBUG(10,("wcache_tdc_add_domain: Adding domain %s (%s), SID %s, "
                  "flags = 0x%x, attributes = 0x%x, type = 0x%x\n",
@@ -3718,7 +3735,7 @@ bool wcache_tdc_add_domain( struct winbindd_domain *domain )
                  domain->domain_type));        
        
        if ( !init_wcache() ) {
-               return False;
+               return false;
        }
        
        /* fetch the list */
@@ -3739,7 +3756,7 @@ bool wcache_tdc_add_domain( struct winbindd_domain *domain )
        
        /* Success */
 
-       ret = True;     
+       ret = true;
  done:
        TALLOC_FREE( dom_list );
        
@@ -3759,7 +3776,7 @@ struct winbindd_tdc_domain * wcache_tdc_fetch_domain( TALLOC_CTX *ctx, const cha
        DEBUG(10,("wcache_tdc_fetch_domain: Searching for domain %s\n", name));
 
        if ( !init_wcache() ) {
-               return False;
+               return false;
        }
        
        /* fetch the list */
@@ -3892,7 +3909,7 @@ do_query:
 
 /* the cache backend methods are exposed via this structure */
 struct winbindd_methods cache_methods = {
-       True,
+       true,
        query_user_list,
        enum_dom_groups,
        enum_local_groups,
index 99e401d53f24d2dcb6fcf442a5a7ab4a5679a805..a9155a57633d69b1f55f889a85763b639cf87e10 100644 (file)
@@ -74,7 +74,7 @@ extern bool override_logfile;
 
 static NTSTATUS init_dc_connection_network(struct winbindd_domain *domain);
 static void set_dc_type_and_flags( struct winbindd_domain *domain );
-static bool get_dcs(TALLOC_CTX *mem_ctx, const struct winbindd_domain *domain,
+static bool get_dcs(TALLOC_CTX *mem_ctx, struct winbindd_domain *domain,
                    struct dc_name_ip **dcs, int *num_dcs);
 
 /****************************************************************
@@ -560,7 +560,7 @@ static void cm_get_ipc_userpass(char **username, char **domain, char **password)
        }
 }
 
-static bool get_dc_name_via_netlogon(const struct winbindd_domain *domain,
+static bool get_dc_name_via_netlogon(struct winbindd_domain *domain,
                                     fstring dcname,
                                     struct sockaddr_storage *dc_ss)
 {
@@ -600,12 +600,12 @@ static bool get_dc_name_via_netlogon(const struct winbindd_domain *domain,
           35 seconds should do it. */
 
        orig_timeout = cli_set_timeout(netlogon_pipe->cli, 35000);
-       
+
        if (our_domain->active_directory) {
                struct DS_DOMAIN_CONTROLLER_INFO *domain_info = NULL;
-               
-               werr = rpccli_netlogon_dsr_getdcname(netlogon_pipe, 
-                                                    mem_ctx, 
+
+               werr = rpccli_netlogon_dsr_getdcname(netlogon_pipe,
+                                                    mem_ctx,
                                                     our_domain->dcname,
                                                     domain->name,
                                                     NULL,
@@ -615,19 +615,21 @@ static bool get_dc_name_via_netlogon(const struct winbindd_domain *domain,
                if (W_ERROR_IS_OK(werr)) {
                        fstrcpy(tmp, domain_info->domain_controller_name);
                        if (strlen(domain->alt_name) == 0) {
-                               fstrcpy(domain->alt_name, 
-                                       CONST_DISCARD(char*, domain_info->domain_name));
+                               fstrcpy(domain->alt_name,
+                                       domain_info->domain_name);
                        }
                        if (strlen(domain->forest_name) == 0) {
-                               fstrcpy(domain->forest_name, 
-                                       CONST_DISCARD(char*, domain_info->dns_forest_name));
+                               fstrcpy(domain->forest_name,
+                                       domain_info->dns_forest_name);
                        }
-               }               
+               }
        } else {
-               
-               werr = rpccli_netlogon_getanydcname(netlogon_pipe, mem_ctx, 
+
+               werr = rpccli_netlogon_getanydcname(netlogon_pipe,
+                                                   mem_ctx,
                                                    our_domain->dcname,
-                                           domain->name, &tmp);
+                                                   domain->name,
+                                                   &tmp);
        }
 
        /* And restore our original timeout. */
@@ -1245,7 +1247,7 @@ static bool dcip_to_name(const struct winbindd_domain *domain,
  the dcs[]  with results.
 *******************************************************************/
 
-static bool get_dcs(TALLOC_CTX *mem_ctx, const struct winbindd_domain *domain,
+static bool get_dcs(TALLOC_CTX *mem_ctx, struct winbindd_domain *domain,
                    struct dc_name_ip **dcs, int *num_dcs)
 {
        fstring dcname;
@@ -1348,7 +1350,7 @@ static bool get_dcs(TALLOC_CTX *mem_ctx, const struct winbindd_domain *domain,
 }
 
 static bool find_new_dc(TALLOC_CTX *mem_ctx,
-                       const struct winbindd_domain *domain,
+                       struct winbindd_domain *domain,
                        fstring dcname, struct sockaddr_storage *pss, int *fd)
 {
        struct dc_name_ip *dcs = NULL;