[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Tue May 17 12:06:02 MDT 2011


The branch, master has been updated
       via  9d9d7a7 is_my_ipaddr() should recognise loopback addresses as ours.
       via  d25370f Don't evaluate the src argument to fstrcpy/fstrcat/nstrcpy/unstrcpy twice. Prevents side-effects when src is a function call.
       via  9dd5704 Remove duplicate definition of SMB_VFS_NEXT_STRICT_UNLOCK. Found by herb at samba.org
      from  fc79169 s3: conn->sconn in smbd_server_connection_read/write_handler

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


- Log -----------------------------------------------------------------
commit 9d9d7a7cfdcd437add3b0f1c2ec614184573c761
Author: Jeremy Allison <jra at samba.org>
Date:   Mon May 16 16:08:48 2011 -0700

    is_my_ipaddr() should recognise loopback addresses as ours.
    
    Autobuild-User: Jeremy Allison <jra at samba.org>
    Autobuild-Date: Tue May 17 20:05:42 CEST 2011 on sn-devel-104

commit d25370fb477dd733fae6c1ee1a67e32a78236779
Author: Jeremy Allison <jra at samba.org>
Date:   Mon May 16 15:47:49 2011 -0700

    Don't evaluate the src argument to fstrcpy/fstrcat/nstrcpy/unstrcpy twice. Prevents side-effects when src is a function call.

commit 9dd5704aba465520213068cc6c5dd54c41266cd6
Author: Jeremy Allison <jra at samba.org>
Date:   Mon May 16 15:39:01 2011 -0700

    Remove duplicate definition of SMB_VFS_NEXT_STRICT_UNLOCK. Found by herb at samba.org

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

Summary of changes:
 lib/util/string_wrappers.h   |   30 +++++++++++++++++++++++++-----
 source3/include/vfs_macros.h |    3 ---
 source3/lib/util_sock.c      |   10 +++++-----
 3 files changed, 30 insertions(+), 13 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/util/string_wrappers.h b/lib/util/string_wrappers.h
index 7baf3cb..37384fc 100644
--- a/lib/util/string_wrappers.h
+++ b/lib/util/string_wrappers.h
@@ -42,15 +42,35 @@ size_t __unsafe_string_function_usage_here_size_t__(void);
 #endif /* HAVE_COMPILER_WILL_OPTIMIZE_OUT_FNS */
 
 #define strlcpy_base(dest, src, base, size) \
-    strlcpy((dest), (src) ? (src) : "", (size)-PTR_DIFF((dest),(base)))
+do { \
+	const char *_strlcpy_base_src = (const char *)src; \
+	strlcpy((dest), _strlcpy_base_src? _strlcpy_base_src : "", (size)-PTR_DIFF((dest),(base))); \
+} while (0)
 
 /* String copy functions - macro hell below adds 'type checking' (limited,
    but the best we can do in C) */
 
-#define fstrcpy(d,s) strlcpy((d),(s) ? (s) : "",sizeof(fstring))
-#define fstrcat(d,s) strlcpy((d),(s) ? (s) : "",sizeof(fstring))
-#define nstrcpy(d,s) strlcpy((d), (s) ? (s) : "",sizeof(nstring))
-#define unstrcpy(d,s) strlcpy((d), (s) ? (s) : "",sizeof(unstring))
+#define fstrcpy(d,s) \
+do { \
+	const char *_fstrcpy_src = (const char *)(s); \
+	strlcpy((d),_fstrcpy_src ? _fstrcpy_src : "",sizeof(fstring)); \
+} while (0)
+
+#define fstrcat(d,s) \
+do { \
+	const char *_fstrcat_src = (const char *)(s); \
+	strlcat((d),_fstrcat_src ? _fstrcat_src : "",sizeof(fstring)); \
+} while (0)
+#define nstrcpy(d,s) \
+do { \
+	const char *_nstrcpy_src = (const char *)(s); \
+	strlcpy((d),_nstrcpy_src ? _nstrcpy_src : "",sizeof(fstring)); \
+} while (0)
+#define unstrcpy(d,s) \
+do { \
+	const char *_unstrcpy_src = (const char *)(s); \
+	strlcpy((d),_unstrcpy_src ? _unstrcpy_src : "",sizeof(fstring)); \
+} while (0)
 
 #ifdef HAVE_COMPILER_WILL_OPTIMIZE_OUT_FNS
 
diff --git a/source3/include/vfs_macros.h b/source3/include/vfs_macros.h
index d04be9b..4b1d1d2 100644
--- a/source3/include/vfs_macros.h
+++ b/source3/include/vfs_macros.h
@@ -364,9 +364,6 @@
 #define SMB_VFS_NEXT_TRANSLATE_NAME(handle, name, direction, mem_ctx, mapped_name) \
 	smb_vfs_call_translate_name((handle)->next, (name), (direction), (mem_ctx), (mapped_name))
 
-#define SMB_VFS_NEXT_STRICT_UNLOCK(handle, fsp, plock) \
-	smb_vfs_call_strict_unlock((handle)->next, (fsp), (plock))
-
 #define SMB_VFS_FGET_NT_ACL(fsp, security_info, ppdesc) \
 	smb_vfs_call_fget_nt_acl((fsp)->conn->vfs_handles, (fsp), (security_info), (ppdesc))
 #define SMB_VFS_NEXT_FGET_NT_ACL(handle, fsp, security_info, ppdesc) \
diff --git a/source3/lib/util_sock.c b/source3/lib/util_sock.c
index 371b8c0..5d20d74 100644
--- a/source3/lib/util_sock.c
+++ b/source3/lib/util_sock.c
@@ -1321,13 +1321,13 @@ static bool is_my_ipaddr(const char *ipaddr_str)
 		return false;
 	}
 
-	if (ismyaddr((struct sockaddr *)&ss)) {
-		return true;
+	if (is_zero_addr(&ss)) {
+		return false;
 	}
 
-	if (is_zero_addr(&ss) ||
-		is_loopback_addr((struct sockaddr *)&ss)) {
-		return false;
+	if (ismyaddr((struct sockaddr *)&ss) ||
+			is_loopback_addr((struct sockaddr *)&ss)) {
+		return true;
 	}
 
 	n = get_interfaces(talloc_tos(), &nics);


-- 
Samba Shared Repository


More information about the samba-cvs mailing list