summaryrefslogtreecommitdiff
path: root/source3/modules/vfs_smb_traffic_analyzer.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_smb_traffic_analyzer.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_smb_traffic_analyzer.c')
-rw-r--r--source3/modules/vfs_smb_traffic_analyzer.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/source3/modules/vfs_smb_traffic_analyzer.c b/source3/modules/vfs_smb_traffic_analyzer.c
index 08389f5d90..1eb02a2581 100644
--- a/source3/modules/vfs_smb_traffic_analyzer.c
+++ b/source3/modules/vfs_smb_traffic_analyzer.c
@@ -277,6 +277,11 @@ static int smb_traffic_analyzer_connect(struct vfs_handle_struct *handle,
uint16_t port = (st == UNIX_DOMAIN_SOCKET) ? 0 :
atoi( lp_parm_const_string(SNUM(conn),
"smb_traffic_analyzer", "port", "9430"));
+ int ret = SMB_VFS_NEXT_CONNECT(handle, service, user);
+
+ if (ret < 0) {
+ return ret;
+ }
/* Are we already connected ? */
for (rf_sock = sock_list; rf_sock; rf_sock = rf_sock->next) {
@@ -294,11 +299,13 @@ static int smb_traffic_analyzer_connect(struct vfs_handle_struct *handle,
/* New connection. */
rf_sock = TALLOC_ZERO_P(NULL, struct refcounted_sock);
if (rf_sock == NULL) {
+ SMB_VFS_NEXT_DISCONNECT(handle);
errno = ENOMEM;
return -1;
}
rf_sock->name = talloc_strdup(rf_sock, name);
if (rf_sock->name == NULL) {
+ SMB_VFS_NEXT_DISCONNECT(handle);
TALLOC_FREE(rf_sock);
errno = ENOMEM;
return -1;
@@ -316,6 +323,7 @@ static int smb_traffic_analyzer_connect(struct vfs_handle_struct *handle,
port);
}
if (rf_sock->sock == -1) {
+ SMB_VFS_NEXT_DISCONNECT(handle);
TALLOC_FREE(rf_sock);
return -1;
}
@@ -325,7 +333,7 @@ static int smb_traffic_analyzer_connect(struct vfs_handle_struct *handle,
/* Store the private data. */
SMB_VFS_HANDLE_SET_DATA(handle, rf_sock, smb_traffic_analyzer_free_data,
struct refcounted_sock, return -1);
- return SMB_VFS_NEXT_CONNECT(handle, service, user);
+ return 0;
}
/* VFS Functions: write, read, pread, pwrite for now */