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);
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' "
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 = {
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)
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
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));
g_readsz = 0;
}
- return SMB_VFS_NEXT_CONNECT(handle, service, user);
+ return 0;
}
static ssize_t cprime_sendfile(
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(
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));
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)
{
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;
}
} 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;
}
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)
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);
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)
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,
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,
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;
}
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 = {
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;
conn->vuid_cache.next_entry = 0;
}
- return SMB_VFS_NEXT_CONNECT(handle, service, user);
+ return 0;
} else {
- return 1;
+ return 0;
}
}
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)
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) {
/* 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;
port);
}
if (rf_sock->sock == -1) {
+ SMB_VFS_NEXT_DISCONNECT(handle);
TALLOC_FREE(rf_sock);
return -1;
}
/* 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 */
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;
/* 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,