diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/LDAP/samba.schema | 91 | ||||
-rw-r--r-- | examples/VFS/audit.c | 7 | ||||
-rw-r--r-- | examples/VFS/skel.c | 187 |
3 files changed, 177 insertions, 108 deletions
diff --git a/examples/LDAP/samba.schema b/examples/LDAP/samba.schema index 8d26cc5612c..d62423458e7 100644 --- a/examples/LDAP/samba.schema +++ b/examples/LDAP/samba.schema @@ -12,25 +12,100 @@ attributetype ( 1.3.6.1.4.1.7165.2.1.1 NAME 'lmPassword' DESC 'LanManager Passwd' EQUALITY caseIgnoreIA5Match - SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{32} ) + SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{32} SINGLE-VALUE ) attributetype ( 1.3.6.1.4.1.7165.2.1.2 NAME 'ntPassword' DESC 'NT Passwd' EQUALITY caseIgnoreIA5Match - SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{32} ) + SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{32} SINGLE-VALUE ) attributetype ( 1.3.6.1.4.1.7165.2.1.3 NAME 'pwdLastSet' DESC 'NT pwdLastSet' EQUALITY caseIgnoreIA5Match - SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{8} ) + SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{32} SINGLE-VALUE ) attributetype ( 1.3.6.1.4.1.7165.2.1.4 NAME 'acctFlags' DESC 'Account Flags' EQUALITY caseIgnoreIA5Match - SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{16} ) + SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{16} SINGLE-VALUE ) -objectclass ( 1.3.1.5.1.4.1.7165.2.2.1 NAME 'smbPasswordEntry' SUP top AUXILIARY - DESC 'Samba smbpasswd entry' - MUST ( uid $ uidNumber ) - MAY ( lmPassword $ ntPassword $ pwdLastSet $ acctFlags )) +attributetype ( 1.3.6.1.4.1.7165.2.1.5 NAME 'logonTime' + DESC 'NT logonTime' + EQUALITY caseIgnoreIA5Match + SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{32} SINGLE-VALUE ) + +attributetype ( 1.3.6.1.4.1.7165.2.1.6 NAME 'logoffTime' + DESC 'NT logoffTime' + EQUALITY caseIgnoreIA5Match + SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{32} SINGLE-VALUE ) + +attributetype ( 1.3.6.1.4.1.7165.2.1.7 NAME 'kickoffTime' + DESC 'NT kickoffTime' + EQUALITY caseIgnoreIA5Match + SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{32} SINGLE-VALUE ) + +attributetype ( 1.3.6.1.4.1.7165.2.1.8 NAME 'pwdCanChange' + DESC 'NT pwdCanChange' + EQUALITY caseIgnoreIA5Match + SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{32} SINGLE-VALUE ) +attributetype ( 1.3.6.1.4.1.7165.2.1.9 NAME 'pwdMustChange' + DESC 'NT pwdMustChange' + EQUALITY caseIgnoreIA5Match + SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{32} SINGLE-VALUE ) + +attributetype ( 1.3.6.1.4.1.7165.2.1.10 NAME 'homeDrive' + DESC 'NT homeDrive' + EQUALITY caseIgnoreIA5Match + SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{4} SINGLE-VALUE ) + +attributetype ( 1.3.6.1.4.1.7165.2.1.11 NAME 'scriptPath' + DESC 'NT scriptPath' + EQUALITY caseIgnoreIA5Match + SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{255} SINGLE-VALUE ) + +attributetype ( 1.3.6.1.4.1.7165.2.1.12 NAME 'profilePath' + DESC 'NT profilePath' + EQUALITY caseIgnoreIA5Match + SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{255} SINGLE-VALUE ) + +attributetype ( 1.3.6.1.4.1.7165.2.1.13 NAME 'userWorkstations' + DESC 'userWorkstations' + EQUALITY caseIgnoreIA5Match + SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{255} SINGLE-VALUE ) + +attributetype ( 1.3.6.1.4.1.7165.2.1.14 NAME 'rid' + DESC 'NT rid' + EQUALITY caseIgnoreIA5Match + SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{255} SINGLE-VALUE ) + +attributetype ( 1.3.6.1.4.1.7165.2.1.15 NAME 'primaryGroupID' + DESC 'NT Group RID' + EQUALITY caseIgnoreIA5Match + SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{255} SINGLE-VALUE ) + +attributetype ( 1.3.6.1.4.1.7165.2.1.16 NAME 'displayName' + DESC 'Friendly User Name' + SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{255} SINGLE-VALUE ) + +attributetype ( 1.3.6.1.4.1.7165.2.1.17 NAME 'smbHome' + DESC 'smbHome' + EQUALITY caseIgnoreIA5Match + SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{128} ) + +## +## The smbPasswordEntry objectclass has been depreciated in favor of the +## sambaAccount objectclass +## +#objectclass ( 1.3.1.5.1.4.1.7165.2.2.1 NAME 'smbPasswordEntry' SUP top AUXILIARY +# DESC 'Samba smbpasswd entry' +# MUST ( uid $ uidNumber ) +# MAY ( lmPassword $ ntPassword $ pwdLastSet $ acctFlags )) + +objectclass ( 1.3.1.5.1.4.1.7165.2.2.2 NAME 'sambaAccount' SUP top STRUCTURAL + DESC 'Samba Account' + MUST ( uid $ uidNumber ) + MAY ( cn $ gidNumber $ lmPassword $ ntPassword $ pwdLastSet $ logonTime $ + logoffTime $ kickoffTime $ pwdCanChange $ pwdMustChange $ acctFlags $ + displayName $ smbHome $ homeDrive $ scriptPath $ profilePath $ + description $ userWorkstations $ rid $ primaryGroupID )) diff --git a/examples/VFS/audit.c b/examples/VFS/audit.c index dc57b649406..ce2aa52250e 100644 --- a/examples/VFS/audit.c +++ b/examples/VFS/audit.c @@ -107,12 +107,11 @@ struct vfs_ops audit_ops = { /* VFS initialisation function. Return initialised vfs_ops structure back to SAMBA. */ -struct vfs_ops *vfs_init(void) +BOOL vfs_init(connection_struct *conn) { openlog("smbd_audit", LOG_PID, SYSLOG_FACILITY); - syslog(SYSLOG_PRIORITY, "VFS_INIT: &audit_ops: 0x%8.8x\n", - &audit_ops); - return(&audit_ops); + syslog(SYSLOG_PRIORITY, "VFS_INIT: vfs_ops loaded\n"); + return True; } /* Implementation of vfs_ops. Pass everything on to the default diff --git a/examples/VFS/skel.c b/examples/VFS/skel.c index 9bb84fe2b1c..65cb4bfe0d5 100644 --- a/examples/VFS/skel.c +++ b/examples/VFS/skel.c @@ -38,110 +38,21 @@ #include <includes.h> #include <vfs.h> -/* Function prototypes */ - - /* Disk operations */ - - int skel_connect(struct connection_struct *conn, char *service, char *user); void skel_disconnect(struct connection_struct *conn); - SMB_BIG_UINT skel_disk_free(struct connection_struct *conn, char *path, BOOL small_query, SMB_BIG_UINT *bsize, - SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize); - - /* Directory operations */ - - DIR *skel_opendir(struct connection_struct *conn, char *fname); - struct dirent *skel_readdir(struct connection_struct *conn, DIR *dirp); - int skel_mkdir(struct connection_struct *conn, char *path, mode_t mode); - int skel_rmdir(struct connection_struct *conn, char *path); - int skel_closedir(struct connection_struct *conn, DIR *dir); - - /* File operations */ - - int skel_open(struct connection_struct *conn, char *fname, int flags, mode_t mode); - int skel_close(struct files_struct *fsp, int fd); - ssize_t skel_read(struct files_struct *fsp, int fd, char *data, size_t n); - ssize_t skel_write(struct files_struct *fsp, int fd, char *data, size_t n); - SMB_OFF_T skel_lseek(struct files_struct *fsp, int filedes, SMB_OFF_T offset, int whence); - int skel_rename(struct connection_struct *conn, char *old, char *new); - int skel_fsync(struct files_struct *fsp, int fd); - int skel_stat(struct connection_struct *conn, char *fname, SMB_STRUCT_STAT *sbuf); - int skel_fstat(struct files_struct *fsp, int fd, SMB_STRUCT_STAT *sbuf); - int skel_lstat(struct connection_struct *conn, char *path, SMB_STRUCT_STAT *sbuf); - int skel_unlink(struct connection_struct *conn, char *path); - int skel_chmod(struct connection_struct *conn, char *path, mode_t mode); - int skel_chown(struct connection_struct *conn, char *path, uid_t uid, gid_t gid); - int skel_chdir(struct connection_struct *conn, char *path); - char *skel_getwd(struct connection_struct *conn, char *buf); - int skel_utime(struct connection_struct *conn, char *path, struct utimbuf *times); - int skel_ftruncate(struct files_struct *fsp, int fd, SMB_OFF_T offset); - BOOL skel_lock(struct files_struct *fsp, int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type); - - /* NT file access control list operations */ - - size_t skel_fget_nt_acl(struct files_struct *fsp, int fd, struct security_descriptor_info **ppdesc); - size_t skel_get_nt_acl(struct files_struct *fsp, char *name, struct security_descriptor_info **ppdesc); - BOOL skel_fset_nt_acl(struct files_struct *fsp, int fd, uint32 security_info_sent, struct security_descriptor_info *psd); - BOOL skel_set_nt_acl(struct files_struct *fsp, char *name, uint32 security_info_sent, struct security_descriptor_info *psd); - - -/* VFS operations structure */ - -struct vfs_ops skel_ops = { - - /* Disk operations */ - - skel_connect, - skel_disconnect, - skel_disk_free, - - /* Directory operations */ - - skel_opendir, - skel_readdir, - skel_mkdir, - skel_rmdir, - skel_closedir, - - /* File operations */ - - skel_open, - skel_close, - skel_read, - skel_write, - skel_lseek, - skel_rename, - skel_fsync, - skel_stat, - skel_fstat, - skel_lstat, - skel_unlink, - skel_chmod, - skel_chown, - skel_chdir, - skel_getwd, - skel_utime, - skel_ftruncate, - skel_lock, +extern struct vfs_ops default_vfs_ops; /* For passthrough operation */ +struct vfs_ops skel_ops; - /* NT File ACL operations */ - skel_fget_nt_acl, - skel_get_nt_acl, - skel_fset_nt_acl, - skel_set_nt_acl -}; /* VFS initialisation - return vfs_ops function pointer structure */ -struct vfs_ops *vfs_init(int *vfs_version) +BOOL vfs_init(connection_struct *conn) { - *vfs_version = SMB_VFS_INTERFACE_VERSION; - return(&skel_ops); + DEBUG(3, ("Initialising default vfs hooks\n")); + + memcpy(&conn->vfs_ops, &skel_ops, sizeof(struct vfs_ops)); + return True; } -/* Implementation of VFS functions. Insert your useful stuff here */ - -extern struct vfs_ops default_vfs_ops; /* For passthrough operation */ - int skel_connect(struct connection_struct *conn, char *service, char *user) { return default_vfs_ops.connect(conn, service, user); @@ -245,11 +156,21 @@ int skel_chmod(struct connection_struct *conn, char *path, mode_t mode) return default_vfs_ops.chmod(conn, path, mode); } +int skel_fchmod(struct files_struct *fsp, int fd, mode_t mode) +{ + return default_vfs_ops.fchmod(fsp, fd, mode); +} + int skel_chown(struct connection_struct *conn, char *path, uid_t uid, gid_t gid) { return default_vfs_ops.chown(conn, path, uid, gid); } +int skel_fchown(struct files_struct *fsp, int fd, uid_t uid, gid_t gid) +{ + return default_vfs_ops.fchown(fsp, fd, uid, gid); +} + int skel_chdir(struct connection_struct *conn, char *path) { return default_vfs_ops.chdir(conn, path); @@ -275,6 +196,16 @@ BOOL skel_lock(struct files_struct *fsp, int fd, int op, SMB_OFF_T offset, SMB_O return default_vfs_ops.lock(fsp, fd, op, offset, count, type); } +BOOL skel_symlink(struct connection_struct *conn, const char *oldpath, const char *newpath) +{ + return default_vfs_ops.symlink(conn, oldpath, newpath); +} + +BOOL skel_readlink(struct connection_struct *conn, const char *path, char *buf, size_t bufsiz) +{ + return default_vfs_ops.readlink(conn, path, buf, bufsiz); +} + size_t skel_fget_nt_acl(struct files_struct *fsp, int fd, struct security_descriptor_info **ppdesc) { return default_vfs_ops.fget_nt_acl(fsp, fd, ppdesc); @@ -295,3 +226,67 @@ BOOL skel_set_nt_acl(struct files_struct *fsp, char *name, uint32 security_info_ return default_vfs_ops.set_nt_acl(fsp, name, security_info_sent, psd); } +BOOL skel_chmod_acl(struct connection_struct *conn, char *name, mode_t mode) +{ + return default_vfs_ops.chmod_acl(conn, name, mode); +} + +BOOL skel_fchmod_acl(struct files_struct *fsp, int fd, mode_t mode) +{ + return default_vfs_ops.fchmod_acl(fsp, fd, mode); +} + + +/* VFS operations structure */ + +struct vfs_ops skel_ops = { + + /* Disk operations */ + + skel_connect, + skel_disconnect, + skel_disk_free, + + /* Directory operations */ + + skel_opendir, + skel_readdir, + skel_mkdir, + skel_rmdir, + skel_closedir, + + /* File operations */ + + skel_open, + skel_close, + skel_read, + skel_write, + skel_lseek, + skel_rename, + skel_fsync, + skel_stat, + skel_fstat, + skel_lstat, + skel_unlink, + skel_chmod, + skel_fchmod, + skel_chown, + skel_fchown, + skel_chdir, + skel_getwd, + skel_utime, + skel_ftruncate, + skel_lock, + skel_symlink, + skel_readlink, + + /* NT File ACL operations */ + + skel_fget_nt_acl, + skel_get_nt_acl, + skel_fset_nt_acl, + skel_set_nt_acl, + + skel_chmod_acl, + skel_fchmod_acl +}; |