[SCM] Samba Shared Repository - branch master updated

Stefan Metzmacher metze at samba.org
Tue Apr 3 18:19:02 UTC 2018


The branch, master has been updated
       via  702665c s3:modules: fix the build of vfs_aixacl2.c
       via  666dda9 ldb/tests: avoid 'return void_function();' which isn't portable
       via  7ae77db lib/crypto: avoid 'return void_function();' which isn't portable
       via  74278a7 s3:modules: make virusfilter_io_connect_path() more portable
       via  fb7b67a s3:modules: fix the picky-developer build of vfs_virusfilter.c on FreeBSD 11
       via  dc16024 nsswitch: fix the developer build of nsswitch/wins.c on freebsd 11
       via  d5be3b3 nsswitch: add some const to _nss_winbind_initgroups_dyn() prototype
       via  b8c30ab nsswitch: maintain prototypes for the linux based functions only once
       via  329a229 lib/replace: define __[u]intptr_t_defined if we prove an replacement
       via  f2ff61c lib/util: remove unused '#include <sys/syscall.h>' from tests/tfork.c
      from  6b75d2c ctdb-scripts: Drop "net serverid wipe" from 50.samba event script

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 702665cc52d5dc05ae636519e1ffe9c296f5ef77
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Mar 21 07:48:16 2018 +0100

    s3:modules: fix the build of vfs_aixacl2.c
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13345
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Björn Jacke <bjacke at samba.org>
    
    Autobuild-User(master): Stefan Metzmacher <metze at samba.org>
    Autobuild-Date(master): Tue Apr  3 20:18:58 CEST 2018 on sn-devel-144

commit 666dda907b7f190b2dff1f2639bd2518240b9fb2
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Mar 21 07:33:16 2018 +0100

    ldb/tests: avoid 'return void_function();' which isn't portable
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13343
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Björn Jacke <bjacke at samba.org>

commit 7ae77db3b29ef08e1f74aa413049b995a598a5dd
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Mar 21 07:33:16 2018 +0100

    lib/crypto: avoid 'return void_function();' which isn't portable
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13343
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Björn Jacke <bjacke at samba.org>

commit 74278a70389e2479d80ec5c88b01a09c141e8d39
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Mar 21 07:25:11 2018 +0100

    s3:modules: make virusfilter_io_connect_path() more portable
    
    We have existing utility functions to prepare a socket.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13343
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Björn Jacke <bjacke at samba.org>

commit fb7b67af984812784756574df4f0fb55d472181b
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Mar 20 12:10:01 2018 +0100

    s3:modules: fix the picky-developer build of vfs_virusfilter.c on FreeBSD 11
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13344
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Björn Jacke <bjacke at samba.org>

commit dc160247d13e2c63574a7e7ec7720fc4c690483b
Author: Stefan Metzmacher <metze at samba.org>
Date:   Sat Oct 21 14:15:12 2017 +0200

    nsswitch: fix the developer build of nsswitch/wins.c on freebsd 11
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13344
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Björn Jacke <bjacke at samba.org>

commit d5be3b3279162005d9ebea2eda71d455e4c48739
Author: Stefan Metzmacher <metze at samba.org>
Date:   Sat Oct 21 14:14:34 2017 +0200

    nsswitch: add some const to _nss_winbind_initgroups_dyn() prototype
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13344
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Björn Jacke <bjacke at samba.org>

commit b8c30abb02f461f16af4da83eecd173993974dc1
Author: Stefan Metzmacher <metze at samba.org>
Date:   Sat Oct 21 14:08:15 2017 +0200

    nsswitch: maintain prototypes for the linux based functions only once
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13344
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Björn Jacke <bjacke at samba.org>

commit 329a229af3c3c9475b9254ca68c413ec18fa3b71
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Mar 20 21:46:12 2018 +0100

    lib/replace: define __[u]intptr_t_defined if we prove an replacement
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13344
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Björn Jacke <bjacke at samba.org>

