summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcvs2svn Import User <samba-bugs@samba.org>2000-04-04 03:05:55 +0000
committercvs2svn Import User <samba-bugs@samba.org>2000-04-04 03:05:55 +0000
commit48ce49e258f2adab4102c609f7beb124bac903fe (patch)
treecd907410339f745002315a3e59dc0ae7f49190da
parentcbe9ba57b11b47dc8460da3662d1a6f685c60cea (diff)
downloadsamba-48ce49e258f2adab4102c609f7beb124bac903fe.tar.gz
This commit was manufactured by cvs2svn to create tagsamba-misc-tags/tng/release-alpha-1-8
'release-alpha-1-8'.
-rw-r--r--examples/VFS/Makefile32
-rw-r--r--examples/VFS/README35
-rw-r--r--examples/VFS/audit.c207
-rw-r--r--examples/VFS/skel.c218
4 files changed, 0 insertions, 492 deletions
diff --git a/examples/VFS/Makefile b/examples/VFS/Makefile
deleted file mode 100644
index c4c9479c7d3..00000000000
--- a/examples/VFS/Makefile
+++ /dev/null
@@ -1,32 +0,0 @@
-#
-# Makefile for samba-vfs examples
-#
-# $Id: Makefile,v 1.2 2000/02/04 05:08:16 tpot Exp $
-#
-
-# Variables
-
-CC = gcc
-LIBTOOL = libtool
-
-SAMBA_SRC = ../../source/include
-CFLAGS = -I$(SAMBA_SRC)
-VFS_OBJS = audit.so skel.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 $(VFS_OBJS) $(VFS_OBJS:.so=.lo) *~ *% *.bak
diff --git a/examples/VFS/README b/examples/VFS/README
deleted file mode 100644
index c2f39f9727d..00000000000
--- a/examples/VFS/README
+++ /dev/null
@@ -1,35 +0,0 @@
-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.
-
-The libtool program, available from your favourite GNU software
-archive, is required to compile these programs.
-
-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
-
-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
deleted file mode 100644
index 8f0aaac4be3..00000000000
--- a/examples/VFS/audit.c
+++ /dev/null
@@ -1,207 +0,0 @@
-/*
- * Auditing VFS module for samba. Log select file operations to syslog
- * facility.
- *
- * 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
- * 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.2 2000/02/04 05:08:16 tpot Exp $
- */
-
-#include "config.h"
-#include <stdio.h>
-#include <sys/stat.h>
-#ifdef HAVE_UTIME_H
-#include <utime.h>
-#endif
-#ifdef HAVE_DIRENT_H
-#include <dirent.h>
-#endif
-#include <syslog.h>
-#ifdef HAVE_FCNTL_H
-#include <fcntl.h>
-#endif
-#include <errno.h>
-#include <string.h>
-#include <vfs.h>
-
-#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, /* fsync */
- NULL, /* stat */
- NULL, /* fstat */
- NULL, /* lstat */
- 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,
- ((flags & O_WRONLY) || (flags & 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
deleted file mode 100644
index da5ef7b3104..00000000000
--- a/examples/VFS/skel.c
+++ /dev/null
@@ -1,218 +0,0 @@
-/*
- * Skeleton VFS module.
- *
- * 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
- * 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.2 2000/02/04 05:08:16 tpot Exp $
- */
-
-#include "config.h"
-
-#include <stdio.h>
-#include <sys/stat.h>
-#ifdef HAVE_UTIME_H
-#include <utime.h>
-#endif
-#ifdef HAVE_DIRENT_H
-#include <dirent.h>
-#endif
-#ifdef HAVE_FCNTL_H
-#include <fcntl.h>
-#endif
-#include <errno.h>
-#include <string.h>
-
-#include <vfs.h>
-
-/* 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);
-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);
-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_fsync,
- skel_stat,
- skel_fstat,
- skel_lstat,
- 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, 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);
-}
-
-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_fsync(int fd)
-{
- default_vfs_ops.fsync(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);
-}
-
-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);
-}