NT ACL code

Luke Kenneth Casson Leighton lkcl at samba-tng.org
Wed Oct 10 12:28:05 GMT 2001


hi there matt,

glad to see that you are working on what i have
been advocating and been ignored about consistently
for well over eighteen months.

very interesting to note that you are implementing
full NT ACL semantics: i told people that this
would be what would be needed in an API and that
doing "immediate conversion to unix ASAP" would
be a pointless waste of time and information.

irritated to learn that what you are implementing
what jeremy told me repeatedly would be a waste of
time, two years ago.


regarding the vfs, can i recommend that you examine the
cliffs project in which the smb vfs i already modified -
over one year ago - to take an SMBSTR string parameter, with
a view to moving over to Unicode ASAP?

i include the vfs.h header here f.y.i.

all best,

luke

/* 
   Unix SMB/Netbios implementation.
   Version 1.9.
   VFS structures and parameters
   Copyright (C) Tim Potter 1999
   Copyright (C) Luke Kenneth Casson Leighton 1996-2000
   
   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
   the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.
   
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.
   
   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

#ifndef _VFS_H
#define _VFS_H

/* Types used in the definition of VFS operations.  These are included
   here so the vfs.h file can be included by VFS modules without
   having to pull in unnecessary amounts of other stuff.  Note to VFS
   writers: you must include config.h before including this file.
   The following type definitions reference the HAVE_* symbols which
   are defined in config.h */

#ifndef SMB_OFF_T
#  ifdef HAVE_OFF64_T
#    define SMB_OFF_T off64_t
#  else
#    define SMB_OFF_T off_t
#  endif
#endif

#ifndef SMB_STRUCT_STAT
#  if defined(HAVE_STAT64) && defined(HAVE_OFF64_T)
#    define SMB_STRUCT_STAT struct stat64
#  else
#    define SMB_STRUCT_STAT struct stat
#  endif
#endif

#ifndef _BOOL
typedef int BOOL;
#endif

#if defined(HAVE_LONGLONG)
#define SMB_BIG_UINT unsigned long long
#else
#define SMB_BIG_UINT unsigned long
#endif

struct smb_connection_struct;

/* Avoid conflict with an AIX include file */

#ifdef vfs_ops
#undef vfs_ops
#endif

/* SMB VFS operations structure */

struct smbvfs_ops {

	/* transaction operations */
    uint32 (*trans2)(PCONN_HND pcon,
		     SMBSTR * pname, 
		     uint8 maxsetup, uint16 maxparam, uint16 maxdata,
		     uint16 *setup, uint8 *param, uint8 *data,
		     uint8 setup_len, uint16 param_len, uint16 data_len,
		     uint16 **rsetup, uint8 **rparam, uint8 **rdata,
		     uint8 *rsetup_len, uint16 *rparam_len, uint16 *rdata_len);

    uint32 (*trans)(PCONN_HND pcon,
		    SMBSTR * pname, 
		    uint8 maxsetup, uint16 maxparam, uint16 maxdata,
		    uint16 *setup, uint8 *param, uint8 *data,
		    uint8 setup_len, uint16 param_len, uint16 data_len,
		    uint16 **rsetup, uint8 **rparam, uint8 **rdata,
		    uint8 *rsetup_len, uint16 *rparam_len, uint16 *rdata_len);

    /* File operations */
    
    uint32 (*open)(const SMB_HDR *hdr,
		    PCONN_HND pcon, PFILE_HND *fhnd,
			SMBSTR * fname, uint16 info,
			uint16 share_mode,
			uint16 ofun, uint16 smb_attr,
			uint16 *Access,
			uint16 *action,
			uint16 *fnum);

    uint32 (*locking)(const SMB_HDR *hdr,
		    PFILE_HND fhnd,
		    uint8 lock_type,
		    uint8 oplock_level,
		    uint32 timeout,
		    uint16 num_unlocks,
		    LOCKING_RANGE_LARGE *u,
		    uint16 num_locks,
		    LOCKING_RANGE_LARGE *l);

    uint32 (*close)(PFILE_HND pfh, uint32 lastwritetime);
    uint32 (*read)(const SMB_HDR *hdr,
		    PFILE_HND pfh, char *data, SMB_OFF_T offset,
		    uint16 maxcnt, ssize_t *nread);
    uint32 (*write)(const SMB_HDR *hdr,
		    PFILE_HND pfh, char *data, SMB_OFF_T offset,
		    uint16 numtowrite, uint16 writethrough,
		    uint16 *nwritten);

    uint32 (*unlink)(PCONN_HND pcon, uint16 attr, SMBSTR * fname);

};

/* Information from the connection_struct passed to the vfs layer */

struct smb_connection_struct {

	/* Handle on dlopen() call */
	void *dl_handle;
	struct smbvfs_ops smbvfs_ops;
	struct smbvfs_ops smbvfs_rdr; /* smb redirection, if you need it. */
	BOOL read_only;
	int snum;
};


struct vfs_connection_struct;
/* VFS operations structure */

struct vfs_ops {

    /* Disk operations */
    
    int (*connect)(struct vfs_connection_struct *conn, const SMBSTR *service, 
		   const SMBSTR *user);
    void (*disconnect)(void);
    SMB_BIG_UINT (*disk_free)(const SMBSTR *path, BOOL small_query, SMB_BIG_UINT *bsize, 
			      SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize);
    
    /* Directory operations */

    DIR *(*opendir)(const SMBSTR *fname);
    struct dirent *(*readdir)(DIR *dirp);
    int (*mkdir)(const SMBSTR *path, mode_t mode);
    int (*rmdir)(const SMBSTR *path);
    int (*closedir)(DIR *dir);
    
    /* File operations */
    
    int (*open)(const SMBSTR *fname, int flags, mode_t mode);
    int (*close)(int fd);
    ssize_t (*read)(int fd, char *data, size_t n);
    ssize_t (*write)(int fd, const char *data, size_t n);
    SMB_OFF_T (*lseek)(int filedes, SMB_OFF_T offset, int whence);
    int (*rename)(const SMBSTR *old, const SMBSTR *new);
    int (*fsync)(int fd);
    int (*stat)(const SMBSTR *fname, SMB_STRUCT_STAT *sbuf);
    int (*fstat)(int fd, SMB_STRUCT_STAT *sbuf);
    int (*lstat)(const SMBSTR *path, SMB_STRUCT_STAT *sbuf);
    int (*unlink)(const SMBSTR *path);
    int (*chmod)(const SMBSTR *path, mode_t mode);
    int (*utime)(const SMBSTR *path, struct utimbuf *times);
	int (*ftruncate)(int fd, SMB_OFF_T offset);
	BOOL (*lock)(int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type);
};

struct vfs_options {
    struct vfs_options *prev, *next;
    char *name;
    char *value;
};

/* Information from the connection_struct passed to the vfs layer */

struct vfs_connection_struct {

	/* Handle on dlopen() call */
	void *dl_handle;
	struct vfs_ops vfs_ops;
	struct vfs_ops vfs_rdr; /* vfs redirection, if you need it. */
	SMBSTR *connectpath;
	BOOL read_only;
	int snum;
};

#endif /* _VFS_H */




More information about the samba-technical mailing list