The branch, master has been updated
       via  98750aa swrap: Update version to 1.0.2.
       via  a05728d swrap: Fall back to RTLD_NEXT if we can't find libc.
       via  b003f1a Fix some typos.
       via  b08c50b swrap: Use the loaded libc open() directly.
       via  1f8fe83 swrap: Do not leak memory in swrap_recvmsg_after().
      from  0ba276e wafsamba: If perl can't provide defaults, define them.

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


- Log -----------------------------------------------------------------
commit 98750aae96ac0fbec767aafc5e274a06d1391fa4
Author: Andreas Schneider <[email protected]>
Date:   Thu May 8 14:07:36 2014 +0200

    swrap: Update version to 1.0.2.
    
    This makes sure we require version 1.0.2 of the system library.
    
    Signed-off-by: Andreas Schneider <[email protected]>
    Reviewed-by: Volker Lendecke <[email protected]>
    
    Autobuild-User(master): Andreas Schneider <[email protected]>
    Autobuild-Date(master): Fri May  9 11:36:55 CEST 2014 on sn-devel-104

commit a05728df56c3bc8e07ac3e8b59309adc0e4fa33c
Author: Andreas Schneider <[email protected]>
Date:   Thu May 8 14:07:16 2014 +0200

    swrap: Fall back to RTLD_NEXT if we can't find libc.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=10572
    
    Signed-off-by: Andreas Schneider <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit b003f1a453750d69b2f5d166fd865fda4463c79a
Author: Jakub Wilk <[email protected]>
Date:   Thu May 8 15:30:09 2014 +0200

    Fix some typos.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=10566
    
    Reviewed-by: Andreas Schneider <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit b08c50b1da2c2ec3f41cc89cd9bdcf8f077a4205
Author: Andreas Schneider <[email protected]>
Date:   Thu May 8 14:05:30 2014 +0200

    swrap: Use the loaded libc open() directly.
    
    Signed-off-by: Andreas Schneider <[email protected]>
    Reviewed-by: Michael Adam <[email protected]>

commit 1f8fe835b51773dc2236c428d2cde905127e4b09
Author: Andreas Schneider <[email protected]>
Date:   Thu May 8 14:04:11 2014 +0200

    swrap: Do not leak memory in swrap_recvmsg_after().
    
    Signed-off-by: Andreas Schneider <[email protected]>
    Reviewed-by: Jakub Hrozek <[email protected]>
    Reviewed-by: Simo Sorce <[email protected]>

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

Summary of changes:
 lib/socket_wrapper/socket_wrapper.c |   39 +++++++++++++++++++++++-----------
 lib/socket_wrapper/wscript          |    2 +-
 2 files changed, 27 insertions(+), 14 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/socket_wrapper/socket_wrapper.c 
b/lib/socket_wrapper/socket_wrapper.c
index c5b1fdf..95643aa 100644
--- a/lib/socket_wrapper/socket_wrapper.c
+++ b/lib/socket_wrapper/socket_wrapper.c
@@ -393,10 +393,6 @@ static void *swrap_load_lib_handle(enum swrap_lib lib)
        void *handle = NULL;
        int i;
 
-#ifdef HAVE_APPLE
-       return RTLD_NEXT;
-#endif
-
 #ifdef RTLD_DEEPBIND
        flags |= RTLD_DEEPBIND;
 #endif
@@ -436,10 +432,14 @@ static void *swrap_load_lib_handle(enum swrap_lib lib)
        }
 
        if (handle == NULL) {
+#ifdef RTLD_NEXT
+               handle = swrap.libc_handle = swrap.libsocket_handle = RTLD_NEXT;
+#else
                SWRAP_LOG(SWRAP_LOG_ERROR,
                          "Failed to dlopen library: %s\n",
                          dlerror());
                exit(-1);
+#endif
        }
 
        return handle;
