From 18b31bce9710580355f7d3447f2f1849acb26c0c Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Thu, 3 Feb 2000 04:40:56 +0000 Subject: Some strange CVS weirdness happening here. I had SAMBA_TNG tags in my head branch CVS/Entries file leading to lots of fun and games. )-: (This used to be commit bb07eceddb0552ff17ba9db94ae81f58226be4b5) --- examples/VFS/.cvsignore | 1 + examples/VFS/Makefile | 21 +++++ examples/VFS/README | 31 +++++++ examples/VFS/audit.c | 208 ++++++++++++++++++++++++++++++++++++++++++++ examples/VFS/skel.c | 225 ++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 486 insertions(+) create mode 100644 examples/VFS/.cvsignore create mode 100644 examples/VFS/Makefile create mode 100644 examples/VFS/README create mode 100644 examples/VFS/audit.c create mode 100644 examples/VFS/skel.c (limited to 'examples/VFS') diff --git a/examples/VFS/.cvsignore b/examples/VFS/.cvsignore new file mode 100644 index 0000000000..9c0e66ecaf --- /dev/null +++ b/examples/VFS/.cvsignore @@ -0,0 +1 @@ +.libs diff --git a/examples/VFS/Makefile b/examples/VFS/Makefile new file mode 100644 index 0000000000..fb9976893b --- /dev/null +++ b/examples/VFS/Makefile @@ -0,0 +1,21 @@ +# +# Makefile for samba-vfs examples +# +# $Id: Makefile,v 1.1 2000/02/03 04:40:56 tpot Exp $ +# + +# Variables + +SAMBA_SRC = ../../source + +CFLAGS = -I$(SAMBA_SRC)/include +CC = gcc + +VFS_OBJS = audit.o skel.o + +# Targets + +default: $(VFS_OBJS) + +clean: + rm -f core $(VFS_OBJS) *~ *% *.bak diff --git a/examples/VFS/README b/examples/VFS/README new file mode 100644 index 0000000000..dc7398892d --- /dev/null +++ b/examples/VFS/README @@ -0,0 +1,31 @@ +README for Samba Virtual File System (VFS) Examples +=================================================== + +This directory contains some sample code to demonstrate VFS +construction. The following VFS modules are given: + + skel + A skeleton VFS module. When used, this module simply + passes all requests back to the disk functions (i.e it + operates as a passthrough filter). It should be + useful as a starting point for developing new VFS + modules. + + audit + A simple module to audit file access to the syslog + facility. The following operations are logged: share + connect/disconnect, directory opens/create/remove, + file open/close/rename/unlink/chmod. + + streamer + Stream file writes to a network address instead of to + disk. + + perlfs + A wrapper for writing Samba VFS modules in Perl. + +The modules need only to be compiled with -I/samba/source/dir added to +CFLAGS. + +Further documentation on writing VFS modules for Samba can be found in +docs directory of the Samba source distribution. diff --git a/examples/VFS/audit.c b/examples/VFS/audit.c new file mode 100644 index 0000000000..3d84c579c7 --- /dev/null +++ b/examples/VFS/audit.c @@ -0,0 +1,208 @@ +/* + * Auditing VFS module for samba. Log select file operations to syslog + * facility. + * + * Copyright (C) Tim Potter, 1999 + * + * 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. + * + * $Id: audit.c,v 1.1 2000/02/03 04:40:56 tpot Exp $ + */ + +#include "config.h" +#include +#include +#ifdef HAVE_UTIME_H +#include +#endif +#ifdef HAVE_DIRENT_H +#include +#endif +#include +#ifdef HAVE_FCNTL_H +#include +#endif +#include +#include +#include + +#ifndef SYSLOG_FACILITY +#define SYSLOG_FACILITY LOG_USER +#endif + +#ifndef SYSLOG_PRIORITY +#define SYSLOG_PRIORITY LOG_NOTICE +#endif + +/* Function prototypes */ + +int audit_connect(struct vfs_connection_struct *conn, char *svc, char *user); +void audit_disconnect(void); +DIR *audit_opendir(char *fname); +int audit_mkdir(char *path, mode_t mode); +int audit_rmdir(char *path); +int audit_open(char *fname, int flags, mode_t mode); +int audit_close(int fd); +int audit_rename(char *old, char *new); +int audit_unlink(char *path); +int audit_chmod(char *path, mode_t mode); + +/* VFS operations */ + +extern struct vfs_ops default_vfs_ops; /* For passthrough operation */ + +struct vfs_ops audit_ops = { + + /* Disk operations */ + + audit_connect, + audit_disconnect, + NULL, /* disk free */ + + /* Directory operations */ + + audit_opendir, + NULL, /* readdir */ + audit_mkdir, + audit_rmdir, + NULL, /* closedir */ + + /* File operations */ + + audit_open, + audit_close, + NULL, /* read */ + NULL, /* write */ + NULL, /* lseek */ + audit_rename, + NULL, /* sync */ + NULL, /* stat */ + NULL, /* fstat */ + NULL, /* lstat */ + NULL, /* fcntl_lock */ + audit_unlink, + NULL, /* chmod */ + NULL /* utime */ +}; + +/* VFS initialisation function. Return initialised vfs_ops structure + back to SAMBA. */ + +struct vfs_ops *vfs_init(void) +{ + openlog("smbd_audit", LOG_PID, SYSLOG_FACILITY); + return(&audit_ops); +} + +/* Implementation of vfs_ops. Pass everything on to the default + operation but log event first. */ + +int audit_connect(struct vfs_connection_struct *conn, char *svc, char *user) +{ + syslog(SYSLOG_PRIORITY, "connect to service %s by user %s\n", svc, user); + + return default_vfs_ops.connect(conn, svc, user); +} + +void audit_disconnect(void) +{ + syslog(SYSLOG_PRIORITY, "disconnected\n"); + default_vfs_ops.disconnect(); +} + +DIR *audit_opendir(char *fname) +{ + DIR *result = default_vfs_ops.opendir(fname); + + syslog(SYSLOG_PRIORITY, "opendir %s %s%s\n", + fname, + (result == NULL) ? "failed: " : "", + (result == NULL) ? strerror(errno) : ""); + + return result; +} + +int audit_mkdir(char *path, mode_t mode) +{ + int result = default_vfs_ops.mkdir(path, mode); + + syslog(SYSLOG_PRIORITY, "mkdir %s %s%s\n", + path, + (result < 0) ? "failed: " : "", + (result < 0) ? strerror(errno) : ""); + + return result; +} + +int audit_rmdir(char *path) +{ + int result = default_vfs_ops.rmdir(path); + + syslog(SYSLOG_PRIORITY, "rmdir %s %s%s\n", + path, + (result < 0) ? "failed: " : "", + (result < 0) ? strerror(errno) : ""); + + return result; +} + +int audit_open(char *fname, int flags, mode_t mode) +{ + int result = default_vfs_ops.open(fname, flags, mode); + + syslog(SYSLOG_PRIORITY, "open %s (fd %d) %s%s%s\n", + fname, result, + ((mode & O_WRONLY) || (mode & O_RDWR)) ? "for writing " : "", + (result < 0) ? "failed: " : "", + (result < 0) ? strerror(errno) : ""); + + return result; +} + +int audit_close(int fd) +{ + int result = default_vfs_ops.close(fd); + + syslog(SYSLOG_PRIORITY, "close fd %d %s%s\n", + fd, + (result < 0) ? "failed: " : "", + (result < 0) ? strerror(errno) : ""); + + return result; +} + +int audit_rename(char *old, char *new) +{ + int result = default_vfs_ops.rename(old, new); + + syslog(SYSLOG_PRIORITY, "rename %s -> %s %s%s\n", + old, new, + (result < 0) ? "failed: " : "", + (result < 0) ? strerror(errno) : ""); + + return result; +} + +int audit_unlink(char *path) +{ + int result = default_vfs_ops.unlink(path); + + syslog(SYSLOG_PRIORITY, "unlink %s %s%s\n", + path, + (result < 0) ? "failed: " : "", + (result < 0) ? strerror(errno) : ""); + + return result; +} diff --git a/examples/VFS/skel.c b/examples/VFS/skel.c new file mode 100644 index 0000000000..fae2bc51df --- /dev/null +++ b/examples/VFS/skel.c @@ -0,0 +1,225 @@ +/* + * Skeleton VFS module. + * + * Copyright (C) Tim Potter, 1999 + * + * 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. + * + * $Id: skel.c,v 1.1 2000/02/03 04:40:56 tpot Exp $ + */ + +#include "config.h" + +#include +#include +#ifdef HAVE_UTIME_H +#include +#endif +#ifdef HAVE_DIRENT_H +#include +#endif +#ifdef HAVE_FCNTL_H +#include +#endif +#include +#include + +#include + +/* Function prototypes */ + +int skel_connect(struct vfs_connection_struct *conn, char *svc, char *user); +void skel_disconnect(void); +SMB_BIG_UINT skel_disk_free(char *path, SMB_BIG_UINT *bsize, + SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize); + +DIR *skel_opendir(char *fname); +struct dirent *skel_readdir(DIR *dirp); +int skel_mkdir(char *path, mode_t mode); +int skel_rmdir(char *path); +int skel_closedir(DIR *dir); + +int skel_open(char *fname, int flags, mode_t mode); +int skel_close(int fd); +ssize_t skel_read(int fd, char *data, size_t n); +ssize_t skel_write(int fd, char *data, size_t n); +SMB_OFF_T skel_lseek(int filedes, SMB_OFF_T offset, int whence); +int skel_rename(char *old, char *new); +void skel_sync(int fd); +int skel_stat(char *fname, SMB_STRUCT_STAT *sbuf); +int skel_fstat(int fd, SMB_STRUCT_STAT *sbuf); +int skel_lstat(char *path, SMB_STRUCT_STAT *sbuf); +BOOL skel_lock(int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type); +int skel_unlink(char *path); +int skel_chmod(char *path, mode_t mode); +int skel_utime(char *path, struct utimbuf *times); + +/* 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_sync, + skel_stat, + skel_fstat, + skel_lstat, + skel_lock, + skel_unlink, + skel_chmod, + skel_utime +}; + +/* VFS initialisation - return vfs_ops function pointer structure */ + +struct vfs_ops *vfs_init(void) +{ + return(&skel_ops); +} + +/* Implementation of VFS functions. Insert your useful stuff here */ + +extern struct vfs_ops default_vfs_ops; /* For passthrough operation */ + +int skel_connect(struct vfs_connection_struct *conn, char *svc, char *user) +{ + return default_vfs_ops.connect(conn, svc, user); +} + +void skel_disconnect(void) +{ + default_vfs_ops.disconnect(); +} + +SMB_BIG_UINT skel_disk_free(char *path, SMB_BIG_UINT *bsize, + SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize) +{ + return default_vfs_ops.disk_free(path, bsize, dfree, dsize); +} + +DIR *skel_opendir(char *fname) +{ + return default_vfs_ops.opendir(fname); +} + +struct dirent *skel_readdir(DIR *dirp) +{ + return default_vfs_ops.readdir(dirp); +} + +int skel_mkdir(char *path, mode_t mode) +{ + return default_vfs_ops.mkdir(path, mode); +} + +int skel_rmdir(char *path) +{ + return default_vfs_ops.rmdir(path); +} + +int skel_closedir(DIR *dir) +{ + return default_vfs_ops.closedir(dir); +} + +int skel_open(char *fname, int flags, mode_t mode) +{ + return default_vfs_ops.open(fname, flags, mode); +} + +int skel_close(int fd) +{ + return default_vfs_ops.close(fd); +} + +ssize_t skel_read(int fd, char *data, size_t n) +{ + return default_vfs_ops.read(fd, data, n); +} + +ssize_t skel_write(int fd, char *data, size_t n) +{ + return default_vfs_ops.write(fd, data, n); +} + +SMB_OFF_T skel_lseek(int filedes, SMB_OFF_T offset, int whence) +{ + return default_vfs_ops.lseek(filedes, offset, whence); +} + +int skel_rename(char *old, char *new) +{ + return default_vfs_ops.rename(old, new); +} + +void skel_sync(int fd) +{ + default_vfs_ops.sync(fd); +} + +int skel_stat(char *fname, SMB_STRUCT_STAT *sbuf) +{ + return default_vfs_ops.stat(fname, sbuf); +} + +int skel_fstat(int fd, SMB_STRUCT_STAT *sbuf) +{ + return default_vfs_ops.fstat(fd, sbuf); +} + +int skel_lstat(char *path, SMB_STRUCT_STAT *sbuf) +{ + return default_vfs_ops.lstat(path, sbuf); +} + +BOOL skel_lock(int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type) +{ + return default_vfs_ops.lock(fd, op, offset, count, type); +} + +int skel_unlink(char *path) +{ + return default_vfs_ops.unlink(path); +} + +int skel_chmod(char *path, mode_t mode) +{ + return default_vfs_ops.chmod(path, mode); +} + +int skel_utime(char *path, struct utimbuf *times) +{ + return default_vfs_ops.utime(path, times); +} -- cgit From 1546a4c683da043af4796acf47dd109c778e2e8a Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Fri, 4 Feb 2000 05:08:16 +0000 Subject: Hopefully these changes will actually stick. (This used to be commit a2782097db258a164bf43d814e8832a27d0eb3f1) --- examples/VFS/Makefile | 25 ++++++++++++++++++------- examples/VFS/README | 18 +++++++++++------- examples/VFS/audit.c | 13 ++++++------- examples/VFS/skel.c | 25 +++++++++---------------- 4 files changed, 44 insertions(+), 37 deletions(-) (limited to 'examples/VFS') diff --git a/examples/VFS/Makefile b/examples/VFS/Makefile index fb9976893b..c4c9479c7d 100644 --- a/examples/VFS/Makefile +++ b/examples/VFS/Makefile @@ -1,21 +1,32 @@ # # Makefile for samba-vfs examples # -# $Id: Makefile,v 1.1 2000/02/03 04:40:56 tpot Exp $ +# $Id: Makefile,v 1.2 2000/02/04 05:08:16 tpot Exp $ # # Variables -SAMBA_SRC = ../../source - -CFLAGS = -I$(SAMBA_SRC)/include CC = gcc +LIBTOOL = libtool -VFS_OBJS = audit.o skel.o +SAMBA_SRC = ../../source/include +CFLAGS = -I$(SAMBA_SRC) +VFS_OBJS = audit.so skel.so -# Targets +# Default target default: $(VFS_OBJS) +# Pattern rules + +%.so: %.lo + $(LIBTOOL) $(CC) -shared -o $@ $< $(LDFLAGS) + +%.lo: %.c + $(LIBTOOL) $(CC) $(CPPFLAGS) $(CFLAGS) -c $< + +# Misc targets + clean: - rm -f core $(VFS_OBJS) *~ *% *.bak + rm -rf .libs + rm -f core $(VFS_OBJS) $(VFS_OBJS:.so=.lo) *~ *% *.bak diff --git a/examples/VFS/README b/examples/VFS/README index dc7398892d..c2f39f9727 100644 --- a/examples/VFS/README +++ b/examples/VFS/README @@ -17,15 +17,19 @@ construction. The following VFS modules are given: connect/disconnect, directory opens/create/remove, file open/close/rename/unlink/chmod. - streamer - Stream file writes to a network address instead of to - disk. +The libtool program, available from your favourite GNU software +archive, is required to compile these programs. - perlfs - A wrapper for writing Samba VFS modules in Perl. +To use the VFS modules, create a share similar to the one below. The +important parameter is the 'vfs object' parameter which must point to +the exact pathname of the shared library object. -The modules need only to be compiled with -I/samba/source/dir added to -CFLAGS. + [audit] + comment = Audited /data directory + path = /data + vfs object = /path/to/audit.so + writeable = yes + browseable = yes Further documentation on writing VFS modules for Samba can be found in docs directory of the Samba source distribution. diff --git a/examples/VFS/audit.c b/examples/VFS/audit.c index 3d84c579c7..8f0aaac4be 100644 --- a/examples/VFS/audit.c +++ b/examples/VFS/audit.c @@ -2,7 +2,7 @@ * Auditing VFS module for samba. Log select file operations to syslog * facility. * - * Copyright (C) Tim Potter, 1999 + * Copyright (C) Tim Potter, 1999-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 @@ -18,7 +18,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * - * $Id: audit.c,v 1.1 2000/02/03 04:40:56 tpot Exp $ + * $Id: audit.c,v 1.2 2000/02/04 05:08:16 tpot Exp $ */ #include "config.h" @@ -83,15 +83,14 @@ struct vfs_ops audit_ops = { audit_open, audit_close, - NULL, /* read */ + NULL, /* read */ NULL, /* write */ NULL, /* lseek */ audit_rename, - NULL, /* sync */ - NULL, /* stat */ + NULL, /* fsync */ + NULL, /* stat */ NULL, /* fstat */ NULL, /* lstat */ - NULL, /* fcntl_lock */ audit_unlink, NULL, /* chmod */ NULL /* utime */ @@ -164,7 +163,7 @@ int audit_open(char *fname, int flags, mode_t mode) syslog(SYSLOG_PRIORITY, "open %s (fd %d) %s%s%s\n", fname, result, - ((mode & O_WRONLY) || (mode & O_RDWR)) ? "for writing " : "", + ((flags & O_WRONLY) || (flags & O_RDWR)) ? "for writing " : "", (result < 0) ? "failed: " : "", (result < 0) ? strerror(errno) : ""); diff --git a/examples/VFS/skel.c b/examples/VFS/skel.c index fae2bc51df..da5ef7b310 100644 --- a/examples/VFS/skel.c +++ b/examples/VFS/skel.c @@ -1,7 +1,7 @@ /* * Skeleton VFS module. * - * Copyright (C) Tim Potter, 1999 + * Copyright (C) Tim Potter, 1999-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 @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * - * $Id: skel.c,v 1.1 2000/02/03 04:40:56 tpot Exp $ + * $Id: skel.c,v 1.2 2000/02/04 05:08:16 tpot Exp $ */ #include "config.h" @@ -42,7 +42,7 @@ int skel_connect(struct vfs_connection_struct *conn, char *svc, char *user); void skel_disconnect(void); -SMB_BIG_UINT skel_disk_free(char *path, SMB_BIG_UINT *bsize, +SMB_BIG_UINT skel_disk_free(char *path, BOOL smallquery, SMB_BIG_UINT *bsize, SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize); DIR *skel_opendir(char *fname); @@ -57,11 +57,10 @@ ssize_t skel_read(int fd, char *data, size_t n); ssize_t skel_write(int fd, char *data, size_t n); SMB_OFF_T skel_lseek(int filedes, SMB_OFF_T offset, int whence); int skel_rename(char *old, char *new); -void skel_sync(int fd); +void skel_fsync(int fd); int skel_stat(char *fname, SMB_STRUCT_STAT *sbuf); int skel_fstat(int fd, SMB_STRUCT_STAT *sbuf); int skel_lstat(char *path, SMB_STRUCT_STAT *sbuf); -BOOL skel_lock(int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type); int skel_unlink(char *path); int skel_chmod(char *path, mode_t mode); int skel_utime(char *path, struct utimbuf *times); @@ -92,11 +91,10 @@ struct vfs_ops skel_ops = { skel_write, skel_lseek, skel_rename, - skel_sync, + skel_fsync, skel_stat, skel_fstat, skel_lstat, - skel_lock, skel_unlink, skel_chmod, skel_utime @@ -123,10 +121,10 @@ void skel_disconnect(void) default_vfs_ops.disconnect(); } -SMB_BIG_UINT skel_disk_free(char *path, SMB_BIG_UINT *bsize, +SMB_BIG_UINT skel_disk_free(char *path, BOOL small_query, SMB_BIG_UINT *bsize, SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize) { - return default_vfs_ops.disk_free(path, bsize, dfree, dsize); + return default_vfs_ops.disk_free(path, small_query, bsize, dfree, dsize); } DIR *skel_opendir(char *fname) @@ -184,9 +182,9 @@ int skel_rename(char *old, char *new) return default_vfs_ops.rename(old, new); } -void skel_sync(int fd) +void skel_fsync(int fd) { - default_vfs_ops.sync(fd); + default_vfs_ops.fsync(fd); } int skel_stat(char *fname, SMB_STRUCT_STAT *sbuf) @@ -204,11 +202,6 @@ int skel_lstat(char *path, SMB_STRUCT_STAT *sbuf) return default_vfs_ops.lstat(path, sbuf); } -BOOL skel_lock(int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type) -{ - return default_vfs_ops.lock(fd, op, offset, count, type); -} - int skel_unlink(char *path) { return default_vfs_ops.unlink(path); -- cgit From a5ef1a71aae21b871a725d4e6e89cea201f1dcba Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Wed, 5 Apr 2000 22:41:42 +0000 Subject: Improved clean target. (This used to be commit facdfd319de59be4dd9b500202d33a2f3853c2c6) --- examples/VFS/Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'examples/VFS') diff --git a/examples/VFS/Makefile b/examples/VFS/Makefile index c4c9479c7d..bb0c307fe9 100644 --- a/examples/VFS/Makefile +++ b/examples/VFS/Makefile @@ -1,7 +1,7 @@ # # Makefile for samba-vfs examples # -# $Id: Makefile,v 1.2 2000/02/04 05:08:16 tpot Exp $ +# $Id: Makefile,v 1.3 2000/04/05 22:41:42 tpot Exp $ # # Variables @@ -29,4 +29,5 @@ default: $(VFS_OBJS) clean: rm -rf .libs - rm -f core $(VFS_OBJS) $(VFS_OBJS:.so=.lo) *~ *% *.bak + rm -f core *~ *% *.bak \ + $(VFS_OBJS) $(VFS_OBJS:.so=.o) $(VFS_OBJS:.so=.lo) -- cgit From bfbbd1ad9dc7a7c7fdb9804b70b47a62c8ce5b0b Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Wed, 5 Apr 2000 22:42:06 +0000 Subject: Added *.so (This used to be commit e6d11483e2187d8f794f38f5687758f2a2f0b0e6) --- examples/VFS/.cvsignore | 1 + 1 file changed, 1 insertion(+) (limited to 'examples/VFS') diff --git a/examples/VFS/.cvsignore b/examples/VFS/.cvsignore index 9c0e66ecaf..0b0923a496 100644 --- a/examples/VFS/.cvsignore +++ b/examples/VFS/.cvsignore @@ -1 +1,2 @@ .libs +*.so -- cgit From b61dc7f051b32034a10483f1fe315bee6d6a87e9 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Wed, 5 Apr 2000 22:42:26 +0000 Subject: fsync() returns an int rather than void. (This used to be commit 26972823cf66aa8c4e61af9b208707c11c8b8ac6) --- examples/VFS/skel.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'examples/VFS') diff --git a/examples/VFS/skel.c b/examples/VFS/skel.c index da5ef7b310..1873e4a479 100644 --- a/examples/VFS/skel.c +++ b/examples/VFS/skel.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * - * $Id: skel.c,v 1.2 2000/02/04 05:08:16 tpot Exp $ + * $Id: skel.c,v 1.3 2000/04/05 22:42:26 tpot Exp $ */ #include "config.h" @@ -57,7 +57,7 @@ ssize_t skel_read(int fd, char *data, size_t n); ssize_t skel_write(int fd, char *data, size_t n); SMB_OFF_T skel_lseek(int filedes, SMB_OFF_T offset, int whence); int skel_rename(char *old, char *new); -void skel_fsync(int fd); +int skel_fsync(int fd); int skel_stat(char *fname, SMB_STRUCT_STAT *sbuf); int skel_fstat(int fd, SMB_STRUCT_STAT *sbuf); int skel_lstat(char *path, SMB_STRUCT_STAT *sbuf); @@ -182,7 +182,7 @@ int skel_rename(char *old, char *new) return default_vfs_ops.rename(old, new); } -void skel_fsync(int fd) +int skel_fsync(int fd) { default_vfs_ops.fsync(fd); } -- cgit From 2b15e8a33efeb14d2132a32396537d144d2f0a2c Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Wed, 17 May 2000 02:48:04 +0000 Subject: Updated VFS examples to use ftruncate() and lock() functions. (This used to be commit def0da145aa8b804b75b0f35bdd4a809a2a806fc) --- examples/VFS/audit.c | 163 ++++++++++++++++++++++++++------------------------- examples/VFS/skel.c | 122 +++++++++++++++++++++----------------- 2 files changed, 150 insertions(+), 135 deletions(-) (limited to 'examples/VFS') diff --git a/examples/VFS/audit.c b/examples/VFS/audit.c index 8f0aaac4be..036438e90e 100644 --- a/examples/VFS/audit.c +++ b/examples/VFS/audit.c @@ -1,5 +1,5 @@ /* - * Auditing VFS module for samba. Log select file operations to syslog + * Auditing VFS module for samba. Log selected file operations to syslog * facility. * * Copyright (C) Tim Potter, 1999-2000 @@ -17,8 +17,6 @@ * 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. - * - * $Id: audit.c,v 1.2 2000/02/04 05:08:16 tpot Exp $ */ #include "config.h" @@ -65,35 +63,37 @@ extern struct vfs_ops default_vfs_ops; /* For passthrough operation */ struct vfs_ops audit_ops = { - /* Disk operations */ - - audit_connect, - audit_disconnect, - NULL, /* disk free */ - - /* Directory operations */ - - audit_opendir, - NULL, /* readdir */ - audit_mkdir, - audit_rmdir, - NULL, /* closedir */ - - /* File operations */ - - audit_open, - audit_close, - NULL, /* read */ - NULL, /* write */ - NULL, /* lseek */ - audit_rename, - NULL, /* fsync */ - NULL, /* stat */ - NULL, /* fstat */ - NULL, /* lstat */ - audit_unlink, - NULL, /* chmod */ - NULL /* utime */ + /* Disk operations */ + + audit_connect, + audit_disconnect, + NULL, /* disk free */ + + /* Directory operations */ + + audit_opendir, + NULL, /* readdir */ + audit_mkdir, + audit_rmdir, + NULL, /* closedir */ + + /* File operations */ + + audit_open, + audit_close, + NULL, /* read */ + NULL, /* write */ + NULL, /* lseek */ + audit_rename, + NULL, /* fsync */ + NULL, /* stat */ + NULL, /* fstat */ + NULL, /* lstat */ + audit_unlink, + NULL, /* chmod */ + NULL, /* utime */ + NULL, /* ftruncate */ + NULL /* lock */ }; /* VFS initialisation function. Return initialised vfs_ops structure @@ -101,8 +101,8 @@ struct vfs_ops audit_ops = { struct vfs_ops *vfs_init(void) { - openlog("smbd_audit", LOG_PID, SYSLOG_FACILITY); - return(&audit_ops); + openlog("smbd_audit", LOG_PID, SYSLOG_FACILITY); + return(&audit_ops); } /* Implementation of vfs_ops. Pass everything on to the default @@ -110,98 +110,99 @@ struct vfs_ops *vfs_init(void) int audit_connect(struct vfs_connection_struct *conn, char *svc, char *user) { - syslog(SYSLOG_PRIORITY, "connect to service %s by user %s\n", svc, user); + syslog(SYSLOG_PRIORITY, "connect to service %s by user %s\n", + svc, user); - return default_vfs_ops.connect(conn, svc, user); + return default_vfs_ops.connect(conn, svc, user); } void audit_disconnect(void) { - syslog(SYSLOG_PRIORITY, "disconnected\n"); - default_vfs_ops.disconnect(); + syslog(SYSLOG_PRIORITY, "disconnected\n"); + default_vfs_ops.disconnect(); } DIR *audit_opendir(char *fname) { - DIR *result = default_vfs_ops.opendir(fname); + DIR *result = default_vfs_ops.opendir(fname); - syslog(SYSLOG_PRIORITY, "opendir %s %s%s\n", - fname, - (result == NULL) ? "failed: " : "", - (result == NULL) ? strerror(errno) : ""); + syslog(SYSLOG_PRIORITY, "opendir %s %s%s\n", + fname, + (result == NULL) ? "failed: " : "", + (result == NULL) ? strerror(errno) : ""); - return result; + return result; } int audit_mkdir(char *path, mode_t mode) { - int result = default_vfs_ops.mkdir(path, mode); + int result = default_vfs_ops.mkdir(path, mode); - syslog(SYSLOG_PRIORITY, "mkdir %s %s%s\n", - path, - (result < 0) ? "failed: " : "", - (result < 0) ? strerror(errno) : ""); + syslog(SYSLOG_PRIORITY, "mkdir %s %s%s\n", + path, + (result < 0) ? "failed: " : "", + (result < 0) ? strerror(errno) : ""); - return result; + return result; } int audit_rmdir(char *path) { - int result = default_vfs_ops.rmdir(path); + int result = default_vfs_ops.rmdir(path); - syslog(SYSLOG_PRIORITY, "rmdir %s %s%s\n", - path, - (result < 0) ? "failed: " : "", - (result < 0) ? strerror(errno) : ""); + syslog(SYSLOG_PRIORITY, "rmdir %s %s%s\n", + path, + (result < 0) ? "failed: " : "", + (result < 0) ? strerror(errno) : ""); - return result; + return result; } int audit_open(char *fname, int flags, mode_t mode) { - int result = default_vfs_ops.open(fname, flags, mode); + int result = default_vfs_ops.open(fname, flags, mode); - syslog(SYSLOG_PRIORITY, "open %s (fd %d) %s%s%s\n", - fname, result, - ((flags & O_WRONLY) || (flags & O_RDWR)) ? "for writing " : "", - (result < 0) ? "failed: " : "", - (result < 0) ? strerror(errno) : ""); + syslog(SYSLOG_PRIORITY, "open %s (fd %d) %s%s%s\n", + fname, result, + ((flags & O_WRONLY) || (flags & O_RDWR)) ? "for writing " : "", + (result < 0) ? "failed: " : "", + (result < 0) ? strerror(errno) : ""); - return result; + return result; } int audit_close(int fd) { - int result = default_vfs_ops.close(fd); + int result = default_vfs_ops.close(fd); - syslog(SYSLOG_PRIORITY, "close fd %d %s%s\n", - fd, - (result < 0) ? "failed: " : "", - (result < 0) ? strerror(errno) : ""); + syslog(SYSLOG_PRIORITY, "close fd %d %s%s\n", + fd, + (result < 0) ? "failed: " : "", + (result < 0) ? strerror(errno) : ""); - return result; + return result; } int audit_rename(char *old, char *new) { - int result = default_vfs_ops.rename(old, new); + int result = default_vfs_ops.rename(old, new); - syslog(SYSLOG_PRIORITY, "rename %s -> %s %s%s\n", - old, new, - (result < 0) ? "failed: " : "", - (result < 0) ? strerror(errno) : ""); + syslog(SYSLOG_PRIORITY, "rename %s -> %s %s%s\n", + old, new, + (result < 0) ? "failed: " : "", + (result < 0) ? strerror(errno) : ""); - return result; + return result; } int audit_unlink(char *path) { - int result = default_vfs_ops.unlink(path); + int result = default_vfs_ops.unlink(path); - syslog(SYSLOG_PRIORITY, "unlink %s %s%s\n", - path, - (result < 0) ? "failed: " : "", - (result < 0) ? strerror(errno) : ""); + syslog(SYSLOG_PRIORITY, "unlink %s %s%s\n", + path, + (result < 0) ? "failed: " : "", + (result < 0) ? strerror(errno) : ""); - return result; + return result; } diff --git a/examples/VFS/skel.c b/examples/VFS/skel.c index 1873e4a479..90f16f952f 100644 --- a/examples/VFS/skel.c +++ b/examples/VFS/skel.c @@ -1,5 +1,6 @@ /* - * Skeleton VFS module. + * Skeleton VFS module. Implements passthrough operation of all VFS + * calls to disk functions. * * Copyright (C) Tim Potter, 1999-2000 * @@ -16,8 +17,6 @@ * 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. - * - * $Id: skel.c,v 1.3 2000/04/05 22:42:26 tpot Exp $ */ #include "config.h" @@ -64,47 +63,51 @@ int skel_lstat(char *path, SMB_STRUCT_STAT *sbuf); int skel_unlink(char *path); int skel_chmod(char *path, mode_t mode); int skel_utime(char *path, struct utimbuf *times); +int skel_ftruncate(int fd, SMB_OFF_T offset); +BOOL skel_lock(int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type); /* 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_utime + /* 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_utime, + skel_ftruncate, + skel_lock }; /* VFS initialisation - return vfs_ops function pointer structure */ struct vfs_ops *vfs_init(void) { - return(&skel_ops); + return(&skel_ops); } /* Implementation of VFS functions. Insert your useful stuff here */ @@ -113,106 +116,117 @@ extern struct vfs_ops default_vfs_ops; /* For passthrough operation */ int skel_connect(struct vfs_connection_struct *conn, char *svc, char *user) { - return default_vfs_ops.connect(conn, svc, user); + return default_vfs_ops.connect(conn, svc, user); } void skel_disconnect(void) { - default_vfs_ops.disconnect(); + default_vfs_ops.disconnect(); } SMB_BIG_UINT skel_disk_free(char *path, BOOL small_query, SMB_BIG_UINT *bsize, SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize) { - return default_vfs_ops.disk_free(path, small_query, bsize, dfree, dsize); + return default_vfs_ops.disk_free(path, small_query, bsize, + dfree, dsize); } DIR *skel_opendir(char *fname) { - return default_vfs_ops.opendir(fname); + return default_vfs_ops.opendir(fname); } struct dirent *skel_readdir(DIR *dirp) { - return default_vfs_ops.readdir(dirp); + return default_vfs_ops.readdir(dirp); } int skel_mkdir(char *path, mode_t mode) { - return default_vfs_ops.mkdir(path, mode); + return default_vfs_ops.mkdir(path, mode); } int skel_rmdir(char *path) { - return default_vfs_ops.rmdir(path); + return default_vfs_ops.rmdir(path); } int skel_closedir(DIR *dir) { - return default_vfs_ops.closedir(dir); + return default_vfs_ops.closedir(dir); } int skel_open(char *fname, int flags, mode_t mode) { - return default_vfs_ops.open(fname, flags, mode); + return default_vfs_ops.open(fname, flags, mode); } int skel_close(int fd) { - return default_vfs_ops.close(fd); + return default_vfs_ops.close(fd); } ssize_t skel_read(int fd, char *data, size_t n) { - return default_vfs_ops.read(fd, data, n); + return default_vfs_ops.read(fd, data, n); } ssize_t skel_write(int fd, char *data, size_t n) { - return default_vfs_ops.write(fd, data, n); + return default_vfs_ops.write(fd, data, n); } SMB_OFF_T skel_lseek(int filedes, SMB_OFF_T offset, int whence) { - return default_vfs_ops.lseek(filedes, offset, whence); + return default_vfs_ops.lseek(filedes, offset, whence); } int skel_rename(char *old, char *new) { - return default_vfs_ops.rename(old, new); + return default_vfs_ops.rename(old, new); } int skel_fsync(int fd) { - default_vfs_ops.fsync(fd); + return default_vfs_ops.fsync(fd); } int skel_stat(char *fname, SMB_STRUCT_STAT *sbuf) { - return default_vfs_ops.stat(fname, sbuf); + return default_vfs_ops.stat(fname, sbuf); } int skel_fstat(int fd, SMB_STRUCT_STAT *sbuf) { - return default_vfs_ops.fstat(fd, sbuf); + return default_vfs_ops.fstat(fd, sbuf); } int skel_lstat(char *path, SMB_STRUCT_STAT *sbuf) { - return default_vfs_ops.lstat(path, sbuf); + return default_vfs_ops.lstat(path, sbuf); } int skel_unlink(char *path) { - return default_vfs_ops.unlink(path); + return default_vfs_ops.unlink(path); } int skel_chmod(char *path, mode_t mode) { - return default_vfs_ops.chmod(path, mode); + return default_vfs_ops.chmod(path, mode); } int skel_utime(char *path, struct utimbuf *times) { - return default_vfs_ops.utime(path, times); + return default_vfs_ops.utime(path, times); +} + +int skel_ftruncate(int fd, SMB_OFF_T offset) +{ + return default_vfs_ops.ftruncate(fd, offset); +} + +BOOL skel_lock(int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type) +{ + return default_vfs_ops.lock(fd, op, offset, count, type); } -- cgit From 5ba7235f0f3bd5ec08e3798795af0c56b1f0e5f5 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 6 Nov 2000 20:01:03 +0000 Subject: Fixes for sample VFS audit code from "Brad Sahr" . Jeremy. (This used to be commit 5d6dec3a94f496651a5f0643ab228c975911e6cd) --- examples/VFS/Makefile | 9 ++- examples/VFS/audit.c | 81 ++++++++++++------- examples/VFS/skel.c | 212 ++++++++++++++++++++++++++++++++------------------ 3 files changed, 196 insertions(+), 106 deletions(-) (limited to 'examples/VFS') diff --git a/examples/VFS/Makefile b/examples/VFS/Makefile index bb0c307fe9..581e1a06fb 100644 --- a/examples/VFS/Makefile +++ b/examples/VFS/Makefile @@ -1,7 +1,7 @@ # # Makefile for samba-vfs examples # -# $Id: Makefile,v 1.3 2000/04/05 22:41:42 tpot Exp $ +# $Id: Makefile,v 1.4 2000/11/06 20:01:03 jra Exp $ # # Variables @@ -9,8 +9,11 @@ CC = gcc LIBTOOL = libtool -SAMBA_SRC = ../../source/include -CFLAGS = -I$(SAMBA_SRC) +SAMBA_SRC = ../../source +SAMBA_INCL = ../../source/include +UBIQX_SRC = ../../source/ubiqx +SMBWR_SRC = ../../source/smbwrapper +CFLAGS = -I$(SAMBA_SRC) -I$(SAMBA_INCL) -I$(UBIQX_SRC) -I$(SMBWR_SRC) -Wall -g VFS_OBJS = audit.so skel.so # Default target diff --git a/examples/VFS/audit.c b/examples/VFS/audit.c index 036438e90e..dc57b64940 100644 --- a/examples/VFS/audit.c +++ b/examples/VFS/audit.c @@ -34,6 +34,7 @@ #endif #include #include +#include #include #ifndef SYSLOG_FACILITY @@ -46,16 +47,16 @@ /* Function prototypes */ -int audit_connect(struct vfs_connection_struct *conn, char *svc, char *user); -void audit_disconnect(void); -DIR *audit_opendir(char *fname); -int audit_mkdir(char *path, mode_t mode); -int audit_rmdir(char *path); -int audit_open(char *fname, int flags, mode_t mode); -int audit_close(int fd); -int audit_rename(char *old, char *new); -int audit_unlink(char *path); -int audit_chmod(char *path, mode_t mode); +int audit_connect(struct connection_struct *conn, char *svc, char *user); +void audit_disconnect(struct connection_struct *conn); +DIR *audit_opendir(struct connection_struct *conn, char *fname); +int audit_mkdir(struct connection_struct *conn, char *path, mode_t mode); +int audit_rmdir(struct connection_struct *conn, char *path); +int audit_open(struct connection_struct *conn, char *fname, int flags, mode_t mode); +int audit_close(struct files_struct *fsp, int fd); +int audit_rename(struct connection_struct *conn, char *old, char *new); +int audit_unlink(struct connection_struct *conn, char *path); +int audit_chmod(struct connection_struct *conn, char *path, mode_t mode); /* VFS operations */ @@ -90,10 +91,17 @@ struct vfs_ops audit_ops = { NULL, /* fstat */ NULL, /* lstat */ audit_unlink, - NULL, /* chmod */ + audit_chmod, + NULL, /* chown */ + NULL, /* chdir */ + NULL, /* getwd */ NULL, /* utime */ NULL, /* ftruncate */ - NULL /* lock */ + NULL, /* lock */ + NULL, /* fget_nt_acl */ + NULL, /* get_nt_acl */ + NULL, /* fset_nt_acl */ + NULL /* set_nt_acl */ }; /* VFS initialisation function. Return initialised vfs_ops structure @@ -102,13 +110,15 @@ struct vfs_ops audit_ops = { struct vfs_ops *vfs_init(void) { openlog("smbd_audit", LOG_PID, SYSLOG_FACILITY); + syslog(SYSLOG_PRIORITY, "VFS_INIT: &audit_ops: 0x%8.8x\n", + &audit_ops); return(&audit_ops); } /* Implementation of vfs_ops. Pass everything on to the default operation but log event first. */ -int audit_connect(struct vfs_connection_struct *conn, char *svc, char *user) +int audit_connect(struct connection_struct *conn, char *svc, char *user) { syslog(SYSLOG_PRIORITY, "connect to service %s by user %s\n", svc, user); @@ -116,15 +126,15 @@ int audit_connect(struct vfs_connection_struct *conn, char *svc, char *user) return default_vfs_ops.connect(conn, svc, user); } -void audit_disconnect(void) +void audit_disconnect(struct connection_struct *conn) { syslog(SYSLOG_PRIORITY, "disconnected\n"); - default_vfs_ops.disconnect(); + default_vfs_ops.disconnect(conn); } -DIR *audit_opendir(char *fname) +DIR *audit_opendir(struct connection_struct *conn, char *fname) { - DIR *result = default_vfs_ops.opendir(fname); + DIR *result = default_vfs_ops.opendir(conn, fname); syslog(SYSLOG_PRIORITY, "opendir %s %s%s\n", fname, @@ -134,9 +144,9 @@ DIR *audit_opendir(char *fname) return result; } -int audit_mkdir(char *path, mode_t mode) +int audit_mkdir(struct connection_struct *conn, char *path, mode_t mode) { - int result = default_vfs_ops.mkdir(path, mode); + int result = default_vfs_ops.mkdir(conn, path, mode); syslog(SYSLOG_PRIORITY, "mkdir %s %s%s\n", path, @@ -146,9 +156,9 @@ int audit_mkdir(char *path, mode_t mode) return result; } -int audit_rmdir(char *path) +int audit_rmdir(struct connection_struct *conn, char *path) { - int result = default_vfs_ops.rmdir(path); + int result = default_vfs_ops.rmdir(conn, path); syslog(SYSLOG_PRIORITY, "rmdir %s %s%s\n", path, @@ -158,9 +168,9 @@ int audit_rmdir(char *path) return result; } -int audit_open(char *fname, int flags, mode_t mode) +int audit_open(struct connection_struct *conn, char *fname, int flags, mode_t mode) { - int result = default_vfs_ops.open(fname, flags, mode); + int result = default_vfs_ops.open(conn, fname, flags, mode); syslog(SYSLOG_PRIORITY, "open %s (fd %d) %s%s%s\n", fname, result, @@ -171,9 +181,9 @@ int audit_open(char *fname, int flags, mode_t mode) return result; } -int audit_close(int fd) +int audit_close(struct files_struct *fsp, int fd) { - int result = default_vfs_ops.close(fd); + int result = default_vfs_ops.close(fsp, fd); syslog(SYSLOG_PRIORITY, "close fd %d %s%s\n", fd, @@ -183,9 +193,9 @@ int audit_close(int fd) return result; } -int audit_rename(char *old, char *new) +int audit_rename(struct connection_struct *conn, char *old, char *new) { - int result = default_vfs_ops.rename(old, new); + int result = default_vfs_ops.rename(conn, old, new); syslog(SYSLOG_PRIORITY, "rename %s -> %s %s%s\n", old, new, @@ -195,9 +205,9 @@ int audit_rename(char *old, char *new) return result; } -int audit_unlink(char *path) +int audit_unlink(struct connection_struct *conn, char *path) { - int result = default_vfs_ops.unlink(path); + int result = default_vfs_ops.unlink(conn, path); syslog(SYSLOG_PRIORITY, "unlink %s %s%s\n", path, @@ -206,3 +216,16 @@ int audit_unlink(char *path) return result; } + +int audit_chmod(struct connection_struct *conn, char *path, mode_t mode) +{ + int result = default_vfs_ops.chmod(conn, path, mode); + + syslog(SYSLOG_PRIORITY, "chmod %s mode 0x%x %s%s\n", + path, mode, + (result < 0) ? "failed: " : "", + (result < 0) ? strerror(errno) : ""); + + return result; +} + diff --git a/examples/VFS/skel.c b/examples/VFS/skel.c index 90f16f952f..d1ec5b9180 100644 --- a/examples/VFS/skel.c +++ b/examples/VFS/skel.c @@ -35,36 +35,53 @@ #include #include +#include #include /* Function prototypes */ -int skel_connect(struct vfs_connection_struct *conn, char *svc, char *user); -void skel_disconnect(void); -SMB_BIG_UINT skel_disk_free(char *path, BOOL smallquery, SMB_BIG_UINT *bsize, - SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize); - -DIR *skel_opendir(char *fname); -struct dirent *skel_readdir(DIR *dirp); -int skel_mkdir(char *path, mode_t mode); -int skel_rmdir(char *path); -int skel_closedir(DIR *dir); - -int skel_open(char *fname, int flags, mode_t mode); -int skel_close(int fd); -ssize_t skel_read(int fd, char *data, size_t n); -ssize_t skel_write(int fd, char *data, size_t n); -SMB_OFF_T skel_lseek(int filedes, SMB_OFF_T offset, int whence); -int skel_rename(char *old, char *new); -int skel_fsync(int fd); -int skel_stat(char *fname, SMB_STRUCT_STAT *sbuf); -int skel_fstat(int fd, SMB_STRUCT_STAT *sbuf); -int skel_lstat(char *path, SMB_STRUCT_STAT *sbuf); -int skel_unlink(char *path); -int skel_chmod(char *path, mode_t mode); -int skel_utime(char *path, struct utimbuf *times); -int skel_ftruncate(int fd, SMB_OFF_T offset); -BOOL skel_lock(int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type); + /* 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 */ @@ -98,9 +115,19 @@ struct vfs_ops skel_ops = { skel_lstat, skel_unlink, skel_chmod, + skel_chown, + skel_chdir, + skel_getwd, skel_utime, skel_ftruncate, - skel_lock + skel_lock, + + /* 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 */ @@ -114,119 +141,156 @@ struct vfs_ops *vfs_init(void) extern struct vfs_ops default_vfs_ops; /* For passthrough operation */ -int skel_connect(struct vfs_connection_struct *conn, char *svc, char *user) +int skel_connect(struct connection_struct *conn, char *service, char *user) { - return default_vfs_ops.connect(conn, svc, user); + return default_vfs_ops.connect(conn, service, user); } -void skel_disconnect(void) +void skel_disconnect(struct connection_struct *conn) { - default_vfs_ops.disconnect(); + default_vfs_ops.disconnect(conn); } -SMB_BIG_UINT skel_disk_free(char *path, BOOL small_query, SMB_BIG_UINT *bsize, - SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize) +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) { - return default_vfs_ops.disk_free(path, small_query, bsize, + return default_vfs_ops.disk_free(conn, path, small_query, bsize, dfree, dsize); } -DIR *skel_opendir(char *fname) +DIR *skel_opendir(struct connection_struct *conn, char *fname) { - return default_vfs_ops.opendir(fname); + return default_vfs_ops.opendir(conn, fname); } -struct dirent *skel_readdir(DIR *dirp) +struct dirent *skel_readdir(struct connection_struct *conn, DIR *dirp) { - return default_vfs_ops.readdir(dirp); + return default_vfs_ops.readdir(conn, dirp); } -int skel_mkdir(char *path, mode_t mode) +int skel_mkdir(struct connection_struct *conn, char *path, mode_t mode) { - return default_vfs_ops.mkdir(path, mode); + return default_vfs_ops.mkdir(conn, path, mode); } -int skel_rmdir(char *path) +int skel_rmdir(struct connection_struct *conn, char *path) { - return default_vfs_ops.rmdir(path); + return default_vfs_ops.rmdir(conn, path); } -int skel_closedir(DIR *dir) +int skel_closedir(struct connection_struct *conn, DIR *dir) { - return default_vfs_ops.closedir(dir); + return default_vfs_ops.closedir(conn, dir); } -int skel_open(char *fname, int flags, mode_t mode) +int skel_open(struct connection_struct *conn, char *fname, int flags, mode_t mode) { - return default_vfs_ops.open(fname, flags, mode); + return default_vfs_ops.open(conn, fname, flags, mode); } -int skel_close(int fd) +int skel_close(struct files_struct *fsp, int fd) { - return default_vfs_ops.close(fd); + return default_vfs_ops.close(fsp, fd); } -ssize_t skel_read(int fd, char *data, size_t n) +ssize_t skel_read(struct files_struct *fsp, int fd, char *data, size_t n) { - return default_vfs_ops.read(fd, data, n); + return default_vfs_ops.read(fsp, fd, data, n); } -ssize_t skel_write(int fd, char *data, size_t n) +ssize_t skel_write(struct files_struct *fsp, int fd, char *data, size_t n) { - return default_vfs_ops.write(fd, data, n); + return default_vfs_ops.write(fsp, fd, data, n); } -SMB_OFF_T skel_lseek(int filedes, SMB_OFF_T offset, int whence) +SMB_OFF_T skel_lseek(struct files_struct *fsp, int filedes, SMB_OFF_T offset, int whence) { - return default_vfs_ops.lseek(filedes, offset, whence); + return default_vfs_ops.lseek(fsp, filedes, offset, whence); } -int skel_rename(char *old, char *new) +int skel_rename(struct connection_struct *conn, char *old, char *new) { - return default_vfs_ops.rename(old, new); + return default_vfs_ops.rename(conn, old, new); } -int skel_fsync(int fd) +int skel_fsync(struct files_struct *fsp, int fd) { - return default_vfs_ops.fsync(fd); + return default_vfs_ops.fsync(fsp, fd); } -int skel_stat(char *fname, SMB_STRUCT_STAT *sbuf) +int skel_stat(struct connection_struct *conn, char *fname, SMB_STRUCT_STAT *sbuf) { - return default_vfs_ops.stat(fname, sbuf); + return default_vfs_ops.stat(conn, fname, sbuf); } -int skel_fstat(int fd, SMB_STRUCT_STAT *sbuf) +int skel_fstat(struct files_struct *fsp, int fd, SMB_STRUCT_STAT *sbuf) { - return default_vfs_ops.fstat(fd, sbuf); + return default_vfs_ops.fstat(fsp, fd, sbuf); } -int skel_lstat(char *path, SMB_STRUCT_STAT *sbuf) +int skel_lstat(struct connection_struct *conn, char *path, SMB_STRUCT_STAT *sbuf) { - return default_vfs_ops.lstat(path, sbuf); + return default_vfs_ops.lstat(conn, path, sbuf); } -int skel_unlink(char *path) +int skel_unlink(struct connection_struct *conn, char *path) { - return default_vfs_ops.unlink(path); + return default_vfs_ops.unlink(conn, path); } -int skel_chmod(char *path, mode_t mode) +int skel_chmod(struct connection_struct *conn, char *path, mode_t mode) { - return default_vfs_ops.chmod(path, mode); + return default_vfs_ops.chmod(conn, path, mode); } -int skel_utime(char *path, struct utimbuf *times) +int skel_chown(struct connection_struct *conn, char *path, uid_t uid, gid_t gid) { - return default_vfs_ops.utime(path, times); + return default_vfs_ops.chown(conn, path, uid, gid); } -int skel_ftruncate(int fd, SMB_OFF_T offset) +int skel_chdir(struct connection_struct *conn, char *path) { - return default_vfs_ops.ftruncate(fd, offset); + return default_vfs_ops.chdir(conn, path); } -BOOL skel_lock(int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type) +char *skel_getwd(struct connection_struct *conn, char *buf) { - return default_vfs_ops.lock(fd, op, offset, count, type); + return default_vfs_ops.getwd(conn, buf); } + +int skel_utime(struct connection_struct *conn, char *path, struct utimbuf *times) +{ + return default_vfs_ops.utime(conn, path, times); +} + +int skel_ftruncate(struct files_struct *fsp, int fd, SMB_OFF_T offset) +{ + return default_vfs_ops.ftruncate(fsp, fd, offset); +} + +BOOL skel_lock(struct files_struct *fsp, int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type) +{ + return default_vfs_ops.lock(fsp, fd, op, offset, count, type); +} + +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); +} + +size_t skel_get_nt_acl(struct files_struct *fsp, char *name, struct security_descriptor_info **ppdesc) +{ + return default_vfs_ops.get_nt_acl(fsp, name, ppdesc); +} + +BOOL skel_fset_nt_acl(struct files_struct *fsp, int fd, uint32 security_info_sent, struct security_descriptor_info *psd) +{ + return default_vfs_ops.fset_nt_acl(fsp, fd, security_info_sent, psd); +} + +BOOL skel_set_nt_acl(struct files_struct *fsp, char *name, uint32 security_info_sent, struct security_descriptor_info *psd) +{ + return default_vfs_ops.set_nt_acl(fsp, name, security_info_sent, psd); +} + -- cgit From aae30b679981e019aa36d83beff83d30b937a16d Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 6 Nov 2000 21:33:49 +0000 Subject: Added a VFS version return to init call. Allows smbd to fail an init if versions don't match. Jeremy. (This used to be commit b29ff816734c0424f69124feb316da13f2e094f7) --- examples/VFS/skel.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'examples/VFS') diff --git a/examples/VFS/skel.c b/examples/VFS/skel.c index d1ec5b9180..9bb84fe2b1 100644 --- a/examples/VFS/skel.c +++ b/examples/VFS/skel.c @@ -132,8 +132,9 @@ struct vfs_ops skel_ops = { /* VFS initialisation - return vfs_ops function pointer structure */ -struct vfs_ops *vfs_init(void) +struct vfs_ops *vfs_init(int *vfs_version) { + *vfs_version = SMB_VFS_INTERFACE_VERSION; return(&skel_ops); } -- cgit From 0c9a2cee9f31661750c31176bda204d9914e5cfc Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 16 May 2001 02:12:37 +0000 Subject: Added example vfs block example from Ronald Kuetemeier . Jeremy. (This used to be commit 0609cd3162173575d22fbd12c48e777a5b15553e) --- examples/VFS/block/Makefile | 37 +++ examples/VFS/block/block.c | 546 ++++++++++++++++++++++++++++++++++++ examples/VFS/block/samba-block.conf | 6 + examples/VFS/block/smb.conf | 13 + 4 files changed, 602 insertions(+) create mode 100644 examples/VFS/block/Makefile create mode 100644 examples/VFS/block/block.c create mode 100644 examples/VFS/block/samba-block.conf create mode 100644 examples/VFS/block/smb.conf (limited to 'examples/VFS') diff --git a/examples/VFS/block/Makefile b/examples/VFS/block/Makefile new file mode 100644 index 0000000000..dcc7c07793 --- /dev/null +++ b/examples/VFS/block/Makefile @@ -0,0 +1,37 @@ +# +# Makefile for samba-vfs examples +# +# + +# Variables + +CC = gcc +LIBTOOL = libtool + +SAMBA_SRC = /usr/local/src/samba/samba-2.2.0-ron/source +SAMBA_INCL = ${SAMBA_SRC}/include +UBIQX_SRC = ${SAMBA_SRC}/ubiqx +SMBWR_SRC = ${SAMBA_SRC}/smbwrapper +CFLAGS = -I$(SAMBA_SRC) -I$(SAMBA_INCL) -I$(UBIQX_SRC) -I$(SMBWR_SRC) -Wall -g -D_LARGEFILE63_SOURCE -D_GNU_SOURCE -fno-builtin + + +VFS_OBJS = block.so + +# Default target + +default: $(VFS_OBJS) + +# Pattern rules + +%.so: %.lo + $(LIBTOOL) $(CC) -shared -o $@ $< $(LDFLAGS) + +%.lo: %.c + $(LIBTOOL) $(CC) $(CPPFLAGS) $(CFLAGS) -c $< + +# Misc targets + +clean: + rm -rf .libs + rm -f core *~ *% *.bak \ + $(VFS_OBJS) $(VFS_OBJS:.so=.o) $(VFS_OBJS:.so=.lo) diff --git a/examples/VFS/block/block.c b/examples/VFS/block/block.c new file mode 100644 index 0000000000..3c4f736e84 --- /dev/null +++ b/examples/VFS/block/block.c @@ -0,0 +1,546 @@ +/* + * + * Block access from links to dev mount points specified in PARAMCONF file + * + * Copyright (C) Ronald Kuetemeier, 2001 + * + * 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. + */ + +#include "config.h" +#include +#include +#include +#include +#include +#include +#include +#include + + +#ifdef HAVE_UTIME_H +#include +#endif +#ifdef HAVE_DIRENT_H +#include +#endif +#include +#ifdef HAVE_FCNTL_H +#include +#endif + + +#include +#include + + + +DIR *block_opendir(struct connection_struct *conn, char *fname); +int block_connect(struct connection_struct *conn, char *service, char *user); +void block_disconnect(struct connection_struct *conn); + + +/* VFS operations */ + + +extern struct vfs_ops default_vfs_ops; /* For passthrough operation */ + +struct vfs_ops execute_vfs_ops = { + + /* Disk operations */ + + block_connect, + block_disconnect, + NULL, /* disk free */ + + /* Directory operations */ + + block_opendir, + NULL, /* readdir */ + NULL, + NULL, + NULL, /* closedir */ + + /* File operations */ + + NULL, + NULL, + NULL, /* read */ + NULL, /* write */ + NULL, /* lseek */ + NULL, + NULL, /* fsync */ + NULL, /* stat */ + NULL, /* fstat */ + NULL, /* lstat */ + NULL, + NULL, + NULL, + NULL, /* chown */ + NULL, + NULL, /* chdir */ + NULL, /* getwd */ + NULL, /* utime */ + NULL, /* ftruncate */ + NULL, /* lock */ + NULL, /* fget_nt_acl */ + NULL, /* get_nt_acl */ + NULL, /* fset_nt_acl */ + NULL, /* set_nt_acl */ + NULL, + NULL +}; + + +#ifndef PARAMCONF +#define PARAMCONF "/etc/samba-block.conf" +#endif + +extern BOOL pm_process(char *FileName, BOOL (*sfunc)(char *), BOOL(*pfunc)(char * , char *)); + +//functions + +BOOL enter_pblock_mount(char *dir); +BOOL get_section(char *sect); +BOOL get_parameter_value(char *param, char *value); +BOOL load_param(void); +BOOL search(struct stat *stat_buf); +BOOL dir_search(char *link, char *dir); +BOOL enter_pblock_dir(char *dir); + + + +typedef struct block_dir +{ + dev_t st_dev; + int str_len; + char *dir_name; + struct block_dir *next; +} block_dir; + + +static char *params[] = {"mount_point","dir_name"}; +enum { MOUNT_POINT , DIR_NAME }; + +static struct block_dir *pblock_mountp = NULL; +static struct block_dir *pblock_dir = NULL; + + + +/* + * Load the conf file into a table + */ + +BOOL load_param(void) +{ + + if ((pm_process(PARAMCONF,&get_section,&get_parameter_value)) == TRUE) + { + return TRUE; + + } + return FALSE; +} + + + +/* + * Enter the key and data into the list + * + */ + +BOOL enter_pblock_mount(char *dir) +{ + struct stat stat_buf; + static struct block_dir *tmp_pblock; + + + if((stat(dir,&stat_buf)) != 0) + { + return FALSE; + } + + if(pblock_mountp == NULL) + { + pblock_mountp = calloc(1, sizeof(block_dir)); + if( pblock_mountp == NULL) + { + return FALSE; + } + tmp_pblock = pblock_mountp; + tmp_pblock->next = NULL; + + }else + { + tmp_pblock->next = calloc(1, sizeof(block_dir)); + if(tmp_pblock->next == NULL) + { + return FALSE; + } + tmp_pblock = tmp_pblock->next; + tmp_pblock->next = NULL; + + } + + + tmp_pblock->st_dev = stat_buf.st_dev; + tmp_pblock->dir_name = strdup(dir); + + + return TRUE; + +} + + +/* + * Enter the key and data into the list + * + */ + +BOOL enter_pblock_dir(char *dir) +{ + static struct block_dir *tmp_pblock; + + + if(pblock_dir == NULL) + { + pblock_dir = calloc(1, sizeof(block_dir)); + if( pblock_dir == NULL) + { + return FALSE; + } + tmp_pblock = pblock_dir; + tmp_pblock->next = NULL; + + }else + { + tmp_pblock->next = calloc(1, sizeof(block_dir)); + if(tmp_pblock->next == NULL) + { + return FALSE; + } + tmp_pblock = tmp_pblock->next; + tmp_pblock->next = NULL; + + } + + + tmp_pblock->dir_name = strdup(dir); + tmp_pblock->str_len = strlen(dir); + + + return TRUE; + +} + + + + +/* + * Function callback for config section names + */ + +BOOL get_section(char *sect) +{ + return TRUE; +} + + + +/* + * Function callback for config parameter value pairs + * + */ + +BOOL get_parameter_value(char *param, char *value) +{ + int i = 0, maxargs = sizeof(params) / sizeof(char *); + + + for( i= 0; i < maxargs; i++) + { + if (strcmp(param,params[i]) == 0) + { + switch(i) + { + case MOUNT_POINT : + enter_pblock_mount(value); + break; + case DIR_NAME : + enter_pblock_dir(value); + break; + default : + break; + } + } + } + + return TRUE; + +} + + + + +/* VFS initialisation function. Return initialised vfs_ops structure + back to SAMBA. */ + +struct vfs_ops *vfs_init(int *vfs_version) +{ + *vfs_version = SMB_VFS_INTERFACE_VERSION; + + return(&execute_vfs_ops); +} + + +/* + * VFS connect and param file loading + */ + +int block_connect(struct connection_struct *conn, char *service, char *user) +{ + if((load_param()) == FALSE) + { + + return -1; + + } + + DEBUG(0,("%s connecting \n",conn->user)); + + return (default_vfs_ops.connect(conn, service,user)); +} + +/* + * Free allocated structures and disconnect + * + */ + + +void block_disconnect(struct connection_struct *conn) +{ + + struct block_dir *tmp_pblock = (pblock_mountp == NULL ? pblock_dir : pblock_mountp); + struct block_dir *free_pblock = NULL; + + while(tmp_pblock != NULL) + { + free(tmp_pblock->dir_name); + free_pblock = tmp_pblock; + tmp_pblock = tmp_pblock->next; + free(free_pblock); + + if(tmp_pblock == NULL && pblock_dir != NULL) + { + tmp_pblock = (pblock_mountp == NULL ? pblock_dir : NULL); + pblock_dir = NULL; + + } + + } + + + + default_vfs_ops.disconnect(conn); +} + +/* + * VFS opendir + */ + +DIR *block_opendir(struct connection_struct *conn, char *fname) +{ + + char *dir_name = NULL; + struct stat stat_buf; + + dir_name = alloca((strlen(conn->origpath) + strlen(fname) + 2) * sizeof(char)); + + pstrcpy(dir_name,conn->origpath); + pstrcat(dir_name, "/"); + strncat(dir_name, fname, strcspn(fname,"/")); + + if((lstat(dir_name,&stat_buf)) == 0) + { + if((S_ISLNK(stat_buf.st_mode)) == 1) + { + stat(dir_name,&stat_buf); + if((search(&stat_buf) || dir_search(dir_name, fname) ) == TRUE) + { + DEBUG(0,("%s used link to blocked dir: %s \n", conn->user, dir_name)); + errno = EACCES; + return NULL; + } + } + } + + return (default_vfs_ops.opendir(conn, fname)); +} + + +/* + * Find mount point to block in list + */ + +BOOL search(struct stat *stat_buf) +{ + struct block_dir *tmp_pblock = pblock_mountp; + + while(tmp_pblock != NULL) + { + + if(tmp_pblock->st_dev == stat_buf->st_dev) + { + return TRUE; + } + tmp_pblock = tmp_pblock->next; + } + + return FALSE; + +} + +/* + * Find dir in list to block id the starting point is link from a share + */ + +BOOL dir_search(char *link, char *dir) +{ + char buf[PATH_MAX +1], *ext_path; + int len = 0; + struct block_dir *tmp_pblock = pblock_dir; + + if((len = readlink(link,buf,sizeof(buf))) == -1) + { + return TRUE; + + }else + { + buf[len] = '\0'; + } + + + if((ext_path = strchr(dir,'/')) != NULL) + { + pstrcat(buf,&ext_path[1]); + len = strlen(buf); + } + + while(tmp_pblock != NULL) + { + if(len < tmp_pblock->str_len) + { + tmp_pblock = tmp_pblock->next; + continue; + } + + if((strstr(buf,tmp_pblock->dir_name)) != NULL) + { + return TRUE; + } + tmp_pblock = tmp_pblock->next; + } + + + return FALSE; + +} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/VFS/block/samba-block.conf b/examples/VFS/block/samba-block.conf new file mode 100644 index 0000000000..7a137980b7 --- /dev/null +++ b/examples/VFS/block/samba-block.conf @@ -0,0 +1,6 @@ +[ blocked ] +mount_point = / +mount_point = /boot +mount_point = /proc +dir_name = /usr/local/src/samba +dir_name = /usr/bin diff --git a/examples/VFS/block/smb.conf b/examples/VFS/block/smb.conf new file mode 100644 index 0000000000..368155f1f8 --- /dev/null +++ b/examples/VFS/block/smb.conf @@ -0,0 +1,13 @@ +[homes] + comment = Home Directories + vfs object = /usr/local/samba/lib/block.so + browseable = yes + writable = yes + + + + + + + + -- cgit From 75746fde8d1e4fffe692839c9c2fe76ccfda729c Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Thu, 18 Oct 2001 00:21:48 +0000 Subject: Now compiles under head branch. Funny, I don't remember using libtool in the original Makefile... (This used to be commit 5392b3fc1279cac64245e311bbc16175e6fd4a7b) --- examples/VFS/audit.c | 140 +++++++++++++++++++-------------------------------- 1 file changed, 51 insertions(+), 89 deletions(-) (limited to 'examples/VFS') diff --git a/examples/VFS/audit.c b/examples/VFS/audit.c index dc57b64940..cee410db84 100644 --- a/examples/VFS/audit.c +++ b/examples/VFS/audit.c @@ -45,96 +45,29 @@ #define SYSLOG_PRIORITY LOG_NOTICE #endif -/* Function prototypes */ - -int audit_connect(struct connection_struct *conn, char *svc, char *user); -void audit_disconnect(struct connection_struct *conn); -DIR *audit_opendir(struct connection_struct *conn, char *fname); -int audit_mkdir(struct connection_struct *conn, char *path, mode_t mode); -int audit_rmdir(struct connection_struct *conn, char *path); -int audit_open(struct connection_struct *conn, char *fname, int flags, mode_t mode); -int audit_close(struct files_struct *fsp, int fd); -int audit_rename(struct connection_struct *conn, char *old, char *new); -int audit_unlink(struct connection_struct *conn, char *path); -int audit_chmod(struct connection_struct *conn, char *path, mode_t mode); - -/* VFS operations */ - -extern struct vfs_ops default_vfs_ops; /* For passthrough operation */ - -struct vfs_ops audit_ops = { - - /* Disk operations */ - - audit_connect, - audit_disconnect, - NULL, /* disk free */ - - /* Directory operations */ - - audit_opendir, - NULL, /* readdir */ - audit_mkdir, - audit_rmdir, - NULL, /* closedir */ - - /* File operations */ - - audit_open, - audit_close, - NULL, /* read */ - NULL, /* write */ - NULL, /* lseek */ - audit_rename, - NULL, /* fsync */ - NULL, /* stat */ - NULL, /* fstat */ - NULL, /* lstat */ - audit_unlink, - audit_chmod, - NULL, /* chown */ - NULL, /* chdir */ - NULL, /* getwd */ - NULL, /* utime */ - NULL, /* ftruncate */ - NULL, /* lock */ - NULL, /* fget_nt_acl */ - NULL, /* get_nt_acl */ - NULL, /* fset_nt_acl */ - NULL /* set_nt_acl */ -}; - -/* VFS initialisation function. Return initialised vfs_ops structure - back to SAMBA. */ - -struct vfs_ops *vfs_init(void) -{ - openlog("smbd_audit", LOG_PID, SYSLOG_FACILITY); - syslog(SYSLOG_PRIORITY, "VFS_INIT: &audit_ops: 0x%8.8x\n", - &audit_ops); - return(&audit_ops); -} +static struct vfs_ops *global_vfs_ops; /* Implementation of vfs_ops. Pass everything on to the default operation but log event first. */ -int audit_connect(struct connection_struct *conn, char *svc, char *user) +static int audit_connect(struct connection_struct *conn, const char *svc, + const char *user) { syslog(SYSLOG_PRIORITY, "connect to service %s by user %s\n", svc, user); - return default_vfs_ops.connect(conn, svc, user); + return global_vfs_ops->connect(conn, svc, user); } -void audit_disconnect(struct connection_struct *conn) +static void audit_disconnect(struct connection_struct *conn) { syslog(SYSLOG_PRIORITY, "disconnected\n"); - default_vfs_ops.disconnect(conn); + global_vfs_ops->disconnect(conn); } -DIR *audit_opendir(struct connection_struct *conn, char *fname) +static DIR *audit_opendir(struct connection_struct *conn, const char *fname) { - DIR *result = default_vfs_ops.opendir(conn, fname); + DIR *result = global_vfs_ops->opendir(conn, fname); syslog(SYSLOG_PRIORITY, "opendir %s %s%s\n", fname, @@ -144,9 +77,10 @@ DIR *audit_opendir(struct connection_struct *conn, char *fname) return result; } -int audit_mkdir(struct connection_struct *conn, char *path, mode_t mode) +static int audit_mkdir(struct connection_struct *conn, const char *path, + mode_t mode) { - int result = default_vfs_ops.mkdir(conn, path, mode); + int result = global_vfs_ops->mkdir(conn, path, mode); syslog(SYSLOG_PRIORITY, "mkdir %s %s%s\n", path, @@ -156,9 +90,9 @@ int audit_mkdir(struct connection_struct *conn, char *path, mode_t mode) return result; } -int audit_rmdir(struct connection_struct *conn, char *path) +static int audit_rmdir(struct connection_struct *conn, const char *path) { - int result = default_vfs_ops.rmdir(conn, path); + int result = global_vfs_ops->rmdir(conn, path); syslog(SYSLOG_PRIORITY, "rmdir %s %s%s\n", path, @@ -168,9 +102,10 @@ int audit_rmdir(struct connection_struct *conn, char *path) return result; } -int audit_open(struct connection_struct *conn, char *fname, int flags, mode_t mode) +static int audit_open(struct connection_struct *conn, const char *fname, + int flags, mode_t mode) { - int result = default_vfs_ops.open(conn, fname, flags, mode); + int result = global_vfs_ops->open(conn, fname, flags, mode); syslog(SYSLOG_PRIORITY, "open %s (fd %d) %s%s%s\n", fname, result, @@ -181,9 +116,9 @@ int audit_open(struct connection_struct *conn, char *fname, int flags, mode_t mo return result; } -int audit_close(struct files_struct *fsp, int fd) +static int audit_close(struct files_struct *fsp, int fd) { - int result = default_vfs_ops.close(fsp, fd); + int result = global_vfs_ops->close(fsp, fd); syslog(SYSLOG_PRIORITY, "close fd %d %s%s\n", fd, @@ -193,9 +128,10 @@ int audit_close(struct files_struct *fsp, int fd) return result; } -int audit_rename(struct connection_struct *conn, char *old, char *new) +static int audit_rename(struct connection_struct *conn, const char *old, + const char *new) { - int result = default_vfs_ops.rename(conn, old, new); + int result = global_vfs_ops->rename(conn, old, new); syslog(SYSLOG_PRIORITY, "rename %s -> %s %s%s\n", old, new, @@ -205,9 +141,9 @@ int audit_rename(struct connection_struct *conn, char *old, char *new) return result; } -int audit_unlink(struct connection_struct *conn, char *path) +static int audit_unlink(struct connection_struct *conn, const char *path) { - int result = default_vfs_ops.unlink(conn, path); + int result = global_vfs_ops->unlink(conn, path); syslog(SYSLOG_PRIORITY, "unlink %s %s%s\n", path, @@ -217,9 +153,10 @@ int audit_unlink(struct connection_struct *conn, char *path) return result; } -int audit_chmod(struct connection_struct *conn, char *path, mode_t mode) +static int audit_chmod(struct connection_struct *conn, const char *path, + mode_t mode) { - int result = default_vfs_ops.chmod(conn, path, mode); + int result = global_vfs_ops->chmod(conn, path, mode); syslog(SYSLOG_PRIORITY, "chmod %s mode 0x%x %s%s\n", path, mode, @@ -229,3 +166,28 @@ int audit_chmod(struct connection_struct *conn, char *path, mode_t mode) return result; } +/* VFS initialisation function. Return initialised vfs_ops structure + back to SAMBA. */ + +struct vfs_ops *vfs_init(int *vfs_version, struct vfs_ops *ops) +{ + *vfs_version = SMB_VFS_INTERFACE_VERSION; + + openlog("smbd_audit", LOG_PID, SYSLOG_FACILITY); + syslog(SYSLOG_PRIORITY, "initialised\n"); + + ops->connect = audit_connect; + ops->disconnect = audit_disconnect; + ops->opendir = audit_opendir; + ops->mkdir = audit_mkdir; + ops->rmdir = audit_rmdir; + ops->open = audit_open; + ops->close = audit_close; + ops->rename = audit_rename; + ops->unlink = audit_unlink; + ops->chmod = audit_chmod; + + global_vfs_ops = ops; + + return(ops); +} -- cgit From 65f591895c8f57024750a7c8c029a04cccac16f0 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Tue, 23 Oct 2001 22:13:25 +0000 Subject: Don't get stuck in an infinite loop in vfs_connect. (This used to be commit 69275e4f0f502f07ceb37f274d01450d639ba23f) --- examples/VFS/audit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'examples/VFS') diff --git a/examples/VFS/audit.c b/examples/VFS/audit.c index cee410db84..dcc288fc97 100644 --- a/examples/VFS/audit.c +++ b/examples/VFS/audit.c @@ -56,7 +56,7 @@ static int audit_connect(struct connection_struct *conn, const char *svc, syslog(SYSLOG_PRIORITY, "connect to service %s by user %s\n", svc, user); - return global_vfs_ops->connect(conn, svc, user); + return 0; /* Success */ } static void audit_disconnect(struct connection_struct *conn) -- cgit From f80a526546c68468b3c24b84a7a62088d2e86260 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Wed, 24 Oct 2001 00:45:41 +0000 Subject: Renamed global_vfs_ops to default_vfs_ops and made static. Make a copy of the default ops structure rather than following a pointer. This fixes the audit VFS example module! (This used to be commit 91ab6f75d9e6820a13fe3034a5f100ae170ad164) --- examples/VFS/audit.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) (limited to 'examples/VFS') diff --git a/examples/VFS/audit.c b/examples/VFS/audit.c index dcc288fc97..bf81f37073 100644 --- a/examples/VFS/audit.c +++ b/examples/VFS/audit.c @@ -45,7 +45,7 @@ #define SYSLOG_PRIORITY LOG_NOTICE #endif -static struct vfs_ops *global_vfs_ops; +static struct vfs_ops default_vfs_ops; /* Implementation of vfs_ops. Pass everything on to the default operation but log event first. */ @@ -62,12 +62,11 @@ static int audit_connect(struct connection_struct *conn, const char *svc, static void audit_disconnect(struct connection_struct *conn) { syslog(SYSLOG_PRIORITY, "disconnected\n"); - global_vfs_ops->disconnect(conn); } static DIR *audit_opendir(struct connection_struct *conn, const char *fname) { - DIR *result = global_vfs_ops->opendir(conn, fname); + DIR *result = default_vfs_ops.opendir(conn, fname); syslog(SYSLOG_PRIORITY, "opendir %s %s%s\n", fname, @@ -80,7 +79,7 @@ static DIR *audit_opendir(struct connection_struct *conn, const char *fname) static int audit_mkdir(struct connection_struct *conn, const char *path, mode_t mode) { - int result = global_vfs_ops->mkdir(conn, path, mode); + int result = default_vfs_ops.mkdir(conn, path, mode); syslog(SYSLOG_PRIORITY, "mkdir %s %s%s\n", path, @@ -92,7 +91,7 @@ static int audit_mkdir(struct connection_struct *conn, const char *path, static int audit_rmdir(struct connection_struct *conn, const char *path) { - int result = global_vfs_ops->rmdir(conn, path); + int result = default_vfs_ops.rmdir(conn, path); syslog(SYSLOG_PRIORITY, "rmdir %s %s%s\n", path, @@ -105,7 +104,7 @@ static int audit_rmdir(struct connection_struct *conn, const char *path) static int audit_open(struct connection_struct *conn, const char *fname, int flags, mode_t mode) { - int result = global_vfs_ops->open(conn, fname, flags, mode); + int result = default_vfs_ops.open(conn, fname, flags, mode); syslog(SYSLOG_PRIORITY, "open %s (fd %d) %s%s%s\n", fname, result, @@ -118,7 +117,7 @@ static int audit_open(struct connection_struct *conn, const char *fname, static int audit_close(struct files_struct *fsp, int fd) { - int result = global_vfs_ops->close(fsp, fd); + int result = default_vfs_ops.close(fsp, fd); syslog(SYSLOG_PRIORITY, "close fd %d %s%s\n", fd, @@ -131,7 +130,7 @@ static int audit_close(struct files_struct *fsp, int fd) static int audit_rename(struct connection_struct *conn, const char *old, const char *new) { - int result = global_vfs_ops->rename(conn, old, new); + int result = default_vfs_ops.rename(conn, old, new); syslog(SYSLOG_PRIORITY, "rename %s -> %s %s%s\n", old, new, @@ -143,7 +142,7 @@ static int audit_rename(struct connection_struct *conn, const char *old, static int audit_unlink(struct connection_struct *conn, const char *path) { - int result = global_vfs_ops->unlink(conn, path); + int result = default_vfs_ops.unlink(conn, path); syslog(SYSLOG_PRIORITY, "unlink %s %s%s\n", path, @@ -156,7 +155,7 @@ static int audit_unlink(struct connection_struct *conn, const char *path) static int audit_chmod(struct connection_struct *conn, const char *path, mode_t mode) { - int result = global_vfs_ops->chmod(conn, path, mode); + int result = default_vfs_ops.chmod(conn, path, mode); syslog(SYSLOG_PRIORITY, "chmod %s mode 0x%x %s%s\n", path, mode, @@ -176,6 +175,12 @@ struct vfs_ops *vfs_init(int *vfs_version, struct vfs_ops *ops) openlog("smbd_audit", LOG_PID, SYSLOG_FACILITY); syslog(SYSLOG_PRIORITY, "initialised\n"); + /* Save a copy of the default ops */ + + default_vfs_ops = *ops; + + /* Override our ones */ + ops->connect = audit_connect; ops->disconnect = audit_disconnect; ops->opendir = audit_opendir; @@ -187,7 +192,5 @@ struct vfs_ops *vfs_init(int *vfs_version, struct vfs_ops *ops) ops->unlink = audit_unlink; ops->chmod = audit_chmod; - global_vfs_ops = ops; - return(ops); } -- cgit From 352f226d7677907c48df4f55bbecdf87c651eaf3 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Wed, 24 Oct 2001 00:55:26 +0000 Subject: Updated copyright notice. (This used to be commit 86de168ea948b48c47d88b8f1928437de7c33873) --- examples/VFS/audit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'examples/VFS') diff --git a/examples/VFS/audit.c b/examples/VFS/audit.c index bf81f37073..7fbcb97837 100644 --- a/examples/VFS/audit.c +++ b/examples/VFS/audit.c @@ -2,7 +2,7 @@ * Auditing VFS module for samba. Log selected file operations to syslog * facility. * - * Copyright (C) Tim Potter, 1999-2000 + * Copyright (C) Tim Potter, 1999-2001 * * 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 -- cgit From 0c42e582f8dbeb61e7364cb3e0c8f437dc360c12 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 19 Mar 2002 02:51:48 +0000 Subject: Sync up the VFS changes from 2.2.x. Jeremy. (This used to be commit e758bdc8a8f37e1d1e1fb0d1d27990dba2067920) --- examples/VFS/Makefile | 6 +- examples/VFS/audit.c | 204 +++++++++++++++---- examples/VFS/block/block.c | 196 +++++++----------- examples/VFS/recycle.c | 284 ++++++++++++++++++++++++++ examples/VFS/skel.c | 487 +++++++++++++++++++++++++++++++++------------ 5 files changed, 883 insertions(+), 294 deletions(-) create mode 100644 examples/VFS/recycle.c (limited to 'examples/VFS') diff --git a/examples/VFS/Makefile b/examples/VFS/Makefile index 581e1a06fb..716e48da88 100644 --- a/examples/VFS/Makefile +++ b/examples/VFS/Makefile @@ -1,7 +1,6 @@ # # Makefile for samba-vfs examples # -# $Id: Makefile,v 1.4 2000/11/06 20:01:03 jra Exp $ # # Variables @@ -13,8 +12,9 @@ SAMBA_SRC = ../../source SAMBA_INCL = ../../source/include UBIQX_SRC = ../../source/ubiqx SMBWR_SRC = ../../source/smbwrapper -CFLAGS = -I$(SAMBA_SRC) -I$(SAMBA_INCL) -I$(UBIQX_SRC) -I$(SMBWR_SRC) -Wall -g -VFS_OBJS = audit.so skel.so +KRB5_SRC = /usr/kerberos/include +CFLAGS = -I$(SAMBA_SRC) -I$(SAMBA_INCL) -I$(UBIQX_SRC) -I$(SMBWR_SRC) -I$(KRB5_SRC) -Wall -g +VFS_OBJS = audit.so skel.so recycle.so # Default target diff --git a/examples/VFS/audit.c b/examples/VFS/audit.c index 7fbcb97837..aad483c295 100644 --- a/examples/VFS/audit.c +++ b/examples/VFS/audit.c @@ -2,7 +2,7 @@ * Auditing VFS module for samba. Log selected file operations to syslog * facility. * - * Copyright (C) Tim Potter, 1999-2001 + * Copyright (C) Tim Potter, 1999-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 @@ -45,26 +45,150 @@ #define SYSLOG_PRIORITY LOG_NOTICE #endif -static struct vfs_ops default_vfs_ops; +/* Function prototypes */ + +int audit_connect(struct connection_struct *conn, const char *svc, const char *user); +void audit_disconnect(struct connection_struct *conn); +DIR *audit_opendir(struct connection_struct *conn, const char *fname); +int audit_mkdir(struct connection_struct *conn, const char *path, mode_t mode); +int audit_rmdir(struct connection_struct *conn, const char *path); +int audit_open(struct connection_struct *conn, const char *fname, int flags, mode_t mode); +int audit_close(struct files_struct *fsp, int fd); +int audit_rename(struct connection_struct *conn, const char *old, const char *new); +int audit_unlink(struct connection_struct *conn, const char *path); +int audit_chmod(struct connection_struct *conn, const char *path, mode_t mode); +int audit_chmod_acl(struct connection_struct *conn, const char *name, mode_t mode); +int audit_fchmod(struct files_struct *fsp, int fd, mode_t mode); +int audit_fchmod_acl(struct files_struct *fsp, int fd, mode_t mode); + +/* VFS operations */ + +extern struct vfs_ops default_vfs_ops; /* For passthrough operation */ + +struct vfs_ops audit_ops = { + + /* Disk operations */ + + audit_connect, + audit_disconnect, + NULL, /* disk free */ + + /* Directory operations */ + + audit_opendir, + NULL, /* readdir */ + audit_mkdir, + audit_rmdir, + NULL, /* closedir */ + + /* File operations */ + + audit_open, + audit_close, + NULL, /* read */ + NULL, /* write */ + NULL, /* lseek */ + audit_rename, + NULL, /* fsync */ + NULL, /* stat */ + NULL, /* fstat */ + NULL, /* lstat */ + audit_unlink, + audit_chmod, + audit_fchmod, + NULL, /* chown */ + NULL, /* fchown */ + NULL, /* chdir */ + NULL, /* getwd */ + NULL, /* utime */ + NULL, /* ftruncate */ + NULL, /* lock */ + NULL, /* symlink */ + NULL, /* readlink */ + NULL, /* link */ + NULL, /* mknod */ + NULL, /* realpath */ + NULL, /* fget_nt_acl */ + NULL, /* get_nt_acl */ + NULL, /* fset_nt_acl */ + NULL, /* set_nt_acl */ + + audit_chmod_acl, /* chmod_acl */ + audit_fchmod_acl, /* fchmod_acl */ + + NULL, /* sys_acl_get_entry */ + NULL, /* sys_acl_get_tag_type */ + NULL, /* sys_acl_get_permset */ + NULL, /*sys_acl_get_qualifier */ + NULL, /* sys_acl_get_file */ + NULL, /* sys_acl_get_fd */ + NULL, /* sys_acl_clear_perms */ + NULL, /* sys_acl_add_perm */ + NULL, /* sys_acl_to_text */ + NULL, /* sys_acl_init */ + NULL, /* sys_acl_create_entry */ + NULL, /* sys_acl_set_tag_type */ + NULL, /* sys_acl_set_qualifier */ + NULL, /* sys_acl_set_permset */ + NULL, /* sys_acl_valid */ + NULL, /* sys_acl_set_file */ + NULL, /* sys_acl_set_fd */ + NULL, /* sys_acl_delete_def_file */ + NULL, /* sys_acl_get_perm */ + NULL, /* sys_acl_free_text */ + NULL, /* sys_acl_free_acl */ + NULL /* sys_acl_free_qualifier */ +}; + +/* VFS initialisation function. Return initialised vfs_ops structure + back to SAMBA. */ + +struct vfs_ops *vfs_init(int *vfs_version, struct vfs_ops *def_vfs_ops) +{ + struct vfs_ops tmp_ops; + + *vfs_version = SMB_VFS_INTERFACE_VERSION; + memcpy(&tmp_ops, def_vfs_ops, sizeof(struct vfs_ops)); + + tmp_ops.connect = audit_connect; + tmp_ops.disconnect = audit_disconnect; + tmp_ops.opendir = audit_opendir; + tmp_ops.mkdir = audit_mkdir; + tmp_ops.rmdir = audit_rmdir; + tmp_ops.open = audit_open; + tmp_ops.close = audit_close; + tmp_ops.rename = audit_rename; + tmp_ops.unlink = audit_unlink; + tmp_ops.chmod = audit_chmod; + tmp_ops.chmod_acl = audit_chmod_acl; + tmp_ops.fchmod = audit_fchmod; + tmp_ops.fchmod_acl = audit_fchmod_acl; + + memcpy(&audit_ops, &tmp_ops, sizeof(struct vfs_ops)); + + openlog("smbd_audit", LOG_PID, SYSLOG_FACILITY); + syslog(SYSLOG_PRIORITY, "VFS_INIT: vfs_ops loaded\n"); + return &audit_ops; +} /* Implementation of vfs_ops. Pass everything on to the default operation but log event first. */ -static int audit_connect(struct connection_struct *conn, const char *svc, - const char *user) +int audit_connect(struct connection_struct *conn, const char *svc, const char *user) { syslog(SYSLOG_PRIORITY, "connect to service %s by user %s\n", svc, user); - return 0; /* Success */ + return default_vfs_ops.connect(conn, svc, user); } -static void audit_disconnect(struct connection_struct *conn) +void audit_disconnect(struct connection_struct *conn) { syslog(SYSLOG_PRIORITY, "disconnected\n"); + default_vfs_ops.disconnect(conn); } -static DIR *audit_opendir(struct connection_struct *conn, const char *fname) +DIR *audit_opendir(struct connection_struct *conn, const char *fname) { DIR *result = default_vfs_ops.opendir(conn, fname); @@ -76,8 +200,7 @@ static DIR *audit_opendir(struct connection_struct *conn, const char *fname) return result; } -static int audit_mkdir(struct connection_struct *conn, const char *path, - mode_t mode) +int audit_mkdir(struct connection_struct *conn, const char *path, mode_t mode) { int result = default_vfs_ops.mkdir(conn, path, mode); @@ -89,7 +212,7 @@ static int audit_mkdir(struct connection_struct *conn, const char *path, return result; } -static int audit_rmdir(struct connection_struct *conn, const char *path) +int audit_rmdir(struct connection_struct *conn, const char *path) { int result = default_vfs_ops.rmdir(conn, path); @@ -101,8 +224,7 @@ static int audit_rmdir(struct connection_struct *conn, const char *path) return result; } -static int audit_open(struct connection_struct *conn, const char *fname, - int flags, mode_t mode) +int audit_open(struct connection_struct *conn, const char *fname, int flags, mode_t mode) { int result = default_vfs_ops.open(conn, fname, flags, mode); @@ -115,7 +237,7 @@ static int audit_open(struct connection_struct *conn, const char *fname, return result; } -static int audit_close(struct files_struct *fsp, int fd) +int audit_close(struct files_struct *fsp, int fd) { int result = default_vfs_ops.close(fsp, fd); @@ -127,8 +249,7 @@ static int audit_close(struct files_struct *fsp, int fd) return result; } -static int audit_rename(struct connection_struct *conn, const char *old, - const char *new) +int audit_rename(struct connection_struct *conn, const char *old, const char *new) { int result = default_vfs_ops.rename(conn, old, new); @@ -140,7 +261,7 @@ static int audit_rename(struct connection_struct *conn, const char *old, return result; } -static int audit_unlink(struct connection_struct *conn, const char *path) +int audit_unlink(struct connection_struct *conn, const char *path) { int result = default_vfs_ops.unlink(conn, path); @@ -152,8 +273,7 @@ static int audit_unlink(struct connection_struct *conn, const char *path) return result; } -static int audit_chmod(struct connection_struct *conn, const char *path, - mode_t mode) +int audit_chmod(struct connection_struct *conn, const char *path, mode_t mode) { int result = default_vfs_ops.chmod(conn, path, mode); @@ -165,32 +285,38 @@ static int audit_chmod(struct connection_struct *conn, const char *path, return result; } -/* VFS initialisation function. Return initialised vfs_ops structure - back to SAMBA. */ - -struct vfs_ops *vfs_init(int *vfs_version, struct vfs_ops *ops) +int audit_chmod_acl(struct connection_struct *conn, const char *path, mode_t mode) { - *vfs_version = SMB_VFS_INTERFACE_VERSION; + int result = default_vfs_ops.chmod_acl(conn, path, mode); - openlog("smbd_audit", LOG_PID, SYSLOG_FACILITY); - syslog(SYSLOG_PRIORITY, "initialised\n"); + syslog(SYSLOG_PRIORITY, "chmod_acl %s mode 0x%x %s%s\n", + path, mode, + (result < 0) ? "failed: " : "", + (result < 0) ? strerror(errno) : ""); + + return result; +} - /* Save a copy of the default ops */ +int audit_fchmod(struct files_struct *fsp, int fd, mode_t mode) +{ + int result = default_vfs_ops.fchmod(fsp, fd, mode); + + syslog(SYSLOG_PRIORITY, "fchmod %s mode 0x%x %s%s\n", + fsp->fsp_name, mode, + (result < 0) ? "failed: " : "", + (result < 0) ? strerror(errno) : ""); - default_vfs_ops = *ops; + return result; +} - /* Override our ones */ +int audit_fchmod_acl(struct files_struct *fsp, int fd, mode_t mode) +{ + int result = default_vfs_ops.fchmod_acl(fsp, fd, mode); - ops->connect = audit_connect; - ops->disconnect = audit_disconnect; - ops->opendir = audit_opendir; - ops->mkdir = audit_mkdir; - ops->rmdir = audit_rmdir; - ops->open = audit_open; - ops->close = audit_close; - ops->rename = audit_rename; - ops->unlink = audit_unlink; - ops->chmod = audit_chmod; + syslog(SYSLOG_PRIORITY, "fchmod_acl %s mode 0x%x %s%s\n", + fsp->fsp_name, mode, + (result < 0) ? "failed: " : "", + (result < 0) ? strerror(errno) : ""); - return(ops); + return result; } diff --git a/examples/VFS/block/block.c b/examples/VFS/block/block.c index 3c4f736e84..f83ab6e07e 100644 --- a/examples/VFS/block/block.c +++ b/examples/VFS/block/block.c @@ -48,7 +48,7 @@ DIR *block_opendir(struct connection_struct *conn, char *fname); -int block_connect(struct connection_struct *conn, char *service, char *user); +int block_connect(struct connection_struct *conn, const char *service, const char *user); void block_disconnect(struct connection_struct *conn); @@ -63,44 +63,77 @@ struct vfs_ops execute_vfs_ops = { block_connect, block_disconnect, - NULL, /* disk free */ + NULL, /* disk free */ /* Directory operations */ block_opendir, - NULL, /* readdir */ - NULL, - NULL, - NULL, /* closedir */ + NULL, /* readdir */ + NULL, /* mkdir */ + NULL, /* rmdir */ + NULL, /* closedir */ /* File operations */ - NULL, - NULL, - NULL, /* read */ - NULL, /* write */ - NULL, /* lseek */ - NULL, - NULL, /* fsync */ - NULL, /* stat */ - NULL, /* fstat */ - NULL, /* lstat */ - NULL, - NULL, - NULL, - NULL, /* chown */ - NULL, - NULL, /* chdir */ - NULL, /* getwd */ - NULL, /* utime */ - NULL, /* ftruncate */ - NULL, /* lock */ - NULL, /* fget_nt_acl */ - NULL, /* get_nt_acl */ - NULL, /* fset_nt_acl */ - NULL, /* set_nt_acl */ - NULL, - NULL + NULL, /* open */ + NULL, /* close */ + NULL, /* read */ + NULL, /* write */ + NULL, /* lseek */ + NULL, /* rename */ + NULL, /* fsync */ + NULL, /* stat */ + NULL, /* fstat */ + NULL, /* lstat */ + NULL, /* unlink */ + NULL, /* chmod */ + NULL, /* fchmod */ + NULL, /* chown */ + NULL, /* fchown */ + NULL, /* chdir */ + NULL, /* getwd */ + NULL, /* utime */ + NULL, /* ftruncate */ + NULL, /* lock */ + NULL, /* symlink */ + NULL, /* readlink */ + NULL, /* link */ + NULL, /* mknod */ + NULL, /* realpath */ + + /* NT ACL operations */ + + NULL, /* fget_nt_acl */ + NULL, /* get_nt_acl */ + NULL, /* fset_nt_acl */ + NULL, /* set_nt_acl */ + + /* POSIX ACL operations. */ + + NULL, /* chmod_acl */ + NULL, /* fchmod_acl */ + NULL, /* sys_acl_get_entry */ + NULL, /* sys_acl_get_tag_type */ + NULL, /* sys_acl_get_permset */ + NULL, /* sys_acl_get_qualifier */ + NULL, /* sys_acl_get_file */ + NULL, /* sys_acl_get_fd */ + NULL, /* sys_acl_clear_perms */ + NULL, /* sys_acl_add_perm */ + NULL, /* sys_acl_to_text */ + NULL, /* sys_acl_init */ + NULL, /* sys_acl_create_entry */ + NULL, /* sys_acl_set_tag_type */ + NULL, /* sys_acl_set_qualifier */ + NULL, /* sys_acl_set_permset */ + NULL, /* sys_acl_valid */ + NULL, /* sys_acl_set_file */ + NULL, /* sys_acl_set_fd */ + NULL, /* sys_acl_delete_def_file */ + NULL, /* sys_acl_get_perm */ + NULL, /* sys_acl_free_text */ + NULL, /* sys_acl_free_acl */ + NULL /* sys_acl_free_qualifier */ }; @@ -297,10 +330,20 @@ BOOL get_parameter_value(char *param, char *value) /* VFS initialisation function. Return initialised vfs_ops structure back to SAMBA. */ -struct vfs_ops *vfs_init(int *vfs_version) +struct vfs_ops *vfs_init(int *vfs_version, struct vfs_ops *def_vfs_ops) { + struct vfs_ops tmp_ops; + *vfs_version = SMB_VFS_INTERFACE_VERSION; + memcpy(&tmp_ops, def_vfs_ops, sizeof(struct vfs_ops)); + + /* Override the ones we want. */ + tmp_ops.connect = block_connect; + tmp_ops.disconnect = block_disconnect; + tmp_ops.opendir = block_opendir; + + memcpy(&execute_vfs_ops, &tmp_ops, sizeof(struct vfs_ops)); return(&execute_vfs_ops); } @@ -457,90 +500,3 @@ BOOL dir_search(char *link, char *dir) return FALSE; } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/examples/VFS/recycle.c b/examples/VFS/recycle.c new file mode 100644 index 0000000000..4e032bb813 --- /dev/null +++ b/examples/VFS/recycle.c @@ -0,0 +1,284 @@ +/* + * Auditing VFS module for samba. Log selected file operations to syslog + * facility. + * + * Copyright (C) 2001, Brandon Stone, Amherst College, . + * Copyright (C) 2002, Jeremy Allison - modified to make a VFS module. + * + * 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. + */ + +#include "config.h" +#include +#include +#ifdef HAVE_UTIME_H +#include +#endif +#ifdef HAVE_DIRENT_H +#include +#endif +#include +#ifdef HAVE_FCNTL_H +#include +#endif +#include +#include +#include +#include + +/* VFS operations */ + +extern struct vfs_ops default_vfs_ops; /* For passthrough operation */ + +static int recycle_unlink(connection_struct *, const char *); +static int recycle_connect(struct connection_struct *conn, const char *service, const char *user); +static void recycle_disconnect(struct connection_struct *conn); + +struct vfs_ops recycle_ops = { + + /* Disk operations */ + + recycle_connect, /* connect */ + recycle_disconnect, /* disconnect */ + NULL, /* disk free */ + + /* Directory operations */ + + NULL, /* opendir */ + NULL, /* readdir */ + NULL, /* mkdir */ + NULL, /* rmdir */ + NULL, /* closedir */ + + /* File operations */ + + NULL, /* open */ + NULL, /* close */ + NULL, /* read */ + NULL, /* write */ + NULL, /* lseek */ + NULL, /* rename */ + NULL, /* fsync */ + NULL, /* stat */ + NULL, /* fstat */ + NULL, /* lstat */ + recycle_unlink, + NULL, /* chmod */ + NULL, /* fchmod */ + NULL, /* chown */ + NULL, /* fchown */ + NULL, /* chdir */ + NULL, /* getwd */ + NULL, /* utime */ + NULL, /* ftruncate */ + NULL, /* lock */ + NULL, /* symlink */ + NULL, /* readlink */ + NULL, /* link */ + NULL, /* mknod */ + NULL, /* realpath */ + NULL, /* fget_nt_acl */ + NULL, /* get_nt_acl */ + NULL, /* fset_nt_acl */ + NULL, /* set_nt_acl */ + + NULL, /* chmod_acl */ + NULL, /* fchmod_acl */ + + NULL, /* sys_acl_get_entry */ + NULL, /* sys_acl_get_tag_type */ + NULL, /* sys_acl_get_permset */ + NULL, /* sys_acl_get_qualifier */ + NULL, /* sys_acl_get_file */ + NULL, /* sys_acl_get_fd */ + NULL, /* sys_acl_clear_perms */ + NULL, /* sys_acl_add_perm */ + NULL, /* sys_acl_to_text */ + NULL, /* sys_acl_init */ + NULL, /* sys_acl_create_entry */ + NULL, /* sys_acl_set_tag_type */ + NULL, /* sys_acl_set_qualifier */ + NULL, /* sys_acl_set_permset */ + NULL, /* sys_acl_valid */ + NULL, /* sys_acl_set_file */ + NULL, /* sys_acl_set_fd */ + NULL, /* sys_acl_delete_def_file */ + NULL, /* sys_acl_get_perm */ + NULL, /* sys_acl_free_text */ + NULL, /* sys_acl_free_acl */ + NULL /* sys_acl_free_qualifier */ +}; + +/* VFS initialisation function. Return initialised vfs_ops structure + back to SAMBA. */ + +struct vfs_ops *vfs_init(int *vfs_version, struct vfs_ops *def_vfs_ops) +{ + struct vfs_ops tmp_ops; + + *vfs_version = SMB_VFS_INTERFACE_VERSION; + memcpy(&tmp_ops, def_vfs_ops, sizeof(struct vfs_ops)); + tmp_ops.unlink = recycle_unlink; + tmp_ops.connect = recycle_connect; + tmp_ops.disconnect = recycle_disconnect; + memcpy(&recycle_ops, &tmp_ops, sizeof(struct vfs_ops)); + return &recycle_ops; +} + +static int recycle_connect(struct connection_struct *conn, const char *service, const char *user) +{ + pstring opts_str; + fstring recycle_bin; + char *p; + + DEBUG(3,("recycle_connect: called for service %s as user %s\n", service, user)); + + pstrcpy(opts_str, (const char *)lp_vfs_options(SNUM(conn))); + if (!*opts_str) { + DEBUG(3,("recycle_connect: No options listed (%s).\n", lp_vfs_options(SNUM(conn)) )); + return 0; /* No options. */ + } + + p = opts_str; + if (next_token(&p,recycle_bin,"=",sizeof(recycle_bin))) { + if (!strequal("recycle", recycle_bin)) { + DEBUG(3,("recycle_connect: option %s is not recycle\n", recycle_bin )); + return -1; + } + } + + if (!next_token(&p,recycle_bin," \n",sizeof(recycle_bin))) { + DEBUG(3,("recycle_connect: no option after recycle=\n")); + return -1; + } + + DEBUG(10,("recycle_connect: recycle name is %s\n", recycle_bin )); + + conn->vfs_private = (void *)strdup(recycle_bin); + return 0; +} + +static void recycle_disconnect(struct connection_struct *conn) +{ + SAFE_FREE(conn->vfs_private); +} + +static BOOL recycle_XXX_exist(connection_struct *conn, const char *dname, BOOL isdir) +{ + SMB_STRUCT_STAT st; + + if (default_vfs_ops.stat(conn,dname,&st) != 0) + return(False); + + if (isdir) + return S_ISDIR(st.st_mode) ? True : False; + else + return S_ISREG(st.st_mode) ? True : False; +} + +static BOOL recycle_directory_exist(connection_struct *conn, const char *dname) +{ + return recycle_XXX_exist(conn, dname, True); +} + +static BOOL recycle_file_exist(connection_struct *conn, const char *fname) +{ + return recycle_XXX_exist(conn, fname, False); +} + +static SMB_OFF_T recycle_get_file_size(connection_struct *conn, const char *fname) +{ + SMB_STRUCT_STAT st; + + if (default_vfs_ops.stat(conn,fname,&st) != 0) + return (SMB_OFF_T)-1; + + return(st.st_size); +} + +/******************************************************************** + Check if file should be recycled +*********************************************************************/ + +static int recycle_unlink(connection_struct *conn, const char *inname) +{ + fstring recycle_bin; + pstring fname; + char *base, *ext; + pstring bin; + int i=1, len, addlen; + int dir_mask=0700; + SMB_BIG_UINT dfree,dsize,bsize; + + *recycle_bin = '\0'; + pstrcpy(fname, inname); + + if (conn->vfs_private) + fstrcpy(recycle_bin, (const char *)conn->vfs_private); + + if(!*recycle_bin) { + DEBUG(3, ("recycle bin: share parameter not set, purging %s...\n", fname)); + return default_vfs_ops.unlink(conn,fname); + } + + if(recycle_get_file_size(conn, fname) == 0) { + DEBUG(3, ("recycle bin: file %s is empty, purging...\n", fname)); + return default_vfs_ops.unlink(conn,fname); + } + + base = strrchr(fname, '/') + 1; + if(base == (char*)1) + ext = strrchr(fname, '.'); + else + ext = strrchr(base, '.'); + + pstrcpy(bin, recycle_bin); + pstrcat(bin, "/"); + pstrcat(bin, base); + + if(strcmp(fname,bin) == 0) { + DEBUG(3, ("recycle bin: file %s exists, purging...\n", fname)); + return default_vfs_ops.unlink(conn,fname); + } + + len = strlen(bin); + addlen = sizeof(pstring)-len-1; + while(recycle_file_exist(conn,bin)) { + slprintf(bin+len, addlen, " (Copy #%d)", i++); + pstrcat(bin, ext); + } + + DEBUG(3, ("recycle bin: moving source=%s to dest=%s\n", fname, bin)); + default_vfs_ops.disk_free(conn,".",True,&bsize,&dfree,&dsize); + if((unsigned int)dfree > 0) { + int ret; + if(!recycle_directory_exist(conn,recycle_bin)) { + DEBUG(3, ("recycle bin: directory %s nonexistant, creating...\n", recycle_bin)); + if (default_vfs_ops.mkdir(conn,recycle_bin,dir_mask) == -1) { + DEBUG(3, ("recycle bin: unable to create directory %s. Error was %s\n", + recycle_bin, strerror(errno) )); + } + } + DEBUG(3, ("recycle bin: move %s -> %s\n", fname, bin)); + + ret = default_vfs_ops.rename(conn, fname, bin); + if (ret == -1) + DEBUG(3, ("recycle bin: move error %d (%s)\n", errno, strerror(errno) )); + return ret; + } else { + DEBUG(3, ("recycle bin: move failed, purging...\n")); + return default_vfs_ops.unlink(conn,fname); + } +} diff --git a/examples/VFS/skel.c b/examples/VFS/skel.c index 9bb84fe2b1..bb5486e690 100644 --- a/examples/VFS/skel.c +++ b/examples/VFS/skel.c @@ -38,121 +38,20 @@ #include #include -/* 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, - - /* 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) -{ - *vfs_version = SMB_VFS_INTERFACE_VERSION; - return(&skel_ops); -} - -/* Implementation of VFS functions. Insert your useful stuff here */ - extern struct vfs_ops default_vfs_ops; /* For passthrough operation */ +extern struct vfs_ops skel_ops; -int skel_connect(struct connection_struct *conn, char *service, char *user) +static int skel_connect(struct connection_struct *conn, const char *service, const char *user) { return default_vfs_ops.connect(conn, service, user); } -void skel_disconnect(struct connection_struct *conn) +static void skel_disconnect(struct connection_struct *conn) { default_vfs_ops.disconnect(conn); } -SMB_BIG_UINT skel_disk_free(struct connection_struct *conn, char *path, +static SMB_BIG_UINT skel_disk_free(struct connection_struct *conn, const char *path, BOOL small_query, SMB_BIG_UINT *bsize, SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize) { @@ -160,138 +59,462 @@ SMB_BIG_UINT skel_disk_free(struct connection_struct *conn, char *path, dfree, dsize); } -DIR *skel_opendir(struct connection_struct *conn, char *fname) +static DIR *skel_opendir(struct connection_struct *conn, const char *fname) { return default_vfs_ops.opendir(conn, fname); } -struct dirent *skel_readdir(struct connection_struct *conn, DIR *dirp) +static struct dirent *skel_readdir(struct connection_struct *conn, DIR *dirp) { return default_vfs_ops.readdir(conn, dirp); } -int skel_mkdir(struct connection_struct *conn, char *path, mode_t mode) +static int skel_mkdir(struct connection_struct *conn, const char *path, mode_t mode) { return default_vfs_ops.mkdir(conn, path, mode); } -int skel_rmdir(struct connection_struct *conn, char *path) +static int skel_rmdir(struct connection_struct *conn, const char *path) { return default_vfs_ops.rmdir(conn, path); } -int skel_closedir(struct connection_struct *conn, DIR *dir) +static int skel_closedir(struct connection_struct *conn, DIR *dir) { return default_vfs_ops.closedir(conn, dir); } -int skel_open(struct connection_struct *conn, char *fname, int flags, mode_t mode) +static int skel_open(struct connection_struct *conn, const char *fname, int flags, mode_t mode) { return default_vfs_ops.open(conn, fname, flags, mode); } -int skel_close(struct files_struct *fsp, int fd) +static int skel_close(struct files_struct *fsp, int fd) { return default_vfs_ops.close(fsp, fd); } -ssize_t skel_read(struct files_struct *fsp, int fd, char *data, size_t n) +static ssize_t skel_read(struct files_struct *fsp, int fd, void *data, size_t n) { return default_vfs_ops.read(fsp, fd, data, n); } -ssize_t skel_write(struct files_struct *fsp, int fd, char *data, size_t n) +static ssize_t skel_write(struct files_struct *fsp, int fd, const void *data, size_t n) { return default_vfs_ops.write(fsp, fd, data, n); } -SMB_OFF_T skel_lseek(struct files_struct *fsp, int filedes, SMB_OFF_T offset, int whence) +static SMB_OFF_T skel_lseek(struct files_struct *fsp, int filedes, SMB_OFF_T offset, int whence) { return default_vfs_ops.lseek(fsp, filedes, offset, whence); } -int skel_rename(struct connection_struct *conn, char *old, char *new) +static int skel_rename(struct connection_struct *conn, const char *old, const char *new) { return default_vfs_ops.rename(conn, old, new); } -int skel_fsync(struct files_struct *fsp, int fd) +static int skel_fsync(struct files_struct *fsp, int fd) { return default_vfs_ops.fsync(fsp, fd); } -int skel_stat(struct connection_struct *conn, char *fname, SMB_STRUCT_STAT *sbuf) +static int skel_stat(struct connection_struct *conn, const char *fname, SMB_STRUCT_STAT *sbuf) { return default_vfs_ops.stat(conn, fname, sbuf); } -int skel_fstat(struct files_struct *fsp, int fd, SMB_STRUCT_STAT *sbuf) +static int skel_fstat(struct files_struct *fsp, int fd, SMB_STRUCT_STAT *sbuf) { return default_vfs_ops.fstat(fsp, fd, sbuf); } -int skel_lstat(struct connection_struct *conn, char *path, SMB_STRUCT_STAT *sbuf) +static int skel_lstat(struct connection_struct *conn, const char *path, SMB_STRUCT_STAT *sbuf) { return default_vfs_ops.lstat(conn, path, sbuf); } -int skel_unlink(struct connection_struct *conn, char *path) +static int skel_unlink(struct connection_struct *conn, const char *path) { return default_vfs_ops.unlink(conn, path); } -int skel_chmod(struct connection_struct *conn, char *path, mode_t mode) +static int skel_chmod(struct connection_struct *conn, const char *path, mode_t mode) { return default_vfs_ops.chmod(conn, path, mode); } -int skel_chown(struct connection_struct *conn, char *path, uid_t uid, gid_t gid) +static int skel_fchmod(struct files_struct *fsp, int fd, mode_t mode) +{ + return default_vfs_ops.fchmod(fsp, fd, mode); +} + +static int skel_chown(struct connection_struct *conn, const char *path, uid_t uid, gid_t gid) { return default_vfs_ops.chown(conn, path, uid, gid); } -int skel_chdir(struct connection_struct *conn, char *path) +static int skel_fchown(struct files_struct *fsp, int fd, uid_t uid, gid_t gid) +{ + return default_vfs_ops.fchown(fsp, fd, uid, gid); +} + +static int skel_chdir(struct connection_struct *conn, const char *path) { return default_vfs_ops.chdir(conn, path); } -char *skel_getwd(struct connection_struct *conn, char *buf) +static char *skel_getwd(struct connection_struct *conn, char *buf) { return default_vfs_ops.getwd(conn, buf); } -int skel_utime(struct connection_struct *conn, char *path, struct utimbuf *times) +static int skel_utime(struct connection_struct *conn, const char *path, struct utimbuf *times) { return default_vfs_ops.utime(conn, path, times); } -int skel_ftruncate(struct files_struct *fsp, int fd, SMB_OFF_T offset) +static int skel_ftruncate(struct files_struct *fsp, int fd, SMB_OFF_T offset) { return default_vfs_ops.ftruncate(fsp, fd, offset); } -BOOL skel_lock(struct files_struct *fsp, int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type) +static BOOL skel_lock(struct files_struct *fsp, int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type) { return default_vfs_ops.lock(fsp, fd, op, offset, count, type); } -size_t skel_fget_nt_acl(struct files_struct *fsp, int fd, struct security_descriptor_info **ppdesc) +static BOOL skel_symlink(struct connection_struct *conn, const char *oldpath, const char *newpath) +{ + return default_vfs_ops.symlink(conn, oldpath, newpath); +} + +static BOOL skel_readlink(struct connection_struct *conn, const char *path, char *buf, size_t bufsiz) +{ + return default_vfs_ops.readlink(conn, path, buf, bufsiz); +} + +static int skel_link(struct connection_struct *conn, const char *oldpath, const char *newpath) +{ + return default_vfs_ops.link(conn, oldpath, newpath); +} + +static int skel_mknod(struct connection_struct *conn, const char *path, mode_t mode, SMB_DEV_T dev) +{ + return default_vfs_ops.mknod(conn, path, mode, dev); +} + +static char *skel_realpath(struct connection_struct *conn, const char *path, char *resolved_path) +{ + return default_vfs_ops.realpath(conn, path, resolved_path); +} + +static 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); } -size_t skel_get_nt_acl(struct files_struct *fsp, char *name, struct security_descriptor_info **ppdesc) +static size_t skel_get_nt_acl(struct files_struct *fsp, const char *name, struct security_descriptor_info **ppdesc) { return default_vfs_ops.get_nt_acl(fsp, name, ppdesc); } -BOOL skel_fset_nt_acl(struct files_struct *fsp, int fd, uint32 security_info_sent, struct security_descriptor_info *psd) +static BOOL skel_fset_nt_acl(struct files_struct *fsp, int fd, uint32 security_info_sent, struct security_descriptor_info *psd) { return default_vfs_ops.fset_nt_acl(fsp, fd, security_info_sent, psd); } -BOOL skel_set_nt_acl(struct files_struct *fsp, char *name, uint32 security_info_sent, struct security_descriptor_info *psd) +static BOOL skel_set_nt_acl(struct files_struct *fsp, const char *name, uint32 security_info_sent, struct security_descriptor_info *psd) { return default_vfs_ops.set_nt_acl(fsp, name, security_info_sent, psd); } +static BOOL skel_chmod_acl(struct connection_struct *conn, const char *name, mode_t mode) +{ + return default_vfs_ops.chmod_acl(conn, name, mode); +} + +static BOOL skel_fchmod_acl(struct files_struct *fsp, int fd, mode_t mode) +{ + return default_vfs_ops.fchmod_acl(fsp, fd, mode); +} + +static int skel_sys_acl_get_entry(struct connection_struct *conn, SMB_ACL_T theacl, int entry_id, SMB_ACL_ENTRY_T *entry_p) +{ + return default_vfs_ops.sys_acl_get_entry(conn, theacl, entry_id, entry_p); +} + +static int skel_sys_acl_get_tag_type(struct connection_struct *conn, SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T *tag_type_p) +{ + return default_vfs_ops.sys_acl_get_tag_type(conn, entry_d, tag_type_p); +} + +static int skel_sys_acl_get_permset(struct connection_struct *conn, SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T *permset_p) +{ + return default_vfs_ops.sys_acl_get_permset(conn, entry_d, permset_p); +} + +static void *skel_sys_acl_get_qualifier(struct connection_struct *conn, SMB_ACL_ENTRY_T entry_d) +{ + return default_vfs_ops.sys_acl_get_qualifier(conn, entry_d); +} + +static SMB_ACL_T skel_sys_acl_get_file(struct connection_struct *conn, const char *path_p, SMB_ACL_TYPE_T type) +{ + return default_vfs_ops.sys_acl_get_file(conn, path_p, type); +} + +static SMB_ACL_T skel_sys_acl_get_fd(struct files_struct *fsp, int fd) +{ + return default_vfs_ops.sys_acl_get_fd(fsp, fd); +} + +static int skel_sys_acl_clear_perms(struct connection_struct *conn, SMB_ACL_PERMSET_T permset) +{ + return default_vfs_ops.sys_acl_clear_perms(conn, permset); +} + +static int skel_sys_acl_add_perm(struct connection_struct *conn, SMB_ACL_PERMSET_T permset, SMB_ACL_PERM_T perm) +{ + return default_vfs_ops.sys_acl_add_perm(conn, permset, perm); +} + +static char *skel_sys_acl_to_text(struct connection_struct *conn, SMB_ACL_T theacl, ssize_t *plen) +{ + return default_vfs_ops.sys_acl_to_text(conn, theacl, plen); +} + +static SMB_ACL_T skel_sys_acl_init(struct connection_struct *conn, int count) +{ + return default_vfs_ops.sys_acl_init(conn, count); +} + +static int skel_sys_acl_create_entry(struct connection_struct *conn, SMB_ACL_T *pacl, SMB_ACL_ENTRY_T *pentry) +{ + return default_vfs_ops.sys_acl_create_entry(conn, pacl, pentry); +} + +static int skel_sys_acl_set_tag_type(struct connection_struct *conn, SMB_ACL_ENTRY_T entry, SMB_ACL_TAG_T tagtype) +{ + return default_vfs_ops.sys_acl_set_tag_type(conn, entry, tagtype); +} + +static int skel_sys_acl_set_qualifier(struct connection_struct *conn, SMB_ACL_ENTRY_T entry, void *qual) +{ + return default_vfs_ops.sys_acl_set_qualifier(conn, entry, qual); +} + +static int skel_sys_acl_set_permset(struct connection_struct *conn, SMB_ACL_ENTRY_T entry, SMB_ACL_PERMSET_T permset) +{ + return default_vfs_ops.sys_acl_set_permset(conn, entry, permset); +} + +static int skel_sys_acl_valid(struct connection_struct *conn, SMB_ACL_T theacl ) +{ + return default_vfs_ops.sys_acl_valid(conn, theacl ); +} + +static int skel_sys_acl_set_file(struct connection_struct *conn, const char *name, SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl) +{ + return default_vfs_ops.sys_acl_set_file(conn, name, acltype, theacl); +} + +static int skel_sys_acl_set_fd(struct files_struct *fsp, int fd, SMB_ACL_T theacl) +{ + return default_vfs_ops.sys_acl_set_fd(fsp, fd, theacl); +} + +static int skel_sys_acl_delete_def_file(struct connection_struct *conn, const char *path) +{ + return default_vfs_ops.sys_acl_delete_def_file(conn, path); +} + +static int skel_sys_acl_get_perm(struct connection_struct *conn, SMB_ACL_PERMSET_T permset, SMB_ACL_PERM_T perm) +{ + return default_vfs_ops.sys_acl_get_perm(conn, permset, perm); +} + +static int skel_sys_acl_free_text(struct connection_struct *conn, char *text) +{ + return default_vfs_ops.sys_acl_free_text(conn, text); +} + +static int skel_sys_acl_free_acl(struct connection_struct *conn, SMB_ACL_T posix_acl) +{ + return default_vfs_ops.sys_acl_free_acl(conn, posix_acl); +} + +static int skel_sys_acl_free_qualifier(struct connection_struct *conn, void *qualifier, SMB_ACL_TAG_T tagtype) +{ + return default_vfs_ops.sys_acl_free_qualifier(conn, qualifier, tagtype); +} + +/* VFS initialisation - return vfs_ops function pointer structure */ + +struct vfs_ops *vfs_init(int *vfs_version, struct vfs_ops *def_vfs_ops) +{ + struct vfs_ops tmp_ops; + + DEBUG(3, ("Initialising default vfs hooks\n")); + + *vfs_version = SMB_VFS_INTERFACE_VERSION; + memcpy(&tmp_ops, def_vfs_ops, sizeof(struct vfs_ops)); + + tmp_ops.connect = skel_connect; + tmp_ops.disconnect = skel_disconnect; + tmp_ops.disk_free = skel_disk_free; + + /* Directory operations */ + + tmp_ops.opendir = skel_opendir; + tmp_ops.readdir = skel_readdir; + tmp_ops.mkdir = skel_mkdir; + tmp_ops.rmdir = skel_rmdir; + tmp_ops.closedir = skel_closedir; + + /* File operations */ + + tmp_ops.open = skel_open; + tmp_ops.close = skel_close; + tmp_ops.read = skel_read; + tmp_ops.write = skel_write; + tmp_ops.lseek = skel_lseek; + tmp_ops.rename = skel_rename; + tmp_ops.fsync = skel_fsync; + tmp_ops.stat = skel_stat; + tmp_ops.fstat = skel_fstat; + tmp_ops.lstat = skel_lstat; + tmp_ops.unlink = skel_unlink; + tmp_ops.chmod = skel_chmod; + tmp_ops.fchmod = skel_fchmod; + tmp_ops.chown = skel_chown; + tmp_ops.fchown = skel_fchown; + tmp_ops.chdir = skel_chdir; + tmp_ops.getwd = skel_getwd; + tmp_ops.utime = skel_utime; + tmp_ops.ftruncate = skel_ftruncate; + tmp_ops.lock = skel_lock; + tmp_ops.symlink = skel_symlink; + tmp_ops.readlink = skel_readlink; + tmp_ops.link = skel_link; + tmp_ops.mknod = skel_mknod; + tmp_ops.realpath = skel_realpath; + + tmp_ops.fget_nt_acl = skel_fget_nt_acl; + tmp_ops.get_nt_acl = skel_get_nt_acl; + tmp_ops.fset_nt_acl = skel_fset_nt_acl; + tmp_ops.set_nt_acl = skel_set_nt_acl; + + /* POSIX ACL operations. */ + + tmp_ops.chmod_acl = skel_chmod_acl; + tmp_ops.fchmod_acl = skel_fchmod_acl; + tmp_ops.sys_acl_get_entry = skel_sys_acl_get_entry; + tmp_ops.sys_acl_get_tag_type = skel_sys_acl_get_tag_type; + tmp_ops.sys_acl_get_permset = skel_sys_acl_get_permset; + tmp_ops.sys_acl_get_qualifier = skel_sys_acl_get_qualifier; + tmp_ops.sys_acl_get_file = skel_sys_acl_get_file; + tmp_ops.sys_acl_get_fd = skel_sys_acl_get_fd; + tmp_ops.sys_acl_clear_perms = skel_sys_acl_clear_perms; + tmp_ops.sys_acl_add_perm = skel_sys_acl_add_perm; + tmp_ops.sys_acl_to_text = skel_sys_acl_to_text; + tmp_ops.sys_acl_init = skel_sys_acl_init; + tmp_ops.sys_acl_create_entry = skel_sys_acl_create_entry; + tmp_ops.sys_acl_set_tag_type = skel_sys_acl_set_tag_type; + tmp_ops.sys_acl_set_qualifier = skel_sys_acl_set_qualifier; + tmp_ops.sys_acl_set_permset = skel_sys_acl_set_permset; + tmp_ops.sys_acl_valid = skel_sys_acl_valid; + tmp_ops.sys_acl_set_file = skel_sys_acl_set_file; + tmp_ops.sys_acl_set_fd = skel_sys_acl_set_fd; + tmp_ops.sys_acl_delete_def_file = skel_sys_acl_delete_def_file; + tmp_ops.sys_acl_get_perm = skel_sys_acl_get_perm; + tmp_ops.sys_acl_free_text = skel_sys_acl_free_text; + tmp_ops.sys_acl_free_acl = skel_sys_acl_free_acl; + tmp_ops.sys_acl_free_qualifier = skel_sys_acl_free_qualifier; + + memcpy(&skel_ops, &tmp_ops, sizeof(struct vfs_ops)); + + return &skel_ops; +} + +/* 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, + skel_link, + skel_mknod, + skel_realpath, + + /* NT File ACL operations */ + + skel_fget_nt_acl, + skel_get_nt_acl, + skel_fset_nt_acl, + skel_set_nt_acl, + + /* POSIX ACL operations */ + + skel_chmod_acl, + skel_fchmod_acl, + + skel_sys_acl_get_entry, + skel_sys_acl_get_tag_type, + skel_sys_acl_get_permset, + skel_sys_acl_get_qualifier, + skel_sys_acl_get_file, + skel_sys_acl_get_fd, + skel_sys_acl_clear_perms, + skel_sys_acl_add_perm, + skel_sys_acl_to_text, + skel_sys_acl_init, + skel_sys_acl_create_entry, + skel_sys_acl_set_tag_type, + skel_sys_acl_set_qualifier, + skel_sys_acl_set_permset, + skel_sys_acl_valid, + skel_sys_acl_set_file, + skel_sys_acl_set_fd, + skel_sys_acl_delete_def_file, + skel_sys_acl_get_perm, + skel_sys_acl_free_text, + skel_sys_acl_free_acl, + skel_sys_acl_free_qualifier +}; -- cgit From 7104dbd245f8c96f3ab90b3f4c44d6adb55ba809 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Sat, 23 Mar 2002 20:48:45 +0000 Subject: Set default recycle directory permissions as 0770. Unlink on rename fail. Jeremy. (This used to be commit 42981c819a07dd35296ecc1ee733ea587f69bcce) --- examples/VFS/recycle.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'examples/VFS') diff --git a/examples/VFS/recycle.c b/examples/VFS/recycle.c index 4e032bb813..74d3657895 100644 --- a/examples/VFS/recycle.c +++ b/examples/VFS/recycle.c @@ -177,13 +177,13 @@ static void recycle_disconnect(struct connection_struct *conn) static BOOL recycle_XXX_exist(connection_struct *conn, const char *dname, BOOL isdir) { - SMB_STRUCT_STAT st; + SMB_STRUCT_STAT st; - if (default_vfs_ops.stat(conn,dname,&st) != 0) - return(False); + if (default_vfs_ops.stat(conn,dname,&st) != 0) + return(False); if (isdir) - return S_ISDIR(st.st_mode) ? True : False; + return S_ISDIR(st.st_mode) ? True : False; else return S_ISREG(st.st_mode) ? True : False; } @@ -200,9 +200,9 @@ static BOOL recycle_file_exist(connection_struct *conn, const char *fname) static SMB_OFF_T recycle_get_file_size(connection_struct *conn, const char *fname) { - SMB_STRUCT_STAT st; + SMB_STRUCT_STAT st; - if (default_vfs_ops.stat(conn,fname,&st) != 0) + if (default_vfs_ops.stat(conn,fname,&st) != 0) return (SMB_OFF_T)-1; return(st.st_size); @@ -219,7 +219,7 @@ static int recycle_unlink(connection_struct *conn, const char *inname) char *base, *ext; pstring bin; int i=1, len, addlen; - int dir_mask=0700; + int dir_mask=0770; SMB_BIG_UINT dfree,dsize,bsize; *recycle_bin = '\0'; @@ -274,8 +274,11 @@ static int recycle_unlink(connection_struct *conn, const char *inname) DEBUG(3, ("recycle bin: move %s -> %s\n", fname, bin)); ret = default_vfs_ops.rename(conn, fname, bin); - if (ret == -1) + if (ret == -1) { DEBUG(3, ("recycle bin: move error %d (%s)\n", errno, strerror(errno) )); + DEBUG(3, ("recycle bin: move failed, purging...\n")); + return default_vfs_ops.unlink(conn,fname); + } return ret; } else { DEBUG(3, ("recycle bin: move failed, purging...\n")); -- cgit From 3ca09d432c1ec65944da279b7851b960dd564870 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Sat, 11 May 2002 00:33:51 +0000 Subject: Fixes for recycle bin VFS for FreeBSD from "Scot W. Hetzel" . Jeremy (This used to be commit 68b83335de0215314c2234aa83069d8fb8265b80) --- examples/VFS/Makefile | 3 ++- examples/VFS/recycle.c | 20 +++++++++++++------- 2 files changed, 15 insertions(+), 8 deletions(-) (limited to 'examples/VFS') diff --git a/examples/VFS/Makefile b/examples/VFS/Makefile index 716e48da88..f93cd0cb2d 100644 --- a/examples/VFS/Makefile +++ b/examples/VFS/Makefile @@ -10,10 +10,11 @@ LIBTOOL = libtool SAMBA_SRC = ../../source SAMBA_INCL = ../../source/include +POPT_INCL = ../../source/popt UBIQX_SRC = ../../source/ubiqx SMBWR_SRC = ../../source/smbwrapper KRB5_SRC = /usr/kerberos/include -CFLAGS = -I$(SAMBA_SRC) -I$(SAMBA_INCL) -I$(UBIQX_SRC) -I$(SMBWR_SRC) -I$(KRB5_SRC) -Wall -g +CFLAGS = -I$(SAMBA_SRC) -I$(SAMBA_INCL) -I$(POPT_INCL) -I$(UBIQX_SRC) -I$(SMBWR_SRC) -I$(KRB5_SRC) -Wall -g VFS_OBJS = audit.so skel.so recycle.so # Default target diff --git a/examples/VFS/recycle.c b/examples/VFS/recycle.c index 74d3657895..6a1c98ce54 100644 --- a/examples/VFS/recycle.c +++ b/examples/VFS/recycle.c @@ -238,15 +238,18 @@ static int recycle_unlink(connection_struct *conn, const char *inname) return default_vfs_ops.unlink(conn,fname); } - base = strrchr(fname, '/') + 1; - if(base == (char*)1) - ext = strrchr(fname, '.'); - else - ext = strrchr(base, '.'); - + base = strrchr(fname, '/'); pstrcpy(bin, recycle_bin); pstrcat(bin, "/"); - pstrcat(bin, base); + + if(base == NULL) { + ext = strrchr(fname, '.'); + pstrcat(bin, fname); + } else { + ext = strrchr(base, '.'); + pstrcat(bin, base+1); + } + DEBUG(3, ("recycle bin: base %s, ext %s, fname %s, bin %s\n", base, ext, fname, bin)); if(strcmp(fname,bin) == 0) { DEBUG(3, ("recycle bin: file %s exists, purging...\n", fname)); @@ -254,6 +257,9 @@ static int recycle_unlink(connection_struct *conn, const char *inname) } len = strlen(bin); + if ( ext != NULL) + len = len - strlen(ext); + addlen = sizeof(pstring)-len-1; while(recycle_file_exist(conn,bin)) { slprintf(bin+len, addlen, " (Copy #%d)", i++); -- cgit From 0dd693bd98aa054c22aa294ab880eb4b5b59ef9f Mon Sep 17 00:00:00 2001 From: John Terpstra Date: Sat, 15 Jun 2002 07:34:06 +0000 Subject: x source path so this thing compiles. (This used to be commit fb89be135575561f759a299048ed1eb5363183c3) --- examples/VFS/block/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'examples/VFS') diff --git a/examples/VFS/block/Makefile b/examples/VFS/block/Makefile index dcc7c07793..44b08681d6 100644 --- a/examples/VFS/block/Makefile +++ b/examples/VFS/block/Makefile @@ -8,7 +8,7 @@ CC = gcc LIBTOOL = libtool -SAMBA_SRC = /usr/local/src/samba/samba-2.2.0-ron/source +SAMBA_SRC = ../../../source SAMBA_INCL = ${SAMBA_SRC}/include UBIQX_SRC = ${SAMBA_SRC}/ubiqx SMBWR_SRC = ${SAMBA_SRC}/smbwrapper -- cgit From edb9158f09d488d9f98dffe477808dd3909b693a Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Tue, 30 Jul 2002 09:59:53 +0000 Subject: OK! Finally the cascaded VFS patch is in. Testing is very welcome, specially with layered multiple vfs modules. A big thank to Alexander Bokovoy for his work and patience :) Simo. (This used to be commit 56283601afe1836dafe0580532f014e29593c463) --- examples/VFS/Makefile | 44 ++++---- examples/VFS/audit.c | 174 +++++++++++-------------------- examples/VFS/block/Makefile | 44 ++++---- examples/VFS/block/block.c | 144 ++++++++------------------ examples/VFS/recycle.c | 139 +++++++------------------ examples/VFS/skel.c | 243 +++++++++++++++++--------------------------- 6 files changed, 276 insertions(+), 512 deletions(-) (limited to 'examples/VFS') diff --git a/examples/VFS/Makefile b/examples/VFS/Makefile index f93cd0cb2d..c8e8b8c4a5 100644 --- a/examples/VFS/Makefile +++ b/examples/VFS/Makefile @@ -1,37 +1,43 @@ -# -# Makefile for samba-vfs examples -# -# +# Generated automatically from Makefile.in by configure. +MAKEFILE = Makefile.vfs -# Variables +include $(MAKEFILE) -CC = gcc -LIBTOOL = libtool - -SAMBA_SRC = ../../source -SAMBA_INCL = ../../source/include -POPT_INCL = ../../source/popt -UBIQX_SRC = ../../source/ubiqx -SMBWR_SRC = ../../source/smbwrapper -KRB5_SRC = /usr/kerberos/include -CFLAGS = -I$(SAMBA_SRC) -I$(SAMBA_INCL) -I$(POPT_INCL) -I$(UBIQX_SRC) -I$(SMBWR_SRC) -I$(KRB5_SRC) -Wall -g -VFS_OBJS = audit.so skel.so recycle.so +CC = gcc +LIBTOOL = libtool +CFLAGS = -O -Wall -g -O2 -march=i386 -mcpu=i686 -I/usr/kerberos/include $(VFS_CFLAGS) +CPPFLAGS = -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -I/usr/kerberos/include $(VFS_CPPFLAGS) +LDFLAGS = -Wl,-rpath,/usr/lib -L/usr/kerberos/lib $(VFS_LDFLAGS) +LDSHFLAGS = -shared +srcdir = /home/sorce/devel/samba/cascaded-vfs/samba/source +FLAGS = $(CFLAGS) -Iinclude -I$(srcdir)/include -I$(srcdir)/ubiqx -I$(srcdir)/smbwrapper -I. $(CPPFLAGS) -I$(srcdir) # Default target default: $(VFS_OBJS) +# if file doesn't exist try to create one; +# it is possible that some variables will be +# defined correctly +Makefile.vfs: + @echo -ne "VFS_OBJS\t= " > $(MAKEFILE); \ + for i in *.c; do \ + echo -n $$i" " | sed -e 's/\(.*\)\.c\(.*\)/\1\.so\2/g' >> $(MAKEFILE); \ + done; \ + echo -ne "\nVFS_CFLAGS\t= \nVFS_CPPFLAGS\t= \nVFS_LDFLAGS\t= \n" >> $(MAKEFILE) + make + # Pattern rules %.so: %.lo - $(LIBTOOL) $(CC) -shared -o $@ $< $(LDFLAGS) + $(LIBTOOL) $(CC) $(LDSHFLAGS) $(LDFLAGS) -o $@ $< %.lo: %.c - $(LIBTOOL) $(CC) $(CPPFLAGS) $(CFLAGS) -c $< + $(LIBTOOL) $(CC) $(FLAGS) -c $< # Misc targets clean: rm -rf .libs rm -f core *~ *% *.bak \ - $(VFS_OBJS) $(VFS_OBJS:.so=.o) $(VFS_OBJS:.so=.lo) + $(VFS_OBJS) $(VFS_OBJS:.so=.o) $(VFS_OBJS:.so=.lo) diff --git a/examples/VFS/audit.c b/examples/VFS/audit.c index aad483c295..92b78c1c32 100644 --- a/examples/VFS/audit.c +++ b/examples/VFS/audit.c @@ -3,6 +3,7 @@ * facility. * * Copyright (C) Tim Potter, 1999-2000 + * Copyright (C) Alexander Bokovoy, 2002 * * 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 @@ -47,134 +48,79 @@ /* Function prototypes */ -int audit_connect(struct connection_struct *conn, const char *svc, const char *user); -void audit_disconnect(struct connection_struct *conn); -DIR *audit_opendir(struct connection_struct *conn, const char *fname); -int audit_mkdir(struct connection_struct *conn, const char *path, mode_t mode); -int audit_rmdir(struct connection_struct *conn, const char *path); -int audit_open(struct connection_struct *conn, const char *fname, int flags, mode_t mode); -int audit_close(struct files_struct *fsp, int fd); -int audit_rename(struct connection_struct *conn, const char *old, const char *new); -int audit_unlink(struct connection_struct *conn, const char *path); -int audit_chmod(struct connection_struct *conn, const char *path, mode_t mode); -int audit_chmod_acl(struct connection_struct *conn, const char *name, mode_t mode); -int audit_fchmod(struct files_struct *fsp, int fd, mode_t mode); -int audit_fchmod_acl(struct files_struct *fsp, int fd, mode_t mode); +static int audit_connect(struct connection_struct *conn, const char *svc, const char *user); +static void audit_disconnect(struct connection_struct *conn); +static DIR *audit_opendir(struct connection_struct *conn, const char *fname); +static int audit_mkdir(struct connection_struct *conn, const char *path, mode_t mode); +static int audit_rmdir(struct connection_struct *conn, const char *path); +static int audit_open(struct connection_struct *conn, const char *fname, int flags, mode_t mode); +static int audit_close(struct files_struct *fsp, int fd); +static int audit_rename(struct connection_struct *conn, const char *old, const char *new); +static int audit_unlink(struct connection_struct *conn, const char *path); +static int audit_chmod(struct connection_struct *conn, const char *path, mode_t mode); +static int audit_chmod_acl(struct connection_struct *conn, const char *name, mode_t mode); +static int audit_fchmod(struct files_struct *fsp, int fd, mode_t mode); +static int audit_fchmod_acl(struct files_struct *fsp, int fd, mode_t mode); /* VFS operations */ -extern struct vfs_ops default_vfs_ops; /* For passthrough operation */ +static struct vfs_ops default_vfs_ops; /* For passthrough operation */ +static struct smb_vfs_handle_struct *audit_handle; -struct vfs_ops audit_ops = { +static vfs_op_tuple audit_ops[] = { /* Disk operations */ - audit_connect, - audit_disconnect, - NULL, /* disk free */ + {audit_connect, SMB_VFS_OP_CONNECT, SMB_VFS_LAYER_LOGGER}, + {audit_disconnect, SMB_VFS_OP_DISCONNECT, SMB_VFS_LAYER_LOGGER}, /* Directory operations */ - audit_opendir, - NULL, /* readdir */ - audit_mkdir, - audit_rmdir, - NULL, /* closedir */ + {audit_opendir, SMB_VFS_OP_OPENDIR, SMB_VFS_LAYER_LOGGER}, + {audit_mkdir, SMB_VFS_OP_MKDIR, SMB_VFS_LAYER_LOGGER}, + {audit_rmdir, SMB_VFS_OP_RMDIR, SMB_VFS_LAYER_LOGGER}, /* File operations */ - audit_open, - audit_close, - NULL, /* read */ - NULL, /* write */ - NULL, /* lseek */ - audit_rename, - NULL, /* fsync */ - NULL, /* stat */ - NULL, /* fstat */ - NULL, /* lstat */ - audit_unlink, - audit_chmod, - audit_fchmod, - NULL, /* chown */ - NULL, /* fchown */ - NULL, /* chdir */ - NULL, /* getwd */ - NULL, /* utime */ - NULL, /* ftruncate */ - NULL, /* lock */ - NULL, /* symlink */ - NULL, /* readlink */ - NULL, /* link */ - NULL, /* mknod */ - NULL, /* realpath */ - NULL, /* fget_nt_acl */ - NULL, /* get_nt_acl */ - NULL, /* fset_nt_acl */ - NULL, /* set_nt_acl */ - - audit_chmod_acl, /* chmod_acl */ - audit_fchmod_acl, /* fchmod_acl */ - - NULL, /* sys_acl_get_entry */ - NULL, /* sys_acl_get_tag_type */ - NULL, /* sys_acl_get_permset */ - NULL, /*sys_acl_get_qualifier */ - NULL, /* sys_acl_get_file */ - NULL, /* sys_acl_get_fd */ - NULL, /* sys_acl_clear_perms */ - NULL, /* sys_acl_add_perm */ - NULL, /* sys_acl_to_text */ - NULL, /* sys_acl_init */ - NULL, /* sys_acl_create_entry */ - NULL, /* sys_acl_set_tag_type */ - NULL, /* sys_acl_set_qualifier */ - NULL, /* sys_acl_set_permset */ - NULL, /* sys_acl_valid */ - NULL, /* sys_acl_set_file */ - NULL, /* sys_acl_set_fd */ - NULL, /* sys_acl_delete_def_file */ - NULL, /* sys_acl_get_perm */ - NULL, /* sys_acl_free_text */ - NULL, /* sys_acl_free_acl */ - NULL /* sys_acl_free_qualifier */ + {audit_open, SMB_VFS_OP_OPEN, SMB_VFS_LAYER_LOGGER}, + {audit_close, SMB_VFS_OP_CLOSE, SMB_VFS_LAYER_LOGGER}, + {audit_rename, SMB_VFS_OP_RENAME, SMB_VFS_LAYER_LOGGER}, + {audit_unlink, SMB_VFS_OP_UNLINK, SMB_VFS_LAYER_LOGGER}, + {audit_chmod, SMB_VFS_OP_CHMOD, SMB_VFS_LAYER_LOGGER}, + {audit_fchmod, SMB_VFS_OP_FCHMOD, SMB_VFS_LAYER_LOGGER}, + {audit_chmod_acl, SMB_VFS_OP_CHMOD_ACL, SMB_VFS_LAYER_LOGGER}, + {audit_fchmod_acl, SMB_VFS_OP_FCHMOD_ACL, SMB_VFS_LAYER_LOGGER}, + + /* Finish VFS operations definition */ + + {NULL, SMB_VFS_OP_NOOP, SMB_VFS_LAYER_NOOP} }; -/* VFS initialisation function. Return initialised vfs_ops structure - back to SAMBA. */ +/* VFS initialisation function. Return vfs_op_tuple array back to SAMBA. */ -struct vfs_ops *vfs_init(int *vfs_version, struct vfs_ops *def_vfs_ops) +vfs_op_tuple *vfs_init(int *vfs_version, struct vfs_ops *def_vfs_ops, + struct smb_vfs_handle_struct *vfs_handle) { - struct vfs_ops tmp_ops; - *vfs_version = SMB_VFS_INTERFACE_VERSION; - memcpy(&tmp_ops, def_vfs_ops, sizeof(struct vfs_ops)); - - tmp_ops.connect = audit_connect; - tmp_ops.disconnect = audit_disconnect; - tmp_ops.opendir = audit_opendir; - tmp_ops.mkdir = audit_mkdir; - tmp_ops.rmdir = audit_rmdir; - tmp_ops.open = audit_open; - tmp_ops.close = audit_close; - tmp_ops.rename = audit_rename; - tmp_ops.unlink = audit_unlink; - tmp_ops.chmod = audit_chmod; - tmp_ops.chmod_acl = audit_chmod_acl; - tmp_ops.fchmod = audit_fchmod; - tmp_ops.fchmod_acl = audit_fchmod_acl; - - memcpy(&audit_ops, &tmp_ops, sizeof(struct vfs_ops)); + memcpy(&default_vfs_ops, def_vfs_ops, sizeof(struct vfs_ops)); + + audit_handle = vfs_handle; openlog("smbd_audit", LOG_PID, SYSLOG_FACILITY); syslog(SYSLOG_PRIORITY, "VFS_INIT: vfs_ops loaded\n"); - return &audit_ops; + return audit_ops; +} + +/* VFS finalization function. */ +void vfs_done(connection_struct *conn) +{ + syslog(SYSLOG_PRIORITY, "VFS_DONE: vfs module unloaded\n"); } /* Implementation of vfs_ops. Pass everything on to the default operation but log event first. */ -int audit_connect(struct connection_struct *conn, const char *svc, const char *user) +static int audit_connect(struct connection_struct *conn, const char *svc, const char *user) { syslog(SYSLOG_PRIORITY, "connect to service %s by user %s\n", svc, user); @@ -182,13 +128,13 @@ int audit_connect(struct connection_struct *conn, const char *svc, const char *u return default_vfs_ops.connect(conn, svc, user); } -void audit_disconnect(struct connection_struct *conn) +static void audit_disconnect(struct connection_struct *conn) { syslog(SYSLOG_PRIORITY, "disconnected\n"); default_vfs_ops.disconnect(conn); } -DIR *audit_opendir(struct connection_struct *conn, const char *fname) +static DIR *audit_opendir(struct connection_struct *conn, const char *fname) { DIR *result = default_vfs_ops.opendir(conn, fname); @@ -200,7 +146,7 @@ DIR *audit_opendir(struct connection_struct *conn, const char *fname) return result; } -int audit_mkdir(struct connection_struct *conn, const char *path, mode_t mode) +static int audit_mkdir(struct connection_struct *conn, const char *path, mode_t mode) { int result = default_vfs_ops.mkdir(conn, path, mode); @@ -212,7 +158,7 @@ int audit_mkdir(struct connection_struct *conn, const char *path, mode_t mode) return result; } -int audit_rmdir(struct connection_struct *conn, const char *path) +static int audit_rmdir(struct connection_struct *conn, const char *path) { int result = default_vfs_ops.rmdir(conn, path); @@ -224,7 +170,7 @@ int audit_rmdir(struct connection_struct *conn, const char *path) return result; } -int audit_open(struct connection_struct *conn, const char *fname, int flags, mode_t mode) +static int audit_open(struct connection_struct *conn, const char *fname, int flags, mode_t mode) { int result = default_vfs_ops.open(conn, fname, flags, mode); @@ -237,7 +183,7 @@ int audit_open(struct connection_struct *conn, const char *fname, int flags, mod return result; } -int audit_close(struct files_struct *fsp, int fd) +static int audit_close(struct files_struct *fsp, int fd) { int result = default_vfs_ops.close(fsp, fd); @@ -249,7 +195,7 @@ int audit_close(struct files_struct *fsp, int fd) return result; } -int audit_rename(struct connection_struct *conn, const char *old, const char *new) +static int audit_rename(struct connection_struct *conn, const char *old, const char *new) { int result = default_vfs_ops.rename(conn, old, new); @@ -261,7 +207,7 @@ int audit_rename(struct connection_struct *conn, const char *old, const char *ne return result; } -int audit_unlink(struct connection_struct *conn, const char *path) +static int audit_unlink(struct connection_struct *conn, const char *path) { int result = default_vfs_ops.unlink(conn, path); @@ -273,7 +219,7 @@ int audit_unlink(struct connection_struct *conn, const char *path) return result; } -int audit_chmod(struct connection_struct *conn, const char *path, mode_t mode) +static int audit_chmod(struct connection_struct *conn, const char *path, mode_t mode) { int result = default_vfs_ops.chmod(conn, path, mode); @@ -285,7 +231,7 @@ int audit_chmod(struct connection_struct *conn, const char *path, mode_t mode) return result; } -int audit_chmod_acl(struct connection_struct *conn, const char *path, mode_t mode) +static int audit_chmod_acl(struct connection_struct *conn, const char *path, mode_t mode) { int result = default_vfs_ops.chmod_acl(conn, path, mode); @@ -297,7 +243,7 @@ int audit_chmod_acl(struct connection_struct *conn, const char *path, mode_t mod return result; } -int audit_fchmod(struct files_struct *fsp, int fd, mode_t mode) +static int audit_fchmod(struct files_struct *fsp, int fd, mode_t mode) { int result = default_vfs_ops.fchmod(fsp, fd, mode); @@ -309,7 +255,7 @@ int audit_fchmod(struct files_struct *fsp, int fd, mode_t mode) return result; } -int audit_fchmod_acl(struct files_struct *fsp, int fd, mode_t mode) +static int audit_fchmod_acl(struct files_struct *fsp, int fd, mode_t mode) { int result = default_vfs_ops.fchmod_acl(fsp, fd, mode); diff --git a/examples/VFS/block/Makefile b/examples/VFS/block/Makefile index 44b08681d6..c8e8b8c4a5 100644 --- a/examples/VFS/block/Makefile +++ b/examples/VFS/block/Makefile @@ -1,37 +1,43 @@ -# -# Makefile for samba-vfs examples -# -# +# Generated automatically from Makefile.in by configure. +MAKEFILE = Makefile.vfs -# Variables +include $(MAKEFILE) -CC = gcc -LIBTOOL = libtool - -SAMBA_SRC = ../../../source -SAMBA_INCL = ${SAMBA_SRC}/include -UBIQX_SRC = ${SAMBA_SRC}/ubiqx -SMBWR_SRC = ${SAMBA_SRC}/smbwrapper -CFLAGS = -I$(SAMBA_SRC) -I$(SAMBA_INCL) -I$(UBIQX_SRC) -I$(SMBWR_SRC) -Wall -g -D_LARGEFILE63_SOURCE -D_GNU_SOURCE -fno-builtin - - -VFS_OBJS = block.so +CC = gcc +LIBTOOL = libtool +CFLAGS = -O -Wall -g -O2 -march=i386 -mcpu=i686 -I/usr/kerberos/include $(VFS_CFLAGS) +CPPFLAGS = -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -I/usr/kerberos/include $(VFS_CPPFLAGS) +LDFLAGS = -Wl,-rpath,/usr/lib -L/usr/kerberos/lib $(VFS_LDFLAGS) +LDSHFLAGS = -shared +srcdir = /home/sorce/devel/samba/cascaded-vfs/samba/source +FLAGS = $(CFLAGS) -Iinclude -I$(srcdir)/include -I$(srcdir)/ubiqx -I$(srcdir)/smbwrapper -I. $(CPPFLAGS) -I$(srcdir) # Default target default: $(VFS_OBJS) +# if file doesn't exist try to create one; +# it is possible that some variables will be +# defined correctly +Makefile.vfs: + @echo -ne "VFS_OBJS\t= " > $(MAKEFILE); \ + for i in *.c; do \ + echo -n $$i" " | sed -e 's/\(.*\)\.c\(.*\)/\1\.so\2/g' >> $(MAKEFILE); \ + done; \ + echo -ne "\nVFS_CFLAGS\t= \nVFS_CPPFLAGS\t= \nVFS_LDFLAGS\t= \n" >> $(MAKEFILE) + make + # Pattern rules %.so: %.lo - $(LIBTOOL) $(CC) -shared -o $@ $< $(LDFLAGS) + $(LIBTOOL) $(CC) $(LDSHFLAGS) $(LDFLAGS) -o $@ $< %.lo: %.c - $(LIBTOOL) $(CC) $(CPPFLAGS) $(CFLAGS) -c $< + $(LIBTOOL) $(CC) $(FLAGS) -c $< # Misc targets clean: rm -rf .libs rm -f core *~ *% *.bak \ - $(VFS_OBJS) $(VFS_OBJS:.so=.o) $(VFS_OBJS:.so=.lo) + $(VFS_OBJS) $(VFS_OBJS:.so=.o) $(VFS_OBJS:.so=.lo) diff --git a/examples/VFS/block/block.c b/examples/VFS/block/block.c index f83ab6e07e..9478b75f0f 100644 --- a/examples/VFS/block/block.c +++ b/examples/VFS/block/block.c @@ -3,6 +3,7 @@ * Block access from links to dev mount points specified in PARAMCONF file * * Copyright (C) Ronald Kuetemeier, 2001 + * Copyright (C) Alexander Bokovoy, 2002 * * 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 @@ -47,93 +48,29 @@ -DIR *block_opendir(struct connection_struct *conn, char *fname); -int block_connect(struct connection_struct *conn, const char *service, const char *user); -void block_disconnect(struct connection_struct *conn); +static DIR *block_opendir(connection_struct *conn, char *fname); +static int block_connect(connection_struct *conn, const char *service, const char *user); +static void block_disconnect(connection_struct *conn); +static struct smb_vfs_handle_struct *block_handle; /* VFS operations */ -extern struct vfs_ops default_vfs_ops; /* For passthrough operation */ +static struct vfs_ops default_vfs_ops; /* For passthrough operation */ -struct vfs_ops execute_vfs_ops = { +static vfs_op_tuple block_vfs_ops[] = { /* Disk operations */ - block_connect, - block_disconnect, - NULL, /* disk free */ + {block_connect, SMB_VFS_OP_CONNECT, SMB_VFS_LAYER_TRANSPARENT}, + {block_disconnect, SMB_VFS_OP_DISCONNECT, SMB_VFS_LAYER_TRANSPARENT}, /* Directory operations */ - block_opendir, - NULL, /* readdir */ - NULL, /* mkdir */ - NULL, /* rmdir */ - NULL, /* closedir */ - - /* File operations */ - - NULL, /* open */ - NULL, /* close */ - NULL, /* read */ - NULL, /* write */ - NULL, /* lseek */ - NULL, /* rename */ - NULL, /* fsync */ - NULL, /* stat */ - NULL, /* fstat */ - NULL, /* lstat */ - NULL, /* unlink */ - NULL, /* chmod */ - NULL, /* fchmod */ - NULL, /* chown */ - NULL, /* fchown */ - NULL, /* chdir */ - NULL, /* getwd */ - NULL, /* utime */ - NULL, /* ftruncate */ - NULL, /* lock */ - NULL, /* symlink */ - NULL, /* readlink */ - NULL, /* link */ - NULL, /* mknod */ - NULL, /* realpath */ - - /* NT ACL operations */ - - NULL, /* fget_nt_acl */ - NULL, /* get_nt_acl */ - NULL, /* fset_nt_acl */ - NULL, /* set_nt_acl */ - - /* POSIX ACL operations. */ - - NULL, /* chmod_acl */ - NULL, /* fchmod_acl */ - NULL, /* sys_acl_get_entry */ - NULL, /* sys_acl_get_tag_type */ - NULL, /* sys_acl_get_permset */ - NULL, /* sys_acl_get_qualifier */ - NULL, /* sys_acl_get_file */ - NULL, /* sys_acl_get_fd */ - NULL, /* sys_acl_clear_perms */ - NULL, /* sys_acl_add_perm */ - NULL, /* sys_acl_to_text */ - NULL, /* sys_acl_init */ - NULL, /* sys_acl_create_entry */ - NULL, /* sys_acl_set_tag_type */ - NULL, /* sys_acl_set_qualifier */ - NULL, /* sys_acl_set_permset */ - NULL, /* sys_acl_valid */ - NULL, /* sys_acl_set_file */ - NULL, /* sys_acl_set_fd */ - NULL, /* sys_acl_delete_def_file */ - NULL, /* sys_acl_get_perm */ - NULL, /* sys_acl_free_text */ - NULL, /* sys_acl_free_acl */ - NULL /* sys_acl_free_qualifier */ + {block_opendir, SMB_VFS_OP_OPENDIR, SMB_VFS_LAYER_TRANSPARENT}, + + {NULL, SMB_VFS_OP_NOOP, SMB_VFS_LAYER_NOOP} }; @@ -145,13 +82,13 @@ extern BOOL pm_process(char *FileName, BOOL (*sfunc)(char *), BOOL(*pfunc)(char //functions -BOOL enter_pblock_mount(char *dir); -BOOL get_section(char *sect); -BOOL get_parameter_value(char *param, char *value); -BOOL load_param(void); -BOOL search(struct stat *stat_buf); -BOOL dir_search(char *link, char *dir); -BOOL enter_pblock_dir(char *dir); +static BOOL enter_pblock_mount(char *dir); +static BOOL get_section(char *sect); +static BOOL get_parameter_value(char *param, char *value); +static BOOL load_param(void); +static BOOL search(struct stat *stat_buf); +static BOOL dir_search(char *link, char *dir); +static BOOL enter_pblock_dir(char *dir); @@ -176,7 +113,7 @@ static struct block_dir *pblock_dir = NULL; * Load the conf file into a table */ -BOOL load_param(void) +static BOOL load_param(void) { if ((pm_process(PARAMCONF,&get_section,&get_parameter_value)) == TRUE) @@ -194,7 +131,7 @@ BOOL load_param(void) * */ -BOOL enter_pblock_mount(char *dir) +static BOOL enter_pblock_mount(char *dir) { struct stat stat_buf; static struct block_dir *tmp_pblock; @@ -242,7 +179,7 @@ BOOL enter_pblock_mount(char *dir) * */ -BOOL enter_pblock_dir(char *dir) +static BOOL enter_pblock_dir(char *dir) { static struct block_dir *tmp_pblock; @@ -285,7 +222,7 @@ BOOL enter_pblock_dir(char *dir) * Function callback for config section names */ -BOOL get_section(char *sect) +static BOOL get_section(char *sect) { return TRUE; } @@ -297,7 +234,7 @@ BOOL get_section(char *sect) * */ -BOOL get_parameter_value(char *param, char *value) +static BOOL get_parameter_value(char *param, char *value) { int i = 0, maxargs = sizeof(params) / sizeof(char *); @@ -327,24 +264,25 @@ BOOL get_parameter_value(char *param, char *value) -/* VFS initialisation function. Return initialised vfs_ops structure +/* VFS initialisation function. Return initialised vfs_op_tuple array back to SAMBA. */ -struct vfs_ops *vfs_init(int *vfs_version, struct vfs_ops *def_vfs_ops) +vfs_op_tuple *vfs_init(int *vfs_version, struct vfs_ops *def_vfs_ops, + struct smb_vfs_handle_struct *vfs_handle) { - struct vfs_ops tmp_ops; - *vfs_version = SMB_VFS_INTERFACE_VERSION; - memcpy(&tmp_ops, def_vfs_ops, sizeof(struct vfs_ops)); + memcpy(&default_vfs_ops, def_vfs_ops, sizeof(struct vfs_ops)); + + block_handle = vfs_handle; + + return block_vfs_ops; +} - /* Override the ones we want. */ - tmp_ops.connect = block_connect; - tmp_ops.disconnect = block_disconnect; - tmp_ops.opendir = block_opendir; - memcpy(&execute_vfs_ops, &tmp_ops, sizeof(struct vfs_ops)); - return(&execute_vfs_ops); +/* VFS finalization function. */ +void vfs_done(connection_struct *conn) +{ } @@ -352,7 +290,7 @@ struct vfs_ops *vfs_init(int *vfs_version, struct vfs_ops *def_vfs_ops) * VFS connect and param file loading */ -int block_connect(struct connection_struct *conn, char *service, char *user) +static int block_connect(connection_struct *conn, const char *service, const char *user) { if((load_param()) == FALSE) { @@ -372,7 +310,7 @@ int block_connect(struct connection_struct *conn, char *service, char *user) */ -void block_disconnect(struct connection_struct *conn) +static void block_disconnect(struct connection_struct *conn) { struct block_dir *tmp_pblock = (pblock_mountp == NULL ? pblock_dir : pblock_mountp); @@ -403,7 +341,7 @@ void block_disconnect(struct connection_struct *conn) * VFS opendir */ -DIR *block_opendir(struct connection_struct *conn, char *fname) +static DIR *block_opendir(struct connection_struct *conn, char *fname) { char *dir_name = NULL; @@ -437,7 +375,7 @@ DIR *block_opendir(struct connection_struct *conn, char *fname) * Find mount point to block in list */ -BOOL search(struct stat *stat_buf) +static BOOL search(struct stat *stat_buf) { struct block_dir *tmp_pblock = pblock_mountp; @@ -459,7 +397,7 @@ BOOL search(struct stat *stat_buf) * Find dir in list to block id the starting point is link from a share */ -BOOL dir_search(char *link, char *dir) +static BOOL dir_search(char *link, char *dir) { char buf[PATH_MAX +1], *ext_path; int len = 0; diff --git a/examples/VFS/recycle.c b/examples/VFS/recycle.c index 6a1c98ce54..ed89e59abf 100644 --- a/examples/VFS/recycle.c +++ b/examples/VFS/recycle.c @@ -4,6 +4,7 @@ * * Copyright (C) 2001, Brandon Stone, Amherst College, . * Copyright (C) 2002, Jeremy Allison - modified to make a VFS module. + * Copyright (C) 2002, Alexander Bokovoy - cascaded VFS adoption, * * 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 @@ -40,139 +41,67 @@ /* VFS operations */ -extern struct vfs_ops default_vfs_ops; /* For passthrough operation */ - +static struct vfs_ops default_vfs_ops; /* For passthrough operation */ +static struct smb_vfs_handle_struct *recycle_handle; static int recycle_unlink(connection_struct *, const char *); static int recycle_connect(struct connection_struct *conn, const char *service, const char *user); static void recycle_disconnect(struct connection_struct *conn); -struct vfs_ops recycle_ops = { - - /* Disk operations */ - - recycle_connect, /* connect */ - recycle_disconnect, /* disconnect */ - NULL, /* disk free */ +static vfs_op_tuple recycle_ops[] = { - /* Directory operations */ + /* Disk operations */ - NULL, /* opendir */ - NULL, /* readdir */ - NULL, /* mkdir */ - NULL, /* rmdir */ - NULL, /* closedir */ + {recycle_connect, SMB_VFS_OP_CONNECT, SMB_VFS_LAYER_OPAQUE}, + {recycle_disconnect, SMB_VFS_OP_DISCONNECT, SMB_VFS_LAYER_OPAQUE}, /* File operations */ - - NULL, /* open */ - NULL, /* close */ - NULL, /* read */ - NULL, /* write */ - NULL, /* lseek */ - NULL, /* rename */ - NULL, /* fsync */ - NULL, /* stat */ - NULL, /* fstat */ - NULL, /* lstat */ - recycle_unlink, - NULL, /* chmod */ - NULL, /* fchmod */ - NULL, /* chown */ - NULL, /* fchown */ - NULL, /* chdir */ - NULL, /* getwd */ - NULL, /* utime */ - NULL, /* ftruncate */ - NULL, /* lock */ - NULL, /* symlink */ - NULL, /* readlink */ - NULL, /* link */ - NULL, /* mknod */ - NULL, /* realpath */ - NULL, /* fget_nt_acl */ - NULL, /* get_nt_acl */ - NULL, /* fset_nt_acl */ - NULL, /* set_nt_acl */ - - NULL, /* chmod_acl */ - NULL, /* fchmod_acl */ - - NULL, /* sys_acl_get_entry */ - NULL, /* sys_acl_get_tag_type */ - NULL, /* sys_acl_get_permset */ - NULL, /* sys_acl_get_qualifier */ - NULL, /* sys_acl_get_file */ - NULL, /* sys_acl_get_fd */ - NULL, /* sys_acl_clear_perms */ - NULL, /* sys_acl_add_perm */ - NULL, /* sys_acl_to_text */ - NULL, /* sys_acl_init */ - NULL, /* sys_acl_create_entry */ - NULL, /* sys_acl_set_tag_type */ - NULL, /* sys_acl_set_qualifier */ - NULL, /* sys_acl_set_permset */ - NULL, /* sys_acl_valid */ - NULL, /* sys_acl_set_file */ - NULL, /* sys_acl_set_fd */ - NULL, /* sys_acl_delete_def_file */ - NULL, /* sys_acl_get_perm */ - NULL, /* sys_acl_free_text */ - NULL, /* sys_acl_free_acl */ - NULL /* sys_acl_free_qualifier */ + + {recycle_unlink, SMB_VFS_OP_UNLINK, SMB_VFS_LAYER_OPAQUE}, + + {NULL, SMB_VFS_OP_NOOP, SMB_VFS_LAYER_NOOP} }; -/* VFS initialisation function. Return initialised vfs_ops structure - back to SAMBA. */ +/* VFS initialisation function. Return initialised vfs_op_tuple array back to SAMBA. */ -struct vfs_ops *vfs_init(int *vfs_version, struct vfs_ops *def_vfs_ops) +vfs_op_tuple *vfs_init(int *vfs_version, struct vfs_ops *def_vfs_ops, + struct smb_vfs_handle_struct *vfs_handle) { - struct vfs_ops tmp_ops; - *vfs_version = SMB_VFS_INTERFACE_VERSION; - memcpy(&tmp_ops, def_vfs_ops, sizeof(struct vfs_ops)); - tmp_ops.unlink = recycle_unlink; - tmp_ops.connect = recycle_connect; - tmp_ops.disconnect = recycle_disconnect; - memcpy(&recycle_ops, &tmp_ops, sizeof(struct vfs_ops)); - return &recycle_ops; + memcpy(&default_vfs_ops, def_vfs_ops, sizeof(struct vfs_ops)); + + /* Remember vfs_id for storing private information at connect */ + recycle_handle = vfs_handle; + + return recycle_ops; +} + +/* VFS finalization function. */ +void vfs_done(connection_struct *conn) +{ + DEBUG(3,("vfs_done_recycle: called for connection %p\n",conn)); } static int recycle_connect(struct connection_struct *conn, const char *service, const char *user) { - pstring opts_str; fstring recycle_bin; - char *p; DEBUG(3,("recycle_connect: called for service %s as user %s\n", service, user)); - pstrcpy(opts_str, (const char *)lp_vfs_options(SNUM(conn))); - if (!*opts_str) { - DEBUG(3,("recycle_connect: No options listed (%s).\n", lp_vfs_options(SNUM(conn)) )); + fstrcpy(recycle_bin, (const char *)lp_parm_string(lp_servicename(SNUM(conn)),"vfs","recycle bin")); + if (!*recycle_bin) { + DEBUG(3,("recycle_connect: No options listed (vfs:recycle bin).\n" )); return 0; /* No options. */ } - p = opts_str; - if (next_token(&p,recycle_bin,"=",sizeof(recycle_bin))) { - if (!strequal("recycle", recycle_bin)) { - DEBUG(3,("recycle_connect: option %s is not recycle\n", recycle_bin )); - return -1; - } - } - - if (!next_token(&p,recycle_bin," \n",sizeof(recycle_bin))) { - DEBUG(3,("recycle_connect: no option after recycle=\n")); - return -1; - } - - DEBUG(10,("recycle_connect: recycle name is %s\n", recycle_bin )); + DEBUG(3,("recycle_connect: recycle name is %s\n", recycle_bin )); - conn->vfs_private = (void *)strdup(recycle_bin); + recycle_handle->data = (void *)strdup(recycle_bin); return 0; } static void recycle_disconnect(struct connection_struct *conn) { - SAFE_FREE(conn->vfs_private); + SAFE_FREE(recycle_handle->data); } static BOOL recycle_XXX_exist(connection_struct *conn, const char *dname, BOOL isdir) @@ -225,8 +154,8 @@ static int recycle_unlink(connection_struct *conn, const char *inname) *recycle_bin = '\0'; pstrcpy(fname, inname); - if (conn->vfs_private) - fstrcpy(recycle_bin, (const char *)conn->vfs_private); + if (recycle_handle->data) + fstrcpy(recycle_bin, (const char *)recycle_handle->data); if(!*recycle_bin) { DEBUG(3, ("recycle bin: share parameter not set, purging %s...\n", fname)); diff --git a/examples/VFS/skel.c b/examples/VFS/skel.c index bb5486e690..b937682822 100644 --- a/examples/VFS/skel.c +++ b/examples/VFS/skel.c @@ -3,6 +3,7 @@ * calls to disk functions. * * Copyright (C) Tim Potter, 1999-2000 + * Copyright (C) Alexander Bokovoy, 2002 * * 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 @@ -38,8 +39,8 @@ #include #include -extern struct vfs_ops default_vfs_ops; /* For passthrough operation */ -extern struct vfs_ops skel_ops; +static struct vfs_ops default_vfs_ops; /* For passthrough operation */ +static struct smb_vfs_handle_struct *skel_handle; /* use skel_handle->data for storing per-instance private data */ static int skel_connect(struct connection_struct *conn, const char *service, const char *user) { @@ -349,172 +350,110 @@ static int skel_sys_acl_free_qualifier(struct connection_struct *conn, void *qua return default_vfs_ops.sys_acl_free_qualifier(conn, qualifier, tagtype); } -/* VFS initialisation - return vfs_ops function pointer structure */ - -struct vfs_ops *vfs_init(int *vfs_version, struct vfs_ops *def_vfs_ops) -{ - struct vfs_ops tmp_ops; - - DEBUG(3, ("Initialising default vfs hooks\n")); - - *vfs_version = SMB_VFS_INTERFACE_VERSION; - memcpy(&tmp_ops, def_vfs_ops, sizeof(struct vfs_ops)); - - tmp_ops.connect = skel_connect; - tmp_ops.disconnect = skel_disconnect; - tmp_ops.disk_free = skel_disk_free; - - /* Directory operations */ - - tmp_ops.opendir = skel_opendir; - tmp_ops.readdir = skel_readdir; - tmp_ops.mkdir = skel_mkdir; - tmp_ops.rmdir = skel_rmdir; - tmp_ops.closedir = skel_closedir; - - /* File operations */ - - tmp_ops.open = skel_open; - tmp_ops.close = skel_close; - tmp_ops.read = skel_read; - tmp_ops.write = skel_write; - tmp_ops.lseek = skel_lseek; - tmp_ops.rename = skel_rename; - tmp_ops.fsync = skel_fsync; - tmp_ops.stat = skel_stat; - tmp_ops.fstat = skel_fstat; - tmp_ops.lstat = skel_lstat; - tmp_ops.unlink = skel_unlink; - tmp_ops.chmod = skel_chmod; - tmp_ops.fchmod = skel_fchmod; - tmp_ops.chown = skel_chown; - tmp_ops.fchown = skel_fchown; - tmp_ops.chdir = skel_chdir; - tmp_ops.getwd = skel_getwd; - tmp_ops.utime = skel_utime; - tmp_ops.ftruncate = skel_ftruncate; - tmp_ops.lock = skel_lock; - tmp_ops.symlink = skel_symlink; - tmp_ops.readlink = skel_readlink; - tmp_ops.link = skel_link; - tmp_ops.mknod = skel_mknod; - tmp_ops.realpath = skel_realpath; - - tmp_ops.fget_nt_acl = skel_fget_nt_acl; - tmp_ops.get_nt_acl = skel_get_nt_acl; - tmp_ops.fset_nt_acl = skel_fset_nt_acl; - tmp_ops.set_nt_acl = skel_set_nt_acl; - - /* POSIX ACL operations. */ - - tmp_ops.chmod_acl = skel_chmod_acl; - tmp_ops.fchmod_acl = skel_fchmod_acl; - tmp_ops.sys_acl_get_entry = skel_sys_acl_get_entry; - tmp_ops.sys_acl_get_tag_type = skel_sys_acl_get_tag_type; - tmp_ops.sys_acl_get_permset = skel_sys_acl_get_permset; - tmp_ops.sys_acl_get_qualifier = skel_sys_acl_get_qualifier; - tmp_ops.sys_acl_get_file = skel_sys_acl_get_file; - tmp_ops.sys_acl_get_fd = skel_sys_acl_get_fd; - tmp_ops.sys_acl_clear_perms = skel_sys_acl_clear_perms; - tmp_ops.sys_acl_add_perm = skel_sys_acl_add_perm; - tmp_ops.sys_acl_to_text = skel_sys_acl_to_text; - tmp_ops.sys_acl_init = skel_sys_acl_init; - tmp_ops.sys_acl_create_entry = skel_sys_acl_create_entry; - tmp_ops.sys_acl_set_tag_type = skel_sys_acl_set_tag_type; - tmp_ops.sys_acl_set_qualifier = skel_sys_acl_set_qualifier; - tmp_ops.sys_acl_set_permset = skel_sys_acl_set_permset; - tmp_ops.sys_acl_valid = skel_sys_acl_valid; - tmp_ops.sys_acl_set_file = skel_sys_acl_set_file; - tmp_ops.sys_acl_set_fd = skel_sys_acl_set_fd; - tmp_ops.sys_acl_delete_def_file = skel_sys_acl_delete_def_file; - tmp_ops.sys_acl_get_perm = skel_sys_acl_get_perm; - tmp_ops.sys_acl_free_text = skel_sys_acl_free_text; - tmp_ops.sys_acl_free_acl = skel_sys_acl_free_acl; - tmp_ops.sys_acl_free_qualifier = skel_sys_acl_free_qualifier; - - memcpy(&skel_ops, &tmp_ops, sizeof(struct vfs_ops)); - - return &skel_ops; -} /* VFS operations structure */ -struct vfs_ops skel_ops = { +static vfs_op_tuple skel_ops[] = { /* Disk operations */ - skel_connect, - skel_disconnect, - skel_disk_free, + {skel_connect, SMB_VFS_OP_CONNECT, SMB_VFS_LAYER_TRANSPARENT}, + {skel_disconnect, SMB_VFS_OP_DISCONNECT, SMB_VFS_LAYER_TRANSPARENT}, + {skel_disk_free, SMB_VFS_OP_DISK_FREE, SMB_VFS_LAYER_TRANSPARENT}, /* Directory operations */ - skel_opendir, - skel_readdir, - skel_mkdir, - skel_rmdir, - skel_closedir, + {skel_opendir, SMB_VFS_OP_OPENDIR, SMB_VFS_LAYER_TRANSPARENT}, + {skel_readdir, SMB_VFS_OP_READDIR, SMB_VFS_LAYER_TRANSPARENT}, + {skel_mkdir, SMB_VFS_OP_MKDIR, SMB_VFS_LAYER_TRANSPARENT}, + {skel_rmdir, SMB_VFS_OP_RMDIR, SMB_VFS_LAYER_TRANSPARENT}, + {skel_closedir, SMB_VFS_OP_CLOSEDIR, SMB_VFS_LAYER_TRANSPARENT}, /* 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, - skel_link, - skel_mknod, - skel_realpath, + {skel_open, SMB_VFS_OP_OPEN, SMB_VFS_LAYER_TRANSPARENT}, + {skel_close, SMB_VFS_OP_CLOSE, SMB_VFS_LAYER_TRANSPARENT}, + {skel_read, SMB_VFS_OP_READ, SMB_VFS_LAYER_TRANSPARENT}, + {skel_write, SMB_VFS_OP_WRITE, SMB_VFS_LAYER_TRANSPARENT}, + {skel_lseek, SMB_VFS_OP_LSEEK, SMB_VFS_LAYER_TRANSPARENT}, + {skel_rename, SMB_VFS_OP_RENAME, SMB_VFS_LAYER_TRANSPARENT}, + {skel_fsync, SMB_VFS_OP_FSYNC, SMB_VFS_LAYER_TRANSPARENT}, + {skel_stat, SMB_VFS_OP_STAT, SMB_VFS_LAYER_TRANSPARENT}, + {skel_fstat, SMB_VFS_OP_FSTAT, SMB_VFS_LAYER_TRANSPARENT}, + {skel_lstat, SMB_VFS_OP_LSTAT, SMB_VFS_LAYER_TRANSPARENT}, + {skel_unlink, SMB_VFS_OP_UNLINK, SMB_VFS_LAYER_TRANSPARENT}, + {skel_chmod, SMB_VFS_OP_CHMOD, SMB_VFS_LAYER_TRANSPARENT}, + {skel_fchmod, SMB_VFS_OP_FCHMOD, SMB_VFS_LAYER_TRANSPARENT}, + {skel_chown, SMB_VFS_OP_CHOWN, SMB_VFS_LAYER_TRANSPARENT}, + {skel_fchown, SMB_VFS_OP_FCHOWN, SMB_VFS_LAYER_TRANSPARENT}, + {skel_chdir, SMB_VFS_OP_CHDIR, SMB_VFS_LAYER_TRANSPARENT}, + {skel_getwd, SMB_VFS_OP_GETWD, SMB_VFS_LAYER_TRANSPARENT}, + {skel_utime, SMB_VFS_OP_UTIME, SMB_VFS_LAYER_TRANSPARENT}, + {skel_ftruncate, SMB_VFS_OP_FTRUNCATE, SMB_VFS_LAYER_TRANSPARENT}, + {skel_lock, SMB_VFS_OP_LOCK, SMB_VFS_LAYER_TRANSPARENT}, + {skel_symlink, SMB_VFS_OP_SYMLINK, SMB_VFS_LAYER_TRANSPARENT}, + {skel_readlink, SMB_VFS_OP_READLINK, SMB_VFS_LAYER_TRANSPARENT}, + {skel_link, SMB_VFS_OP_LINK, SMB_VFS_LAYER_TRANSPARENT}, + {skel_mknod, SMB_VFS_OP_MKNOD, SMB_VFS_LAYER_TRANSPARENT}, + {skel_realpath, SMB_VFS_OP_REALPATH, SMB_VFS_LAYER_TRANSPARENT}, /* NT File ACL operations */ - skel_fget_nt_acl, - skel_get_nt_acl, - skel_fset_nt_acl, - skel_set_nt_acl, + {skel_fget_nt_acl, SMB_VFS_OP_FGET_NT_ACL, SMB_VFS_LAYER_TRANSPARENT}, + {skel_get_nt_acl, SMB_VFS_OP_GET_NT_ACL, SMB_VFS_LAYER_TRANSPARENT}, + {skel_fset_nt_acl, SMB_VFS_OP_FSET_NT_ACL, SMB_VFS_LAYER_TRANSPARENT}, + {skel_set_nt_acl, SMB_VFS_OP_SET_NT_ACL, SMB_VFS_LAYER_TRANSPARENT}, /* POSIX ACL operations */ - skel_chmod_acl, - skel_fchmod_acl, - - skel_sys_acl_get_entry, - skel_sys_acl_get_tag_type, - skel_sys_acl_get_permset, - skel_sys_acl_get_qualifier, - skel_sys_acl_get_file, - skel_sys_acl_get_fd, - skel_sys_acl_clear_perms, - skel_sys_acl_add_perm, - skel_sys_acl_to_text, - skel_sys_acl_init, - skel_sys_acl_create_entry, - skel_sys_acl_set_tag_type, - skel_sys_acl_set_qualifier, - skel_sys_acl_set_permset, - skel_sys_acl_valid, - skel_sys_acl_set_file, - skel_sys_acl_set_fd, - skel_sys_acl_delete_def_file, - skel_sys_acl_get_perm, - skel_sys_acl_free_text, - skel_sys_acl_free_acl, - skel_sys_acl_free_qualifier + {skel_chmod_acl, SMB_VFS_OP_CHMOD_ACL, SMB_VFS_LAYER_TRANSPARENT}, + {skel_fchmod_acl, SMB_VFS_OP_FCHMOD_ACL, SMB_VFS_LAYER_TRANSPARENT}, + + {skel_sys_acl_get_entry, SMB_VFS_OP_SYS_ACL_GET_ENTRY, SMB_VFS_LAYER_TRANSPARENT}, + {skel_sys_acl_get_tag_type, SMB_VFS_OP_SYS_ACL_GET_TAG_TYPE, SMB_VFS_LAYER_TRANSPARENT}, + {skel_sys_acl_get_permset, SMB_VFS_OP_SYS_ACL_GET_PERMSET, SMB_VFS_LAYER_TRANSPARENT}, + {skel_sys_acl_get_qualifier, SMB_VFS_OP_SYS_ACL_GET_QUALIFIER, SMB_VFS_LAYER_TRANSPARENT}, + {skel_sys_acl_get_file, SMB_VFS_OP_SYS_ACL_GET_FILE, SMB_VFS_LAYER_TRANSPARENT}, + {skel_sys_acl_get_fd, SMB_VFS_OP_SYS_ACL_GET_FD, SMB_VFS_LAYER_TRANSPARENT}, + {skel_sys_acl_clear_perms, SMB_VFS_OP_SYS_ACL_CLEAR_PERMS, SMB_VFS_LAYER_TRANSPARENT}, + {skel_sys_acl_add_perm, SMB_VFS_OP_SYS_ACL_ADD_PERM, SMB_VFS_LAYER_TRANSPARENT}, + {skel_sys_acl_to_text, SMB_VFS_OP_SYS_ACL_TO_TEXT, SMB_VFS_LAYER_TRANSPARENT}, + {skel_sys_acl_init, SMB_VFS_OP_SYS_ACL_INIT, SMB_VFS_LAYER_TRANSPARENT}, + {skel_sys_acl_create_entry, SMB_VFS_OP_SYS_ACL_CREATE_ENTRY, SMB_VFS_LAYER_TRANSPARENT}, + {skel_sys_acl_set_tag_type, SMB_VFS_OP_SYS_ACL_SET_TAG_TYPE, SMB_VFS_LAYER_TRANSPARENT}, + {skel_sys_acl_set_qualifier, SMB_VFS_OP_SYS_ACL_SET_QUALIFIER, SMB_VFS_LAYER_TRANSPARENT}, + {skel_sys_acl_set_permset, SMB_VFS_OP_SYS_ACL_SET_PERMSET, SMB_VFS_LAYER_TRANSPARENT}, + {skel_sys_acl_valid, SMB_VFS_OP_SYS_ACL_VALID, SMB_VFS_LAYER_TRANSPARENT}, + {skel_sys_acl_set_file, SMB_VFS_OP_SYS_ACL_SET_FILE, SMB_VFS_LAYER_TRANSPARENT}, + {skel_sys_acl_set_fd, SMB_VFS_OP_SYS_ACL_SET_FD, SMB_VFS_LAYER_TRANSPARENT}, + {skel_sys_acl_delete_def_file, SMB_VFS_OP_SYS_ACL_DELETE_DEF_FILE, SMB_VFS_LAYER_TRANSPARENT}, + {skel_sys_acl_get_perm, SMB_VFS_OP_SYS_ACL_GET_PERM, SMB_VFS_LAYER_TRANSPARENT}, + {skel_sys_acl_free_text, SMB_VFS_OP_SYS_ACL_FREE_TEXT, SMB_VFS_LAYER_TRANSPARENT}, + {skel_sys_acl_free_acl, SMB_VFS_OP_SYS_ACL_FREE_ACL, SMB_VFS_LAYER_TRANSPARENT}, + {skel_sys_acl_free_qualifier, SMB_VFS_OP_SYS_ACL_FREE_QUALIFIER, SMB_VFS_LAYER_TRANSPARENT}, + + {NULL, SMB_VFS_OP_NOOP, SMB_VFS_LAYER_NOOP} }; + +/* VFS initialisation - return initialized vfs_op_tuple array back to Samba */ + +vfs_op_tuple *vfs_init(int *vfs_version, struct vfs_ops *def_vfs_ops, + struct smb_vfs_handle_struct *vfs_handle) +{ + DEBUG(3, ("Initialising default vfs hooks\n")); + + *vfs_version = SMB_VFS_INTERFACE_VERSION; + memcpy(&default_vfs_ops, def_vfs_ops, sizeof(struct vfs_ops)); + + /* Remember vfs_handle for further allocation and referencing of private + information in vfs_handle->data + */ + skel_handle = vfs_handle; + return skel_ops; +} + +/* VFS finalization function */ +void vfs_done(connection_struct *conn) +{ + DEBUG(3, ("Finalizing default vfs hooks\n")); +} -- cgit From 255288df65bf2ebcc5909fc0cb70bc80a7c67343 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Wed, 31 Jul 2002 13:16:14 +0000 Subject: forgot to change the makefile system, sorry (This used to be commit 3e6a11f56a3878e75c4354db214971208d911be3) --- examples/VFS/Makefile | 43 ------------------------------------------ examples/VFS/Makefile.in | 42 +++++++++++++++++++++++++++++++++++++++++ examples/VFS/block/Makefile | 43 ------------------------------------------ examples/VFS/block/Makefile.in | 42 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 84 insertions(+), 86 deletions(-) delete mode 100644 examples/VFS/Makefile create mode 100644 examples/VFS/Makefile.in delete mode 100644 examples/VFS/block/Makefile create mode 100644 examples/VFS/block/Makefile.in (limited to 'examples/VFS') diff --git a/examples/VFS/Makefile b/examples/VFS/Makefile deleted file mode 100644 index c8e8b8c4a5..0000000000 --- a/examples/VFS/Makefile +++ /dev/null @@ -1,43 +0,0 @@ -# Generated automatically from Makefile.in by configure. -MAKEFILE = Makefile.vfs - -include $(MAKEFILE) - -CC = gcc -LIBTOOL = libtool -CFLAGS = -O -Wall -g -O2 -march=i386 -mcpu=i686 -I/usr/kerberos/include $(VFS_CFLAGS) -CPPFLAGS = -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -I/usr/kerberos/include $(VFS_CPPFLAGS) -LDFLAGS = -Wl,-rpath,/usr/lib -L/usr/kerberos/lib $(VFS_LDFLAGS) -LDSHFLAGS = -shared -srcdir = /home/sorce/devel/samba/cascaded-vfs/samba/source -FLAGS = $(CFLAGS) -Iinclude -I$(srcdir)/include -I$(srcdir)/ubiqx -I$(srcdir)/smbwrapper -I. $(CPPFLAGS) -I$(srcdir) - -# Default target - -default: $(VFS_OBJS) - -# if file doesn't exist try to create one; -# it is possible that some variables will be -# defined correctly -Makefile.vfs: - @echo -ne "VFS_OBJS\t= " > $(MAKEFILE); \ - for i in *.c; do \ - echo -n $$i" " | sed -e 's/\(.*\)\.c\(.*\)/\1\.so\2/g' >> $(MAKEFILE); \ - done; \ - echo -ne "\nVFS_CFLAGS\t= \nVFS_CPPFLAGS\t= \nVFS_LDFLAGS\t= \n" >> $(MAKEFILE) - make - -# Pattern rules - -%.so: %.lo - $(LIBTOOL) $(CC) $(LDSHFLAGS) $(LDFLAGS) -o $@ $< - -%.lo: %.c - $(LIBTOOL) $(CC) $(FLAGS) -c $< - -# Misc targets - -clean: - rm -rf .libs - rm -f core *~ *% *.bak \ - $(VFS_OBJS) $(VFS_OBJS:.so=.o) $(VFS_OBJS:.so=.lo) diff --git a/examples/VFS/Makefile.in b/examples/VFS/Makefile.in new file mode 100644 index 0000000000..3126dfa3b8 --- /dev/null +++ b/examples/VFS/Makefile.in @@ -0,0 +1,42 @@ +MAKEFILE = Makefile.vfs + +include $(MAKEFILE) + +CC = @CC@ +LIBTOOL = libtool +CFLAGS = @CFLAGS@ $(VFS_CFLAGS) +CPPFLAGS = @CPPFLAGS@ $(VFS_CPPFLAGS) +LDFLAGS = @LDFLAGS@ $(VFS_LDFLAGS) +LDSHFLAGS = -shared +srcdir = @builddir@ +FLAGS = $(CFLAGS) -Iinclude -I$(srcdir)/include -I$(srcdir)/ubiqx -I$(srcdir)/smbwrapper -I. $(CPPFLAGS) -I$(srcdir) + +# Default target + +default: $(VFS_OBJS) + +# if file doesn't exist try to create one; +# it is possible that some variables will be +# defined correctly +Makefile.vfs: + @echo -ne "VFS_OBJS\t= " > $(MAKEFILE); \ + for i in *.c; do \ + echo -n $$i" " | sed -e 's/\(.*\)\.c\(.*\)/\1\.so\2/g' >> $(MAKEFILE); \ + done; \ + echo -ne "\nVFS_CFLAGS\t= \nVFS_CPPFLAGS\t= \nVFS_LDFLAGS\t= \n" >> $(MAKEFILE) + make + +# Pattern rules + +%.so: %.lo + $(LIBTOOL) $(CC) $(LDSHFLAGS) $(LDFLAGS) -o $@ $< + +%.lo: %.c + $(LIBTOOL) $(CC) $(FLAGS) -c $< + +# Misc targets + +clean: + rm -rf .libs + rm -f core *~ *% *.bak \ + $(VFS_OBJS) $(VFS_OBJS:.so=.o) $(VFS_OBJS:.so=.lo) diff --git a/examples/VFS/block/Makefile b/examples/VFS/block/Makefile deleted file mode 100644 index c8e8b8c4a5..0000000000 --- a/examples/VFS/block/Makefile +++ /dev/null @@ -1,43 +0,0 @@ -# Generated automatically from Makefile.in by configure. -MAKEFILE = Makefile.vfs - -include $(MAKEFILE) - -CC = gcc -LIBTOOL = libtool -CFLAGS = -O -Wall -g -O2 -march=i386 -mcpu=i686 -I/usr/kerberos/include $(VFS_CFLAGS) -CPPFLAGS = -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -I/usr/kerberos/include $(VFS_CPPFLAGS) -LDFLAGS = -Wl,-rpath,/usr/lib -L/usr/kerberos/lib $(VFS_LDFLAGS) -LDSHFLAGS = -shared -srcdir = /home/sorce/devel/samba/cascaded-vfs/samba/source -FLAGS = $(CFLAGS) -Iinclude -I$(srcdir)/include -I$(srcdir)/ubiqx -I$(srcdir)/smbwrapper -I. $(CPPFLAGS) -I$(srcdir) - -# Default target - -default: $(VFS_OBJS) - -# if file doesn't exist try to create one; -# it is possible that some variables will be -# defined correctly -Makefile.vfs: - @echo -ne "VFS_OBJS\t= " > $(MAKEFILE); \ - for i in *.c; do \ - echo -n $$i" " | sed -e 's/\(.*\)\.c\(.*\)/\1\.so\2/g' >> $(MAKEFILE); \ - done; \ - echo -ne "\nVFS_CFLAGS\t= \nVFS_CPPFLAGS\t= \nVFS_LDFLAGS\t= \n" >> $(MAKEFILE) - make - -# Pattern rules - -%.so: %.lo - $(LIBTOOL) $(CC) $(LDSHFLAGS) $(LDFLAGS) -o $@ $< - -%.lo: %.c - $(LIBTOOL) $(CC) $(FLAGS) -c $< - -# Misc targets - -clean: - rm -rf .libs - rm -f core *~ *% *.bak \ - $(VFS_OBJS) $(VFS_OBJS:.so=.o) $(VFS_OBJS:.so=.lo) diff --git a/examples/VFS/block/Makefile.in b/examples/VFS/block/Makefile.in new file mode 100644 index 0000000000..3126dfa3b8 --- /dev/null +++ b/examples/VFS/block/Makefile.in @@ -0,0 +1,42 @@ +MAKEFILE = Makefile.vfs + +include $(MAKEFILE) + +CC = @CC@ +LIBTOOL = libtool +CFLAGS = @CFLAGS@ $(VFS_CFLAGS) +CPPFLAGS = @CPPFLAGS@ $(VFS_CPPFLAGS) +LDFLAGS = @LDFLAGS@ $(VFS_LDFLAGS) +LDSHFLAGS = -shared +srcdir = @builddir@ +FLAGS = $(CFLAGS) -Iinclude -I$(srcdir)/include -I$(srcdir)/ubiqx -I$(srcdir)/smbwrapper -I. $(CPPFLAGS) -I$(srcdir) + +# Default target + +default: $(VFS_OBJS) + +# if file doesn't exist try to create one; +# it is possible that some variables will be +# defined correctly +Makefile.vfs: + @echo -ne "VFS_OBJS\t= " > $(MAKEFILE); \ + for i in *.c; do \ + echo -n $$i" " | sed -e 's/\(.*\)\.c\(.*\)/\1\.so\2/g' >> $(MAKEFILE); \ + done; \ + echo -ne "\nVFS_CFLAGS\t= \nVFS_CPPFLAGS\t= \nVFS_LDFLAGS\t= \n" >> $(MAKEFILE) + make + +# Pattern rules + +%.so: %.lo + $(LIBTOOL) $(CC) $(LDSHFLAGS) $(LDFLAGS) -o $@ $< + +%.lo: %.c + $(LIBTOOL) $(CC) $(FLAGS) -c $< + +# Misc targets + +clean: + rm -rf .libs + rm -f core *~ *% *.bak \ + $(VFS_OBJS) $(VFS_OBJS:.so=.o) $(VFS_OBJS:.so=.lo) -- cgit From ec91716cb79ee0ac059f29cbcc331c114313f1ef Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 18 Aug 2002 20:12:43 +0000 Subject: Add entry about block.so (This used to be commit 6973344fb5207341e98576b1ddbe58a745225e10) --- examples/VFS/README | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'examples/VFS') diff --git a/examples/VFS/README b/examples/VFS/README index c2f39f9727..7a2152fc4d 100644 --- a/examples/VFS/README +++ b/examples/VFS/README @@ -17,6 +17,13 @@ construction. The following VFS modules are given: connect/disconnect, directory opens/create/remove, file open/close/rename/unlink/chmod. + block + A simple module to block access to certain mount points or + directories. This module only hides the specified directories + and all directories beneath them. It should NOT be used to secure + directories. If the name of a file in one of those directories is + known, the file can still be opened. + The libtool program, available from your favourite GNU software archive, is required to compile these programs. -- cgit From 7251f6b9ecf6f4c797baf4cd5390cf2bf310d179 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Tue, 27 Aug 2002 09:14:21 +0000 Subject: avoid using libtool for VFS modules change a name in block.c it was hiding a function name add a comment in configure (This used to be commit 05038f44717ff07ed7d4a3afbdd8f072a3c058cc) --- examples/VFS/Makefile.in | 34 ++++++++++------------------------ examples/VFS/README | 23 +++++++++++++++++------ examples/VFS/block/Makefile.in | 34 ++++++++++------------------------ examples/VFS/block/block.c | 21 ++++++++++----------- 4 files changed, 47 insertions(+), 65 deletions(-) (limited to 'examples/VFS') diff --git a/examples/VFS/Makefile.in b/examples/VFS/Makefile.in index 3126dfa3b8..6ae4f49434 100644 --- a/examples/VFS/Makefile.in +++ b/examples/VFS/Makefile.in @@ -1,42 +1,28 @@ -MAKEFILE = Makefile.vfs - -include $(MAKEFILE) - CC = @CC@ -LIBTOOL = libtool -CFLAGS = @CFLAGS@ $(VFS_CFLAGS) -CPPFLAGS = @CPPFLAGS@ $(VFS_CPPFLAGS) -LDFLAGS = @LDFLAGS@ $(VFS_LDFLAGS) +CFLAGS = @CFLAGS@ +CPPFLAGS = @CPPFLAGS@ +LDFLAGS = @LDFLAGS@ LDSHFLAGS = -shared srcdir = @builddir@ FLAGS = $(CFLAGS) -Iinclude -I$(srcdir)/include -I$(srcdir)/ubiqx -I$(srcdir)/smbwrapper -I. $(CPPFLAGS) -I$(srcdir) +VFS_OBJS = audit.so recycle.so + # Default target default: $(VFS_OBJS) -# if file doesn't exist try to create one; -# it is possible that some variables will be -# defined correctly -Makefile.vfs: - @echo -ne "VFS_OBJS\t= " > $(MAKEFILE); \ - for i in *.c; do \ - echo -n $$i" " | sed -e 's/\(.*\)\.c\(.*\)/\1\.so\2/g' >> $(MAKEFILE); \ - done; \ - echo -ne "\nVFS_CFLAGS\t= \nVFS_CPPFLAGS\t= \nVFS_LDFLAGS\t= \n" >> $(MAKEFILE) - make - # Pattern rules -%.so: %.lo - $(LIBTOOL) $(CC) $(LDSHFLAGS) $(LDFLAGS) -o $@ $< +%.so: %.o + $(CC) $(LDSHFLAGS) $(LDFLAGS) -o $@ $< -%.lo: %.c - $(LIBTOOL) $(CC) $(FLAGS) -c $< +%.o: %.c + $(CC) $(FLAGS) -c $< # Misc targets clean: rm -rf .libs rm -f core *~ *% *.bak \ - $(VFS_OBJS) $(VFS_OBJS:.so=.o) $(VFS_OBJS:.so=.lo) + $(VFS_OBJ) $(VFS_OBJS) diff --git a/examples/VFS/README b/examples/VFS/README index 7a2152fc4d..1b09929059 100644 --- a/examples/VFS/README +++ b/examples/VFS/README @@ -17,15 +17,26 @@ construction. The following VFS modules are given: connect/disconnect, directory opens/create/remove, file open/close/rename/unlink/chmod. + recycle + A recycle-bin like modules. When used any unlink call + will be intercepted and files moved to the recycle + directory nstead of beeing deleted. + block A simple module to block access to certain mount points or directories. This module only hides the specified directories - and all directories beneath them. It should NOT be used to secure - directories. If the name of a file in one of those directories is - known, the file can still be opened. - -The libtool program, available from your favourite GNU software -archive, is required to compile these programs. + and all directories beneath them. It should NOT be used to + secure directories. If the name of a file in one of those + directories is known, the file can still be opened. + + netatalk + A netatalk module, that will ease co-existence of samba and + netatalk file sharing services. + Looka t the README for more informations. + +You may have problems to compile these modules, as shared libraries are +compiled and linked in different ways on different systems. +I currently tested them against GNU/linux and IRIX. To use the VFS modules, create a share similar to the one below. The important parameter is the 'vfs object' parameter which must point to diff --git a/examples/VFS/block/Makefile.in b/examples/VFS/block/Makefile.in index 3126dfa3b8..3deb17c596 100644 --- a/examples/VFS/block/Makefile.in +++ b/examples/VFS/block/Makefile.in @@ -1,42 +1,28 @@ -MAKEFILE = Makefile.vfs - -include $(MAKEFILE) - CC = @CC@ -LIBTOOL = libtool -CFLAGS = @CFLAGS@ $(VFS_CFLAGS) -CPPFLAGS = @CPPFLAGS@ $(VFS_CPPFLAGS) -LDFLAGS = @LDFLAGS@ $(VFS_LDFLAGS) +CFLAGS = @CFLAGS@ +CPPFLAGS = @CPPFLAGS@ +LDFLAGS = @LDFLAGS@ LDSHFLAGS = -shared srcdir = @builddir@ FLAGS = $(CFLAGS) -Iinclude -I$(srcdir)/include -I$(srcdir)/ubiqx -I$(srcdir)/smbwrapper -I. $(CPPFLAGS) -I$(srcdir) +VFS_OBJS = block.so + # Default target default: $(VFS_OBJS) -# if file doesn't exist try to create one; -# it is possible that some variables will be -# defined correctly -Makefile.vfs: - @echo -ne "VFS_OBJS\t= " > $(MAKEFILE); \ - for i in *.c; do \ - echo -n $$i" " | sed -e 's/\(.*\)\.c\(.*\)/\1\.so\2/g' >> $(MAKEFILE); \ - done; \ - echo -ne "\nVFS_CFLAGS\t= \nVFS_CPPFLAGS\t= \nVFS_LDFLAGS\t= \n" >> $(MAKEFILE) - make - # Pattern rules -%.so: %.lo - $(LIBTOOL) $(CC) $(LDSHFLAGS) $(LDFLAGS) -o $@ $< +%.so: %.o + $(CC) $(LDSHFLAGS) $(LDFLAGS) -o $@ $< -%.lo: %.c - $(LIBTOOL) $(CC) $(FLAGS) -c $< +%.o: %.c + $(CC) $(FLAGS) -c $< # Misc targets clean: rm -rf .libs rm -f core *~ *% *.bak \ - $(VFS_OBJS) $(VFS_OBJS:.so=.o) $(VFS_OBJS:.so=.lo) + $(VFS_OBJ) $(VFS_OBJS) diff --git a/examples/VFS/block/block.c b/examples/VFS/block/block.c index 9478b75f0f..6566bf3d8c 100644 --- a/examples/VFS/block/block.c +++ b/examples/VFS/block/block.c @@ -87,7 +87,7 @@ static BOOL get_section(char *sect); static BOOL get_parameter_value(char *param, char *value); static BOOL load_param(void); static BOOL search(struct stat *stat_buf); -static BOOL dir_search(char *link, char *dir); +static BOOL dir_search(char *linkstr, char *dir); static BOOL enter_pblock_dir(char *dir); @@ -346,12 +346,11 @@ static DIR *block_opendir(struct connection_struct *conn, char *fname) char *dir_name = NULL; struct stat stat_buf; + size_t len; - dir_name = alloca((strlen(conn->origpath) + strlen(fname) + 2) * sizeof(char)); - - pstrcpy(dir_name,conn->origpath); - pstrcat(dir_name, "/"); - strncat(dir_name, fname, strcspn(fname,"/")); + len = strlen(conn->origpath) + 1 + strcspn(fname, "/"); + asprintf(&dir_name, "%s/%s", conn->origpath, fname); + dir_name[len] = '\0'; if((lstat(dir_name,&stat_buf)) == 0) { @@ -397,13 +396,13 @@ static BOOL search(struct stat *stat_buf) * Find dir in list to block id the starting point is link from a share */ -static BOOL dir_search(char *link, char *dir) +static BOOL dir_search(char *linkstr, char *dir) { char buf[PATH_MAX +1], *ext_path; int len = 0; struct block_dir *tmp_pblock = pblock_dir; - if((len = readlink(link,buf,sizeof(buf))) == -1) + if((len = readlink(linkstr, buf, sizeof(buf))) == -1) { return TRUE; @@ -413,9 +412,9 @@ static BOOL dir_search(char *link, char *dir) } - if((ext_path = strchr(dir,'/')) != NULL) + if((ext_path = strchr(dir, '/')) != NULL) { - pstrcat(buf,&ext_path[1]); + pstrcat(buf, &ext_path[1]); len = strlen(buf); } @@ -427,7 +426,7 @@ static BOOL dir_search(char *link, char *dir) continue; } - if((strstr(buf,tmp_pblock->dir_name)) != NULL) + if((strstr(buf, tmp_pblock->dir_name)) != NULL) { return TRUE; } -- cgit From 709c7c1674f43d38e38a6616c173ec87e632971f Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Tue, 27 Aug 2002 09:30:17 +0000 Subject: add the netatalk module (This used to be commit 2a156995329699c776772fe01672cfe763b3f988) --- examples/VFS/block/smb.conf | 7 - examples/VFS/netatalk/Makefile.in | 28 +++ examples/VFS/netatalk/README | 18 ++ examples/VFS/netatalk/netatalk.c | 430 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 476 insertions(+), 7 deletions(-) create mode 100644 examples/VFS/netatalk/Makefile.in create mode 100644 examples/VFS/netatalk/README create mode 100644 examples/VFS/netatalk/netatalk.c (limited to 'examples/VFS') diff --git a/examples/VFS/block/smb.conf b/examples/VFS/block/smb.conf index 368155f1f8..931196f402 100644 --- a/examples/VFS/block/smb.conf +++ b/examples/VFS/block/smb.conf @@ -4,10 +4,3 @@ browseable = yes writable = yes - - - - - - - diff --git a/examples/VFS/netatalk/Makefile.in b/examples/VFS/netatalk/Makefile.in new file mode 100644 index 0000000000..a9a5d69b51 --- /dev/null +++ b/examples/VFS/netatalk/Makefile.in @@ -0,0 +1,28 @@ +CC = @CC@ +CFLAGS = @CFLAGS@ +CPPFLAGS = @CPPFLAGS@ +LDFLAGS = @LDFLAGS@ +LDSHFLAGS = -shared +srcdir = @builddir@ +FLAGS = $(CFLAGS) -Iinclude -I$(srcdir)/include -I$(srcdir)/ubiqx -I$(srcdir)/smbwrapper -I. $(CPPFLAGS) -I$(srcdir) + +VFS_OBJS = netatalk.so + +# Default target + +default: $(VFS_OBJS) + +# Pattern rules + +%.so: %.o + $(CC) $(LDSHFLAGS) $(LDFLAGS) -o $@ $< + +%.o: %.c + $(CC) $(FLAGS) -c $< + +# Misc targets + +clean: + rm -rf .libs + rm -f core *~ *% *.bak \ + $(VFS_OBJ) $(VFS_OBJS) diff --git a/examples/VFS/netatalk/README b/examples/VFS/netatalk/README new file mode 100644 index 0000000000..70f6eea316 --- /dev/null +++ b/examples/VFS/netatalk/README @@ -0,0 +1,18 @@ +There is the new netatalk module both for HEAD. +This one has some difference from previous module: + +-- it doesn't care about creating of .AppleDouble forks, just keeps ones in +sync; + +-- if share in smb.conf doesn't contain .AppleDouble item in hide or veto +list, it will be added automatically. + +To my way of thinking, module became more lightweight and speedy. + +How to compile: + +you should place proper netatalk.c into examples/VFS/ then run 'configure' +from source/ and then run 'make' from examples/VFS/. + +add string 'vfs object = /netatlk.so' to smb.conf. It may +be defined either as global or as share-specific parameter. diff --git a/examples/VFS/netatalk/netatalk.c b/examples/VFS/netatalk/netatalk.c new file mode 100644 index 0000000000..353be36e6f --- /dev/null +++ b/examples/VFS/netatalk/netatalk.c @@ -0,0 +1,430 @@ +/* + * AppleTalk VFS module for Samba-3.x + * + * Copyright (C) Alexei Kotovich, 2002 + * + * 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. + */ + +#include "config.h" +#include +#include +#ifdef HAVE_UTIME_H +#include +#endif +#ifdef HAVE_DIRENT_H +#include +#endif +#ifdef HAVE_FCNTL_H +#include +#endif +#include +#include +#include +#include + +#define APPLEDOUBLE ".AppleDouble" +#define ADOUBLEMODE 0777 + +/* atalk functions */ + +static int atalk_build_paths(TALLOC_CTX *ctx, const char *path, + const char *fname, char **adbl_path, char **orig_path, + SMB_STRUCT_STAT *adbl_info, SMB_STRUCT_STAT *orig_info); + +static int atalk_unlink_file(const char *path); + +static struct vfs_ops default_vfs_ops; /* For passthrough operation */ +static struct smb_vfs_handle_struct *atalk_handle; + +static int atalk_get_path_ptr(char *path) +{ + int i = 0; + int ptr = 0; + + for (i = 0; path[i]; i ++) { + if (path[i] == '/') + ptr = i; + /* get out some 'spam';) from win32's file name */ + else if (path[i] == ':') { + path[i] = '\0'; + break; + } + } + + return ptr; +} + +static int atalk_build_paths(TALLOC_CTX *ctx, const char *path, const char *fname, + char **adbl_path, char **orig_path, + SMB_STRUCT_STAT *adbl_info, SMB_STRUCT_STAT *orig_info) +{ + int ptr0 = 0; + int ptr1 = 0; + char *dname = 0; + char *name = 0; + + if (!ctx || !path || !fname || !adbl_path || !orig_path || + !adbl_info || !orig_info) + return -1; +#if 0 + DEBUG(3, ("ATALK: PATH: %s[%s]\n", path, fname)); +#endif + if (strstr(path, APPLEDOUBLE) || strstr(fname, APPLEDOUBLE)) { + DEBUG(3, ("ATALK: path %s[%s] already contains %s\n", path, fname, APPLEDOUBLE)); + return -1; + } + + if (fname[0] == '.') ptr0 ++; + if (fname[1] == '/') ptr0 ++; + + *orig_path = talloc_asprintf(ctx, "%s/%s", path, &fname[ptr0]); + + /* get pointer to last '/' */ + ptr1 = atalk_get_path_ptr(*orig_path); + + sys_lstat(*orig_path, orig_info); + + if (S_ISDIR(orig_info->st_mode)) { + *adbl_path = talloc_asprintf(ctx, "%s/%s/%s/", + path, &fname[ptr0], APPLEDOUBLE); + } else { + dname = talloc_strdup(ctx, *orig_path); + dname[ptr1] = '\0'; + name = *orig_path; + *adbl_path = talloc_asprintf(ctx, "%s/%s/%s", + dname, APPLEDOUBLE, &name[ptr1 + 1]); + } +#if 0 + DEBUG(3, ("ATALK: DEBUG:\n%s\n%s\n", *orig_path, *adbl_path)); +#endif + sys_lstat(*adbl_path, adbl_info); + return 0; +} + +static int atalk_unlink_file(const char *path) +{ + int ret = 0; + + become_root(); + ret = unlink(path); + unbecome_root(); + + return ret; +} + +static void atalk_add_to_list(name_compare_entry **list) +{ + int i, count = 0; + name_compare_entry *new_list = 0; + name_compare_entry *cur_list = 0; + + cur_list = *list; + + if (cur_list) { + for (i = 0, count = 0; cur_list[i].name; i ++, count ++) { + if (strstr(cur_list[i].name, APPLEDOUBLE)) + return; + } + } + + if (!(new_list = calloc(1, + (count == 0 ? 1 : count + 1) * sizeof(name_compare_entry)))) + return; + + for (i = 0; i < count; i ++) { + new_list[i].name = strdup(cur_list[i].name); + new_list[i].is_wild = cur_list[i].is_wild; + } + + new_list[i].name = strdup(APPLEDOUBLE); + new_list[i].is_wild = False; + + free_namearray(*list); + + *list = new_list; + new_list = 0; + cur_list = 0; +} + +static void atalk_rrmdir(TALLOC_CTX *ctx, char *path) +{ + int n; + char *dpath; + struct dirent **namelist; + + if (!path) return; + + n = scandir(path, &namelist, 0, alphasort); + if (n < 0) { + return; + } else { + while (n --) { + if (strcmp(namelist[n]->d_name, ".") == 0 || + strcmp(namelist[n]->d_name, "..") == 0) + continue; + if (!(dpath = talloc_asprintf(ctx, "%s/%s", + path, namelist[n]->d_name))) + continue; + atalk_unlink_file(dpath); + free(namelist[n]); + } + } +} + +/* Disk operations */ + +/* Directory operations */ + +DIR *atalk_opendir(struct connection_struct *conn, const char *fname) +{ + DIR *ret = 0; + + ret = default_vfs_ops.opendir(conn, fname); + + /* + * when we try to perform delete operation upon file which has fork + * in ./.AppleDouble and this directory wasn't hidden by Samba, + * MS Windows explorer causes the error: "Cannot find the specified file" + * There is some workaround to avoid this situation, i.e. if + * connection has not .AppleDouble entry in either veto or hide + * list then it would be nice to add one. + */ + + atalk_add_to_list(&conn->hide_list); + atalk_add_to_list(&conn->veto_list); + + return ret; +} + +static int atalk_rmdir(struct connection_struct *conn, const char *path) +{ + BOOL add = False; + TALLOC_CTX *ctx = 0; + char *dpath; + + if (!conn || !conn->origpath || !path) goto exit_rmdir; + + /* due to there is no way to change bDeleteVetoFiles variable + * from this module, gotta use talloc stuff.. + */ + + strstr(path, APPLEDOUBLE) ? (add = False) : (add = True); + + if (!(ctx = talloc_init_named("remove_directory"))) + goto exit_rmdir; + + if (!(dpath = talloc_asprintf(ctx, "%s/%s%s", + conn->origpath, path, add ? "/"APPLEDOUBLE : ""))) + goto exit_rmdir; + + atalk_rrmdir(ctx, dpath); + +exit_rmdir: + talloc_destroy(ctx); + return default_vfs_ops.rmdir(conn, path); +} + +/* File operations */ + +static int atalk_rename(struct connection_struct *conn, const char *old, const char *new) +{ + int ret = 0; + char *adbl_path = 0; + char *orig_path = 0; + SMB_STRUCT_STAT adbl_info; + SMB_STRUCT_STAT orig_info; + TALLOC_CTX *ctx; + + ret = default_vfs_ops.rename(conn, old, new); + + if (!conn || !old) return ret; + + if (!(ctx = talloc_init_named("rename_file"))) + return ret; + + if (atalk_build_paths(ctx, conn->origpath, old, &adbl_path, &orig_path, + &adbl_info, &orig_info) != 0) + return ret; + + if (S_ISDIR(orig_info.st_mode) || S_ISREG(orig_info.st_mode)) { + DEBUG(3, ("ATALK: %s has passed..\n", adbl_path)); + goto exit_rename; + } + + atalk_unlink_file(adbl_path); + +exit_rename: + talloc_destroy(ctx); + return ret; +} + +static int atalk_unlink(struct connection_struct *conn, const char *path) +{ + int ret = 0, i; + char *adbl_path = 0; + char *orig_path = 0; + SMB_STRUCT_STAT adbl_info; + SMB_STRUCT_STAT orig_info; + TALLOC_CTX *ctx; + + ret = default_vfs_ops.unlink(conn, path); + + if (!conn || !path) return ret; + + /* no .AppleDouble sync if veto or hide list is empty, + * otherwise "Cannot find the specified file" error will be caused + */ + + if (!conn->veto_list) return ret; + if (!conn->hide_list) return ret; + + for (i = 0; conn->veto_list[i].name; i ++) { + if (strstr(conn->veto_list[i].name, APPLEDOUBLE)) + break; + } + + if (!conn->veto_list[i].name) { + for (i = 0; conn->hide_list[i].name; i ++) { + if (strstr(conn->hide_list[i].name, APPLEDOUBLE)) + break; + else { + DEBUG(3, ("ATALK: %s is not hidden, skipped..\n", + APPLEDOUBLE)); + return ret; + } + } + } + + if (!(ctx = talloc_init_named("unlink_file"))) + return ret; + + if (atalk_build_paths(ctx, conn->origpath, path, &adbl_path, &orig_path, + &adbl_info, &orig_info) != 0) + return ret; + + if (S_ISDIR(orig_info.st_mode) || S_ISREG(orig_info.st_mode)) { + DEBUG(3, ("ATALK: %s has passed..\n", adbl_path)); + goto exit_unlink; + } + + atalk_unlink_file(adbl_path); + +exit_unlink: + talloc_destroy(ctx); + return ret; +} + +static int atalk_chmod(struct connection_struct *conn, const char *path, mode_t mode) +{ + int ret = 0; + char *adbl_path = 0; + char *orig_path = 0; + SMB_STRUCT_STAT adbl_info; + SMB_STRUCT_STAT orig_info; + TALLOC_CTX *ctx; + + ret = default_vfs_ops.chmod(conn, path, mode); + + if (!conn || !path) return ret; + + if (!(ctx = talloc_init_named("chmod_file"))) + return ret; + + if (atalk_build_paths(ctx, conn->origpath, path, &adbl_path, &orig_path, + &adbl_info, &orig_info) != 0) + return ret; + + if (!S_ISDIR(orig_info.st_mode) && !S_ISREG(orig_info.st_mode)) { + DEBUG(3, ("ATALK: %s has passed..\n", orig_path)); + goto exit_chmod; + } + + chmod(adbl_path, ADOUBLEMODE); + +exit_chmod: + talloc_destroy(ctx); + return ret; +} + +static int atalk_chown(struct connection_struct *conn, const char *path, uid_t uid, gid_t gid) +{ + int ret = 0; + char *adbl_path = 0; + char *orig_path = 0; + SMB_STRUCT_STAT adbl_info; + SMB_STRUCT_STAT orig_info; + TALLOC_CTX *ctx; + + ret = default_vfs_ops.chown(conn, path, uid, gid); + + if (!conn || !path) return ret; + + if (!(ctx = talloc_init_named("chown_file"))) + return ret; + + if (atalk_build_paths(ctx, conn->origpath, path, &adbl_path, &orig_path, + &adbl_info, &orig_info) != 0) + return ret; + + if (!S_ISDIR(orig_info.st_mode) && !S_ISREG(orig_info.st_mode)) { + DEBUG(3, ("ATALK: %s has passed..\n", orig_path)); + goto exit_chown; + } + + chown(adbl_path, uid, gid); + +exit_chown: + talloc_destroy(ctx); + return ret; +} + +static vfs_op_tuple atalk_ops[] = { + + /* Directory operations */ + + {atalk_opendir, SMB_VFS_OP_OPENDIR, SMB_VFS_LAYER_TRANSPARENT}, + {atalk_rmdir, SMB_VFS_OP_RMDIR, SMB_VFS_LAYER_TRANSPARENT}, + + /* File operations */ + + {atalk_rename, SMB_VFS_OP_RENAME, SMB_VFS_LAYER_TRANSPARENT}, + {atalk_unlink, SMB_VFS_OP_UNLINK, SMB_VFS_LAYER_TRANSPARENT}, + {atalk_chmod, SMB_VFS_OP_CHMOD, SMB_VFS_LAYER_TRANSPARENT}, + {atalk_chown, SMB_VFS_OP_CHOWN, SMB_VFS_LAYER_TRANSPARENT}, + + /* Finish VFS operations definition */ + + {NULL, SMB_VFS_OP_NOOP, SMB_VFS_LAYER_NOOP} +}; + +/* VFS initialisation function. Return vfs_op_tuple array back to SAMBA. */ +vfs_op_tuple *vfs_init(int *vfs_version, struct vfs_ops *def_vfs_ops, + struct smb_vfs_handle_struct *vfs_handle) +{ + *vfs_version = SMB_VFS_INTERFACE_VERSION; + memcpy(&default_vfs_ops, def_vfs_ops, sizeof(struct vfs_ops)); + + atalk_handle = vfs_handle; + + DEBUG(3, ("ATALK: vfs module loaded\n")); + return atalk_ops; +} + +/* VFS finalization function. */ +void vfs_done(connection_struct *conn) +{ + DEBUG(3, ("ATALK: vfs module unloaded\n")); +} -- cgit From 995bf62aae0329750b2fff62db4f2b113a9f93e0 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Tue, 27 Aug 2002 09:45:26 +0000 Subject: patch from metze (This used to be commit cc8e6ebc0ec840d882211c8327cafdcafbcafbd7) --- examples/VFS/recycle.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'examples/VFS') diff --git a/examples/VFS/recycle.c b/examples/VFS/recycle.c index ed89e59abf..0a261c20df 100644 --- a/examples/VFS/recycle.c +++ b/examples/VFS/recycle.c @@ -57,7 +57,7 @@ static vfs_op_tuple recycle_ops[] = { /* File operations */ {recycle_unlink, SMB_VFS_OP_UNLINK, SMB_VFS_LAYER_OPAQUE}, - + {NULL, SMB_VFS_OP_NOOP, SMB_VFS_LAYER_NOOP} }; @@ -68,6 +68,8 @@ vfs_op_tuple *vfs_init(int *vfs_version, struct vfs_ops *def_vfs_ops, { *vfs_version = SMB_VFS_INTERFACE_VERSION; memcpy(&default_vfs_ops, def_vfs_ops, sizeof(struct vfs_ops)); + + DEBUG(5,("vfs_init: for recycle!\n")); /* Remember vfs_id for storing private information at connect */ recycle_handle = vfs_handle; @@ -78,20 +80,23 @@ vfs_op_tuple *vfs_init(int *vfs_version, struct vfs_ops *def_vfs_ops, /* VFS finalization function. */ void vfs_done(connection_struct *conn) { - DEBUG(3,("vfs_done_recycle: called for connection %p\n",conn)); + DEBUG(5,("vfs_done_recycle: called for connection %p\n",conn)); } static int recycle_connect(struct connection_struct *conn, const char *service, const char *user) { fstring recycle_bin; - DEBUG(3,("recycle_connect: called for service %s as user %s\n", service, user)); + DEBUG(4,("recycle_connect: called for service %s as user %s\n", service, user)); fstrcpy(recycle_bin, (const char *)lp_parm_string(lp_servicename(SNUM(conn)),"vfs","recycle bin")); if (!*recycle_bin) { - DEBUG(3,("recycle_connect: No options listed (vfs:recycle bin).\n" )); + DEBUG(0,("recycle_connect: No options listed (vfs:recycle bin).\n" )); return 0; /* No options. */ } + + standard_sub_conn(conn,recycle_bin,sizeof(fstring)); + DEBUG(3,("recycle_connect: recycle name is %s\n", recycle_bin )); @@ -158,7 +163,7 @@ static int recycle_unlink(connection_struct *conn, const char *inname) fstrcpy(recycle_bin, (const char *)recycle_handle->data); if(!*recycle_bin) { - DEBUG(3, ("recycle bin: share parameter not set, purging %s...\n", fname)); + DEBUG(1, ("recycle bin: share parameter not set, purging %s...\n", fname)); return default_vfs_ops.unlink(conn,fname); } @@ -178,7 +183,7 @@ static int recycle_unlink(connection_struct *conn, const char *inname) ext = strrchr(base, '.'); pstrcat(bin, base+1); } - DEBUG(3, ("recycle bin: base %s, ext %s, fname %s, bin %s\n", base, ext, fname, bin)); + DEBUG(4, ("recycle bin: base %s, ext %s, fname %s, bin %s\n", base, ext, fname, bin)); if(strcmp(fname,bin) == 0) { DEBUG(3, ("recycle bin: file %s exists, purging...\n", fname)); @@ -202,7 +207,7 @@ static int recycle_unlink(connection_struct *conn, const char *inname) if(!recycle_directory_exist(conn,recycle_bin)) { DEBUG(3, ("recycle bin: directory %s nonexistant, creating...\n", recycle_bin)); if (default_vfs_ops.mkdir(conn,recycle_bin,dir_mask) == -1) { - DEBUG(3, ("recycle bin: unable to create directory %s. Error was %s\n", + DEBUG(0, ("recycle bin: unable to create directory %s. Error was %s\n", recycle_bin, strerror(errno) )); } } @@ -210,13 +215,13 @@ static int recycle_unlink(connection_struct *conn, const char *inname) ret = default_vfs_ops.rename(conn, fname, bin); if (ret == -1) { - DEBUG(3, ("recycle bin: move error %d (%s)\n", errno, strerror(errno) )); - DEBUG(3, ("recycle bin: move failed, purging...\n")); + DEBUG(1, ("recycle bin: move error %d (%s)\n", errno, strerror(errno) )); + DEBUG(0, ("recycle bin: move failed, purging...\n")); return default_vfs_ops.unlink(conn,fname); } return ret; } else { - DEBUG(3, ("recycle bin: move failed, purging...\n")); + DEBUG(1, ("recycle bin: move failed, purging...\n")); return default_vfs_ops.unlink(conn,fname); } } -- cgit From 84a8efbf1a14e9ce36aa4347ada8973392e96330 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 28 Aug 2002 12:55:20 +0000 Subject: Removed C++ style comment. Jeremy. (This used to be commit 3803770edaf4212ceac826e039bb075f098a4fab) --- examples/VFS/block/block.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'examples/VFS') diff --git a/examples/VFS/block/block.c b/examples/VFS/block/block.c index 6566bf3d8c..eb388a97ea 100644 --- a/examples/VFS/block/block.c +++ b/examples/VFS/block/block.c @@ -80,7 +80,7 @@ static vfs_op_tuple block_vfs_ops[] = { extern BOOL pm_process(char *FileName, BOOL (*sfunc)(char *), BOOL(*pfunc)(char * , char *)); -//functions +/* functions */ static BOOL enter_pblock_mount(char *dir); static BOOL get_section(char *sect); -- cgit From afc1a220b74bfbfa68541d3595038bcf138606c0 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Fri, 6 Sep 2002 13:37:40 +0000 Subject: move everything to flat VFS/ directory (This used to be commit d383c309d4a259fb28d7541777a8b3b53cca23bf) --- examples/VFS/Makefile.in | 2 +- examples/VFS/README.netatalk | 18 ++ examples/VFS/netatalk.c | 430 ++++++++++++++++++++++++++++++++++++++ examples/VFS/netatalk/Makefile.in | 28 --- examples/VFS/netatalk/README | 18 -- examples/VFS/netatalk/netatalk.c | 430 -------------------------------------- 6 files changed, 449 insertions(+), 477 deletions(-) create mode 100644 examples/VFS/README.netatalk create mode 100644 examples/VFS/netatalk.c delete mode 100644 examples/VFS/netatalk/Makefile.in delete mode 100644 examples/VFS/netatalk/README delete mode 100644 examples/VFS/netatalk/netatalk.c (limited to 'examples/VFS') diff --git a/examples/VFS/Makefile.in b/examples/VFS/Makefile.in index 6ae4f49434..2ffd23b853 100644 --- a/examples/VFS/Makefile.in +++ b/examples/VFS/Makefile.in @@ -6,7 +6,7 @@ LDSHFLAGS = -shared srcdir = @builddir@ FLAGS = $(CFLAGS) -Iinclude -I$(srcdir)/include -I$(srcdir)/ubiqx -I$(srcdir)/smbwrapper -I. $(CPPFLAGS) -I$(srcdir) -VFS_OBJS = audit.so recycle.so +VFS_OBJS = audit.so recycle.so netatalk.so # Default target diff --git a/examples/VFS/README.netatalk b/examples/VFS/README.netatalk new file mode 100644 index 0000000000..70f6eea316 --- /dev/null +++ b/examples/VFS/README.netatalk @@ -0,0 +1,18 @@ +There is the new netatalk module both for HEAD. +This one has some difference from previous module: + +-- it doesn't care about creating of .AppleDouble forks, just keeps ones in +sync; + +-- if share in smb.conf doesn't contain .AppleDouble item in hide or veto +list, it will be added automatically. + +To my way of thinking, module became more lightweight and speedy. + +How to compile: + +you should place proper netatalk.c into examples/VFS/ then run 'configure' +from source/ and then run 'make' from examples/VFS/. + +add string 'vfs object = /netatlk.so' to smb.conf. It may +be defined either as global or as share-specific parameter. diff --git a/examples/VFS/netatalk.c b/examples/VFS/netatalk.c new file mode 100644 index 0000000000..353be36e6f --- /dev/null +++ b/examples/VFS/netatalk.c @@ -0,0 +1,430 @@ +/* + * AppleTalk VFS module for Samba-3.x + * + * Copyright (C) Alexei Kotovich, 2002 + * + * 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. + */ + +#include "config.h" +#include +#include +#ifdef HAVE_UTIME_H +#include +#endif +#ifdef HAVE_DIRENT_H +#include +#endif +#ifdef HAVE_FCNTL_H +#include +#endif +#include +#include +#include +#include + +#define APPLEDOUBLE ".AppleDouble" +#define ADOUBLEMODE 0777 + +/* atalk functions */ + +static int atalk_build_paths(TALLOC_CTX *ctx, const char *path, + const char *fname, char **adbl_path, char **orig_path, + SMB_STRUCT_STAT *adbl_info, SMB_STRUCT_STAT *orig_info); + +static int atalk_unlink_file(const char *path); + +static struct vfs_ops default_vfs_ops; /* For passthrough operation */ +static struct smb_vfs_handle_struct *atalk_handle; + +static int atalk_get_path_ptr(char *path) +{ + int i = 0; + int ptr = 0; + + for (i = 0; path[i]; i ++) { + if (path[i] == '/') + ptr = i; + /* get out some 'spam';) from win32's file name */ + else if (path[i] == ':') { + path[i] = '\0'; + break; + } + } + + return ptr; +} + +static int atalk_build_paths(TALLOC_CTX *ctx, const char *path, const char *fname, + char **adbl_path, char **orig_path, + SMB_STRUCT_STAT *adbl_info, SMB_STRUCT_STAT *orig_info) +{ + int ptr0 = 0; + int ptr1 = 0; + char *dname = 0; + char *name = 0; + + if (!ctx || !path || !fname || !adbl_path || !orig_path || + !adbl_info || !orig_info) + return -1; +#if 0 + DEBUG(3, ("ATALK: PATH: %s[%s]\n", path, fname)); +#endif + if (strstr(path, APPLEDOUBLE) || strstr(fname, APPLEDOUBLE)) { + DEBUG(3, ("ATALK: path %s[%s] already contains %s\n", path, fname, APPLEDOUBLE)); + return -1; + } + + if (fname[0] == '.') ptr0 ++; + if (fname[1] == '/') ptr0 ++; + + *orig_path = talloc_asprintf(ctx, "%s/%s", path, &fname[ptr0]); + + /* get pointer to last '/' */ + ptr1 = atalk_get_path_ptr(*orig_path); + + sys_lstat(*orig_path, orig_info); + + if (S_ISDIR(orig_info->st_mode)) { + *adbl_path = talloc_asprintf(ctx, "%s/%s/%s/", + path, &fname[ptr0], APPLEDOUBLE); + } else { + dname = talloc_strdup(ctx, *orig_path); + dname[ptr1] = '\0'; + name = *orig_path; + *adbl_path = talloc_asprintf(ctx, "%s/%s/%s", + dname, APPLEDOUBLE, &name[ptr1 + 1]); + } +#if 0 + DEBUG(3, ("ATALK: DEBUG:\n%s\n%s\n", *orig_path, *adbl_path)); +#endif + sys_lstat(*adbl_path, adbl_info); + return 0; +} + +static int atalk_unlink_file(const char *path) +{ + int ret = 0; + + become_root(); + ret = unlink(path); + unbecome_root(); + + return ret; +} + +static void atalk_add_to_list(name_compare_entry **list) +{ + int i, count = 0; + name_compare_entry *new_list = 0; + name_compare_entry *cur_list = 0; + + cur_list = *list; + + if (cur_list) { + for (i = 0, count = 0; cur_list[i].name; i ++, count ++) { + if (strstr(cur_list[i].name, APPLEDOUBLE)) + return; + } + } + + if (!(new_list = calloc(1, + (count == 0 ? 1 : count + 1) * sizeof(name_compare_entry)))) + return; + + for (i = 0; i < count; i ++) { + new_list[i].name = strdup(cur_list[i].name); + new_list[i].is_wild = cur_list[i].is_wild; + } + + new_list[i].name = strdup(APPLEDOUBLE); + new_list[i].is_wild = False; + + free_namearray(*list); + + *list = new_list; + new_list = 0; + cur_list = 0; +} + +static void atalk_rrmdir(TALLOC_CTX *ctx, char *path) +{ + int n; + char *dpath; + struct dirent **namelist; + + if (!path) return; + + n = scandir(path, &namelist, 0, alphasort); + if (n < 0) { + return; + } else { + while (n --) { + if (strcmp(namelist[n]->d_name, ".") == 0 || + strcmp(namelist[n]->d_name, "..") == 0) + continue; + if (!(dpath = talloc_asprintf(ctx, "%s/%s", + path, namelist[n]->d_name))) + continue; + atalk_unlink_file(dpath); + free(namelist[n]); + } + } +} + +/* Disk operations */ + +/* Directory operations */ + +DIR *atalk_opendir(struct connection_struct *conn, const char *fname) +{ + DIR *ret = 0; + + ret = default_vfs_ops.opendir(conn, fname); + + /* + * when we try to perform delete operation upon file which has fork + * in ./.AppleDouble and this directory wasn't hidden by Samba, + * MS Windows explorer causes the error: "Cannot find the specified file" + * There is some workaround to avoid this situation, i.e. if + * connection has not .AppleDouble entry in either veto or hide + * list then it would be nice to add one. + */ + + atalk_add_to_list(&conn->hide_list); + atalk_add_to_list(&conn->veto_list); + + return ret; +} + +static int atalk_rmdir(struct connection_struct *conn, const char *path) +{ + BOOL add = False; + TALLOC_CTX *ctx = 0; + char *dpath; + + if (!conn || !conn->origpath || !path) goto exit_rmdir; + + /* due to there is no way to change bDeleteVetoFiles variable + * from this module, gotta use talloc stuff.. + */ + + strstr(path, APPLEDOUBLE) ? (add = False) : (add = True); + + if (!(ctx = talloc_init_named("remove_directory"))) + goto exit_rmdir; + + if (!(dpath = talloc_asprintf(ctx, "%s/%s%s", + conn->origpath, path, add ? "/"APPLEDOUBLE : ""))) + goto exit_rmdir; + + atalk_rrmdir(ctx, dpath); + +exit_rmdir: + talloc_destroy(ctx); + return default_vfs_ops.rmdir(conn, path); +} + +/* File operations */ + +static int atalk_rename(struct connection_struct *conn, const char *old, const char *new) +{ + int ret = 0; + char *adbl_path = 0; + char *orig_path = 0; + SMB_STRUCT_STAT adbl_info; + SMB_STRUCT_STAT orig_info; + TALLOC_CTX *ctx; + + ret = default_vfs_ops.rename(conn, old, new); + + if (!conn || !old) return ret; + + if (!(ctx = talloc_init_named("rename_file"))) + return ret; + + if (atalk_build_paths(ctx, conn->origpath, old, &adbl_path, &orig_path, + &adbl_info, &orig_info) != 0) + return ret; + + if (S_ISDIR(orig_info.st_mode) || S_ISREG(orig_info.st_mode)) { + DEBUG(3, ("ATALK: %s has passed..\n", adbl_path)); + goto exit_rename; + } + + atalk_unlink_file(adbl_path); + +exit_rename: + talloc_destroy(ctx); + return ret; +} + +static int atalk_unlink(struct connection_struct *conn, const char *path) +{ + int ret = 0, i; + char *adbl_path = 0; + char *orig_path = 0; + SMB_STRUCT_STAT adbl_info; + SMB_STRUCT_STAT orig_info; + TALLOC_CTX *ctx; + + ret = default_vfs_ops.unlink(conn, path); + + if (!conn || !path) return ret; + + /* no .AppleDouble sync if veto or hide list is empty, + * otherwise "Cannot find the specified file" error will be caused + */ + + if (!conn->veto_list) return ret; + if (!conn->hide_list) return ret; + + for (i = 0; conn->veto_list[i].name; i ++) { + if (strstr(conn->veto_list[i].name, APPLEDOUBLE)) + break; + } + + if (!conn->veto_list[i].name) { + for (i = 0; conn->hide_list[i].name; i ++) { + if (strstr(conn->hide_list[i].name, APPLEDOUBLE)) + break; + else { + DEBUG(3, ("ATALK: %s is not hidden, skipped..\n", + APPLEDOUBLE)); + return ret; + } + } + } + + if (!(ctx = talloc_init_named("unlink_file"))) + return ret; + + if (atalk_build_paths(ctx, conn->origpath, path, &adbl_path, &orig_path, + &adbl_info, &orig_info) != 0) + return ret; + + if (S_ISDIR(orig_info.st_mode) || S_ISREG(orig_info.st_mode)) { + DEBUG(3, ("ATALK: %s has passed..\n", adbl_path)); + goto exit_unlink; + } + + atalk_unlink_file(adbl_path); + +exit_unlink: + talloc_destroy(ctx); + return ret; +} + +static int atalk_chmod(struct connection_struct *conn, const char *path, mode_t mode) +{ + int ret = 0; + char *adbl_path = 0; + char *orig_path = 0; + SMB_STRUCT_STAT adbl_info; + SMB_STRUCT_STAT orig_info; + TALLOC_CTX *ctx; + + ret = default_vfs_ops.chmod(conn, path, mode); + + if (!conn || !path) return ret; + + if (!(ctx = talloc_init_named("chmod_file"))) + return ret; + + if (atalk_build_paths(ctx, conn->origpath, path, &adbl_path, &orig_path, + &adbl_info, &orig_info) != 0) + return ret; + + if (!S_ISDIR(orig_info.st_mode) && !S_ISREG(orig_info.st_mode)) { + DEBUG(3, ("ATALK: %s has passed..\n", orig_path)); + goto exit_chmod; + } + + chmod(adbl_path, ADOUBLEMODE); + +exit_chmod: + talloc_destroy(ctx); + return ret; +} + +static int atalk_chown(struct connection_struct *conn, const char *path, uid_t uid, gid_t gid) +{ + int ret = 0; + char *adbl_path = 0; + char *orig_path = 0; + SMB_STRUCT_STAT adbl_info; + SMB_STRUCT_STAT orig_info; + TALLOC_CTX *ctx; + + ret = default_vfs_ops.chown(conn, path, uid, gid); + + if (!conn || !path) return ret; + + if (!(ctx = talloc_init_named("chown_file"))) + return ret; + + if (atalk_build_paths(ctx, conn->origpath, path, &adbl_path, &orig_path, + &adbl_info, &orig_info) != 0) + return ret; + + if (!S_ISDIR(orig_info.st_mode) && !S_ISREG(orig_info.st_mode)) { + DEBUG(3, ("ATALK: %s has passed..\n", orig_path)); + goto exit_chown; + } + + chown(adbl_path, uid, gid); + +exit_chown: + talloc_destroy(ctx); + return ret; +} + +static vfs_op_tuple atalk_ops[] = { + + /* Directory operations */ + + {atalk_opendir, SMB_VFS_OP_OPENDIR, SMB_VFS_LAYER_TRANSPARENT}, + {atalk_rmdir, SMB_VFS_OP_RMDIR, SMB_VFS_LAYER_TRANSPARENT}, + + /* File operations */ + + {atalk_rename, SMB_VFS_OP_RENAME, SMB_VFS_LAYER_TRANSPARENT}, + {atalk_unlink, SMB_VFS_OP_UNLINK, SMB_VFS_LAYER_TRANSPARENT}, + {atalk_chmod, SMB_VFS_OP_CHMOD, SMB_VFS_LAYER_TRANSPARENT}, + {atalk_chown, SMB_VFS_OP_CHOWN, SMB_VFS_LAYER_TRANSPARENT}, + + /* Finish VFS operations definition */ + + {NULL, SMB_VFS_OP_NOOP, SMB_VFS_LAYER_NOOP} +}; + +/* VFS initialisation function. Return vfs_op_tuple array back to SAMBA. */ +vfs_op_tuple *vfs_init(int *vfs_version, struct vfs_ops *def_vfs_ops, + struct smb_vfs_handle_struct *vfs_handle) +{ + *vfs_version = SMB_VFS_INTERFACE_VERSION; + memcpy(&default_vfs_ops, def_vfs_ops, sizeof(struct vfs_ops)); + + atalk_handle = vfs_handle; + + DEBUG(3, ("ATALK: vfs module loaded\n")); + return atalk_ops; +} + +/* VFS finalization function. */ +void vfs_done(connection_struct *conn) +{ + DEBUG(3, ("ATALK: vfs module unloaded\n")); +} diff --git a/examples/VFS/netatalk/Makefile.in b/examples/VFS/netatalk/Makefile.in deleted file mode 100644 index a9a5d69b51..0000000000 --- a/examples/VFS/netatalk/Makefile.in +++ /dev/null @@ -1,28 +0,0 @@ -CC = @CC@ -CFLAGS = @CFLAGS@ -CPPFLAGS = @CPPFLAGS@ -LDFLAGS = @LDFLAGS@ -LDSHFLAGS = -shared -srcdir = @builddir@ -FLAGS = $(CFLAGS) -Iinclude -I$(srcdir)/include -I$(srcdir)/ubiqx -I$(srcdir)/smbwrapper -I. $(CPPFLAGS) -I$(srcdir) - -VFS_OBJS = netatalk.so - -# Default target - -default: $(VFS_OBJS) - -# Pattern rules - -%.so: %.o - $(CC) $(LDSHFLAGS) $(LDFLAGS) -o $@ $< - -%.o: %.c - $(CC) $(FLAGS) -c $< - -# Misc targets - -clean: - rm -rf .libs - rm -f core *~ *% *.bak \ - $(VFS_OBJ) $(VFS_OBJS) diff --git a/examples/VFS/netatalk/README b/examples/VFS/netatalk/README deleted file mode 100644 index 70f6eea316..0000000000 --- a/examples/VFS/netatalk/README +++ /dev/null @@ -1,18 +0,0 @@ -There is the new netatalk module both for HEAD. -This one has some difference from previous module: - --- it doesn't care about creating of .AppleDouble forks, just keeps ones in -sync; - --- if share in smb.conf doesn't contain .AppleDouble item in hide or veto -list, it will be added automatically. - -To my way of thinking, module became more lightweight and speedy. - -How to compile: - -you should place proper netatalk.c into examples/VFS/ then run 'configure' -from source/ and then run 'make' from examples/VFS/. - -add string 'vfs object = /netatlk.so' to smb.conf. It may -be defined either as global or as share-specific parameter. diff --git a/examples/VFS/netatalk/netatalk.c b/examples/VFS/netatalk/netatalk.c deleted file mode 100644 index 353be36e6f..0000000000 --- a/examples/VFS/netatalk/netatalk.c +++ /dev/null @@ -1,430 +0,0 @@ -/* - * AppleTalk VFS module for Samba-3.x - * - * Copyright (C) Alexei Kotovich, 2002 - * - * 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. - */ - -#include "config.h" -#include -#include -#ifdef HAVE_UTIME_H -#include -#endif -#ifdef HAVE_DIRENT_H -#include -#endif -#ifdef HAVE_FCNTL_H -#include -#endif -#include -#include -#include -#include - -#define APPLEDOUBLE ".AppleDouble" -#define ADOUBLEMODE 0777 - -/* atalk functions */ - -static int atalk_build_paths(TALLOC_CTX *ctx, const char *path, - const char *fname, char **adbl_path, char **orig_path, - SMB_STRUCT_STAT *adbl_info, SMB_STRUCT_STAT *orig_info); - -static int atalk_unlink_file(const char *path); - -static struct vfs_ops default_vfs_ops; /* For passthrough operation */ -static struct smb_vfs_handle_struct *atalk_handle; - -static int atalk_get_path_ptr(char *path) -{ - int i = 0; - int ptr = 0; - - for (i = 0; path[i]; i ++) { - if (path[i] == '/') - ptr = i; - /* get out some 'spam';) from win32's file name */ - else if (path[i] == ':') { - path[i] = '\0'; - break; - } - } - - return ptr; -} - -static int atalk_build_paths(TALLOC_CTX *ctx, const char *path, const char *fname, - char **adbl_path, char **orig_path, - SMB_STRUCT_STAT *adbl_info, SMB_STRUCT_STAT *orig_info) -{ - int ptr0 = 0; - int ptr1 = 0; - char *dname = 0; - char *name = 0; - - if (!ctx || !path || !fname || !adbl_path || !orig_path || - !adbl_info || !orig_info) - return -1; -#if 0 - DEBUG(3, ("ATALK: PATH: %s[%s]\n", path, fname)); -#endif - if (strstr(path, APPLEDOUBLE) || strstr(fname, APPLEDOUBLE)) { - DEBUG(3, ("ATALK: path %s[%s] already contains %s\n", path, fname, APPLEDOUBLE)); - return -1; - } - - if (fname[0] == '.') ptr0 ++; - if (fname[1] == '/') ptr0 ++; - - *orig_path = talloc_asprintf(ctx, "%s/%s", path, &fname[ptr0]); - - /* get pointer to last '/' */ - ptr1 = atalk_get_path_ptr(*orig_path); - - sys_lstat(*orig_path, orig_info); - - if (S_ISDIR(orig_info->st_mode)) { - *adbl_path = talloc_asprintf(ctx, "%s/%s/%s/", - path, &fname[ptr0], APPLEDOUBLE); - } else { - dname = talloc_strdup(ctx, *orig_path); - dname[ptr1] = '\0'; - name = *orig_path; - *adbl_path = talloc_asprintf(ctx, "%s/%s/%s", - dname, APPLEDOUBLE, &name[ptr1 + 1]); - } -#if 0 - DEBUG(3, ("ATALK: DEBUG:\n%s\n%s\n", *orig_path, *adbl_path)); -#endif - sys_lstat(*adbl_path, adbl_info); - return 0; -} - -static int atalk_unlink_file(const char *path) -{ - int ret = 0; - - become_root(); - ret = unlink(path); - unbecome_root(); - - return ret; -} - -static void atalk_add_to_list(name_compare_entry **list) -{ - int i, count = 0; - name_compare_entry *new_list = 0; - name_compare_entry *cur_list = 0; - - cur_list = *list; - - if (cur_list) { - for (i = 0, count = 0; cur_list[i].name; i ++, count ++) { - if (strstr(cur_list[i].name, APPLEDOUBLE)) - return; - } - } - - if (!(new_list = calloc(1, - (count == 0 ? 1 : count + 1) * sizeof(name_compare_entry)))) - return; - - for (i = 0; i < count; i ++) { - new_list[i].name = strdup(cur_list[i].name); - new_list[i].is_wild = cur_list[i].is_wild; - } - - new_list[i].name = strdup(APPLEDOUBLE); - new_list[i].is_wild = False; - - free_namearray(*list); - - *list = new_list; - new_list = 0; - cur_list = 0; -} - -static void atalk_rrmdir(TALLOC_CTX *ctx, char *path) -{ - int n; - char *dpath; - struct dirent **namelist; - - if (!path) return; - - n = scandir(path, &namelist, 0, alphasort); - if (n < 0) { - return; - } else { - while (n --) { - if (strcmp(namelist[n]->d_name, ".") == 0 || - strcmp(namelist[n]->d_name, "..") == 0) - continue; - if (!(dpath = talloc_asprintf(ctx, "%s/%s", - path, namelist[n]->d_name))) - continue; - atalk_unlink_file(dpath); - free(namelist[n]); - } - } -} - -/* Disk operations */ - -/* Directory operations */ - -DIR *atalk_opendir(struct connection_struct *conn, const char *fname) -{ - DIR *ret = 0; - - ret = default_vfs_ops.opendir(conn, fname); - - /* - * when we try to perform delete operation upon file which has fork - * in ./.AppleDouble and this directory wasn't hidden by Samba, - * MS Windows explorer causes the error: "Cannot find the specified file" - * There is some workaround to avoid this situation, i.e. if - * connection has not .AppleDouble entry in either veto or hide - * list then it would be nice to add one. - */ - - atalk_add_to_list(&conn->hide_list); - atalk_add_to_list(&conn->veto_list); - - return ret; -} - -static int atalk_rmdir(struct connection_struct *conn, const char *path) -{ - BOOL add = False; - TALLOC_CTX *ctx = 0; - char *dpath; - - if (!conn || !conn->origpath || !path) goto exit_rmdir; - - /* due to there is no way to change bDeleteVetoFiles variable - * from this module, gotta use talloc stuff.. - */ - - strstr(path, APPLEDOUBLE) ? (add = False) : (add = True); - - if (!(ctx = talloc_init_named("remove_directory"))) - goto exit_rmdir; - - if (!(dpath = talloc_asprintf(ctx, "%s/%s%s", - conn->origpath, path, add ? "/"APPLEDOUBLE : ""))) - goto exit_rmdir; - - atalk_rrmdir(ctx, dpath); - -exit_rmdir: - talloc_destroy(ctx); - return default_vfs_ops.rmdir(conn, path); -} - -/* File operations */ - -static int atalk_rename(struct connection_struct *conn, const char *old, const char *new) -{ - int ret = 0; - char *adbl_path = 0; - char *orig_path = 0; - SMB_STRUCT_STAT adbl_info; - SMB_STRUCT_STAT orig_info; - TALLOC_CTX *ctx; - - ret = default_vfs_ops.rename(conn, old, new); - - if (!conn || !old) return ret; - - if (!(ctx = talloc_init_named("rename_file"))) - return ret; - - if (atalk_build_paths(ctx, conn->origpath, old, &adbl_path, &orig_path, - &adbl_info, &orig_info) != 0) - return ret; - - if (S_ISDIR(orig_info.st_mode) || S_ISREG(orig_info.st_mode)) { - DEBUG(3, ("ATALK: %s has passed..\n", adbl_path)); - goto exit_rename; - } - - atalk_unlink_file(adbl_path); - -exit_rename: - talloc_destroy(ctx); - return ret; -} - -static int atalk_unlink(struct connection_struct *conn, const char *path) -{ - int ret = 0, i; - char *adbl_path = 0; - char *orig_path = 0; - SMB_STRUCT_STAT adbl_info; - SMB_STRUCT_STAT orig_info; - TALLOC_CTX *ctx; - - ret = default_vfs_ops.unlink(conn, path); - - if (!conn || !path) return ret; - - /* no .AppleDouble sync if veto or hide list is empty, - * otherwise "Cannot find the specified file" error will be caused - */ - - if (!conn->veto_list) return ret; - if (!conn->hide_list) return ret; - - for (i = 0; conn->veto_list[i].name; i ++) { - if (strstr(conn->veto_list[i].name, APPLEDOUBLE)) - break; - } - - if (!conn->veto_list[i].name) { - for (i = 0; conn->hide_list[i].name; i ++) { - if (strstr(conn->hide_list[i].name, APPLEDOUBLE)) - break; - else { - DEBUG(3, ("ATALK: %s is not hidden, skipped..\n", - APPLEDOUBLE)); - return ret; - } - } - } - - if (!(ctx = talloc_init_named("unlink_file"))) - return ret; - - if (atalk_build_paths(ctx, conn->origpath, path, &adbl_path, &orig_path, - &adbl_info, &orig_info) != 0) - return ret; - - if (S_ISDIR(orig_info.st_mode) || S_ISREG(orig_info.st_mode)) { - DEBUG(3, ("ATALK: %s has passed..\n", adbl_path)); - goto exit_unlink; - } - - atalk_unlink_file(adbl_path); - -exit_unlink: - talloc_destroy(ctx); - return ret; -} - -static int atalk_chmod(struct connection_struct *conn, const char *path, mode_t mode) -{ - int ret = 0; - char *adbl_path = 0; - char *orig_path = 0; - SMB_STRUCT_STAT adbl_info; - SMB_STRUCT_STAT orig_info; - TALLOC_CTX *ctx; - - ret = default_vfs_ops.chmod(conn, path, mode); - - if (!conn || !path) return ret; - - if (!(ctx = talloc_init_named("chmod_file"))) - return ret; - - if (atalk_build_paths(ctx, conn->origpath, path, &adbl_path, &orig_path, - &adbl_info, &orig_info) != 0) - return ret; - - if (!S_ISDIR(orig_info.st_mode) && !S_ISREG(orig_info.st_mode)) { - DEBUG(3, ("ATALK: %s has passed..\n", orig_path)); - goto exit_chmod; - } - - chmod(adbl_path, ADOUBLEMODE); - -exit_chmod: - talloc_destroy(ctx); - return ret; -} - -static int atalk_chown(struct connection_struct *conn, const char *path, uid_t uid, gid_t gid) -{ - int ret = 0; - char *adbl_path = 0; - char *orig_path = 0; - SMB_STRUCT_STAT adbl_info; - SMB_STRUCT_STAT orig_info; - TALLOC_CTX *ctx; - - ret = default_vfs_ops.chown(conn, path, uid, gid); - - if (!conn || !path) return ret; - - if (!(ctx = talloc_init_named("chown_file"))) - return ret; - - if (atalk_build_paths(ctx, conn->origpath, path, &adbl_path, &orig_path, - &adbl_info, &orig_info) != 0) - return ret; - - if (!S_ISDIR(orig_info.st_mode) && !S_ISREG(orig_info.st_mode)) { - DEBUG(3, ("ATALK: %s has passed..\n", orig_path)); - goto exit_chown; - } - - chown(adbl_path, uid, gid); - -exit_chown: - talloc_destroy(ctx); - return ret; -} - -static vfs_op_tuple atalk_ops[] = { - - /* Directory operations */ - - {atalk_opendir, SMB_VFS_OP_OPENDIR, SMB_VFS_LAYER_TRANSPARENT}, - {atalk_rmdir, SMB_VFS_OP_RMDIR, SMB_VFS_LAYER_TRANSPARENT}, - - /* File operations */ - - {atalk_rename, SMB_VFS_OP_RENAME, SMB_VFS_LAYER_TRANSPARENT}, - {atalk_unlink, SMB_VFS_OP_UNLINK, SMB_VFS_LAYER_TRANSPARENT}, - {atalk_chmod, SMB_VFS_OP_CHMOD, SMB_VFS_LAYER_TRANSPARENT}, - {atalk_chown, SMB_VFS_OP_CHOWN, SMB_VFS_LAYER_TRANSPARENT}, - - /* Finish VFS operations definition */ - - {NULL, SMB_VFS_OP_NOOP, SMB_VFS_LAYER_NOOP} -}; - -/* VFS initialisation function. Return vfs_op_tuple array back to SAMBA. */ -vfs_op_tuple *vfs_init(int *vfs_version, struct vfs_ops *def_vfs_ops, - struct smb_vfs_handle_struct *vfs_handle) -{ - *vfs_version = SMB_VFS_INTERFACE_VERSION; - memcpy(&default_vfs_ops, def_vfs_ops, sizeof(struct vfs_ops)); - - atalk_handle = vfs_handle; - - DEBUG(3, ("ATALK: vfs module loaded\n")); - return atalk_ops; -} - -/* VFS finalization function. */ -void vfs_done(connection_struct *conn) -{ - DEBUG(3, ("ATALK: vfs module unloaded\n")); -} -- cgit From d0cef25c27d180b6f864e942058e1b6805971a76 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Fri, 6 Sep 2002 13:39:46 +0000 Subject: the current block module is completely broken, jelmer will commit a new one later. simo (This used to be commit 830f9910bb77562aa2dbef2f479c01493928692d) --- examples/VFS/block/Makefile.in | 28 --- examples/VFS/block/block.c | 439 ------------------------------------ examples/VFS/block/samba-block.conf | 6 - examples/VFS/block/smb.conf | 6 - 4 files changed, 479 deletions(-) delete mode 100644 examples/VFS/block/Makefile.in delete mode 100644 examples/VFS/block/block.c delete mode 100644 examples/VFS/block/samba-block.conf delete mode 100644 examples/VFS/block/smb.conf (limited to 'examples/VFS') diff --git a/examples/VFS/block/Makefile.in b/examples/VFS/block/Makefile.in deleted file mode 100644 index 3deb17c596..0000000000 --- a/examples/VFS/block/Makefile.in +++ /dev/null @@ -1,28 +0,0 @@ -CC = @CC@ -CFLAGS = @CFLAGS@ -CPPFLAGS = @CPPFLAGS@ -LDFLAGS = @LDFLAGS@ -LDSHFLAGS = -shared -srcdir = @builddir@ -FLAGS = $(CFLAGS) -Iinclude -I$(srcdir)/include -I$(srcdir)/ubiqx -I$(srcdir)/smbwrapper -I. $(CPPFLAGS) -I$(srcdir) - -VFS_OBJS = block.so - -# Default target - -default: $(VFS_OBJS) - -# Pattern rules - -%.so: %.o - $(CC) $(LDSHFLAGS) $(LDFLAGS) -o $@ $< - -%.o: %.c - $(CC) $(FLAGS) -c $< - -# Misc targets - -clean: - rm -rf .libs - rm -f core *~ *% *.bak \ - $(VFS_OBJ) $(VFS_OBJS) diff --git a/examples/VFS/block/block.c b/examples/VFS/block/block.c deleted file mode 100644 index eb388a97ea..0000000000 --- a/examples/VFS/block/block.c +++ /dev/null @@ -1,439 +0,0 @@ -/* - * - * Block access from links to dev mount points specified in PARAMCONF file - * - * Copyright (C) Ronald Kuetemeier, 2001 - * Copyright (C) Alexander Bokovoy, 2002 - * - * 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. - */ - -#include "config.h" -#include -#include -#include -#include -#include -#include -#include -#include - - -#ifdef HAVE_UTIME_H -#include -#endif -#ifdef HAVE_DIRENT_H -#include -#endif -#include -#ifdef HAVE_FCNTL_H -#include -#endif - - -#include -#include - - - -static DIR *block_opendir(connection_struct *conn, char *fname); -static int block_connect(connection_struct *conn, const char *service, const char *user); -static void block_disconnect(connection_struct *conn); - -static struct smb_vfs_handle_struct *block_handle; - -/* VFS operations */ - - -static struct vfs_ops default_vfs_ops; /* For passthrough operation */ - -static vfs_op_tuple block_vfs_ops[] = { - - /* Disk operations */ - - {block_connect, SMB_VFS_OP_CONNECT, SMB_VFS_LAYER_TRANSPARENT}, - {block_disconnect, SMB_VFS_OP_DISCONNECT, SMB_VFS_LAYER_TRANSPARENT}, - - /* Directory operations */ - - {block_opendir, SMB_VFS_OP_OPENDIR, SMB_VFS_LAYER_TRANSPARENT}, - - {NULL, SMB_VFS_OP_NOOP, SMB_VFS_LAYER_NOOP} -}; - - -#ifndef PARAMCONF -#define PARAMCONF "/etc/samba-block.conf" -#endif - -extern BOOL pm_process(char *FileName, BOOL (*sfunc)(char *), BOOL(*pfunc)(char * , char *)); - -/* functions */ - -static BOOL enter_pblock_mount(char *dir); -static BOOL get_section(char *sect); -static BOOL get_parameter_value(char *param, char *value); -static BOOL load_param(void); -static BOOL search(struct stat *stat_buf); -static BOOL dir_search(char *linkstr, char *dir); -static BOOL enter_pblock_dir(char *dir); - - - -typedef struct block_dir -{ - dev_t st_dev; - int str_len; - char *dir_name; - struct block_dir *next; -} block_dir; - - -static char *params[] = {"mount_point","dir_name"}; -enum { MOUNT_POINT , DIR_NAME }; - -static struct block_dir *pblock_mountp = NULL; -static struct block_dir *pblock_dir = NULL; - - - -/* - * Load the conf file into a table - */ - -static BOOL load_param(void) -{ - - if ((pm_process(PARAMCONF,&get_section,&get_parameter_value)) == TRUE) - { - return TRUE; - - } - return FALSE; -} - - - -/* - * Enter the key and data into the list - * - */ - -static BOOL enter_pblock_mount(char *dir) -{ - struct stat stat_buf; - static struct block_dir *tmp_pblock; - - - if((stat(dir,&stat_buf)) != 0) - { - return FALSE; - } - - if(pblock_mountp == NULL) - { - pblock_mountp = calloc(1, sizeof(block_dir)); - if( pblock_mountp == NULL) - { - return FALSE; - } - tmp_pblock = pblock_mountp; - tmp_pblock->next = NULL; - - }else - { - tmp_pblock->next = calloc(1, sizeof(block_dir)); - if(tmp_pblock->next == NULL) - { - return FALSE; - } - tmp_pblock = tmp_pblock->next; - tmp_pblock->next = NULL; - - } - - - tmp_pblock->st_dev = stat_buf.st_dev; - tmp_pblock->dir_name = strdup(dir); - - - return TRUE; - -} - - -/* - * Enter the key and data into the list - * - */ - -static BOOL enter_pblock_dir(char *dir) -{ - static struct block_dir *tmp_pblock; - - - if(pblock_dir == NULL) - { - pblock_dir = calloc(1, sizeof(block_dir)); - if( pblock_dir == NULL) - { - return FALSE; - } - tmp_pblock = pblock_dir; - tmp_pblock->next = NULL; - - }else - { - tmp_pblock->next = calloc(1, sizeof(block_dir)); - if(tmp_pblock->next == NULL) - { - return FALSE; - } - tmp_pblock = tmp_pblock->next; - tmp_pblock->next = NULL; - - } - - - tmp_pblock->dir_name = strdup(dir); - tmp_pblock->str_len = strlen(dir); - - - return TRUE; - -} - - - - -/* - * Function callback for config section names - */ - -static BOOL get_section(char *sect) -{ - return TRUE; -} - - - -/* - * Function callback for config parameter value pairs - * - */ - -static BOOL get_parameter_value(char *param, char *value) -{ - int i = 0, maxargs = sizeof(params) / sizeof(char *); - - - for( i= 0; i < maxargs; i++) - { - if (strcmp(param,params[i]) == 0) - { - switch(i) - { - case MOUNT_POINT : - enter_pblock_mount(value); - break; - case DIR_NAME : - enter_pblock_dir(value); - break; - default : - break; - } - } - } - - return TRUE; - -} - - - - -/* VFS initialisation function. Return initialised vfs_op_tuple array - back to SAMBA. */ - -vfs_op_tuple *vfs_init(int *vfs_version, struct vfs_ops *def_vfs_ops, - struct smb_vfs_handle_struct *vfs_handle) -{ - *vfs_version = SMB_VFS_INTERFACE_VERSION; - - memcpy(&default_vfs_ops, def_vfs_ops, sizeof(struct vfs_ops)); - - block_handle = vfs_handle; - - return block_vfs_ops; -} - - -/* VFS finalization function. */ -void vfs_done(connection_struct *conn) -{ -} - - -/* - * VFS connect and param file loading - */ - -static int block_connect(connection_struct *conn, const char *service, const char *user) -{ - if((load_param()) == FALSE) - { - - return -1; - - } - - DEBUG(0,("%s connecting \n",conn->user)); - - return (default_vfs_ops.connect(conn, service,user)); -} - -/* - * Free allocated structures and disconnect - * - */ - - -static void block_disconnect(struct connection_struct *conn) -{ - - struct block_dir *tmp_pblock = (pblock_mountp == NULL ? pblock_dir : pblock_mountp); - struct block_dir *free_pblock = NULL; - - while(tmp_pblock != NULL) - { - free(tmp_pblock->dir_name); - free_pblock = tmp_pblock; - tmp_pblock = tmp_pblock->next; - free(free_pblock); - - if(tmp_pblock == NULL && pblock_dir != NULL) - { - tmp_pblock = (pblock_mountp == NULL ? pblock_dir : NULL); - pblock_dir = NULL; - - } - - } - - - - default_vfs_ops.disconnect(conn); -} - -/* - * VFS opendir - */ - -static DIR *block_opendir(struct connection_struct *conn, char *fname) -{ - - char *dir_name = NULL; - struct stat stat_buf; - size_t len; - - len = strlen(conn->origpath) + 1 + strcspn(fname, "/"); - asprintf(&dir_name, "%s/%s", conn->origpath, fname); - dir_name[len] = '\0'; - - if((lstat(dir_name,&stat_buf)) == 0) - { - if((S_ISLNK(stat_buf.st_mode)) == 1) - { - stat(dir_name,&stat_buf); - if((search(&stat_buf) || dir_search(dir_name, fname) ) == TRUE) - { - DEBUG(0,("%s used link to blocked dir: %s \n", conn->user, dir_name)); - errno = EACCES; - return NULL; - } - } - } - - return (default_vfs_ops.opendir(conn, fname)); -} - - -/* - * Find mount point to block in list - */ - -static BOOL search(struct stat *stat_buf) -{ - struct block_dir *tmp_pblock = pblock_mountp; - - while(tmp_pblock != NULL) - { - - if(tmp_pblock->st_dev == stat_buf->st_dev) - { - return TRUE; - } - tmp_pblock = tmp_pblock->next; - } - - return FALSE; - -} - -/* - * Find dir in list to block id the starting point is link from a share - */ - -static BOOL dir_search(char *linkstr, char *dir) -{ - char buf[PATH_MAX +1], *ext_path; - int len = 0; - struct block_dir *tmp_pblock = pblock_dir; - - if((len = readlink(linkstr, buf, sizeof(buf))) == -1) - { - return TRUE; - - }else - { - buf[len] = '\0'; - } - - - if((ext_path = strchr(dir, '/')) != NULL) - { - pstrcat(buf, &ext_path[1]); - len = strlen(buf); - } - - while(tmp_pblock != NULL) - { - if(len < tmp_pblock->str_len) - { - tmp_pblock = tmp_pblock->next; - continue; - } - - if((strstr(buf, tmp_pblock->dir_name)) != NULL) - { - return TRUE; - } - tmp_pblock = tmp_pblock->next; - } - - - return FALSE; - -} diff --git a/examples/VFS/block/samba-block.conf b/examples/VFS/block/samba-block.conf deleted file mode 100644 index 7a137980b7..0000000000 --- a/examples/VFS/block/samba-block.conf +++ /dev/null @@ -1,6 +0,0 @@ -[ blocked ] -mount_point = / -mount_point = /boot -mount_point = /proc -dir_name = /usr/local/src/samba -dir_name = /usr/bin diff --git a/examples/VFS/block/smb.conf b/examples/VFS/block/smb.conf deleted file mode 100644 index 931196f402..0000000000 --- a/examples/VFS/block/smb.conf +++ /dev/null @@ -1,6 +0,0 @@ -[homes] - comment = Home Directories - vfs object = /usr/local/samba/lib/block.so - browseable = yes - writable = yes - -- cgit From 27cc26cec83f685c6d1dc73f855e01c082a09ca2 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Sat, 7 Sep 2002 04:05:42 +0000 Subject: recycle.c: merged in modifications made my differnt people, cleaned up things, yet some work todo the code works but there are still some cases to be handled properly Makefile.in: this one seem much simpler and effective than the previous hack with file inclusion it should also be more portable we still need to find a solution to support multiple platforms or go back to libtool (This used to be commit e9f4bc77f84eeece82dea25f9c693cfb1d0a8464) --- examples/VFS/Makefile.in | 10 +- examples/VFS/recycle.c | 582 ++++++++++++++++++++++++++++++++++++----------- 2 files changed, 454 insertions(+), 138 deletions(-) (limited to 'examples/VFS') diff --git a/examples/VFS/Makefile.in b/examples/VFS/Makefile.in index 2ffd23b853..46e1a90263 100644 --- a/examples/VFS/Makefile.in +++ b/examples/VFS/Makefile.in @@ -6,11 +6,8 @@ LDSHFLAGS = -shared srcdir = @builddir@ FLAGS = $(CFLAGS) -Iinclude -I$(srcdir)/include -I$(srcdir)/ubiqx -I$(srcdir)/smbwrapper -I. $(CPPFLAGS) -I$(srcdir) -VFS_OBJS = audit.so recycle.so netatalk.so - -# Default target - -default: $(VFS_OBJS) +# Auto target +default: $(patsubst %.c,%.so,$(wildcard *.c)) # Pattern rules @@ -24,5 +21,4 @@ default: $(VFS_OBJS) clean: rm -rf .libs - rm -f core *~ *% *.bak \ - $(VFS_OBJ) $(VFS_OBJS) + rm -f core *~ *% *.bak *.o *.so diff --git a/examples/VFS/recycle.c b/examples/VFS/recycle.c index 0a261c20df..bcf5f898cc 100644 --- a/examples/VFS/recycle.c +++ b/examples/VFS/recycle.c @@ -1,227 +1,547 @@ -/* - * Auditing VFS module for samba. Log selected file operations to syslog - * facility. +/* + * Recycle bin VFS module for Samba. * * Copyright (C) 2001, Brandon Stone, Amherst College, . * Copyright (C) 2002, Jeremy Allison - modified to make a VFS module. * Copyright (C) 2002, Alexander Bokovoy - cascaded VFS adoption, + * Copyright (C) 2002, Juergen Hasch - added some options. + * Copyright (C) 2002, Simo Sorce * * 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. */ -#include "config.h" -#include -#include -#ifdef HAVE_UTIME_H -#include -#endif -#ifdef HAVE_DIRENT_H -#include -#endif -#include -#ifdef HAVE_FCNTL_H -#include -#endif -#include -#include -#include -#include - -/* VFS operations */ +#include "includes.h" + +#define ALLOC_CHECK(ptr, label) do { if ((ptr) == NULL) { DEBUG(0, ("recycle.bin: out of memory!\n")); errno = ENOMEM; goto label; } } while(0) + +static int vfs_recycle_debug_level = DBGC_VFS; + +#undef DBGC_CLASS +#define DBGC_CLASS vfs_recycle_debug_level +static const char *delimiter = "|"; /* delimiter for options */ + +/* One per connection */ + +typedef struct recycle_bin_struct +{ + TALLOC_CTX *ctx; + char *repository; /* name of the recycle bin directory */ + BOOL keep_directories; /* keep directory structure of deleted file in recycle bin */ + BOOL versions; /* create versions of deleted files with identical name */ + BOOL touch; /* touch access date of deleted file */ + char *exclude; /* which files to exclude */ + char *exclude_dir; /* which directories to exclude */ + char *noversions; /* which files to exclude from versioning */ + SMB_OFF_T maxsize; /* maximum file size to be saved */ +} recycle_bin_struct; + +static BOOL checkparam(char *haystack,char *needle); + +/* VFS operations */ static struct vfs_ops default_vfs_ops; /* For passthrough operation */ -static struct smb_vfs_handle_struct *recycle_handle; -static int recycle_unlink(connection_struct *, const char *); + static int recycle_connect(struct connection_struct *conn, const char *service, const char *user); static void recycle_disconnect(struct connection_struct *conn); +static int recycle_unlink(connection_struct *, const char *); + +#define VFS_OP(x) ((void *) x) static vfs_op_tuple recycle_ops[] = { /* Disk operations */ - - {recycle_connect, SMB_VFS_OP_CONNECT, SMB_VFS_LAYER_OPAQUE}, - {recycle_disconnect, SMB_VFS_OP_DISCONNECT, SMB_VFS_LAYER_OPAQUE}, + {VFS_OP(recycle_connect), SMB_VFS_OP_CONNECT, SMB_VFS_LAYER_TRANSPARENT}, + {VFS_OP(recycle_disconnect), SMB_VFS_OP_DISCONNECT, SMB_VFS_LAYER_TRANSPARENT}, /* File operations */ - - {recycle_unlink, SMB_VFS_OP_UNLINK, SMB_VFS_LAYER_OPAQUE}, + {VFS_OP(recycle_unlink), SMB_VFS_OP_UNLINK, SMB_VFS_LAYER_TRANSPARENT}, - {NULL, SMB_VFS_OP_NOOP, SMB_VFS_LAYER_NOOP} + {NULL, SMB_VFS_OP_NOOP, SMB_VFS_LAYER_NOOP} }; -/* VFS initialisation function. Return initialised vfs_op_tuple array back to SAMBA. */ - -vfs_op_tuple *vfs_init(int *vfs_version, struct vfs_ops *def_vfs_ops, - struct smb_vfs_handle_struct *vfs_handle) +/** + * VFS initialisation function. + * + * @retval initialised vfs_op_tuple array + **/ +vfs_op_tuple *vfs_init(int *vfs_version, struct vfs_ops *def_vfs_ops) { + DEBUG(10, ("Initializing VFS module recycle\n")); *vfs_version = SMB_VFS_INTERFACE_VERSION; memcpy(&default_vfs_ops, def_vfs_ops, sizeof(struct vfs_ops)); - - DEBUG(5,("vfs_init: for recycle!\n")); - - /* Remember vfs_id for storing private information at connect */ - recycle_handle = vfs_handle; + vfs_recycle_debug_level = debug_add_class("recycle.bin"); + if (vfs_recycle_debug_level == -1) { + vfs_recycle_debug_level = DBGC_VFS; + DEBUG(0, ("vfs_recycle: Couldn't register custom debugging class!\n")); + } else { + DEBUG(0, ("vfs_recycle: Debug class number of 'vfs_recycle': %d\n", vfs_recycle_debug_level)); + } return recycle_ops; } -/* VFS finalization function. */ +/** + * VFS finalization function. + * + **/ void vfs_done(connection_struct *conn) { - DEBUG(5,("vfs_done_recycle: called for connection %p\n",conn)); + DEBUG(10,("Called for connection %d\n", SNUM(conn))); } static int recycle_connect(struct connection_struct *conn, const char *service, const char *user) { - fstring recycle_bin; + TALLOC_CTX *ctx = NULL; + recycle_bin_struct *recbin; + char *servicename; + char *tmp_str; - DEBUG(4,("recycle_connect: called for service %s as user %s\n", service, user)); + DEBUG(10, ("Called for service %s (%d) as user %s\n", service, SNUM(conn), user)); - fstrcpy(recycle_bin, (const char *)lp_parm_string(lp_servicename(SNUM(conn)),"vfs","recycle bin")); - if (!*recycle_bin) { - DEBUG(0,("recycle_connect: No options listed (vfs:recycle bin).\n" )); - return 0; /* No options. */ + if (!(ctx = talloc_init_named("recycle bin"))) { + DEBUG(0, ("Failed to allocate memory in VFS module recycle_bin\n")); + return 0; } - - standard_sub_conn(conn,recycle_bin,sizeof(fstring)); + recbin = talloc(ctx,sizeof(recycle_bin_struct)); + if ( recbin == NULL) { + DEBUG(0, ("Failed to allocate memory in VFS module recycle_bin\n")); + return -1; + } + recbin->ctx = ctx; + + /* Set defaults */ + recbin->repository = talloc_strdup(ctx, ".recycle"); + ALLOC_CHECK(recbin->repository, error); + recbin->keep_directories = False; + recbin->versions = False; + recbin->touch = False; + recbin->exclude = ""; + recbin->exclude_dir = ""; + recbin->noversions = ""; + recbin->maxsize = 0; + + /* parse configuration options */ + servicename = talloc_strdup(recbin->ctx, lp_servicename(SNUM(conn))); + DEBUG(10, ("servicename = %s\n",servicename)); + if ((tmp_str = lp_parm_string(servicename, "recycle.bin", "repository")) != NULL) { + recbin->repository = talloc_sub_conn(ctx, conn, tmp_str); + ALLOC_CHECK(recbin->repository, error); + trim_string(recbin->repository, "/", "/"); + DEBUG(5, ("recycle.bin: repository = %s\n", recbin->repository)); + } + if ((tmp_str = lp_parm_string(servicename, "recycle.bin", "mode")) != NULL) { + if (checkparam(tmp_str, "KEEP_DIRECTORIES") == True) + recbin->keep_directories = True; + if (checkparam(tmp_str, "VERSIONS") == True) + recbin->versions = True; + if (checkparam(tmp_str, "TOUCH") == True) + recbin->touch = True; + DEBUG(5, ("recycle.bin: mode = %s\n", tmp_str)); + } + if ((tmp_str = lp_parm_string(servicename, "recycle.bin", "maxsize")) != NULL) { + recbin->maxsize = strtoul(tmp_str, NULL, 10); + if (recbin->maxsize == 0) { + recbin->maxsize = -1; + DEBUG(5, ("recycle.bin: maxsize = -infinite-\n")); + } else { + DEBUG(5, ("recycle.bin: maxsize = %ld\n", (long int)recbin->maxsize)); + } + } + if ((tmp_str = lp_parm_string(servicename, "recycle.bin", "exclude")) != NULL) { + recbin->exclude = talloc_strdup(ctx, tmp_str); + ALLOC_CHECK(recbin->exclude, error); + DEBUG(5, ("recycle.bin: exclude = %s\n", recbin->exclude)); + } + if ((tmp_str = lp_parm_string(servicename,"recycle.bin", "exclude_dir")) != NULL) { + recbin->exclude_dir = talloc_strdup(ctx, tmp_str); + ALLOC_CHECK(recbin->exclude_dir, error); + DEBUG(5, ("recycle.bin: exclude_dir = %s\n", recbin->exclude_dir)); + } + if ((tmp_str = lp_parm_string(servicename,"recycle.bin", "noversions")) != NULL) { + recbin->noversions = talloc_strdup(ctx, tmp_str); + ALLOC_CHECK(recbin->noversions, error); + DEBUG(5, ("recycle.bin: noversions = %s\n", recbin->noversions)); + } - DEBUG(3,("recycle_connect: recycle name is %s\n", recycle_bin )); + conn->vfs_private = (void *)recbin; + return default_vfs_ops.connect(conn, service, user); - recycle_handle->data = (void *)strdup(recycle_bin); - return 0; +error: + talloc_destroy(ctx); + return -1; } static void recycle_disconnect(struct connection_struct *conn) { - SAFE_FREE(recycle_handle->data); + DEBUG(10, ("Disconnecting VFS module recycle bin\n")); + if (conn->vfs_private) { + talloc_destroy(((recycle_bin_struct *)conn->vfs_private)->ctx); + conn->vfs_private = NULL; + } + default_vfs_ops.disconnect(conn); } -static BOOL recycle_XXX_exist(connection_struct *conn, const char *dname, BOOL isdir) +static BOOL recycle_directory_exist(connection_struct *conn, const char *dname) { SMB_STRUCT_STAT st; - if (default_vfs_ops.stat(conn,dname,&st) != 0) - return(False); + if (default_vfs_ops.stat(conn, dname, &st) == 0) { + if (S_ISDIR(st.st_mode)) { + return True; + } + } - if (isdir) - return S_ISDIR(st.st_mode) ? True : False; - else - return S_ISREG(st.st_mode) ? True : False; -} - -static BOOL recycle_directory_exist(connection_struct *conn, const char *dname) -{ - return recycle_XXX_exist(conn, dname, True); + return False; } static BOOL recycle_file_exist(connection_struct *conn, const char *fname) { - return recycle_XXX_exist(conn, fname, False); + SMB_STRUCT_STAT st; + + if (default_vfs_ops.stat(conn, fname, &st) == 0) { + if (S_ISREG(st.st_mode)) { + return True; + } + } + + return False; } +/** + * Return file size + * @param conn connection + * @param fname file name + * @return size in bytes + **/ static SMB_OFF_T recycle_get_file_size(connection_struct *conn, const char *fname) { SMB_STRUCT_STAT st; + if (default_vfs_ops.stat(conn, fname, &st) != 0) { + DEBUG(0,("recycle.bin: stat for %s returned %s\n", fname, strerror(errno))); + return (SMB_OFF_T)0; + } + return(st.st_size); +} - if (default_vfs_ops.stat(conn,fname,&st) != 0) - return (SMB_OFF_T)-1; +/** + * Create directory tree + * @param conn connection + * @param dname Directory tree to be created + * @return Returns True for success + **/ +static BOOL recycle_create_dir(connection_struct *conn, const char *dname) +{ + int len; + mode_t mode; + char *new_dir = NULL; + char *tmp_str = NULL; + char *token; + char *tok_str; + BOOL ret = False; + + mode = S_IREAD | S_IWRITE | S_IEXEC; + + tmp_str = strdup(dname); + ALLOC_CHECK(tmp_str, done); + tok_str = tmp_str; + + len = strlen(dname); + new_dir = (char *)malloc(len + 1); + ALLOC_CHECK(new_dir, done); + *new_dir = '\0'; + + /* Create directory tree if neccessary */ + for(token = strtok(tok_str, "/"); token; token = strtok(NULL, "/")) { + safe_strcat(new_dir, token, len); + if (recycle_directory_exist(conn, new_dir)) + DEBUG(10, ("recycle.bin: dir %s already exists\n", new_dir)); + else { + DEBUG(5, ("recycle.bin: creating new dir %s\n", new_dir)); + if (default_vfs_ops.mkdir(conn, new_dir, mode) != 0) { + DEBUG(1,("recycle.bin: mkdir failed for %s with error: %s\n", new_dir, strerror(errno))); + ret = False; + goto done; + } + } + safe_strcat(new_dir, "/", len); + } - return(st.st_size); + ret = True; +done: + SAFE_FREE(tmp_str); + SAFE_FREE(new_dir); + return ret; } -/******************************************************************** - Check if file should be recycled -*********************************************************************/ +/** + * Check if needle is contained exactly in haystack + * @param haystack list of parameters separated by delimimiter character + * @param needle string to be matched exactly to haystack + * @return True if found + **/ +static BOOL checkparam(char *haystack, char *needle) +{ + char *token; + char *tok_str; + char *tmp_str; + BOOL ret = False; + + if (haystack == NULL || strlen(haystack) == 0 || needle == NULL || strlen(needle) == 0) { + return False; + } + + tmp_str = strdup(haystack); + ALLOC_CHECK(tmp_str, done); + token = tok_str = tmp_str; + + for(token = strtok(tok_str, delimiter); token; token = strtok(NULL, delimiter)) { + if(strcmp(token, needle) == 0) { + ret = True; + goto done; + } + } +done: + SAFE_FREE(tmp_str); + return ret; +} + +/** + * Check if needle is contained in haystack, * and ? patterns are resolved + * @param haystack list of parameters separated by delimimiter character + * @param needle string to be matched exectly to haystack including pattern matching + * @return True if found + **/ +static BOOL matchparam(char *haystack, char *needle) +{ + char *token; + char *tok_str; + char *tmp_str; + BOOL ret = False; + + if (haystack == NULL || strlen(haystack) == 0 || needle == NULL || strlen(needle) == 0) { + return False; + } + + tmp_str = strdup(haystack); + ALLOC_CHECK(tmp_str, done); + token = tok_str = tmp_str; + + for(token = strtok(tok_str, delimiter); token; token = strtok(NULL, delimiter)) { + if (!unix_wild_match(token, needle)) { + ret = True; + goto done; + } + } +done: + SAFE_FREE(tmp_str); + return ret; +} + +/** + * Touch access date + **/ +static void recycle_touch(connection_struct *conn, const char *fname) +{ + SMB_STRUCT_STAT st; + struct utimbuf tb; + time_t currtime; + + if (default_vfs_ops.stat(conn, fname, &st) != 0) { + DEBUG(0,("recycle.bin: stat for %s returned %s\n", fname, strerror(errno))); + return; + } + currtime = time(&currtime); + tb.actime = currtime; + tb.modtime = st.st_mtime; + + if (default_vfs_ops.utime(conn, fname, &tb) == -1 ) + DEBUG(0, ("recycle.bin: touching %s failed, reason = %s\n", fname, strerror(errno))); + } +/** + * Check if file should be recycled + **/ static int recycle_unlink(connection_struct *conn, const char *inname) { - fstring recycle_bin; - pstring fname; - char *base, *ext; - pstring bin; - int i=1, len, addlen; - int dir_mask=0770; - SMB_BIG_UINT dfree,dsize,bsize; + recycle_bin_struct *recbin; + char *file_name = NULL; + char *path_name = NULL; + char *temp_name = NULL; + char *final_name = NULL; + char *base; + int i; + SMB_BIG_UINT dfree, dsize, bsize; + SMB_OFF_T file_size, space_avail; + BOOL exist; + int rc; + + file_name = strdup(inname); + ALLOC_CHECK(file_name, done); + + if (conn->vfs_private) + recbin = (recycle_bin_struct *)conn->vfs_private; + else { + DEBUG(0, ("Recycle bin not initialized!\n")); + rc = default_vfs_ops.unlink(conn, file_name); + goto done; + } - *recycle_bin = '\0'; - pstrcpy(fname, inname); + if(!recbin->repository || *(recbin->repository) == '\0') { + DEBUG(3, ("Recycle path not set, purging %s...\n", file_name)); + rc = default_vfs_ops.unlink(conn, file_name); + goto done; + } - if (recycle_handle->data) - fstrcpy(recycle_bin, (const char *)recycle_handle->data); + /* we don't recycle the recycle bin... */ + if (strncmp(file_name, recbin->repository, strlen(recbin->repository)) == 0) { + DEBUG(3, ("File is within recycling bin, unlinking ...\n")); + rc = default_vfs_ops.unlink(conn, file_name); + goto done; + } - if(!*recycle_bin) { - DEBUG(1, ("recycle bin: share parameter not set, purging %s...\n", fname)); - return default_vfs_ops.unlink(conn,fname); + file_size = recycle_get_file_size(conn, file_name); + /* it is wrong to purge filenames only because they are empty imho + * --- simo + * + if(fsize == 0) { + DEBUG(3, ("File %s is empty, purging...\n", file_name)); + rc = default_vfs_ops.unlink(conn,file_name); + goto done; + } + */ + + /* FIXME: this is wrong, we should check the hole size of the recycle bin is + * not greater then maxsize, not the size of the single file, also it is better + * to remove older files + */ + if(recbin->maxsize > 0 && file_size > recbin->maxsize) { + DEBUG(3, ("File %s exceeds maximum recycle size, purging... \n", file_name)); + rc = default_vfs_ops.unlink(conn, file_name); + goto done; } - if(recycle_get_file_size(conn, fname) == 0) { - DEBUG(3, ("recycle bin: file %s is empty, purging...\n", fname)); - return default_vfs_ops.unlink(conn,fname); + /* FIXME: this is wrong: moving files with rename does not change the disk space + * allocation + * + space_avail = default_vfs_ops.disk_free(conn, ".", True, &bsize, &dfree, &dsize) * 1024L; + DEBUG(5, ("space_avail = %Lu, file_size = %Lu\n", space_avail, file_size)); + if(space_avail < file_size) { + DEBUG(3, ("Not enough diskspace, purging file %s\n", file_name)); + rc = default_vfs_ops.unlink(conn, file_name); + goto done; + } + */ + + /* extract filename and path */ + path_name = (char *)malloc(PATH_MAX); + ALLOC_CHECK(path_name, done); + *path_name = '\0'; + safe_strcpy(path_name, file_name, PATH_MAX); + base = strrchr(path_name, '/'); + if (base == NULL) { + base = file_name; + safe_strcpy(path_name, "/", PATH_MAX); + } + else { + *base = '\0'; + base++; } - base = strrchr(fname, '/'); - pstrcpy(bin, recycle_bin); - pstrcat(bin, "/"); + DEBUG(10, ("recycle.bin: fname = %s\n", file_name)); /* original filename with path */ + DEBUG(10, ("recycle.bin: fpath = %s\n", path_name)); /* original path */ + DEBUG(10, ("recycle.bin: base = %s\n", base)); /* filename without path */ - if(base == NULL) { - ext = strrchr(fname, '.'); - pstrcat(bin, fname); - } else { - ext = strrchr(base, '.'); - pstrcat(bin, base+1); + if (matchparam(recbin->exclude, base)) { + DEBUG(3, ("recycle.bin: file %s is excluded \n", base)); + rc = default_vfs_ops.unlink(conn, file_name); + goto done; } - DEBUG(4, ("recycle bin: base %s, ext %s, fname %s, bin %s\n", base, ext, fname, bin)); - if(strcmp(fname,bin) == 0) { - DEBUG(3, ("recycle bin: file %s exists, purging...\n", fname)); - return default_vfs_ops.unlink(conn,fname); + /* FIXME: this check will fail if we have more than one level of directories, + * we shoud check for every level 1, 1/2, 1/2/3, 1/2/3/4 .... + * ---simo + */ + if (checkparam(recbin->exclude_dir, path_name)) { + DEBUG(3, ("recycle.bin: directory %s is excluded \n", path_name)); + rc = default_vfs_ops.unlink(conn, file_name); + goto done; } - len = strlen(bin); - if ( ext != NULL) - len = len - strlen(ext); + temp_name = (char *)malloc(PATH_MAX); + ALLOC_CHECK(temp_name, done); + safe_strcpy(temp_name, recbin->repository, PATH_MAX); - addlen = sizeof(pstring)-len-1; - while(recycle_file_exist(conn,bin)) { - slprintf(bin+len, addlen, " (Copy #%d)", i++); - pstrcat(bin, ext); + /* see if we need to recreate the original directory structure in the recycle bin */ + if (recbin->keep_directories == True) { + safe_strcat(temp_name, "/", PATH_MAX); + safe_strcat(temp_name, path_name, PATH_MAX); } - DEBUG(3, ("recycle bin: moving source=%s to dest=%s\n", fname, bin)); - default_vfs_ops.disk_free(conn,".",True,&bsize,&dfree,&dsize); - if((unsigned int)dfree > 0) { - int ret; - if(!recycle_directory_exist(conn,recycle_bin)) { - DEBUG(3, ("recycle bin: directory %s nonexistant, creating...\n", recycle_bin)); - if (default_vfs_ops.mkdir(conn,recycle_bin,dir_mask) == -1) { - DEBUG(0, ("recycle bin: unable to create directory %s. Error was %s\n", - recycle_bin, strerror(errno) )); - } + exist = recycle_directory_exist(conn, temp_name); + if (exist) { + DEBUG(10, ("recycle.bin: Directory already exists\n")); + } else { + DEBUG(10, ("recycle.bin: Creating directory %s\n", temp_name)); + if (recycle_create_dir(conn, temp_name) == False) { + DEBUG(3, ("Could not create directory, purging %s...\n", file_name)); + rc = default_vfs_ops.unlink(conn, file_name); + goto done; } - DEBUG(3, ("recycle bin: move %s -> %s\n", fname, bin)); + } - ret = default_vfs_ops.rename(conn, fname, bin); - if (ret == -1) { - DEBUG(1, ("recycle bin: move error %d (%s)\n", errno, strerror(errno) )); - DEBUG(0, ("recycle bin: move failed, purging...\n")); - return default_vfs_ops.unlink(conn,fname); + safe_strcat(temp_name, "/", PATH_MAX); + safe_strcat(temp_name, base, PATH_MAX); + DEBUG(10, ("recycle.bin: recycled file name%s\n", temp_name)); /* new filename with path */ + + /* check if we should delete file from recycle bin */ + if (recycle_file_exist(conn, temp_name)) { + if (recbin->versions == False || matchparam(recbin->noversions, base) == True) { + DEBUG(3, ("recycle.bin: Removing old file %s from recycle bin\n", temp_name)); + if (default_vfs_ops.unlink(conn, temp_name) != 0) { + DEBUG(1, ("recycle.bin: Error deleting old file: %s\n", strerror(errno))); + } } - return ret; - } else { - DEBUG(1, ("recycle bin: move failed, purging...\n")); - return default_vfs_ops.unlink(conn,fname); } + + /* rename file we move to recycle bin */ + i = 1; + final_name = (char *)malloc(PATH_MAX); + ALLOC_CHECK(final_name, done); + final_name = safe_strcpy(final_name, temp_name, PATH_MAX); + while (recycle_file_exist(conn, final_name)) { + snprintf(final_name, PATH_MAX, "Copy #%d of ", i++); + safe_strcat(final_name, temp_name, PATH_MAX); + } + + DEBUG(10, ("recycle.bin: Moving %s to %s\n", file_name, final_name)); + rc = default_vfs_ops.rename(conn, file_name, final_name); + if (rc != 0) { + DEBUG(3, ("recycle.bin: Move error %d (%s), purging file %s (%s)\n", errno, strerror(errno), file_name, final_name)); + rc = default_vfs_ops.unlink(conn, file_name); + goto done; + } + + /* touch access date of moved file */ + if (recbin->touch == True ) + recycle_touch(conn, final_name); + +done: + SAFE_FREE(file_name); + SAFE_FREE(path_name); + SAFE_FREE(temp_name); + SAFE_FREE(final_name); + return rc; } -- cgit From 79f54d28f8dd7aae636c2c2c857c98ad35fc747f Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Sun, 8 Sep 2002 03:55:37 +0000 Subject: change parametric option name to vfs_recycle_bin it is more sane and do not pollute standard options namespace too much changed also the mode options to be indipendente boolean values, make it easier to understand how to configure them eg: vfs_recycle_bin:keeptree=yes vfs_recycle_bin:versions=yes (This used to be commit d904d50d3945f5f6a80b59850a82f3e37863c125) --- examples/VFS/recycle.c | 71 +++++++++++++++++++++++++++++--------------------- 1 file changed, 41 insertions(+), 30 deletions(-) (limited to 'examples/VFS') diff --git a/examples/VFS/recycle.c b/examples/VFS/recycle.c index bcf5f898cc..a56619af31 100644 --- a/examples/VFS/recycle.c +++ b/examples/VFS/recycle.c @@ -39,7 +39,7 @@ typedef struct recycle_bin_struct { TALLOC_CTX *ctx; char *repository; /* name of the recycle bin directory */ - BOOL keep_directories; /* keep directory structure of deleted file in recycle bin */ + BOOL keep_dir_tree; /* keep directory structure of deleted file in recycle bin */ BOOL versions; /* create versions of deleted files with identical name */ BOOL touch; /* touch access date of deleted file */ char *exclude; /* which files to exclude */ @@ -48,8 +48,6 @@ typedef struct recycle_bin_struct SMB_OFF_T maxsize; /* maximum file size to be saved */ } recycle_bin_struct; -static BOOL checkparam(char *haystack,char *needle); - /* VFS operations */ static struct vfs_ops default_vfs_ops; /* For passthrough operation */ @@ -71,6 +69,16 @@ static vfs_op_tuple recycle_ops[] = { {NULL, SMB_VFS_OP_NOOP, SMB_VFS_LAYER_NOOP} }; +static BOOL check_bool_param(const char *value) +{ + if (strwicmp(value, "yes") == 0 || + strwicmp(value, "true") == 0 || + strwicmp(value, "1") == 0) + return True; + + return False; +} + /** * VFS initialisation function. * @@ -81,7 +89,7 @@ vfs_op_tuple *vfs_init(int *vfs_version, struct vfs_ops *def_vfs_ops) DEBUG(10, ("Initializing VFS module recycle\n")); *vfs_version = SMB_VFS_INTERFACE_VERSION; memcpy(&default_vfs_ops, def_vfs_ops, sizeof(struct vfs_ops)); - vfs_recycle_debug_level = debug_add_class("recycle.bin"); + vfs_recycle_debug_level = debug_add_class("vfs_recycle_bin"); if (vfs_recycle_debug_level == -1) { vfs_recycle_debug_level = DBGC_VFS; DEBUG(0, ("vfs_recycle: Couldn't register custom debugging class!\n")); @@ -125,7 +133,7 @@ static int recycle_connect(struct connection_struct *conn, const char *service, /* Set defaults */ recbin->repository = talloc_strdup(ctx, ".recycle"); ALLOC_CHECK(recbin->repository, error); - recbin->keep_directories = False; + recbin->keep_dir_tree = False; recbin->versions = False; recbin->touch = False; recbin->exclude = ""; @@ -136,22 +144,28 @@ static int recycle_connect(struct connection_struct *conn, const char *service, /* parse configuration options */ servicename = talloc_strdup(recbin->ctx, lp_servicename(SNUM(conn))); DEBUG(10, ("servicename = %s\n",servicename)); - if ((tmp_str = lp_parm_string(servicename, "recycle.bin", "repository")) != NULL) { + if ((tmp_str = lp_parm_string(servicename, "vfs_recycle_bin", "repository")) != NULL) { recbin->repository = talloc_sub_conn(ctx, conn, tmp_str); ALLOC_CHECK(recbin->repository, error); trim_string(recbin->repository, "/", "/"); DEBUG(5, ("recycle.bin: repository = %s\n", recbin->repository)); } - if ((tmp_str = lp_parm_string(servicename, "recycle.bin", "mode")) != NULL) { - if (checkparam(tmp_str, "KEEP_DIRECTORIES") == True) - recbin->keep_directories = True; - if (checkparam(tmp_str, "VERSIONS") == True) + if ((tmp_str = lp_parm_string(servicename, "vfs_recycle_bin", "keeptree")) != NULL) { + if (check_bool_param(tmp_str) == True) + recbin->keep_dir_tree = True; + DEBUG(5, ("recycle.bin: keeptree = %s\n", tmp_str)); + } + if ((tmp_str = lp_parm_string(servicename, "vfs_recycle_bin", "versions")) != NULL) { + if (check_bool_param(tmp_str) == True) recbin->versions = True; - if (checkparam(tmp_str, "TOUCH") == True) + DEBUG(5, ("recycle.bin: versions = %s\n", tmp_str)); + } + if ((tmp_str = lp_parm_string(servicename, "vfs_recycle_bin", "touch")) != NULL) { + if (check_bool_param(tmp_str) == True) recbin->touch = True; - DEBUG(5, ("recycle.bin: mode = %s\n", tmp_str)); + DEBUG(5, ("recycle.bin: touch = %s\n", tmp_str)); } - if ((tmp_str = lp_parm_string(servicename, "recycle.bin", "maxsize")) != NULL) { + if ((tmp_str = lp_parm_string(servicename, "vfs_recycle_bin", "maxsize")) != NULL) { recbin->maxsize = strtoul(tmp_str, NULL, 10); if (recbin->maxsize == 0) { recbin->maxsize = -1; @@ -160,17 +174,17 @@ static int recycle_connect(struct connection_struct *conn, const char *service, DEBUG(5, ("recycle.bin: maxsize = %ld\n", (long int)recbin->maxsize)); } } - if ((tmp_str = lp_parm_string(servicename, "recycle.bin", "exclude")) != NULL) { + if ((tmp_str = lp_parm_string(servicename, "vfs_recycle_bin", "exclude")) != NULL) { recbin->exclude = talloc_strdup(ctx, tmp_str); ALLOC_CHECK(recbin->exclude, error); DEBUG(5, ("recycle.bin: exclude = %s\n", recbin->exclude)); } - if ((tmp_str = lp_parm_string(servicename,"recycle.bin", "exclude_dir")) != NULL) { + if ((tmp_str = lp_parm_string(servicename,"vfs_recycle_bin", "exclude_dir")) != NULL) { recbin->exclude_dir = talloc_strdup(ctx, tmp_str); ALLOC_CHECK(recbin->exclude_dir, error); DEBUG(5, ("recycle.bin: exclude_dir = %s\n", recbin->exclude_dir)); } - if ((tmp_str = lp_parm_string(servicename,"recycle.bin", "noversions")) != NULL) { + if ((tmp_str = lp_parm_string(servicename,"vfs_recycle_bin", "noversions")) != NULL) { recbin->noversions = talloc_strdup(ctx, tmp_str); ALLOC_CHECK(recbin->noversions, error); DEBUG(5, ("recycle.bin: noversions = %s\n", recbin->noversions)); @@ -292,7 +306,7 @@ done: * @param needle string to be matched exactly to haystack * @return True if found **/ -static BOOL checkparam(char *haystack, char *needle) +static BOOL checkparam(const char *haystack, const char *needle) { char *token; char *tok_str; @@ -324,7 +338,7 @@ done: * @param needle string to be matched exectly to haystack including pattern matching * @return True if found **/ -static BOOL matchparam(char *haystack, char *needle) +static BOOL matchparam(const char *haystack, const char *needle) { char *token; char *tok_str; @@ -386,7 +400,7 @@ static int recycle_unlink(connection_struct *conn, const char *inname) SMB_BIG_UINT dfree, dsize, bsize; SMB_OFF_T file_size, space_avail; BOOL exist; - int rc; + int rc = -1; file_name = strdup(inname); ALLOC_CHECK(file_name, done); @@ -485,7 +499,7 @@ static int recycle_unlink(connection_struct *conn, const char *inname) safe_strcpy(temp_name, recbin->repository, PATH_MAX); /* see if we need to recreate the original directory structure in the recycle bin */ - if (recbin->keep_directories == True) { + if (recbin->keep_dir_tree == True) { safe_strcat(temp_name, "/", PATH_MAX); safe_strcat(temp_name, path_name, PATH_MAX); } @@ -502,15 +516,16 @@ static int recycle_unlink(connection_struct *conn, const char *inname) } } - safe_strcat(temp_name, "/", PATH_MAX); - safe_strcat(temp_name, base, PATH_MAX); + final_name = (char *)malloc(PATH_MAX); + ALLOC_CHECK(final_name, done); + snprintf(final_name, PATH_MAX, "%s/%s", temp_name, base); DEBUG(10, ("recycle.bin: recycled file name%s\n", temp_name)); /* new filename with path */ /* check if we should delete file from recycle bin */ - if (recycle_file_exist(conn, temp_name)) { + if (recycle_file_exist(conn, final_name)) { if (recbin->versions == False || matchparam(recbin->noversions, base) == True) { - DEBUG(3, ("recycle.bin: Removing old file %s from recycle bin\n", temp_name)); - if (default_vfs_ops.unlink(conn, temp_name) != 0) { + DEBUG(3, ("recycle.bin: Removing old file %s from recycle bin\n", final_name)); + if (default_vfs_ops.unlink(conn, final_name) != 0) { DEBUG(1, ("recycle.bin: Error deleting old file: %s\n", strerror(errno))); } } @@ -518,12 +533,8 @@ static int recycle_unlink(connection_struct *conn, const char *inname) /* rename file we move to recycle bin */ i = 1; - final_name = (char *)malloc(PATH_MAX); - ALLOC_CHECK(final_name, done); - final_name = safe_strcpy(final_name, temp_name, PATH_MAX); while (recycle_file_exist(conn, final_name)) { - snprintf(final_name, PATH_MAX, "Copy #%d of ", i++); - safe_strcat(final_name, temp_name, PATH_MAX); + snprintf(final_name, PATH_MAX, "%s/Copy #%d of %s", temp_name, i++, base); } DEBUG(10, ("recycle.bin: Moving %s to %s\n", file_name, final_name)); -- cgit From 812c0a0f98dfd392662a4174c94d577755fbe740 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Mon, 30 Sep 2002 15:25:40 +0000 Subject: README.OtherModules (This used to be commit 93cb8b47c48d0492e3e699542bdc521aafb8d1b7) --- examples/VFS/README.OtherModules | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 examples/VFS/README.OtherModules (limited to 'examples/VFS') diff --git a/examples/VFS/README.OtherModules b/examples/VFS/README.OtherModules new file mode 100644 index 0000000000..02dced6158 --- /dev/null +++ b/examples/VFS/README.OtherModules @@ -0,0 +1,39 @@ +This file contains a listing of various other VFS modules that +have been posted but don't currently reside in the Samba CVS +tree for one reason ot another (e.g. it is easy for the maintainer +to have his or her own CVS tree). + +No statemets about the stability or functionality any module +should be implied due to its presence here. + + +------------------------------------------------------------ +Date: Sat, 28 Sep 2002 23:41:31 -0500 +From: Eric Lorimer +To: samba-technical@lists.samba.org +Subject: DatabaseFS VFS module + +Hello, + +I have created a VFS module which implements a fairly complete read-only +filesystem. It presents information from a database as a filesystem in +a modular and generic way to allow different databases to be used +(originally designed for organizing MP3s under directories such as +"Artists," "Song Keywords," etc... I have since applied it to a student +roster database very easily). The directory structure is stored in the +database itself and the module makes no assumptions about the database +structure beyond the table it requires to run. You can find it at: + +http://www.css.tayloru.edu/~elorimer/databasefs/index.php + + +Any feedback would be appreciated: comments, suggestions, patches, +etc... If nothing else, hopefully it might prove useful for someone +else who wishes to create a virtual filesystem. + +Thanks for the great product and keep up the good work. + + +- Eric Lorimer + +------------------------------------------------------------ -- cgit From f861aab464e5344d0be1ea68272db832a25223b5 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 24 Oct 2002 15:45:23 +0000 Subject: Give recycle 3 arguments as required by the VFS interface (patch by metze) (This used to be commit 15b9430d9ce43ba7e08338ab9fab657d6763dc02) --- examples/VFS/recycle.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'examples/VFS') diff --git a/examples/VFS/recycle.c b/examples/VFS/recycle.c index a56619af31..b59cb92a28 100644 --- a/examples/VFS/recycle.c +++ b/examples/VFS/recycle.c @@ -84,7 +84,8 @@ static BOOL check_bool_param(const char *value) * * @retval initialised vfs_op_tuple array **/ -vfs_op_tuple *vfs_init(int *vfs_version, struct vfs_ops *def_vfs_ops) +vfs_op_tuple *vfs_init(int *vfs_version, struct vfs_ops *def_vfs_ops, + struct smb_vfs_handle_struct *vfs_handle) { DEBUG(10, ("Initializing VFS module recycle\n")); *vfs_version = SMB_VFS_INTERFACE_VERSION; -- cgit From 59810257b9a266225366ea08d699cbf2f906e63a Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 28 Oct 2002 19:19:59 +0000 Subject: Sync with HEAD (This used to be commit e8475eceb397f86c4bada063707f09a3c45bc14c) --- examples/VFS/README.OtherModules | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'examples/VFS') diff --git a/examples/VFS/README.OtherModules b/examples/VFS/README.OtherModules index 02dced6158..5693d2e3f4 100644 --- a/examples/VFS/README.OtherModules +++ b/examples/VFS/README.OtherModules @@ -8,6 +8,8 @@ should be implied due to its presence here. ------------------------------------------------------------ +URL: http://www.css.tayloru.edu/~elorimer/databasefs/index.php + Date: Sat, 28 Sep 2002 23:41:31 -0500 From: Eric Lorimer To: samba-technical@lists.samba.org @@ -37,3 +39,13 @@ Thanks for the great product and keep up the good work. - Eric Lorimer ------------------------------------------------------------ +URL: http://www.openantivirus.org/ + +"samba-vscan is a proof-of-concept module for Samba, which +uses the VFS (virtual file system) features of Samba 2.2.x/3.0 +alphaX. Of couse, Samba has to be compiled with VFS support. +samba-vscan supports various virus scanners and is maintained +by Rainer Link". + +------------------------------------------------------------ + -- cgit From 4d12794bc15e7983372476baa8b21aa71eb69a98 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 18 Nov 2002 16:22:44 +0000 Subject: Sync with HEAD: - Move working VFS modules to source/ - Move documentation to SGML (This used to be commit be4894815cf7a8e3d792d9801fe9a343f2060c3e) --- examples/VFS/README | 57 +--- examples/VFS/README.OtherModules | 51 ---- examples/VFS/README.netatalk | 18 -- examples/VFS/audit.c | 268 ------------------- examples/VFS/netatalk.c | 430 ------------------------------ examples/VFS/recycle.c | 559 --------------------------------------- 6 files changed, 9 insertions(+), 1374 deletions(-) delete mode 100644 examples/VFS/README.OtherModules delete mode 100644 examples/VFS/README.netatalk delete mode 100644 examples/VFS/audit.c delete mode 100644 examples/VFS/netatalk.c delete mode 100644 examples/VFS/recycle.c (limited to 'examples/VFS') diff --git a/examples/VFS/README b/examples/VFS/README index 1b09929059..25254c1ffc 100644 --- a/examples/VFS/README +++ b/examples/VFS/README @@ -1,53 +1,14 @@ -README for Samba Virtual File System (VFS) Examples +README for Samba Virtual File System (VFS) Example =================================================== -This directory contains some sample code to demonstrate VFS -construction. The following VFS modules are given: +This directory contains a skeleton VFS module. When used, +this module simply passes all requests back to the disk functions +(i.e it operates as a passthrough filter). It should be +useful as a starting point for developing new VFS +modules. - skel - A skeleton VFS module. When used, this module simply - passes all requests back to the disk functions (i.e it - operates as a passthrough filter). It should be - useful as a starting point for developing new VFS - modules. - - audit - A simple module to audit file access to the syslog - facility. The following operations are logged: share - connect/disconnect, directory opens/create/remove, - file open/close/rename/unlink/chmod. - - recycle - A recycle-bin like modules. When used any unlink call - will be intercepted and files moved to the recycle - directory nstead of beeing deleted. - - block - A simple module to block access to certain mount points or - directories. This module only hides the specified directories - and all directories beneath them. It should NOT be used to - secure directories. If the name of a file in one of those - directories is known, the file can still be opened. - - netatalk - A netatalk module, that will ease co-existence of samba and - netatalk file sharing services. - Looka t the README for more informations. - -You may have problems to compile these modules, as shared libraries are -compiled and linked in different ways on different systems. -I currently tested them against GNU/linux and IRIX. - -To use the VFS modules, create a share similar to the one below. The -important parameter is the 'vfs object' parameter which must point to -the exact pathname of the shared library object. - - [audit] - comment = Audited /data directory - path = /data - vfs object = /path/to/audit.so - writeable = yes - browseable = yes +Please read the VFS chapter in the HOWTO collection for general help +on the usage of VFS modules. Further documentation on writing VFS modules for Samba can be found in -docs directory of the Samba source distribution. +Samba Developers Guide. diff --git a/examples/VFS/README.OtherModules b/examples/VFS/README.OtherModules deleted file mode 100644 index 5693d2e3f4..0000000000 --- a/examples/VFS/README.OtherModules +++ /dev/null @@ -1,51 +0,0 @@ -This file contains a listing of various other VFS modules that -have been posted but don't currently reside in the Samba CVS -tree for one reason ot another (e.g. it is easy for the maintainer -to have his or her own CVS tree). - -No statemets about the stability or functionality any module -should be implied due to its presence here. - - ------------------------------------------------------------- -URL: http://www.css.tayloru.edu/~elorimer/databasefs/index.php - -Date: Sat, 28 Sep 2002 23:41:31 -0500 -From: Eric Lorimer -To: samba-technical@lists.samba.org -Subject: DatabaseFS VFS module - -Hello, - -I have created a VFS module which implements a fairly complete read-only -filesystem. It presents information from a database as a filesystem in -a modular and generic way to allow different databases to be used -(originally designed for organizing MP3s under directories such as -"Artists," "Song Keywords," etc... I have since applied it to a student -roster database very easily). The directory structure is stored in the -database itself and the module makes no assumptions about the database -structure beyond the table it requires to run. You can find it at: - -http://www.css.tayloru.edu/~elorimer/databasefs/index.php - - -Any feedback would be appreciated: comments, suggestions, patches, -etc... If nothing else, hopefully it might prove useful for someone -else who wishes to create a virtual filesystem. - -Thanks for the great product and keep up the good work. - - -- Eric Lorimer - ------------------------------------------------------------- -URL: http://www.openantivirus.org/ - -"samba-vscan is a proof-of-concept module for Samba, which -uses the VFS (virtual file system) features of Samba 2.2.x/3.0 -alphaX. Of couse, Samba has to be compiled with VFS support. -samba-vscan supports various virus scanners and is maintained -by Rainer Link". - ------------------------------------------------------------- - diff --git a/examples/VFS/README.netatalk b/examples/VFS/README.netatalk deleted file mode 100644 index 70f6eea316..0000000000 --- a/examples/VFS/README.netatalk +++ /dev/null @@ -1,18 +0,0 @@ -There is the new netatalk module both for HEAD. -This one has some difference from previous module: - --- it doesn't care about creating of .AppleDouble forks, just keeps ones in -sync; - --- if share in smb.conf doesn't contain .AppleDouble item in hide or veto -list, it will be added automatically. - -To my way of thinking, module became more lightweight and speedy. - -How to compile: - -you should place proper netatalk.c into examples/VFS/ then run 'configure' -from source/ and then run 'make' from examples/VFS/. - -add string 'vfs object = /netatlk.so' to smb.conf. It may -be defined either as global or as share-specific parameter. diff --git a/examples/VFS/audit.c b/examples/VFS/audit.c deleted file mode 100644 index 92b78c1c32..0000000000 --- a/examples/VFS/audit.c +++ /dev/null @@ -1,268 +0,0 @@ -/* - * Auditing VFS module for samba. Log selected file operations to syslog - * facility. - * - * Copyright (C) Tim Potter, 1999-2000 - * Copyright (C) Alexander Bokovoy, 2002 - * - * 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. - */ - -#include "config.h" -#include -#include -#ifdef HAVE_UTIME_H -#include -#endif -#ifdef HAVE_DIRENT_H -#include -#endif -#include -#ifdef HAVE_FCNTL_H -#include -#endif -#include -#include -#include -#include - -#ifndef SYSLOG_FACILITY -#define SYSLOG_FACILITY LOG_USER -#endif - -#ifndef SYSLOG_PRIORITY -#define SYSLOG_PRIORITY LOG_NOTICE -#endif - -/* Function prototypes */ - -static int audit_connect(struct connection_struct *conn, const char *svc, const char *user); -static void audit_disconnect(struct connection_struct *conn); -static DIR *audit_opendir(struct connection_struct *conn, const char *fname); -static int audit_mkdir(struct connection_struct *conn, const char *path, mode_t mode); -static int audit_rmdir(struct connection_struct *conn, const char *path); -static int audit_open(struct connection_struct *conn, const char *fname, int flags, mode_t mode); -static int audit_close(struct files_struct *fsp, int fd); -static int audit_rename(struct connection_struct *conn, const char *old, const char *new); -static int audit_unlink(struct connection_struct *conn, const char *path); -static int audit_chmod(struct connection_struct *conn, const char *path, mode_t mode); -static int audit_chmod_acl(struct connection_struct *conn, const char *name, mode_t mode); -static int audit_fchmod(struct files_struct *fsp, int fd, mode_t mode); -static int audit_fchmod_acl(struct files_struct *fsp, int fd, mode_t mode); - -/* VFS operations */ - -static struct vfs_ops default_vfs_ops; /* For passthrough operation */ -static struct smb_vfs_handle_struct *audit_handle; - -static vfs_op_tuple audit_ops[] = { - - /* Disk operations */ - - {audit_connect, SMB_VFS_OP_CONNECT, SMB_VFS_LAYER_LOGGER}, - {audit_disconnect, SMB_VFS_OP_DISCONNECT, SMB_VFS_LAYER_LOGGER}, - - /* Directory operations */ - - {audit_opendir, SMB_VFS_OP_OPENDIR, SMB_VFS_LAYER_LOGGER}, - {audit_mkdir, SMB_VFS_OP_MKDIR, SMB_VFS_LAYER_LOGGER}, - {audit_rmdir, SMB_VFS_OP_RMDIR, SMB_VFS_LAYER_LOGGER}, - - /* File operations */ - - {audit_open, SMB_VFS_OP_OPEN, SMB_VFS_LAYER_LOGGER}, - {audit_close, SMB_VFS_OP_CLOSE, SMB_VFS_LAYER_LOGGER}, - {audit_rename, SMB_VFS_OP_RENAME, SMB_VFS_LAYER_LOGGER}, - {audit_unlink, SMB_VFS_OP_UNLINK, SMB_VFS_LAYER_LOGGER}, - {audit_chmod, SMB_VFS_OP_CHMOD, SMB_VFS_LAYER_LOGGER}, - {audit_fchmod, SMB_VFS_OP_FCHMOD, SMB_VFS_LAYER_LOGGER}, - {audit_chmod_acl, SMB_VFS_OP_CHMOD_ACL, SMB_VFS_LAYER_LOGGER}, - {audit_fchmod_acl, SMB_VFS_OP_FCHMOD_ACL, SMB_VFS_LAYER_LOGGER}, - - /* Finish VFS operations definition */ - - {NULL, SMB_VFS_OP_NOOP, SMB_VFS_LAYER_NOOP} -}; - -/* VFS initialisation function. Return vfs_op_tuple array back to SAMBA. */ - -vfs_op_tuple *vfs_init(int *vfs_version, struct vfs_ops *def_vfs_ops, - struct smb_vfs_handle_struct *vfs_handle) -{ - *vfs_version = SMB_VFS_INTERFACE_VERSION; - memcpy(&default_vfs_ops, def_vfs_ops, sizeof(struct vfs_ops)); - - audit_handle = vfs_handle; - - openlog("smbd_audit", LOG_PID, SYSLOG_FACILITY); - syslog(SYSLOG_PRIORITY, "VFS_INIT: vfs_ops loaded\n"); - return audit_ops; -} - -/* VFS finalization function. */ -void vfs_done(connection_struct *conn) -{ - syslog(SYSLOG_PRIORITY, "VFS_DONE: vfs module unloaded\n"); -} - -/* Implementation of vfs_ops. Pass everything on to the default - operation but log event first. */ - -static int audit_connect(struct connection_struct *conn, const char *svc, const char *user) -{ - syslog(SYSLOG_PRIORITY, "connect to service %s by user %s\n", - svc, user); - - return default_vfs_ops.connect(conn, svc, user); -} - -static void audit_disconnect(struct connection_struct *conn) -{ - syslog(SYSLOG_PRIORITY, "disconnected\n"); - default_vfs_ops.disconnect(conn); -} - -static DIR *audit_opendir(struct connection_struct *conn, const char *fname) -{ - DIR *result = default_vfs_ops.opendir(conn, fname); - - syslog(SYSLOG_PRIORITY, "opendir %s %s%s\n", - fname, - (result == NULL) ? "failed: " : "", - (result == NULL) ? strerror(errno) : ""); - - return result; -} - -static int audit_mkdir(struct connection_struct *conn, const char *path, mode_t mode) -{ - int result = default_vfs_ops.mkdir(conn, path, mode); - - syslog(SYSLOG_PRIORITY, "mkdir %s %s%s\n", - path, - (result < 0) ? "failed: " : "", - (result < 0) ? strerror(errno) : ""); - - return result; -} - -static int audit_rmdir(struct connection_struct *conn, const char *path) -{ - int result = default_vfs_ops.rmdir(conn, path); - - syslog(SYSLOG_PRIORITY, "rmdir %s %s%s\n", - path, - (result < 0) ? "failed: " : "", - (result < 0) ? strerror(errno) : ""); - - return result; -} - -static int audit_open(struct connection_struct *conn, const char *fname, int flags, mode_t mode) -{ - int result = default_vfs_ops.open(conn, fname, flags, mode); - - syslog(SYSLOG_PRIORITY, "open %s (fd %d) %s%s%s\n", - fname, result, - ((flags & O_WRONLY) || (flags & O_RDWR)) ? "for writing " : "", - (result < 0) ? "failed: " : "", - (result < 0) ? strerror(errno) : ""); - - return result; -} - -static int audit_close(struct files_struct *fsp, int fd) -{ - int result = default_vfs_ops.close(fsp, fd); - - syslog(SYSLOG_PRIORITY, "close fd %d %s%s\n", - fd, - (result < 0) ? "failed: " : "", - (result < 0) ? strerror(errno) : ""); - - return result; -} - -static int audit_rename(struct connection_struct *conn, const char *old, const char *new) -{ - int result = default_vfs_ops.rename(conn, old, new); - - syslog(SYSLOG_PRIORITY, "rename %s -> %s %s%s\n", - old, new, - (result < 0) ? "failed: " : "", - (result < 0) ? strerror(errno) : ""); - - return result; -} - -static int audit_unlink(struct connection_struct *conn, const char *path) -{ - int result = default_vfs_ops.unlink(conn, path); - - syslog(SYSLOG_PRIORITY, "unlink %s %s%s\n", - path, - (result < 0) ? "failed: " : "", - (result < 0) ? strerror(errno) : ""); - - return result; -} - -static int audit_chmod(struct connection_struct *conn, const char *path, mode_t mode) -{ - int result = default_vfs_ops.chmod(conn, path, mode); - - syslog(SYSLOG_PRIORITY, "chmod %s mode 0x%x %s%s\n", - path, mode, - (result < 0) ? "failed: " : "", - (result < 0) ? strerror(errno) : ""); - - return result; -} - -static int audit_chmod_acl(struct connection_struct *conn, const char *path, mode_t mode) -{ - int result = default_vfs_ops.chmod_acl(conn, path, mode); - - syslog(SYSLOG_PRIORITY, "chmod_acl %s mode 0x%x %s%s\n", - path, mode, - (result < 0) ? "failed: " : "", - (result < 0) ? strerror(errno) : ""); - - return result; -} - -static int audit_fchmod(struct files_struct *fsp, int fd, mode_t mode) -{ - int result = default_vfs_ops.fchmod(fsp, fd, mode); - - syslog(SYSLOG_PRIORITY, "fchmod %s mode 0x%x %s%s\n", - fsp->fsp_name, mode, - (result < 0) ? "failed: " : "", - (result < 0) ? strerror(errno) : ""); - - return result; -} - -static int audit_fchmod_acl(struct files_struct *fsp, int fd, mode_t mode) -{ - int result = default_vfs_ops.fchmod_acl(fsp, fd, mode); - - syslog(SYSLOG_PRIORITY, "fchmod_acl %s mode 0x%x %s%s\n", - fsp->fsp_name, mode, - (result < 0) ? "failed: " : "", - (result < 0) ? strerror(errno) : ""); - - return result; -} diff --git a/examples/VFS/netatalk.c b/examples/VFS/netatalk.c deleted file mode 100644 index 353be36e6f..0000000000 --- a/examples/VFS/netatalk.c +++ /dev/null @@ -1,430 +0,0 @@ -/* - * AppleTalk VFS module for Samba-3.x - * - * Copyright (C) Alexei Kotovich, 2002 - * - * 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. - */ - -#include "config.h" -#include -#include -#ifdef HAVE_UTIME_H -#include -#endif -#ifdef HAVE_DIRENT_H -#include -#endif -#ifdef HAVE_FCNTL_H -#include -#endif -#include -#include -#include -#include - -#define APPLEDOUBLE ".AppleDouble" -#define ADOUBLEMODE 0777 - -/* atalk functions */ - -static int atalk_build_paths(TALLOC_CTX *ctx, const char *path, - const char *fname, char **adbl_path, char **orig_path, - SMB_STRUCT_STAT *adbl_info, SMB_STRUCT_STAT *orig_info); - -static int atalk_unlink_file(const char *path); - -static struct vfs_ops default_vfs_ops; /* For passthrough operation */ -static struct smb_vfs_handle_struct *atalk_handle; - -static int atalk_get_path_ptr(char *path) -{ - int i = 0; - int ptr = 0; - - for (i = 0; path[i]; i ++) { - if (path[i] == '/') - ptr = i; - /* get out some 'spam';) from win32's file name */ - else if (path[i] == ':') { - path[i] = '\0'; - break; - } - } - - return ptr; -} - -static int atalk_build_paths(TALLOC_CTX *ctx, const char *path, const char *fname, - char **adbl_path, char **orig_path, - SMB_STRUCT_STAT *adbl_info, SMB_STRUCT_STAT *orig_info) -{ - int ptr0 = 0; - int ptr1 = 0; - char *dname = 0; - char *name = 0; - - if (!ctx || !path || !fname || !adbl_path || !orig_path || - !adbl_info || !orig_info) - return -1; -#if 0 - DEBUG(3, ("ATALK: PATH: %s[%s]\n", path, fname)); -#endif - if (strstr(path, APPLEDOUBLE) || strstr(fname, APPLEDOUBLE)) { - DEBUG(3, ("ATALK: path %s[%s] already contains %s\n", path, fname, APPLEDOUBLE)); - return -1; - } - - if (fname[0] == '.') ptr0 ++; - if (fname[1] == '/') ptr0 ++; - - *orig_path = talloc_asprintf(ctx, "%s/%s", path, &fname[ptr0]); - - /* get pointer to last '/' */ - ptr1 = atalk_get_path_ptr(*orig_path); - - sys_lstat(*orig_path, orig_info); - - if (S_ISDIR(orig_info->st_mode)) { - *adbl_path = talloc_asprintf(ctx, "%s/%s/%s/", - path, &fname[ptr0], APPLEDOUBLE); - } else { - dname = talloc_strdup(ctx, *orig_path); - dname[ptr1] = '\0'; - name = *orig_path; - *adbl_path = talloc_asprintf(ctx, "%s/%s/%s", - dname, APPLEDOUBLE, &name[ptr1 + 1]); - } -#if 0 - DEBUG(3, ("ATALK: DEBUG:\n%s\n%s\n", *orig_path, *adbl_path)); -#endif - sys_lstat(*adbl_path, adbl_info); - return 0; -} - -static int atalk_unlink_file(const char *path) -{ - int ret = 0; - - become_root(); - ret = unlink(path); - unbecome_root(); - - return ret; -} - -static void atalk_add_to_list(name_compare_entry **list) -{ - int i, count = 0; - name_compare_entry *new_list = 0; - name_compare_entry *cur_list = 0; - - cur_list = *list; - - if (cur_list) { - for (i = 0, count = 0; cur_list[i].name; i ++, count ++) { - if (strstr(cur_list[i].name, APPLEDOUBLE)) - return; - } - } - - if (!(new_list = calloc(1, - (count == 0 ? 1 : count + 1) * sizeof(name_compare_entry)))) - return; - - for (i = 0; i < count; i ++) { - new_list[i].name = strdup(cur_list[i].name); - new_list[i].is_wild = cur_list[i].is_wild; - } - - new_list[i].name = strdup(APPLEDOUBLE); - new_list[i].is_wild = False; - - free_namearray(*list); - - *list = new_list; - new_list = 0; - cur_list = 0; -} - -static void atalk_rrmdir(TALLOC_CTX *ctx, char *path) -{ - int n; - char *dpath; - struct dirent **namelist; - - if (!path) return; - - n = scandir(path, &namelist, 0, alphasort); - if (n < 0) { - return; - } else { - while (n --) { - if (strcmp(namelist[n]->d_name, ".") == 0 || - strcmp(namelist[n]->d_name, "..") == 0) - continue; - if (!(dpath = talloc_asprintf(ctx, "%s/%s", - path, namelist[n]->d_name))) - continue; - atalk_unlink_file(dpath); - free(namelist[n]); - } - } -} - -/* Disk operations */ - -/* Directory operations */ - -DIR *atalk_opendir(struct connection_struct *conn, const char *fname) -{ - DIR *ret = 0; - - ret = default_vfs_ops.opendir(conn, fname); - - /* - * when we try to perform delete operation upon file which has fork - * in ./.AppleDouble and this directory wasn't hidden by Samba, - * MS Windows explorer causes the error: "Cannot find the specified file" - * There is some workaround to avoid this situation, i.e. if - * connection has not .AppleDouble entry in either veto or hide - * list then it would be nice to add one. - */ - - atalk_add_to_list(&conn->hide_list); - atalk_add_to_list(&conn->veto_list); - - return ret; -} - -static int atalk_rmdir(struct connection_struct *conn, const char *path) -{ - BOOL add = False; - TALLOC_CTX *ctx = 0; - char *dpath; - - if (!conn || !conn->origpath || !path) goto exit_rmdir; - - /* due to there is no way to change bDeleteVetoFiles variable - * from this module, gotta use talloc stuff.. - */ - - strstr(path, APPLEDOUBLE) ? (add = False) : (add = True); - - if (!(ctx = talloc_init_named("remove_directory"))) - goto exit_rmdir; - - if (!(dpath = talloc_asprintf(ctx, "%s/%s%s", - conn->origpath, path, add ? "/"APPLEDOUBLE : ""))) - goto exit_rmdir; - - atalk_rrmdir(ctx, dpath); - -exit_rmdir: - talloc_destroy(ctx); - return default_vfs_ops.rmdir(conn, path); -} - -/* File operations */ - -static int atalk_rename(struct connection_struct *conn, const char *old, const char *new) -{ - int ret = 0; - char *adbl_path = 0; - char *orig_path = 0; - SMB_STRUCT_STAT adbl_info; - SMB_STRUCT_STAT orig_info; - TALLOC_CTX *ctx; - - ret = default_vfs_ops.rename(conn, old, new); - - if (!conn || !old) return ret; - - if (!(ctx = talloc_init_named("rename_file"))) - return ret; - - if (atalk_build_paths(ctx, conn->origpath, old, &adbl_path, &orig_path, - &adbl_info, &orig_info) != 0) - return ret; - - if (S_ISDIR(orig_info.st_mode) || S_ISREG(orig_info.st_mode)) { - DEBUG(3, ("ATALK: %s has passed..\n", adbl_path)); - goto exit_rename; - } - - atalk_unlink_file(adbl_path); - -exit_rename: - talloc_destroy(ctx); - return ret; -} - -static int atalk_unlink(struct connection_struct *conn, const char *path) -{ - int ret = 0, i; - char *adbl_path = 0; - char *orig_path = 0; - SMB_STRUCT_STAT adbl_info; - SMB_STRUCT_STAT orig_info; - TALLOC_CTX *ctx; - - ret = default_vfs_ops.unlink(conn, path); - - if (!conn || !path) return ret; - - /* no .AppleDouble sync if veto or hide list is empty, - * otherwise "Cannot find the specified file" error will be caused - */ - - if (!conn->veto_list) return ret; - if (!conn->hide_list) return ret; - - for (i = 0; conn->veto_list[i].name; i ++) { - if (strstr(conn->veto_list[i].name, APPLEDOUBLE)) - break; - } - - if (!conn->veto_list[i].name) { - for (i = 0; conn->hide_list[i].name; i ++) { - if (strstr(conn->hide_list[i].name, APPLEDOUBLE)) - break; - else { - DEBUG(3, ("ATALK: %s is not hidden, skipped..\n", - APPLEDOUBLE)); - return ret; - } - } - } - - if (!(ctx = talloc_init_named("unlink_file"))) - return ret; - - if (atalk_build_paths(ctx, conn->origpath, path, &adbl_path, &orig_path, - &adbl_info, &orig_info) != 0) - return ret; - - if (S_ISDIR(orig_info.st_mode) || S_ISREG(orig_info.st_mode)) { - DEBUG(3, ("ATALK: %s has passed..\n", adbl_path)); - goto exit_unlink; - } - - atalk_unlink_file(adbl_path); - -exit_unlink: - talloc_destroy(ctx); - return ret; -} - -static int atalk_chmod(struct connection_struct *conn, const char *path, mode_t mode) -{ - int ret = 0; - char *adbl_path = 0; - char *orig_path = 0; - SMB_STRUCT_STAT adbl_info; - SMB_STRUCT_STAT orig_info; - TALLOC_CTX *ctx; - - ret = default_vfs_ops.chmod(conn, path, mode); - - if (!conn || !path) return ret; - - if (!(ctx = talloc_init_named("chmod_file"))) - return ret; - - if (atalk_build_paths(ctx, conn->origpath, path, &adbl_path, &orig_path, - &adbl_info, &orig_info) != 0) - return ret; - - if (!S_ISDIR(orig_info.st_mode) && !S_ISREG(orig_info.st_mode)) { - DEBUG(3, ("ATALK: %s has passed..\n", orig_path)); - goto exit_chmod; - } - - chmod(adbl_path, ADOUBLEMODE); - -exit_chmod: - talloc_destroy(ctx); - return ret; -} - -static int atalk_chown(struct connection_struct *conn, const char *path, uid_t uid, gid_t gid) -{ - int ret = 0; - char *adbl_path = 0; - char *orig_path = 0; - SMB_STRUCT_STAT adbl_info; - SMB_STRUCT_STAT orig_info; - TALLOC_CTX *ctx; - - ret = default_vfs_ops.chown(conn, path, uid, gid); - - if (!conn || !path) return ret; - - if (!(ctx = talloc_init_named("chown_file"))) - return ret; - - if (atalk_build_paths(ctx, conn->origpath, path, &adbl_path, &orig_path, - &adbl_info, &orig_info) != 0) - return ret; - - if (!S_ISDIR(orig_info.st_mode) && !S_ISREG(orig_info.st_mode)) { - DEBUG(3, ("ATALK: %s has passed..\n", orig_path)); - goto exit_chown; - } - - chown(adbl_path, uid, gid); - -exit_chown: - talloc_destroy(ctx); - return ret; -} - -static vfs_op_tuple atalk_ops[] = { - - /* Directory operations */ - - {atalk_opendir, SMB_VFS_OP_OPENDIR, SMB_VFS_LAYER_TRANSPARENT}, - {atalk_rmdir, SMB_VFS_OP_RMDIR, SMB_VFS_LAYER_TRANSPARENT}, - - /* File operations */ - - {atalk_rename, SMB_VFS_OP_RENAME, SMB_VFS_LAYER_TRANSPARENT}, - {atalk_unlink, SMB_VFS_OP_UNLINK, SMB_VFS_LAYER_TRANSPARENT}, - {atalk_chmod, SMB_VFS_OP_CHMOD, SMB_VFS_LAYER_TRANSPARENT}, - {atalk_chown, SMB_VFS_OP_CHOWN, SMB_VFS_LAYER_TRANSPARENT}, - - /* Finish VFS operations definition */ - - {NULL, SMB_VFS_OP_NOOP, SMB_VFS_LAYER_NOOP} -}; - -/* VFS initialisation function. Return vfs_op_tuple array back to SAMBA. */ -vfs_op_tuple *vfs_init(int *vfs_version, struct vfs_ops *def_vfs_ops, - struct smb_vfs_handle_struct *vfs_handle) -{ - *vfs_version = SMB_VFS_INTERFACE_VERSION; - memcpy(&default_vfs_ops, def_vfs_ops, sizeof(struct vfs_ops)); - - atalk_handle = vfs_handle; - - DEBUG(3, ("ATALK: vfs module loaded\n")); - return atalk_ops; -} - -/* VFS finalization function. */ -void vfs_done(connection_struct *conn) -{ - DEBUG(3, ("ATALK: vfs module unloaded\n")); -} diff --git a/examples/VFS/recycle.c b/examples/VFS/recycle.c deleted file mode 100644 index b59cb92a28..0000000000 --- a/examples/VFS/recycle.c +++ /dev/null @@ -1,559 +0,0 @@ -/* - * Recycle bin VFS module for Samba. - * - * Copyright (C) 2001, Brandon Stone, Amherst College, . - * Copyright (C) 2002, Jeremy Allison - modified to make a VFS module. - * Copyright (C) 2002, Alexander Bokovoy - cascaded VFS adoption, - * Copyright (C) 2002, Juergen Hasch - added some options. - * Copyright (C) 2002, Simo Sorce - * - * 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. - */ - -#include "includes.h" - -#define ALLOC_CHECK(ptr, label) do { if ((ptr) == NULL) { DEBUG(0, ("recycle.bin: out of memory!\n")); errno = ENOMEM; goto label; } } while(0) - -static int vfs_recycle_debug_level = DBGC_VFS; - -#undef DBGC_CLASS -#define DBGC_CLASS vfs_recycle_debug_level - -static const char *delimiter = "|"; /* delimiter for options */ - -/* One per connection */ - -typedef struct recycle_bin_struct -{ - TALLOC_CTX *ctx; - char *repository; /* name of the recycle bin directory */ - BOOL keep_dir_tree; /* keep directory structure of deleted file in recycle bin */ - BOOL versions; /* create versions of deleted files with identical name */ - BOOL touch; /* touch access date of deleted file */ - char *exclude; /* which files to exclude */ - char *exclude_dir; /* which directories to exclude */ - char *noversions; /* which files to exclude from versioning */ - SMB_OFF_T maxsize; /* maximum file size to be saved */ -} recycle_bin_struct; - -/* VFS operations */ -static struct vfs_ops default_vfs_ops; /* For passthrough operation */ - -static int recycle_connect(struct connection_struct *conn, const char *service, const char *user); -static void recycle_disconnect(struct connection_struct *conn); -static int recycle_unlink(connection_struct *, const char *); - -#define VFS_OP(x) ((void *) x) - -static vfs_op_tuple recycle_ops[] = { - - /* Disk operations */ - {VFS_OP(recycle_connect), SMB_VFS_OP_CONNECT, SMB_VFS_LAYER_TRANSPARENT}, - {VFS_OP(recycle_disconnect), SMB_VFS_OP_DISCONNECT, SMB_VFS_LAYER_TRANSPARENT}, - - /* File operations */ - {VFS_OP(recycle_unlink), SMB_VFS_OP_UNLINK, SMB_VFS_LAYER_TRANSPARENT}, - - {NULL, SMB_VFS_OP_NOOP, SMB_VFS_LAYER_NOOP} -}; - -static BOOL check_bool_param(const char *value) -{ - if (strwicmp(value, "yes") == 0 || - strwicmp(value, "true") == 0 || - strwicmp(value, "1") == 0) - return True; - - return False; -} - -/** - * VFS initialisation function. - * - * @retval initialised vfs_op_tuple array - **/ -vfs_op_tuple *vfs_init(int *vfs_version, struct vfs_ops *def_vfs_ops, - struct smb_vfs_handle_struct *vfs_handle) -{ - DEBUG(10, ("Initializing VFS module recycle\n")); - *vfs_version = SMB_VFS_INTERFACE_VERSION; - memcpy(&default_vfs_ops, def_vfs_ops, sizeof(struct vfs_ops)); - vfs_recycle_debug_level = debug_add_class("vfs_recycle_bin"); - if (vfs_recycle_debug_level == -1) { - vfs_recycle_debug_level = DBGC_VFS; - DEBUG(0, ("vfs_recycle: Couldn't register custom debugging class!\n")); - } else { - DEBUG(0, ("vfs_recycle: Debug class number of 'vfs_recycle': %d\n", vfs_recycle_debug_level)); - } - - return recycle_ops; -} - -/** - * VFS finalization function. - * - **/ -void vfs_done(connection_struct *conn) -{ - DEBUG(10,("Called for connection %d\n", SNUM(conn))); -} - -static int recycle_connect(struct connection_struct *conn, const char *service, const char *user) -{ - TALLOC_CTX *ctx = NULL; - recycle_bin_struct *recbin; - char *servicename; - char *tmp_str; - - DEBUG(10, ("Called for service %s (%d) as user %s\n", service, SNUM(conn), user)); - - if (!(ctx = talloc_init_named("recycle bin"))) { - DEBUG(0, ("Failed to allocate memory in VFS module recycle_bin\n")); - return 0; - } - - recbin = talloc(ctx,sizeof(recycle_bin_struct)); - if ( recbin == NULL) { - DEBUG(0, ("Failed to allocate memory in VFS module recycle_bin\n")); - return -1; - } - recbin->ctx = ctx; - - /* Set defaults */ - recbin->repository = talloc_strdup(ctx, ".recycle"); - ALLOC_CHECK(recbin->repository, error); - recbin->keep_dir_tree = False; - recbin->versions = False; - recbin->touch = False; - recbin->exclude = ""; - recbin->exclude_dir = ""; - recbin->noversions = ""; - recbin->maxsize = 0; - - /* parse configuration options */ - servicename = talloc_strdup(recbin->ctx, lp_servicename(SNUM(conn))); - DEBUG(10, ("servicename = %s\n",servicename)); - if ((tmp_str = lp_parm_string(servicename, "vfs_recycle_bin", "repository")) != NULL) { - recbin->repository = talloc_sub_conn(ctx, conn, tmp_str); - ALLOC_CHECK(recbin->repository, error); - trim_string(recbin->repository, "/", "/"); - DEBUG(5, ("recycle.bin: repository = %s\n", recbin->repository)); - } - if ((tmp_str = lp_parm_string(servicename, "vfs_recycle_bin", "keeptree")) != NULL) { - if (check_bool_param(tmp_str) == True) - recbin->keep_dir_tree = True; - DEBUG(5, ("recycle.bin: keeptree = %s\n", tmp_str)); - } - if ((tmp_str = lp_parm_string(servicename, "vfs_recycle_bin", "versions")) != NULL) { - if (check_bool_param(tmp_str) == True) - recbin->versions = True; - DEBUG(5, ("recycle.bin: versions = %s\n", tmp_str)); - } - if ((tmp_str = lp_parm_string(servicename, "vfs_recycle_bin", "touch")) != NULL) { - if (check_bool_param(tmp_str) == True) - recbin->touch = True; - DEBUG(5, ("recycle.bin: touch = %s\n", tmp_str)); - } - if ((tmp_str = lp_parm_string(servicename, "vfs_recycle_bin", "maxsize")) != NULL) { - recbin->maxsize = strtoul(tmp_str, NULL, 10); - if (recbin->maxsize == 0) { - recbin->maxsize = -1; - DEBUG(5, ("recycle.bin: maxsize = -infinite-\n")); - } else { - DEBUG(5, ("recycle.bin: maxsize = %ld\n", (long int)recbin->maxsize)); - } - } - if ((tmp_str = lp_parm_string(servicename, "vfs_recycle_bin", "exclude")) != NULL) { - recbin->exclude = talloc_strdup(ctx, tmp_str); - ALLOC_CHECK(recbin->exclude, error); - DEBUG(5, ("recycle.bin: exclude = %s\n", recbin->exclude)); - } - if ((tmp_str = lp_parm_string(servicename,"vfs_recycle_bin", "exclude_dir")) != NULL) { - recbin->exclude_dir = talloc_strdup(ctx, tmp_str); - ALLOC_CHECK(recbin->exclude_dir, error); - DEBUG(5, ("recycle.bin: exclude_dir = %s\n", recbin->exclude_dir)); - } - if ((tmp_str = lp_parm_string(servicename,"vfs_recycle_bin", "noversions")) != NULL) { - recbin->noversions = talloc_strdup(ctx, tmp_str); - ALLOC_CHECK(recbin->noversions, error); - DEBUG(5, ("recycle.bin: noversions = %s\n", recbin->noversions)); - } - - conn->vfs_private = (void *)recbin; - return default_vfs_ops.connect(conn, service, user); - -error: - talloc_destroy(ctx); - return -1; -} - -static void recycle_disconnect(struct connection_struct *conn) -{ - DEBUG(10, ("Disconnecting VFS module recycle bin\n")); - if (conn->vfs_private) { - talloc_destroy(((recycle_bin_struct *)conn->vfs_private)->ctx); - conn->vfs_private = NULL; - } - default_vfs_ops.disconnect(conn); -} - -static BOOL recycle_directory_exist(connection_struct *conn, const char *dname) -{ - SMB_STRUCT_STAT st; - - if (default_vfs_ops.stat(conn, dname, &st) == 0) { - if (S_ISDIR(st.st_mode)) { - return True; - } - } - - return False; -} - -static BOOL recycle_file_exist(connection_struct *conn, const char *fname) -{ - SMB_STRUCT_STAT st; - - if (default_vfs_ops.stat(conn, fname, &st) == 0) { - if (S_ISREG(st.st_mode)) { - return True; - } - } - - return False; -} - -/** - * Return file size - * @param conn connection - * @param fname file name - * @return size in bytes - **/ -static SMB_OFF_T recycle_get_file_size(connection_struct *conn, const char *fname) -{ - SMB_STRUCT_STAT st; - if (default_vfs_ops.stat(conn, fname, &st) != 0) { - DEBUG(0,("recycle.bin: stat for %s returned %s\n", fname, strerror(errno))); - return (SMB_OFF_T)0; - } - return(st.st_size); -} - -/** - * Create directory tree - * @param conn connection - * @param dname Directory tree to be created - * @return Returns True for success - **/ -static BOOL recycle_create_dir(connection_struct *conn, const char *dname) -{ - int len; - mode_t mode; - char *new_dir = NULL; - char *tmp_str = NULL; - char *token; - char *tok_str; - BOOL ret = False; - - mode = S_IREAD | S_IWRITE | S_IEXEC; - - tmp_str = strdup(dname); - ALLOC_CHECK(tmp_str, done); - tok_str = tmp_str; - - len = strlen(dname); - new_dir = (char *)malloc(len + 1); - ALLOC_CHECK(new_dir, done); - *new_dir = '\0'; - - /* Create directory tree if neccessary */ - for(token = strtok(tok_str, "/"); token; token = strtok(NULL, "/")) { - safe_strcat(new_dir, token, len); - if (recycle_directory_exist(conn, new_dir)) - DEBUG(10, ("recycle.bin: dir %s already exists\n", new_dir)); - else { - DEBUG(5, ("recycle.bin: creating new dir %s\n", new_dir)); - if (default_vfs_ops.mkdir(conn, new_dir, mode) != 0) { - DEBUG(1,("recycle.bin: mkdir failed for %s with error: %s\n", new_dir, strerror(errno))); - ret = False; - goto done; - } - } - safe_strcat(new_dir, "/", len); - } - - ret = True; -done: - SAFE_FREE(tmp_str); - SAFE_FREE(new_dir); - return ret; -} - -/** - * Check if needle is contained exactly in haystack - * @param haystack list of parameters separated by delimimiter character - * @param needle string to be matched exactly to haystack - * @return True if found - **/ -static BOOL checkparam(const char *haystack, const char *needle) -{ - char *token; - char *tok_str; - char *tmp_str; - BOOL ret = False; - - if (haystack == NULL || strlen(haystack) == 0 || needle == NULL || strlen(needle) == 0) { - return False; - } - - tmp_str = strdup(haystack); - ALLOC_CHECK(tmp_str, done); - token = tok_str = tmp_str; - - for(token = strtok(tok_str, delimiter); token; token = strtok(NULL, delimiter)) { - if(strcmp(token, needle) == 0) { - ret = True; - goto done; - } - } -done: - SAFE_FREE(tmp_str); - return ret; -} - -/** - * Check if needle is contained in haystack, * and ? patterns are resolved - * @param haystack list of parameters separated by delimimiter character - * @param needle string to be matched exectly to haystack including pattern matching - * @return True if found - **/ -static BOOL matchparam(const char *haystack, const char *needle) -{ - char *token; - char *tok_str; - char *tmp_str; - BOOL ret = False; - - if (haystack == NULL || strlen(haystack) == 0 || needle == NULL || strlen(needle) == 0) { - return False; - } - - tmp_str = strdup(haystack); - ALLOC_CHECK(tmp_str, done); - token = tok_str = tmp_str; - - for(token = strtok(tok_str, delimiter); token; token = strtok(NULL, delimiter)) { - if (!unix_wild_match(token, needle)) { - ret = True; - goto done; - } - } -done: - SAFE_FREE(tmp_str); - return ret; -} - -/** - * Touch access date - **/ -static void recycle_touch(connection_struct *conn, const char *fname) -{ - SMB_STRUCT_STAT st; - struct utimbuf tb; - time_t currtime; - - if (default_vfs_ops.stat(conn, fname, &st) != 0) { - DEBUG(0,("recycle.bin: stat for %s returned %s\n", fname, strerror(errno))); - return; - } - currtime = time(&currtime); - tb.actime = currtime; - tb.modtime = st.st_mtime; - - if (default_vfs_ops.utime(conn, fname, &tb) == -1 ) - DEBUG(0, ("recycle.bin: touching %s failed, reason = %s\n", fname, strerror(errno))); - } - -/** - * Check if file should be recycled - **/ -static int recycle_unlink(connection_struct *conn, const char *inname) -{ - recycle_bin_struct *recbin; - char *file_name = NULL; - char *path_name = NULL; - char *temp_name = NULL; - char *final_name = NULL; - char *base; - int i; - SMB_BIG_UINT dfree, dsize, bsize; - SMB_OFF_T file_size, space_avail; - BOOL exist; - int rc = -1; - - file_name = strdup(inname); - ALLOC_CHECK(file_name, done); - - if (conn->vfs_private) - recbin = (recycle_bin_struct *)conn->vfs_private; - else { - DEBUG(0, ("Recycle bin not initialized!\n")); - rc = default_vfs_ops.unlink(conn, file_name); - goto done; - } - - if(!recbin->repository || *(recbin->repository) == '\0') { - DEBUG(3, ("Recycle path not set, purging %s...\n", file_name)); - rc = default_vfs_ops.unlink(conn, file_name); - goto done; - } - - /* we don't recycle the recycle bin... */ - if (strncmp(file_name, recbin->repository, strlen(recbin->repository)) == 0) { - DEBUG(3, ("File is within recycling bin, unlinking ...\n")); - rc = default_vfs_ops.unlink(conn, file_name); - goto done; - } - - file_size = recycle_get_file_size(conn, file_name); - /* it is wrong to purge filenames only because they are empty imho - * --- simo - * - if(fsize == 0) { - DEBUG(3, ("File %s is empty, purging...\n", file_name)); - rc = default_vfs_ops.unlink(conn,file_name); - goto done; - } - */ - - /* FIXME: this is wrong, we should check the hole size of the recycle bin is - * not greater then maxsize, not the size of the single file, also it is better - * to remove older files - */ - if(recbin->maxsize > 0 && file_size > recbin->maxsize) { - DEBUG(3, ("File %s exceeds maximum recycle size, purging... \n", file_name)); - rc = default_vfs_ops.unlink(conn, file_name); - goto done; - } - - /* FIXME: this is wrong: moving files with rename does not change the disk space - * allocation - * - space_avail = default_vfs_ops.disk_free(conn, ".", True, &bsize, &dfree, &dsize) * 1024L; - DEBUG(5, ("space_avail = %Lu, file_size = %Lu\n", space_avail, file_size)); - if(space_avail < file_size) { - DEBUG(3, ("Not enough diskspace, purging file %s\n", file_name)); - rc = default_vfs_ops.unlink(conn, file_name); - goto done; - } - */ - - /* extract filename and path */ - path_name = (char *)malloc(PATH_MAX); - ALLOC_CHECK(path_name, done); - *path_name = '\0'; - safe_strcpy(path_name, file_name, PATH_MAX); - base = strrchr(path_name, '/'); - if (base == NULL) { - base = file_name; - safe_strcpy(path_name, "/", PATH_MAX); - } - else { - *base = '\0'; - base++; - } - - DEBUG(10, ("recycle.bin: fname = %s\n", file_name)); /* original filename with path */ - DEBUG(10, ("recycle.bin: fpath = %s\n", path_name)); /* original path */ - DEBUG(10, ("recycle.bin: base = %s\n", base)); /* filename without path */ - - if (matchparam(recbin->exclude, base)) { - DEBUG(3, ("recycle.bin: file %s is excluded \n", base)); - rc = default_vfs_ops.unlink(conn, file_name); - goto done; - } - - /* FIXME: this check will fail if we have more than one level of directories, - * we shoud check for every level 1, 1/2, 1/2/3, 1/2/3/4 .... - * ---simo - */ - if (checkparam(recbin->exclude_dir, path_name)) { - DEBUG(3, ("recycle.bin: directory %s is excluded \n", path_name)); - rc = default_vfs_ops.unlink(conn, file_name); - goto done; - } - - temp_name = (char *)malloc(PATH_MAX); - ALLOC_CHECK(temp_name, done); - safe_strcpy(temp_name, recbin->repository, PATH_MAX); - - /* see if we need to recreate the original directory structure in the recycle bin */ - if (recbin->keep_dir_tree == True) { - safe_strcat(temp_name, "/", PATH_MAX); - safe_strcat(temp_name, path_name, PATH_MAX); - } - - exist = recycle_directory_exist(conn, temp_name); - if (exist) { - DEBUG(10, ("recycle.bin: Directory already exists\n")); - } else { - DEBUG(10, ("recycle.bin: Creating directory %s\n", temp_name)); - if (recycle_create_dir(conn, temp_name) == False) { - DEBUG(3, ("Could not create directory, purging %s...\n", file_name)); - rc = default_vfs_ops.unlink(conn, file_name); - goto done; - } - } - - final_name = (char *)malloc(PATH_MAX); - ALLOC_CHECK(final_name, done); - snprintf(final_name, PATH_MAX, "%s/%s", temp_name, base); - DEBUG(10, ("recycle.bin: recycled file name%s\n", temp_name)); /* new filename with path */ - - /* check if we should delete file from recycle bin */ - if (recycle_file_exist(conn, final_name)) { - if (recbin->versions == False || matchparam(recbin->noversions, base) == True) { - DEBUG(3, ("recycle.bin: Removing old file %s from recycle bin\n", final_name)); - if (default_vfs_ops.unlink(conn, final_name) != 0) { - DEBUG(1, ("recycle.bin: Error deleting old file: %s\n", strerror(errno))); - } - } - } - - /* rename file we move to recycle bin */ - i = 1; - while (recycle_file_exist(conn, final_name)) { - snprintf(final_name, PATH_MAX, "%s/Copy #%d of %s", temp_name, i++, base); - } - - DEBUG(10, ("recycle.bin: Moving %s to %s\n", file_name, final_name)); - rc = default_vfs_ops.rename(conn, file_name, final_name); - if (rc != 0) { - DEBUG(3, ("recycle.bin: Move error %d (%s), purging file %s (%s)\n", errno, strerror(errno), file_name, final_name)); - rc = default_vfs_ops.unlink(conn, file_name); - goto done; - } - - /* touch access date of moved file */ - if (recbin->touch == True ) - recycle_touch(conn, final_name); - -done: - SAFE_FREE(file_name); - SAFE_FREE(path_name); - SAFE_FREE(temp_name); - SAFE_FREE(final_name); - return rc; -} -- cgit From 9eeab10e54e9e94082ced649b33ee45b4f59f858 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Wed, 15 Jan 2003 16:10:57 +0000 Subject: [merge] * removed unused variable from rpcclient code * added container option to net command (patch from SuSE) * Makefile patch for examples/VFS from SuSE (This used to be commit 25a9681ddda47a41fac8fdc97ca50b7f4c579eaf) --- examples/VFS/Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'examples/VFS') diff --git a/examples/VFS/Makefile.in b/examples/VFS/Makefile.in index 46e1a90263..30019caccd 100644 --- a/examples/VFS/Makefile.in +++ b/examples/VFS/Makefile.in @@ -3,7 +3,7 @@ CFLAGS = @CFLAGS@ CPPFLAGS = @CPPFLAGS@ LDFLAGS = @LDFLAGS@ LDSHFLAGS = -shared -srcdir = @builddir@ +srcdir = ../../source/ FLAGS = $(CFLAGS) -Iinclude -I$(srcdir)/include -I$(srcdir)/ubiqx -I$(srcdir)/smbwrapper -I. $(CPPFLAGS) -I$(srcdir) # Auto target -- cgit From 210cb79d29fcf8e01b538b6af4dee430f9032882 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Wed, 22 Jan 2003 23:49:54 +0000 Subject: Minor merges from HEAD. (This used to be commit 902a1dc1d5f74ce94496d03327c07416bc2061be) --- examples/VFS/.cvsignore | 2 ++ 1 file changed, 2 insertions(+) (limited to 'examples/VFS') diff --git a/examples/VFS/.cvsignore b/examples/VFS/.cvsignore index 0b0923a496..92b494f978 100644 --- a/examples/VFS/.cvsignore +++ b/examples/VFS/.cvsignore @@ -1,2 +1,4 @@ .libs *.so +*.o +Makefile -- cgit From ff09ef629a8f5c24c85a45d54c0fe32c2b1dc055 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 28 Apr 2003 00:52:02 +0000 Subject: Update for the new modules system. Also, use Makefile rather then Makefile.in because we don't generate Makefile from configure anymore (This used to be commit 0d322968cbf445df79153c0abc0d041edcf223ee) --- examples/VFS/Makefile | 23 +++++++++++++++++++++++ examples/VFS/Makefile.in | 24 ------------------------ examples/VFS/skel.c | 8 +++----- 3 files changed, 26 insertions(+), 29 deletions(-) create mode 100644 examples/VFS/Makefile delete mode 100644 examples/VFS/Makefile.in (limited to 'examples/VFS') diff --git a/examples/VFS/Makefile b/examples/VFS/Makefile new file mode 100644 index 0000000000..ac5a93b49b --- /dev/null +++ b/examples/VFS/Makefile @@ -0,0 +1,23 @@ +CFLAGS = +CPPFLAGS = +LDFLAGS = +LDSHFLAGS = -shared +srcdir = ../../source/ +FLAGS = $(CFLAGS) -Iinclude -I$(srcdir)/include -I$(srcdir)/ubiqx -I$(srcdir)/smbwrapper -I. $(CPPFLAGS) -I$(srcdir) + +# Auto target +default: $(patsubst %.c,%.so,$(wildcard *.c)) + +# Pattern rules + +%.so: %.o + $(CC) $(LDSHFLAGS) $(LDFLAGS) -o $@ $< + +%.o: %.c + $(CC) $(FLAGS) -c $< + +# Misc targets + +clean: + rm -rf .libs + rm -f core *~ *% *.bak *.o *.so diff --git a/examples/VFS/Makefile.in b/examples/VFS/Makefile.in deleted file mode 100644 index 30019caccd..0000000000 --- a/examples/VFS/Makefile.in +++ /dev/null @@ -1,24 +0,0 @@ -CC = @CC@ -CFLAGS = @CFLAGS@ -CPPFLAGS = @CPPFLAGS@ -LDFLAGS = @LDFLAGS@ -LDSHFLAGS = -shared -srcdir = ../../source/ -FLAGS = $(CFLAGS) -Iinclude -I$(srcdir)/include -I$(srcdir)/ubiqx -I$(srcdir)/smbwrapper -I. $(CPPFLAGS) -I$(srcdir) - -# Auto target -default: $(patsubst %.c,%.so,$(wildcard *.c)) - -# Pattern rules - -%.so: %.o - $(CC) $(LDSHFLAGS) $(LDFLAGS) -o $@ $< - -%.o: %.c - $(CC) $(FLAGS) -c $< - -# Misc targets - -clean: - rm -rf .libs - rm -f core *~ *% *.bak *.o *.so diff --git a/examples/VFS/skel.c b/examples/VFS/skel.c index b937682822..f19323480f 100644 --- a/examples/VFS/skel.c +++ b/examples/VFS/skel.c @@ -437,12 +437,11 @@ static vfs_op_tuple skel_ops[] = { /* VFS initialisation - return initialized vfs_op_tuple array back to Samba */ -vfs_op_tuple *vfs_init(int *vfs_version, struct vfs_ops *def_vfs_ops, +static vfs_op_tuple *skel_init(const struct vfs_ops *def_vfs_ops, struct smb_vfs_handle_struct *vfs_handle) { DEBUG(3, ("Initialising default vfs hooks\n")); - *vfs_version = SMB_VFS_INTERFACE_VERSION; memcpy(&default_vfs_ops, def_vfs_ops, sizeof(struct vfs_ops)); /* Remember vfs_handle for further allocation and referencing of private @@ -452,8 +451,7 @@ vfs_op_tuple *vfs_init(int *vfs_version, struct vfs_ops *def_vfs_ops, return skel_ops; } -/* VFS finalization function */ -void vfs_done(connection_struct *conn) +int init_module(void) { - DEBUG(3, ("Finalizing default vfs hooks\n")); + return smb_register_vfs("skel", skel_init, SMB_VFS_INTERFACE_VERSION); } -- cgit From 17a3acafa89bfc6090b0767d05a00a7505003fcc Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 28 Apr 2003 17:48:48 +0000 Subject: Use NTSTATUS as return value for smb_register_*() functions and init_module() function. Patch by metze with some minor modifications. (This used to be commit bc4b51bcb2daa7271c884cb83bf8bdba6d3a9b6d) --- examples/VFS/skel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'examples/VFS') diff --git a/examples/VFS/skel.c b/examples/VFS/skel.c index f19323480f..fe6e0731ef 100644 --- a/examples/VFS/skel.c +++ b/examples/VFS/skel.c @@ -451,7 +451,7 @@ static vfs_op_tuple *skel_init(const struct vfs_ops *def_vfs_ops, return skel_ops; } -int init_module(void) +NTSTATUS init_module(void) { return smb_register_vfs("skel", skel_init, SMB_VFS_INTERFACE_VERSION); } -- cgit From 9bf2a5bde9f25b7e602ffb353d1bcd1da1e8975a Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 1 May 2003 01:35:56 +0000 Subject: Don't crash if the underlying VFS doesn't support ACL's (This used to be commit a7520177b088589eec7f3989273020dab89d90b5) --- examples/VFS/skel.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'examples/VFS') diff --git a/examples/VFS/skel.c b/examples/VFS/skel.c index fe6e0731ef..0742caa608 100644 --- a/examples/VFS/skel.c +++ b/examples/VFS/skel.c @@ -232,11 +232,21 @@ static BOOL skel_set_nt_acl(struct files_struct *fsp, const char *name, uint32 s static BOOL skel_chmod_acl(struct connection_struct *conn, const char *name, mode_t mode) { + /* If the underlying VFS doesn't have ACL support... */ + if (!default_vfs_ops.chmod_acl) { + errno = ENOSYS; + return -1; + } return default_vfs_ops.chmod_acl(conn, name, mode); } static BOOL skel_fchmod_acl(struct files_struct *fsp, int fd, mode_t mode) { + /* If the underlying VFS doesn't have ACL support... */ + if (!default_vfs_ops.fchmod_acl) { + errno = ENOSYS; + return -1; + } return default_vfs_ops.fchmod_acl(fsp, fd, mode); } -- cgit From bee3d8f410703a4eabdfe1d40b05425637ee14df Mon Sep 17 00:00:00 2001 From: Alexander Bokovoy Date: Wed, 4 Jun 2003 13:13:41 +0000 Subject: Move VFS example skel.c to two different examples: one for opaque operations and one for transparent. Also add configure support for compiling third-party modules. Patch from Stefan Metzmacher (This used to be commit fcdf215753630d4173e50b7d93d6bc8ba254a5ff) --- examples/VFS/.cvsignore | 5 + examples/VFS/Makefile | 23 -- examples/VFS/Makefile.in | 43 ++++ examples/VFS/README | 8 +- examples/VFS/autogen.sh | 60 +++++ examples/VFS/configure.in | 275 +++++++++++++++++++++++ examples/VFS/install-sh | 238 ++++++++++++++++++++ examples/VFS/skel.c | 467 --------------------------------------- examples/VFS/skel_opaque.c | 477 ++++++++++++++++++++++++++++++++++++++++ examples/VFS/skel_transparent.c | 458 ++++++++++++++++++++++++++++++++++++++ 10 files changed, 1563 insertions(+), 491 deletions(-) delete mode 100644 examples/VFS/Makefile create mode 100644 examples/VFS/Makefile.in create mode 100755 examples/VFS/autogen.sh create mode 100644 examples/VFS/configure.in create mode 100644 examples/VFS/install-sh delete mode 100644 examples/VFS/skel.c create mode 100644 examples/VFS/skel_opaque.c create mode 100644 examples/VFS/skel_transparent.c (limited to 'examples/VFS') diff --git a/examples/VFS/.cvsignore b/examples/VFS/.cvsignore index 92b494f978..f269c98273 100644 --- a/examples/VFS/.cvsignore +++ b/examples/VFS/.cvsignore @@ -1,4 +1,9 @@ .libs *.so *.o +*.bak +autom4te.cache +autom4te-2.53.cache Makefile +configure +config.* diff --git a/examples/VFS/Makefile b/examples/VFS/Makefile deleted file mode 100644 index ac5a93b49b..0000000000 --- a/examples/VFS/Makefile +++ /dev/null @@ -1,23 +0,0 @@ -CFLAGS = -CPPFLAGS = -LDFLAGS = -LDSHFLAGS = -shared -srcdir = ../../source/ -FLAGS = $(CFLAGS) -Iinclude -I$(srcdir)/include -I$(srcdir)/ubiqx -I$(srcdir)/smbwrapper -I. $(CPPFLAGS) -I$(srcdir) - -# Auto target -default: $(patsubst %.c,%.so,$(wildcard *.c)) - -# Pattern rules - -%.so: %.o - $(CC) $(LDSHFLAGS) $(LDFLAGS) -o $@ $< - -%.o: %.c - $(CC) $(FLAGS) -c $< - -# Misc targets - -clean: - rm -rf .libs - rm -f core *~ *% *.bak *.o *.so diff --git a/examples/VFS/Makefile.in b/examples/VFS/Makefile.in new file mode 100644 index 0000000000..c368974bd5 --- /dev/null +++ b/examples/VFS/Makefile.in @@ -0,0 +1,43 @@ +CC = @CC@ +CFLAGS = @CFLAGS@ +CPPFLAGS = @CPPFLAGS@ +LDFLAGS = @LDFLAGS@ +LDSHFLAGS = @LDSHFLAGS@ +INSTALLCMD = @INSTALL@ +SAMBA_SOURCE = @SAMBA_SOURCE@ +SHLIBEXT = @SHLIBEXT@ +OBJEXT = @OBJEXT@ +FLAGS = $(CFLAGS) -Iinclude -I$(SAMBA_SOURCE)/include -I$(SAMBA_SOURCE)/ubiqx -I$(SAMBA_SOURCE)/smbwrapper -I. $(CPPFLAGS) -I$(SAMBA_SOURCE) + + +prefix = @prefix@ +libdir = @libdir@ + +VFS_LIBDIR = $(libdir)/vfs + +# Auto target +default: $(patsubst %.c,%.$(SHLIBEXT),$(wildcard *.c)) + +# Pattern rules + +%.$(SHLIBEXT): %.$(OBJEXT) + @echo "Linking $@" + @$(CC) $(LDSHFLAGS) $(LDFLAGS) -o $@ $< + +%.$(OBJEXT): %.c + @echo "Compiling $<" + @$(CC) $(FLAGS) -c $< + + +install: default + $(INSTALLCMD) -d $(VFS_LIBDIR) + $(INSTALLCMD) -m 755 *.$(SHLIBEXT) $(VFS_LIBDIR) + +# Misc targets +clean: + rm -rf .libs + rm -f core *~ *% *.bak *.o *.$(SHLIBEXT) + +distclean: clean + rm config.* Makefile + diff --git a/examples/VFS/README b/examples/VFS/README index 25254c1ffc..2f6196d117 100644 --- a/examples/VFS/README +++ b/examples/VFS/README @@ -1,12 +1,18 @@ README for Samba Virtual File System (VFS) Example =================================================== -This directory contains a skeleton VFS module. When used, +This directory contains skeleton VFS modules. When used, this module simply passes all requests back to the disk functions (i.e it operates as a passthrough filter). It should be useful as a starting point for developing new VFS modules. +Please look at skel_opaque.c when you want your module to provide +final functions, like a database filesystem. + +Please look at skel_transport.c when you want your module to provide +passthrough functions, like audit modules. + Please read the VFS chapter in the HOWTO collection for general help on the usage of VFS modules. diff --git a/examples/VFS/autogen.sh b/examples/VFS/autogen.sh new file mode 100755 index 0000000000..fcae16ec5c --- /dev/null +++ b/examples/VFS/autogen.sh @@ -0,0 +1,60 @@ +#!/bin/sh + +# Run this script to build samba from CVS. + +## insert all possible names (only works with +## autoconf 2.x +#TESTAUTOHEADER="autoheader autoheader-2.53" +TESTAUTOCONF="autoconf autoconf-2.53" + +#AUTOHEADERFOUND="0" +AUTOCONFFOUND="0" + + +## +## Look for autoheader +## +#for i in $TESTAUTOHEADER; do +# if which $i > /dev/null 2>&1; then +# if [ `$i --version | head -n 1 | cut -d. -f 2` -ge 53 ]; then +# AUTOHEADER=$i +# AUTOHEADERFOUND="1" +# break +# fi +# fi +#done + +## +## Look for autoconf +## + +for i in $TESTAUTOCONF; do + if which $i > /dev/null 2>&1; then + if [ `$i --version | head -n 1 | cut -d. -f 2` -ge 53 ]; then + AUTOCONF=$i + AUTOCONFFOUND="1" + break + fi + fi +done + + +## +## do we have it? +## +if [ "$AUTOCONFFOUND" = "0" -o "$AUTOHEADERFOUND" = "0" ]; then + echo "$0: need autoconf 2.53 or later to build samba from CVS" >&2 + exit 1 +fi + + + +#echo "$0: running $AUTOHEADER" +#$AUTOHEADER || exit 1 + +echo "$0: running $AUTOCONF" +$AUTOCONF || exit 1 + +echo "Now run ./configure and then make." +exit 0 + diff --git a/examples/VFS/configure.in b/examples/VFS/configure.in new file mode 100644 index 0000000000..8e6c517fed --- /dev/null +++ b/examples/VFS/configure.in @@ -0,0 +1,275 @@ +dnl -*- mode: m4-mode -*- +dnl Process this file with autoconf to produce a configure script. + +dnl We must use autotools 2.53 or above +AC_PREREQ(2.53) +AC_INIT(Makefile.in) + +#dnl Uncomment this if you want to use your own define's too +#AC_CONFIG_HEADER(module_config.h) +#dnl To make sure that didn't get #define PACKAGE_* in modules_config.h +#echo "" > confdefs.h + +dnl Checks for programs. +AC_PROG_CC +AC_PROG_INSTALL + +################################################# +# Directory handling stuff to support both the +# legacy SAMBA directories and FHS compliant +# ones... +AC_PREFIX_DEFAULT(/usr/local/samba) + +AC_ARG_WITH(fhs, +[ --with-fhs Use FHS-compliant paths (default=no)], + libdir="\${prefix}/lib/samba", + libdir="\${prefix}/lib") + +AC_SUBST(libdir) + +SAMBA_SOURCE="../../source" +#################################################### +# set the location location of the samba source tree +AC_ARG_WITH(samba-source, +[ --with-samba-source=DIR Where is the samba source tree (../../source)], +[ case "$withval" in + yes|no) + # + # Just in case anybody calls it without argument + # + AC_MSG_WARN([--with-samba-source called without argument - will use default]) + ;; + * ) + SAMBA_SOURCE="$withval" + ;; + esac]) + +AC_SUBST(SAMBA_SOURCE) + +dnl Unique-to-Samba variables we'll be playing with. +AC_SUBST(CC) +AC_SUBST(SHELL) +AC_SUBST(LDSHFLAGS) +AC_SUBST(SONAMEFLAG) +AC_SUBST(SHLD) +AC_SUBST(HOST_OS) +AC_SUBST(PICFLAG) +AC_SUBST(PICSUFFIX) +AC_SUBST(POBAD_CC) +AC_SUBST(SHLIBEXT) +AC_SUBST(INSTALLCLIENTCMD_SH) +AC_SUBST(INSTALLCLIENTCMD_A) +AC_SUBST(SHLIB_PROGS) +AC_SUBST(EXTRA_BIN_PROGS) +AC_SUBST(EXTRA_SBIN_PROGS) +AC_SUBST(EXTRA_ALL_TARGETS) + +AC_ARG_ENABLE(debug, +[ --enable-debug Turn on compiler debugging information (default=no)], + [if eval "test x$enable_debug = xyes"; then + CFLAGS="${CFLAGS} -g" + fi]) + +AC_ARG_ENABLE(developer, [ --enable-developer Turn on developer warnings and debugging (default=no)], + [if eval "test x$enable_developer = xyes"; then + developer=yes + CFLAGS="${CFLAGS} -g -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -DDEBUG_PASSWORD -DDEVELOPER" + fi]) + +# compile with optimization and without debugging by default, but +# allow people to set their own preference. +if test "x$CFLAGS" = x +then + CFLAGS="-O ${CFLAGS}" +fi + +#dnl Check if we use GNU ld +#LD=ld +#AC_PROG_LD_GNU + +#dnl look for executable suffix +#AC_EXEEXT + +builddir=`pwd` +AC_SUBST(builddir) + +# Assume non-shared by default and override below +BLDSHARED="false" + +# these are the defaults, good for lots of systems +HOST_OS="$host_os" +LDSHFLAGS="-shared" +SONAMEFLAG="#" +SHLD="\${CC}" +PICFLAG="" +PICSUFFIX="po" +POBAD_CC="#" +SHLIBEXT="so" + +if test "$enable_shared" = "yes"; then + # this bit needs to be modified for each OS that is suported by + # smbwrapper. You need to specify how to created a shared library and + # how to compile C code to produce PIC object files + + AC_MSG_CHECKING([ability to build shared libraries]) + + # and these are for particular systems + case "$host_os" in + *linux*) + BLDSHARED="true" + LDSHFLAGS="-shared" + DYNEXP="-Wl,--export-dynamic" + PICFLAG="-fPIC" + SONAMEFLAG="-Wl,-soname=" + ;; + *solaris*) + BLDSHARED="true" + LDSHFLAGS="-G" + SONAMEFLAG="-h " + if test "${GCC}" = "yes"; then + PICFLAG="-fPIC" + if test "${ac_cv_prog_gnu_ld}" = "yes"; then + DYNEXP="-Wl,-E" + fi + else + PICFLAG="-KPIC" + ## ${CFLAGS} added for building 64-bit shared + ## libs using Sun's Compiler + LDSHFLAGS="-G \${CFLAGS}" + POBAD_CC="" + PICSUFFIX="po.o" + fi + ;; + *sunos*) + BLDSHARED="true" + LDSHFLAGS="-G" + SONAMEFLAG="-Wl,-h," + PICFLAG="-KPIC" # Is this correct for SunOS + ;; + *netbsd* | *freebsd*) BLDSHARED="true" + LDSHFLAGS="-shared" + DYNEXP="-Wl,--export-dynamic" + SONAMEFLAG="-Wl,-soname," + PICFLAG="-fPIC -DPIC" + ;; + *openbsd*) BLDSHARED="true" + LDSHFLAGS="-shared" + DYNEXP="-Wl,-Bdynamic" + SONAMEFLAG="-Wl,-soname," + PICFLAG="-fPIC" + ;; + *irix*) + case "$host_os" in + *irix6*) + ;; + esac + ATTEMPT_WRAP32_BUILD=yes + BLDSHARED="true" + LDSHFLAGS="-set_version sgi1.0 -shared" + SONAMEFLAG="-soname " + SHLD="\${LD}" + if test "${GCC}" = "yes"; then + PICFLAG="-fPIC" + else + PICFLAG="-KPIC" + fi + ;; + *aix*) + BLDSHARED="true" + LDSHFLAGS="-Wl,-bexpall,-bM:SRE,-bnoentry,-berok" + DYNEXP="-Wl,-brtl,-bexpall" + PICFLAG="-O2" + if test "${GCC}" != "yes"; then + ## for funky AIX compiler using strncpy() + CFLAGS="$CFLAGS -D_LINUX_SOURCE_COMPAT -qmaxmem=32000" + fi + ;; + *hpux*) + SHLIBEXT="sl" + # Use special PIC flags for the native HP-UX compiler. + if test $ac_cv_prog_cc_Ae = yes; then + BLDSHARED="true" + SHLD="/usr/bin/ld" + LDSHFLAGS="-B symbolic -b -z" + SONAMEFLAG="+h " + PICFLAG="+z" + fi + DYNEXP="-Wl,-E" + ;; + *qnx*) + ;; + *osf*) + BLDSHARED="true" + LDSHFLAGS="-shared" + SONAMEFLAG="-Wl,-soname," + PICFLAG="-fPIC" + ;; + *sco*) + ;; + *unixware*) + BLDSHARED="true" + LDSHFLAGS="-shared" + SONAMEFLAG="-Wl,-soname," + PICFLAG="-KPIC" + ;; + *next2*) + ;; + *dgux*) AC_CHECK_PROG( ROFF, groff, [groff -etpsR -Tascii -man]) + ;; + *sysv4*) + case "$host" in + *-univel-*) + LDSHFLAGS="-G" + DYNEXP="-Bexport" + ;; + *mips-sni-sysv4*) + ;; + esac + ;; + + *sysv5*) + LDSHFLAGS="-G" + ;; + *vos*) + BLDSHARED="false" + LDSHFLAGS="" + ;; + *) + ;; + esac + AC_SUBST(DYNEXP) + AC_MSG_RESULT($BLDSHARED) + AC_MSG_CHECKING([linker flags for shared libraries]) + AC_MSG_RESULT([$LDSHFLAGS]) + AC_MSG_CHECKING([compiler flags for position-independent code]) + AC_MSG_RESULT([$PICFLAGS]) +fi + +####################################################### +# test whether building a shared library actually works +if test $BLDSHARED = true; then +AC_CACHE_CHECK([whether building shared libraries actually works], + [ac_cv_shlib_works],[ + ac_cv_shlib_works=no + # try building a trivial shared library + if test "$PICSUFFIX" = "po"; then + $CC $CPPFLAGS $CFLAGS $PICFLAG -c -o shlib.po ${srcdir-.}/tests/shlib.c && + $CC $CPPFLAGS $CFLAGS `eval echo $LDSHFLAGS` -o "shlib.$SHLIBEXT" shlib.po && + ac_cv_shlib_works=yes + else + $CC $CPPFLAGS $CFLAGS $PICFLAG -c -o shlib.$PICSUFFIX ${srcdir-.}/tests/shlib.c && + mv shlib.$PICSUFFIX shlib.po && + $CC $CPPFLAGS $CFLAGS `eval echo $LDSHFLAGS` -o "shlib.$SHLIBEXT" shlib.po && + ac_cv_shlib_works=yes + fi + rm -f "shlib.$SHLIBEXT" shlib.po +]) +if test $ac_cv_shlib_works = no; then + BLDSHARED=false +fi +fi + + + + +AC_OUTPUT(Makefile) diff --git a/examples/VFS/install-sh b/examples/VFS/install-sh new file mode 100644 index 0000000000..58719246f0 --- /dev/null +++ b/examples/VFS/install-sh @@ -0,0 +1,238 @@ +#! /bin/sh +# +# install - install a program, script, or datafile +# This comes from X11R5. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. +# + + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +transformbasename="" +transform_arg="" +instcmd="$mvprog" +chmodcmd="$chmodprog 0755" +chowncmd="" +chgrpcmd="" +stripcmd="" +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src="" +dst="" +dir_arg="" + +while [ x"$1" != x ]; do + case $1 in + -c) instcmd="$cpprog" + shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + -s) stripcmd="$stripprog" + shift + continue;; + + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; + + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; + + *) if [ x"$src" = x ] + then + src=$1 + else + # this colon is to work around a 386BSD /bin/sh bug + : + dst=$1 + fi + shift + continue;; + esac +done + +if [ x"$src" = x ] +then + echo "install: no input file specified" + exit 1 +else + true +fi + +if [ x"$dir_arg" != x ]; then + dst=$src + src="" + + if [ -d $dst ]; then + instcmd=: + else + instcmd=mkdir + fi +else + +# Waiting for this to be detected by the "$instcmd $src $dsttmp" command +# might cause directories to be created, which would be especially bad +# if $src (and thus $dsttmp) contains '*'. + + if [ -f $src -o -d $src ] + then + true + else + echo "install: $src does not exist" + exit 1 + fi + + if [ x"$dst" = x ] + then + echo "install: no destination specified" + exit 1 + else + true + fi + +# If destination is a directory, append the input filename; if your system +# does not like double slashes in filenames, you may need to add some logic + + if [ -d $dst ] + then + dst="$dst"/`basename $src` + else + true + fi +fi + +## this sed command emulates the dirname command +dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` + +# Make sure that the destination directory exists. +# this part is taken from Noah Friedman's mkinstalldirs script + +# Skip lots of stat calls in the usual case. +if [ ! -d "$dstdir" ]; then +defaultIFS=' +' +IFS="${IFS-${defaultIFS}}" + +oIFS="${IFS}" +# Some sh's can't handle IFS=/ for some reason. +IFS='%' +set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` +IFS="${oIFS}" + +pathcomp='' + +while [ $# -ne 0 ] ; do + pathcomp="${pathcomp}${1}" + shift + + if [ ! -d "${pathcomp}" ] ; + then + $mkdirprog "${pathcomp}" + else + true + fi + + pathcomp="${pathcomp}/" +done +fi + +if [ x"$dir_arg" != x ] +then + $doit $instcmd $dst && + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi +else + +# If we're going to rename the final executable, determine the name now. + + if [ x"$transformarg" = x ] + then + dstfile=`basename $dst` + else + dstfile=`basename $dst $transformbasename | + sed $transformarg`$transformbasename + fi + +# don't allow the sed command to completely eliminate the filename + + if [ x"$dstfile" = x ] + then + dstfile=`basename $dst` + else + true + fi + +# Make a temp file name in the proper directory. + + dsttmp=$dstdir/#inst.$$# + +# Move or copy the file name to the temp name + + $doit $instcmd $src $dsttmp && + + trap "rm -f ${dsttmp}" 0 && + +# and set any options; do chmod last to preserve setuid bits + +# If any of these fail, we abort the whole thing. If we want to +# ignore errors from any of these, just make sure not to ignore +# errors from the above "$doit $instcmd $src $dsttmp" command. + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && + +# Now rename the file to the real destination. + + $doit $rmcmd -f $dstdir/$dstfile && + $doit $mvcmd $dsttmp $dstdir/$dstfile + +fi && + + +exit 0 diff --git a/examples/VFS/skel.c b/examples/VFS/skel.c deleted file mode 100644 index 0742caa608..0000000000 --- a/examples/VFS/skel.c +++ /dev/null @@ -1,467 +0,0 @@ -/* - * Skeleton VFS module. Implements passthrough operation of all VFS - * calls to disk functions. - * - * Copyright (C) Tim Potter, 1999-2000 - * Copyright (C) Alexander Bokovoy, 2002 - * - * 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. - */ - -#include "config.h" - -#include -#include -#ifdef HAVE_UTIME_H -#include -#endif -#ifdef HAVE_DIRENT_H -#include -#endif -#ifdef HAVE_FCNTL_H -#include -#endif -#include -#include - -#include -#include - -static struct vfs_ops default_vfs_ops; /* For passthrough operation */ -static struct smb_vfs_handle_struct *skel_handle; /* use skel_handle->data for storing per-instance private data */ - -static int skel_connect(struct connection_struct *conn, const char *service, const char *user) -{ - return default_vfs_ops.connect(conn, service, user); -} - -static void skel_disconnect(struct connection_struct *conn) -{ - default_vfs_ops.disconnect(conn); -} - -static SMB_BIG_UINT skel_disk_free(struct connection_struct *conn, const char *path, - BOOL small_query, SMB_BIG_UINT *bsize, - SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize) -{ - return default_vfs_ops.disk_free(conn, path, small_query, bsize, - dfree, dsize); -} - -static DIR *skel_opendir(struct connection_struct *conn, const char *fname) -{ - return default_vfs_ops.opendir(conn, fname); -} - -static struct dirent *skel_readdir(struct connection_struct *conn, DIR *dirp) -{ - return default_vfs_ops.readdir(conn, dirp); -} - -static int skel_mkdir(struct connection_struct *conn, const char *path, mode_t mode) -{ - return default_vfs_ops.mkdir(conn, path, mode); -} - -static int skel_rmdir(struct connection_struct *conn, const char *path) -{ - return default_vfs_ops.rmdir(conn, path); -} - -static int skel_closedir(struct connection_struct *conn, DIR *dir) -{ - return default_vfs_ops.closedir(conn, dir); -} - -static int skel_open(struct connection_struct *conn, const char *fname, int flags, mode_t mode) -{ - return default_vfs_ops.open(conn, fname, flags, mode); -} - -static int skel_close(struct files_struct *fsp, int fd) -{ - return default_vfs_ops.close(fsp, fd); -} - -static ssize_t skel_read(struct files_struct *fsp, int fd, void *data, size_t n) -{ - return default_vfs_ops.read(fsp, fd, data, n); -} - -static ssize_t skel_write(struct files_struct *fsp, int fd, const void *data, size_t n) -{ - return default_vfs_ops.write(fsp, fd, data, n); -} - -static SMB_OFF_T skel_lseek(struct files_struct *fsp, int filedes, SMB_OFF_T offset, int whence) -{ - return default_vfs_ops.lseek(fsp, filedes, offset, whence); -} - -static int skel_rename(struct connection_struct *conn, const char *old, const char *new) -{ - return default_vfs_ops.rename(conn, old, new); -} - -static int skel_fsync(struct files_struct *fsp, int fd) -{ - return default_vfs_ops.fsync(fsp, fd); -} - -static int skel_stat(struct connection_struct *conn, const char *fname, SMB_STRUCT_STAT *sbuf) -{ - return default_vfs_ops.stat(conn, fname, sbuf); -} - -static int skel_fstat(struct files_struct *fsp, int fd, SMB_STRUCT_STAT *sbuf) -{ - return default_vfs_ops.fstat(fsp, fd, sbuf); -} - -static int skel_lstat(struct connection_struct *conn, const char *path, SMB_STRUCT_STAT *sbuf) -{ - return default_vfs_ops.lstat(conn, path, sbuf); -} - -static int skel_unlink(struct connection_struct *conn, const char *path) -{ - return default_vfs_ops.unlink(conn, path); -} - -static int skel_chmod(struct connection_struct *conn, const char *path, mode_t mode) -{ - return default_vfs_ops.chmod(conn, path, mode); -} - -static int skel_fchmod(struct files_struct *fsp, int fd, mode_t mode) -{ - return default_vfs_ops.fchmod(fsp, fd, mode); -} - -static int skel_chown(struct connection_struct *conn, const char *path, uid_t uid, gid_t gid) -{ - return default_vfs_ops.chown(conn, path, uid, gid); -} - -static int skel_fchown(struct files_struct *fsp, int fd, uid_t uid, gid_t gid) -{ - return default_vfs_ops.fchown(fsp, fd, uid, gid); -} - -static int skel_chdir(struct connection_struct *conn, const char *path) -{ - return default_vfs_ops.chdir(conn, path); -} - -static char *skel_getwd(struct connection_struct *conn, char *buf) -{ - return default_vfs_ops.getwd(conn, buf); -} - -static int skel_utime(struct connection_struct *conn, const char *path, struct utimbuf *times) -{ - return default_vfs_ops.utime(conn, path, times); -} - -static int skel_ftruncate(struct files_struct *fsp, int fd, SMB_OFF_T offset) -{ - return default_vfs_ops.ftruncate(fsp, fd, offset); -} - -static BOOL skel_lock(struct files_struct *fsp, int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type) -{ - return default_vfs_ops.lock(fsp, fd, op, offset, count, type); -} - -static BOOL skel_symlink(struct connection_struct *conn, const char *oldpath, const char *newpath) -{ - return default_vfs_ops.symlink(conn, oldpath, newpath); -} - -static BOOL skel_readlink(struct connection_struct *conn, const char *path, char *buf, size_t bufsiz) -{ - return default_vfs_ops.readlink(conn, path, buf, bufsiz); -} - -static int skel_link(struct connection_struct *conn, const char *oldpath, const char *newpath) -{ - return default_vfs_ops.link(conn, oldpath, newpath); -} - -static int skel_mknod(struct connection_struct *conn, const char *path, mode_t mode, SMB_DEV_T dev) -{ - return default_vfs_ops.mknod(conn, path, mode, dev); -} - -static char *skel_realpath(struct connection_struct *conn, const char *path, char *resolved_path) -{ - return default_vfs_ops.realpath(conn, path, resolved_path); -} - -static 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); -} - -static size_t skel_get_nt_acl(struct files_struct *fsp, const char *name, struct security_descriptor_info **ppdesc) -{ - return default_vfs_ops.get_nt_acl(fsp, name, ppdesc); -} - -static BOOL skel_fset_nt_acl(struct files_struct *fsp, int fd, uint32 security_info_sent, struct security_descriptor_info *psd) -{ - return default_vfs_ops.fset_nt_acl(fsp, fd, security_info_sent, psd); -} - -static BOOL skel_set_nt_acl(struct files_struct *fsp, const char *name, uint32 security_info_sent, struct security_descriptor_info *psd) -{ - return default_vfs_ops.set_nt_acl(fsp, name, security_info_sent, psd); -} - -static BOOL skel_chmod_acl(struct connection_struct *conn, const char *name, mode_t mode) -{ - /* If the underlying VFS doesn't have ACL support... */ - if (!default_vfs_ops.chmod_acl) { - errno = ENOSYS; - return -1; - } - return default_vfs_ops.chmod_acl(conn, name, mode); -} - -static BOOL skel_fchmod_acl(struct files_struct *fsp, int fd, mode_t mode) -{ - /* If the underlying VFS doesn't have ACL support... */ - if (!default_vfs_ops.fchmod_acl) { - errno = ENOSYS; - return -1; - } - return default_vfs_ops.fchmod_acl(fsp, fd, mode); -} - -static int skel_sys_acl_get_entry(struct connection_struct *conn, SMB_ACL_T theacl, int entry_id, SMB_ACL_ENTRY_T *entry_p) -{ - return default_vfs_ops.sys_acl_get_entry(conn, theacl, entry_id, entry_p); -} - -static int skel_sys_acl_get_tag_type(struct connection_struct *conn, SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T *tag_type_p) -{ - return default_vfs_ops.sys_acl_get_tag_type(conn, entry_d, tag_type_p); -} - -static int skel_sys_acl_get_permset(struct connection_struct *conn, SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T *permset_p) -{ - return default_vfs_ops.sys_acl_get_permset(conn, entry_d, permset_p); -} - -static void *skel_sys_acl_get_qualifier(struct connection_struct *conn, SMB_ACL_ENTRY_T entry_d) -{ - return default_vfs_ops.sys_acl_get_qualifier(conn, entry_d); -} - -static SMB_ACL_T skel_sys_acl_get_file(struct connection_struct *conn, const char *path_p, SMB_ACL_TYPE_T type) -{ - return default_vfs_ops.sys_acl_get_file(conn, path_p, type); -} - -static SMB_ACL_T skel_sys_acl_get_fd(struct files_struct *fsp, int fd) -{ - return default_vfs_ops.sys_acl_get_fd(fsp, fd); -} - -static int skel_sys_acl_clear_perms(struct connection_struct *conn, SMB_ACL_PERMSET_T permset) -{ - return default_vfs_ops.sys_acl_clear_perms(conn, permset); -} - -static int skel_sys_acl_add_perm(struct connection_struct *conn, SMB_ACL_PERMSET_T permset, SMB_ACL_PERM_T perm) -{ - return default_vfs_ops.sys_acl_add_perm(conn, permset, perm); -} - -static char *skel_sys_acl_to_text(struct connection_struct *conn, SMB_ACL_T theacl, ssize_t *plen) -{ - return default_vfs_ops.sys_acl_to_text(conn, theacl, plen); -} - -static SMB_ACL_T skel_sys_acl_init(struct connection_struct *conn, int count) -{ - return default_vfs_ops.sys_acl_init(conn, count); -} - -static int skel_sys_acl_create_entry(struct connection_struct *conn, SMB_ACL_T *pacl, SMB_ACL_ENTRY_T *pentry) -{ - return default_vfs_ops.sys_acl_create_entry(conn, pacl, pentry); -} - -static int skel_sys_acl_set_tag_type(struct connection_struct *conn, SMB_ACL_ENTRY_T entry, SMB_ACL_TAG_T tagtype) -{ - return default_vfs_ops.sys_acl_set_tag_type(conn, entry, tagtype); -} - -static int skel_sys_acl_set_qualifier(struct connection_struct *conn, SMB_ACL_ENTRY_T entry, void *qual) -{ - return default_vfs_ops.sys_acl_set_qualifier(conn, entry, qual); -} - -static int skel_sys_acl_set_permset(struct connection_struct *conn, SMB_ACL_ENTRY_T entry, SMB_ACL_PERMSET_T permset) -{ - return default_vfs_ops.sys_acl_set_permset(conn, entry, permset); -} - -static int skel_sys_acl_valid(struct connection_struct *conn, SMB_ACL_T theacl ) -{ - return default_vfs_ops.sys_acl_valid(conn, theacl ); -} - -static int skel_sys_acl_set_file(struct connection_struct *conn, const char *name, SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl) -{ - return default_vfs_ops.sys_acl_set_file(conn, name, acltype, theacl); -} - -static int skel_sys_acl_set_fd(struct files_struct *fsp, int fd, SMB_ACL_T theacl) -{ - return default_vfs_ops.sys_acl_set_fd(fsp, fd, theacl); -} - -static int skel_sys_acl_delete_def_file(struct connection_struct *conn, const char *path) -{ - return default_vfs_ops.sys_acl_delete_def_file(conn, path); -} - -static int skel_sys_acl_get_perm(struct connection_struct *conn, SMB_ACL_PERMSET_T permset, SMB_ACL_PERM_T perm) -{ - return default_vfs_ops.sys_acl_get_perm(conn, permset, perm); -} - -static int skel_sys_acl_free_text(struct connection_struct *conn, char *text) -{ - return default_vfs_ops.sys_acl_free_text(conn, text); -} - -static int skel_sys_acl_free_acl(struct connection_struct *conn, SMB_ACL_T posix_acl) -{ - return default_vfs_ops.sys_acl_free_acl(conn, posix_acl); -} - -static int skel_sys_acl_free_qualifier(struct connection_struct *conn, void *qualifier, SMB_ACL_TAG_T tagtype) -{ - return default_vfs_ops.sys_acl_free_qualifier(conn, qualifier, tagtype); -} - - -/* VFS operations structure */ - -static vfs_op_tuple skel_ops[] = { - - /* Disk operations */ - - {skel_connect, SMB_VFS_OP_CONNECT, SMB_VFS_LAYER_TRANSPARENT}, - {skel_disconnect, SMB_VFS_OP_DISCONNECT, SMB_VFS_LAYER_TRANSPARENT}, - {skel_disk_free, SMB_VFS_OP_DISK_FREE, SMB_VFS_LAYER_TRANSPARENT}, - - /* Directory operations */ - - {skel_opendir, SMB_VFS_OP_OPENDIR, SMB_VFS_LAYER_TRANSPARENT}, - {skel_readdir, SMB_VFS_OP_READDIR, SMB_VFS_LAYER_TRANSPARENT}, - {skel_mkdir, SMB_VFS_OP_MKDIR, SMB_VFS_LAYER_TRANSPARENT}, - {skel_rmdir, SMB_VFS_OP_RMDIR, SMB_VFS_LAYER_TRANSPARENT}, - {skel_closedir, SMB_VFS_OP_CLOSEDIR, SMB_VFS_LAYER_TRANSPARENT}, - - /* File operations */ - - {skel_open, SMB_VFS_OP_OPEN, SMB_VFS_LAYER_TRANSPARENT}, - {skel_close, SMB_VFS_OP_CLOSE, SMB_VFS_LAYER_TRANSPARENT}, - {skel_read, SMB_VFS_OP_READ, SMB_VFS_LAYER_TRANSPARENT}, - {skel_write, SMB_VFS_OP_WRITE, SMB_VFS_LAYER_TRANSPARENT}, - {skel_lseek, SMB_VFS_OP_LSEEK, SMB_VFS_LAYER_TRANSPARENT}, - {skel_rename, SMB_VFS_OP_RENAME, SMB_VFS_LAYER_TRANSPARENT}, - {skel_fsync, SMB_VFS_OP_FSYNC, SMB_VFS_LAYER_TRANSPARENT}, - {skel_stat, SMB_VFS_OP_STAT, SMB_VFS_LAYER_TRANSPARENT}, - {skel_fstat, SMB_VFS_OP_FSTAT, SMB_VFS_LAYER_TRANSPARENT}, - {skel_lstat, SMB_VFS_OP_LSTAT, SMB_VFS_LAYER_TRANSPARENT}, - {skel_unlink, SMB_VFS_OP_UNLINK, SMB_VFS_LAYER_TRANSPARENT}, - {skel_chmod, SMB_VFS_OP_CHMOD, SMB_VFS_LAYER_TRANSPARENT}, - {skel_fchmod, SMB_VFS_OP_FCHMOD, SMB_VFS_LAYER_TRANSPARENT}, - {skel_chown, SMB_VFS_OP_CHOWN, SMB_VFS_LAYER_TRANSPARENT}, - {skel_fchown, SMB_VFS_OP_FCHOWN, SMB_VFS_LAYER_TRANSPARENT}, - {skel_chdir, SMB_VFS_OP_CHDIR, SMB_VFS_LAYER_TRANSPARENT}, - {skel_getwd, SMB_VFS_OP_GETWD, SMB_VFS_LAYER_TRANSPARENT}, - {skel_utime, SMB_VFS_OP_UTIME, SMB_VFS_LAYER_TRANSPARENT}, - {skel_ftruncate, SMB_VFS_OP_FTRUNCATE, SMB_VFS_LAYER_TRANSPARENT}, - {skel_lock, SMB_VFS_OP_LOCK, SMB_VFS_LAYER_TRANSPARENT}, - {skel_symlink, SMB_VFS_OP_SYMLINK, SMB_VFS_LAYER_TRANSPARENT}, - {skel_readlink, SMB_VFS_OP_READLINK, SMB_VFS_LAYER_TRANSPARENT}, - {skel_link, SMB_VFS_OP_LINK, SMB_VFS_LAYER_TRANSPARENT}, - {skel_mknod, SMB_VFS_OP_MKNOD, SMB_VFS_LAYER_TRANSPARENT}, - {skel_realpath, SMB_VFS_OP_REALPATH, SMB_VFS_LAYER_TRANSPARENT}, - - /* NT File ACL operations */ - - {skel_fget_nt_acl, SMB_VFS_OP_FGET_NT_ACL, SMB_VFS_LAYER_TRANSPARENT}, - {skel_get_nt_acl, SMB_VFS_OP_GET_NT_ACL, SMB_VFS_LAYER_TRANSPARENT}, - {skel_fset_nt_acl, SMB_VFS_OP_FSET_NT_ACL, SMB_VFS_LAYER_TRANSPARENT}, - {skel_set_nt_acl, SMB_VFS_OP_SET_NT_ACL, SMB_VFS_LAYER_TRANSPARENT}, - - /* POSIX ACL operations */ - - {skel_chmod_acl, SMB_VFS_OP_CHMOD_ACL, SMB_VFS_LAYER_TRANSPARENT}, - {skel_fchmod_acl, SMB_VFS_OP_FCHMOD_ACL, SMB_VFS_LAYER_TRANSPARENT}, - - {skel_sys_acl_get_entry, SMB_VFS_OP_SYS_ACL_GET_ENTRY, SMB_VFS_LAYER_TRANSPARENT}, - {skel_sys_acl_get_tag_type, SMB_VFS_OP_SYS_ACL_GET_TAG_TYPE, SMB_VFS_LAYER_TRANSPARENT}, - {skel_sys_acl_get_permset, SMB_VFS_OP_SYS_ACL_GET_PERMSET, SMB_VFS_LAYER_TRANSPARENT}, - {skel_sys_acl_get_qualifier, SMB_VFS_OP_SYS_ACL_GET_QUALIFIER, SMB_VFS_LAYER_TRANSPARENT}, - {skel_sys_acl_get_file, SMB_VFS_OP_SYS_ACL_GET_FILE, SMB_VFS_LAYER_TRANSPARENT}, - {skel_sys_acl_get_fd, SMB_VFS_OP_SYS_ACL_GET_FD, SMB_VFS_LAYER_TRANSPARENT}, - {skel_sys_acl_clear_perms, SMB_VFS_OP_SYS_ACL_CLEAR_PERMS, SMB_VFS_LAYER_TRANSPARENT}, - {skel_sys_acl_add_perm, SMB_VFS_OP_SYS_ACL_ADD_PERM, SMB_VFS_LAYER_TRANSPARENT}, - {skel_sys_acl_to_text, SMB_VFS_OP_SYS_ACL_TO_TEXT, SMB_VFS_LAYER_TRANSPARENT}, - {skel_sys_acl_init, SMB_VFS_OP_SYS_ACL_INIT, SMB_VFS_LAYER_TRANSPARENT}, - {skel_sys_acl_create_entry, SMB_VFS_OP_SYS_ACL_CREATE_ENTRY, SMB_VFS_LAYER_TRANSPARENT}, - {skel_sys_acl_set_tag_type, SMB_VFS_OP_SYS_ACL_SET_TAG_TYPE, SMB_VFS_LAYER_TRANSPARENT}, - {skel_sys_acl_set_qualifier, SMB_VFS_OP_SYS_ACL_SET_QUALIFIER, SMB_VFS_LAYER_TRANSPARENT}, - {skel_sys_acl_set_permset, SMB_VFS_OP_SYS_ACL_SET_PERMSET, SMB_VFS_LAYER_TRANSPARENT}, - {skel_sys_acl_valid, SMB_VFS_OP_SYS_ACL_VALID, SMB_VFS_LAYER_TRANSPARENT}, - {skel_sys_acl_set_file, SMB_VFS_OP_SYS_ACL_SET_FILE, SMB_VFS_LAYER_TRANSPARENT}, - {skel_sys_acl_set_fd, SMB_VFS_OP_SYS_ACL_SET_FD, SMB_VFS_LAYER_TRANSPARENT}, - {skel_sys_acl_delete_def_file, SMB_VFS_OP_SYS_ACL_DELETE_DEF_FILE, SMB_VFS_LAYER_TRANSPARENT}, - {skel_sys_acl_get_perm, SMB_VFS_OP_SYS_ACL_GET_PERM, SMB_VFS_LAYER_TRANSPARENT}, - {skel_sys_acl_free_text, SMB_VFS_OP_SYS_ACL_FREE_TEXT, SMB_VFS_LAYER_TRANSPARENT}, - {skel_sys_acl_free_acl, SMB_VFS_OP_SYS_ACL_FREE_ACL, SMB_VFS_LAYER_TRANSPARENT}, - {skel_sys_acl_free_qualifier, SMB_VFS_OP_SYS_ACL_FREE_QUALIFIER, SMB_VFS_LAYER_TRANSPARENT}, - - {NULL, SMB_VFS_OP_NOOP, SMB_VFS_LAYER_NOOP} -}; - -/* VFS initialisation - return initialized vfs_op_tuple array back to Samba */ - -static vfs_op_tuple *skel_init(const struct vfs_ops *def_vfs_ops, - struct smb_vfs_handle_struct *vfs_handle) -{ - DEBUG(3, ("Initialising default vfs hooks\n")); - - memcpy(&default_vfs_ops, def_vfs_ops, sizeof(struct vfs_ops)); - - /* Remember vfs_handle for further allocation and referencing of private - information in vfs_handle->data - */ - skel_handle = vfs_handle; - return skel_ops; -} - -NTSTATUS init_module(void) -{ - return smb_register_vfs("skel", skel_init, SMB_VFS_INTERFACE_VERSION); -} diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c new file mode 100644 index 0000000000..c985ec44fd --- /dev/null +++ b/examples/VFS/skel_opaque.c @@ -0,0 +1,477 @@ +/* + * Skeleton VFS module. Implements passthrough operation of all VFS + * calls to disk functions. + * + * Copyright (C) Tim Potter, 1999-2000 + * Copyright (C) Alexander Bokovoy, 2002 + * Copyright (C) Stefan (metze) Metzmacher, 2003 + * + * 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. + */ + + +#include "includes.h" + +/* PLEASE,PLEASE READ THE VFS MODULES CHAPTER OF THE + SAMBA DEVELOPERS GUIDE!!!!!! + */ + +/* If you take this file as template for your module + * please make sure that you remove all vfswrap_* functions and + * implement your own function!! + * + * for functions you didn't want to provide implement dummy functions + * witch return ERROR and errno = ENOSYS; ! + * + * --metze + */ + +static int skel_connect(vfs_handle_struct *handle, connection_struct *conn, const char *service, const char *user) +{ + return 0; +} + +static void skel_disconnect(vfs_handle_struct *handle, connection_struct *conn) +{ + return; +} + +static SMB_BIG_UINT skel_disk_free(vfs_handle_struct *handle, connection_struct *conn, const char *path, + BOOL small_query, SMB_BIG_UINT *bsize, + SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize) +{ + return vfswrap_disk_free(NULL, conn, path, small_query, bsize, + dfree, dsize); +} + +static int skel_get_quota(vfs_handle_struct *handle, connection_struct *conn, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dq) +{ + return vfswrap_get_quota(NULL, conn, qtype, id, dq); +} + +static int skel_set_quota(vfs_handle_struct *handle, connection_struct *conn, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dq) +{ + return vfswrap_set_quota(NULL, conn, qtype, id, dq); +} + +static DIR *skel_opendir(vfs_handle_struct *handle, connection_struct *conn, const char *fname) +{ + return vfswrap_opendir(NULL, conn, fname); +} + +static struct dirent *skel_readdir(vfs_handle_struct *handle, connection_struct *conn, DIR *dirp) +{ + return vfswrap_readdir(NULL, conn, dirp); +} + +static int skel_mkdir(vfs_handle_struct *handle, connection_struct *conn, const char *path, mode_t mode) +{ + return vfswrap_mkdir(NULL, conn, path, mode); +} + +static int skel_rmdir(vfs_handle_struct *handle, connection_struct *conn, const char *path) +{ + return vfswrap_rmdir(NULL, conn, path); +} + +static int skel_closedir(vfs_handle_struct *handle, connection_struct *conn, DIR *dir) +{ + return vfswrap_closedir(NULL, conn, dir); +} + +static int skel_open(vfs_handle_struct *handle, connection_struct *conn, const char *fname, int flags, mode_t mode) +{ + return vfswrap_open(NULL, conn, fname, flags, mode); +} + +static int skel_close(vfs_handle_struct *handle, files_struct *fsp, int fd) +{ + return vfswrap_close(NULL, fsp, fd); +} + +static ssize_t skel_read(vfs_handle_struct *handle, files_struct *fsp, int fd, void *data, size_t n) +{ + return vfswrap_read(NULL, fsp, fd, data, n); +} + +static ssize_t skel_write(vfs_handle_struct *handle, files_struct *fsp, int fd, const void *data, size_t n) +{ + return vfswrap_write(NULL, fsp, fd, data, n); +} + +static SMB_OFF_T skel_lseek(vfs_handle_struct *handle, files_struct *fsp, int filedes, SMB_OFF_T offset, int whence) +{ + return vfswrap_lseek(NULL, fsp, filedes, offset, whence); +} + +static int skel_rename(vfs_handle_struct *handle, connection_struct *conn, const char *old, const char *new) +{ + return vfswrap_rename(NULL, conn, old, new); +} + +static int skel_fsync(vfs_handle_struct *handle, files_struct *fsp, int fd) +{ + return vfswrap_fsync(NULL, fsp, fd); +} + +static int skel_stat(vfs_handle_struct *handle, connection_struct *conn, const char *fname, SMB_STRUCT_STAT *sbuf) +{ + return vfswrap_stat(NULL, conn, fname, sbuf); +} + +static int skel_fstat(vfs_handle_struct *handle, files_struct *fsp, int fd, SMB_STRUCT_STAT *sbuf) +{ + return vfswrap_fstat(NULL, fsp, fd, sbuf); +} + +static int skel_lstat(vfs_handle_struct *handle, connection_struct *conn, const char *path, SMB_STRUCT_STAT *sbuf) +{ + return vfswrap_lstat(NULL, conn, path, sbuf); +} + +static int skel_unlink(vfs_handle_struct *handle, connection_struct *conn, const char *path) +{ + return vfswrap_unlink(NULL, conn, path); +} + +static int skel_chmod(vfs_handle_struct *handle, connection_struct *conn, const char *path, mode_t mode) +{ + return vfswrap_chmod(NULL, conn, path, mode); +} + +static int skel_fchmod(vfs_handle_struct *handle, files_struct *fsp, int fd, mode_t mode) +{ + return vfswrap_fchmod(NULL, fsp, fd, mode); +} + +static int skel_chown(vfs_handle_struct *handle, connection_struct *conn, const char *path, uid_t uid, gid_t gid) +{ + return vfswrap_chown(NULL, conn, path, uid, gid); +} + +static int skel_fchown(vfs_handle_struct *handle, files_struct *fsp, int fd, uid_t uid, gid_t gid) +{ + return vfswrap_fchown(NULL, fsp, fd, uid, gid); +} + +static int skel_chdir(vfs_handle_struct *handle, connection_struct *conn, const char *path) +{ + return vfswrap_chdir(NULL, conn, path); +} + +static char *skel_getwd(vfs_handle_struct *handle, connection_struct *conn, char *buf) +{ + return vfswrap_getwd(NULL, conn, buf); +} + +static int skel_utime(vfs_handle_struct *handle, connection_struct *conn, const char *path, struct utimbuf *times) +{ + return vfswrap_utime(NULL, conn, path, times); +} + +static int skel_ftruncate(vfs_handle_struct *handle, files_struct *fsp, int fd, SMB_OFF_T offset) +{ + return vfswrap_ftruncate(NULL, fsp, fd, 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) +{ + return vfswrap_lock(NULL, fsp, fd, op, offset, count, type); +} + +static BOOL skel_symlink(vfs_handle_struct *handle, connection_struct *conn, const char *oldpath, const char *newpath) +{ + return vfswrap_symlink(NULL, conn, oldpath, newpath); +} + +static BOOL skel_readlink(vfs_handle_struct *handle, connection_struct *conn, const char *path, char *buf, size_t bufsiz) +{ + return vfswrap_readlink(NULL, conn, path, buf, bufsiz); +} + +static int skel_link(vfs_handle_struct *handle, connection_struct *conn, const char *oldpath, const char *newpath) +{ + return vfswrap_link(NULL, conn, oldpath, newpath); +} + +static int skel_mknod(vfs_handle_struct *handle, connection_struct *conn, const char *path, mode_t mode, SMB_DEV_T dev) +{ + return vfswrap_mknod(NULL, conn, path, mode, dev); +} + +static char *skel_realpath(vfs_handle_struct *handle, connection_struct *conn, const char *path, char *resolved_path) +{ + return vfswrap_realpath(NULL, conn, path, resolved_path); +} + +static size_t skel_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp, int fd, uint32 security_info, struct security_descriptor_info **ppdesc) +{ + errno = ENOSYS; + return 0; +} + +static size_t skel_get_nt_acl(vfs_handle_struct *handle, files_struct *fsp, const char *name, uint32 security_info, struct security_descriptor_info **ppdesc) +{ + errno = ENOSYS; + return 0; +} + +static BOOL skel_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp, int fd, uint32 security_info_sent, struct security_descriptor_info *psd) +{ + errno = ENOSYS; + return False; +} + +static BOOL skel_set_nt_acl(vfs_handle_struct *handle, files_struct *fsp, const char *name, uint32 security_info_sent, struct security_descriptor_info *psd) +{ + errno = ENOSYS; + return False; +} + +static int skel_chmod_acl(vfs_handle_struct *handle, connection_struct *conn, const char *name, mode_t mode) +{ + errno = ENOSYS; + return -1; +} + +static int skel_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp, int fd, mode_t mode) +{ + errno = ENOSYS; + return -1; +} + +static int skel_sys_acl_get_entry(vfs_handle_struct *handle, connection_struct *conn, SMB_ACL_T theacl, int entry_id, SMB_ACL_ENTRY_T *entry_p) +{ + errno = ENOSYS; + return -1; +} + +static int skel_sys_acl_get_tag_type(vfs_handle_struct *handle, connection_struct *conn, SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T *tag_type_p) +{ + errno = ENOSYS; + return -1; +} + +static int skel_sys_acl_get_permset(vfs_handle_struct *handle, connection_struct *conn, SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T *permset_p) +{ + errno = ENOSYS; + return -1; +} + +static void *skel_sys_acl_get_qualifier(vfs_handle_struct *handle, connection_struct *conn, SMB_ACL_ENTRY_T entry_d) +{ + errno = ENOSYS; + return NULL; +} + +static SMB_ACL_T skel_sys_acl_get_file(vfs_handle_struct *handle, connection_struct *conn, const char *path_p, SMB_ACL_TYPE_T type) +{ + errno = ENOSYS; + return NULL; +} + +static SMB_ACL_T skel_sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp, int fd) +{ + errno = ENOSYS; + return NULL; +} + +static int skel_sys_acl_clear_perms(vfs_handle_struct *handle, connection_struct *conn, SMB_ACL_PERMSET_T permset) +{ + errno = ENOSYS; + return -1; +} + +static int skel_sys_acl_add_perm(vfs_handle_struct *handle, connection_struct *conn, SMB_ACL_PERMSET_T permset, SMB_ACL_PERM_T perm) +{ + errno = ENOSYS; + return -1; +} + +static char *skel_sys_acl_to_text(vfs_handle_struct *handle, connection_struct *conn, SMB_ACL_T theacl, ssize_t *plen) +{ + errno = ENOSYS; + return NULL; +} + +static SMB_ACL_T skel_sys_acl_init(vfs_handle_struct *handle, connection_struct *conn, int count) +{ + errno = ENOSYS; + return NULL; +} + +static int skel_sys_acl_create_entry(vfs_handle_struct *handle, connection_struct *conn, SMB_ACL_T *pacl, SMB_ACL_ENTRY_T *pentry) +{ + errno = ENOSYS; + return -1; +} + +static int skel_sys_acl_set_tag_type(vfs_handle_struct *handle, connection_struct *conn, SMB_ACL_ENTRY_T entry, SMB_ACL_TAG_T tagtype) +{ + errno = ENOSYS; + return -1; +} + +static int skel_sys_acl_set_qualifier(vfs_handle_struct *handle, connection_struct *conn, SMB_ACL_ENTRY_T entry, void *qual) +{ + errno = ENOSYS; + return -1; +} + +static int skel_sys_acl_set_permset(vfs_handle_struct *handle, connection_struct *conn, SMB_ACL_ENTRY_T entry, SMB_ACL_PERMSET_T permset) +{ + errno = ENOSYS; + return -1; +} + +static int skel_sys_acl_valid(vfs_handle_struct *handle, connection_struct *conn, SMB_ACL_T theacl ) +{ + errno = ENOSYS; + return -1; +} + +static int skel_sys_acl_set_file(vfs_handle_struct *handle, connection_struct *conn, const char *name, SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl) +{ + errno = ENOSYS; + return -1; +} + +static int skel_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp, int fd, SMB_ACL_T theacl) +{ + errno = ENOSYS; + return -1; +} + +static int skel_sys_acl_delete_def_file(vfs_handle_struct *handle, connection_struct *conn, const char *path) +{ + errno = ENOSYS; + return -1; +} + +static int skel_sys_acl_get_perm(vfs_handle_struct *handle, connection_struct *conn, SMB_ACL_PERMSET_T permset, SMB_ACL_PERM_T perm) +{ + errno = ENOSYS; + return -1; +} + +static int skel_sys_acl_free_text(vfs_handle_struct *handle, connection_struct *conn, char *text) +{ + errno = ENOSYS; + return -1; +} + +static int skel_sys_acl_free_acl(vfs_handle_struct *handle, connection_struct *conn, SMB_ACL_T posix_acl) +{ + errno = ENOSYS; + return -1; +} + +static int skel_sys_acl_free_qualifier(vfs_handle_struct *handle, connection_struct *conn, void *qualifier, SMB_ACL_TAG_T tagtype) +{ + errno = ENOSYS; + return -1; +} + + +/* VFS operations structure */ + +static vfs_op_tuple skel_op_tuples[] = { + + /* Disk operations */ + + {SMB_VFS_OP(skel_connect), SMB_VFS_OP_CONNECT, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_disconnect), SMB_VFS_OP_DISCONNECT, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_disk_free), SMB_VFS_OP_DISK_FREE, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_get_quota), SMB_VFS_OP_GET_QUOTA, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_set_quota), SMB_VFS_OP_SET_QUOTA, SMB_VFS_LAYER_OPAQUE}, + + /* Directory operations */ + + {SMB_VFS_OP(skel_opendir), SMB_VFS_OP_OPENDIR, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_readdir), SMB_VFS_OP_READDIR, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_mkdir), SMB_VFS_OP_MKDIR, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_rmdir), SMB_VFS_OP_RMDIR, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_closedir), SMB_VFS_OP_CLOSEDIR, SMB_VFS_LAYER_OPAQUE}, + + /* File operations */ + + {SMB_VFS_OP(skel_open), SMB_VFS_OP_OPEN, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_close), SMB_VFS_OP_CLOSE, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_read), SMB_VFS_OP_READ, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_write), SMB_VFS_OP_WRITE, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_lseek), SMB_VFS_OP_LSEEK, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_rename), SMB_VFS_OP_RENAME, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_fsync), SMB_VFS_OP_FSYNC, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_stat), SMB_VFS_OP_STAT, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_fstat), SMB_VFS_OP_FSTAT, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_lstat), SMB_VFS_OP_LSTAT, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_unlink), SMB_VFS_OP_UNLINK, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_chmod), SMB_VFS_OP_CHMOD, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_fchmod), SMB_VFS_OP_FCHMOD, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_chown), SMB_VFS_OP_CHOWN, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_fchown), SMB_VFS_OP_FCHOWN, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_chdir), SMB_VFS_OP_CHDIR, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_getwd), SMB_VFS_OP_GETWD, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_utime), SMB_VFS_OP_UTIME, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_ftruncate), SMB_VFS_OP_FTRUNCATE, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_lock), SMB_VFS_OP_LOCK, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_symlink), SMB_VFS_OP_SYMLINK, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_readlink), SMB_VFS_OP_READLINK, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_link), SMB_VFS_OP_LINK, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_mknod), SMB_VFS_OP_MKNOD, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_realpath), SMB_VFS_OP_REALPATH, SMB_VFS_LAYER_OPAQUE}, + + /* NT File ACL operations */ + + {SMB_VFS_OP(skel_fget_nt_acl), SMB_VFS_OP_FGET_NT_ACL, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_get_nt_acl), SMB_VFS_OP_GET_NT_ACL, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_fset_nt_acl), SMB_VFS_OP_FSET_NT_ACL, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_set_nt_acl), SMB_VFS_OP_SET_NT_ACL, SMB_VFS_LAYER_OPAQUE}, + + /* POSIX ACL operations */ + + {SMB_VFS_OP(skel_chmod_acl), SMB_VFS_OP_CHMOD_ACL, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_fchmod_acl), SMB_VFS_OP_FCHMOD_ACL, SMB_VFS_LAYER_OPAQUE}, + + {SMB_VFS_OP(skel_sys_acl_get_entry), SMB_VFS_OP_SYS_ACL_GET_ENTRY, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_sys_acl_get_tag_type), SMB_VFS_OP_SYS_ACL_GET_TAG_TYPE, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_sys_acl_get_permset), SMB_VFS_OP_SYS_ACL_GET_PERMSET, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_sys_acl_get_qualifier), SMB_VFS_OP_SYS_ACL_GET_QUALIFIER, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_sys_acl_get_file), SMB_VFS_OP_SYS_ACL_GET_FILE, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_sys_acl_get_fd), SMB_VFS_OP_SYS_ACL_GET_FD, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_sys_acl_clear_perms), SMB_VFS_OP_SYS_ACL_CLEAR_PERMS, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_sys_acl_add_perm), SMB_VFS_OP_SYS_ACL_ADD_PERM, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_sys_acl_to_text), SMB_VFS_OP_SYS_ACL_TO_TEXT, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_sys_acl_init), SMB_VFS_OP_SYS_ACL_INIT, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_sys_acl_create_entry), SMB_VFS_OP_SYS_ACL_CREATE_ENTRY, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_sys_acl_set_tag_type), SMB_VFS_OP_SYS_ACL_SET_TAG_TYPE, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_sys_acl_set_qualifier), SMB_VFS_OP_SYS_ACL_SET_QUALIFIER, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_sys_acl_set_permset), SMB_VFS_OP_SYS_ACL_SET_PERMSET, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_sys_acl_valid), SMB_VFS_OP_SYS_ACL_VALID, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_sys_acl_set_file), SMB_VFS_OP_SYS_ACL_SET_FILE, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_sys_acl_set_fd), SMB_VFS_OP_SYS_ACL_SET_FD, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_sys_acl_delete_def_file), SMB_VFS_OP_SYS_ACL_DELETE_DEF_FILE, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_sys_acl_get_perm), SMB_VFS_OP_SYS_ACL_GET_PERM, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_sys_acl_free_text), SMB_VFS_OP_SYS_ACL_FREE_TEXT, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_sys_acl_free_acl), SMB_VFS_OP_SYS_ACL_FREE_ACL, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_sys_acl_free_qualifier), SMB_VFS_OP_SYS_ACL_FREE_QUALIFIER, SMB_VFS_LAYER_OPAQUE}, + + {NULL, SMB_VFS_OP_NOOP, SMB_VFS_LAYER_NOOP} +}; + +NTSTATUS init_module(void) +{ + return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "skel_opaque", skel_op_tuples); +} diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c new file mode 100644 index 0000000000..3a967470a8 --- /dev/null +++ b/examples/VFS/skel_transparent.c @@ -0,0 +1,458 @@ +/* + * Skeleton VFS module. Implements passthrough operation of all VFS + * calls to disk functions. + * + * Copyright (C) Tim Potter, 1999-2000 + * Copyright (C) Alexander Bokovoy, 2002 + * Copyright (C) Stefan (metze) Metzmacher, 2003 + * + * 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. + */ + + +#include "includes.h" + +/* PLEASE,PLEASE READ THE VFS MODULES CHAPTER OF THE + SAMBA DEVELOPERS GUIDE!!!!!! + */ + +/* If you take this file as template for your module + * please make sure that you remove all functions you didn't + * want to implement!! + * + * This passthrough operations are useless in reall vfs modules! + * + * --metze + */ + +static int skel_connect(vfs_handle_struct *handle, connection_struct *conn, const char *service, const char *user) +{ + return SMB_VFS_NEXT_CONNECT(handle, conn, service, user); +} + +static void skel_disconnect(vfs_handle_struct *handle, connection_struct *conn) +{ + SMB_VFS_NEXT_DISCONNECT(handle, conn); +} + +static SMB_BIG_UINT skel_disk_free(vfs_handle_struct *handle, connection_struct *conn, const char *path, + BOOL small_query, SMB_BIG_UINT *bsize, + SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize) +{ + return SMB_VFS_NEXT_DISK_FREE(handle, conn, path, small_query, bsize, + dfree, dsize); +} + +static int skel_get_quota(vfs_handle_struct *handle, connection_struct *conn, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dq) +{ + return SMB_VFS_NEXT_GET_QUOTA(handle, conn, qtype, id, dq); +} + +static int skel_set_quota(vfs_handle_struct *handle, connection_struct *conn, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dq) +{ + return SMB_VFS_NEXT_SET_QUOTA(handle, conn, qtype, id, dq); +} + +static DIR *skel_opendir(vfs_handle_struct *handle, connection_struct *conn, const char *fname) +{ + return SMB_VFS_NEXT_OPENDIR(handle, conn, fname); +} + +static struct dirent *skel_readdir(vfs_handle_struct *handle, connection_struct *conn, DIR *dirp) +{ + return SMB_VFS_NEXT_READDIR(handle, conn, dirp); +} + +static int skel_mkdir(vfs_handle_struct *handle, connection_struct *conn, const char *path, mode_t mode) +{ + return SMB_VFS_NEXT_MKDIR(handle, conn, path, mode); +} + +static int skel_rmdir(vfs_handle_struct *handle, connection_struct *conn, const char *path) +{ + return SMB_VFS_NEXT_RMDIR(handle, conn, path); +} + +static int skel_closedir(vfs_handle_struct *handle, connection_struct *conn, DIR *dir) +{ + return SMB_VFS_NEXT_CLOSEDIR(handle, conn, dir); +} + +static int skel_open(vfs_handle_struct *handle, connection_struct *conn, const char *fname, int flags, mode_t mode) +{ + return SMB_VFS_NEXT_OPEN(handle, conn, fname, flags, mode); +} + +static int skel_close(vfs_handle_struct *handle, files_struct *fsp, int fd) +{ + return SMB_VFS_NEXT_CLOSE(handle, fsp, fd); +} + +static ssize_t skel_read(vfs_handle_struct *handle, files_struct *fsp, int fd, void *data, size_t n) +{ + return SMB_VFS_NEXT_READ(handle, fsp, fd, data, n); +} + +static ssize_t skel_write(vfs_handle_struct *handle, files_struct *fsp, int fd, const void *data, size_t n) +{ + return SMB_VFS_NEXT_WRITE(handle, fsp, fd, data, n); +} + +static SMB_OFF_T skel_lseek(vfs_handle_struct *handle, files_struct *fsp, int filedes, SMB_OFF_T offset, int whence) +{ + return SMB_VFS_NEXT_LSEEK(handle, fsp, filedes, offset, whence); +} + +static int skel_rename(vfs_handle_struct *handle, connection_struct *conn, const char *old, const char *new) +{ + return SMB_VFS_NEXT_RENAME(handle, conn, old, new); +} + +static int skel_fsync(vfs_handle_struct *handle, files_struct *fsp, int fd) +{ + return SMB_VFS_NEXT_FSYNC(handle, fsp, fd); +} + +static int skel_stat(vfs_handle_struct *handle, connection_struct *conn, const char *fname, SMB_STRUCT_STAT *sbuf) +{ + return SMB_VFS_NEXT_STAT(handle, conn, fname, sbuf); +} + +static int skel_fstat(vfs_handle_struct *handle, files_struct *fsp, int fd, SMB_STRUCT_STAT *sbuf) +{ + return SMB_VFS_NEXT_FSTAT(handle, fsp, fd, sbuf); +} + +static int skel_lstat(vfs_handle_struct *handle, connection_struct *conn, const char *path, SMB_STRUCT_STAT *sbuf) +{ + return SMB_VFS_NEXT_LSTAT(handle, conn, path, sbuf); +} + +static int skel_unlink(vfs_handle_struct *handle, connection_struct *conn, const char *path) +{ + return SMB_VFS_NEXT_UNLINK(handle, conn, path); +} + +static int skel_chmod(vfs_handle_struct *handle, connection_struct *conn, const char *path, mode_t mode) +{ + return SMB_VFS_NEXT_CHMOD(handle, conn, path, mode); +} + +static int skel_fchmod(vfs_handle_struct *handle, files_struct *fsp, int fd, mode_t mode) +{ + return SMB_VFS_NEXT_FCHMOD(handle, fsp, fd, mode); +} + +static int skel_chown(vfs_handle_struct *handle, connection_struct *conn, const char *path, uid_t uid, gid_t gid) +{ + return SMB_VFS_NEXT_CHOWN(handle, conn, path, uid, gid); +} + +static int skel_fchown(vfs_handle_struct *handle, files_struct *fsp, int fd, uid_t uid, gid_t gid) +{ + return SMB_VFS_NEXT_FCHOWN(handle, fsp, fd, uid, gid); +} + +static int skel_chdir(vfs_handle_struct *handle, connection_struct *conn, const char *path) +{ + return SMB_VFS_NEXT_CHDIR(handle, conn, path); +} + +static char *skel_getwd(vfs_handle_struct *handle, connection_struct *conn, char *buf) +{ + return SMB_VFS_NEXT_GETWD(handle, conn, buf); +} + +static int skel_utime(vfs_handle_struct *handle, connection_struct *conn, const char *path, struct utimbuf *times) +{ + return SMB_VFS_NEXT_UTIME(handle, conn, path, times); +} + +static int skel_ftruncate(vfs_handle_struct *handle, files_struct *fsp, int fd, SMB_OFF_T offset) +{ + return SMB_VFS_NEXT_FTRUNCATE(handle, fsp, fd, 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) +{ + return SMB_VFS_NEXT_LOCK(handle, fsp, fd, op, offset, count, type); +} + +static BOOL skel_symlink(vfs_handle_struct *handle, connection_struct *conn, const char *oldpath, const char *newpath) +{ + return SMB_VFS_NEXT_SYMLINK(handle, conn, oldpath, newpath); +} + +static BOOL skel_readlink(vfs_handle_struct *handle, connection_struct *conn, const char *path, char *buf, size_t bufsiz) +{ + return SMB_VFS_NEXT_READLINK(handle, conn, path, buf, bufsiz); +} + +static int skel_link(vfs_handle_struct *handle, connection_struct *conn, const char *oldpath, const char *newpath) +{ + return SMB_VFS_NEXT_LINK(handle, conn, oldpath, newpath); +} + +static int skel_mknod(vfs_handle_struct *handle, connection_struct *conn, const char *path, mode_t mode, SMB_DEV_T dev) +{ + return SMB_VFS_NEXT_MKNOD(handle, conn, path, mode, dev); +} + +static char *skel_realpath(vfs_handle_struct *handle, connection_struct *conn, const char *path, char *resolved_path) +{ + return SMB_VFS_NEXT_REALPATH(handle, conn, path, resolved_path); +} + +static size_t skel_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp, int fd, uint32 security_info, struct security_descriptor_info **ppdesc) +{ + return SMB_VFS_NEXT_FGET_NT_ACL(handle, fsp, fd, security_info, ppdesc); +} + +static size_t skel_get_nt_acl(vfs_handle_struct *handle, files_struct *fsp, const char *name, uint32 security_info, struct security_descriptor_info **ppdesc) +{ + return SMB_VFS_NEXT_GET_NT_ACL(handle, fsp, name, security_info, ppdesc); +} + +static BOOL skel_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp, int fd, uint32 security_info_sent, struct security_descriptor_info *psd) +{ + return SMB_VFS_NEXT_FSET_NT_ACL(handle, fsp, fd, security_info_sent, psd); +} + +static BOOL skel_set_nt_acl(vfs_handle_struct *handle, files_struct *fsp, const char *name, uint32 security_info_sent, struct security_descriptor_info *psd) +{ + return SMB_VFS_NEXT_SET_NT_ACL(handle, fsp, name, security_info_sent, psd); +} + +static int skel_chmod_acl(vfs_handle_struct *handle, connection_struct *conn, const char *name, mode_t mode) +{ + /* If the underlying VFS doesn't have ACL support... */ + if (!handle->vfs_next.ops.chmod_acl) { + errno = ENOSYS; + return -1; + } + return SMB_VFS_NEXT_CHMOD_ACL(handle, conn, name, mode); +} + +static int skel_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp, int fd, mode_t mode) +{ + /* If the underlying VFS doesn't have ACL support... */ + if (!handle->vfs_next.ops.fchmod_acl) { + errno = ENOSYS; + return -1; + } + return SMB_VFS_NEXT_FCHMOD_ACL(handle, fsp, fd, mode); +} + +static int skel_sys_acl_get_entry(vfs_handle_struct *handle, connection_struct *conn, SMB_ACL_T theacl, int entry_id, SMB_ACL_ENTRY_T *entry_p) +{ + return SMB_VFS_NEXT_SYS_ACL_GET_ENTRY(handle, conn, theacl, entry_id, entry_p); +} + +static int skel_sys_acl_get_tag_type(vfs_handle_struct *handle, connection_struct *conn, SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T *tag_type_p) +{ + return SMB_VFS_NEXT_SYS_ACL_GET_TAG_TYPE(handle, conn, entry_d, tag_type_p); +} + +static int skel_sys_acl_get_permset(vfs_handle_struct *handle, connection_struct *conn, SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T *permset_p) +{ + return SMB_VFS_NEXT_SYS_ACL_GET_PERMSET(handle, conn, entry_d, permset_p); +} + +static void *skel_sys_acl_get_qualifier(vfs_handle_struct *handle, connection_struct *conn, SMB_ACL_ENTRY_T entry_d) +{ + return SMB_VFS_NEXT_SYS_ACL_GET_QUALIFIER(handle, conn, entry_d); +} + +static SMB_ACL_T skel_sys_acl_get_file(vfs_handle_struct *handle, connection_struct *conn, const char *path_p, SMB_ACL_TYPE_T type) +{ + return SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, conn, path_p, type); +} + +static SMB_ACL_T skel_sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp, int fd) +{ + return SMB_VFS_NEXT_SYS_ACL_GET_FD(handle, fsp, fd); +} + +static int skel_sys_acl_clear_perms(vfs_handle_struct *handle, connection_struct *conn, SMB_ACL_PERMSET_T permset) +{ + return SMB_VFS_NEXT_SYS_ACL_CLEAR_PERMS(handle, conn, permset); +} + +static int skel_sys_acl_add_perm(vfs_handle_struct *handle, connection_struct *conn, SMB_ACL_PERMSET_T permset, SMB_ACL_PERM_T perm) +{ + return SMB_VFS_NEXT_SYS_ACL_ADD_PERM(handle, conn, permset, perm); +} + +static char *skel_sys_acl_to_text(vfs_handle_struct *handle, connection_struct *conn, SMB_ACL_T theacl, ssize_t *plen) +{ + return SMB_VFS_NEXT_SYS_ACL_TO_TEXT(handle, conn, theacl, plen); +} + +static SMB_ACL_T skel_sys_acl_init(vfs_handle_struct *handle, connection_struct *conn, int count) +{ + return SMB_VFS_NEXT_SYS_ACL_INIT(handle, conn, count); +} + +static int skel_sys_acl_create_entry(vfs_handle_struct *handle, connection_struct *conn, SMB_ACL_T *pacl, SMB_ACL_ENTRY_T *pentry) +{ + return SMB_VFS_NEXT_SYS_ACL_CREATE_ENTRY(handle, conn, pacl, pentry); +} + +static int skel_sys_acl_set_tag_type(vfs_handle_struct *handle, connection_struct *conn, SMB_ACL_ENTRY_T entry, SMB_ACL_TAG_T tagtype) +{ + return SMB_VFS_NEXT_SYS_ACL_SET_TAG_TYPE(handle, conn, entry, tagtype); +} + +static int skel_sys_acl_set_qualifier(vfs_handle_struct *handle, connection_struct *conn, SMB_ACL_ENTRY_T entry, void *qual) +{ + return SMB_VFS_NEXT_SYS_ACL_SET_QUALIFIER(handle, conn, entry, qual); +} + +static int skel_sys_acl_set_permset(vfs_handle_struct *handle, connection_struct *conn, SMB_ACL_ENTRY_T entry, SMB_ACL_PERMSET_T permset) +{ + return SMB_VFS_NEXT_SYS_ACL_SET_PERMSET(handle, conn, entry, permset); +} + +static int skel_sys_acl_valid(vfs_handle_struct *handle, connection_struct *conn, SMB_ACL_T theacl ) +{ + return SMB_VFS_NEXT_SYS_ACL_VALID(handle, conn, theacl); +} + +static int skel_sys_acl_set_file(vfs_handle_struct *handle, connection_struct *conn, const char *name, SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl) +{ + return SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, conn, name, acltype, theacl); +} + +static int skel_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp, int fd, SMB_ACL_T theacl) +{ + return SMB_VFS_NEXT_SYS_ACL_SET_FD(handle, fsp, fd, theacl); +} + +static int skel_sys_acl_delete_def_file(vfs_handle_struct *handle, connection_struct *conn, const char *path) +{ + return SMB_VFS_NEXT_SYS_ACL_DELETE_DEF_FILE(handle, conn, path); +} + +static int skel_sys_acl_get_perm(vfs_handle_struct *handle, connection_struct *conn, SMB_ACL_PERMSET_T permset, SMB_ACL_PERM_T perm) +{ + return SMB_VFS_NEXT_SYS_ACL_GET_PERM(handle, conn, permset, perm); +} + +static int skel_sys_acl_free_text(vfs_handle_struct *handle, connection_struct *conn, char *text) +{ + return SMB_VFS_NEXT_SYS_ACL_FREE_TEXT(handle, conn, text); +} + +static int skel_sys_acl_free_acl(vfs_handle_struct *handle, connection_struct *conn, SMB_ACL_T posix_acl) +{ + return SMB_VFS_NEXT_SYS_ACL_FREE_ACL(handle, conn, posix_acl); +} + +static int skel_sys_acl_free_qualifier(vfs_handle_struct *handle, connection_struct *conn, void *qualifier, SMB_ACL_TAG_T tagtype) +{ + return SMB_VFS_NEXT_SYS_ACL_FREE_QUALIFIER(handle, conn, qualifier, tagtype); +} + + +/* VFS operations structure */ + +static vfs_op_tuple skel_op_tuples[] = { + + /* Disk operations */ + + {SMB_VFS_OP(skel_connect), SMB_VFS_OP_CONNECT, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_disconnect), SMB_VFS_OP_DISCONNECT, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_disk_free), SMB_VFS_OP_DISK_FREE, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_get_quota), SMB_VFS_OP_GET_QUOTA, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_set_quota), SMB_VFS_OP_SET_QUOTA, SMB_VFS_LAYER_TRANSPARENT}, + + /* Directory operations */ + + {SMB_VFS_OP(skel_opendir), SMB_VFS_OP_OPENDIR, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_readdir), SMB_VFS_OP_READDIR, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_mkdir), SMB_VFS_OP_MKDIR, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_rmdir), SMB_VFS_OP_RMDIR, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_closedir), SMB_VFS_OP_CLOSEDIR, SMB_VFS_LAYER_TRANSPARENT}, + + /* File operations */ + + {SMB_VFS_OP(skel_open), SMB_VFS_OP_OPEN, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_close), SMB_VFS_OP_CLOSE, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_read), SMB_VFS_OP_READ, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_write), SMB_VFS_OP_WRITE, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_lseek), SMB_VFS_OP_LSEEK, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_rename), SMB_VFS_OP_RENAME, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_fsync), SMB_VFS_OP_FSYNC, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_stat), SMB_VFS_OP_STAT, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_fstat), SMB_VFS_OP_FSTAT, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_lstat), SMB_VFS_OP_LSTAT, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_unlink), SMB_VFS_OP_UNLINK, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_chmod), SMB_VFS_OP_CHMOD, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_fchmod), SMB_VFS_OP_FCHMOD, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_chown), SMB_VFS_OP_CHOWN, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_fchown), SMB_VFS_OP_FCHOWN, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_chdir), SMB_VFS_OP_CHDIR, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_getwd), SMB_VFS_OP_GETWD, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_utime), SMB_VFS_OP_UTIME, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_ftruncate), SMB_VFS_OP_FTRUNCATE, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_lock), SMB_VFS_OP_LOCK, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_symlink), SMB_VFS_OP_SYMLINK, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_readlink), SMB_VFS_OP_READLINK, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_link), SMB_VFS_OP_LINK, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_mknod), SMB_VFS_OP_MKNOD, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_realpath), SMB_VFS_OP_REALPATH, SMB_VFS_LAYER_TRANSPARENT}, + + /* NT File ACL operations */ + + {SMB_VFS_OP(skel_fget_nt_acl), SMB_VFS_OP_FGET_NT_ACL, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_get_nt_acl), SMB_VFS_OP_GET_NT_ACL, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_fset_nt_acl), SMB_VFS_OP_FSET_NT_ACL, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_set_nt_acl), SMB_VFS_OP_SET_NT_ACL, SMB_VFS_LAYER_TRANSPARENT}, + + /* POSIX ACL operations */ + + {SMB_VFS_OP(skel_chmod_acl), SMB_VFS_OP_CHMOD_ACL, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_fchmod_acl), SMB_VFS_OP_FCHMOD_ACL, SMB_VFS_LAYER_TRANSPARENT}, + + {SMB_VFS_OP(skel_sys_acl_get_entry), SMB_VFS_OP_SYS_ACL_GET_ENTRY, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_sys_acl_get_tag_type), SMB_VFS_OP_SYS_ACL_GET_TAG_TYPE, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_sys_acl_get_permset), SMB_VFS_OP_SYS_ACL_GET_PERMSET, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_sys_acl_get_qualifier), SMB_VFS_OP_SYS_ACL_GET_QUALIFIER, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_sys_acl_get_file), SMB_VFS_OP_SYS_ACL_GET_FILE, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_sys_acl_get_fd), SMB_VFS_OP_SYS_ACL_GET_FD, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_sys_acl_clear_perms), SMB_VFS_OP_SYS_ACL_CLEAR_PERMS, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_sys_acl_add_perm), SMB_VFS_OP_SYS_ACL_ADD_PERM, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_sys_acl_to_text), SMB_VFS_OP_SYS_ACL_TO_TEXT, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_sys_acl_init), SMB_VFS_OP_SYS_ACL_INIT, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_sys_acl_create_entry), SMB_VFS_OP_SYS_ACL_CREATE_ENTRY, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_sys_acl_set_tag_type), SMB_VFS_OP_SYS_ACL_SET_TAG_TYPE, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_sys_acl_set_qualifier), SMB_VFS_OP_SYS_ACL_SET_QUALIFIER, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_sys_acl_set_permset), SMB_VFS_OP_SYS_ACL_SET_PERMSET, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_sys_acl_valid), SMB_VFS_OP_SYS_ACL_VALID, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_sys_acl_set_file), SMB_VFS_OP_SYS_ACL_SET_FILE, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_sys_acl_set_fd), SMB_VFS_OP_SYS_ACL_SET_FD, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_sys_acl_delete_def_file), SMB_VFS_OP_SYS_ACL_DELETE_DEF_FILE, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_sys_acl_get_perm), SMB_VFS_OP_SYS_ACL_GET_PERM, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_sys_acl_free_text), SMB_VFS_OP_SYS_ACL_FREE_TEXT, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_sys_acl_free_acl), SMB_VFS_OP_SYS_ACL_FREE_ACL, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_sys_acl_free_qualifier), SMB_VFS_OP_SYS_ACL_FREE_QUALIFIER, SMB_VFS_LAYER_TRANSPARENT}, + + {NULL, SMB_VFS_OP_NOOP, SMB_VFS_LAYER_NOOP} +}; + +NTSTATUS init_module(void) +{ + return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "skel_transparent", skel_op_tuples); +} -- cgit From de3f1c77677c80cb27688521b39c5325bb4e3bd7 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 6 Jun 2003 07:09:30 +0000 Subject: Make skeleton VFSs compile with new EA modules. Jeremy (This used to be commit 7c4cc2086d59e163ab89366c24ba399994a49462) --- examples/VFS/configure.in | 78 +++++++++++++++++++++++++++++++++++++ examples/VFS/skel_opaque.c | 86 +++++++++++++++++++++++++++++++++++++++++ examples/VFS/skel_transparent.c | 74 +++++++++++++++++++++++++++++++++++ 3 files changed, 238 insertions(+) (limited to 'examples/VFS') diff --git a/examples/VFS/configure.in b/examples/VFS/configure.in index 8e6c517fed..a0d1dc9630 100644 --- a/examples/VFS/configure.in +++ b/examples/VFS/configure.in @@ -83,6 +83,84 @@ then CFLAGS="-O ${CFLAGS}" fi + ################################################# + # check for krb5-config from recent MIT and Heimdal kerberos 5 + AC_PATH_PROG(KRB5_CONFIG, krb5-config) + AC_MSG_CHECKING(for working krb5-config) + if test -x "$KRB5_CONFIG"; then + CFLAGS="$CFLAGS `$KRB5_CONFIG --cflags | sed s/@INCLUDE_des@//`" + CPPFLAGS="$CPPFLAGS `$KRB5_CONFIG --cflags | sed s/@INCLUDE_des@//`" + FOUND_KRB5=yes + AC_MSG_RESULT(yes) + else + AC_MSG_RESULT(no. Fallback to previous krb5 detection strategy) + fi + + if test x$FOUND_KRB5 = x"no"; then + ################################################# + # check for location of Kerberos 5 install + AC_MSG_CHECKING(for kerberos 5 install path) + AC_ARG_WITH(krb5, + [ --with-krb5=base-dir Locate Kerberos 5 support (default=/usr)], + [ case "$withval" in + no) + AC_MSG_RESULT(no) + ;; + *) + AC_MSG_RESULT(yes) + CFLAGS="$CFLAGS -I$withval/include" + CPPFLAGS="$CPPFLAGS -I$withval/include" + FOUND_KRB5=yes + ;; + esac ], + AC_MSG_RESULT(no) + ) + fi + +if test x$FOUND_KRB5 = x"no"; then +################################################# +# see if this box has the SuSE location for the heimdal kerberos implementation +AC_MSG_CHECKING(for /usr/include/heimdal) +if test -d /usr/include/heimdal; then + if test -f /usr/lib/heimdal/lib/libkrb5.a; then + CFLAGS="$CFLAGS -I/usr/include/heimdal" + CPPFLAGS="$CPPFLAGS -I/usr/include/heimdal" + AC_MSG_RESULT(yes) + else + CFLAGS="$CFLAGS -I/usr/include/heimdal" + CPPFLAGS="$CPPFLAGS -I/usr/include/heimdal" + AC_MSG_RESULT(yes) + + fi +else + AC_MSG_RESULT(no) +fi +fi + + +if test x$FOUND_KRB5 = x"no"; then +################################################# +# see if this box has the RedHat location for kerberos +AC_MSG_CHECKING(for /usr/kerberos) +if test -d /usr/kerberos -a -f /usr/kerberos/lib/libkrb5.a; then + LDFLAGS="$LDFLAGS -L/usr/kerberos/lib" + CFLAGS="$CFLAGS -I/usr/kerberos/include" + CPPFLAGS="$CPPFLAGS -I/usr/kerberos/include" + AC_MSG_RESULT(yes) +else + AC_MSG_RESULT(no) +fi +fi + + # now check for krb5.h. Some systems have the libraries without the headers! + # note that this check is done here to allow for different kerberos + # include paths + AC_CHECK_HEADERS(krb5.h) + + # now check for gssapi headers. This is also done here to allow for + # different kerberos include paths + AC_CHECK_HEADERS(gssapi.h gssapi/gssapi_generic.h gssapi/gssapi.h com_err.h) + #dnl Check if we use GNU ld #LD=ld #AC_PROG_LD_GNU diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index c985ec44fd..e507dc1094 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -384,6 +384,78 @@ static int skel_sys_acl_free_qualifier(vfs_handle_struct *handle, connection_str return -1; } +static ssize_t skel_getxattr(vfs_handle_struct *handle, struct connection_struct *conn,const char *path, const char *name, void *value, size_t size) +{ + errno = ENOSYS; + return -1; +} + +static ssize_t skel_lgetxattr(vfs_handle_struct *handle, struct connection_struct *conn,const char *path, const char *name, void *value, size_t +size) +{ + errno = ENOSYS; + return -1; +} + +static ssize_t skel_fgetxattr(vfs_handle_struct *handle, struct files_struct *fsp,int fd, const char *name, void *value, size_t size) +{ + errno = ENOSYS; + return -1; +} + +static ssize_t skel_listxattr(vfs_handle_struct *handle, struct connection_struct *conn,const char *path, char *list, size_t size) +{ + errno = ENOSYS; + return -1; +} + +static ssize_t skel_llistxattr(vfs_handle_struct *handle, struct connection_struct *conn,const char *path, char *list, size_t size) +{ + errno = ENOSYS; + return -1; +} + +static ssize_t skel_flistxattr(vfs_handle_struct *handle, struct files_struct *fsp,int fd, char *list, size_t size) +{ + errno = ENOSYS; + return -1; +} + +static int skel_removexattr(vfs_handle_struct *handle, struct connection_struct *conn,const char *path, const char *name) +{ + errno = ENOSYS; + return -1; +} + +static int skel_lremovexattr(vfs_handle_struct *handle, struct connection_struct *conn,const char *path, const char *name) +{ + errno = ENOSYS; + return -1; +} + +static int skel_fremovexattr(vfs_handle_struct *handle, struct files_struct *fsp,int fd, const char *name) +{ + errno = ENOSYS; + return -1; +} + +static int skel_setxattr(vfs_handle_struct *handle, struct connection_struct *conn,const char *path, const char *name, const void *value, size_t size, int flags) +{ + errno = ENOSYS; + return -1; +} + +static int skel_lsetxattr(vfs_handle_struct *handle, struct connection_struct *conn,const char *path, const char *name, const void *value, size_t size, int flags) +{ + errno = ENOSYS; + return -1; +} + +static int skel_fsetxattr(vfs_handle_struct *handle, struct files_struct *fsp,int fd, const char *name, const void *value, size_t size, int flags) +{ + errno = ENOSYS; + return -1; +} /* VFS operations structure */ @@ -468,6 +540,20 @@ static vfs_op_tuple skel_op_tuples[] = { {SMB_VFS_OP(skel_sys_acl_free_acl), SMB_VFS_OP_SYS_ACL_FREE_ACL, SMB_VFS_LAYER_OPAQUE}, {SMB_VFS_OP(skel_sys_acl_free_qualifier), SMB_VFS_OP_SYS_ACL_FREE_QUALIFIER, SMB_VFS_LAYER_OPAQUE}, + /* EA operations. */ + {SMB_VFS_OP(skel_getxattr), SMB_VFS_OP_GETXATTR, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_lgetxattr), SMB_VFS_OP_LGETXATTR, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_fgetxattr), SMB_VFS_OP_FGETXATTR, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_listxattr), SMB_VFS_OP_LISTXATTR, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_llistxattr), SMB_VFS_OP_LLISTXATTR, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_flistxattr), SMB_VFS_OP_FLISTXATTR, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_removexattr), SMB_VFS_OP_REMOVEXATTR, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_lremovexattr), SMB_VFS_OP_LREMOVEXATTR, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_fremovexattr), SMB_VFS_OP_FREMOVEXATTR, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_setxattr), SMB_VFS_OP_SETXATTR, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_lsetxattr), SMB_VFS_OP_LSETXATTR, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_fsetxattr), SMB_VFS_OP_FSETXATTR, SMB_VFS_LAYER_OPAQUE}, + {NULL, SMB_VFS_OP_NOOP, SMB_VFS_LAYER_NOOP} }; diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c index 3a967470a8..b2db76c9f9 100644 --- a/examples/VFS/skel_transparent.c +++ b/examples/VFS/skel_transparent.c @@ -365,6 +365,66 @@ static int skel_sys_acl_free_qualifier(vfs_handle_struct *handle, connection_str return SMB_VFS_NEXT_SYS_ACL_FREE_QUALIFIER(handle, conn, qualifier, tagtype); } +static ssize_t skel_getxattr(vfs_handle_struct *handle, struct connection_struct *conn,const char *path, const char *name, void *value, size_t size) +{ + return SMB_VFS_NEXT_GETXATTR(handle, conn, path, name, value, size); +} + +static ssize_t skel_lgetxattr(vfs_handle_struct *handle, struct connection_struct *conn,const char *path, const char *name, void *value, size_t +size) +{ + return SMB_VFS_NEXT_LGETXATTR(handle, conn, path, name, value, size); +} + +static ssize_t skel_fgetxattr(vfs_handle_struct *handle, struct files_struct *fsp,int fd, const char *name, void *value, size_t size) +{ + return SMB_VFS_NEXT_FGETXATTR(handle, fsp, fd, name, value, size); +} + +static ssize_t skel_listxattr(vfs_handle_struct *handle, struct connection_struct *conn,const char *path, char *list, size_t size) +{ + return SMB_VFS_NEXT_LISTXATTR(handle, conn, path, list, size); +} + +static ssize_t skel_llistxattr(vfs_handle_struct *handle, struct connection_struct *conn,const char *path, char *list, size_t size) +{ + return SMB_VFS_NEXT_LLISTXATTR(handle, conn, path, list, size); +} + +static ssize_t skel_flistxattr(vfs_handle_struct *handle, struct files_struct *fsp,int fd, char *list, size_t size) +{ + return SMB_VFS_NEXT_FLISTXATTR(handle, fsp, fd, list, size); +} + +static int skel_removexattr(vfs_handle_struct *handle, struct connection_struct *conn,const char *path, const char *name) +{ + return SMB_VFS_NEXT_REMOVEXATTR(handle, conn, path, name); +} + +static int skel_lremovexattr(vfs_handle_struct *handle, struct connection_struct *conn,const char *path, const char *name) +{ + return SMB_VFS_NEXT_LREMOVEXATTR(handle, conn, path, name); +} + +static int skel_fremovexattr(vfs_handle_struct *handle, struct files_struct *fsp,int fd, const char *name) +{ + return SMB_VFS_NEXT_FREMOVEXATTR(handle, fsp, fd, name); +} + +static int skel_setxattr(vfs_handle_struct *handle, struct connection_struct *conn,const char *path, const char *name, const void *value, size_t size, int flags) +{ + return SMB_VFS_NEXT_SETXATTR(handle, conn, path, name, value, size, flags); +} + +static int skel_lsetxattr(vfs_handle_struct *handle, struct connection_struct *conn,const char *path, const char *name, const void *value, size_t size, int flags) +{ + return SMB_VFS_NEXT_LSETXATTR(handle, conn, path, name, value, size, flags); +} + +static int skel_fsetxattr(vfs_handle_struct *handle, struct files_struct *fsp,int fd, const char *name, const void *value, size_t size, int flags) +{ + return SMB_VFS_NEXT_FSETXATTR(handle, fsp, fd, name, value, size, flags); +} /* VFS operations structure */ @@ -449,6 +509,20 @@ static vfs_op_tuple skel_op_tuples[] = { {SMB_VFS_OP(skel_sys_acl_free_acl), SMB_VFS_OP_SYS_ACL_FREE_ACL, SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(skel_sys_acl_free_qualifier), SMB_VFS_OP_SYS_ACL_FREE_QUALIFIER, SMB_VFS_LAYER_TRANSPARENT}, + /* EA operations. */ + {SMB_VFS_OP(skel_getxattr), SMB_VFS_OP_GETXATTR, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_lgetxattr), SMB_VFS_OP_LGETXATTR, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_fgetxattr), SMB_VFS_OP_FGETXATTR, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_listxattr), SMB_VFS_OP_LISTXATTR, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_llistxattr), SMB_VFS_OP_LLISTXATTR, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_flistxattr), SMB_VFS_OP_FLISTXATTR, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_removexattr), SMB_VFS_OP_REMOVEXATTR, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_lremovexattr), SMB_VFS_OP_LREMOVEXATTR, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_fremovexattr), SMB_VFS_OP_FREMOVEXATTR, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_setxattr), SMB_VFS_OP_SETXATTR, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_lsetxattr), SMB_VFS_OP_LSETXATTR, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_fsetxattr), SMB_VFS_OP_FSETXATTR, SMB_VFS_LAYER_TRANSPARENT}, + {NULL, SMB_VFS_OP_NOOP, SMB_VFS_LAYER_NOOP} }; -- cgit From 4d48737782cb2d9434e2722f3827a5c1bac29d53 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 7 Aug 2003 21:49:01 +0000 Subject: Test modules for shadow copy by "Stefan (metze) Metzmacher" . Jeremy. (This used to be commit 3f8c77b116b96b01fd333c4b45d84666ef108fe9) --- examples/VFS/skel_opaque.c | 8 +++++++- examples/VFS/skel_transparent.c | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) (limited to 'examples/VFS') diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index e507dc1094..de82801d85 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -66,6 +66,11 @@ static int skel_set_quota(vfs_handle_struct *handle, connection_struct *conn, en return vfswrap_set_quota(NULL, conn, qtype, id, dq); } +static int skel_get_shadow_copy_data(vfs_handle_struct *handle, files_struct *fsp, SHADOW_COPY_DATA *shadow_copy_data, BOOL labels) +{ + return vfswrap_get_shadow_copy_data(NULL, fsp, shadow_copy_data, labels); +} + static DIR *skel_opendir(vfs_handle_struct *handle, connection_struct *conn, const char *fname) { return vfswrap_opendir(NULL, conn, fname); @@ -468,7 +473,8 @@ static vfs_op_tuple skel_op_tuples[] = { {SMB_VFS_OP(skel_disk_free), SMB_VFS_OP_DISK_FREE, SMB_VFS_LAYER_OPAQUE}, {SMB_VFS_OP(skel_get_quota), SMB_VFS_OP_GET_QUOTA, SMB_VFS_LAYER_OPAQUE}, {SMB_VFS_OP(skel_set_quota), SMB_VFS_OP_SET_QUOTA, SMB_VFS_LAYER_OPAQUE}, - + {SMB_VFS_OP(skel_get_shadow_copy_data), SMB_VFS_OP_GET_SHADOW_COPY_DATA,SMB_VFS_LAYER_OPAQUE}, + /* Directory operations */ {SMB_VFS_OP(skel_opendir), SMB_VFS_OP_OPENDIR, SMB_VFS_LAYER_OPAQUE}, diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c index b2db76c9f9..7a326741c5 100644 --- a/examples/VFS/skel_transparent.c +++ b/examples/VFS/skel_transparent.c @@ -65,6 +65,11 @@ static int skel_set_quota(vfs_handle_struct *handle, connection_struct *conn, en return SMB_VFS_NEXT_SET_QUOTA(handle, conn, qtype, id, dq); } +static int skel_get_shadow_copy_data(vfs_handle_struct *handle, files_struct *fsp, SHADOW_COPY_DATA *shadow_copy_data, BOOL labels) +{ + return SMB_VFS_NEXT_GET_SHADOW_COPY_DATA(handle, fsp, shadow_copy_data, labels); +} + static DIR *skel_opendir(vfs_handle_struct *handle, connection_struct *conn, const char *fname) { return SMB_VFS_NEXT_OPENDIR(handle, conn, fname); @@ -437,7 +442,8 @@ static vfs_op_tuple skel_op_tuples[] = { {SMB_VFS_OP(skel_disk_free), SMB_VFS_OP_DISK_FREE, SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(skel_get_quota), SMB_VFS_OP_GET_QUOTA, SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(skel_set_quota), SMB_VFS_OP_SET_QUOTA, SMB_VFS_LAYER_TRANSPARENT}, - + {SMB_VFS_OP(skel_get_shadow_copy_data), SMB_VFS_OP_GET_SHADOW_COPY_DATA,SMB_VFS_LAYER_TRANSPARENT}, + /* Directory operations */ {SMB_VFS_OP(skel_opendir), SMB_VFS_OP_OPENDIR, SMB_VFS_LAYER_TRANSPARENT}, -- cgit From 11bf0c0b2310e0c6ef7f0c99eec5647001a63c54 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 8 Aug 2003 00:53:46 +0000 Subject: Added by request of "Stefan (metze) Metzmacher" . Jeremy. (This used to be commit 80e14b176526a3038ea03214fc3dd0fd00fef922) --- examples/VFS/shadow_copy_test.c | 83 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 examples/VFS/shadow_copy_test.c (limited to 'examples/VFS') diff --git a/examples/VFS/shadow_copy_test.c b/examples/VFS/shadow_copy_test.c new file mode 100644 index 0000000000..d2b7206cd3 --- /dev/null +++ b/examples/VFS/shadow_copy_test.c @@ -0,0 +1,83 @@ +/* + * TEST implementation of an Shadow Copy module + * + * Copyright (C) Stefan Metzmacher 2003 + * + * 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. + */ + +#include "includes.h" + +#undef DBGC_CLASS +#define DBGC_CLASS DBGC_VFS + +/* USE THIS MODULE ONLY FOR TESTING!!!! */ + +/* + For this share + Z:\ + + the ShadowCopies are in this directories + + Z:\@GMT-2003.08.05-12.00.00\ + Z:\@GMT-2003.08.05-12.01.00\ + Z:\@GMT-2003.08.05-12.02.00\ + + e.g. + + Z:\testfile.txt + Z:\@GMT-2003.08.05-12.02.00\testfile.txt + + or: + + Z:\testdir\testfile.txt + Z:\@GMT-2003.08.05-12.02.00\testdir\testfile.txt + + + Note: Files must differ to be displayed via Windows Explorer! + Directories are always displayed... +*/ + +static int test_get_shadow_copy_data(vfs_handle_struct *handle, files_struct *fsp, SHADOW_COPY_DATA *shadow_copy_data, BOOL labels) +{ + uint32 num = 3; + uint32 i; + + shadow_copy_data->num_volumes = num; + + if (labels) { + shadow_copy_data->labels = (SHADOW_COPY_LABEL *)talloc_zero(shadow_copy_data->mem_ctx,(num)*sizeof(SHADOW_COPY_LABEL)); + for (i=0;ilabels[i], sizeof(SHADOW_COPY_LABEL), "@GMT-2003.08.05-12.%02u.00",i); + } + } else { + shadow_copy_data->labels = NULL; + } + + return 0; +} + +/* VFS operations structure */ + +static vfs_op_tuple shadow_copy_test_ops[] = { + {SMB_VFS_OP(test_get_shadow_copy_data), SMB_VFS_OP_GET_SHADOW_COPY_DATA,SMB_VFS_LAYER_OPAQUE}, + + {SMB_VFS_OP(NULL), SMB_VFS_OP_NOOP, SMB_VFS_LAYER_NOOP} +}; + +NTSTATUS init_module(void) +{ + return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "shadow_copy_test", shadow_copy_test_ops); +} -- cgit From f6c798f4cc923f3f2d8d61f8a94ee1facc57aa58 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Fri, 5 Dec 2003 11:12:05 +0000 Subject: Change PICFLAG -> PICFLAGS to keep in line with version from source directory and fix display bug. (This used to be commit f43546d0af7c7ad74b3bf0bae1652822184a04da) --- examples/VFS/configure.in | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'examples/VFS') diff --git a/examples/VFS/configure.in b/examples/VFS/configure.in index a0d1dc9630..68931ad3d8 100644 --- a/examples/VFS/configure.in +++ b/examples/VFS/configure.in @@ -53,7 +53,7 @@ AC_SUBST(LDSHFLAGS) AC_SUBST(SONAMEFLAG) AC_SUBST(SHLD) AC_SUBST(HOST_OS) -AC_SUBST(PICFLAG) +AC_SUBST(PICFLAGS) AC_SUBST(PICSUFFIX) AC_SUBST(POBAD_CC) AC_SUBST(SHLIBEXT) @@ -179,7 +179,7 @@ HOST_OS="$host_os" LDSHFLAGS="-shared" SONAMEFLAG="#" SHLD="\${CC}" -PICFLAG="" +PICFLAGS="" PICSUFFIX="po" POBAD_CC="#" SHLIBEXT="so" @@ -197,7 +197,7 @@ if test "$enable_shared" = "yes"; then BLDSHARED="true" LDSHFLAGS="-shared" DYNEXP="-Wl,--export-dynamic" - PICFLAG="-fPIC" + PICFLAGS="-fPIC" SONAMEFLAG="-Wl,-soname=" ;; *solaris*) @@ -205,12 +205,12 @@ if test "$enable_shared" = "yes"; then LDSHFLAGS="-G" SONAMEFLAG="-h " if test "${GCC}" = "yes"; then - PICFLAG="-fPIC" + PICFLAGS="-fPIC" if test "${ac_cv_prog_gnu_ld}" = "yes"; then DYNEXP="-Wl,-E" fi else - PICFLAG="-KPIC" + PICFLAGS="-KPIC" ## ${CFLAGS} added for building 64-bit shared ## libs using Sun's Compiler LDSHFLAGS="-G \${CFLAGS}" @@ -222,19 +222,19 @@ if test "$enable_shared" = "yes"; then BLDSHARED="true" LDSHFLAGS="-G" SONAMEFLAG="-Wl,-h," - PICFLAG="-KPIC" # Is this correct for SunOS + PICFLAGS="-KPIC" # Is this correct for SunOS ;; *netbsd* | *freebsd*) BLDSHARED="true" LDSHFLAGS="-shared" DYNEXP="-Wl,--export-dynamic" SONAMEFLAG="-Wl,-soname," - PICFLAG="-fPIC -DPIC" + PICFLAGS="-fPIC -DPIC" ;; *openbsd*) BLDSHARED="true" LDSHFLAGS="-shared" DYNEXP="-Wl,-Bdynamic" SONAMEFLAG="-Wl,-soname," - PICFLAG="-fPIC" + PICFLAGS="-fPIC" ;; *irix*) case "$host_os" in @@ -247,16 +247,16 @@ if test "$enable_shared" = "yes"; then SONAMEFLAG="-soname " SHLD="\${LD}" if test "${GCC}" = "yes"; then - PICFLAG="-fPIC" + PICFLAGS="-fPIC" else - PICFLAG="-KPIC" + PICFLAGS="-KPIC" fi ;; *aix*) BLDSHARED="true" LDSHFLAGS="-Wl,-bexpall,-bM:SRE,-bnoentry,-berok" DYNEXP="-Wl,-brtl,-bexpall" - PICFLAG="-O2" + PICFLAGS="-O2" if test "${GCC}" != "yes"; then ## for funky AIX compiler using strncpy() CFLAGS="$CFLAGS -D_LINUX_SOURCE_COMPAT -qmaxmem=32000" @@ -270,7 +270,7 @@ if test "$enable_shared" = "yes"; then SHLD="/usr/bin/ld" LDSHFLAGS="-B symbolic -b -z" SONAMEFLAG="+h " - PICFLAG="+z" + PICFLAGS="+z" fi DYNEXP="-Wl,-E" ;; @@ -280,7 +280,7 @@ if test "$enable_shared" = "yes"; then BLDSHARED="true" LDSHFLAGS="-shared" SONAMEFLAG="-Wl,-soname," - PICFLAG="-fPIC" + PICFLAGS="-fPIC" ;; *sco*) ;; @@ -288,7 +288,7 @@ if test "$enable_shared" = "yes"; then BLDSHARED="true" LDSHFLAGS="-shared" SONAMEFLAG="-Wl,-soname," - PICFLAG="-KPIC" + PICFLAGS="-KPIC" ;; *next2*) ;; @@ -331,11 +331,11 @@ AC_CACHE_CHECK([whether building shared libraries actually works], ac_cv_shlib_works=no # try building a trivial shared library if test "$PICSUFFIX" = "po"; then - $CC $CPPFLAGS $CFLAGS $PICFLAG -c -o shlib.po ${srcdir-.}/tests/shlib.c && + $CC $CPPFLAGS $CFLAGS $PICFLAGS -c -o shlib.po ${srcdir-.}/tests/shlib.c && $CC $CPPFLAGS $CFLAGS `eval echo $LDSHFLAGS` -o "shlib.$SHLIBEXT" shlib.po && ac_cv_shlib_works=yes else - $CC $CPPFLAGS $CFLAGS $PICFLAG -c -o shlib.$PICSUFFIX ${srcdir-.}/tests/shlib.c && + $CC $CPPFLAGS $CFLAGS $PICFLAGS -c -o shlib.$PICSUFFIX ${srcdir-.}/tests/shlib.c && mv shlib.$PICSUFFIX shlib.po && $CC $CPPFLAGS $CFLAGS `eval echo $LDSHFLAGS` -o "shlib.$SHLIBEXT" shlib.po && ac_cv_shlib_works=yes -- cgit From 0d44747df99f2168a063feedad5039f222746f61 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 6 Jan 2004 01:22:14 +0000 Subject: Patch based on work from James Peach to convert over to using pread/pwrite. Modified a little to ensure fsp->pos is correct. Fix for #889. Jeremy. (This used to be commit 019aaaf0df091c3f67048f591e70d4353a02bb9b) --- examples/VFS/skel_opaque.c | 12 ++++++++++++ examples/VFS/skel_transparent.c | 10 ++++++++++ 2 files changed, 22 insertions(+) (limited to 'examples/VFS') diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index de82801d85..310d305cee 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -111,11 +111,21 @@ 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) +{ + return vfswrap_pread(NULL, fsp, fd, data, n, offset); +} + static ssize_t skel_write(vfs_handle_struct *handle, files_struct *fsp, int fd, const void *data, size_t n) { 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) +{ + return vfswrap_pwrite(NULL, fsp, fd, data, n, offset); +} + static SMB_OFF_T skel_lseek(vfs_handle_struct *handle, files_struct *fsp, int filedes, SMB_OFF_T offset, int whence) { return vfswrap_lseek(NULL, fsp, filedes, offset, whence); @@ -488,7 +498,9 @@ static vfs_op_tuple skel_op_tuples[] = { {SMB_VFS_OP(skel_open), SMB_VFS_OP_OPEN, SMB_VFS_LAYER_OPAQUE}, {SMB_VFS_OP(skel_close), SMB_VFS_OP_CLOSE, SMB_VFS_LAYER_OPAQUE}, {SMB_VFS_OP(skel_read), SMB_VFS_OP_READ, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_pread), SMB_VFS_OP_PREAD, SMB_VFS_LAYER_OPAQUE}, {SMB_VFS_OP(skel_write), SMB_VFS_OP_WRITE, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_pwrite), SMB_VFS_OP_PWRITE, SMB_VFS_LAYER_OPAQUE}, {SMB_VFS_OP(skel_lseek), SMB_VFS_OP_LSEEK, SMB_VFS_LAYER_OPAQUE}, {SMB_VFS_OP(skel_rename), SMB_VFS_OP_RENAME, SMB_VFS_LAYER_OPAQUE}, {SMB_VFS_OP(skel_fsync), SMB_VFS_OP_FSYNC, SMB_VFS_LAYER_OPAQUE}, diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c index 7a326741c5..448390e72f 100644 --- a/examples/VFS/skel_transparent.c +++ b/examples/VFS/skel_transparent.c @@ -110,11 +110,21 @@ 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) +{ + return SMB_VFS_NEXT_PREAD(handle, fsp, fd, data, n, offset); +} + static ssize_t skel_write(vfs_handle_struct *handle, files_struct *fsp, int fd, const void *data, size_t n) { 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) +{ + return SMB_VFS_NEXT_PWRITE(handle, fsp, fd, data, n, offset); +} + static SMB_OFF_T skel_lseek(vfs_handle_struct *handle, files_struct *fsp, int filedes, SMB_OFF_T offset, int whence) { return SMB_VFS_NEXT_LSEEK(handle, fsp, filedes, offset, whence); -- cgit From c92a776bcf4210ad2073aa0d76e88b6fe82dc2a3 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Thu, 15 Jan 2004 06:51:20 +0000 Subject: Fix for bug 905. Remove POBAD_CC as it doesn't seem to be applicable anymore. (This used to be commit 67d25f3de803f7e599c51cacd51367f124151d6b) --- examples/VFS/configure.in | 3 --- 1 file changed, 3 deletions(-) (limited to 'examples/VFS') diff --git a/examples/VFS/configure.in b/examples/VFS/configure.in index 68931ad3d8..fda4cf3a31 100644 --- a/examples/VFS/configure.in +++ b/examples/VFS/configure.in @@ -55,7 +55,6 @@ AC_SUBST(SHLD) AC_SUBST(HOST_OS) AC_SUBST(PICFLAGS) AC_SUBST(PICSUFFIX) -AC_SUBST(POBAD_CC) AC_SUBST(SHLIBEXT) AC_SUBST(INSTALLCLIENTCMD_SH) AC_SUBST(INSTALLCLIENTCMD_A) @@ -181,7 +180,6 @@ SONAMEFLAG="#" SHLD="\${CC}" PICFLAGS="" PICSUFFIX="po" -POBAD_CC="#" SHLIBEXT="so" if test "$enable_shared" = "yes"; then @@ -214,7 +212,6 @@ if test "$enable_shared" = "yes"; then ## ${CFLAGS} added for building 64-bit shared ## libs using Sun's Compiler LDSHFLAGS="-G \${CFLAGS}" - POBAD_CC="" PICSUFFIX="po.o" fi ;; -- cgit From 931df5850e326ad0639fe317e0ca82e6d820a68e Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Mon, 5 Apr 2004 12:19:50 +0000 Subject: r39: * importing .cvsignore files * updateing WHATSNEW with vl's change (This used to be commit a7e2730ec4389e0c249886a8bfe1ee14c5abac41) --- examples/VFS/.cvsignore | 9 --------- 1 file changed, 9 deletions(-) delete mode 100644 examples/VFS/.cvsignore (limited to 'examples/VFS') diff --git a/examples/VFS/.cvsignore b/examples/VFS/.cvsignore deleted file mode 100644 index f269c98273..0000000000 --- a/examples/VFS/.cvsignore +++ /dev/null @@ -1,9 +0,0 @@ -.libs -*.so -*.o -*.bak -autom4te.cache -autom4te-2.53.cache -Makefile -configure -config.* -- cgit From a8caf25bd86ebe9f616b3fc88cca120850eb05d6 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 9 Nov 2004 23:55:04 +0000 Subject: r3644: Fixup examples VFS compile. Jeremy. (This used to be commit dfa910e4ab498100d0572838f2ac05faec3c917f) --- examples/VFS/skel_opaque.c | 20 +++++++++++++++++++- examples/VFS/skel_transparent.c | 20 +++++++++++++++++++- 2 files changed, 38 insertions(+), 2 deletions(-) (limited to 'examples/VFS') diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index 310d305cee..c7e5295b00 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -76,11 +76,26 @@ static DIR *skel_opendir(vfs_handle_struct *handle, connection_struct *conn, con return vfswrap_opendir(NULL, conn, fname); } -static struct dirent *skel_readdir(vfs_handle_struct *handle, connection_struct *conn, DIR *dirp) +static SMB_STRUCT_DIRENT *skel_readdir(vfs_handle_struct *handle, connection_struct *conn, DIR *dirp) { return vfswrap_readdir(NULL, conn, dirp); } +static void skel_seekdir(vfs_handle_struct *handle, connection_struct *conn, DIR *dirp, long offset) +{ + return vfswrap_seekdir(NULL, conn, dirp, offset); +} + +static long skel_telldir(vfs_handle_struct *handle, connection_struct *conn, DIR *dirp) +{ + return vfswrap_telldir(NULL, conn, dirp); +} + +static void skel_rewinddir(vfs_handle_struct *handle, connection_struct *conn, DIR *dirp) +{ + return vfswrap_rewinddir(NULL, conn, dirp); +} + static int skel_mkdir(vfs_handle_struct *handle, connection_struct *conn, const char *path, mode_t mode) { return vfswrap_mkdir(NULL, conn, path, mode); @@ -489,6 +504,9 @@ static vfs_op_tuple skel_op_tuples[] = { {SMB_VFS_OP(skel_opendir), SMB_VFS_OP_OPENDIR, SMB_VFS_LAYER_OPAQUE}, {SMB_VFS_OP(skel_readdir), SMB_VFS_OP_READDIR, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_seekdir), SMB_VFS_OP_SEEKDIR, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_telldir), SMB_VFS_OP_TELLDIR, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_rewinddir), SMB_VFS_OP_REWINDDIR, SMB_VFS_LAYER_OPAQUE}, {SMB_VFS_OP(skel_mkdir), SMB_VFS_OP_MKDIR, SMB_VFS_LAYER_OPAQUE}, {SMB_VFS_OP(skel_rmdir), SMB_VFS_OP_RMDIR, SMB_VFS_LAYER_OPAQUE}, {SMB_VFS_OP(skel_closedir), SMB_VFS_OP_CLOSEDIR, SMB_VFS_LAYER_OPAQUE}, diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c index 448390e72f..b10161cde1 100644 --- a/examples/VFS/skel_transparent.c +++ b/examples/VFS/skel_transparent.c @@ -75,11 +75,26 @@ static DIR *skel_opendir(vfs_handle_struct *handle, connection_struct *conn, con return SMB_VFS_NEXT_OPENDIR(handle, conn, fname); } -static struct dirent *skel_readdir(vfs_handle_struct *handle, connection_struct *conn, DIR *dirp) +static SMB_STRUCT_DIRENT *skel_readdir(vfs_handle_struct *handle, connection_struct *conn, DIR *dirp) { return SMB_VFS_NEXT_READDIR(handle, conn, dirp); } +static void skel_seekdir(vfs_handle_struct *handle, connection_struct *conn, DIR *dirp, long offset) +{ + return SMB_VFS_NEXT_SEEKDIR(handle, conn, dirp, offset); +} + +static long skel_telldir(vfs_handle_struct *handle, connection_struct *conn, DIR *dirp) +{ + return SMB_VFS_NEXT_TELLDIR(handle, conn, dirp); +} + +static void skel_rewinddir(vfs_handle_struct *handle, connection_struct *conn, DIR *dirp) +{ + return SMB_VFS_NEXT_REWINDDIR(handle, conn, dirp); +} + static int skel_mkdir(vfs_handle_struct *handle, connection_struct *conn, const char *path, mode_t mode) { return SMB_VFS_NEXT_MKDIR(handle, conn, path, mode); @@ -458,6 +473,9 @@ static vfs_op_tuple skel_op_tuples[] = { {SMB_VFS_OP(skel_opendir), SMB_VFS_OP_OPENDIR, SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(skel_readdir), SMB_VFS_OP_READDIR, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_seekdir), SMB_VFS_OP_SEEKDIR, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_telldir), SMB_VFS_OP_TELLDIR, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_rewinddir), SMB_VFS_OP_REWINDDIR, SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(skel_mkdir), SMB_VFS_OP_MKDIR, SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(skel_rmdir), SMB_VFS_OP_RMDIR, SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(skel_closedir), SMB_VFS_OP_CLOSEDIR, SMB_VFS_LAYER_TRANSPARENT}, -- cgit From c7e532496b689a04f7c7dc4144d0326e922f2e59 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 18 Nov 2004 18:40:39 +0000 Subject: r3855: Sync up with the one in the main source dir (yes, this should probably be a symlink...). Jeremy. (This used to be commit 5b0da25796337b73d151a3025b7e460222164b3f) --- examples/VFS/autogen.sh | 39 ++++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 17 deletions(-) (limited to 'examples/VFS') diff --git a/examples/VFS/autogen.sh b/examples/VFS/autogen.sh index fcae16ec5c..e8160d2173 100755 --- a/examples/VFS/autogen.sh +++ b/examples/VFS/autogen.sh @@ -1,28 +1,28 @@ #!/bin/sh -# Run this script to build samba from CVS. +# Run this script to build samba from SVN. ## insert all possible names (only works with ## autoconf 2.x -#TESTAUTOHEADER="autoheader autoheader-2.53" -TESTAUTOCONF="autoconf autoconf-2.53" +TESTAUTOHEADER="autoheader autoheader-2.53 autoheader2.50" +TESTAUTOCONF="autoconf autoconf-2.53 autoconf2.50" -#AUTOHEADERFOUND="0" +AUTOHEADERFOUND="0" AUTOCONFFOUND="0" ## ## Look for autoheader ## -#for i in $TESTAUTOHEADER; do -# if which $i > /dev/null 2>&1; then -# if [ `$i --version | head -n 1 | cut -d. -f 2` -ge 53 ]; then -# AUTOHEADER=$i -# AUTOHEADERFOUND="1" -# break -# fi -# fi -#done +for i in $TESTAUTOHEADER; do + if which $i > /dev/null 2>&1; then + if [ `$i --version | head -n 1 | cut -d. -f 2 | tr -d [:alpha:]` -ge 53 ]; then + AUTOHEADER=$i + AUTOHEADERFOUND="1" + break + fi + fi +done ## ## Look for autoconf @@ -30,7 +30,7 @@ AUTOCONFFOUND="0" for i in $TESTAUTOCONF; do if which $i > /dev/null 2>&1; then - if [ `$i --version | head -n 1 | cut -d. -f 2` -ge 53 ]; then + if [ `$i --version | head -n 1 | cut -d. -f 2 | tr -d [:alpha:]` -ge 53 ]; then AUTOCONF=$i AUTOCONFFOUND="1" break @@ -43,18 +43,23 @@ done ## do we have it? ## if [ "$AUTOCONFFOUND" = "0" -o "$AUTOHEADERFOUND" = "0" ]; then - echo "$0: need autoconf 2.53 or later to build samba from CVS" >&2 + echo "$0: need autoconf 2.53 or later to build samba from SVN" >&2 exit 1 fi +echo "$0: running script/mkversion.sh" +./script/mkversion.sh || exit 1 +rm -rf autom4te*.cache -#echo "$0: running $AUTOHEADER" -#$AUTOHEADER || exit 1 +echo "$0: running $AUTOHEADER" +$AUTOHEADER || exit 1 echo "$0: running $AUTOCONF" $AUTOCONF || exit 1 +rm -rf autom4te*.cache + echo "Now run ./configure and then make." exit 0 -- cgit From c5dcd2d57234c8474ea2d95553f5a84ff682df90 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 8 Dec 2004 01:52:23 +0000 Subject: r4092: Bring into line with new *alloc rules. Jeremy. (This used to be commit 2ed86ac5844ce5893beb2bca351fee66cc3b4049) --- examples/VFS/shadow_copy_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'examples/VFS') diff --git a/examples/VFS/shadow_copy_test.c b/examples/VFS/shadow_copy_test.c index d2b7206cd3..155181229b 100644 --- a/examples/VFS/shadow_copy_test.c +++ b/examples/VFS/shadow_copy_test.c @@ -58,7 +58,7 @@ static int test_get_shadow_copy_data(vfs_handle_struct *handle, files_struct *fs shadow_copy_data->num_volumes = num; if (labels) { - shadow_copy_data->labels = (SHADOW_COPY_LABEL *)talloc_zero(shadow_copy_data->mem_ctx,(num)*sizeof(SHADOW_COPY_LABEL)); + shadow_copy_data->labels = TALLOC_ZERO_ARRAY(shadow_copy_data->mem_ctx,SHADOW_COPY_LABEL,num); for (i=0;ilabels[i], sizeof(SHADOW_COPY_LABEL), "@GMT-2003.08.05-12.%02u.00",i); } -- cgit From 12ce2c5acabfc9a3ee51963ac3ba75d4fb2d8be2 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Mon, 31 Jan 2005 13:17:49 +0000 Subject: r5131: BUG 2290: don;t call mkversion.sh since we don't have it in this directory (This used to be commit 2ddcb643819bcb0f33c14fc22117d98ea2bcc132) --- examples/VFS/autogen.sh | 3 --- 1 file changed, 3 deletions(-) (limited to 'examples/VFS') diff --git a/examples/VFS/autogen.sh b/examples/VFS/autogen.sh index e8160d2173..223919890f 100755 --- a/examples/VFS/autogen.sh +++ b/examples/VFS/autogen.sh @@ -47,9 +47,6 @@ if [ "$AUTOCONFFOUND" = "0" -o "$AUTOHEADERFOUND" = "0" ]; then exit 1 fi -echo "$0: running script/mkversion.sh" -./script/mkversion.sh || exit 1 - rm -rf autom4te*.cache echo "$0: running $AUTOHEADER" -- cgit From 19ca97a70f6b7b41d251eaa76e4d3c980c6eedff Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 24 Jun 2005 20:25:18 +0000 Subject: r7882: Looks like a large patch - but what it actually does is make Samba safe for using our headers and linking with C++ modules. Stops us from using C++ reserved keywords in our code. Jeremy (This used to be commit 9506b8e145982b1160a2f0aee5c9b7a54980940a) --- examples/VFS/skel_opaque.c | 4 ++-- examples/VFS/skel_transparent.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'examples/VFS') diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index c7e5295b00..48fdf37ca0 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -146,9 +146,9 @@ static SMB_OFF_T skel_lseek(vfs_handle_struct *handle, files_struct *fsp, int fi return vfswrap_lseek(NULL, fsp, filedes, offset, whence); } -static int skel_rename(vfs_handle_struct *handle, connection_struct *conn, const char *old, const char *new) +static int skel_rename(vfs_handle_struct *handle, connection_struct *conn, const char *oldname, const char *newname) { - return vfswrap_rename(NULL, conn, old, new); + return vfswrap_rename(NULL, conn, oldname, newname); } static int skel_fsync(vfs_handle_struct *handle, files_struct *fsp, int fd) diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c index b10161cde1..5f83dd417c 100644 --- a/examples/VFS/skel_transparent.c +++ b/examples/VFS/skel_transparent.c @@ -145,9 +145,9 @@ static SMB_OFF_T skel_lseek(vfs_handle_struct *handle, files_struct *fsp, int fi return SMB_VFS_NEXT_LSEEK(handle, fsp, filedes, offset, whence); } -static int skel_rename(vfs_handle_struct *handle, connection_struct *conn, const char *old, const char *new) +static int skel_rename(vfs_handle_struct *handle, connection_struct *conn, const char *oldname, const char *newname) { - return SMB_VFS_NEXT_RENAME(handle, conn, old, new); + return SMB_VFS_NEXT_RENAME(handle, conn, oldname, newname); } static int skel_fsync(vfs_handle_struct *handle, files_struct *fsp, int fd) -- cgit From ff7e5c26733c933d0ed71616c39e2d931ad1e597 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Sat, 25 Jun 2005 03:03:44 +0000 Subject: r7893: Add in the extra parameters to opendir() to fix the large directory/insane app problem. Rev vfs version. Doesn't change the normal codepath. Jeremy. (This used to be commit 0f03a6bdcdbdf60da81e0aeffa84ac6e48fc6a04) --- examples/VFS/skel_opaque.c | 4 ++-- examples/VFS/skel_transparent.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'examples/VFS') diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index 48fdf37ca0..fb4254ccff 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -71,9 +71,9 @@ static int skel_get_shadow_copy_data(vfs_handle_struct *handle, files_struct *fs return vfswrap_get_shadow_copy_data(NULL, fsp, shadow_copy_data, labels); } -static DIR *skel_opendir(vfs_handle_struct *handle, connection_struct *conn, const char *fname) +static DIR *skel_opendir(vfs_handle_struct *handle, connection_struct *conn, const char *fname, const char *mask, uint32 attr) { - return vfswrap_opendir(NULL, conn, fname); + return vfswrap_opendir(NULL, conn, fname, mask, attr); } static SMB_STRUCT_DIRENT *skel_readdir(vfs_handle_struct *handle, connection_struct *conn, DIR *dirp) diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c index 5f83dd417c..428ab97061 100644 --- a/examples/VFS/skel_transparent.c +++ b/examples/VFS/skel_transparent.c @@ -70,9 +70,9 @@ static int skel_get_shadow_copy_data(vfs_handle_struct *handle, files_struct *fs return SMB_VFS_NEXT_GET_SHADOW_COPY_DATA(handle, fsp, shadow_copy_data, labels); } -static DIR *skel_opendir(vfs_handle_struct *handle, connection_struct *conn, const char *fname) +static DIR *skel_opendir(vfs_handle_struct *handle, connection_struct *conn, const char *fname, const char *mask, uint32 attr) { - return SMB_VFS_NEXT_OPENDIR(handle, conn, fname); + return SMB_VFS_NEXT_OPENDIR(handle, conn, fname, mask, attr); } static SMB_STRUCT_DIRENT *skel_readdir(vfs_handle_struct *handle, connection_struct *conn, DIR *dirp) -- cgit From e55d945ff1b4fb95f19527b1fa41af374b501488 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 27 Jun 2005 18:32:58 +0000 Subject: r7952: Fix for bug #2826 pointed out by Jiri Klouda . Wrong return val for symlink and readlink. Jeremy. (This used to be commit f3c4d5a95746531b7bd548bbbfccfff197a2abf3) --- examples/VFS/skel_opaque.c | 4 ++-- examples/VFS/skel_transparent.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'examples/VFS') diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index fb4254ccff..a3a42912f8 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -221,12 +221,12 @@ static BOOL skel_lock(vfs_handle_struct *handle, files_struct *fsp, int fd, int return vfswrap_lock(NULL, fsp, fd, op, offset, count, type); } -static BOOL skel_symlink(vfs_handle_struct *handle, connection_struct *conn, const char *oldpath, const char *newpath) +static int skel_symlink(vfs_handle_struct *handle, connection_struct *conn, const char *oldpath, const char *newpath) { return vfswrap_symlink(NULL, conn, oldpath, newpath); } -static BOOL skel_readlink(vfs_handle_struct *handle, connection_struct *conn, const char *path, char *buf, size_t bufsiz) +static int skel_readlink(vfs_handle_struct *handle, connection_struct *conn, const char *path, char *buf, size_t bufsiz) { return vfswrap_readlink(NULL, conn, path, buf, bufsiz); } diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c index 428ab97061..8be1a7fb44 100644 --- a/examples/VFS/skel_transparent.c +++ b/examples/VFS/skel_transparent.c @@ -220,12 +220,12 @@ static BOOL skel_lock(vfs_handle_struct *handle, files_struct *fsp, int fd, int return SMB_VFS_NEXT_LOCK(handle, fsp, fd, op, offset, count, type); } -static BOOL skel_symlink(vfs_handle_struct *handle, connection_struct *conn, const char *oldpath, const char *newpath) +static int skel_symlink(vfs_handle_struct *handle, connection_struct *conn, const char *oldpath, const char *newpath) { return SMB_VFS_NEXT_SYMLINK(handle, conn, oldpath, newpath); } -static BOOL skel_readlink(vfs_handle_struct *handle, connection_struct *conn, const char *path, char *buf, size_t bufsiz) +static int skel_readlink(vfs_handle_struct *handle, connection_struct *conn, const char *path, char *buf, size_t bufsiz) { return SMB_VFS_NEXT_READLINK(handle, conn, path, buf, bufsiz); } -- cgit From f2f55d703d0dd549a83809d3e5cc5151569b48d6 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 27 Jun 2005 22:53:56 +0000 Subject: r7963: Add aio support to 3.0. Jeremy. (This used to be commit 1de27da47051af08790317f5b48b02719d6b9934) --- examples/VFS/skel_opaque.c | 44 +++++++++++++++++++++++++++++++++++++++++ examples/VFS/skel_transparent.c | 44 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 88 insertions(+) (limited to 'examples/VFS') diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index a3a42912f8..a3aab55c3e 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -487,6 +487,41 @@ static int skel_fsetxattr(vfs_handle_struct *handle, struct files_struct *fsp,in return -1; } +static int skel_aio_read(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb) +{ + return vfswrap_aio_read(NULL, fsp, aiocb); +} + +static int skel_aio_write(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb) +{ + return vfswrap_aio_write(NULL, fsp, aiocb); +} + +static ssize_t skel_aio_return(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb) +{ + return vfswrap_aio_return(NULL, fsp, aiocb); +} + +static int skel_aio_cancel(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, SMB_STRUCT_AIOCB *aiocb) +{ + return vfswrap_aio_cancel(NULL, fsp, fd, aiocb); +} + +static int skel_aio_error(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb) +{ + return vfswrap_aio_error(NULL, fsp, aiocb); +} + +static int skel_aio_fsync(struct vfs_handle_struct *handle, struct files_struct *fsp, int op, SMB_STRUCT_AIOCB *aiocb) +{ + return vfswrap_aio_fsync(NULL, fsp, op, aiocb); +} + +static int skel_aio_suspend(struct vfs_handle_struct *handle, struct files_struct *fsp, const SMB_STRUCT_AIOCB * const aiocb[], int n, const struct timespec *ts) +{ + return vfswrap_aioi_suspend(NULL, fsp, aiocb, n, ts); +} + /* VFS operations structure */ static vfs_op_tuple skel_op_tuples[] = { @@ -590,6 +625,15 @@ static vfs_op_tuple skel_op_tuples[] = { {SMB_VFS_OP(skel_lsetxattr), SMB_VFS_OP_LSETXATTR, SMB_VFS_LAYER_OPAQUE}, {SMB_VFS_OP(skel_fsetxattr), SMB_VFS_OP_FSETXATTR, SMB_VFS_LAYER_OPAQUE}, + /* AIO operations. */ + {SMB_VFS_OP(skel_aio_read), SMB_VFS_OP_AIO_READ, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_aio_write), SMB_VFS_OP_AIO_WRITE, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_aio_return), SMB_VFS_OP_AIO_RETURN, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_aio_cancel), SMB_VFS_OP_AIO_CANCEL, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_aio_error), SMB_VFS_OP_AIO_ERROR, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_aio_fsync), SMB_VFS_OP_AIO_FSYNC, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_aio_suspend), SMB_VFS_OP_AIO_SUSPEND, SMB_VFS_LAYER_OPAQUE}, + {NULL, SMB_VFS_OP_NOOP, SMB_VFS_LAYER_NOOP} }; diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c index 8be1a7fb44..81069765d0 100644 --- a/examples/VFS/skel_transparent.c +++ b/examples/VFS/skel_transparent.c @@ -456,6 +456,41 @@ static int skel_fsetxattr(vfs_handle_struct *handle, struct files_struct *fsp,in return SMB_VFS_NEXT_FSETXATTR(handle, fsp, fd, name, value, size, flags); } +static int skel_aio_read(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb) +{ + return SMB_VFS_NEXT_AIO_READ(handle, fsp, aiocb); +} + +static int skel_aio_write(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb) +{ + return SMB_VFS_NEXT_AIO_WRITE(handle, fsp, aiocb); +} + +static ssize_t skel_aio_return(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb) +{ + return SMB_VFS_NEXT_AIO_RETURN(handle, fsp, aiocb); +} + +static int skel_aio_cancel(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, SMB_STRUCT_AIOCB *aiocb) +{ + return SMB_VFS_NEXT_AIO_CANCEL(handle, fsp, fd, aiocb); +} + +static int skel_aio_error(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb) +{ + return SMB_VFS_NEXT_AIO_ERROR(handle, fsp, aiocb); +} + +static int skel_aio_fsync(struct vfs_handle_struct *handle, struct files_struct *fsp, int op, SMB_STRUCT_AIOCB *aiocb) +{ + return SMB_VFS_NEXT_AIO_FSYNC(handle, fsp, op, aiocb); +} + +static int skel_aio_suspend(struct vfs_handle_struct *handle, struct files_struct *fsp, const SMB_STRUCT_AIOCB * const aiocb[], int n, const struct timespec *ts) +{ + return SMB_VFS_NEXT_AIO_SUSPEND(handle, fsp, aiocb, n, ts); +} + /* VFS operations structure */ static vfs_op_tuple skel_op_tuples[] = { @@ -557,6 +592,15 @@ static vfs_op_tuple skel_op_tuples[] = { {SMB_VFS_OP(skel_lsetxattr), SMB_VFS_OP_LSETXATTR, SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(skel_fsetxattr), SMB_VFS_OP_FSETXATTR, SMB_VFS_LAYER_TRANSPARENT}, + /* AIO operations. */ + {SMB_VFS_OP(skel_aio_read), SMB_VFS_OP_AIO_READ, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_aio_write), SMB_VFS_OP_AIO_WRITE, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_aio_return), SMB_VFS_OP_AIO_RETURN, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_aio_cancel), SMB_VFS_OP_AIO_CANCEL, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_aio_error), SMB_VFS_OP_AIO_ERROR, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_aio_fsync), SMB_VFS_OP_AIO_FSYNC, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_aio_suspend), SMB_VFS_OP_AIO_SUSPEND, SMB_VFS_LAYER_TRANSPARENT}, + {NULL, SMB_VFS_OP_NOOP, SMB_VFS_LAYER_NOOP} }; -- cgit From 042d4b86f55ac82fade7dc14ab00a23b0380753b Mon Sep 17 00:00:00 2001 From: Lars Müller Date: Wed, 20 Jul 2005 20:30:21 +0000 Subject: r8657: Add -fPIC which is the case for all other Samba shared libs. Fix bug #2060. (This used to be commit 8c09716c91e0bb2ef90a9f81e093048077581e47) --- examples/VFS/Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'examples/VFS') diff --git a/examples/VFS/Makefile.in b/examples/VFS/Makefile.in index c368974bd5..7d04ad9f3a 100644 --- a/examples/VFS/Makefile.in +++ b/examples/VFS/Makefile.in @@ -7,7 +7,7 @@ INSTALLCMD = @INSTALL@ SAMBA_SOURCE = @SAMBA_SOURCE@ SHLIBEXT = @SHLIBEXT@ OBJEXT = @OBJEXT@ -FLAGS = $(CFLAGS) -Iinclude -I$(SAMBA_SOURCE)/include -I$(SAMBA_SOURCE)/ubiqx -I$(SAMBA_SOURCE)/smbwrapper -I. $(CPPFLAGS) -I$(SAMBA_SOURCE) +FLAGS = $(CFLAGS) -Iinclude -I$(SAMBA_SOURCE)/include -I$(SAMBA_SOURCE)/ubiqx -I$(SAMBA_SOURCE)/smbwrapper -I. $(CPPFLAGS) -I$(SAMBA_SOURCE) -fPIC prefix = @prefix@ -- cgit From f98f86394a654722fa13ef1dc3c4dea82d452442 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 22 Aug 2005 18:03:08 +0000 Subject: r9483: Changed DIR to SMB_STRUCT_DIR because of the amazing stupidity of a UNIX vendor not understanding abstract data types :-(. Jeremy. (This used to be commit be5b4e2fa3ed30b0ff01b47d2354e5f782a12e25) --- examples/VFS/skel_opaque.c | 12 ++++++------ examples/VFS/skel_transparent.c | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) (limited to 'examples/VFS') diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index a3aab55c3e..065c9ecbc1 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -71,27 +71,27 @@ static int skel_get_shadow_copy_data(vfs_handle_struct *handle, files_struct *fs return vfswrap_get_shadow_copy_data(NULL, fsp, shadow_copy_data, labels); } -static DIR *skel_opendir(vfs_handle_struct *handle, connection_struct *conn, const char *fname, const char *mask, uint32 attr) +static SMB_STRUCT_DIR *skel_opendir(vfs_handle_struct *handle, connection_struct *conn, const char *fname, const char *mask, uint32 attr) { return vfswrap_opendir(NULL, conn, fname, mask, attr); } -static SMB_STRUCT_DIRENT *skel_readdir(vfs_handle_struct *handle, connection_struct *conn, DIR *dirp) +static SMB_STRUCT_DIRENT *skel_readdir(vfs_handle_struct *handle, connection_struct *conn, SMB_STRUCT_DIR *dirp) { return vfswrap_readdir(NULL, conn, dirp); } -static void skel_seekdir(vfs_handle_struct *handle, connection_struct *conn, DIR *dirp, long offset) +static void skel_seekdir(vfs_handle_struct *handle, connection_struct *conn, SMB_STRUCT_DIR *dirp, long offset) { return vfswrap_seekdir(NULL, conn, dirp, offset); } -static long skel_telldir(vfs_handle_struct *handle, connection_struct *conn, DIR *dirp) +static long skel_telldir(vfs_handle_struct *handle, connection_struct *conn, SMB_STRUCT_DIR *dirp) { return vfswrap_telldir(NULL, conn, dirp); } -static void skel_rewinddir(vfs_handle_struct *handle, connection_struct *conn, DIR *dirp) +static void skel_rewinddir(vfs_handle_struct *handle, connection_struct *conn, SMB_STRUCT_DIR *dirp) { return vfswrap_rewinddir(NULL, conn, dirp); } @@ -106,7 +106,7 @@ static int skel_rmdir(vfs_handle_struct *handle, connection_struct *conn, const return vfswrap_rmdir(NULL, conn, path); } -static int skel_closedir(vfs_handle_struct *handle, connection_struct *conn, DIR *dir) +static int skel_closedir(vfs_handle_struct *handle, connection_struct *conn, SMB_STRUCT_DIR *dir) { return vfswrap_closedir(NULL, conn, dir); } diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c index 81069765d0..0879683fdc 100644 --- a/examples/VFS/skel_transparent.c +++ b/examples/VFS/skel_transparent.c @@ -70,27 +70,27 @@ static int skel_get_shadow_copy_data(vfs_handle_struct *handle, files_struct *fs return SMB_VFS_NEXT_GET_SHADOW_COPY_DATA(handle, fsp, shadow_copy_data, labels); } -static DIR *skel_opendir(vfs_handle_struct *handle, connection_struct *conn, const char *fname, const char *mask, uint32 attr) +static SMB_STRUCT_DIR *skel_opendir(vfs_handle_struct *handle, connection_struct *conn, const char *fname, const char *mask, uint32 attr) { return SMB_VFS_NEXT_OPENDIR(handle, conn, fname, mask, attr); } -static SMB_STRUCT_DIRENT *skel_readdir(vfs_handle_struct *handle, connection_struct *conn, DIR *dirp) +static SMB_STRUCT_DIRENT *skel_readdir(vfs_handle_struct *handle, connection_struct *conn, SMB_STRUCT_DIR *dirp) { return SMB_VFS_NEXT_READDIR(handle, conn, dirp); } -static void skel_seekdir(vfs_handle_struct *handle, connection_struct *conn, DIR *dirp, long offset) +static void skel_seekdir(vfs_handle_struct *handle, connection_struct *conn, SMB_STRUCT_DIR *dirp, long offset) { return SMB_VFS_NEXT_SEEKDIR(handle, conn, dirp, offset); } -static long skel_telldir(vfs_handle_struct *handle, connection_struct *conn, DIR *dirp) +static long skel_telldir(vfs_handle_struct *handle, connection_struct *conn, SMB_STRUCT_DIR *dirp) { return SMB_VFS_NEXT_TELLDIR(handle, conn, dirp); } -static void skel_rewinddir(vfs_handle_struct *handle, connection_struct *conn, DIR *dirp) +static void skel_rewinddir(vfs_handle_struct *handle, connection_struct *conn, SMB_STRUCT_DIR *dirp) { return SMB_VFS_NEXT_REWINDDIR(handle, conn, dirp); } @@ -105,7 +105,7 @@ static int skel_rmdir(vfs_handle_struct *handle, connection_struct *conn, const return SMB_VFS_NEXT_RMDIR(handle, conn, path); } -static int skel_closedir(vfs_handle_struct *handle, connection_struct *conn, DIR *dir) +static int skel_closedir(vfs_handle_struct *handle, connection_struct *conn, SMB_STRUCT_DIR *dir) { return SMB_VFS_NEXT_CLOSEDIR(handle, conn, dir); } -- cgit From a5b339c799b39d5147c6d31f94cc0b2ea9c865db Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 20 Oct 2005 17:33:17 +0000 Subject: r11232: Added ab's POSIX statvfs vfs call. Sorry for the delay ab. Jeremy. (This used to be commit af8545806770a7530eecc184bdd230ca14999884) --- examples/VFS/skel_opaque.c | 6 ++++++ examples/VFS/skel_transparent.c | 6 ++++++ 2 files changed, 12 insertions(+) (limited to 'examples/VFS') diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index 065c9ecbc1..e6b7d032fc 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -71,6 +71,11 @@ static int skel_get_shadow_copy_data(vfs_handle_struct *handle, files_struct *fs return vfswrap_get_shadow_copy_data(NULL, fsp, shadow_copy_data, labels); } +static int skel_statvfs(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *path, struct vfs_statvfs_struct *statbuf) +{ + return vfswrap_statvfs(NULL, conn, path, statbuf); +} + static SMB_STRUCT_DIR *skel_opendir(vfs_handle_struct *handle, connection_struct *conn, const char *fname, const char *mask, uint32 attr) { return vfswrap_opendir(NULL, conn, fname, mask, attr); @@ -534,6 +539,7 @@ static vfs_op_tuple skel_op_tuples[] = { {SMB_VFS_OP(skel_get_quota), SMB_VFS_OP_GET_QUOTA, SMB_VFS_LAYER_OPAQUE}, {SMB_VFS_OP(skel_set_quota), SMB_VFS_OP_SET_QUOTA, SMB_VFS_LAYER_OPAQUE}, {SMB_VFS_OP(skel_get_shadow_copy_data), SMB_VFS_OP_GET_SHADOW_COPY_DATA,SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_statvfs), SMB_VFS_OP_STATVFS, SMB_VFS_LAYER_OPAQUE}, /* Directory operations */ diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c index 0879683fdc..14fa2276e1 100644 --- a/examples/VFS/skel_transparent.c +++ b/examples/VFS/skel_transparent.c @@ -70,6 +70,11 @@ static int skel_get_shadow_copy_data(vfs_handle_struct *handle, files_struct *fs return SMB_VFS_NEXT_GET_SHADOW_COPY_DATA(handle, fsp, shadow_copy_data, labels); } +static int skel_statvfs(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *path, struct vfs_statvfs_struct *statbuf) +{ + return SMB_VFS_NEXT_STATVFS(handle, conn, path, statbuf); +} + static SMB_STRUCT_DIR *skel_opendir(vfs_handle_struct *handle, connection_struct *conn, const char *fname, const char *mask, uint32 attr) { return SMB_VFS_NEXT_OPENDIR(handle, conn, fname, mask, attr); @@ -503,6 +508,7 @@ static vfs_op_tuple skel_op_tuples[] = { {SMB_VFS_OP(skel_get_quota), SMB_VFS_OP_GET_QUOTA, SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(skel_set_quota), SMB_VFS_OP_SET_QUOTA, SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(skel_get_shadow_copy_data), SMB_VFS_OP_GET_SHADOW_COPY_DATA,SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_statvfs), SMB_VFS_OP_STATVFS, SMB_VFS_LAYER_TRANSPARENT}, /* Directory operations */ -- cgit From d75de28c9ee6463d53920dcd0e769aa11c0b562e Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Fri, 18 Nov 2005 13:02:19 +0000 Subject: r11784: Fix minor glitch found by Rainer Weikusat -- Thanks (This used to be commit 1128d054dd8d387e529bf92dad3a3db5e251d61d) --- examples/VFS/skel_opaque.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'examples/VFS') diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index e6b7d032fc..e6af475da6 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -524,7 +524,7 @@ static int skel_aio_fsync(struct vfs_handle_struct *handle, struct files_struct static int skel_aio_suspend(struct vfs_handle_struct *handle, struct files_struct *fsp, const SMB_STRUCT_AIOCB * const aiocb[], int n, const struct timespec *ts) { - return vfswrap_aioi_suspend(NULL, fsp, aiocb, n, ts); + return vfswrap_aio_suspend(NULL, fsp, aiocb, n, ts); } /* VFS operations structure */ -- cgit From 933a8ec57edf38d27e6af4bb3be489efadaab713 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 11 Jan 2006 12:00:59 +0000 Subject: r12839: - apply changes from svn r4963 also for VFS configure - KRB5_CONFIG should not be used - rename it to KRB5CONFIG MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Thanks to Björn Jacke Volker (This used to be commit 9c44fef5bec76d383d25b73ecc01dc1fc25b3f20) --- examples/VFS/configure.in | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'examples/VFS') diff --git a/examples/VFS/configure.in b/examples/VFS/configure.in index fda4cf3a31..515d43f009 100644 --- a/examples/VFS/configure.in +++ b/examples/VFS/configure.in @@ -84,11 +84,11 @@ fi ################################################# # check for krb5-config from recent MIT and Heimdal kerberos 5 - AC_PATH_PROG(KRB5_CONFIG, krb5-config) + AC_PATH_PROG(KRB5CONFIG, krb5-config) AC_MSG_CHECKING(for working krb5-config) - if test -x "$KRB5_CONFIG"; then - CFLAGS="$CFLAGS `$KRB5_CONFIG --cflags | sed s/@INCLUDE_des@//`" - CPPFLAGS="$CPPFLAGS `$KRB5_CONFIG --cflags | sed s/@INCLUDE_des@//`" + if test -x "$KRB5CONFIG"; then + CFLAGS="$CFLAGS `$KRB5CONFIG --cflags | sed s/@INCLUDE_des@//`" + CPPFLAGS="$CPPFLAGS `$KRB5CONFIG --cflags | sed s/@INCLUDE_des@//`" FOUND_KRB5=yes AC_MSG_RESULT(yes) else -- cgit From e91aca5158bad59dba8d6e06c54078116ce8f82c Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Mon, 6 Feb 2006 13:39:34 +0000 Subject: r13366: Add popt to the include path for examples/VFS. The modules themselves don't use that, but includes.h fails in environments where there's no system popt around. As the modules don't need that anyway, porting the check whether to use the system one or our own seems a bit overkill. Thanks to Michael Adam . Volker (This used to be commit 04cbde59566f814cfba5a008e12496795544ad05) --- examples/VFS/Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'examples/VFS') diff --git a/examples/VFS/Makefile.in b/examples/VFS/Makefile.in index 7d04ad9f3a..79873c3857 100644 --- a/examples/VFS/Makefile.in +++ b/examples/VFS/Makefile.in @@ -7,7 +7,7 @@ INSTALLCMD = @INSTALL@ SAMBA_SOURCE = @SAMBA_SOURCE@ SHLIBEXT = @SHLIBEXT@ OBJEXT = @OBJEXT@ -FLAGS = $(CFLAGS) -Iinclude -I$(SAMBA_SOURCE)/include -I$(SAMBA_SOURCE)/ubiqx -I$(SAMBA_SOURCE)/smbwrapper -I. $(CPPFLAGS) -I$(SAMBA_SOURCE) -fPIC +FLAGS = $(CFLAGS) -Iinclude -I$(SAMBA_SOURCE)/include -I$(SAMBA_SOURCE)/popt -I$(SAMBA_SOURCE)/ubiqx -I$(SAMBA_SOURCE)/smbwrapper -I. $(CPPFLAGS) -I$(SAMBA_SOURCE) -fPIC prefix = @prefix@ -- cgit From 22dbd67708f1651a2341d70ce576fac360affccf Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 10 Apr 2006 15:33:04 +0000 Subject: r15018: Merge Volker's ipc/trans2/nttrans changes over into 3.0. Also merge the new POSIX lock code - this is not enabled unless -DDEVELOPER is defined. This doesn't yet map onto underlying system POSIX locks. Updates vfs to allow lock queries. Jeremy. (This used to be commit 08e52ead03304ff04229e1bfe544ff40e2564fc7) --- examples/VFS/Makefile.in | 2 +- examples/VFS/skel_opaque.c | 6 ++++++ examples/VFS/skel_transparent.c | 6 ++++++ 3 files changed, 13 insertions(+), 1 deletion(-) (limited to 'examples/VFS') diff --git a/examples/VFS/Makefile.in b/examples/VFS/Makefile.in index 79873c3857..caf8f030aa 100644 --- a/examples/VFS/Makefile.in +++ b/examples/VFS/Makefile.in @@ -7,7 +7,7 @@ INSTALLCMD = @INSTALL@ SAMBA_SOURCE = @SAMBA_SOURCE@ SHLIBEXT = @SHLIBEXT@ OBJEXT = @OBJEXT@ -FLAGS = $(CFLAGS) -Iinclude -I$(SAMBA_SOURCE)/include -I$(SAMBA_SOURCE)/popt -I$(SAMBA_SOURCE)/ubiqx -I$(SAMBA_SOURCE)/smbwrapper -I. $(CPPFLAGS) -I$(SAMBA_SOURCE) -fPIC +FLAGS = $(CFLAGS) -Iinclude -I$(SAMBA_SOURCE)/include -I$(SAMBA_SOURCE)/popt -I$(SAMBA_SOURCE)/smbwrapper -I. $(CPPFLAGS) -I$(SAMBA_SOURCE) -fPIC prefix = @prefix@ diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index e6af475da6..a02bf3c146 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -226,6 +226,11 @@ static BOOL skel_lock(vfs_handle_struct *handle, files_struct *fsp, int fd, int return vfswrap_lock(NULL, fsp, fd, 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) +{ + return vfswrap_getlock(NULL, fsp, fd, poffset, pcount, ptype, ppid); +} + static int skel_symlink(vfs_handle_struct *handle, connection_struct *conn, const char *oldpath, const char *newpath) { return vfswrap_symlink(NULL, conn, oldpath, newpath); @@ -576,6 +581,7 @@ static vfs_op_tuple skel_op_tuples[] = { {SMB_VFS_OP(skel_utime), SMB_VFS_OP_UTIME, SMB_VFS_LAYER_OPAQUE}, {SMB_VFS_OP(skel_ftruncate), SMB_VFS_OP_FTRUNCATE, SMB_VFS_LAYER_OPAQUE}, {SMB_VFS_OP(skel_lock), SMB_VFS_OP_LOCK, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_getlock), SMB_VFS_OP_GETLOCK, SMB_VFS_LAYER_OPAQUE}, {SMB_VFS_OP(skel_symlink), SMB_VFS_OP_SYMLINK, SMB_VFS_LAYER_OPAQUE}, {SMB_VFS_OP(skel_readlink), SMB_VFS_OP_READLINK, SMB_VFS_LAYER_OPAQUE}, {SMB_VFS_OP(skel_link), SMB_VFS_OP_LINK, SMB_VFS_LAYER_OPAQUE}, diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c index 14fa2276e1..5996b29806 100644 --- a/examples/VFS/skel_transparent.c +++ b/examples/VFS/skel_transparent.c @@ -225,6 +225,11 @@ static BOOL skel_lock(vfs_handle_struct *handle, files_struct *fsp, int fd, int return SMB_VFS_NEXT_LOCK(handle, fsp, fd, 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) +{ + return SMB_VFS_NEXT_GETLOCK(handle, fsp, fd, poffset, pcount, ptype, ppid); +} + static int skel_symlink(vfs_handle_struct *handle, connection_struct *conn, const char *oldpath, const char *newpath) { return SMB_VFS_NEXT_SYMLINK(handle, conn, oldpath, newpath); @@ -543,6 +548,7 @@ static vfs_op_tuple skel_op_tuples[] = { {SMB_VFS_OP(skel_utime), SMB_VFS_OP_UTIME, SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(skel_ftruncate), SMB_VFS_OP_FTRUNCATE, SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(skel_lock), SMB_VFS_OP_LOCK, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_getlock), SMB_VFS_OP_GETLOCK, SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(skel_symlink), SMB_VFS_OP_SYMLINK, SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(skel_readlink), SMB_VFS_OP_READLINK, SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(skel_link), SMB_VFS_OP_LINK, SMB_VFS_LAYER_TRANSPARENT}, -- cgit From 6d291669972fc1344183dea29dced5e575ea7af8 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 11 Jul 2006 18:06:52 +0000 Subject: r16948: Sync the exmaples code from trunk. Jeremy. (This used to be commit 508ba05a8e4a7df8bf7f6ffe3d09a3c461026f78) --- examples/VFS/skel_opaque.c | 168 ++++++++++++++--------------- examples/VFS/skel_transparent.c | 232 ++++++++++++++++++++-------------------- 2 files changed, 200 insertions(+), 200 deletions(-) (limited to 'examples/VFS') diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index a02bf3c146..096068da14 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -38,7 +38,7 @@ * --metze */ -static int skel_connect(vfs_handle_struct *handle, connection_struct *conn, const char *service, const char *user) +static int skel_connect(vfs_handle_struct *handle, const char *service, const char *user) { return 0; } @@ -48,22 +48,22 @@ static void skel_disconnect(vfs_handle_struct *handle, connection_struct *conn) return; } -static SMB_BIG_UINT skel_disk_free(vfs_handle_struct *handle, connection_struct *conn, const char *path, +static SMB_BIG_UINT skel_disk_free(vfs_handle_struct *handle, const char *path, BOOL small_query, SMB_BIG_UINT *bsize, SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize) { - return vfswrap_disk_free(NULL, conn, path, small_query, bsize, + return vfswrap_disk_free(NULL, path, small_query, bsize, dfree, dsize); } -static int skel_get_quota(vfs_handle_struct *handle, connection_struct *conn, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dq) +static int skel_get_quota(vfs_handle_struct *handle, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dq) { - return vfswrap_get_quota(NULL, conn, qtype, id, dq); + return vfswrap_get_quota(NULL, qtype, id, dq); } -static int skel_set_quota(vfs_handle_struct *handle, connection_struct *conn, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dq) +static int skel_set_quota(vfs_handle_struct *handle, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dq) { - return vfswrap_set_quota(NULL, conn, qtype, id, dq); + return vfswrap_set_quota(NULL, qtype, id, dq); } static int skel_get_shadow_copy_data(vfs_handle_struct *handle, files_struct *fsp, SHADOW_COPY_DATA *shadow_copy_data, BOOL labels) @@ -71,54 +71,54 @@ static int skel_get_shadow_copy_data(vfs_handle_struct *handle, files_struct *fs return vfswrap_get_shadow_copy_data(NULL, fsp, shadow_copy_data, labels); } -static int skel_statvfs(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *path, struct vfs_statvfs_struct *statbuf) +static int skel_statvfs(struct vfs_handle_struct *handle, const char *path, struct vfs_statvfs_struct *statbuf) { - return vfswrap_statvfs(NULL, conn, path, statbuf); + return vfswrap_statvfs(NULL, path, statbuf); } -static SMB_STRUCT_DIR *skel_opendir(vfs_handle_struct *handle, connection_struct *conn, const char *fname, const char *mask, uint32 attr) +static SMB_STRUCT_DIR *skel_opendir(vfs_handle_struct *handle, const char *fname, const char *mask, uint32 attr) { - return vfswrap_opendir(NULL, conn, fname, mask, attr); + return vfswrap_opendir(NULL, fname, mask, attr); } -static SMB_STRUCT_DIRENT *skel_readdir(vfs_handle_struct *handle, connection_struct *conn, SMB_STRUCT_DIR *dirp) +static SMB_STRUCT_DIRENT *skel_readdir(vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp) { - return vfswrap_readdir(NULL, conn, dirp); + return vfswrap_readdir(NULL, dirp); } -static void skel_seekdir(vfs_handle_struct *handle, connection_struct *conn, SMB_STRUCT_DIR *dirp, long offset) +static void skel_seekdir(vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp, long offset) { - return vfswrap_seekdir(NULL, conn, dirp, offset); + return vfswrap_seekdir(NULL, dirp, offset); } -static long skel_telldir(vfs_handle_struct *handle, connection_struct *conn, SMB_STRUCT_DIR *dirp) +static long skel_telldir(vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp) { - return vfswrap_telldir(NULL, conn, dirp); + return vfswrap_telldir(NULL, dirp); } -static void skel_rewinddir(vfs_handle_struct *handle, connection_struct *conn, SMB_STRUCT_DIR *dirp) +static void skel_rewinddir(vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp) { - return vfswrap_rewinddir(NULL, conn, dirp); + return vfswrap_rewinddir(NULL, dirp); } -static int skel_mkdir(vfs_handle_struct *handle, connection_struct *conn, const char *path, mode_t mode) +static int skel_mkdir(vfs_handle_struct *handle, const char *path, mode_t mode) { - return vfswrap_mkdir(NULL, conn, path, mode); + return vfswrap_mkdir(NULL, path, mode); } -static int skel_rmdir(vfs_handle_struct *handle, connection_struct *conn, const char *path) +static int skel_rmdir(vfs_handle_struct *handle, const char *path) { - return vfswrap_rmdir(NULL, conn, path); + return vfswrap_rmdir(NULL, path); } -static int skel_closedir(vfs_handle_struct *handle, connection_struct *conn, SMB_STRUCT_DIR *dir) +static int skel_closedir(vfs_handle_struct *handle, SMB_STRUCT_DIR *dir) { - return vfswrap_closedir(NULL, conn, dir); + return vfswrap_closedir(NULL, dir); } -static int skel_open(vfs_handle_struct *handle, connection_struct *conn, const char *fname, int flags, mode_t mode) +static int skel_open(vfs_handle_struct *handle, const char *fname, files_struct *fsp, int flags, mode_t mode) { - return vfswrap_open(NULL, conn, fname, flags, mode); + return vfswrap_open(NULL, fname, flags, mode); } static int skel_close(vfs_handle_struct *handle, files_struct *fsp, int fd) @@ -151,9 +151,9 @@ static SMB_OFF_T skel_lseek(vfs_handle_struct *handle, files_struct *fsp, int fi return vfswrap_lseek(NULL, fsp, filedes, offset, whence); } -static int skel_rename(vfs_handle_struct *handle, connection_struct *conn, const char *oldname, const char *newname) +static int skel_rename(vfs_handle_struct *handle, const char *oldname, const char *newname) { - return vfswrap_rename(NULL, conn, oldname, newname); + return vfswrap_rename(NULL, oldname, newname); } static int skel_fsync(vfs_handle_struct *handle, files_struct *fsp, int fd) @@ -161,9 +161,9 @@ static int skel_fsync(vfs_handle_struct *handle, files_struct *fsp, int fd) return vfswrap_fsync(NULL, fsp, fd); } -static int skel_stat(vfs_handle_struct *handle, connection_struct *conn, const char *fname, SMB_STRUCT_STAT *sbuf) +static int skel_stat(vfs_handle_struct *handle, const char *fname, SMB_STRUCT_STAT *sbuf) { - return vfswrap_stat(NULL, conn, fname, sbuf); + return vfswrap_stat(NULL, fname, sbuf); } static int skel_fstat(vfs_handle_struct *handle, files_struct *fsp, int fd, SMB_STRUCT_STAT *sbuf) @@ -171,19 +171,19 @@ static int skel_fstat(vfs_handle_struct *handle, files_struct *fsp, int fd, SMB_ return vfswrap_fstat(NULL, fsp, fd, sbuf); } -static int skel_lstat(vfs_handle_struct *handle, connection_struct *conn, const char *path, SMB_STRUCT_STAT *sbuf) +static int skel_lstat(vfs_handle_struct *handle, const char *path, SMB_STRUCT_STAT *sbuf) { - return vfswrap_lstat(NULL, conn, path, sbuf); + return vfswrap_lstat(NULL, path, sbuf); } -static int skel_unlink(vfs_handle_struct *handle, connection_struct *conn, const char *path) +static int skel_unlink(vfs_handle_struct *handle, const char *path) { - return vfswrap_unlink(NULL, conn, path); + return vfswrap_unlink(NULL, path); } -static int skel_chmod(vfs_handle_struct *handle, connection_struct *conn, const char *path, mode_t mode) +static int skel_chmod(vfs_handle_struct *handle, const char *path, mode_t mode) { - return vfswrap_chmod(NULL, conn, path, mode); + return vfswrap_chmod(NULL, path, mode); } static int skel_fchmod(vfs_handle_struct *handle, files_struct *fsp, int fd, mode_t mode) @@ -191,9 +191,9 @@ static int skel_fchmod(vfs_handle_struct *handle, files_struct *fsp, int fd, mod return vfswrap_fchmod(NULL, fsp, fd, mode); } -static int skel_chown(vfs_handle_struct *handle, connection_struct *conn, const char *path, uid_t uid, gid_t gid) +static int skel_chown(vfs_handle_struct *handle, const char *path, uid_t uid, gid_t gid) { - return vfswrap_chown(NULL, conn, path, uid, gid); + 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) @@ -201,19 +201,19 @@ static int skel_fchown(vfs_handle_struct *handle, files_struct *fsp, int fd, uid return vfswrap_fchown(NULL, fsp, fd, uid, gid); } -static int skel_chdir(vfs_handle_struct *handle, connection_struct *conn, const char *path) +static int skel_chdir(vfs_handle_struct *handle, const char *path) { - return vfswrap_chdir(NULL, conn, path); + return vfswrap_chdir(NULL, path); } -static char *skel_getwd(vfs_handle_struct *handle, connection_struct *conn, char *buf) +static char *skel_getwd(vfs_handle_struct *handle, char *buf) { - return vfswrap_getwd(NULL, conn, buf); + return vfswrap_getwd(NULL, buf); } -static int skel_utime(vfs_handle_struct *handle, connection_struct *conn, const char *path, struct utimbuf *times) +static int skel_utime(vfs_handle_struct *handle, const char *path, struct utimbuf *times) { - return vfswrap_utime(NULL, conn, path, times); + return vfswrap_utime(NULL, path, times); } static int skel_ftruncate(vfs_handle_struct *handle, files_struct *fsp, int fd, SMB_OFF_T offset) @@ -231,29 +231,29 @@ static BOOL skel_getlock(vfs_handle_struct *handle, files_struct *fsp, int fd, S return vfswrap_getlock(NULL, fsp, fd, poffset, pcount, ptype, ppid); } -static int skel_symlink(vfs_handle_struct *handle, connection_struct *conn, const char *oldpath, const char *newpath) +static int skel_symlink(vfs_handle_struct *handle, const char *oldpath, const char *newpath) { - return vfswrap_symlink(NULL, conn, oldpath, newpath); + return vfswrap_symlink(NULL, oldpath, newpath); } -static int skel_readlink(vfs_handle_struct *handle, connection_struct *conn, const char *path, char *buf, size_t bufsiz) +static int skel_readlink(vfs_handle_struct *handle, const char *path, char *buf, size_t bufsiz) { - return vfswrap_readlink(NULL, conn, path, buf, bufsiz); + return vfswrap_readlink(NULL, path, buf, bufsiz); } -static int skel_link(vfs_handle_struct *handle, connection_struct *conn, const char *oldpath, const char *newpath) +static int skel_link(vfs_handle_struct *handle, const char *oldpath, const char *newpath) { - return vfswrap_link(NULL, conn, oldpath, newpath); + return vfswrap_link(NULL, oldpath, newpath); } -static int skel_mknod(vfs_handle_struct *handle, connection_struct *conn, const char *path, mode_t mode, SMB_DEV_T dev) +static int skel_mknod(vfs_handle_struct *handle, const char *path, mode_t mode, SMB_DEV_T dev) { - return vfswrap_mknod(NULL, conn, path, mode, dev); + return vfswrap_mknod(NULL, path, mode, dev); } -static char *skel_realpath(vfs_handle_struct *handle, connection_struct *conn, const char *path, char *resolved_path) +static char *skel_realpath(vfs_handle_struct *handle, const char *path, char *resolved_path) { - return vfswrap_realpath(NULL, conn, path, resolved_path); + return vfswrap_realpath(NULL, path, resolved_path); } static size_t skel_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp, int fd, uint32 security_info, struct security_descriptor_info **ppdesc) @@ -280,7 +280,7 @@ static BOOL skel_set_nt_acl(vfs_handle_struct *handle, files_struct *fsp, const return False; } -static int skel_chmod_acl(vfs_handle_struct *handle, connection_struct *conn, const char *name, mode_t mode) +static int skel_chmod_acl(vfs_handle_struct *handle, const char *name, mode_t mode) { errno = ENOSYS; return -1; @@ -292,31 +292,31 @@ static int skel_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp, int fd, return -1; } -static int skel_sys_acl_get_entry(vfs_handle_struct *handle, connection_struct *conn, SMB_ACL_T theacl, int entry_id, SMB_ACL_ENTRY_T *entry_p) +static int skel_sys_acl_get_entry(vfs_handle_struct *handle, SMB_ACL_T theacl, int entry_id, SMB_ACL_ENTRY_T *entry_p) { errno = ENOSYS; return -1; } -static int skel_sys_acl_get_tag_type(vfs_handle_struct *handle, connection_struct *conn, SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T *tag_type_p) +static int skel_sys_acl_get_tag_type(vfs_handle_struct *handle, SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T *tag_type_p) { errno = ENOSYS; return -1; } -static int skel_sys_acl_get_permset(vfs_handle_struct *handle, connection_struct *conn, SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T *permset_p) +static int skel_sys_acl_get_permset(vfs_handle_struct *handle, SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T *permset_p) { errno = ENOSYS; return -1; } -static void *skel_sys_acl_get_qualifier(vfs_handle_struct *handle, connection_struct *conn, SMB_ACL_ENTRY_T entry_d) +static void *skel_sys_acl_get_qualifier(vfs_handle_struct *handle, SMB_ACL_ENTRY_T entry_d) { errno = ENOSYS; return NULL; } -static SMB_ACL_T skel_sys_acl_get_file(vfs_handle_struct *handle, connection_struct *conn, const char *path_p, SMB_ACL_TYPE_T type) +static SMB_ACL_T skel_sys_acl_get_file(vfs_handle_struct *handle, const char *path_p, SMB_ACL_TYPE_T type) { errno = ENOSYS; return NULL; @@ -328,61 +328,61 @@ static SMB_ACL_T skel_sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fs return NULL; } -static int skel_sys_acl_clear_perms(vfs_handle_struct *handle, connection_struct *conn, SMB_ACL_PERMSET_T permset) +static int skel_sys_acl_clear_perms(vfs_handle_struct *handle, SMB_ACL_PERMSET_T permset) { errno = ENOSYS; return -1; } -static int skel_sys_acl_add_perm(vfs_handle_struct *handle, connection_struct *conn, SMB_ACL_PERMSET_T permset, SMB_ACL_PERM_T perm) +static int skel_sys_acl_add_perm(vfs_handle_struct *handle, SMB_ACL_PERMSET_T permset, SMB_ACL_PERM_T perm) { errno = ENOSYS; return -1; } -static char *skel_sys_acl_to_text(vfs_handle_struct *handle, connection_struct *conn, SMB_ACL_T theacl, ssize_t *plen) +static char *skel_sys_acl_to_text(vfs_handle_struct *handle, SMB_ACL_T theacl, ssize_t *plen) { errno = ENOSYS; return NULL; } -static SMB_ACL_T skel_sys_acl_init(vfs_handle_struct *handle, connection_struct *conn, int count) +static SMB_ACL_T skel_sys_acl_init(vfs_handle_struct *handle, int count) { errno = ENOSYS; return NULL; } -static int skel_sys_acl_create_entry(vfs_handle_struct *handle, connection_struct *conn, SMB_ACL_T *pacl, SMB_ACL_ENTRY_T *pentry) +static int skel_sys_acl_create_entry(vfs_handle_struct *handle, SMB_ACL_T *pacl, SMB_ACL_ENTRY_T *pentry) { errno = ENOSYS; return -1; } -static int skel_sys_acl_set_tag_type(vfs_handle_struct *handle, connection_struct *conn, SMB_ACL_ENTRY_T entry, SMB_ACL_TAG_T tagtype) +static int skel_sys_acl_set_tag_type(vfs_handle_struct *handle, SMB_ACL_ENTRY_T entry, SMB_ACL_TAG_T tagtype) { errno = ENOSYS; return -1; } -static int skel_sys_acl_set_qualifier(vfs_handle_struct *handle, connection_struct *conn, SMB_ACL_ENTRY_T entry, void *qual) +static int skel_sys_acl_set_qualifier(vfs_handle_struct *handle, SMB_ACL_ENTRY_T entry, void *qual) { errno = ENOSYS; return -1; } -static int skel_sys_acl_set_permset(vfs_handle_struct *handle, connection_struct *conn, SMB_ACL_ENTRY_T entry, SMB_ACL_PERMSET_T permset) +static int skel_sys_acl_set_permset(vfs_handle_struct *handle, SMB_ACL_ENTRY_T entry, SMB_ACL_PERMSET_T permset) { errno = ENOSYS; return -1; } -static int skel_sys_acl_valid(vfs_handle_struct *handle, connection_struct *conn, SMB_ACL_T theacl ) +static int skel_sys_acl_valid(vfs_handle_struct *handle, SMB_ACL_T theacl ) { errno = ENOSYS; return -1; } -static int skel_sys_acl_set_file(vfs_handle_struct *handle, connection_struct *conn, const char *name, SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl) +static int skel_sys_acl_set_file(vfs_handle_struct *handle, const char *name, SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl) { errno = ENOSYS; return -1; @@ -394,43 +394,43 @@ static int skel_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp, int return -1; } -static int skel_sys_acl_delete_def_file(vfs_handle_struct *handle, connection_struct *conn, const char *path) +static int skel_sys_acl_delete_def_file(vfs_handle_struct *handle, const char *path) { errno = ENOSYS; return -1; } -static int skel_sys_acl_get_perm(vfs_handle_struct *handle, connection_struct *conn, SMB_ACL_PERMSET_T permset, SMB_ACL_PERM_T perm) +static int skel_sys_acl_get_perm(vfs_handle_struct *handle, SMB_ACL_PERMSET_T permset, SMB_ACL_PERM_T perm) { errno = ENOSYS; return -1; } -static int skel_sys_acl_free_text(vfs_handle_struct *handle, connection_struct *conn, char *text) +static int skel_sys_acl_free_text(vfs_handle_struct *handle, char *text) { errno = ENOSYS; return -1; } -static int skel_sys_acl_free_acl(vfs_handle_struct *handle, connection_struct *conn, SMB_ACL_T posix_acl) +static int skel_sys_acl_free_acl(vfs_handle_struct *handle, SMB_ACL_T posix_acl) { errno = ENOSYS; return -1; } -static int skel_sys_acl_free_qualifier(vfs_handle_struct *handle, connection_struct *conn, void *qualifier, SMB_ACL_TAG_T tagtype) +static int skel_sys_acl_free_qualifier(vfs_handle_struct *handle, void *qualifier, SMB_ACL_TAG_T tagtype) { errno = ENOSYS; return -1; } -static ssize_t skel_getxattr(vfs_handle_struct *handle, struct connection_struct *conn,const char *path, const char *name, void *value, size_t size) +static ssize_t skel_getxattr(vfs_handle_struct *handle, const char *path, const char *name, void *value, size_t size) { errno = ENOSYS; return -1; } -static ssize_t skel_lgetxattr(vfs_handle_struct *handle, struct connection_struct *conn,const char *path, const char *name, void *value, size_t +static ssize_t skel_lgetxattr(vfs_handle_struct *handle, const char *path, const char *name, void *value, size_t size) { errno = ENOSYS; @@ -443,13 +443,13 @@ static ssize_t skel_fgetxattr(vfs_handle_struct *handle, struct files_struct *fs return -1; } -static ssize_t skel_listxattr(vfs_handle_struct *handle, struct connection_struct *conn,const char *path, char *list, size_t size) +static ssize_t skel_listxattr(vfs_handle_struct *handle, const char *path, char *list, size_t size) { errno = ENOSYS; return -1; } -static ssize_t skel_llistxattr(vfs_handle_struct *handle, struct connection_struct *conn,const char *path, char *list, size_t size) +static ssize_t skel_llistxattr(vfs_handle_struct *handle, const char *path, char *list, size_t size) { errno = ENOSYS; return -1; @@ -461,13 +461,13 @@ static ssize_t skel_flistxattr(vfs_handle_struct *handle, struct files_struct *f return -1; } -static int skel_removexattr(vfs_handle_struct *handle, struct connection_struct *conn,const char *path, const char *name) +static int skel_removexattr(vfs_handle_struct *handle, const char *path, const char *name) { errno = ENOSYS; return -1; } -static int skel_lremovexattr(vfs_handle_struct *handle, struct connection_struct *conn,const char *path, const char *name) +static int skel_lremovexattr(vfs_handle_struct *handle, const char *path, const char *name) { errno = ENOSYS; return -1; @@ -479,13 +479,13 @@ static int skel_fremovexattr(vfs_handle_struct *handle, struct files_struct *fsp return -1; } -static int skel_setxattr(vfs_handle_struct *handle, struct connection_struct *conn,const char *path, const char *name, const void *value, size_t size, int flags) +static int skel_setxattr(vfs_handle_struct *handle, const char *path, const char *name, const void *value, size_t size, int flags) { errno = ENOSYS; return -1; } -static int skel_lsetxattr(vfs_handle_struct *handle, struct connection_struct *conn,const char *path, const char *name, const void *value, size_t size, int flags) +static int skel_lsetxattr(vfs_handle_struct *handle, const char *path, const char *name, const void *value, size_t size, int flags) { errno = ENOSYS; return -1; diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c index 5996b29806..2a379cd6d8 100644 --- a/examples/VFS/skel_transparent.c +++ b/examples/VFS/skel_transparent.c @@ -37,32 +37,32 @@ * --metze */ -static int skel_connect(vfs_handle_struct *handle, connection_struct *conn, const char *service, const char *user) +static int skel_connect(vfs_handle_struct *handle, const char *service, const char *user) { - return SMB_VFS_NEXT_CONNECT(handle, conn, service, user); + return SMB_VFS_NEXT_CONNECT(handle, service, user); } -static void skel_disconnect(vfs_handle_struct *handle, connection_struct *conn) +static void skel_disconnect(vfs_handle_struct *handle) { - SMB_VFS_NEXT_DISCONNECT(handle, conn); + SMB_VFS_NEXT_DISCONNECT(handle); } -static SMB_BIG_UINT skel_disk_free(vfs_handle_struct *handle, connection_struct *conn, const char *path, +static SMB_BIG_UINT skel_disk_free(vfs_handle_struct *handle, const char *path, BOOL small_query, SMB_BIG_UINT *bsize, SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize) { - return SMB_VFS_NEXT_DISK_FREE(handle, conn, path, small_query, bsize, + return SMB_VFS_NEXT_DISK_FREE(handle, path, small_query, bsize, dfree, dsize); } -static int skel_get_quota(vfs_handle_struct *handle, connection_struct *conn, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dq) +static int skel_get_quota(vfs_handle_struct *handle, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dq) { - return SMB_VFS_NEXT_GET_QUOTA(handle, conn, qtype, id, dq); + return SMB_VFS_NEXT_GET_QUOTA(handle, qtype, id, dq); } -static int skel_set_quota(vfs_handle_struct *handle, connection_struct *conn, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dq) +static int skel_set_quota(vfs_handle_struct *handle, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dq) { - return SMB_VFS_NEXT_SET_QUOTA(handle, conn, qtype, id, dq); + return SMB_VFS_NEXT_SET_QUOTA(handle, qtype, id, dq); } static int skel_get_shadow_copy_data(vfs_handle_struct *handle, files_struct *fsp, SHADOW_COPY_DATA *shadow_copy_data, BOOL labels) @@ -70,54 +70,54 @@ static int skel_get_shadow_copy_data(vfs_handle_struct *handle, files_struct *fs return SMB_VFS_NEXT_GET_SHADOW_COPY_DATA(handle, fsp, shadow_copy_data, labels); } -static int skel_statvfs(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *path, struct vfs_statvfs_struct *statbuf) +static int skel_statvfs(struct vfs_handle_struct *handle, const char *path, struct vfs_statvfs_struct *statbuf) { - return SMB_VFS_NEXT_STATVFS(handle, conn, path, statbuf); + return SMB_VFS_NEXT_STATVFS(handle, path, statbuf); } -static SMB_STRUCT_DIR *skel_opendir(vfs_handle_struct *handle, connection_struct *conn, const char *fname, const char *mask, uint32 attr) +static SMB_STRUCT_DIR *skel_opendir(vfs_handle_struct *handle, const char *fname, const char *mask, uint32 attr) { - return SMB_VFS_NEXT_OPENDIR(handle, conn, fname, mask, attr); + return SMB_VFS_NEXT_OPENDIR(handle, fname, mask, attr); } -static SMB_STRUCT_DIRENT *skel_readdir(vfs_handle_struct *handle, connection_struct *conn, SMB_STRUCT_DIR *dirp) +static SMB_STRUCT_DIRENT *skel_readdir(vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp) { - return SMB_VFS_NEXT_READDIR(handle, conn, dirp); + return SMB_VFS_NEXT_READDIR(handle, dirp); } -static void skel_seekdir(vfs_handle_struct *handle, connection_struct *conn, SMB_STRUCT_DIR *dirp, long offset) +static void skel_seekdir(vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp, long offset) { - return SMB_VFS_NEXT_SEEKDIR(handle, conn, dirp, offset); + return SMB_VFS_NEXT_SEEKDIR(handle, dirp, offset); } -static long skel_telldir(vfs_handle_struct *handle, connection_struct *conn, SMB_STRUCT_DIR *dirp) +static long skel_telldir(vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp) { - return SMB_VFS_NEXT_TELLDIR(handle, conn, dirp); + return SMB_VFS_NEXT_TELLDIR(handle, dirp); } -static void skel_rewinddir(vfs_handle_struct *handle, connection_struct *conn, SMB_STRUCT_DIR *dirp) +static void skel_rewinddir(vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp) { - return SMB_VFS_NEXT_REWINDDIR(handle, conn, dirp); + return SMB_VFS_NEXT_REWINDDIR(handle, dirp); } -static int skel_mkdir(vfs_handle_struct *handle, connection_struct *conn, const char *path, mode_t mode) +static int skel_mkdir(vfs_handle_struct *handle, const char *path, mode_t mode) { - return SMB_VFS_NEXT_MKDIR(handle, conn, path, mode); + return SMB_VFS_NEXT_MKDIR(handle, path, mode); } -static int skel_rmdir(vfs_handle_struct *handle, connection_struct *conn, const char *path) +static int skel_rmdir(vfs_handle_struct *handle, const char *path) { - return SMB_VFS_NEXT_RMDIR(handle, conn, path); + return SMB_VFS_NEXT_RMDIR(handle, path); } -static int skel_closedir(vfs_handle_struct *handle, connection_struct *conn, SMB_STRUCT_DIR *dir) +static int skel_closedir(vfs_handle_struct *handle, SMB_STRUCT_DIR *dir) { - return SMB_VFS_NEXT_CLOSEDIR(handle, conn, dir); + return SMB_VFS_NEXT_CLOSEDIR(handle, dir); } -static int skel_open(vfs_handle_struct *handle, connection_struct *conn, const char *fname, int flags, mode_t mode) +static int skel_open(vfs_handle_struct *handle, const char *fname, files_struct *fsp, int flags, mode_t mode) { - return SMB_VFS_NEXT_OPEN(handle, conn, fname, flags, mode); + return SMB_VFS_NEXT_OPEN(handle, fname, fsp, flags, mode); } static int skel_close(vfs_handle_struct *handle, files_struct *fsp, int fd) @@ -150,9 +150,9 @@ static SMB_OFF_T skel_lseek(vfs_handle_struct *handle, files_struct *fsp, int fi return SMB_VFS_NEXT_LSEEK(handle, fsp, filedes, offset, whence); } -static int skel_rename(vfs_handle_struct *handle, connection_struct *conn, const char *oldname, const char *newname) +static int skel_rename(vfs_handle_struct *handle, const char *oldname, const char *newname) { - return SMB_VFS_NEXT_RENAME(handle, conn, oldname, newname); + return SMB_VFS_NEXT_RENAME(handle, oldname, newname); } static int skel_fsync(vfs_handle_struct *handle, files_struct *fsp, int fd) @@ -160,9 +160,9 @@ static int skel_fsync(vfs_handle_struct *handle, files_struct *fsp, int fd) return SMB_VFS_NEXT_FSYNC(handle, fsp, fd); } -static int skel_stat(vfs_handle_struct *handle, connection_struct *conn, const char *fname, SMB_STRUCT_STAT *sbuf) +static int skel_stat(vfs_handle_struct *handle, const char *fname, SMB_STRUCT_STAT *sbuf) { - return SMB_VFS_NEXT_STAT(handle, conn, fname, sbuf); + 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) @@ -170,19 +170,19 @@ static int skel_fstat(vfs_handle_struct *handle, files_struct *fsp, int fd, SMB_ return SMB_VFS_NEXT_FSTAT(handle, fsp, fd, sbuf); } -static int skel_lstat(vfs_handle_struct *handle, connection_struct *conn, const char *path, SMB_STRUCT_STAT *sbuf) +static int skel_lstat(vfs_handle_struct *handle, const char *path, SMB_STRUCT_STAT *sbuf) { - return SMB_VFS_NEXT_LSTAT(handle, conn, path, sbuf); + return SMB_VFS_NEXT_LSTAT(handle, path, sbuf); } -static int skel_unlink(vfs_handle_struct *handle, connection_struct *conn, const char *path) +static int skel_unlink(vfs_handle_struct *handle, const char *path) { - return SMB_VFS_NEXT_UNLINK(handle, conn, path); + return SMB_VFS_NEXT_UNLINK(handle, path); } -static int skel_chmod(vfs_handle_struct *handle, connection_struct *conn, const char *path, mode_t mode) +static int skel_chmod(vfs_handle_struct *handle, const char *path, mode_t mode) { - return SMB_VFS_NEXT_CHMOD(handle, conn, path, 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) @@ -190,9 +190,9 @@ static int skel_fchmod(vfs_handle_struct *handle, files_struct *fsp, int fd, mod return SMB_VFS_NEXT_FCHMOD(handle, fsp, fd, mode); } -static int skel_chown(vfs_handle_struct *handle, connection_struct *conn, const char *path, uid_t uid, gid_t gid) +static int skel_chown(vfs_handle_struct *handle, const char *path, uid_t uid, gid_t gid) { - return SMB_VFS_NEXT_CHOWN(handle, conn, path, uid, gid); + 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) @@ -200,19 +200,19 @@ static int skel_fchown(vfs_handle_struct *handle, files_struct *fsp, int fd, uid return SMB_VFS_NEXT_FCHOWN(handle, fsp, fd, uid, gid); } -static int skel_chdir(vfs_handle_struct *handle, connection_struct *conn, const char *path) +static int skel_chdir(vfs_handle_struct *handle, const char *path) { - return SMB_VFS_NEXT_CHDIR(handle, conn, path); + return SMB_VFS_NEXT_CHDIR(handle, path); } -static char *skel_getwd(vfs_handle_struct *handle, connection_struct *conn, char *buf) +static char *skel_getwd(vfs_handle_struct *handle, char *buf) { - return SMB_VFS_NEXT_GETWD(handle, conn, buf); + return SMB_VFS_NEXT_GETWD(handle, buf); } -static int skel_utime(vfs_handle_struct *handle, connection_struct *conn, const char *path, struct utimbuf *times) +static int skel_utime(vfs_handle_struct *handle, const char *path, struct utimbuf *times) { - return SMB_VFS_NEXT_UTIME(handle, conn, path, times); + return SMB_VFS_NEXT_UTIME(handle, path, times); } static int skel_ftruncate(vfs_handle_struct *handle, files_struct *fsp, int fd, SMB_OFF_T offset) @@ -230,29 +230,29 @@ static BOOL skel_getlock(vfs_handle_struct *handle, files_struct *fsp, int fd, S return SMB_VFS_NEXT_GETLOCK(handle, fsp, fd, poffset, pcount, ptype, ppid); } -static int skel_symlink(vfs_handle_struct *handle, connection_struct *conn, const char *oldpath, const char *newpath) +static int skel_symlink(vfs_handle_struct *handle, const char *oldpath, const char *newpath) { - return SMB_VFS_NEXT_SYMLINK(handle, conn, oldpath, newpath); + return SMB_VFS_NEXT_SYMLINK(handle, oldpath, newpath); } -static int skel_readlink(vfs_handle_struct *handle, connection_struct *conn, const char *path, char *buf, size_t bufsiz) +static int skel_readlink(vfs_handle_struct *handle, const char *path, char *buf, size_t bufsiz) { - return SMB_VFS_NEXT_READLINK(handle, conn, path, buf, bufsiz); + return SMB_VFS_NEXT_READLINK(handle, path, buf, bufsiz); } -static int skel_link(vfs_handle_struct *handle, connection_struct *conn, const char *oldpath, const char *newpath) +static int skel_link(vfs_handle_struct *handle, const char *oldpath, const char *newpath) { - return SMB_VFS_NEXT_LINK(handle, conn, oldpath, newpath); + return SMB_VFS_NEXT_LINK(handle, oldpath, newpath); } -static int skel_mknod(vfs_handle_struct *handle, connection_struct *conn, const char *path, mode_t mode, SMB_DEV_T dev) +static int skel_mknod(vfs_handle_struct *handle, const char *path, mode_t mode, SMB_DEV_T dev) { - return SMB_VFS_NEXT_MKNOD(handle, conn, path, mode, dev); + return SMB_VFS_NEXT_MKNOD(handle, path, mode, dev); } -static char *skel_realpath(vfs_handle_struct *handle, connection_struct *conn, const char *path, char *resolved_path) +static char *skel_realpath(vfs_handle_struct *handle, const char *path, char *resolved_path) { - return SMB_VFS_NEXT_REALPATH(handle, conn, path, resolved_path); + return SMB_VFS_NEXT_REALPATH(handle, path, resolved_path); } static size_t skel_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp, int fd, uint32 security_info, struct security_descriptor_info **ppdesc) @@ -275,14 +275,14 @@ static BOOL skel_set_nt_acl(vfs_handle_struct *handle, files_struct *fsp, const return SMB_VFS_NEXT_SET_NT_ACL(handle, fsp, name, security_info_sent, psd); } -static int skel_chmod_acl(vfs_handle_struct *handle, connection_struct *conn, const char *name, mode_t mode) +static int skel_chmod_acl(vfs_handle_struct *handle, const char *name, mode_t mode) { /* If the underlying VFS doesn't have ACL support... */ if (!handle->vfs_next.ops.chmod_acl) { errno = ENOSYS; return -1; } - return SMB_VFS_NEXT_CHMOD_ACL(handle, conn, name, mode); + return SMB_VFS_NEXT_CHMOD_ACL(handle, name, mode); } static int skel_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp, int fd, mode_t mode) @@ -295,29 +295,29 @@ static int skel_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp, int fd, return SMB_VFS_NEXT_FCHMOD_ACL(handle, fsp, fd, mode); } -static int skel_sys_acl_get_entry(vfs_handle_struct *handle, connection_struct *conn, SMB_ACL_T theacl, int entry_id, SMB_ACL_ENTRY_T *entry_p) +static int skel_sys_acl_get_entry(vfs_handle_struct *handle, SMB_ACL_T theacl, int entry_id, SMB_ACL_ENTRY_T *entry_p) { - return SMB_VFS_NEXT_SYS_ACL_GET_ENTRY(handle, conn, theacl, entry_id, entry_p); + return SMB_VFS_NEXT_SYS_ACL_GET_ENTRY(handle, theacl, entry_id, entry_p); } -static int skel_sys_acl_get_tag_type(vfs_handle_struct *handle, connection_struct *conn, SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T *tag_type_p) +static int skel_sys_acl_get_tag_type(vfs_handle_struct *handle, SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T *tag_type_p) { - return SMB_VFS_NEXT_SYS_ACL_GET_TAG_TYPE(handle, conn, entry_d, tag_type_p); + return SMB_VFS_NEXT_SYS_ACL_GET_TAG_TYPE(handle, entry_d, tag_type_p); } -static int skel_sys_acl_get_permset(vfs_handle_struct *handle, connection_struct *conn, SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T *permset_p) +static int skel_sys_acl_get_permset(vfs_handle_struct *handle, SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T *permset_p) { - return SMB_VFS_NEXT_SYS_ACL_GET_PERMSET(handle, conn, entry_d, permset_p); + return SMB_VFS_NEXT_SYS_ACL_GET_PERMSET(handle, entry_d, permset_p); } -static void *skel_sys_acl_get_qualifier(vfs_handle_struct *handle, connection_struct *conn, SMB_ACL_ENTRY_T entry_d) +static void *skel_sys_acl_get_qualifier(vfs_handle_struct *handle, SMB_ACL_ENTRY_T entry_d) { - return SMB_VFS_NEXT_SYS_ACL_GET_QUALIFIER(handle, conn, entry_d); + return SMB_VFS_NEXT_SYS_ACL_GET_QUALIFIER(handle, entry_d); } -static SMB_ACL_T skel_sys_acl_get_file(vfs_handle_struct *handle, connection_struct *conn, const char *path_p, SMB_ACL_TYPE_T type) +static SMB_ACL_T skel_sys_acl_get_file(vfs_handle_struct *handle, const char *path_p, SMB_ACL_TYPE_T type) { - return SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, conn, path_p, type); + return SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, path_p, type); } static SMB_ACL_T skel_sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp, int fd) @@ -325,54 +325,54 @@ static SMB_ACL_T skel_sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fs return SMB_VFS_NEXT_SYS_ACL_GET_FD(handle, fsp, fd); } -static int skel_sys_acl_clear_perms(vfs_handle_struct *handle, connection_struct *conn, SMB_ACL_PERMSET_T permset) +static int skel_sys_acl_clear_perms(vfs_handle_struct *handle, SMB_ACL_PERMSET_T permset) { - return SMB_VFS_NEXT_SYS_ACL_CLEAR_PERMS(handle, conn, permset); + return SMB_VFS_NEXT_SYS_ACL_CLEAR_PERMS(handle, permset); } -static int skel_sys_acl_add_perm(vfs_handle_struct *handle, connection_struct *conn, SMB_ACL_PERMSET_T permset, SMB_ACL_PERM_T perm) +static int skel_sys_acl_add_perm(vfs_handle_struct *handle, SMB_ACL_PERMSET_T permset, SMB_ACL_PERM_T perm) { - return SMB_VFS_NEXT_SYS_ACL_ADD_PERM(handle, conn, permset, perm); + return SMB_VFS_NEXT_SYS_ACL_ADD_PERM(handle, permset, perm); } -static char *skel_sys_acl_to_text(vfs_handle_struct *handle, connection_struct *conn, SMB_ACL_T theacl, ssize_t *plen) +static char *skel_sys_acl_to_text(vfs_handle_struct *handle, SMB_ACL_T theacl, ssize_t *plen) { - return SMB_VFS_NEXT_SYS_ACL_TO_TEXT(handle, conn, theacl, plen); + return SMB_VFS_NEXT_SYS_ACL_TO_TEXT(handle, theacl, plen); } -static SMB_ACL_T skel_sys_acl_init(vfs_handle_struct *handle, connection_struct *conn, int count) +static SMB_ACL_T skel_sys_acl_init(vfs_handle_struct *handle, int count) { - return SMB_VFS_NEXT_SYS_ACL_INIT(handle, conn, count); + return SMB_VFS_NEXT_SYS_ACL_INIT(handle, count); } -static int skel_sys_acl_create_entry(vfs_handle_struct *handle, connection_struct *conn, SMB_ACL_T *pacl, SMB_ACL_ENTRY_T *pentry) +static int skel_sys_acl_create_entry(vfs_handle_struct *handle, SMB_ACL_T *pacl, SMB_ACL_ENTRY_T *pentry) { - return SMB_VFS_NEXT_SYS_ACL_CREATE_ENTRY(handle, conn, pacl, pentry); + return SMB_VFS_NEXT_SYS_ACL_CREATE_ENTRY(handle, pacl, pentry); } -static int skel_sys_acl_set_tag_type(vfs_handle_struct *handle, connection_struct *conn, SMB_ACL_ENTRY_T entry, SMB_ACL_TAG_T tagtype) +static int skel_sys_acl_set_tag_type(vfs_handle_struct *handle, SMB_ACL_ENTRY_T entry, SMB_ACL_TAG_T tagtype) { - return SMB_VFS_NEXT_SYS_ACL_SET_TAG_TYPE(handle, conn, entry, tagtype); + return SMB_VFS_NEXT_SYS_ACL_SET_TAG_TYPE(handle, entry, tagtype); } -static int skel_sys_acl_set_qualifier(vfs_handle_struct *handle, connection_struct *conn, SMB_ACL_ENTRY_T entry, void *qual) +static int skel_sys_acl_set_qualifier(vfs_handle_struct *handle, SMB_ACL_ENTRY_T entry, void *qual) { - return SMB_VFS_NEXT_SYS_ACL_SET_QUALIFIER(handle, conn, entry, qual); + return SMB_VFS_NEXT_SYS_ACL_SET_QUALIFIER(handle, entry, qual); } -static int skel_sys_acl_set_permset(vfs_handle_struct *handle, connection_struct *conn, SMB_ACL_ENTRY_T entry, SMB_ACL_PERMSET_T permset) +static int skel_sys_acl_set_permset(vfs_handle_struct *handle, SMB_ACL_ENTRY_T entry, SMB_ACL_PERMSET_T permset) { - return SMB_VFS_NEXT_SYS_ACL_SET_PERMSET(handle, conn, entry, permset); + return SMB_VFS_NEXT_SYS_ACL_SET_PERMSET(handle, entry, permset); } -static int skel_sys_acl_valid(vfs_handle_struct *handle, connection_struct *conn, SMB_ACL_T theacl ) +static int skel_sys_acl_valid(vfs_handle_struct *handle, SMB_ACL_T theacl ) { - return SMB_VFS_NEXT_SYS_ACL_VALID(handle, conn, theacl); + return SMB_VFS_NEXT_SYS_ACL_VALID(handle, theacl); } -static int skel_sys_acl_set_file(vfs_handle_struct *handle, connection_struct *conn, const char *name, SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl) +static int skel_sys_acl_set_file(vfs_handle_struct *handle, const char *name, SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl) { - return SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, conn, name, acltype, theacl); + return SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, name, acltype, theacl); } static int skel_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp, int fd, SMB_ACL_T theacl) @@ -380,40 +380,40 @@ static int skel_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp, int return SMB_VFS_NEXT_SYS_ACL_SET_FD(handle, fsp, fd, theacl); } -static int skel_sys_acl_delete_def_file(vfs_handle_struct *handle, connection_struct *conn, const char *path) +static int skel_sys_acl_delete_def_file(vfs_handle_struct *handle, const char *path) { - return SMB_VFS_NEXT_SYS_ACL_DELETE_DEF_FILE(handle, conn, path); + return SMB_VFS_NEXT_SYS_ACL_DELETE_DEF_FILE(handle, path); } -static int skel_sys_acl_get_perm(vfs_handle_struct *handle, connection_struct *conn, SMB_ACL_PERMSET_T permset, SMB_ACL_PERM_T perm) +static int skel_sys_acl_get_perm(vfs_handle_struct *handle, SMB_ACL_PERMSET_T permset, SMB_ACL_PERM_T perm) { - return SMB_VFS_NEXT_SYS_ACL_GET_PERM(handle, conn, permset, perm); + return SMB_VFS_NEXT_SYS_ACL_GET_PERM(handle, permset, perm); } -static int skel_sys_acl_free_text(vfs_handle_struct *handle, connection_struct *conn, char *text) +static int skel_sys_acl_free_text(vfs_handle_struct *handle, char *text) { - return SMB_VFS_NEXT_SYS_ACL_FREE_TEXT(handle, conn, text); + return SMB_VFS_NEXT_SYS_ACL_FREE_TEXT(handle, text); } -static int skel_sys_acl_free_acl(vfs_handle_struct *handle, connection_struct *conn, SMB_ACL_T posix_acl) +static int skel_sys_acl_free_acl(vfs_handle_struct *handle, SMB_ACL_T posix_acl) { - return SMB_VFS_NEXT_SYS_ACL_FREE_ACL(handle, conn, posix_acl); + return SMB_VFS_NEXT_SYS_ACL_FREE_ACL(handle, posix_acl); } -static int skel_sys_acl_free_qualifier(vfs_handle_struct *handle, connection_struct *conn, void *qualifier, SMB_ACL_TAG_T tagtype) +static int skel_sys_acl_free_qualifier(vfs_handle_struct *handle, void *qualifier, SMB_ACL_TAG_T tagtype) { - return SMB_VFS_NEXT_SYS_ACL_FREE_QUALIFIER(handle, conn, qualifier, tagtype); + return SMB_VFS_NEXT_SYS_ACL_FREE_QUALIFIER(handle, qualifier, tagtype); } -static ssize_t skel_getxattr(vfs_handle_struct *handle, struct connection_struct *conn,const char *path, const char *name, void *value, size_t size) +static ssize_t skel_getxattr(vfs_handle_struct *handle, const char *path, const char *name, void *value, size_t size) { - return SMB_VFS_NEXT_GETXATTR(handle, conn, path, name, value, size); + return SMB_VFS_NEXT_GETXATTR(handle, path, name, value, size); } -static ssize_t skel_lgetxattr(vfs_handle_struct *handle, struct connection_struct *conn,const char *path, const char *name, void *value, size_t +static ssize_t skel_lgetxattr(vfs_handle_struct *handle, const char *path, const char *name, void *value, size_t size) { - return SMB_VFS_NEXT_LGETXATTR(handle, conn, path, name, value, size); + return SMB_VFS_NEXT_LGETXATTR(handle, path, name, value, size); } static ssize_t skel_fgetxattr(vfs_handle_struct *handle, struct files_struct *fsp,int fd, const char *name, void *value, size_t size) @@ -421,14 +421,14 @@ static ssize_t skel_fgetxattr(vfs_handle_struct *handle, struct files_struct *fs return SMB_VFS_NEXT_FGETXATTR(handle, fsp, fd, name, value, size); } -static ssize_t skel_listxattr(vfs_handle_struct *handle, struct connection_struct *conn,const char *path, char *list, size_t size) +static ssize_t skel_listxattr(vfs_handle_struct *handle, const char *path, char *list, size_t size) { - return SMB_VFS_NEXT_LISTXATTR(handle, conn, path, list, size); + return SMB_VFS_NEXT_LISTXATTR(handle, path, list, size); } -static ssize_t skel_llistxattr(vfs_handle_struct *handle, struct connection_struct *conn,const char *path, char *list, size_t size) +static ssize_t skel_llistxattr(vfs_handle_struct *handle, const char *path, char *list, size_t size) { - return SMB_VFS_NEXT_LLISTXATTR(handle, conn, path, list, size); + return SMB_VFS_NEXT_LLISTXATTR(handle, path, list, size); } static ssize_t skel_flistxattr(vfs_handle_struct *handle, struct files_struct *fsp,int fd, char *list, size_t size) @@ -436,14 +436,14 @@ static ssize_t skel_flistxattr(vfs_handle_struct *handle, struct files_struct *f return SMB_VFS_NEXT_FLISTXATTR(handle, fsp, fd, list, size); } -static int skel_removexattr(vfs_handle_struct *handle, struct connection_struct *conn,const char *path, const char *name) +static int skel_removexattr(vfs_handle_struct *handle, const char *path, const char *name) { - return SMB_VFS_NEXT_REMOVEXATTR(handle, conn, path, name); + return SMB_VFS_NEXT_REMOVEXATTR(handle, path, name); } -static int skel_lremovexattr(vfs_handle_struct *handle, struct connection_struct *conn,const char *path, const char *name) +static int skel_lremovexattr(vfs_handle_struct *handle, const char *path, const char *name) { - return SMB_VFS_NEXT_LREMOVEXATTR(handle, conn, path, name); + return SMB_VFS_NEXT_LREMOVEXATTR(handle, path, name); } static int skel_fremovexattr(vfs_handle_struct *handle, struct files_struct *fsp,int fd, const char *name) @@ -451,14 +451,14 @@ static int skel_fremovexattr(vfs_handle_struct *handle, struct files_struct *fsp return SMB_VFS_NEXT_FREMOVEXATTR(handle, fsp, fd, name); } -static int skel_setxattr(vfs_handle_struct *handle, struct connection_struct *conn,const char *path, const char *name, const void *value, size_t size, int flags) +static int skel_setxattr(vfs_handle_struct *handle, const char *path, const char *name, const void *value, size_t size, int flags) { - return SMB_VFS_NEXT_SETXATTR(handle, conn, path, name, value, size, flags); + return SMB_VFS_NEXT_SETXATTR(handle, path, name, value, size, flags); } -static int skel_lsetxattr(vfs_handle_struct *handle, struct connection_struct *conn,const char *path, const char *name, const void *value, size_t size, int flags) +static int skel_lsetxattr(vfs_handle_struct *handle, const char *path, const char *name, const void *value, size_t size, int flags) { - return SMB_VFS_NEXT_LSETXATTR(handle, conn, path, name, value, size, flags); + return SMB_VFS_NEXT_LSETXATTR(handle, path, name, value, size, flags); } static int skel_fsetxattr(vfs_handle_struct *handle, struct files_struct *fsp,int fd, const char *name, const void *value, size_t size, int flags) -- cgit From 55170cb6a7735b28e371e52cf16af2677425adb4 Mon Sep 17 00:00:00 2001 From: James Peach Date: Thu, 23 Nov 2006 06:44:05 +0000 Subject: r19852: Fix the build for the VFS examples. Fixes bugzilla #3931. (This used to be commit fa69031d00f914aa8d642a2731db8c81f74bc8d9) --- examples/VFS/Makefile.in | 10 +++++++++- examples/VFS/configure.in | 11 ++++++++--- 2 files changed, 17 insertions(+), 4 deletions(-) (limited to 'examples/VFS') diff --git a/examples/VFS/Makefile.in b/examples/VFS/Makefile.in index caf8f030aa..4c0f119dcd 100644 --- a/examples/VFS/Makefile.in +++ b/examples/VFS/Makefile.in @@ -7,7 +7,15 @@ INSTALLCMD = @INSTALL@ SAMBA_SOURCE = @SAMBA_SOURCE@ SHLIBEXT = @SHLIBEXT@ OBJEXT = @OBJEXT@ -FLAGS = $(CFLAGS) -Iinclude -I$(SAMBA_SOURCE)/include -I$(SAMBA_SOURCE)/popt -I$(SAMBA_SOURCE)/smbwrapper -I. $(CPPFLAGS) -I$(SAMBA_SOURCE) -fPIC +FLAGS = $(CFLAGS) $(CPPFLAGS) -fPIC \ + -Iinclude -I$(SAMBA_SOURCE)/include \ + -I$(SAMBA_SOURCE)/popt \ + -I$(SAMBA_SOURCE)/lib/replace \ + -I$(SAMBA_SOURCE)/lib/talloc \ + -I$(SAMBA_SOURCE)/tdb/include \ + -I$(SAMBA_SOURCE)/smbwrapper \ + -I$(SAMBA_SOURCE)/librpc \ + -I$(SAMBA_SOURCE) -I. prefix = @prefix@ diff --git a/examples/VFS/configure.in b/examples/VFS/configure.in index 515d43f009..e96101b091 100644 --- a/examples/VFS/configure.in +++ b/examples/VFS/configure.in @@ -5,14 +5,14 @@ dnl We must use autotools 2.53 or above AC_PREREQ(2.53) AC_INIT(Makefile.in) -#dnl Uncomment this if you want to use your own define's too -#AC_CONFIG_HEADER(module_config.h) +AC_CONFIG_HEADER(module_config.h) #dnl To make sure that didn't get #define PACKAGE_* in modules_config.h #echo "" > confdefs.h dnl Checks for programs. AC_PROG_CC AC_PROG_INSTALL +AC_CANONICAL_HOST ################################################# # Directory handling stuff to support both the @@ -309,6 +309,11 @@ if test "$enable_shared" = "yes"; then BLDSHARED="false" LDSHFLAGS="" ;; + *darwin*) + BLDSHARED="true" + LDSHFLAGS="-bundle -flat_namespace -undefined suppress" + SHLIBEXT="dylib" + ;; *) ;; esac @@ -328,7 +333,7 @@ AC_CACHE_CHECK([whether building shared libraries actually works], ac_cv_shlib_works=no # try building a trivial shared library if test "$PICSUFFIX" = "po"; then - $CC $CPPFLAGS $CFLAGS $PICFLAGS -c -o shlib.po ${srcdir-.}/tests/shlib.c && + $CC $CPPFLAGS $CFLAGS $PICFLAGS -c -o shlib.po ${srcdir-.}/../../source/tests/shlib.c && $CC $CPPFLAGS $CFLAGS `eval echo $LDSHFLAGS` -o "shlib.$SHLIBEXT" shlib.po && ac_cv_shlib_works=yes else -- cgit From 4952fe368a40b239140b3035db6075427d237bb9 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 5 Mar 2007 23:40:03 +0000 Subject: r21714: Change the VFS interface to use struct timespec for utimes - change the call to ntimes. This preserves nsec timestamps we get from stat (if the system supports it) and only maps back down to usec or sec resolution on time set. Looks bigger than it is as I had to move lots of internal code from using time_t and struct utimebuf to struct timespec. Jeremy. (This used to be commit 8f3d530c5a748ea90f42ed8fbe68ae92178d4875) --- examples/VFS/skel_opaque.c | 6 +++--- examples/VFS/skel_transparent.c | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'examples/VFS') diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index 096068da14..18ad5eb517 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -211,9 +211,9 @@ static char *skel_getwd(vfs_handle_struct *handle, char *buf) return vfswrap_getwd(NULL, buf); } -static int skel_utime(vfs_handle_struct *handle, const char *path, struct utimbuf *times) +static int skel_ntimes(vfs_handle_struct *handle, const char *path, const struct timespec ts[2]) { - return vfswrap_utime(NULL, path, times); + return vfswrap_ntimes(NULL, path, ts); } static int skel_ftruncate(vfs_handle_struct *handle, files_struct *fsp, int fd, SMB_OFF_T offset) @@ -578,7 +578,7 @@ static vfs_op_tuple skel_op_tuples[] = { {SMB_VFS_OP(skel_fchown), SMB_VFS_OP_FCHOWN, SMB_VFS_LAYER_OPAQUE}, {SMB_VFS_OP(skel_chdir), SMB_VFS_OP_CHDIR, SMB_VFS_LAYER_OPAQUE}, {SMB_VFS_OP(skel_getwd), SMB_VFS_OP_GETWD, SMB_VFS_LAYER_OPAQUE}, - {SMB_VFS_OP(skel_utime), SMB_VFS_OP_UTIME, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_ntimes), SMB_VFS_OP_NTIMES, SMB_VFS_LAYER_OPAQUE}, {SMB_VFS_OP(skel_ftruncate), SMB_VFS_OP_FTRUNCATE, SMB_VFS_LAYER_OPAQUE}, {SMB_VFS_OP(skel_lock), SMB_VFS_OP_LOCK, SMB_VFS_LAYER_OPAQUE}, {SMB_VFS_OP(skel_getlock), SMB_VFS_OP_GETLOCK, SMB_VFS_LAYER_OPAQUE}, diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c index 2a379cd6d8..b967a337eb 100644 --- a/examples/VFS/skel_transparent.c +++ b/examples/VFS/skel_transparent.c @@ -210,9 +210,9 @@ static char *skel_getwd(vfs_handle_struct *handle, char *buf) return SMB_VFS_NEXT_GETWD(handle, buf); } -static int skel_utime(vfs_handle_struct *handle, const char *path, struct utimbuf *times) +static int skel_ntimes(vfs_handle_struct *handle, const char *path, const struct timespec ts[2]) { - return SMB_VFS_NEXT_UTIME(handle, path, times); + return SMB_VFS_NEXT_NTIMES(handle, path, ts[2]); } static int skel_ftruncate(vfs_handle_struct *handle, files_struct *fsp, int fd, SMB_OFF_T offset) @@ -545,7 +545,7 @@ static vfs_op_tuple skel_op_tuples[] = { {SMB_VFS_OP(skel_fchown), SMB_VFS_OP_FCHOWN, SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(skel_chdir), SMB_VFS_OP_CHDIR, SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(skel_getwd), SMB_VFS_OP_GETWD, SMB_VFS_LAYER_TRANSPARENT}, - {SMB_VFS_OP(skel_utime), SMB_VFS_OP_UTIME, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_ntimes), SMB_VFS_OP_NTIMES, SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(skel_ftruncate), SMB_VFS_OP_FTRUNCATE, SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(skel_lock), SMB_VFS_OP_LOCK, SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(skel_getlock), SMB_VFS_OP_GETLOCK, SMB_VFS_LAYER_TRANSPARENT}, -- cgit From 70d5f417ab7abf1ac41db72e2cbaee5ccda51a2e Mon Sep 17 00:00:00 2001 From: James Peach Date: Thu, 8 Mar 2007 17:06:16 +0000 Subject: r21762: Fix the build by enabling shared modules and adding the config.* files. Add norify_watch and chflags operations. Fix a bunch of warnings. (This used to be commit 1106db7ea148253e3b5f0806b2d5efcd094b202e) --- examples/VFS/Makefile.in | 2 +- examples/VFS/config.guess | 1465 ++++++++++++++++++++++++++++++++++++ examples/VFS/config.sub | 1579 +++++++++++++++++++++++++++++++++++++++ examples/VFS/configure.in | 4 + examples/VFS/skel_opaque.c | 36 +- examples/VFS/skel_transparent.c | 30 +- 6 files changed, 3106 insertions(+), 10 deletions(-) create mode 100755 examples/VFS/config.guess create mode 100755 examples/VFS/config.sub (limited to 'examples/VFS') diff --git a/examples/VFS/Makefile.in b/examples/VFS/Makefile.in index 4c0f119dcd..8869a4f20d 100644 --- a/examples/VFS/Makefile.in +++ b/examples/VFS/Makefile.in @@ -47,5 +47,5 @@ clean: rm -f core *~ *% *.bak *.o *.$(SHLIBEXT) distclean: clean - rm config.* Makefile + rm -f config.status config.cache Makefile diff --git a/examples/VFS/config.guess b/examples/VFS/config.guess new file mode 100755 index 0000000000..d0d57f6945 --- /dev/null +++ b/examples/VFS/config.guess @@ -0,0 +1,1465 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. + +timestamp='2005-09-19' + +# This file 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., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + + +# Originally written by Per Bothner . +# Please send patches to . Submit a context +# diff and a properly formatted ChangeLog entry. +# +# This script attempts to guess a canonical system name similar to +# config.sub. If it succeeds, it prints the system name on stdout, and +# exits with 0. Otherwise, it exits with 1. +# +# The plan is that this can be called by configure scripts if you +# don't specify an explicit build system type. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system \`$me' is run on. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + * ) + break ;; + esac +done + +if test $# != 0; then + echo "$me: too many arguments$help" >&2 + exit 1 +fi + +trap 'exit 1' 1 2 15 + +# CC_FOR_BUILD -- compiler used by this script. Note that the use of a +# compiler to aid in system detection is discouraged as it requires +# temporary files to be created and, as you can see below, it is a +# headache to deal with in a portable fashion. + +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still +# use `HOST_CC' if defined, but it is deprecated. + +# Portable tmp directory creation inspired by the Autoconf team. + +set_cc_for_build=' +trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; +trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; +: ${TMPDIR=/tmp} ; + { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; +dummy=$tmp/dummy ; +tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; +case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int x;" > $dummy.c ; + for c in cc gcc c89 c99 ; do + if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then + CC_FOR_BUILD="$c"; break ; + fi ; + done ; + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found ; + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; +esac ; set_cc_for_build= ;' + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 1994-08-24) +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +# Note: order is significant - the case branches are not exclusive. + +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + *:NetBSD:*:*) + # NetBSD (nbsd) targets should (where applicable) match one or + # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # + # Note: NetBSD doesn't particularly care about the vendor + # portion of the name. We always set it to "unknown". + sysctl="sysctl -n hw.machine_arch" + UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ + /usr/sbin/$sysctl 2>/dev/null || echo unknown)` + case "${UNAME_MACHINE_ARCH}" in + armeb) machine=armeb-unknown ;; + arm*) machine=arm-unknown ;; + sh3el) machine=shl-unknown ;; + sh3eb) machine=sh-unknown ;; + *) machine=${UNAME_MACHINE_ARCH}-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently, or will in the future. + case "${UNAME_MACHINE_ARCH}" in + arm*|i386|m68k|ns32k|sh3*|sparc|vax) + eval $set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep __ELF__ >/dev/null + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac + # The OS release + # Debian GNU/NetBSD machines have a different userland, and + # thus, need a distinct triplet. However, they do not need + # kernel version information, so it can be replaced with a + # suitable tag, in the style of linux-gnu. + case "${UNAME_VERSION}" in + Debian*) + release='-gnu' + ;; + *) + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + ;; + esac + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}" + exit ;; + *:OpenBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} + exit ;; + *:ekkoBSD:*:*) + echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} + exit ;; + macppc:MirBSD:*:*) + echo powerppc-unknown-mirbsd${UNAME_RELEASE} + exit ;; + *:MirBSD:*:*) + echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} + exit ;; + alpha:OSF1:*:*) + case $UNAME_RELEASE in + *4.0) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + ;; + *5.*) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` + ;; + esac + # According to Compaq, /usr/sbin/psrinfo has been available on + # OSF/1 and Tru64 systems produced since 1995. I hope that + # covers most systems running today. This code pipes the CPU + # types through head -n 1, so we only detect the type of CPU 0. + ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` + case "$ALPHA_CPU_TYPE" in + "EV4 (21064)") + UNAME_MACHINE="alpha" ;; + "EV4.5 (21064)") + UNAME_MACHINE="alpha" ;; + "LCA4 (21066/21068)") + UNAME_MACHINE="alpha" ;; + "EV5 (21164)") + UNAME_MACHINE="alphaev5" ;; + "EV5.6 (21164A)") + UNAME_MACHINE="alphaev56" ;; + "EV5.6 (21164PC)") + UNAME_MACHINE="alphapca56" ;; + "EV5.7 (21164PC)") + UNAME_MACHINE="alphapca57" ;; + "EV6 (21264)") + UNAME_MACHINE="alphaev6" ;; + "EV6.7 (21264A)") + UNAME_MACHINE="alphaev67" ;; + "EV6.8CB (21264C)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8AL (21264B)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8CX (21264D)") + UNAME_MACHINE="alphaev68" ;; + "EV6.9A (21264/EV69A)") + UNAME_MACHINE="alphaev69" ;; + "EV7 (21364)") + UNAME_MACHINE="alphaev7" ;; + "EV7.9 (21364A)") + UNAME_MACHINE="alphaev79" ;; + esac + # A Pn.n version is a patched version. + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + exit ;; + Alpha\ *:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # Should we change UNAME_MACHINE based on the output of uname instead + # of the specific Alpha model? + echo alpha-pc-interix + exit ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 + exit ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-unknown-sysv4 + exit ;; + *:[Aa]miga[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-amigaos + exit ;; + *:[Mm]orph[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-morphos + exit ;; + *:OS/390:*:*) + echo i370-ibm-openedition + exit ;; + *:z/VM:*:*) + echo s390-ibm-zvmoe + exit ;; + *:OS400:*:*) + echo powerpc-ibm-os400 + exit ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit ;; + arm:riscos:*:*|arm:RISCOS:*:*) + echo arm-unknown-riscos + exit ;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit ;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + if test "`(/bin/universe) 2>/dev/null`" = att ; then + echo pyramid-pyramid-sysv3 + else + echo pyramid-pyramid-bsd + fi + exit ;; + NILE*:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit ;; + DRS?6000:unix:4.0:6*) + echo sparc-icl-nx6 + exit ;; + DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) + case `/usr/bin/uname -p` in + sparc) echo sparc-icl-nx7; exit ;; + esac ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + i86pc:SunOS:5.*:*) + echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:*:*) + case "`/usr/bin/arch -k`" in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` + exit ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + case "`/bin/arch`" in + sun3) + echo m68k-sun-sunos${UNAME_RELEASE} + ;; + sun4) + echo sparc-sun-sunos${UNAME_RELEASE} + ;; + esac + exit ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} + exit ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint${UNAME_RELEASE} + exit ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint${UNAME_RELEASE} + exit ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint${UNAME_RELEASE} + exit ;; + m68k:machten:*:*) + echo m68k-apple-machten${UNAME_RELEASE} + exit ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} + exit ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + echo clipper-intergraph-clix${UNAME_RELEASE} + exit ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c +#ifdef __cplusplus +#include /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && + dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && + SYSTEM_NAME=`$dummy $dummyarg` && + { echo "$SYSTEM_NAME"; exit; } + echo mips-mips-riscos${UNAME_RELEASE} + exit ;; + Motorola:PowerMAX_OS:*:*) + echo powerpc-motorola-powermax + exit ;; + Motorola:*:4.3:PL8-*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] + then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ + [ ${TARGET_BINARY_INTERFACE}x = x ] + then + echo m88k-dg-dgux${UNAME_RELEASE} + else + echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + else + echo i586-dg-dgux${UNAME_RELEASE} + fi + exit ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit ;; + *:IRIX*:*:*) + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` + exit ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i*86:AIX:*:*) + echo i386-ibm-aix + exit ;; + ia64:AIX:*:*) + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} + exit ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` + then + echo "$SYSTEM_NAME" + else + echo rs6000-ibm-aix3.2.5 + fi + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi + exit ;; + *:AIX:*:[45]) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` + if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${IBM_ARCH}-ibm-aix${IBM_REV} + exit ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 + exit ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to + exit ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit ;; + 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + case "${UNAME_MACHINE}" in + 9000/31? ) HP_ARCH=m68000 ;; + 9000/[34]?? ) HP_ARCH=m68k ;; + 9000/[678][0-9][0-9]) + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; + '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 + esac ;; + esac + fi + if [ "${HP_ARCH}" = "" ]; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + + #define _HPUX_SOURCE + #include + #include + + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); + + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } +EOF + (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` + test -z "$HP_ARCH" && HP_ARCH=hppa + fi ;; + esac + if [ ${HP_ARCH} = "hppa2.0w" ] + then + eval $set_cc_for_build + + # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating + # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler + # generating 64-bit code. GNU and HP use different nomenclature: + # + # $ CC_FOR_BUILD=cc ./config.guess + # => hppa2.0w-hp-hpux11.23 + # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess + # => hppa64-hp-hpux11.23 + + if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | + grep __LP64__ >/dev/null + then + HP_ARCH="hppa2.0w" + else + HP_ARCH="hppa64" + fi + fi + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux${HPUX_REV} + exit ;; + 3050*:HI-UX:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } + echo unknown-hitachi-hiuxwe2 + exit ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit ;; + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf + exit ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit ;; + i*86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi + exit ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*[A-Z]90:*:*:*) + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ + -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*T3E:*:*:*) + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + *:UNICOS/mp:*:*) + echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + 5000:UNIX_System_V:4.*:*) + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` + echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi${UNAME_RELEASE} + exit ;; + *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + exit ;; + *:FreeBSD:*:*) + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit ;; + i*:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit ;; + i*:windows32*:*) + # uname -m includes "-pc" on this system. + echo ${UNAME_MACHINE}-mingw32 + exit ;; + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 + exit ;; + x86:Interix*:[34]*) + echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//' + exit ;; + [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) + echo i${UNAME_MACHINE}-pc-mks + exit ;; + i*:Windows_NT*:* | Pentium*:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we + # UNAME_MACHINE based on the output of uname instead of i386? + echo i586-pc-interix + exit ;; + i*:UWIN*:*) + echo ${UNAME_MACHINE}-pc-uwin + exit ;; + amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) + echo x86_64-unknown-cygwin + exit ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin + exit ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + *:GNU:*:*) + # the GNU system + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + exit ;; + *:GNU/*:*:*) + # other systems with GNU libc and userland + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu + exit ;; + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix + exit ;; + arm*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + cris:Linux:*:*) + echo cris-axis-linux-gnu + exit ;; + crisv32:Linux:*:*) + echo crisv32-axis-linux-gnu + exit ;; + frv:Linux:*:*) + echo frv-unknown-linux-gnu + exit ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + m32r*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + mips:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef mips + #undef mipsel + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=mipsel + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=mips + #else + CPU= + #endif + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } + ;; + mips64:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef mips64 + #undef mips64el + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=mips64el + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=mips64 + #else + CPU= + #endif + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } + ;; + or32:Linux:*:*) + echo or32-unknown-linux-gnu + exit ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-gnu + exit ;; + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-gnu + exit ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + exit ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) echo hppa1.1-unknown-linux-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; + esac + exit ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-gnu + exit ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux + exit ;; + sh64*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + x86_64:Linux:*:*) + echo x86_64-unknown-linux-gnu + exit ;; + i*86:Linux:*:*) + # The BFD linker knows what the default object file format is, so + # first see if it will tell us. cd to the root directory to prevent + # problems with other programs or directories called `ld' in the path. + # Set LC_ALL=C to ensure ld outputs messages in English. + ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ + | sed -ne '/supported targets:/!d + s/[ ][ ]*/ /g + s/.*supported targets: *// + s/ .*// + p'` + case "$ld_supported_targets" in + elf32-i386) + TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" + ;; + a.out-i386-linux) + echo "${UNAME_MACHINE}-pc-linux-gnuaout" + exit ;; + coff-i386) + echo "${UNAME_MACHINE}-pc-linux-gnucoff" + exit ;; + "") + # Either a pre-BFD a.out linker (linux-gnuoldld) or + # one that does not give us useful --help. + echo "${UNAME_MACHINE}-pc-linux-gnuoldld" + exit ;; + esac + # Determine whether the default compiler is a.out or elf + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + #ifdef __ELF__ + # ifdef __GLIBC__ + # if __GLIBC__ >= 2 + LIBC=gnu + # else + LIBC=gnulibc1 + # endif + # else + LIBC=gnulibc1 + # endif + #else + #ifdef __INTEL_COMPILER + LIBC=gnu + #else + LIBC=gnuaout + #endif + #endif + #ifdef __dietlibc__ + LIBC=dietlibc + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` + test x"${LIBC}" != x && { + echo "${UNAME_MACHINE}-pc-linux-${LIBC}" + exit + } + test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } + ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both + # sysname and nodename. + echo i386-sequent-sysv4 + exit ;; + i*86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} + exit ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo ${UNAME_MACHINE}-pc-os2-emx + exit ;; + i*86:XTS-300:*:STOP) + echo ${UNAME_MACHINE}-unknown-stop + exit ;; + i*86:atheos:*:*) + echo ${UNAME_MACHINE}-unknown-atheos + exit ;; + i*86:syllable:*:*) + echo ${UNAME_MACHINE}-pc-syllable + exit ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit ;; + i*86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit ;; + i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) + UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} + fi + exit ;; + i*86:*:5:[678]*) + # UnixWare 7.x, OpenUNIX and OpenServer 6. + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; + *Pent*|*Celeron) UNAME_MACHINE=i686 ;; + esac + echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + exit ;; + i*86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` + (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 + echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + else + echo ${UNAME_MACHINE}-pc-sysv32 + fi + exit ;; + pc:*:*:*) + # Left here for compatibility: + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i386. + echo i386-pc-msdosdjgpp + exit ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + fi + exit ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit ;; + mc68k:UNIX:SYSTEM5:3.51m) + echo m68k-convergent-sysv + exit ;; + M680?0:D-NIX:5.3:*) + echo m68k-diab-dnix + exit ;; + M68*:*:R3V[5678]*:*) + test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; + 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4; exit; } ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} + exit ;; + rs6000:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) + echo powerpc-unknown-lynxos${UNAME_RELEASE} + exit ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} + exit ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + echo ${UNAME_MACHINE}-sni-sysv4 + else + echo ns32k-sni-sysv + fi + exit ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + echo i586-unisys-sysv4 + exit ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes . + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 + exit ;; + i*86:VOS:*:*) + # From Paul.Green@stratus.com. + echo ${UNAME_MACHINE}-stratus-vos + exit ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + echo hppa1.1-stratus-vos + exit ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} + exit ;; + news*:NEWS-OS:6*:*) + echo mips-sony-newsos6 + exit ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if [ -d /usr/nec ]; then + echo mips-nec-sysv${UNAME_RELEASE} + else + echo mips-unknown-sysv${UNAME_RELEASE} + fi + exit ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos + exit ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} + exit ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux${UNAME_RELEASE} + exit ;; + SX-6:SUPER-UX:*:*) + echo sx6-nec-superux${UNAME_RELEASE} + exit ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} + exit ;; + *:Rhapsody:*:*) + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} + exit ;; + *:Darwin:*:*) + UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown + case $UNAME_PROCESSOR in + unknown) UNAME_PROCESSOR=powerpc ;; + esac + echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} + exit ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + UNAME_PROCESSOR=`uname -p` + if test "$UNAME_PROCESSOR" = "x86"; then + UNAME_PROCESSOR=i386 + UNAME_MACHINE=pc + fi + echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} + exit ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit ;; + NSE-?:NONSTOP_KERNEL:*:*) + echo nse-tandem-nsk${UNAME_RELEASE} + exit ;; + NSR-?:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} + exit ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux + exit ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit ;; + DS/*:UNIX_System_V:*:*) + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} + exit ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 + # operating systems. + if test "$cputype" = "386"; then + UNAME_MACHINE=i386 + else + UNAME_MACHINE="$cputype" + fi + echo ${UNAME_MACHINE}-unknown-plan9 + exit ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 + exit ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex + exit ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 + exit ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 + exit ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 + exit ;; + *:ITS:*:*) + echo pdp10-unknown-its + exit ;; + SEI:*:*:SEIUX) + echo mips-sei-seiux${UNAME_RELEASE} + exit ;; + *:DragonFly:*:*) + echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit ;; + *:*VMS:*:*) + UNAME_MACHINE=`(uname -p) 2>/dev/null` + case "${UNAME_MACHINE}" in + A*) echo alpha-dec-vms ; exit ;; + I*) echo ia64-dec-vms ; exit ;; + V*) echo vax-dec-vms ; exit ;; + esac ;; + *:XENIX:*:SysV) + echo i386-pc-xenix + exit ;; + i*86:skyos:*:*) + echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' + exit ;; +esac + +#echo '(No uname command or uname output not recognized.)' 1>&2 +#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 + +eval $set_cc_for_build +cat >$dummy.c < +# include +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (__arm) && defined (__acorn) && defined (__unix) + printf ("arm-acorn-riscix\n"); exit (0); +#endif + +#if defined (hp300) && !defined (hpux) + printf ("m68k-hp-bsd\n"); exit (0); +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); + +#endif + +#if defined (vax) +# if !defined (ultrix) +# include +# if defined (BSD) +# if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +# else +# if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# endif +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# else + printf ("vax-dec-ultrix\n"); exit (0); +# endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } + +# Apollos put the system type in the environment. + +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } + +# Convex versions that predate uname can use getsysinfo(1) + +if [ -x /usr/convex/getsysinfo ] +then + case `getsysinfo -f cpu_type` in + c1*) + echo c1-convex-bsd + exit ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + c34*) + echo c34-convex-bsd + exit ;; + c38*) + echo c38-convex-bsd + exit ;; + c4*) + echo c4-convex-bsd + exit ;; + esac +fi + +cat >&2 < in order to provide the needed +information to handle your system. + +config.guess timestamp = $timestamp + +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null` + +hostinfo = `(hostinfo) 2>/dev/null` +/bin/universe = `(/bin/universe) 2>/dev/null` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` +/bin/arch = `(/bin/arch) 2>/dev/null` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` + +UNAME_MACHINE = ${UNAME_MACHINE} +UNAME_RELEASE = ${UNAME_RELEASE} +UNAME_SYSTEM = ${UNAME_SYSTEM} +UNAME_VERSION = ${UNAME_VERSION} +EOF + +exit 1 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/examples/VFS/config.sub b/examples/VFS/config.sub new file mode 100755 index 0000000000..1c366dfde9 --- /dev/null +++ b/examples/VFS/config.sub @@ -0,0 +1,1579 @@ +#! /bin/sh +# Configuration validation subroutine script. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. + +timestamp='2005-07-08' + +# This file is (in principle) common to ALL GNU software. +# The presence of a machine in this file suggests that SOME GNU software +# can handle that machine. It does not imply ALL GNU software can. +# +# This file 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., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + + +# Please send patches to . Submit a context +# diff and a properly formatted ChangeLog entry. +# +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] CPU-MFR-OPSYS + $0 [OPTION] ALIAS + +Canonicalize a configuration name. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.sub ($timestamp) + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" + exit 1 ;; + + *local*) + # First pass through any local machine types. + echo $1 + exit ;; + + * ) + break ;; + esac +done + +case $# in + 0) echo "$me: missing argument$help" >&2 + exit 1;; + 1) ;; + *) echo "$me: too many arguments$help" >&2 + exit 1;; +esac + +# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). +# Here we must recognize all the valid KERNEL-OS combinations. +maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` +case $maybe_os in + nto-qnx* | linux-gnu* | linux-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \ + kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; + *) + basic_machine=`echo $1 | sed 's/-[^-]*$//'` + if [ $basic_machine != $1 ] + then os=`echo $1 | sed 's/.*-/-/'` + else os=; fi + ;; +esac + +### Let's recognize common machines as not being operating systems so +### that things like config.sub decstation-3100 work. We also +### recognize some manufacturers as not being operating systems, so we +### can provide default operating systems below. +case $os in + -sun*os*) + # Prevent following clause from handling this invalid input. + ;; + -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ + -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ + -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ + -apple | -axis | -knuth | -cray) + os= + basic_machine=$1 + ;; + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 + ;; + -scout) + ;; + -wrs) + os=-vxworks + basic_machine=$1 + ;; + -chorusos*) + os=-chorusos + basic_machine=$1 + ;; + -chorusrdb) + os=-chorusrdb + basic_machine=$1 + ;; + -hiux*) + os=-hiuxwe2 + ;; + -sco5) + os=-sco3.2v5 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco4) + os=-sco3.2v4 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2.[4-9]*) + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2v[4-9]*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -udk*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -isc) + os=-isc2.2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -clix*) + basic_machine=clipper-intergraph + ;; + -isc*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -lynx*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + ;; + -windowsnt*) + os=`echo $os | sed -e 's/windowsnt/winnt/'` + ;; + -psos*) + os=-psos + ;; + -mint | -mint[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; +esac + +# Decode aliases for certain CPU-COMPANY combinations. +case $basic_machine in + # Recognize the basic CPU types without company name. + # Some are omitted here because they have special meanings below. + 1750a | 580 \ + | a29k \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ + | am33_2.0 \ + | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ + | bfin \ + | c4x | clipper \ + | d10v | d30v | dlx | dsp16xx \ + | fr30 | frv \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | i370 | i860 | i960 | ia64 \ + | ip2k | iq2000 \ + | m32r | m32rle | m68000 | m68k | m88k | maxq | mcore \ + | mips | mipsbe | mipseb | mipsel | mipsle \ + | mips16 \ + | mips64 | mips64el \ + | mips64vr | mips64vrel \ + | mips64orion | mips64orionel \ + | mips64vr4100 | mips64vr4100el \ + | mips64vr4300 | mips64vr4300el \ + | mips64vr5000 | mips64vr5000el \ + | mips64vr5900 | mips64vr5900el \ + | mipsisa32 | mipsisa32el \ + | mipsisa32r2 | mipsisa32r2el \ + | mipsisa64 | mipsisa64el \ + | mipsisa64r2 | mipsisa64r2el \ + | mipsisa64sb1 | mipsisa64sb1el \ + | mipsisa64sr71k | mipsisa64sr71kel \ + | mipstx39 | mipstx39el \ + | mn10200 | mn10300 \ + | ms1 \ + | msp430 \ + | ns16k | ns32k \ + | or32 \ + | pdp10 | pdp11 | pj | pjl \ + | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ + | pyramid \ + | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ + | sh64 | sh64le \ + | sparc | sparc64 | sparc64b | sparc86x | sparclet | sparclite \ + | sparcv8 | sparcv9 | sparcv9b \ + | strongarm \ + | tahoe | thumb | tic4x | tic80 | tron \ + | v850 | v850e \ + | we32k \ + | x86 | xscale | xscalee[bl] | xstormy16 | xtensa \ + | z8k) + basic_machine=$basic_machine-unknown + ;; + m32c) + basic_machine=$basic_machine-unknown + ;; + m6811 | m68hc11 | m6812 | m68hc12) + # Motorola 68HC11/12. + basic_machine=$basic_machine-unknown + os=-none + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) + ;; + + # We use `pc' rather than `unknown' + # because (1) that's what they normally are, and + # (2) the word "unknown" tends to confuse beginning users. + i*86 | x86_64) + basic_machine=$basic_machine-pc + ;; + # Object if more than one company name word. + *-*-*) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; + # Recognize the basic CPU types with company name. + 580-* \ + | a29k-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ + | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ + | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ + | avr-* \ + | bfin-* | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ + | clipper-* | craynv-* | cydra-* \ + | d10v-* | d30v-* | dlx-* \ + | elxsi-* \ + | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ + | h8300-* | h8500-* \ + | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | i*86-* | i860-* | i960-* | ia64-* \ + | ip2k-* | iq2000-* \ + | m32r-* | m32rle-* \ + | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ + | m88110-* | m88k-* | maxq-* | mcore-* \ + | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ + | mips16-* \ + | mips64-* | mips64el-* \ + | mips64vr-* | mips64vrel-* \ + | mips64orion-* | mips64orionel-* \ + | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* \ + | mips64vr5000-* | mips64vr5000el-* \ + | mips64vr5900-* | mips64vr5900el-* \ + | mipsisa32-* | mipsisa32el-* \ + | mipsisa32r2-* | mipsisa32r2el-* \ + | mipsisa64-* | mipsisa64el-* \ + | mipsisa64r2-* | mipsisa64r2el-* \ + | mipsisa64sb1-* | mipsisa64sb1el-* \ + | mipsisa64sr71k-* | mipsisa64sr71kel-* \ + | mipstx39-* | mipstx39el-* \ + | mmix-* \ + | ms1-* \ + | msp430-* \ + | none-* | np1-* | ns16k-* | ns32k-* \ + | orion-* \ + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ + | pyramid-* \ + | romp-* | rs6000-* \ + | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | shbe-* \ + | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ + | sparc-* | sparc64-* | sparc64b-* | sparc86x-* | sparclet-* \ + | sparclite-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ + | tahoe-* | thumb-* \ + | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ + | tron-* \ + | v850-* | v850e-* | vax-* \ + | we32k-* \ + | x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \ + | xstormy16-* | xtensa-* \ + | ymp-* \ + | z8k-*) + ;; + m32c-*) + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 386bsd) + basic_machine=i386-unknown + os=-bsd + ;; + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + basic_machine=m68000-att + ;; + 3b*) + basic_machine=we32k-att + ;; + a29khif) + basic_machine=a29k-amd + os=-udi + ;; + abacus) + basic_machine=abacus-unknown + ;; + adobe68k) + basic_machine=m68010-adobe + os=-scout + ;; + alliant | fx80) + basic_machine=fx80-alliant + ;; + altos | altos3068) + basic_machine=m68k-altos + ;; + am29k) + basic_machine=a29k-none + os=-bsd + ;; + amd64) + basic_machine=x86_64-pc + ;; + amd64-*) + basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv + ;; + amiga | amiga-*) + basic_machine=m68k-unknown + ;; + amigaos | amigados) + basic_machine=m68k-unknown + os=-amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + os=-bsd + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + c90) + basic_machine=c90-cray + os=-unicos + ;; + convex-c1) + basic_machine=c1-convex + os=-bsd + ;; + convex-c2) + basic_machine=c2-convex + os=-bsd + ;; + convex-c32) + basic_machine=c32-convex + os=-bsd + ;; + convex-c34) + basic_machine=c34-convex + os=-bsd + ;; + convex-c38) + basic_machine=c38-convex + os=-bsd + ;; + cray | j90) + basic_machine=j90-cray + os=-unicos + ;; + craynv) + basic_machine=craynv-cray + os=-unicosmp + ;; + cr16c) + basic_machine=cr16c-unknown + os=-elf + ;; + crds | unos) + basic_machine=m68k-crds + ;; + crisv32 | crisv32-* | etraxfs*) + basic_machine=crisv32-axis + ;; + cris | cris-* | etrax*) + basic_machine=cris-axis + ;; + crx) + basic_machine=crx-unknown + os=-elf + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + decsystem10* | dec10*) + basic_machine=pdp10-dec + os=-tops10 + ;; + decsystem20* | dec20*) + basic_machine=pdp10-dec + os=-tops20 + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola + ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + djgpp) + basic_machine=i586-pc + os=-msdosdjgpp + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2* | dpx2*-bull) + basic_machine=m68k-bull + os=-sysv3 + ;; + ebmon29k) + basic_machine=a29k-amd + os=-ebmon + ;; + elxsi) + basic_machine=elxsi-elxsi + os=-bsd + ;; + encore | umax | mmax) + basic_machine=ns32k-encore + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + os=-ose + ;; + fx2800) + basic_machine=i860-alliant + ;; + genix) + basic_machine=ns32k-ns + ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + go32) + basic_machine=i386-pc + os=-go32 + ;; + h3050r* | hiux*) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=-hms + ;; + h8300xray) + basic_machine=h8300-hitachi + os=-xray + ;; + h8500hms) + basic_machine=h8500-hitachi + os=-hms + ;; + harris) + basic_machine=m88k-harris + os=-sysv3 + ;; + hp300-*) + basic_machine=m68k-hp + ;; + hp300bsd) + basic_machine=m68k-hp + os=-bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=-hpux + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + basic_machine=m68000-hp + ;; + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + basic_machine=hppa1.1-hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hppa-next) + os=-nextstep3 + ;; + hppaosf) + basic_machine=hppa1.1-hp + os=-osf + ;; + hppro) + basic_machine=hppa1.1-hp + os=-proelf + ;; + i370-ibm* | ibm*) + basic_machine=i370-ibm + ;; +# I'm not sure what "Sysv32" means. Should this be sysv3.2? + i*86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 + ;; + i*86v4*) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; + i*86v) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; + i*86sol2) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-solaris2 + ;; + i386mach) + basic_machine=i386-mach + os=-mach + ;; + i386-vsta | vsta) + basic_machine=i386-unknown + os=-vsta + ;; + iris | iris4d) + basic_machine=mips-sgi + case $os in + -irix*) + ;; + *) + os=-irix4 + ;; + esac + ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + mingw32) + basic_machine=i386-pc + os=-mingw32 + ;; + miniframe) + basic_machine=m68000-convergent + ;; + *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; + mips3*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; + monitor) + basic_machine=m68k-rom68k + os=-coff + ;; + morphos) + basic_machine=powerpc-unknown + os=-morphos + ;; + msdos) + basic_machine=i386-pc + os=-msdos + ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 + ;; + netbsd386) + basic_machine=i386-unknown + os=-netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + os=-linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=-newsos + ;; + news1000) + basic_machine=m68030-sony + os=-newsos + ;; + news-3600 | risc-news) + basic_machine=mips-sony + os=-newsos + ;; + necv70) + basic_machine=v70-nec + os=-sysv + ;; + next | m*-next ) + basic_machine=m68k-next + case $os in + -nextstep* ) + ;; + -ns2*) + os=-nextstep2 + ;; + *) + os=-nextstep3 + ;; + esac + ;; + nh3000) + basic_machine=m68k-harris + os=-cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=-cxux + ;; + nindy960) + basic_machine=i960-intel + os=-nindy + ;; + mon960) + basic_machine=i960-intel + os=-mon960 + ;; + nonstopux) + basic_machine=mips-compaq + os=-nonstopux + ;; + np1) + basic_machine=np1-gould + ;; + nsr-tandem) + basic_machine=nsr-tandem + ;; + op50n-* | op60c-*) + basic_machine=hppa1.1-oki + os=-proelf + ;; + openrisc | openrisc-*) + basic_machine=or32-unknown + ;; + os400) + basic_machine=powerpc-ibm + os=-os400 + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + os=-ose + ;; + os68k) + basic_machine=m68k-none + os=-os68k + ;; + pa-hitachi) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + paragon) + basic_machine=i860-intel + os=-osf + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + pentium | p5 | k5 | k6 | nexgen | viac3) + basic_machine=i586-pc + ;; + pentiumpro | p6 | 6x86 | athlon | athlon_*) + basic_machine=i686-pc + ;; + pentiumii | pentium2 | pentiumiii | pentium3) + basic_machine=i686-pc + ;; + pentium4) + basic_machine=i786-pc + ;; + pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-* | 6x86-* | athlon-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentium4-*) + basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pn) + basic_machine=pn-gould + ;; + power) basic_machine=power-ibm + ;; + ppc) basic_machine=powerpc-unknown + ;; + ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle | ppc-le | powerpc-little) + basic_machine=powerpcle-unknown + ;; + ppcle-* | powerpclittle-*) + basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64) basic_machine=powerpc64-unknown + ;; + ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64le | powerpc64little | ppc64-le | powerpc64-little) + basic_machine=powerpc64le-unknown + ;; + ppc64le-* | powerpc64little-*) + basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm + ;; + pw32) + basic_machine=i586-unknown + os=-pw32 + ;; + rom68k) + basic_machine=m68k-rom68k + os=-coff + ;; + rm[46]00) + basic_machine=mips-siemens + ;; + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; + s390 | s390-*) + basic_machine=s390-ibm + ;; + s390x | s390x-*) + basic_machine=s390x-ibm + ;; + sa29200) + basic_machine=a29k-amd + os=-udi + ;; + sb1) + basic_machine=mipsisa64sb1-unknown + ;; + sb1el) + basic_machine=mipsisa64sb1el-unknown + ;; + sei) + basic_machine=mips-sei + os=-seiux + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sh64) + basic_machine=sh64-unknown + ;; + sparclite-wrs | simso-wrs) + basic_machine=sparclite-wrs + os=-vxworks + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 + ;; + spur) + basic_machine=spur-unknown + ;; + st2000) + basic_machine=m68k-tandem + ;; + stratus) + basic_machine=i860-stratus + os=-sysv4 + ;; + sun2) + basic_machine=m68000-sun + ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=-solaris2 + ;; + sun3 | sun3-*) + basic_machine=m68k-sun + ;; + sun4) + basic_machine=sparc-sun + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; + sv1) + basic_machine=sv1-cray + os=-unicos + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + t3e) + basic_machine=alphaev5-cray + os=-unicos + ;; + t90) + basic_machine=t90-cray + os=-unicos + ;; + tic54x | c54x*) + basic_machine=tic54x-unknown + os=-coff + ;; + tic55x | c55x*) + basic_machine=tic55x-unknown + os=-coff + ;; + tic6x | c6x*) + basic_machine=tic6x-unknown + os=-coff + ;; + tx39) + basic_machine=mipstx39-unknown + ;; + tx39el) + basic_machine=mipstx39el-unknown + ;; + toad1) + basic_machine=pdp10-xkl + os=-tops20 + ;; + tower | tower-32) + basic_machine=m68k-ncr + ;; + tpf) + basic_machine=s390x-ibm + os=-tpf + ;; + udi29k) + basic_machine=a29k-amd + os=-udi + ;; + ultra3) + basic_machine=a29k-nyu + os=-sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + os=-none + ;; + vaxv) + basic_machine=vax-dec + os=-sysv + ;; + vms) + basic_machine=vax-dec + os=-vms + ;; + vpp*|vx|vx-*) + basic_machine=f301-fujitsu + ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + os=-vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + os=-vxworks + ;; + w65*) + basic_machine=w65-wdc + os=-none + ;; + w89k-*) + basic_machine=hppa1.1-winbond + os=-proelf + ;; + xbox) + basic_machine=i686-pc + os=-mingw32 + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + ymp) + basic_machine=ymp-cray + os=-unicos + ;; + z8k-*-coff) + basic_machine=z8k-unknown + os=-sim + ;; + none) + basic_machine=none-none + os=-none + ;; + +# Here we handle the default manufacturer of certain CPU types. It is in +# some cases the only manufacturer, in others, it is the most popular. + w89k) + basic_machine=hppa1.1-winbond + ;; + op50n) + basic_machine=hppa1.1-oki + ;; + op60c) + basic_machine=hppa1.1-oki + ;; + romp) + basic_machine=romp-ibm + ;; + mmix) + basic_machine=mmix-knuth + ;; + rs6000) + basic_machine=rs6000-ibm + ;; + vax) + basic_machine=vax-dec + ;; + pdp10) + # there are many clones, so DEC is not a safe bet + basic_machine=pdp10-unknown + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele) + basic_machine=sh-unknown + ;; + sparc | sparcv8 | sparcv9 | sparcv9b) + basic_machine=sparc-sun + ;; + cydra) + basic_machine=cydra-cydrome + ;; + orion) + basic_machine=orion-highlevel + ;; + orion105) + basic_machine=clipper-highlevel + ;; + mac | mpw | mac-mpw) + basic_machine=m68k-apple + ;; + pmac | pmac-mpw) + basic_machine=powerpc-apple + ;; + *-unknown) + # Make sure to match an already-canonicalized machine name. + ;; + *) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $basic_machine in + *-digital*) + basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` + ;; + *-commodore*) + basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if [ x"$os" != x"" ] +then +case $os in + # First match some system type aliases + # that might get confused with valid system types. + # -solaris* is a basic system type, with this one exception. + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; + -solaris) + os=-solaris2 + ;; + -svr4*) + os=-sysv4 + ;; + -unixware*) + os=-sysv4.2uw + ;; + -gnu/linux*) + os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` + ;; + # First accept the basic system types. + # The portable systems comes first. + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ + | -aos* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \ + | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ + | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -chorusos* | -chorusrdb* \ + | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ + | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ + | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ + | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ + | -skyos* | -haiku*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -qnx*) + case $basic_machine in + x86-* | i*86-*) + ;; + *) + os=-nto$os + ;; + esac + ;; + -nto-qnx*) + ;; + -nto*) + os=`echo $os | sed -e 's|nto|nto-qnx|'` + ;; + -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ + | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) + ;; + -mac*) + os=`echo $os | sed -e 's|mac|macos|'` + ;; + -linux-dietlibc) + os=-linux-dietlibc + ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; + -sunos5*) + os=`echo $os | sed -e 's|sunos5|solaris2|'` + ;; + -sunos6*) + os=`echo $os | sed -e 's|sunos6|solaris3|'` + ;; + -opened*) + os=-openedition + ;; + -os400*) + os=-os400 + ;; + -wince*) + os=-wince + ;; + -osfrose*) + os=-osfrose + ;; + -osf*) + os=-osf + ;; + -utek*) + os=-bsd + ;; + -dynix*) + os=-bsd + ;; + -acis*) + os=-aos + ;; + -atheos*) + os=-atheos + ;; + -syllable*) + os=-syllable + ;; + -386bsd) + os=-bsd + ;; + -ctix* | -uts*) + os=-sysv + ;; + -nova*) + os=-rtmk-nova + ;; + -ns2 ) + os=-nextstep2 + ;; + -nsk*) + os=-nsk + ;; + # Preserve the version number of sinix5. + -sinix5.*) + os=`echo $os | sed -e 's|sinix|sysv|'` + ;; + -sinix*) + os=-sysv4 + ;; + -tpf*) + os=-tpf + ;; + -triton*) + os=-sysv3 + ;; + -oss*) + os=-sysv3 + ;; + -svr4) + os=-sysv4 + ;; + -svr3) + os=-sysv3 + ;; + -sysvr4) + os=-sysv4 + ;; + # This must come after -sysvr4. + -sysv*) + ;; + -ose*) + os=-ose + ;; + -es1800*) + os=-ose + ;; + -xenix) + os=-xenix + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + os=-mint + ;; + -aros*) + os=-aros + ;; + -kaos*) + os=-kaos + ;; + -zvmoe) + os=-zvmoe + ;; + -none) + ;; + *) + # Get rid of the `-' at the beginning of $os. + os=`echo $os | sed 's/[^-]*-//'` + echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 + exit 1 + ;; +esac +else + +# Here we handle the default operating systems that come with various machines. +# The value should be what the vendor currently ships out the door with their +# machine or put another way, the most popular os provided with the machine. + +# Note that if you're going to try to match "-MANUFACTURER" here (say, +# "-sun"), then you have to tell the case statement up towards the top +# that MANUFACTURER isn't an operating system. Otherwise, code above +# will signal an error saying that MANUFACTURER isn't an operating +# system, and we'll never get to this point. + +case $basic_machine in + *-acorn) + os=-riscix1.2 + ;; + arm*-rebel) + os=-linux + ;; + arm*-semi) + os=-aout + ;; + c4x-* | tic4x-*) + os=-coff + ;; + # This must come before the *-dec entry. + pdp10-*) + os=-tops20 + ;; + pdp11-*) + os=-none + ;; + *-dec | vax-*) + os=-ultrix4.2 + ;; + m68*-apollo) + os=-domain + ;; + i386-sun) + os=-sunos4.0.2 + ;; + m68000-sun) + os=-sunos3 + # This also exists in the configure program, but was not the + # default. + # os=-sunos4 + ;; + m68*-cisco) + os=-aout + ;; + mips*-cisco) + os=-elf + ;; + mips*-*) + os=-elf + ;; + or32-*) + os=-coff + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=-sysv3 + ;; + sparc-* | *-sun) + os=-sunos4.1.1 + ;; + *-be) + os=-beos + ;; + *-haiku) + os=-haiku + ;; + *-ibm) + os=-aix + ;; + *-knuth) + os=-mmixware + ;; + *-wec) + os=-proelf + ;; + *-winbond) + os=-proelf + ;; + *-oki) + os=-proelf + ;; + *-hp) + os=-hpux + ;; + *-hitachi) + os=-hiux + ;; + i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) + os=-sysv + ;; + *-cbm) + os=-amigaos + ;; + *-dg) + os=-dgux + ;; + *-dolphin) + os=-sysv3 + ;; + m68k-ccur) + os=-rtu + ;; + m88k-omron*) + os=-luna + ;; + *-next ) + os=-nextstep + ;; + *-sequent) + os=-ptx + ;; + *-crds) + os=-unos + ;; + *-ns) + os=-genix + ;; + i370-*) + os=-mvs + ;; + *-next) + os=-nextstep3 + ;; + *-gould) + os=-sysv + ;; + *-highlevel) + os=-bsd + ;; + *-encore) + os=-bsd + ;; + *-sgi) + os=-irix + ;; + *-siemens) + os=-sysv4 + ;; + *-masscomp) + os=-rtu + ;; + f30[01]-fujitsu | f700-fujitsu) + os=-uxpv + ;; + *-rom68k) + os=-coff + ;; + *-*bug) + os=-coff + ;; + *-apple) + os=-macos + ;; + *-atari*) + os=-mint + ;; + *) + os=-none + ;; +esac +fi + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +vendor=unknown +case $basic_machine in + *-unknown) + case $os in + -riscix*) + vendor=acorn + ;; + -sunos*) + vendor=sun + ;; + -aix*) + vendor=ibm + ;; + -beos*) + vendor=be + ;; + -hpux*) + vendor=hp + ;; + -mpeix*) + vendor=hp + ;; + -hiux*) + vendor=hitachi + ;; + -unos*) + vendor=crds + ;; + -dgux*) + vendor=dg + ;; + -luna*) + vendor=omron + ;; + -genix*) + vendor=ns + ;; + -mvs* | -opened*) + vendor=ibm + ;; + -os400*) + vendor=ibm + ;; + -ptx*) + vendor=sequent + ;; + -tpf*) + vendor=ibm + ;; + -vxsim* | -vxworks* | -windiss*) + vendor=wrs + ;; + -aux*) + vendor=apple + ;; + -hms*) + vendor=hitachi + ;; + -mpw* | -macos*) + vendor=apple + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + vendor=atari + ;; + -vos*) + vendor=stratus + ;; + esac + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + ;; +esac + +echo $basic_machine$os +exit + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/examples/VFS/configure.in b/examples/VFS/configure.in index e96101b091..b8e10d482b 100644 --- a/examples/VFS/configure.in +++ b/examples/VFS/configure.in @@ -182,6 +182,10 @@ PICFLAGS="" PICSUFFIX="po" SHLIBEXT="so" +# Since we are not embedded in the Samba tree, building shared modules is +# really the only option. +enable_shared=yes + if test "$enable_shared" = "yes"; then # this bit needs to be modified for each OS that is suported by # smbwrapper. You need to specify how to created a shared library and diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index 18ad5eb517..7103d0c27b 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -38,6 +38,11 @@ * --metze */ +/* NOTE: As of approximately Samba 3.0.24, the vfswrap_* functions are not + * global symbols. They are included here only as an pointer that opaque + * operations should not call further into the VFS. + */ + static int skel_connect(vfs_handle_struct *handle, const char *service, const char *user) { return 0; @@ -236,6 +241,7 @@ static int skel_symlink(vfs_handle_struct *handle, const char *oldpath, const c return vfswrap_symlink(NULL, oldpath, newpath); } + static int skel_readlink(vfs_handle_struct *handle, const char *path, char *buf, size_t bufsiz) { return vfswrap_readlink(NULL, path, buf, bufsiz); @@ -256,25 +262,43 @@ static char *skel_realpath(vfs_handle_struct *handle, const char *path, char *r return vfswrap_realpath(NULL, path, resolved_path); } -static size_t skel_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp, int fd, uint32 security_info, struct security_descriptor_info **ppdesc) +static NTSTATUS skel_notify_watch(struct vfs_handle_struct *handle, + struct sys_notify_context *ctx, struct notify_entry *e, + void (*callback)(struct sys_notify_context *ctx, void *private_data, struct notify_event *ev), + void *private_data, void *handle_p) +{ + return NT_STATUS_NOT_SUPPORTED; +} + +static int skel_chflags(vfs_handle_struct *handle, const char *path, uint flags) +{ + errno = ENOSYS; + return -1; +} + +static size_t skel_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp, + int fd, uint32 security_info, SEC_DESC **ppdesc) { errno = ENOSYS; return 0; } -static size_t skel_get_nt_acl(vfs_handle_struct *handle, files_struct *fsp, const char *name, uint32 security_info, struct security_descriptor_info **ppdesc) +static size_t skel_get_nt_acl(vfs_handle_struct *handle, files_struct *fsp, + const char *name, uint32 security_info, SEC_DESC **ppdesc) { errno = ENOSYS; return 0; } -static BOOL skel_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp, int fd, uint32 security_info_sent, struct security_descriptor_info *psd) +static BOOL skel_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp, int + fd, uint32 security_info_sent, SEC_DESC *psd) { errno = ENOSYS; return False; } -static BOOL skel_set_nt_acl(vfs_handle_struct *handle, files_struct *fsp, const char *name, uint32 security_info_sent, struct security_descriptor_info *psd) +static BOOL skel_set_nt_acl(vfs_handle_struct *handle, files_struct *fsp, const + char *name, uint32 security_info_sent, SEC_DESC *psd) { errno = ENOSYS; return False; @@ -587,6 +611,10 @@ static vfs_op_tuple skel_op_tuples[] = { {SMB_VFS_OP(skel_link), SMB_VFS_OP_LINK, SMB_VFS_LAYER_OPAQUE}, {SMB_VFS_OP(skel_mknod), SMB_VFS_OP_MKNOD, SMB_VFS_LAYER_OPAQUE}, {SMB_VFS_OP(skel_realpath), SMB_VFS_OP_REALPATH, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_notify_watch), SMB_VFS_OP_NOTIFY_WATCH, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_chflags), SMB_VFS_OP_CHFLAGS, SMB_VFS_LAYER_OPAQUE}, + + /* NT File ACL operations */ diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c index b967a337eb..2efb3d54a7 100644 --- a/examples/VFS/skel_transparent.c +++ b/examples/VFS/skel_transparent.c @@ -212,7 +212,7 @@ static char *skel_getwd(vfs_handle_struct *handle, char *buf) static int skel_ntimes(vfs_handle_struct *handle, const char *path, const struct timespec ts[2]) { - return SMB_VFS_NEXT_NTIMES(handle, path, ts[2]); + 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) @@ -255,22 +255,40 @@ static char *skel_realpath(vfs_handle_struct *handle, const char *path, char *r return SMB_VFS_NEXT_REALPATH(handle, path, resolved_path); } -static size_t skel_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp, int fd, uint32 security_info, struct security_descriptor_info **ppdesc) +static NTSTATUS skel_notify_watch(struct vfs_handle_struct *handle, + struct sys_notify_context *ctx, struct notify_entry *e, + void (*callback)(struct sys_notify_context *ctx, void *private_data, struct notify_event *ev), + void *private_data, void *handle_p) +{ + return SMB_VFS_NEXT_NOTIFY_WATCH(handle, ctx, e, callback, + private_data, handle_p); +} + +static int skel_chflags(vfs_handle_struct *handle, const char *path, uint flags) +{ + return SMB_VFS_NEXT_CHFLAGS(handle, path, flags); +} + +static size_t skel_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp, + int fd, uint32 security_info, SEC_DESC **ppdesc) { return SMB_VFS_NEXT_FGET_NT_ACL(handle, fsp, fd, security_info, ppdesc); } -static size_t skel_get_nt_acl(vfs_handle_struct *handle, files_struct *fsp, const char *name, uint32 security_info, struct security_descriptor_info **ppdesc) +static size_t skel_get_nt_acl(vfs_handle_struct *handle, files_struct *fsp, + const char *name, uint32 security_info, SEC_DESC **ppdesc) { return SMB_VFS_NEXT_GET_NT_ACL(handle, fsp, name, security_info, ppdesc); } -static BOOL skel_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp, int fd, uint32 security_info_sent, struct security_descriptor_info *psd) +static BOOL skel_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp, + int fd, uint32 security_info_sent, SEC_DESC *psd) { return SMB_VFS_NEXT_FSET_NT_ACL(handle, fsp, fd, security_info_sent, psd); } -static BOOL skel_set_nt_acl(vfs_handle_struct *handle, files_struct *fsp, const char *name, uint32 security_info_sent, struct security_descriptor_info *psd) +static BOOL skel_set_nt_acl(vfs_handle_struct *handle, files_struct *fsp, + const char *name, uint32 security_info_sent, SEC_DESC *psd) { return SMB_VFS_NEXT_SET_NT_ACL(handle, fsp, name, security_info_sent, psd); } @@ -554,6 +572,8 @@ static vfs_op_tuple skel_op_tuples[] = { {SMB_VFS_OP(skel_link), SMB_VFS_OP_LINK, SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(skel_mknod), SMB_VFS_OP_MKNOD, SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(skel_realpath), SMB_VFS_OP_REALPATH, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_notify_watch), SMB_VFS_OP_NOTIFY_WATCH, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_chflags), SMB_VFS_OP_CHFLAGS, SMB_VFS_LAYER_TRANSPARENT}, /* NT File ACL operations */ -- cgit From 256f506c5b060c37ee22ee9ff0c371154721252a Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Wed, 18 Apr 2007 20:18:43 +0000 Subject: r22341: Fix build of examples/VFS: adapt include for new place of tdb... (This used to be commit e7110058286ed7e723c9a24e555b9c3b527c456e) --- examples/VFS/Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'examples/VFS') diff --git a/examples/VFS/Makefile.in b/examples/VFS/Makefile.in index 8869a4f20d..4de0efd29e 100644 --- a/examples/VFS/Makefile.in +++ b/examples/VFS/Makefile.in @@ -12,7 +12,7 @@ FLAGS = $(CFLAGS) $(CPPFLAGS) -fPIC \ -I$(SAMBA_SOURCE)/popt \ -I$(SAMBA_SOURCE)/lib/replace \ -I$(SAMBA_SOURCE)/lib/talloc \ - -I$(SAMBA_SOURCE)/tdb/include \ + -I$(SAMBA_SOURCE)/lib/tdb/include \ -I$(SAMBA_SOURCE)/smbwrapper \ -I$(SAMBA_SOURCE)/librpc \ -I$(SAMBA_SOURCE) -I. -- cgit From 5b3d90e48b8f599cb0f4458839c26d33a9cbd7b3 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 30 Apr 2007 03:38:19 +0000 Subject: r22591: Fix up the examples also. Jeremy. (This used to be commit aa5a1591c626e2828244a78f237af8a59af57784) --- examples/VFS/shadow_copy_test.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'examples/VFS') diff --git a/examples/VFS/shadow_copy_test.c b/examples/VFS/shadow_copy_test.c index 155181229b..98ac304ee2 100644 --- a/examples/VFS/shadow_copy_test.c +++ b/examples/VFS/shadow_copy_test.c @@ -58,7 +58,11 @@ static int test_get_shadow_copy_data(vfs_handle_struct *handle, files_struct *fs shadow_copy_data->num_volumes = num; if (labels) { - shadow_copy_data->labels = TALLOC_ZERO_ARRAY(shadow_copy_data->mem_ctx,SHADOW_COPY_LABEL,num); + if (num) { + shadow_copy_data->labels = TALLOC_ZERO_ARRAY(shadow_copy_data->mem_ctx,SHADOW_COPY_LABEL,num); + } else { + shadow_copy_data->labels = NULL; + } for (i=0;ilabels[i], sizeof(SHADOW_COPY_LABEL), "@GMT-2003.08.05-12.%02u.00",i); } -- cgit From 57d6318a0b5ecc0154547a04acef8ac222c1d28f Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 23 May 2007 23:55:12 +0000 Subject: r23105: Add lchown to the vfs layer. We need this in the POSIX code. Jeremy. (This used to be commit 932523cbb508db869b726768e86bfa8e248f768b) --- examples/VFS/skel_opaque.c | 6 ++++++ examples/VFS/skel_transparent.c | 6 ++++++ 2 files changed, 12 insertions(+) (limited to 'examples/VFS') diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index 7103d0c27b..6204ef47f4 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -206,6 +206,11 @@ static int skel_fchown(vfs_handle_struct *handle, files_struct *fsp, int fd, uid return vfswrap_fchown(NULL, fsp, fd, uid, gid); } +static int skel_lchown(vfs_handle_struct *handle, const char *path, uid_t uid, gid_t gid) +{ + return vfswrap_lchown(NULL, path, uid, gid); +} + static int skel_chdir(vfs_handle_struct *handle, const char *path) { return vfswrap_chdir(NULL, path); @@ -600,6 +605,7 @@ static vfs_op_tuple skel_op_tuples[] = { {SMB_VFS_OP(skel_fchmod), SMB_VFS_OP_FCHMOD, SMB_VFS_LAYER_OPAQUE}, {SMB_VFS_OP(skel_chown), SMB_VFS_OP_CHOWN, SMB_VFS_LAYER_OPAQUE}, {SMB_VFS_OP(skel_fchown), SMB_VFS_OP_FCHOWN, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_lchown), SMB_VFS_OP_LCHOWN, SMB_VFS_LAYER_OPAQUE}, {SMB_VFS_OP(skel_chdir), SMB_VFS_OP_CHDIR, SMB_VFS_LAYER_OPAQUE}, {SMB_VFS_OP(skel_getwd), SMB_VFS_OP_GETWD, SMB_VFS_LAYER_OPAQUE}, {SMB_VFS_OP(skel_ntimes), SMB_VFS_OP_NTIMES, SMB_VFS_LAYER_OPAQUE}, diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c index 2efb3d54a7..a422b7ce00 100644 --- a/examples/VFS/skel_transparent.c +++ b/examples/VFS/skel_transparent.c @@ -200,6 +200,11 @@ static int skel_fchown(vfs_handle_struct *handle, files_struct *fsp, int fd, uid return SMB_VFS_NEXT_FCHOWN(handle, fsp, fd, uid, gid); } +static int skel_lchown(vfs_handle_struct *handle, const char *path, uid_t uid, gid_t gid) +{ + return SMB_VFS_NEXT_LCHOWN(handle, path, uid, gid); +} + static int skel_chdir(vfs_handle_struct *handle, const char *path) { return SMB_VFS_NEXT_CHDIR(handle, path); @@ -561,6 +566,7 @@ static vfs_op_tuple skel_op_tuples[] = { {SMB_VFS_OP(skel_fchmod), SMB_VFS_OP_FCHMOD, SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(skel_chown), SMB_VFS_OP_CHOWN, SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(skel_fchown), SMB_VFS_OP_FCHOWN, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_lchown), SMB_VFS_OP_LCHOWN, SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(skel_chdir), SMB_VFS_OP_CHDIR, SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(skel_getwd), SMB_VFS_OP_GETWD, SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(skel_ntimes), SMB_VFS_OP_NTIMES, SMB_VFS_LAYER_TRANSPARENT}, -- cgit From a0ac7a7f4c0290787cdadb5866272cee2bd61b8a Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 26 Jun 2007 22:49:10 +0000 Subject: r23620: Convert set_nt_acl to return NTSTATUS. Also fix the chown return to correctly return NT_STATUS_INVALID_OWNER if it should be disallowed. Matches better what W2K3R3 does. NFSv4 ACL module owners, please examine these changes. Jeremy. (This used to be commit fc6899a5506b272f8cd5f5837ca13300b4e69a5f) --- examples/VFS/skel_opaque.c | 8 ++++---- examples/VFS/skel_transparent.c | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'examples/VFS') diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index 6204ef47f4..1ba6a9b13b 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -295,18 +295,18 @@ static size_t skel_get_nt_acl(vfs_handle_struct *handle, files_struct *fsp, return 0; } -static BOOL skel_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp, int +static NTSTATUS skel_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp, int fd, uint32 security_info_sent, SEC_DESC *psd) { errno = ENOSYS; - return False; + return NT_STATUS_NOT_IMPLEMENTED; } -static BOOL skel_set_nt_acl(vfs_handle_struct *handle, files_struct *fsp, const +static NTSTATUS skel_set_nt_acl(vfs_handle_struct *handle, files_struct *fsp, const char *name, uint32 security_info_sent, SEC_DESC *psd) { errno = ENOSYS; - return False; + return NT_STATUS_NOT_IMPLEMENTED; } static int skel_chmod_acl(vfs_handle_struct *handle, const char *name, mode_t mode) diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c index a422b7ce00..746fa31736 100644 --- a/examples/VFS/skel_transparent.c +++ b/examples/VFS/skel_transparent.c @@ -286,13 +286,13 @@ static size_t skel_get_nt_acl(vfs_handle_struct *handle, files_struct *fsp, return SMB_VFS_NEXT_GET_NT_ACL(handle, fsp, name, security_info, ppdesc); } -static BOOL skel_fset_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) { return SMB_VFS_NEXT_FSET_NT_ACL(handle, fsp, fd, security_info_sent, psd); } -static BOOL skel_set_nt_acl(vfs_handle_struct *handle, files_struct *fsp, +static NTSTATUS skel_set_nt_acl(vfs_handle_struct *handle, files_struct *fsp, const char *name, uint32 security_info_sent, SEC_DESC *psd) { return SMB_VFS_NEXT_SET_NT_ACL(handle, fsp, name, security_info_sent, psd); -- cgit From d824b98f80ba186030cbb70b3a1e5daf80469ecd Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 9 Jul 2007 19:25:36 +0000 Subject: r23779: Change from v2 or later to v3 or later. Jeremy. (This used to be commit 407e6e695b8366369b7c76af1ff76869b45347b3) --- examples/VFS/shadow_copy_test.c | 2 +- examples/VFS/skel_opaque.c | 2 +- examples/VFS/skel_transparent.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'examples/VFS') diff --git a/examples/VFS/shadow_copy_test.c b/examples/VFS/shadow_copy_test.c index 98ac304ee2..3e0f6a7f79 100644 --- a/examples/VFS/shadow_copy_test.c +++ b/examples/VFS/shadow_copy_test.c @@ -5,7 +5,7 @@ * * 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 + * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index 1ba6a9b13b..3da830ead9 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -8,7 +8,7 @@ * * 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 + * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c index 746fa31736..09461cff42 100644 --- a/examples/VFS/skel_transparent.c +++ b/examples/VFS/skel_transparent.c @@ -8,7 +8,7 @@ * * 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 + * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, -- cgit From 2a9b4da0fa00d4ada504f49fafcadab7b0094331 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 9 Jul 2007 19:46:27 +0000 Subject: r23780: Find and fix more GPL2 -> GPL3. Jeremy. (This used to be commit c2f7ab1c175ecff0cf44d0bbc4763ba9f7d7803f) --- examples/VFS/config.guess | 2 +- examples/VFS/config.sub | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'examples/VFS') diff --git a/examples/VFS/config.guess b/examples/VFS/config.guess index d0d57f6945..7e19c0b261 100755 --- a/examples/VFS/config.guess +++ b/examples/VFS/config.guess @@ -7,7 +7,7 @@ timestamp='2005-09-19' # This file 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 +# the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but diff --git a/examples/VFS/config.sub b/examples/VFS/config.sub index 1c366dfde9..f0fcaf6361 100755 --- a/examples/VFS/config.sub +++ b/examples/VFS/config.sub @@ -11,7 +11,7 @@ timestamp='2005-07-08' # # This file 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 +# the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, -- cgit From 674b835241c53af7d31af402bd900e95ac83fcca Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 10 Jul 2007 03:52:17 +0000 Subject: r23799: updated old Franklin Street FSF addresses to new URL (This used to be commit 43cd589773148fe3d243892768ce187604dd0c33) --- examples/VFS/config.guess | 4 +--- examples/VFS/config.sub | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) (limited to 'examples/VFS') diff --git a/examples/VFS/config.guess b/examples/VFS/config.guess index 7e19c0b261..600580b1aa 100755 --- a/examples/VFS/config.guess +++ b/examples/VFS/config.guess @@ -16,9 +16,7 @@ timestamp='2005-09-19' # 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., 51 Franklin Street - Fifth Floor, Boston, MA -# 02110-1301, USA. +# along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a diff --git a/examples/VFS/config.sub b/examples/VFS/config.sub index f0fcaf6361..23cd6fd75c 100755 --- a/examples/VFS/config.sub +++ b/examples/VFS/config.sub @@ -20,9 +20,7 @@ timestamp='2005-07-08' # 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., 51 Franklin Street - Fifth Floor, Boston, MA -# 02110-1301, USA. +# along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a -- cgit From 153cfb9c83534b09f15cc16205d7adb19b394928 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 10 Jul 2007 05:23:25 +0000 Subject: r23801: The FSF has moved around a lot. This fixes their Mass Ave address. (This used to be commit 87c91e4362c51819032bfbebbb273c52e203b227) --- examples/VFS/shadow_copy_test.c | 3 +-- examples/VFS/skel_opaque.c | 3 +-- examples/VFS/skel_transparent.c | 3 +-- 3 files changed, 3 insertions(+), 6 deletions(-) (limited to 'examples/VFS') diff --git a/examples/VFS/shadow_copy_test.c b/examples/VFS/shadow_copy_test.c index 3e0f6a7f79..86b61dc00e 100644 --- a/examples/VFS/shadow_copy_test.c +++ b/examples/VFS/shadow_copy_test.c @@ -14,8 +14,7 @@ * 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. + * along with this program; if not, see . */ #include "includes.h" diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index 3da830ead9..6a5b34f3af 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -17,8 +17,7 @@ * 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. + * along with this program; if not, see . */ diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c index 09461cff42..0a74cfc95d 100644 --- a/examples/VFS/skel_transparent.c +++ b/examples/VFS/skel_transparent.c @@ -17,8 +17,7 @@ * 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. + * along with this program; if not, see . */ -- cgit From 564e6841d60ec5ae573a707f73fcc0ab80a41394 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 2 Aug 2007 09:19:04 +0000 Subject: r24123: add file_id_create() to some vfs modules metze (This used to be commit 0bc5a9cd0136f8512e963a30b6e7b009667fb0bf) --- examples/VFS/skel_opaque.c | 12 ++++++++++-- examples/VFS/skel_transparent.c | 7 +++++++ 2 files changed, 17 insertions(+), 2 deletions(-) (limited to 'examples/VFS') diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index 6a5b34f3af..173644f3d1 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -280,6 +280,15 @@ static int skel_chflags(vfs_handle_struct *handle, const char *path, uint flags return -1; } +static struct file_id skel_file_id_create(vfs_handle_struct *handle, + SMB_DEV_T dev, SMB_INO_T inode) +{ + struct file_id id_zero; + ZERO_STRUCT(id_zero); + errno = ENOSYS; + return id_zero; +} + static size_t skel_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp, int fd, uint32 security_info, SEC_DESC **ppdesc) { @@ -618,8 +627,7 @@ static vfs_op_tuple skel_op_tuples[] = { {SMB_VFS_OP(skel_realpath), SMB_VFS_OP_REALPATH, SMB_VFS_LAYER_OPAQUE}, {SMB_VFS_OP(skel_notify_watch), SMB_VFS_OP_NOTIFY_WATCH, SMB_VFS_LAYER_OPAQUE}, {SMB_VFS_OP(skel_chflags), SMB_VFS_OP_CHFLAGS, SMB_VFS_LAYER_OPAQUE}, - - + {SMB_VFS_OP(skel_file_id_create), SMB_VFS_OP_FILE_ID_CREATE, SMB_VFS_LAYER_OPAQUE}, /* NT File ACL operations */ diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c index 0a74cfc95d..411dc31c6a 100644 --- a/examples/VFS/skel_transparent.c +++ b/examples/VFS/skel_transparent.c @@ -273,6 +273,12 @@ static int skel_chflags(vfs_handle_struct *handle, const char *path, uint flags return SMB_VFS_NEXT_CHFLAGS(handle, path, flags); } +static struct file_id skel_file_id_create(vfs_handle_struct *handle, + SMB_DEV_T dev, SMB_INO_T inode) +{ + return SMB_VFS_NEXT_FILE_ID_CREATE(handle, dev, inode); +} + static size_t skel_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp, int fd, uint32 security_info, SEC_DESC **ppdesc) { @@ -579,6 +585,7 @@ static vfs_op_tuple skel_op_tuples[] = { {SMB_VFS_OP(skel_realpath), SMB_VFS_OP_REALPATH, SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(skel_notify_watch), SMB_VFS_OP_NOTIFY_WATCH, SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(skel_chflags), SMB_VFS_OP_CHFLAGS, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_file_id_create), SMB_VFS_OP_FILE_ID_CREATE, SMB_VFS_LAYER_TRANSPARENT}, /* NT File ACL operations */ -- cgit From 30191d1a5704ad2b158386b511558972d539ce47 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 18 Oct 2007 17:40:25 -0700 Subject: RIP BOOL. Convert BOOL -> bool. I found a few interesting bugs in various places whilst doing this (places that assumed BOOL == int). I also need to fix the Samba4 pidl generation (next checkin). Jeremy. (This used to be commit f35a266b3cbb3e5fa6a86be60f34fe340a3ca71f) --- examples/VFS/shadow_copy_test.c | 2 +- examples/VFS/skel_opaque.c | 8 ++++---- examples/VFS/skel_transparent.c | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) (limited to 'examples/VFS') diff --git a/examples/VFS/shadow_copy_test.c b/examples/VFS/shadow_copy_test.c index 86b61dc00e..1ba46b7176 100644 --- a/examples/VFS/shadow_copy_test.c +++ b/examples/VFS/shadow_copy_test.c @@ -49,7 +49,7 @@ Directories are always displayed... */ -static int test_get_shadow_copy_data(vfs_handle_struct *handle, files_struct *fsp, SHADOW_COPY_DATA *shadow_copy_data, BOOL labels) +static int test_get_shadow_copy_data(vfs_handle_struct *handle, files_struct *fsp, SHADOW_COPY_DATA *shadow_copy_data, bool labels) { uint32 num = 3; uint32 i; diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index 173644f3d1..244c02e3ce 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -53,7 +53,7 @@ static void skel_disconnect(vfs_handle_struct *handle, connection_struct *conn) } static SMB_BIG_UINT skel_disk_free(vfs_handle_struct *handle, const char *path, - BOOL small_query, SMB_BIG_UINT *bsize, + bool small_query, SMB_BIG_UINT *bsize, SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize) { return vfswrap_disk_free(NULL, path, small_query, bsize, @@ -70,7 +70,7 @@ static int skel_set_quota(vfs_handle_struct *handle, enum SMB_QUOTA_TYPE qtype, return vfswrap_set_quota(NULL, qtype, id, dq); } -static int skel_get_shadow_copy_data(vfs_handle_struct *handle, files_struct *fsp, SHADOW_COPY_DATA *shadow_copy_data, BOOL labels) +static int skel_get_shadow_copy_data(vfs_handle_struct *handle, files_struct *fsp, SHADOW_COPY_DATA *shadow_copy_data, bool labels) { return vfswrap_get_shadow_copy_data(NULL, fsp, shadow_copy_data, labels); } @@ -230,12 +230,12 @@ static int skel_ftruncate(vfs_handle_struct *handle, files_struct *fsp, int fd, return vfswrap_ftruncate(NULL, fsp, fd, 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 fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type) { return vfswrap_lock(NULL, fsp, fd, 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) +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) { return vfswrap_getlock(NULL, fsp, fd, poffset, pcount, ptype, ppid); } diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c index 411dc31c6a..66ea1129b6 100644 --- a/examples/VFS/skel_transparent.c +++ b/examples/VFS/skel_transparent.c @@ -47,7 +47,7 @@ static void skel_disconnect(vfs_handle_struct *handle) } static SMB_BIG_UINT skel_disk_free(vfs_handle_struct *handle, const char *path, - BOOL small_query, SMB_BIG_UINT *bsize, + bool small_query, SMB_BIG_UINT *bsize, SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize) { return SMB_VFS_NEXT_DISK_FREE(handle, path, small_query, bsize, @@ -64,7 +64,7 @@ static int skel_set_quota(vfs_handle_struct *handle, enum SMB_QUOTA_TYPE qtype, return SMB_VFS_NEXT_SET_QUOTA(handle, qtype, id, dq); } -static int skel_get_shadow_copy_data(vfs_handle_struct *handle, files_struct *fsp, SHADOW_COPY_DATA *shadow_copy_data, BOOL labels) +static int skel_get_shadow_copy_data(vfs_handle_struct *handle, files_struct *fsp, SHADOW_COPY_DATA *shadow_copy_data, bool labels) { return SMB_VFS_NEXT_GET_SHADOW_COPY_DATA(handle, fsp, shadow_copy_data, labels); } @@ -224,12 +224,12 @@ static int skel_ftruncate(vfs_handle_struct *handle, files_struct *fsp, int fd, return SMB_VFS_NEXT_FTRUNCATE(handle, fsp, fd, 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 fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type) { return SMB_VFS_NEXT_LOCK(handle, fsp, fd, 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) +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) { return SMB_VFS_NEXT_GETLOCK(handle, fsp, fd, poffset, pcount, ptype, ppid); } -- cgit From 488b59cfac244ec8cfc60df687fcd153d693509c Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 29 Oct 2007 17:16:13 -0700 Subject: Add in the recvfile entry to the VFS layer with a default implementation. Needed for the zero-copy write code. Jeremy. (This used to be commit bfbdb6324c5d13bfde8b742e9c5a0e0c9092bd86) --- examples/VFS/skel_opaque.c | 13 +++++++++++++ examples/VFS/skel_transparent.c | 12 ++++++++++++ 2 files changed, 25 insertions(+) (limited to 'examples/VFS') diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index 244c02e3ce..fd4b206185 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -155,6 +155,17 @@ static SMB_OFF_T skel_lseek(vfs_handle_struct *handle, files_struct *fsp, int fi return vfswrap_lseek(NULL, fsp, filedes, 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) +{ + return vfswrap_sendfile(NULL, tofd, fsp, fromfd, hdr, offset, n); +} + +static ssize_t skel_recvfile(vfs_handle_struct *handle, int fromfd, files_struct *fsp, int tofd, SMB_OFF_T offset, size_t n) +{ + return vfswrap_recvfile(NULL, fromfd, fsp, tofd, offset, n); +} + static int skel_rename(vfs_handle_struct *handle, const char *oldname, const char *newname) { return vfswrap_rename(NULL, oldname, newname); @@ -603,6 +614,8 @@ static vfs_op_tuple skel_op_tuples[] = { {SMB_VFS_OP(skel_write), SMB_VFS_OP_WRITE, SMB_VFS_LAYER_OPAQUE}, {SMB_VFS_OP(skel_pwrite), SMB_VFS_OP_PWRITE, SMB_VFS_LAYER_OPAQUE}, {SMB_VFS_OP(skel_lseek), SMB_VFS_OP_LSEEK, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_sendfile), SMB_VFS_OP_SENDFILE, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_recvfile), SMB_VFS_OP_RECVFLE, SMB_VFS_LAYER_OPAQUE}, {SMB_VFS_OP(skel_rename), SMB_VFS_OP_RENAME, SMB_VFS_LAYER_OPAQUE}, {SMB_VFS_OP(skel_fsync), SMB_VFS_OP_FSYNC, SMB_VFS_LAYER_OPAQUE}, {SMB_VFS_OP(skel_stat), SMB_VFS_OP_STAT, SMB_VFS_LAYER_OPAQUE}, diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c index 66ea1129b6..2512f4d6db 100644 --- a/examples/VFS/skel_transparent.c +++ b/examples/VFS/skel_transparent.c @@ -149,6 +149,16 @@ static SMB_OFF_T skel_lseek(vfs_handle_struct *handle, files_struct *fsp, int fi return SMB_VFS_NEXT_LSEEK(handle, fsp, filedes, 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) +{ + return SMB_VFS_NEXT_SENDFILE(handle, tofd, fsp, fromfd, hdr, offset, n); +} + +static ssize_t skel_recvfile(vfs_handle_struct *handle, int fromfd, files_struct *fsp, int tofd, SMB_OFF_T offset, size_t n) +{ + return SMB_VFS_NEXT_RECVFILE(handle, fromfd, fsp, tofd, offset, n); +} + static int skel_rename(vfs_handle_struct *handle, const char *oldname, const char *newname) { return SMB_VFS_NEXT_RENAME(handle, oldname, newname); @@ -561,6 +571,8 @@ static vfs_op_tuple skel_op_tuples[] = { {SMB_VFS_OP(skel_read), SMB_VFS_OP_READ, SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(skel_write), SMB_VFS_OP_WRITE, SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(skel_lseek), SMB_VFS_OP_LSEEK, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_sendfile), SMB_VFS_OP_SENDFILE, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_recvfile), SMB_VFS_OP_RECVFILE, SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(skel_rename), SMB_VFS_OP_RENAME, SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(skel_fsync), SMB_VFS_OP_FSYNC, SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(skel_stat), SMB_VFS_OP_STAT, SMB_VFS_LAYER_TRANSPARENT}, -- cgit From ca275e254985727c50b1b988c958a3743a7bc8ce Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Mon, 7 Jan 2008 00:14:19 +0100 Subject: Remove unneeded parameter fd from SMB_VFS_PREAD(). Michael (This used to be commit 73e28806ce87d829ea7c38ed3440020845bb13bf) --- examples/VFS/skel_opaque.c | 4 ++-- examples/VFS/skel_transparent.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'examples/VFS') diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index fd4b206185..aeca932132 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -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) diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c index 2512f4d6db..c6d7d5c36e 100644 --- a/examples/VFS/skel_transparent.c +++ b/examples/VFS/skel_transparent.c @@ -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) -- cgit From 3f4699f5a3f3c7a2ad11119c266e5a018d71b0fe Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Mon, 7 Jan 2008 00:21:12 +0100 Subject: Adapt fset_nt_acl() and fget_nt_acl() in examples/VFS/ to vfs prototype change. Michael (This used to be commit d9d6775878f8b3425665c6a45a5ef9cb92932cf8) --- examples/VFS/skel_opaque.c | 6 +++--- examples/VFS/skel_transparent.c | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'examples/VFS') diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index aeca932132..21b39c1d95 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -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; diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c index c6d7d5c36e..76ef7e0f2b 100644 --- a/examples/VFS/skel_transparent.c +++ b/examples/VFS/skel_transparent.c @@ -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, -- cgit From a56b417809805f8872c1e3238cce5d006d6189e4 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Mon, 7 Jan 2008 09:23:04 +0100 Subject: Remove redundant parameter fd from SMB_VFS_PWRITE(). Michael (This used to be commit 8c4901a19ae2fd3ee085f9499f33aa7db016d182) --- examples/VFS/skel_opaque.c | 4 ++-- examples/VFS/skel_transparent.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'examples/VFS') diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index 21b39c1d95..1fb9b8056e 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -145,9 +145,9 @@ 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) diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c index 76ef7e0f2b..f702c93d80 100644 --- a/examples/VFS/skel_transparent.c +++ b/examples/VFS/skel_transparent.c @@ -139,9 +139,9 @@ 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) -- cgit From 6f657c873efa4779e762a8f9ede97e19da6fb7ec Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Mon, 7 Jan 2008 10:15:08 +0100 Subject: Remove redundant parameter fd from SMB_VFS_LSEEK(). Michael (This used to be commit df929796f2698698d2875227bda8500589cca2df) --- examples/VFS/skel_opaque.c | 4 ++-- examples/VFS/skel_transparent.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'examples/VFS') diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index 1fb9b8056e..ea525bf2dd 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -150,9 +150,9 @@ ssize_t skel_pwrite(vfs_handle_struct *handle, struct files_struct *fsp, const v 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, diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c index f702c93d80..8772718a74 100644 --- a/examples/VFS/skel_transparent.c +++ b/examples/VFS/skel_transparent.c @@ -144,9 +144,9 @@ static ssize_t skel_pwrite(vfs_handle_struct *handle, files_struct *fsp, const v 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) -- cgit From 8dcce0d236b2102ca94fbcb7aa7126fe6733f2e7 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Mon, 7 Jan 2008 12:49:02 +0100 Subject: Remove redundant parameter fd from SMB_VFS_FSYNC(). Michael (This used to be commit 8f83c9a7b245dbfef28195f9a7f33047a8ba95a0) --- examples/VFS/skel_opaque.c | 4 ++-- examples/VFS/skel_transparent.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'examples/VFS') diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index ea525bf2dd..2ae24312b4 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -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) diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c index 8772718a74..ea20312514 100644 --- a/examples/VFS/skel_transparent.c +++ b/examples/VFS/skel_transparent.c @@ -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) -- cgit From 87a684f7fcfa8d9fabc42e33981299d0b33eeeb7 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Mon, 7 Jan 2008 13:21:26 +0100 Subject: Remove redundant parameter fd from SMB_VFS_FSTAT(). Michael (This used to be commit 0b86c420be94d295f6917a220b5d699f65b46711) --- examples/VFS/skel_opaque.c | 4 ++-- examples/VFS/skel_transparent.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'examples/VFS') diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index 2ae24312b4..361cf207d3 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -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) diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c index ea20312514..72ca6f2056 100644 --- a/examples/VFS/skel_transparent.c +++ b/examples/VFS/skel_transparent.c @@ -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) -- cgit From e614dec27f33c932c6c29c806d567fd6015cd5e6 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Mon, 7 Jan 2008 13:44:37 +0100 Subject: Remove redundant parameter fd from SMB_VFS_FCHMOD(). Michael (This used to be commit a54d5604da556d1250ca9948d4acc4a187a9fede) --- examples/VFS/skel_opaque.c | 4 ++-- examples/VFS/skel_transparent.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'examples/VFS') diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index 361cf207d3..ac3ee6bd23 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -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) diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c index 72ca6f2056..0cae379445 100644 --- a/examples/VFS/skel_transparent.c +++ b/examples/VFS/skel_transparent.c @@ -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) -- cgit From 670909cb07e38a06bf5db12342b3b1189f0e1ab7 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Mon, 7 Jan 2008 14:26:00 +0100 Subject: Remove redundant parameter fd from SMB_VFS_FCHOWN(). Michael (This used to be commit fbb193db3e0dc51cb000ae406a68bc547f31d9ab) --- examples/VFS/skel_opaque.c | 4 ++-- examples/VFS/skel_transparent.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'examples/VFS') diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index ac3ee6bd23..185694f6fa 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -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) diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c index 0cae379445..d4af67db51 100644 --- a/examples/VFS/skel_transparent.c +++ b/examples/VFS/skel_transparent.c @@ -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) -- cgit From b457b94bb86897b7020c6f300cd19a3d8e192610 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Mon, 7 Jan 2008 15:55:09 +0100 Subject: Remove redundant parameter fd from SMB_VFS_FTRUNCATE(). Michael (This used to be commit 2ad66050a0452b8e7e08b1e7a01efa00c72fd451) --- examples/VFS/skel_opaque.c | 4 ++-- examples/VFS/skel_transparent.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'examples/VFS') diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index 185694f6fa..2ecfcf1b66 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -236,9 +236,9 @@ 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) diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c index d4af67db51..5d3103ee76 100644 --- a/examples/VFS/skel_transparent.c +++ b/examples/VFS/skel_transparent.c @@ -229,9 +229,9 @@ 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) -- cgit From edd30e716fb5133b269ef82358e95d187a107870 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Mon, 7 Jan 2008 16:38:23 +0100 Subject: Remove redundant parameter fd from SMB_VFS_LOCK(). Michael (This used to be commit 4f3ab2c406072e0b43581057e7e785e8ad454cfa) --- examples/VFS/skel_opaque.c | 4 ++-- examples/VFS/skel_transparent.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'examples/VFS') diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index 2ecfcf1b66..d5cedaf5d2 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -241,9 +241,9 @@ static int skel_ftruncate(vfs_handle_struct *handle, files_struct *fsp, SMB_OFF_ 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) diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c index 5d3103ee76..37570b8ab0 100644 --- a/examples/VFS/skel_transparent.c +++ b/examples/VFS/skel_transparent.c @@ -234,9 +234,9 @@ static int skel_ftruncate(vfs_handle_struct *handle, files_struct *fsp, SMB_OFF_ 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) -- cgit From 89f1fec4e57255fc511eeee0b18cbe19e8c22297 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 8 Jan 2008 22:13:25 +0100 Subject: Fix examples/VFS after VFS API changes. Michael (This used to be commit c88555ce45aa2998037d316f3a8edccd04be04a4) --- examples/VFS/skel_opaque.c | 24 +++++++++++------------ examples/VFS/skel_transparent.c | 42 ++++++++++++++++++++--------------------- 2 files changed, 33 insertions(+), 33 deletions(-) (limited to 'examples/VFS') diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index d5cedaf5d2..c095a15794 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -246,9 +246,9 @@ static bool skel_lock(vfs_handle_struct *handle, files_struct *fsp, int op, SMB_ 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) +static bool skel_getlock(vfs_handle_struct *handle, files_struct *fsp, SMB_OFF_T *poffset, SMB_OFF_T *pcount, int *ptype, pid_t *ppid) { - return vfswrap_getlock(NULL, fsp, fd, poffset, pcount, ptype, ppid); + return vfswrap_getlock(NULL, fsp, poffset, pcount, ptype, ppid); } static int skel_symlink(vfs_handle_struct *handle, const char *oldpath, const char *newpath) @@ -334,7 +334,7 @@ static int skel_chmod_acl(vfs_handle_struct *handle, const char *name, mode_t m return -1; } -static int skel_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp, int fd, mode_t mode) +static int skel_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp, mode_t mode) { errno = ENOSYS; return -1; @@ -370,7 +370,7 @@ static SMB_ACL_T skel_sys_acl_get_file(vfs_handle_struct *handle, const char *p return NULL; } -static SMB_ACL_T skel_sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp, int fd) +static SMB_ACL_T skel_sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp) { errno = ENOSYS; return NULL; @@ -436,7 +436,7 @@ static int skel_sys_acl_set_file(vfs_handle_struct *handle, const char *name, S return -1; } -static int skel_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp, int fd, SMB_ACL_T theacl) +static int skel_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp, SMB_ACL_T theacl) { errno = ENOSYS; return -1; @@ -485,7 +485,7 @@ size) return -1; } -static ssize_t skel_fgetxattr(vfs_handle_struct *handle, struct files_struct *fsp,int fd, const char *name, void *value, size_t size) +static ssize_t skel_fgetxattr(vfs_handle_struct *handle, struct files_struct *fsp, const char *name, void *value, size_t size) { errno = ENOSYS; return -1; @@ -503,7 +503,7 @@ static ssize_t skel_llistxattr(vfs_handle_struct *handle, const char *path, char return -1; } -static ssize_t skel_flistxattr(vfs_handle_struct *handle, struct files_struct *fsp,int fd, char *list, size_t size) +static ssize_t skel_flistxattr(vfs_handle_struct *handle, struct files_struct *fsp, char *list, size_t size) { errno = ENOSYS; return -1; @@ -521,7 +521,7 @@ static int skel_lremovexattr(vfs_handle_struct *handle, const char *path, const return -1; } -static int skel_fremovexattr(vfs_handle_struct *handle, struct files_struct *fsp,int fd, const char *name) +static int skel_fremovexattr(vfs_handle_struct *handle, struct files_struct *fsp, const char *name) { errno = ENOSYS; return -1; @@ -539,7 +539,7 @@ static int skel_lsetxattr(vfs_handle_struct *handle, const char *path, const cha return -1; } -static int skel_fsetxattr(vfs_handle_struct *handle, struct files_struct *fsp,int fd, const char *name, const void *value, size_t size, int flags) +static int skel_fsetxattr(vfs_handle_struct *handle, struct files_struct *fsp, const char *name, const void *value, size_t size, int flags) { errno = ENOSYS; return -1; @@ -560,9 +560,9 @@ static ssize_t skel_aio_return(struct vfs_handle_struct *handle, struct files_st return vfswrap_aio_return(NULL, fsp, aiocb); } -static int skel_aio_cancel(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, SMB_STRUCT_AIOCB *aiocb) +static int skel_aio_cancel(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb) { - return vfswrap_aio_cancel(NULL, fsp, fd, aiocb); + return vfswrap_aio_cancel(NULL, fsp, aiocb); } static int skel_aio_error(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb) @@ -615,7 +615,7 @@ static vfs_op_tuple skel_op_tuples[] = { {SMB_VFS_OP(skel_pwrite), SMB_VFS_OP_PWRITE, SMB_VFS_LAYER_OPAQUE}, {SMB_VFS_OP(skel_lseek), SMB_VFS_OP_LSEEK, SMB_VFS_LAYER_OPAQUE}, {SMB_VFS_OP(skel_sendfile), SMB_VFS_OP_SENDFILE, SMB_VFS_LAYER_OPAQUE}, - {SMB_VFS_OP(skel_recvfile), SMB_VFS_OP_RECVFLE, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_recvfile), SMB_VFS_OP_RECVFILE, SMB_VFS_LAYER_OPAQUE}, {SMB_VFS_OP(skel_rename), SMB_VFS_OP_RENAME, SMB_VFS_LAYER_OPAQUE}, {SMB_VFS_OP(skel_fsync), SMB_VFS_OP_FSYNC, SMB_VFS_LAYER_OPAQUE}, {SMB_VFS_OP(skel_stat), SMB_VFS_OP_STAT, SMB_VFS_LAYER_OPAQUE}, diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c index 37570b8ab0..f15cdfdb70 100644 --- a/examples/VFS/skel_transparent.c +++ b/examples/VFS/skel_transparent.c @@ -239,9 +239,9 @@ static bool skel_lock(vfs_handle_struct *handle, files_struct *fsp, int op, SMB_ 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) +static bool skel_getlock(vfs_handle_struct *handle, files_struct *fsp, SMB_OFF_T *poffset, SMB_OFF_T *pcount, int *ptype, pid_t *ppid) { - return SMB_VFS_NEXT_GETLOCK(handle, fsp, fd, poffset, pcount, ptype, ppid); + return SMB_VFS_NEXT_GETLOCK(handle, fsp, poffset, pcount, ptype, ppid); } static int skel_symlink(vfs_handle_struct *handle, const char *oldpath, const char *newpath) @@ -289,16 +289,16 @@ static struct file_id skel_file_id_create(vfs_handle_struct *handle, return SMB_VFS_NEXT_FILE_ID_CREATE(handle, dev, inode); } -static size_t skel_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp, +static NTSTATUS skel_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp, uint32 security_info, SEC_DESC **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, +static NTSTATUS skel_get_nt_acl(vfs_handle_struct *handle, const char *name, uint32 security_info, SEC_DESC **ppdesc) { - return SMB_VFS_NEXT_GET_NT_ACL(handle, fsp, name, security_info, ppdesc); + return SMB_VFS_NEXT_GET_NT_ACL(handle, name, security_info, ppdesc); } static NTSTATUS skel_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp, @@ -323,14 +323,14 @@ static int skel_chmod_acl(vfs_handle_struct *handle, const char *name, mode_t m return SMB_VFS_NEXT_CHMOD_ACL(handle, name, mode); } -static int skel_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp, int fd, mode_t mode) +static int skel_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp, mode_t mode) { /* If the underlying VFS doesn't have ACL support... */ if (!handle->vfs_next.ops.fchmod_acl) { errno = ENOSYS; return -1; } - return SMB_VFS_NEXT_FCHMOD_ACL(handle, fsp, fd, mode); + return SMB_VFS_NEXT_FCHMOD_ACL(handle, fsp, mode); } static int skel_sys_acl_get_entry(vfs_handle_struct *handle, SMB_ACL_T theacl, int entry_id, SMB_ACL_ENTRY_T *entry_p) @@ -358,9 +358,9 @@ static SMB_ACL_T skel_sys_acl_get_file(vfs_handle_struct *handle, const char *p return SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, path_p, type); } -static SMB_ACL_T skel_sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp, int fd) +static SMB_ACL_T skel_sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp) { - return SMB_VFS_NEXT_SYS_ACL_GET_FD(handle, fsp, fd); + return SMB_VFS_NEXT_SYS_ACL_GET_FD(handle, fsp); } static int skel_sys_acl_clear_perms(vfs_handle_struct *handle, SMB_ACL_PERMSET_T permset) @@ -413,9 +413,9 @@ static int skel_sys_acl_set_file(vfs_handle_struct *handle, const char *name, S return SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, name, acltype, theacl); } -static int skel_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp, int fd, SMB_ACL_T theacl) +static int skel_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp, SMB_ACL_T theacl) { - return SMB_VFS_NEXT_SYS_ACL_SET_FD(handle, fsp, fd, theacl); + return SMB_VFS_NEXT_SYS_ACL_SET_FD(handle, fsp, theacl); } static int skel_sys_acl_delete_def_file(vfs_handle_struct *handle, const char *path) @@ -454,9 +454,9 @@ size) return SMB_VFS_NEXT_LGETXATTR(handle, path, name, value, size); } -static ssize_t skel_fgetxattr(vfs_handle_struct *handle, struct files_struct *fsp,int fd, const char *name, void *value, size_t size) +static ssize_t skel_fgetxattr(vfs_handle_struct *handle, struct files_struct *fsp, const char *name, void *value, size_t size) { - return SMB_VFS_NEXT_FGETXATTR(handle, fsp, fd, name, value, size); + return SMB_VFS_NEXT_FGETXATTR(handle, fsp, name, value, size); } static ssize_t skel_listxattr(vfs_handle_struct *handle, const char *path, char *list, size_t size) @@ -469,9 +469,9 @@ static ssize_t skel_llistxattr(vfs_handle_struct *handle, const char *path, char return SMB_VFS_NEXT_LLISTXATTR(handle, path, list, size); } -static ssize_t skel_flistxattr(vfs_handle_struct *handle, struct files_struct *fsp,int fd, char *list, size_t size) +static ssize_t skel_flistxattr(vfs_handle_struct *handle, struct files_struct *fsp, char *list, size_t size) { - return SMB_VFS_NEXT_FLISTXATTR(handle, fsp, fd, list, size); + return SMB_VFS_NEXT_FLISTXATTR(handle, fsp, list, size); } static int skel_removexattr(vfs_handle_struct *handle, const char *path, const char *name) @@ -484,9 +484,9 @@ static int skel_lremovexattr(vfs_handle_struct *handle, const char *path, const return SMB_VFS_NEXT_LREMOVEXATTR(handle, path, name); } -static int skel_fremovexattr(vfs_handle_struct *handle, struct files_struct *fsp,int fd, const char *name) +static int skel_fremovexattr(vfs_handle_struct *handle, struct files_struct *fsp, const char *name) { - return SMB_VFS_NEXT_FREMOVEXATTR(handle, fsp, fd, name); + return SMB_VFS_NEXT_FREMOVEXATTR(handle, fsp, name); } static int skel_setxattr(vfs_handle_struct *handle, const char *path, const char *name, const void *value, size_t size, int flags) @@ -499,9 +499,9 @@ static int skel_lsetxattr(vfs_handle_struct *handle, const char *path, const cha return SMB_VFS_NEXT_LSETXATTR(handle, path, name, value, size, flags); } -static int skel_fsetxattr(vfs_handle_struct *handle, struct files_struct *fsp,int fd, const char *name, const void *value, size_t size, int flags) +static int skel_fsetxattr(vfs_handle_struct *handle, struct files_struct *fsp, const char *name, const void *value, size_t size, int flags) { - return SMB_VFS_NEXT_FSETXATTR(handle, fsp, fd, name, value, size, flags); + return SMB_VFS_NEXT_FSETXATTR(handle, fsp, name, value, size, flags); } static int skel_aio_read(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb) @@ -519,9 +519,9 @@ static ssize_t skel_aio_return(struct vfs_handle_struct *handle, struct files_st return SMB_VFS_NEXT_AIO_RETURN(handle, fsp, aiocb); } -static int skel_aio_cancel(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, SMB_STRUCT_AIOCB *aiocb) +static int skel_aio_cancel(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb) { - return SMB_VFS_NEXT_AIO_CANCEL(handle, fsp, fd, aiocb); + return SMB_VFS_NEXT_AIO_CANCEL(handle, fsp, aiocb); } static int skel_aio_error(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb) -- cgit From e09316ed789accc77b1812e8da4f9aa20330e2ea Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 8 Jan 2008 22:51:21 +0100 Subject: Fix returns in void functions. Michael (This used to be commit ef7c9a765bcdb1c774ff4f6d14053c4aa3815f31) --- examples/VFS/skel_opaque.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'examples/VFS') diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index c095a15794..8c05479a62 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -92,7 +92,7 @@ static SMB_STRUCT_DIRENT *skel_readdir(vfs_handle_struct *handle, SMB_STRUCT_DI static void skel_seekdir(vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp, long offset) { - return vfswrap_seekdir(NULL, dirp, offset); + vfswrap_seekdir(NULL, dirp, offset); } static long skel_telldir(vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp) @@ -102,7 +102,7 @@ static long skel_telldir(vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp) static void skel_rewinddir(vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp) { - return vfswrap_rewinddir(NULL, dirp); + vfswrap_rewinddir(NULL, dirp); } static int skel_mkdir(vfs_handle_struct *handle, const char *path, mode_t mode) -- cgit From 1d66f4d58b5fdd9c4e0c022cd2724e05d144510b Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 10 Jan 2008 15:33:51 +0100 Subject: Remove redundant parameter fd from SMB_VFS_READ(). Michael (This used to be commit a8fc2ddad8d5f7c6c00cb36c74a32a02d69d1d04) --- examples/VFS/skel_opaque.c | 4 ++-- examples/VFS/skel_transparent.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'examples/VFS') diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index 8c05479a62..eda1ceb1d1 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -130,9 +130,9 @@ static int skel_close(vfs_handle_struct *handle, files_struct *fsp, int fd) return vfswrap_close(NULL, fsp, fd); } -static ssize_t skel_read(vfs_handle_struct *handle, files_struct *fsp, int fd, void *data, size_t n) +static ssize_t skel_read(vfs_handle_struct *handle, files_struct *fsp, void *data, size_t n) { - return vfswrap_read(NULL, fsp, fd, data, n); + return vfswrap_read(NULL, fsp, data, n); } static ssize_t skel_pread(vfs_handle_struct *handle, struct files_struct *fsp, void *data, size_t n, SMB_OFF_T offset) diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c index f15cdfdb70..7b09e3369c 100644 --- a/examples/VFS/skel_transparent.c +++ b/examples/VFS/skel_transparent.c @@ -124,9 +124,9 @@ static int skel_close(vfs_handle_struct *handle, files_struct *fsp, int fd) return SMB_VFS_NEXT_CLOSE(handle, fsp, fd); } -static ssize_t skel_read(vfs_handle_struct *handle, files_struct *fsp, int fd, void *data, size_t n) +static ssize_t skel_read(vfs_handle_struct *handle, files_struct *fsp, void *data, size_t n) { - return SMB_VFS_NEXT_READ(handle, fsp, fd, data, n); + return SMB_VFS_NEXT_READ(handle, fsp, data, n); } static ssize_t skel_pread(vfs_handle_struct *handle, files_struct *fsp, void *data, size_t n, SMB_OFF_T offset) -- cgit From e9a3a62e7448bef72d9c17c90ff2b404082f067c Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 10 Jan 2008 15:49:35 +0100 Subject: Remove redundant parameter fd from SMB_VFS_WRITE(). Michael (This used to be commit c8ae7d095a2a6a7eac920a68ca7244e3a423e1b1) --- examples/VFS/skel_opaque.c | 4 ++-- examples/VFS/skel_transparent.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'examples/VFS') diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index eda1ceb1d1..6b1f29b12d 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -140,9 +140,9 @@ static ssize_t skel_pread(vfs_handle_struct *handle, struct files_struct *fsp, v 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) +static ssize_t skel_write(vfs_handle_struct *handle, files_struct *fsp, const void *data, size_t n) { - return vfswrap_write(NULL, fsp, fd, data, n); + return vfswrap_write(NULL, fsp, data, n); } ssize_t skel_pwrite(vfs_handle_struct *handle, struct files_struct *fsp, const void *data, size_t n, SMB_OFF_T offset) diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c index 7b09e3369c..c168b461ba 100644 --- a/examples/VFS/skel_transparent.c +++ b/examples/VFS/skel_transparent.c @@ -134,9 +134,9 @@ static ssize_t skel_pread(vfs_handle_struct *handle, files_struct *fsp, void *da 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) +static ssize_t skel_write(vfs_handle_struct *handle, files_struct *fsp, const void *data, size_t n) { - return SMB_VFS_NEXT_WRITE(handle, fsp, fd, data, n); + return SMB_VFS_NEXT_WRITE(handle, fsp, data, n); } static ssize_t skel_pwrite(vfs_handle_struct *handle, files_struct *fsp, const void *data, size_t n, SMB_OFF_T offset) -- cgit From 4caab9ca25e1163378714de825d835e79e27dd4f Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 11 Jan 2008 00:51:19 +0100 Subject: Combine fsp and fromfd to fromfsp in SMB_VFS_SENDFILE(). Michael (This used to be commit a52cfb7d777157c93c9dc26c67f457be592dd537) --- examples/VFS/skel_opaque.c | 4 ++-- examples/VFS/skel_transparent.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'examples/VFS') diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index 6b1f29b12d..16578057d0 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -155,10 +155,10 @@ static SMB_OFF_T skel_lseek(vfs_handle_struct *handle, files_struct *fsp, SMB_OF 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, +static ssize_t skel_sendfile(vfs_handle_struct *handle, int tofd, files_struct *fromfsp, const DATA_BLOB *hdr, SMB_OFF_T offset, size_t n) { - return vfswrap_sendfile(NULL, tofd, fsp, fromfd, hdr, offset, n); + return vfswrap_sendfile(NULL, tofd, fromfsp, hdr, offset, n); } static ssize_t skel_recvfile(vfs_handle_struct *handle, int fromfd, files_struct *fsp, int tofd, SMB_OFF_T offset, size_t n) diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c index c168b461ba..e69826a89d 100644 --- a/examples/VFS/skel_transparent.c +++ b/examples/VFS/skel_transparent.c @@ -149,9 +149,9 @@ static SMB_OFF_T skel_lseek(vfs_handle_struct *handle, files_struct *fsp, SMB_OF 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) +static ssize_t skel_sendfile(vfs_handle_struct *handle, int tofd, files_struct *fromfsp, const DATA_BLOB *hdr, SMB_OFF_T offset, size_t n) { - return SMB_VFS_NEXT_SENDFILE(handle, tofd, fsp, fromfd, hdr, offset, n); + return SMB_VFS_NEXT_SENDFILE(handle, tofd, fromfsp, hdr, offset, n); } static ssize_t skel_recvfile(vfs_handle_struct *handle, int fromfd, files_struct *fsp, int tofd, SMB_OFF_T offset, size_t n) -- cgit From fef9cf00e1e110ff5872f1c368d080fe4f7939d6 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 11 Jan 2008 01:26:54 +0100 Subject: Combine fsp and tofd to tofsp in SMB_VFS_RECVFILE(). Michael (This used to be commit 3958abffaf2866c69ad9e13ec345364fde5c78bb) --- examples/VFS/skel_opaque.c | 4 ++-- examples/VFS/skel_transparent.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'examples/VFS') diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index 16578057d0..5b196af5eb 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -161,9 +161,9 @@ static ssize_t skel_sendfile(vfs_handle_struct *handle, int tofd, files_struct * return vfswrap_sendfile(NULL, tofd, fromfsp, hdr, offset, n); } -static ssize_t skel_recvfile(vfs_handle_struct *handle, int fromfd, files_struct *fsp, int tofd, SMB_OFF_T offset, size_t n) +static ssize_t skel_recvfile(vfs_handle_struct *handle, int fromfd, files_struct *tofsp, SMB_OFF_T offset, size_t n) { - return vfswrap_recvfile(NULL, fromfd, fsp, tofd, offset, n); + return vfswrap_recvfile(NULL, fromfd, tofsp, offset, n); } static int skel_rename(vfs_handle_struct *handle, const char *oldname, const char *newname) diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c index e69826a89d..55407be10c 100644 --- a/examples/VFS/skel_transparent.c +++ b/examples/VFS/skel_transparent.c @@ -154,9 +154,9 @@ static ssize_t skel_sendfile(vfs_handle_struct *handle, int tofd, files_struct * return SMB_VFS_NEXT_SENDFILE(handle, tofd, fromfsp, hdr, offset, n); } -static ssize_t skel_recvfile(vfs_handle_struct *handle, int fromfd, files_struct *fsp, int tofd, SMB_OFF_T offset, size_t n) +static ssize_t skel_recvfile(vfs_handle_struct *handle, int fromfd, files_struct *tofsp, SMB_OFF_T offset, size_t n) { - return SMB_VFS_NEXT_RECVFILE(handle, fromfd, fsp, tofd, offset, n); + return SMB_VFS_NEXT_RECVFILE(handle, fromfd, tofsp, offset, n); } static int skel_rename(vfs_handle_struct *handle, const char *oldname, const char *newname) -- cgit From 3020ec12a39276eaf3978323f4048b8a2e430bea Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 16 Jan 2008 17:22:31 -0800 Subject: Fix the mess that ab just made of the new VFS code. NEEDS MORE TESTING ! Jeremy. (This used to be commit bcc94aed6f03211866aa85753a90fece87846ba9) --- examples/VFS/skel_opaque.c | 28 +++++++++++++++++++++++++++- examples/VFS/skel_transparent.c | 28 +++++++++++++++++++++++++++- 2 files changed, 54 insertions(+), 2 deletions(-) (limited to 'examples/VFS') diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index 5b196af5eb..1c2fc45011 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -580,6 +580,26 @@ static int skel_aio_suspend(struct vfs_handle_struct *handle, struct files_struc return vfswrap_aio_suspend(NULL, fsp, aiocb, n, ts); } +static bool skel_aio_force(struct vfs_handle_struct *handle, struct files_struct *fsp) +{ + return vfswrap_aio_force(NULL, fsp); +} + +static int skel_is_offline(struct vfs_handle_struct *handle, const char *path, SMB_STRUCT_STAT *sbuf, bool *offline) +{ + return vfswrap_set_offline(NULL, path, sbuf, offline); +} + +static int skel_set_offline(struct vfs_handle_struct *handle, const char *path) +{ + return vfswrap_set_offline(NULL, path); +} + +static bool skel_is_remotestorage(struct vfs_handle_struct *handle, const char *path) +{ + return vfswrap_is_remotestorage(NULL, path); +} + /* VFS operations structure */ static vfs_op_tuple skel_op_tuples[] = { @@ -676,7 +696,7 @@ static vfs_op_tuple skel_op_tuples[] = { {SMB_VFS_OP(skel_sys_acl_free_text), SMB_VFS_OP_SYS_ACL_FREE_TEXT, SMB_VFS_LAYER_OPAQUE}, {SMB_VFS_OP(skel_sys_acl_free_acl), SMB_VFS_OP_SYS_ACL_FREE_ACL, SMB_VFS_LAYER_OPAQUE}, {SMB_VFS_OP(skel_sys_acl_free_qualifier), SMB_VFS_OP_SYS_ACL_FREE_QUALIFIER, SMB_VFS_LAYER_OPAQUE}, - + /* EA operations. */ {SMB_VFS_OP(skel_getxattr), SMB_VFS_OP_GETXATTR, SMB_VFS_LAYER_OPAQUE}, {SMB_VFS_OP(skel_lgetxattr), SMB_VFS_OP_LGETXATTR, SMB_VFS_LAYER_OPAQUE}, @@ -699,6 +719,12 @@ static vfs_op_tuple skel_op_tuples[] = { {SMB_VFS_OP(skel_aio_error), SMB_VFS_OP_AIO_ERROR, SMB_VFS_LAYER_OPAQUE}, {SMB_VFS_OP(skel_aio_fsync), SMB_VFS_OP_AIO_FSYNC, SMB_VFS_LAYER_OPAQUE}, {SMB_VFS_OP(skel_aio_suspend), SMB_VFS_OP_AIO_SUSPEND, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_aio_force), SMB_VFS_OP_AIO_FORCE, SMB_VFS_LAYER_OPAQUE}, + + /* offline operations */ + {SMB_VFS_OP(skel_is_offline), SMB_VFS_OP_IS_OFFLINE, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_set_offline), SMB_VFS_OP_SET_OFFLINE, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_is_remotestorage), SMB_VFS_OP_IS_REMOTESTORAGE, SMB_VFS_LAYER_OPAQUE}, {NULL, SMB_VFS_OP_NOOP, SMB_VFS_LAYER_NOOP} }; diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c index 55407be10c..0a934976c4 100644 --- a/examples/VFS/skel_transparent.c +++ b/examples/VFS/skel_transparent.c @@ -539,6 +539,26 @@ static int skel_aio_suspend(struct vfs_handle_struct *handle, struct files_struc return SMB_VFS_NEXT_AIO_SUSPEND(handle, fsp, aiocb, n, ts); } +static bool skel_aio_force(struct vfs_handle_struct *handle, struct files_struct *fsp) +{ + return SMB_VFS_NEXT_AIO_FORCE(handle, fsp); +} + +static int skel_is_offline(struct vfs_handle_struct *handle, const char *path, SMB_STRUCT_STAT *sbuf, bool *offline) +{ + return SMB_VFS_NEXT_IS_OFFLINE(handle, path, sbuf, offline); +} + +static int skel_set_offline(struct vfs_handle_struct *handle, const char *path) +{ + return SMB_VFS_NEXT_SET_OFFLINE(handle, path); +} + +static bool skel_is_remotestorage(struct vfs_handle_struct *handle, const char *path) +{ + return SMB_VFS_NEXT_IS_REMOTESTORAGE(handle, path); +} + /* VFS operations structure */ static vfs_op_tuple skel_op_tuples[] = { @@ -633,7 +653,7 @@ static vfs_op_tuple skel_op_tuples[] = { {SMB_VFS_OP(skel_sys_acl_free_text), SMB_VFS_OP_SYS_ACL_FREE_TEXT, SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(skel_sys_acl_free_acl), SMB_VFS_OP_SYS_ACL_FREE_ACL, SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(skel_sys_acl_free_qualifier), SMB_VFS_OP_SYS_ACL_FREE_QUALIFIER, SMB_VFS_LAYER_TRANSPARENT}, - + /* EA operations. */ {SMB_VFS_OP(skel_getxattr), SMB_VFS_OP_GETXATTR, SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(skel_lgetxattr), SMB_VFS_OP_LGETXATTR, SMB_VFS_LAYER_TRANSPARENT}, @@ -656,6 +676,12 @@ static vfs_op_tuple skel_op_tuples[] = { {SMB_VFS_OP(skel_aio_error), SMB_VFS_OP_AIO_ERROR, SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(skel_aio_fsync), SMB_VFS_OP_AIO_FSYNC, SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(skel_aio_suspend), SMB_VFS_OP_AIO_SUSPEND, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_aio_force), SMB_VFS_OP_AIO_FORCE, SMB_VFS_LAYER_TRANSPARENT}, + + /* offline operations */ + {SMB_VFS_OP(skel_is_offline), SMB_VFS_OP_IS_OFFLINE, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_set_offline), SMB_VFS_OP_SET_OFFLINE, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_is_remotestorage), SMB_VFS_OP_IS_REMOTESTORAGE, SMB_VFS_LAYER_TRANSPARENT}, {NULL, SMB_VFS_OP_NOOP, SMB_VFS_LAYER_NOOP} }; -- cgit From 026a66abecea3e3a54cdbfb97129d5e65608e5df Mon Sep 17 00:00:00 2001 From: Alexander Bokovoy Date: Thu, 17 Jan 2008 14:57:35 +0300 Subject: Rework of VFS is_offline() function to only return boolean offline/online result for a file. This makes sense as upper levels are only taking returned result of 0 (no error) into consideration when deciding whether to mark file offline/online as returned from is_offline. That means that we simply can move the decision down to VFS module and clean up upper levels so that they always see only file status. If there is an error when trying to identify file status, then VFS module could decide what to return (offline or online) by itself -- after all, it ought to have system-specific knowledge anyway. (This used to be commit 75cc08661473cce62756fa062071bb2bc1fb39ec) --- examples/VFS/skel_opaque.c | 4 ++-- examples/VFS/skel_transparent.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'examples/VFS') diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index 1c2fc45011..42154c47a6 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -585,9 +585,9 @@ static bool skel_aio_force(struct vfs_handle_struct *handle, struct files_struct return vfswrap_aio_force(NULL, fsp); } -static int skel_is_offline(struct vfs_handle_struct *handle, const char *path, SMB_STRUCT_STAT *sbuf, bool *offline) +static bool skel_is_offline(struct vfs_handle_struct *handle, const char *path, SMB_STRUCT_STAT *sbuf) { - return vfswrap_set_offline(NULL, path, sbuf, offline); + return vfswrap_is_offline(NULL, path, sbuf); } static int skel_set_offline(struct vfs_handle_struct *handle, const char *path) diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c index 0a934976c4..997783819c 100644 --- a/examples/VFS/skel_transparent.c +++ b/examples/VFS/skel_transparent.c @@ -544,9 +544,9 @@ static bool skel_aio_force(struct vfs_handle_struct *handle, struct files_struct return SMB_VFS_NEXT_AIO_FORCE(handle, fsp); } -static int skel_is_offline(struct vfs_handle_struct *handle, const char *path, SMB_STRUCT_STAT *sbuf, bool *offline) +static bool skel_is_offline(struct vfs_handle_struct *handle, const char *path, SMB_STRUCT_STAT *sbuf) { - return SMB_VFS_NEXT_IS_OFFLINE(handle, path, sbuf, offline); + return SMB_VFS_NEXT_IS_OFFLINE(handle, path, sbuf); } static int skel_set_offline(struct vfs_handle_struct *handle, const char *path) -- cgit From 03387a0f5886d449eda359a5acecd830f3bd35bc Mon Sep 17 00:00:00 2001 From: Alexander Bokovoy Date: Thu, 17 Jan 2008 16:51:14 +0300 Subject: Remove is_remotestorage() call from VFS. We already have statvfs() there to handle FS capabilities. As discussed with Volker, it is better to calculate FS capabilities at connection time. We already do this with help of VFS statvfs() call which allows to fill-in system-specific attributes including FS capabilities. So just re-use it if you want to represent additional capabilities in your modules. The only caution is that you need to call underlying statvfs() call to actually get system-specific capabilities (and other fields) added. Then add module-specific ones. (This used to be commit e342ca0d931f9a5c8ec9e472dc9c63f1fe012b3a) --- examples/VFS/skel_opaque.c | 6 ------ examples/VFS/skel_transparent.c | 1 - 2 files changed, 7 deletions(-) (limited to 'examples/VFS') diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index 42154c47a6..4a6e6be42f 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -595,11 +595,6 @@ static int skel_set_offline(struct vfs_handle_struct *handle, const char *path) return vfswrap_set_offline(NULL, path); } -static bool skel_is_remotestorage(struct vfs_handle_struct *handle, const char *path) -{ - return vfswrap_is_remotestorage(NULL, path); -} - /* VFS operations structure */ static vfs_op_tuple skel_op_tuples[] = { @@ -724,7 +719,6 @@ static vfs_op_tuple skel_op_tuples[] = { /* offline operations */ {SMB_VFS_OP(skel_is_offline), SMB_VFS_OP_IS_OFFLINE, SMB_VFS_LAYER_OPAQUE}, {SMB_VFS_OP(skel_set_offline), SMB_VFS_OP_SET_OFFLINE, SMB_VFS_LAYER_OPAQUE}, - {SMB_VFS_OP(skel_is_remotestorage), SMB_VFS_OP_IS_REMOTESTORAGE, SMB_VFS_LAYER_OPAQUE}, {NULL, SMB_VFS_OP_NOOP, SMB_VFS_LAYER_NOOP} }; diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c index 997783819c..f4cb9b15ba 100644 --- a/examples/VFS/skel_transparent.c +++ b/examples/VFS/skel_transparent.c @@ -681,7 +681,6 @@ static vfs_op_tuple skel_op_tuples[] = { /* offline operations */ {SMB_VFS_OP(skel_is_offline), SMB_VFS_OP_IS_OFFLINE, SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(skel_set_offline), SMB_VFS_OP_SET_OFFLINE, SMB_VFS_LAYER_TRANSPARENT}, - {SMB_VFS_OP(skel_is_remotestorage), SMB_VFS_OP_IS_REMOTESTORAGE, SMB_VFS_LAYER_TRANSPARENT}, {NULL, SMB_VFS_OP_NOOP, SMB_VFS_LAYER_NOOP} }; -- cgit From 0db7aba8af80a01150d1061a4192ab814e4234b7 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 11 Jan 2008 14:19:28 +0100 Subject: Remove redundant parameter fd from SMB_VFS_CLOSE(). Now all those redundant fd's have vanished from the VFS API. Michael (This used to be commit 14294535512a7f191c5008e622b6708e417854ae) --- examples/VFS/skel_opaque.c | 4 ++-- examples/VFS/skel_transparent.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'examples/VFS') diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index 4a6e6be42f..eb49f35c04 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -125,9 +125,9 @@ static int skel_open(vfs_handle_struct *handle, const char *fname, files_struct return vfswrap_open(NULL, fname, flags, mode); } -static int skel_close(vfs_handle_struct *handle, files_struct *fsp, int fd) +static int skel_close(vfs_handle_struct *handle, files_struct *fsp) { - return vfswrap_close(NULL, fsp, fd); + return vfswrap_close(NULL, fsp); } static ssize_t skel_read(vfs_handle_struct *handle, files_struct *fsp, void *data, size_t n) diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c index f4cb9b15ba..7102d4d4db 100644 --- a/examples/VFS/skel_transparent.c +++ b/examples/VFS/skel_transparent.c @@ -119,9 +119,9 @@ static int skel_open(vfs_handle_struct *handle, const char *fname, files_struct return SMB_VFS_NEXT_OPEN(handle, fname, fsp, flags, mode); } -static int skel_close(vfs_handle_struct *handle, files_struct *fsp, int fd) +static int skel_close(vfs_handle_struct *handle, files_struct *fsp) { - return SMB_VFS_NEXT_CLOSE(handle, fsp, fd); + return SMB_VFS_NEXT_CLOSE(handle, fsp); } static ssize_t skel_read(vfs_handle_struct *handle, files_struct *fsp, void *data, size_t n) -- cgit From 00b2cdf75e9bea25034440054b4acd91a179c86d Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 8 May 2008 18:09:07 -0700 Subject: Yay ! Remove a VFS entry. Removed the set_nt_acl() call, this can only be done via fset_nt_acl() using an open file/directory handle. I'd like to do the same with get_nt_acl() but am concerned about efficiency problems with "hide unreadable/hide unwritable" when doing a directory listing (this would mean opening every file in the dir on list). Moving closer to rationalizing the ACL model and maybe moving the POSIX calls into a posix_acl VFS module rather than having them as first class citizens of the VFS. Jeremy. (This used to be commit f487f742cb903a06fbf2be006ddc9ce9063339ed) --- examples/VFS/skel_opaque.c | 8 -------- examples/VFS/skel_transparent.c | 7 ------- 2 files changed, 15 deletions(-) (limited to 'examples/VFS') diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index eb49f35c04..bac035a821 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -321,13 +321,6 @@ static NTSTATUS skel_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp, return NT_STATUS_NOT_IMPLEMENTED; } -static NTSTATUS skel_set_nt_acl(vfs_handle_struct *handle, files_struct *fsp, const - char *name, uint32 security_info_sent, SEC_DESC *psd) -{ - errno = ENOSYS; - return NT_STATUS_NOT_IMPLEMENTED; -} - static int skel_chmod_acl(vfs_handle_struct *handle, const char *name, mode_t mode) { errno = ENOSYS; @@ -662,7 +655,6 @@ static vfs_op_tuple skel_op_tuples[] = { {SMB_VFS_OP(skel_fget_nt_acl), SMB_VFS_OP_FGET_NT_ACL, SMB_VFS_LAYER_OPAQUE}, {SMB_VFS_OP(skel_get_nt_acl), SMB_VFS_OP_GET_NT_ACL, SMB_VFS_LAYER_OPAQUE}, {SMB_VFS_OP(skel_fset_nt_acl), SMB_VFS_OP_FSET_NT_ACL, SMB_VFS_LAYER_OPAQUE}, - {SMB_VFS_OP(skel_set_nt_acl), SMB_VFS_OP_SET_NT_ACL, SMB_VFS_LAYER_OPAQUE}, /* POSIX ACL operations */ diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c index 7102d4d4db..ea8530d855 100644 --- a/examples/VFS/skel_transparent.c +++ b/examples/VFS/skel_transparent.c @@ -307,12 +307,6 @@ static NTSTATUS skel_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp, 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, - const char *name, uint32 security_info_sent, SEC_DESC *psd) -{ - return SMB_VFS_NEXT_SET_NT_ACL(handle, fsp, name, security_info_sent, psd); -} - static int skel_chmod_acl(vfs_handle_struct *handle, const char *name, mode_t mode) { /* If the underlying VFS doesn't have ACL support... */ @@ -624,7 +618,6 @@ static vfs_op_tuple skel_op_tuples[] = { {SMB_VFS_OP(skel_fget_nt_acl), SMB_VFS_OP_FGET_NT_ACL, SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(skel_get_nt_acl), SMB_VFS_OP_GET_NT_ACL, SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(skel_fset_nt_acl), SMB_VFS_OP_FSET_NT_ACL, SMB_VFS_LAYER_TRANSPARENT}, - {SMB_VFS_OP(skel_set_nt_acl), SMB_VFS_OP_SET_NT_ACL, SMB_VFS_LAYER_TRANSPARENT}, /* POSIX ACL operations */ -- cgit From 9253044276fdf44bae2db2e232a47b229ebb0055 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 14 Aug 2008 10:58:50 -0700 Subject: Fix bug #5692 - Core dump in full_audit.so. There were some function mismatches in the various GET_NT_ACL modules (some places the fsp parameter has not been removed). Jeremy. (This used to be commit 221cc5e21eb27cdad51f34ec6832467a7bd89213) --- examples/VFS/skel_opaque.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'examples/VFS') diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index bac035a821..89d8ce5239 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -307,7 +307,7 @@ static size_t skel_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp, return 0; } -static size_t skel_get_nt_acl(vfs_handle_struct *handle, files_struct *fsp, +static size_t skel_get_nt_acl(vfs_handle_struct *handle, const char *name, uint32 security_info, SEC_DESC **ppdesc) { errno = ENOSYS; -- cgit