commit f2ff61ce9e8ab56d8a69fce29c9f214d5d98f89e
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Mar 20 16:49:30 2018 +0100

    lib/util: remove unused '#include <sys/syscall.h>' from tests/tfork.c
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13342
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 lib/crypto/aes.c                        | 10 ++++++----
 lib/ldb/tests/ldb_mod_op_test.c         |  8 ++++----
 lib/replace/replace.h                   |  2 ++
 lib/util/tests/tfork.c                  |  1 -
 nsswitch/winbind_nss.h                  |  6 ++++++
 nsswitch/winbind_nss_freebsd.c          | 19 -------------------
 nsswitch/winbind_nss_linux.c            | 24 +-----------------------
 nsswitch/winbind_nss_linux.h            | 24 +++++++++++++++++++++---
 nsswitch/winbind_nss_netbsd.c           | 26 --------------------------
 nsswitch/winbind_nss_solaris.h          | 26 --------------------------
 nsswitch/wins.c                         |  2 +-
 source3/modules/vfs_aixacl2.c           |  5 +++--
 source3/modules/vfs_virusfilter.c       |  5 +++--
 source3/modules/vfs_virusfilter_utils.c | 31 ++++++++++++++++---------------
 14 files changed, 63 insertions(+), 126 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/crypto/aes.c b/lib/crypto/aes.c
index d16d715..4ff019a 100644
--- a/lib/crypto/aes.c
+++ b/lib/crypto/aes.c
@@ -236,18 +236,20 @@ void
 AES_encrypt(const unsigned char *in, unsigned char *out, const AES_KEY *key)
 {
 	if (has_intel_aes_instructions()) {
-		return AES_encrypt_aesni(in, out, key);
+		AES_encrypt_aesni(in, out, key);
+		return;
 	}
-	return AES_encrypt_rj(in, out, key);
+	AES_encrypt_rj(in, out, key);
 }
 
 void
 AES_decrypt(const unsigned char *in, unsigned char *out, const AES_KEY *key)
 {
 	if (has_intel_aes_instructions()) {
-		return AES_decrypt_aesni(in, out, key);
+		AES_decrypt_aesni(in, out, key);
+		return;
 	}
-	return AES_decrypt_rj(in, out, key);
+	AES_decrypt_rj(in, out, key);
 }
 
 #endif /* SAMBA_RIJNDAEL */
