summaryrefslogtreecommitdiff
path: root/source3/modules
diff options
context:
space:
mode:
Diffstat (limited to 'source3/modules')
-rw-r--r--source3/modules/vfs_acl_tdb.c9
-rw-r--r--source3/modules/vfs_acl_xattr.c6
-rw-r--r--source3/modules/vfs_afsacl.c11
-rw-r--r--source3/modules/vfs_audit.c11
-rw-r--r--source3/modules/vfs_cacheprime.c9
-rw-r--r--source3/modules/vfs_commit.c8
-rw-r--r--source3/modules/vfs_extd_audit.c10
-rw-r--r--source3/modules/vfs_fileid.c9
-rw-r--r--source3/modules/vfs_full_audit.c10
-rw-r--r--source3/modules/vfs_onefs.c9
-rw-r--r--source3/modules/vfs_prealloc.c10
-rw-r--r--source3/modules/vfs_readahead.c11
-rw-r--r--source3/modules/vfs_readonly.c9
-rw-r--r--source3/modules/vfs_recycle.c8
-rw-r--r--source3/modules/vfs_smb_traffic_analyzer.c10
-rw-r--r--source3/modules/vfs_tsmsm.c14
16 files changed, 117 insertions, 37 deletions
diff --git a/source3/modules/vfs_acl_tdb.c b/source3/modules/vfs_acl_tdb.c
index db3881e1e7..e9d0f9027a 100644
--- a/source3/modules/vfs_acl_tdb.c
+++ b/source3/modules/vfs_acl_tdb.c
@@ -367,12 +367,11 @@ static int connect_acl_tdb(struct vfs_handle_struct *handle,
const char *user)
{
struct db_context *db;
- int res;
+ int ret = SMB_VFS_NEXT_CONNECT(handle, service, user);
- res = SMB_VFS_NEXT_CONNECT(handle, service, user);
- if (res < 0) {
- return res;
- }
+ if (ret < 0) {
+ return ret;
+ }
if (!acl_tdb_init(&db)) {
SMB_VFS_NEXT_DISCONNECT(handle);
diff --git a/source3/modules/vfs_acl_xattr.c b/source3/modules/vfs_acl_xattr.c
index 962d1b7b09..5e51a68875 100644
--- a/source3/modules/vfs_acl_xattr.c
+++ b/source3/modules/vfs_acl_xattr.c
@@ -212,6 +212,12 @@ static int connect_acl_xattr(struct vfs_handle_struct *handle,
const char *service,
const char *user)
{
+ int ret = SMB_VFS_NEXT_CONNECT(handle, service, user);
+
+ if (ret < 0) {
+ return ret;
+ }
+
/* Ensure we have "inherit acls = yes" if we're
* using this module. */
DEBUG(2,("connect_acl_xattr: setting 'inherit acls = true' "
diff --git a/source3/modules/vfs_afsacl.c b/source3/modules/vfs_afsacl.c
index 4666be2aa3..82c1799129 100644
--- a/source3/modules/vfs_afsacl.c
+++ b/source3/modules/vfs_afsacl.c
@@ -1065,14 +1065,19 @@ static int afsacl_connect(vfs_handle_struct *handle,
const char *service,
const char *user)
{
- const char *spc;
+ const char *spc;
+ int ret = SMB_VFS_NEXT_CONNECT(handle, service, user);
+
+ if (ret < 0) {
+ return ret;
+ }
spc = lp_parm_const_string(SNUM(handle->conn), "afsacl", "space", "%");
if (spc != NULL)
space_replacement = spc[0];
-
- return SMB_VFS_NEXT_CONNECT(handle, service, user);
+
+ return 0;
}
static struct vfs_fn_pointers vfs_afsacl_fns = {
diff --git a/source3/modules/vfs_audit.c b/source3/modules/vfs_audit.c
index 258246e42d..d256c2f7da 100644
--- a/source3/modules/vfs_audit.c
+++ b/source3/modules/vfs_audit.c
@@ -78,15 +78,18 @@ static int audit_syslog_priority(vfs_handle_struct *handle)
static int audit_connect(vfs_handle_struct *handle, const char *svc, const char *user)
{
int result;
-
+
+ result = SMB_VFS_NEXT_CONNECT(handle, svc, user);
+ if (result < 0) {
+ return result;
+ }
+
openlog("smbd_audit", LOG_PID, audit_syslog_facility(handle));
syslog(audit_syslog_priority(handle), "connect to service %s by user %s\n",
svc, user);
- result = SMB_VFS_NEXT_CONNECT(handle, svc, user);
-
- return result;
+ return 0;
}
static void audit_disconnect(vfs_handle_struct *handle)
diff --git a/source3/modules/vfs_cacheprime.c b/source3/modules/vfs_cacheprime.c
index d107c5fc96..02cffbb703 100644
--- a/source3/modules/vfs_cacheprime.c
+++ b/source3/modules/vfs_cacheprime.c
@@ -89,6 +89,8 @@ static int cprime_connect(
const char * service,
const char * user)
{
+ int ret;
+
module_debug = lp_parm_int(SNUM(handle->conn), MODULE, "debug", 100);
if (g_readbuf) {
/* Only allocate g_readbuf once. If the config changes and
@@ -98,6 +100,11 @@ static int cprime_connect(
return SMB_VFS_NEXT_CONNECT(handle, service, user);
}
+ ret = SMB_VFS_NEXT_CONNECT(handle, service, user);
+ if (ret < 0) {
+ return ret;
+ }
+
g_readsz = conv_str_size(lp_parm_const_string(SNUM(handle->conn),
MODULE, "rsize", NULL));
@@ -118,7 +125,7 @@ static int cprime_connect(
g_readsz = 0;
}
- return SMB_VFS_NEXT_CONNECT(handle, service, user);
+ return 0;
}
static ssize_t cprime_sendfile(
diff --git a/source3/modules/vfs_commit.c b/source3/modules/vfs_commit.c
index b926112203..1d099494e9 100644
--- a/source3/modules/vfs_commit.c
+++ b/source3/modules/vfs_commit.c
@@ -162,8 +162,14 @@ static int commit_connect(
const char * service,
const char * user)
{
+ int ret = SMB_VFS_NEXT_CONNECT(handle, service, user);
+
+ if (ret < 0) {
+ return ret;
+ }
+
module_debug = lp_parm_int(SNUM(handle->conn), MODULE, "debug", 100);
- return SMB_VFS_NEXT_CONNECT(handle, service, user);
+ return 0;
}
static int commit_open(
diff --git a/source3/modules/vfs_extd_audit.c b/source3/modules/vfs_extd_audit.c
index c4a20f0bdd..80dece7edd 100644
--- a/source3/modules/vfs_extd_audit.c
+++ b/source3/modules/vfs_extd_audit.c
@@ -80,7 +80,11 @@ static int audit_syslog_priority(vfs_handle_struct *handle)
static int audit_connect(vfs_handle_struct *handle, const char *svc, const char *user)
{
- int result;
+ int result = SMB_VFS_NEXT_CONNECT(handle, svc, user);
+
+ if (result < 0) {
+ return result;
+ }
openlog("smbd_audit", LOG_PID, audit_syslog_facility(handle));
@@ -92,9 +96,7 @@ static int audit_connect(vfs_handle_struct *handle, const char *svc, const char
DEBUG(10, ("Connected to service %s as user %s\n",
svc, user));
- result = SMB_VFS_NEXT_CONNECT(handle, svc, user);
-
- return result;
+ return 0;
}
static void audit_disconnect(vfs_handle_struct *handle)
diff --git a/source3/modules/vfs_fileid.c b/source3/modules/vfs_fileid.c
index 133ad09cc3..559b520d1c 100644
--- a/source3/modules/vfs_fileid.c
+++ b/source3/modules/vfs_fileid.c
@@ -181,9 +181,15 @@ static int fileid_connect(struct vfs_handle_struct *handle,
{
struct fileid_handle_data *data;
const char *algorithm;
+ int ret = SMB_VFS_NEXT_CONNECT(handle, service, user);
+
+ if (ret < 0) {
+ return ret;
+ }
data = talloc_zero(handle->conn, struct fileid_handle_data);
if (!data) {
+ SMB_VFS_NEXT_DISCONNECT(handle);
DEBUG(0, ("talloc_zero() failed\n"));
return -1;
}
@@ -203,6 +209,7 @@ static int fileid_connect(struct vfs_handle_struct *handle,
} else if (strcmp("fsid", algorithm) == 0) {
data->device_mapping_fn = fileid_device_mapping_fsid;
} else {
+ SMB_VFS_NEXT_DISCONNECT(handle);
DEBUG(0,("fileid_connect(): unknown algorithm[%s]\n", algorithm));
return -1;
}
@@ -214,7 +221,7 @@ static int fileid_connect(struct vfs_handle_struct *handle,
DEBUG(10, ("fileid_connect(): connect to service[%s] with algorithm[%s]\n",
service, algorithm));
- return SMB_VFS_NEXT_CONNECT(handle, service, user);
+ return 0;
}
static void fileid_disconnect(struct vfs_handle_struct *handle)
diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c
index d9d12a1d28..19ac7adaed 100644
--- a/source3/modules/vfs_full_audit.c
+++ b/source3/modules/vfs_full_audit.c
@@ -606,12 +606,14 @@ static int smb_full_audit_connect(vfs_handle_struct *handle,
const char *none[] = { NULL };
const char *all [] = { "all" };
- if (!handle) {
- return -1;
+ result = SMB_VFS_NEXT_CONNECT(handle, svc, user);
+ if (result < 0) {
+ return result;
}
pd = SMB_MALLOC_P(struct vfs_full_audit_private_data);
if (!pd) {
+ SMB_VFS_NEXT_DISCONNECT(handle);
return -1;
}
ZERO_STRUCTP(pd);
@@ -631,12 +633,10 @@ static int smb_full_audit_connect(vfs_handle_struct *handle,
SMB_VFS_HANDLE_SET_DATA(handle, pd, free_private_data,
struct vfs_full_audit_private_data, return -1);
- result = SMB_VFS_NEXT_CONNECT(handle, svc, user);
-
do_log(SMB_VFS_OP_CONNECT, True, handle,
"%s", svc);
- return result;
+ return 0;
}
static void smb_full_audit_disconnect(vfs_handle_struct *handle)
diff --git a/source3/modules/vfs_onefs.c b/source3/modules/vfs_onefs.c
index 865eccdbf5..5f1b99292b 100644
--- a/source3/modules/vfs_onefs.c
+++ b/source3/modules/vfs_onefs.c
@@ -28,15 +28,20 @@
static int onefs_connect(struct vfs_handle_struct *handle, const char *service,
const char *user)
{
- int ret;
+ int ret = SMB_VFS_NEXT_CONNECT(handle, service, user);
+
+ if (ret < 0) {
+ return ret;
+ }
ret = onefs_load_config(handle->conn);
if (ret) {
+ SMB_VFS_NEXT_DISCONNECT(handle);
DEBUG(3, ("Load config failed: %s\n", strerror(errno)));
return ret;
}
- return SMB_VFS_NEXT_CONNECT(handle, service, user);
+ return 0;
}
static int onefs_mkdir(vfs_handle_struct *handle, const char *path,
diff --git a/source3/modules/vfs_prealloc.c b/source3/modules/vfs_prealloc.c
index c6333be23b..386de29071 100644
--- a/source3/modules/vfs_prealloc.c
+++ b/source3/modules/vfs_prealloc.c
@@ -101,10 +101,16 @@ static int prealloc_connect(
const char * service,
const char * user)
{
- module_debug = lp_parm_int(SNUM(handle->conn),
+ int ret = SMB_VFS_NEXT_CONNECT(handle, service, user);
+
+ if (ret < 0) {
+ return ret;
+ }
+
+ module_debug = lp_parm_int(SNUM(handle->conn),
MODULE, "debug", 100);
- return SMB_VFS_NEXT_CONNECT(handle, service, user);
+ return 0;
}
static int prealloc_open(vfs_handle_struct* handle,
diff --git a/source3/modules/vfs_readahead.c b/source3/modules/vfs_readahead.c
index 124230811d..e7a7dd305c 100644
--- a/source3/modules/vfs_readahead.c
+++ b/source3/modules/vfs_readahead.c
@@ -127,8 +127,15 @@ static int readahead_connect(struct vfs_handle_struct *handle,
const char *service,
const char *user)
{
- struct readahead_data *rhd = SMB_MALLOC_P(struct readahead_data);
+ struct readahead_data *rhd;
+ int ret = SMB_VFS_NEXT_CONNECT(handle, service, user);
+
+ if (ret < 0) {
+ return ret;
+ }
+ rhd = SMB_MALLOC_P(struct readahead_data);
if (!rhd) {
+ SMB_VFS_NEXT_DISCONNECT(handle);
DEBUG(0,("readahead_connect: out of memory\n"));
return -1;
}
@@ -152,7 +159,7 @@ static int readahead_connect(struct vfs_handle_struct *handle,
handle->data = (void *)rhd;
handle->free_data = free_readahead_data;
- return SMB_VFS_NEXT_CONNECT(handle, service, user);
+ return 0;
}
static struct vfs_fn_pointers vfs_readahead_fns = {
diff --git a/source3/modules/vfs_readonly.c b/source3/modules/vfs_readonly.c
index f736028168..afb167f045 100644
--- a/source3/modules/vfs_readonly.c
+++ b/source3/modules/vfs_readonly.c
@@ -62,6 +62,11 @@ static int readonly_connect(vfs_handle_struct *handle,
const char **period = lp_parm_string_list(SNUM(handle->conn),
(handle->param ? handle->param : MODULE_NAME),
"period", period_def);
+ int ret = SMB_VFS_NEXT_CONNECT(handle, service, user);
+
+ if (ret < 0) {
+ return ret;
+ }
if (period && period[0] && period[1]) {
int i;
@@ -85,11 +90,11 @@ static int readonly_connect(vfs_handle_struct *handle,
conn->vuid_cache.next_entry = 0;
}
- return SMB_VFS_NEXT_CONNECT(handle, service, user);
+ return 0;
} else {
- return 1;
+ return 0;
}
}
diff --git a/source3/modules/vfs_recycle.c b/source3/modules/vfs_recycle.c
index 0c019dbd70..667442732e 100644
--- a/source3/modules/vfs_recycle.c
+++ b/source3/modules/vfs_recycle.c
@@ -38,10 +38,16 @@ static int recycle_unlink(vfs_handle_struct *handle,
static int recycle_connect(vfs_handle_struct *handle, const char *service, const char *user)
{
+ int ret = SMB_VFS_NEXT_CONNECT(handle, service, user);
+
+ if (ret < 0) {
+ return ret;
+ }
+
DEBUG(10,("recycle_connect() connect to service[%s] as user[%s].\n",
service,user));
- return SMB_VFS_NEXT_CONNECT(handle, service, user);
+ return 0;
}
static void recycle_disconnect(vfs_handle_struct *handle)
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 */
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,