@@ -476,7 +476,7 @@ static void *_swrap_load_lib_function(enum swrap_lib lib, 
const char *fn_name)
 /*
  * IMPORTANT
  *
- * Functions expeciall from libc need to be loaded individually, you can't load
+ * Functions especially from libc need to be loaded individually, you can't 
load
  * all at once or gdb will segfault at startup. The same applies to valgrind 
and
  * has probably something todo with with the linker.
  * So we need load each function at the point it is called the first time.
@@ -608,6 +608,18 @@ static int libc_vopen(const char *pathname, int flags, 
va_list ap)
        return fd;
 }
 
+static int libc_open(const char *pathname, int flags, ...)
+{
+       va_list ap;
+       int fd;
+
+       va_start(ap, flags);
+       fd = libc_vopen(pathname, flags, ap);
+       va_end(ap);
+
+       return fd;
+}
+
 static int libc_pipe(int pipefd[2])
 {
        swrap_load_lib_function(SWRAP_LIBSOCKET, pipe);
@@ -1589,7 +1601,7 @@ static uint8_t *swrap_packet_init(struct timeval *tval,
                ip->v4.tos              = 0x00;
                ip->v4.packet_length    = htons(wire_len - icmp_truncate_len);
                ip->v4.identification   = htons(0xFFFF);
-               ip->v4.flags            = 0x40; /* BIT 1 set - means don't 
fraqment */
+               ip->v4.flags            = 0x40; /* BIT 1 set - means don't 
fragment */
                ip->v4.fragment         = htons(0x0000);
                ip->v4.ttl              = 0xFF;
                ip->v4.protocol         = protocol;
@@ -1628,7 +1640,7 @@ static uint8_t *swrap_packet_init(struct timeval *tval,
                        ip->v4.tos              = 0x00;
                        ip->v4.packet_length    = htons(wire_len - 
icmp_hdr_len);
                        ip->v4.identification   = htons(0xFFFF);
-                       ip->v4.flags            = 0x40; /* BIT 1 set - means 
don't fraqment */
+                       ip->v4.flags            = 0x40; /* BIT 1 set - means 
don't fragment */
                        ip->v4.fragment         = htons(0x0000);
                        ip->v4.ttl              = 0xFF;
                        ip->v4.protocol         = icmp_protocol;
@@ -1707,7 +1719,7 @@ static int swrap_get_pcap_fd(const char *fname)
 
        if (fd != -1) return fd;
 
-       fd = open(fname, O_WRONLY|O_CREAT|O_EXCL|O_APPEND, 0644);
+       fd = libc_open(fname, O_WRONLY|O_CREAT|O_EXCL|O_APPEND, 0644);
        if (fd != -1) {
                struct swrap_file_hdr file_hdr;
                file_hdr.magic          = 0xA1B2C3D4;
@@ -1725,7 +1737,7 @@ static int swrap_get_pcap_fd(const char *fname)
                return fd;
        }
 
-       fd = open(fname, O_WRONLY|O_APPEND, 0644);
+       fd = libc_open(fname, O_WRONLY|O_APPEND, 0644);
 
        return fd;
 }
@@ -2383,7 +2395,7 @@ static int autobind_start;
 
 /* using sendto() or connect() on an unbound socket would give the
    recipient no way to reply, as unlike UDP and TCP, a unix domain
-   socket can't auto-assign emphemeral port numbers, so we need to
+   socket can't auto-assign ephemeral port numbers, so we need to
    assign it here.
    Note: this might change the family from ipv6 to ipv4
 */
@@ -3155,7 +3167,7 @@ static int swrap_recvmsg_after(int fd,
 {
        int saved_errno = errno;
        size_t i;
-       uint8_t *buf;
+       uint8_t *buf = NULL;
        off_t ofs = 0;
        size_t avail = 0;
        size_t remain;
@@ -3187,7 +3199,7 @@ static int swrap_recvmsg_after(int fd,
 
        /* we capture it as one single packet */
        buf = (uint8_t *)malloc(remain);
-       if (!buf) {
+       if (buf == NULL) {
                /* we just not capture the packet */
                errno = saved_errno;
                return -1;
@@ -3228,7 +3240,7 @@ static int swrap_recvmsg_after(int fd,
                                                      msg->msg_name,
                                                      &msg->msg_namelen);
                        if (rc == -1) {
-                               return -1;
+                               goto done;
                        }
 
                        swrap_dump_packet(si,
@@ -3247,6 +3259,7 @@ static int swrap_recvmsg_after(int fd,
                break;
        }
 
+done:
        free(buf);
        errno = saved_errno;
        return 0;
diff --git a/lib/socket_wrapper/wscript b/lib/socket_wrapper/wscript
index fb9481a..3615fa8 100644
--- a/lib/socket_wrapper/wscript
+++ b/lib/socket_wrapper/wscript
@@ -2,7 +2,7 @@
 
 import os
 
-VERSION="1.0.0"
+VERSION="1.0.2"
 
 def configure(conf):
     if conf.CHECK_BUNDLED_SYSTEM('socket_wrapper', minversion=VERSION, 
set_target=False):


-- 
Samba Shared Repository

Reply via email to