diff --git a/lib/ldb/tests/ldb_mod_op_test.c b/lib/ldb/tests/ldb_mod_op_test.c
index b911302..d024ab6 100644
--- a/lib/ldb/tests/ldb_mod_op_test.c
+++ b/lib/ldb/tests/ldb_mod_op_test.c
@@ -1954,22 +1954,22 @@ static void test_ldb_modify_during_search(void **state, bool add_index,
 
 static void test_ldb_modify_during_indexed_search(void **state)
 {
-	return test_ldb_modify_during_search(state, true, false);
+	test_ldb_modify_during_search(state, true, false);
 }
 
 static void test_ldb_modify_during_unindexed_search(void **state)
 {
-	return test_ldb_modify_during_search(state, false, false);
+	test_ldb_modify_during_search(state, false, false);
 }
 
 static void test_ldb_rename_during_indexed_search(void **state)
 {
-	return test_ldb_modify_during_search(state, true, true);
+	test_ldb_modify_during_search(state, true, true);
 }
 
 static void test_ldb_rename_during_unindexed_search(void **state)
 {
-	return test_ldb_modify_during_search(state, false, true);
+	test_ldb_modify_during_search(state, false, true);
 }
 
 /*
diff --git a/lib/replace/replace.h b/lib/replace/replace.h
index e2a5541..626d305 100644
--- a/lib/replace/replace.h
+++ b/lib/replace/replace.h
@@ -691,10 +691,12 @@ typedef int bool;
 
 #if !defined(HAVE_INTPTR_T)
 typedef long long intptr_t ;
+#define __intptr_t_defined
 #endif
 
 #if !defined(HAVE_UINTPTR_T)
 typedef unsigned long long uintptr_t ;
+#define __uintptr_t_defined
 #endif
 
 #if !defined(HAVE_PTRDIFF_T)
diff --git a/lib/util/tests/tfork.c b/lib/util/tests/tfork.c
index bf642fe..9bcdc2f 100644
--- a/lib/util/tests/tfork.c
+++ b/lib/util/tests/tfork.c
@@ -32,7 +32,6 @@
 #include "lib/util/sys_rw.h"
 #ifdef HAVE_PTHREAD
 #include <pthread.h>
-#include <sys/syscall.h>
 #endif
 
 static bool test_tfork_simple(struct torture_context *tctx)
diff --git a/nsswitch/winbind_nss.h b/nsswitch/winbind_nss.h
index 05e07ad..e98a961 100644
--- a/nsswitch/winbind_nss.h
+++ b/nsswitch/winbind_nss.h
@@ -30,6 +30,7 @@
  */
 
 #include "nsswitch/winbind_nss_solaris.h"
+#include "nsswitch/winbind_nss_linux.h"
 
 #elif HAVE_NSS_H
 
@@ -37,6 +38,10 @@
  * Linux (glibc)
  */
 
+#include <nss.h>
+
+typedef enum nss_status NSS_STATUS;
+
 #include "nsswitch/winbind_nss_linux.h"
 
 #elif HAVE_NS_API_H
@@ -60,6 +65,7 @@
  */
 
 #include "nsswitch/winbind_nss_netbsd.h"
+#include "nsswitch/winbind_nss_linux.h"
 
 #else /* Nothing's defined. Neither gnu nor netbsd nor sun nor hp */
 
diff --git a/nsswitch/winbind_nss_freebsd.c b/nsswitch/winbind_nss_freebsd.c
index e283872..f424adb 100644
--- a/nsswitch/winbind_nss_freebsd.c
+++ b/nsswitch/winbind_nss_freebsd.c
@@ -24,25 +24,6 @@
 #include "winbind_client.h"
 
 /* Make sure that the module gets registered needed by freebsd 5.1 */
-extern enum nss_status _nss_winbind_getgrent_r(struct group *, char *, size_t,
-    int *);
-extern enum nss_status _nss_winbind_getgrnam_r(const char *, struct group *,
-    char *, size_t, int *);
-extern enum nss_status _nss_winbind_getgrgid_r(gid_t gid, struct group *, char *,
-    size_t, int *);
-extern enum nss_status _nss_winbind_setgrent(void);
-extern enum nss_status _nss_winbind_endgrent(void);
-extern enum nss_status _nss_winbind_initgroups_dyn(char *, gid_t, long int *,
-    long int *, gid_t **, long int , int *);
-
-extern enum nss_status _nss_winbind_getpwent_r(struct passwd *, char *, size_t,
-    int *);
-extern enum nss_status _nss_winbind_getpwnam_r(const char *, struct passwd *,
-    char *, size_t, int *);
-extern enum nss_status _nss_winbind_getpwuid_r(gid_t gid, struct passwd *, char *,
-    size_t, int *);
-extern enum nss_status _nss_winbind_setpwent(void);
-extern enum nss_status _nss_winbind_endpwent(void);
 ns_mtab *nss_module_register(const char *, unsigned int *, nss_module_unregister_fn *);
 
 NSS_METHOD_PROTOTYPE(__nss_compat_getgrnam_r);
diff --git a/nsswitch/winbind_nss_linux.c b/nsswitch/winbind_nss_linux.c
index b5c50ef..442c06e 100644
--- a/nsswitch/winbind_nss_linux.c
+++ b/nsswitch/winbind_nss_linux.c
@@ -36,28 +36,6 @@ static pthread_mutex_t winbind_nss_mutex = PTHREAD_MUTEX_INITIALIZER;
 #define MAX_GETPWENT_USERS 250
 #define MAX_GETGRENT_USERS 250
 
-NSS_STATUS _nss_winbind_setpwent(void);
-NSS_STATUS _nss_winbind_endpwent(void);
-NSS_STATUS _nss_winbind_getpwent_r(struct passwd *result, char *buffer,
-				   size_t buflen, int *errnop);
-NSS_STATUS _nss_winbind_getpwuid_r(uid_t uid, struct passwd *result,
-				   char *buffer, size_t buflen, int *errnop);
-NSS_STATUS _nss_winbind_getpwnam_r(const char *name, struct passwd *result,
-				   char *buffer, size_t buflen, int *errnop);
-NSS_STATUS _nss_winbind_setgrent(void);
-NSS_STATUS _nss_winbind_endgrent(void);
-NSS_STATUS _nss_winbind_getgrent_r(struct group *result, char *buffer,
-				   size_t buflen, int *errnop);
-NSS_STATUS _nss_winbind_getgrlst_r(struct group *result, char *buffer,
-				   size_t buflen, int *errnop);
-NSS_STATUS _nss_winbind_getgrnam_r(const char *name, struct group *result,
-				   char *buffer, size_t buflen, int *errnop);
-NSS_STATUS _nss_winbind_getgrgid_r(gid_t gid, struct group *result, char *buffer,
-				   size_t buflen, int *errnop);
-NSS_STATUS _nss_winbind_initgroups_dyn(char *user, gid_t group, long int *start,
-				       long int *size, gid_t **groups,
-				       long int limit, int *errnop);
-
 /*************************************************************************
  ************************************************************************/
 
@@ -1046,7 +1024,7 @@ _nss_winbind_getgrgid_r(gid_t gid,
 /* Initialise supplementary groups */
 
 NSS_STATUS
-_nss_winbind_initgroups_dyn(char *user, gid_t group, long int *start,
+_nss_winbind_initgroups_dyn(const char *user, gid_t group, long int *start,
 			    long int *size, gid_t **groups, long int limit,
 			    int *errnop)
 {
diff --git a/nsswitch/winbind_nss_linux.h b/nsswitch/winbind_nss_linux.h
index db5a378..d18799e 100644
--- a/nsswitch/winbind_nss_linux.h
+++ b/nsswitch/winbind_nss_linux.h
@@ -22,8 +22,26 @@
 #ifndef _WINBIND_NSS_LINUX_H
 #define _WINBIND_NSS_LINUX_H
 
-#include <nss.h>
-
-typedef enum nss_status NSS_STATUS;
+NSS_STATUS _nss_winbind_setpwent(void);
+NSS_STATUS _nss_winbind_endpwent(void);
+NSS_STATUS _nss_winbind_getpwent_r(struct passwd *result, char *buffer,
+				   size_t buflen, int *errnop);
+NSS_STATUS _nss_winbind_getpwuid_r(uid_t uid, struct passwd *result,
+				   char *buffer, size_t buflen, int *errnop);
+NSS_STATUS _nss_winbind_getpwnam_r(const char *name, struct passwd *result,
+				   char *buffer, size_t buflen, int *errnop);
+NSS_STATUS _nss_winbind_setgrent(void);
+NSS_STATUS _nss_winbind_endgrent(void);
+NSS_STATUS _nss_winbind_getgrent_r(struct group *result, char *buffer,
+				   size_t buflen, int *errnop);
+NSS_STATUS _nss_winbind_getgrlst_r(struct group *result, char *buffer,
+				   size_t buflen, int *errnop);
+NSS_STATUS _nss_winbind_getgrnam_r(const char *name, struct group *result,
+				   char *buffer, size_t buflen, int *errnop);
+NSS_STATUS _nss_winbind_getgrgid_r(gid_t gid, struct group *result, char *buffer,
+				   size_t buflen, int *errnop);
+NSS_STATUS _nss_winbind_initgroups_dyn(const char *user, gid_t group, long int *start,
+				       long int *size, gid_t **groups,
+				       long int limit, int *errnop);
 
 #endif /* _WINBIND_NSS_LINUX_H */
diff --git a/nsswitch/winbind_nss_netbsd.c b/nsswitch/winbind_nss_netbsd.c
index d3a558c..4edf64c 100644
--- a/nsswitch/winbind_nss_netbsd.c
+++ b/nsswitch/winbind_nss_netbsd.c
@@ -38,32 +38,6 @@
 static struct group	_winbind_group;
 static char		_winbind_groupbuf[1024];
 
-/*
- * We need a proper prototype for this :-)
- */
-
-NSS_STATUS _nss_winbind_setpwent(void);
-NSS_STATUS _nss_winbind_endpwent(void);
-NSS_STATUS _nss_winbind_getpwent_r(struct passwd *result, char *buffer,
-				   size_t buflen, int *errnop);
-NSS_STATUS _nss_winbind_getpwuid_r(uid_t uid, struct passwd *result,
-				   char *buffer, size_t buflen, int *errnop);
-NSS_STATUS _nss_winbind_getpwnam_r(const char *name, struct passwd *result,
-				   char *buffer, size_t buflen, int *errnop);
-NSS_STATUS _nss_winbind_setgrent(void);
-NSS_STATUS _nss_winbind_endgrent(void);
-NSS_STATUS _nss_winbind_getgrent_r(struct group *result, char *buffer,
-				   size_t buflen, int *errnop);
-NSS_STATUS _nss_winbind_getgrlst_r(struct group *result, char *buffer,
-				   size_t buflen, int *errnop);
-NSS_STATUS _nss_winbind_getgrnam_r(const char *name, struct group *result,
-				   char *buffer, size_t buflen, int *errnop);
-NSS_STATUS _nss_winbind_getgrgid_r(gid_t gid, struct group *result, char *buffer,
-				   size_t buflen, int *errnop);
-NSS_STATUS _nss_winbind_initgroups_dyn(char *user, gid_t group, long int *start,
-				       long int *size, gid_t **groups,
-				       long int limit, int *errnop);
-
 int
 netbsdwinbind_endgrent(void *nsrv, void *nscb, va_list ap)
 {
diff --git a/nsswitch/winbind_nss_solaris.h b/nsswitch/winbind_nss_solaris.h
index f0cc099..8e26d0d 100644
--- a/nsswitch/winbind_nss_solaris.h
+++ b/nsswitch/winbind_nss_solaris.h
@@ -34,30 +34,4 @@ typedef nss_status_t NSS_STATUS;
 #define NSS_STATUS_UNAVAIL     NSS_UNAVAIL
 #define NSS_STATUS_TRYAGAIN    NSS_TRYAGAIN
 
-/* The solaris winbind is implemented as a wrapper around the linux
-   version. */
-
-NSS_STATUS _nss_winbind_setpwent(void);
-NSS_STATUS _nss_winbind_endpwent(void);
-NSS_STATUS _nss_winbind_getpwent_r(struct passwd* result, char* buffer,
-				   size_t buflen, int* errnop);
-NSS_STATUS _nss_winbind_getpwuid_r(uid_t, struct passwd*, char* buffer,
-				   size_t buflen, int* errnop);
-NSS_STATUS _nss_winbind_getpwnam_r(const char* name, struct passwd* result,
-				   char* buffer, size_t buflen, int* errnop);
-
-NSS_STATUS _nss_winbind_setgrent(void);
-NSS_STATUS _nss_winbind_endgrent(void);
-NSS_STATUS _nss_winbind_getgrent_r(struct group* result, char* buffer,
-				   size_t buflen, int* errnop);
-NSS_STATUS _nss_winbind_getgrnam_r(const char *name,
-				   struct group *result, char *buffer,
-				   size_t buflen, int *errnop);
-NSS_STATUS _nss_winbind_getgrgid_r(gid_t gid,
-				   struct group *result, char *buffer,
-				   size_t buflen, int *errnop);
-NSS_STATUS _nss_winbind_initgroups_dyn(char *user, gid_t group, long int *start,
-				       long int *size, gid_t **groups,
-				       long int limit, int *errnop);
-
 #endif /* _WINBIND_NSS_SOLARIS_H */
diff --git a/nsswitch/wins.c b/nsswitch/wins.c
index 19d3c5b..72055f0 100644
--- a/nsswitch/wins.c
+++ b/nsswitch/wins.c
@@ -19,7 +19,7 @@
 */
 
 #include "includes.h"
-#include "nsswitch/winbind_nss.h"
+#include "nsswitch/winbind_client.h"
 #include "nsswitch/libwbclient/wbclient.h"
 
 #ifdef HAVE_NS_API_H
diff --git a/source3/modules/vfs_aixacl2.c b/source3/modules/vfs_aixacl2.c
index d0cd2c1..e094be1 100644
--- a/source3/modules/vfs_aixacl2.c
+++ b/source3/modules/vfs_aixacl2.c
@@ -476,7 +476,8 @@ int aixjfs2_sys_acl_set_file(vfs_handle_struct *handle,
 	acl_type_t	acl_type_info;
 	int	rc;
 
-	DEBUG(10, ("aixjfs2_sys_acl_set_file invoked for %s", name));
+	DEBUG(10, ("aixjfs2_sys_acl_set_file invoked for %s",
+		   smb_fname->base_name));
 
 	rc = aixjfs2_query_acl_support((char *)smb_fname->base_name,
 			ACL_AIXC, &acl_type_info);
@@ -490,7 +491,7 @@ int aixjfs2_sys_acl_set_file(vfs_handle_struct *handle,
 		return -1;
 
 	rc = aclx_put(
-		(char *)name,
+		(char *)smb_fname->base_name,
 		SET_ACL, /* set only the ACL, not mode bits */
 		acl_type_info,
 		acl_aixc,
diff --git a/source3/modules/vfs_virusfilter.c b/source3/modules/vfs_virusfilter.c
index ef9dc78..0b4bc72 100644
--- a/source3/modules/vfs_virusfilter.c
+++ b/source3/modules/vfs_virusfilter.c
@@ -275,8 +275,9 @@ static int virusfilter_vfs_connect(
 	temp_quarantine_dir_mode = lp_parm_const_string(
 		snum, "virusfilter", "quarantine directory mode", "0755");
 	if (temp_quarantine_dir_mode != NULL) {
-		sscanf(temp_quarantine_dir_mode, "%o",
-		       &config->quarantine_dir_mode);
+		unsigned int mode = 0;
+		sscanf(temp_quarantine_dir_mode, "%o", &mode);
+		config->quarantine_dir_mode = mode;
 	}
 
 	config->quarantine_prefix = lp_parm_const_string(
diff --git a/source3/modules/vfs_virusfilter_utils.c b/source3/modules/vfs_virusfilter_utils.c
index 90ae427..f56fc6e 100644
--- a/source3/modules/vfs_virusfilter_utils.c
+++ b/source3/modules/vfs_virusfilter_utils.c
@@ -147,8 +147,9 @@ bool virusfilter_io_connect_path(
 {
 	struct sockaddr_un addr;
 	NTSTATUS status;
-	int socket, bes_result, flags, ret;
+	int socket, ret;
 	size_t len;
+	bool ok;
 
 	ZERO_STRUCT(addr);
 	addr.sun_family = AF_UNIX;
@@ -168,23 +169,23 @@ bool virusfilter_io_connect_path(
 	}
 
 	/* We must not block */
-	flags = fcntl(socket, F_GETFL);
-	if (flags <= 0) {
-		/* Handle error by ignoring */;
-		flags = 0;
-		DBG_WARNING("Could not get flags on socket (%s).\n",
-			    strerror(errno));
-	}
-	flags |= SOCK_NONBLOCK;
-	ret = fcntl(socket, F_SETFL, flags);
+	ret = set_blocking(socket, false);
 	if (ret == -1) {
-		/* Handle error by ignoring for now */
-		DBG_WARNING("Could not set flags on socket: %s.\n",
-			    strerror(errno));
+		close(socket);
+		io_h->stream = NULL;
+		return false;
 	}
 
-	bes_result = tstream_bsd_existing_socket(io_h, socket, &io_h->stream);
-	if (bes_result < 0) {
+	ok = smb_set_close_on_exec(socket);
+	if (!ok) {
+		close(socket);
+		io_h->stream = NULL;
+		return false;
+	}
+
+	ret = tstream_bsd_existing_socket(io_h, socket, &io_h->stream);
+	if (ret == -1) {
+		close(socket);
 		DBG_ERR("Could not convert socket to tstream: %s.\n",
 			strerror(errno));
 		io_h->stream = NULL;


-- 
Samba Shared Repository



More information about the samba-cvs mailing list