New Feature Idea
REYNAUD Jean-Samuel
reynaud at nantes.inra.fr
Tue Jun 5 14:24:45 GMT 2001
Le 05 Jun 2001 14:30:47 +0100, Mayers, Philip J a écrit :
> You want to use the VFS really - the VFS module will be pluggable and it
> (the VFS) is intended for this kind of thing.
It would be something like (an adaptation from audit.c):
/*
* From Auditing VFS module for samba. Log selected file operations to
* syslog facility. Modify to an Network recycle Bin example.
*
* 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.
*/
#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 <includes.h>
#include <vfs.h>
/* Function prototypes */
int recycle_unlink(struct connection_struct *conn, char *path);
/* VFS operations */
extern struct vfs_ops default_vfs_ops; /* For passthrough operation */
struct vfs_ops recycle_ops = {
/* Disk operations */
NULL,
NULL,
NULL, /* disk free */
/* Directory operations */
NULL,
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, /* 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(int *vfs_version)
{
*vfs_version = SMB_VFS_INTERFACE_VERSION;
return(&recycle_ops);
}
int recycle_unlink(struct connection_struct *conn, char *path)
{
int result;
/*
Modifie the code to
Copy file to .recycle ...
*/
result = default_vfs_ops.unlink(conn, path); /* for example ...*/
return result;
}
--
REYNAUD Jean-Samuel
More information about the samba-technical
mailing list