diff options
author | Jeremy Allison <jra@samba.org> | 2000-11-06 21:44:33 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2000-11-06 21:44:33 +0000 |
commit | d0fbb4f5d999abade8930cc6fff231a2af6cccfb (patch) | |
tree | bc6e5b10e6230c48e53c2d9b1e935647737ab1b2 | |
parent | b29ff816734c0424f69124feb316da13f2e094f7 (diff) | |
download | samba-d0fbb4f5d999abade8930cc6fff231a2af6cccfb.tar.gz samba-d0fbb4f5d999abade8930cc6fff231a2af6cccfb.tar.xz samba-d0fbb4f5d999abade8930cc6fff231a2af6cccfb.zip |
Added a VFS version return to init call. Allows smbd to fail an init if
versions don't match.
Jeremy.
-rw-r--r-- | source/include/vfs.h | 8 | ||||
-rw-r--r-- | source/smbd/service.c | 2 | ||||
-rw-r--r-- | source/smbd/vfs.c | 22 |
3 files changed, 24 insertions, 8 deletions
diff --git a/source/include/vfs.h b/source/include/vfs.h index 3624311c301..3696178a751 100644 --- a/source/include/vfs.h +++ b/source/include/vfs.h @@ -33,6 +33,14 @@ * structs in the vfs - then anyone writing a vfs must include includes.h... */ +/* + * This next constant specifies the version number of the VFS interface + * this smbd will load. Increment this if *ANY* changes are made to the + * vfs_ops below. JRA. + */ + +#define SMB_VFS_INTERFACE_VERSION 1 + /* VFS operations structure */ struct connection_struct; diff --git a/source/smbd/service.c b/source/smbd/service.c index b86f3beadda..fcdd9a376bf 100644 --- a/source/smbd/service.c +++ b/source/smbd/service.c @@ -485,6 +485,8 @@ connection_struct *make_connection(char *service,char *user,char *password, int /* Loadable object file */ if (!vfs_init_custom(conn)) { + DEBUG(0, ("vfs_init failed\n")); + conn_free(conn); return NULL; } #else diff --git a/source/smbd/vfs.c b/source/smbd/vfs.c index 2f984aee4f3..99c8e26fa85 100644 --- a/source/smbd/vfs.c +++ b/source/smbd/vfs.c @@ -94,7 +94,8 @@ int vfs_init_default(connection_struct *conn) #ifdef HAVE_LIBDL BOOL vfs_init_custom(connection_struct *conn) { - struct vfs_ops *ops, *(*fptr)(struct vfs_options *options); + int vfs_version = -1; + struct vfs_ops *ops, *(*init_fptr)(int *); DEBUG(3, ("Initialising custom vfs hooks from %s\n", lp_vfsobj(SNUM(conn)))); @@ -108,22 +109,27 @@ BOOL vfs_init_custom(connection_struct *conn) /* Get handle on vfs_init() symbol */ - fptr = (struct vfs_ops *(*)(struct vfs_options *)) - dlsym(conn->dl_handle, "vfs_init"); + init_fptr = (struct vfs_ops *(*)(int *))dlsym(conn->dl_handle, "vfs_init"); - if (fptr == NULL) { - DEBUG(0, ("No vfs_init() symbol found in %s\n", + if (init_fptr == NULL) { + DEBUG(0, ("No vfs_init() symbol found in %s\n", lp_vfsobj(SNUM(conn)))); - return False; + return False; } /* Initialise vfs_ops structure */ - if ((ops = fptr(NULL)) == NULL) { + if ((ops = init_fptr(&vfs_version)) == NULL) { DEBUG(0, ("vfs_init function from %s failed\n", lp_vfsobj(SNUM(conn)))); - return False; + return False; } + if (vfs_version != SMB_VFS_INTERFACE_VERSION) { + DEBUG(0, ("vfs_init returned wrong interface version info (was %d, should be %d)\n", + vfs_version, SMB_VFS_INTERFACE_VERSION )); + return False; + } + /* Fill in unused operations with default (disk based) ones. There's probably a neater way to do this then a whole bunch of if statements. */ |