summaryrefslogtreecommitdiff
path: root/source3/modules/vfs_tsmsm.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2009-11-30 15:53:04 -0800
committerJeremy Allison <jra@samba.org>2009-11-30 15:53:04 -0800
commit8303bc49a45d5bab0cdbd4f2d793088f600f715f (patch)
treede386a449efb20c1cbb4fc3a62a6e6bb588d4810 /source3/modules/vfs_tsmsm.c
parentb852a3494aa3af3d69175f68669609b23fefc1bb (diff)
downloadsamba-8303bc49a45d5bab0cdbd4f2d793088f600f715f.tar.gz
samba-8303bc49a45d5bab0cdbd4f2d793088f600f715f.tar.bz2
samba-8303bc49a45d5bab0cdbd4f2d793088f600f715f.zip
Restructure the connect function code to always call
down to NEXT-> before initializing. This allows us to do cleanup (by calling DISCONNECT) if initialization fails. Also fix vfs_acl_xattr which was failing to call the NEXT connect function. Jeremy.
Diffstat (limited to 'source3/modules/vfs_tsmsm.c')
-rw-r--r--source3/modules/vfs_tsmsm.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/source3/modules/vfs_tsmsm.c b/source3/modules/vfs_tsmsm.c
index 7c63b8c20e..12f79ff71e 100644
--- a/source3/modules/vfs_tsmsm.c
+++ b/source3/modules/vfs_tsmsm.c
@@ -87,16 +87,24 @@ static void tsmsm_free_data(void **pptr) {
static int tsmsm_connect(struct vfs_handle_struct *handle,
const char *service,
const char *user) {
- struct tsmsm_struct *tsmd = TALLOC_ZERO_P(handle, struct tsmsm_struct);
+ struct tsmsm_struct *tsmd;
const char *fres;
const char *tsmname;
-
+ int ret = SMB_VFS_NEXT_CONNECT(handle, service, user);
+
+ if (ret < 0) {
+ return ret;
+ }
+
+ tsmd = TALLOC_ZERO_P(handle, struct tsmsm_struct);
if (!tsmd) {
+ SMB_VFS_NEXT_DISCONNECT(handle);
DEBUG(0,("tsmsm_connect: out of memory!\n"));
return -1;
}
if (!dmapi_have_session()) {
+ SMB_VFS_NEXT_DISCONNECT(handle);
DEBUG(0,("tsmsm_connect: no DMAPI session for Samba is available!\n"));
TALLOC_FREE(tsmd);
return -1;
@@ -134,7 +142,7 @@ static int tsmsm_connect(struct vfs_handle_struct *handle,
/* Store the private data. */
SMB_VFS_HANDLE_SET_DATA(handle, tsmd, tsmsm_free_data,
struct tsmsm_struct, return -1);
- return SMB_VFS_NEXT_CONNECT(handle, service, user);
+ return 0;
}
static bool tsmsm_is_offline(struct vfs_handle_struct *handle,