The branch, master has been updated
       via  00954a9 lib: We can do ACCRIGHTS style fdpassing
       via  0499cee lib: Support fd passing using the 4.3BSD way
       via  f4e06a9 lib: Move some routines around in msghdr.c
       via  2c675aa lib: We only need the fd-passing check once
       via  b191632 lib: Fix the build on Solaris
       via  d9000cb libreplace: Fix the build on Solaris
      from  22c5699 lib: Fix server_id_db_set_exclusive

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


- Log -----------------------------------------------------------------
commit 00954a975b45cdb0dcf08c25850d2be26efabe48
Author: Volker Lendecke <[email protected]>
Date:   Sun Sep 27 00:36:23 2015 +0200

    lib: We can do ACCRIGHTS style fdpassing
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11053
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Michael Adam <[email protected]>
    
    Autobuild-User(master): Michael Adam <[email protected]>
    Autobuild-Date(master): Thu Oct  1 05:55:42 CEST 2015 on sn-devel-104

commit 0499cee90307d9644271869c86fac2b5401df0e0
Author: Volker Lendecke <[email protected]>
Date:   Sun Sep 27 00:54:42 2015 +0200

    lib: Support fd passing using the 4.3BSD way
    
    This is required on Solaris
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11053
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Michael Adam <[email protected]>

commit f4e06a9bce42d60f6c96a21307266a99d2785ae9
Author: Volker Lendecke <[email protected]>
Date:   Sun Sep 27 00:46:33 2015 +0200

    lib: Move some routines around in msghdr.c
    
    This way we only need one #ifdef for ACCRIGHTS
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11053
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Michael Adam <[email protected]>

commit 2c675aad40e3e0bb412f9fb8558de349ad62860a
Author: Volker Lendecke <[email protected]>
Date:   Sun Sep 27 00:35:45 2015 +0200

    lib: We only need the fd-passing check once
    
    unix_dgram_send will tell us as well
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11053
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Michael Adam <[email protected]>

commit b191632701c8b5fb8d89109494a2251416bd6a93
Author: Volker Lendecke <[email protected]>
Date:   Sun Sep 27 00:58:00 2015 +0200

    lib: Fix the build on Solaris
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Michael Adam <[email protected]>

commit d9000cbc944fa58cc7b7bc509ce885d7b5f498af
Author: Volker Lendecke <[email protected]>
Date:   Sun Sep 27 00:57:50 2015 +0200

    libreplace: Fix the build on Solaris
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Michael Adam <[email protected]>

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

Summary of changes:
 lib/replace/replace.c           |   2 +-
 lib/replace/wscript             |   5 ++
 lib/util/time_basic.c           |   2 +-
 source3/lib/msghdr.c            | 176 +++++++++++++++++++++++++++++-----------
 source3/lib/unix_msg/unix_msg.c |  10 +--
 5 files changed, 137 insertions(+), 58 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/replace/replace.c b/lib/replace/replace.c
index 798990a..c9c12a4 100644
--- a/lib/replace/replace.c
+++ b/lib/replace/replace.c
@@ -829,7 +829,7 @@ int rep_clock_gettime(clockid_t clk_id, struct timespec *tp)
        struct timeval tval;
        switch (clk_id) {
                case 0: /* CLOCK_REALTIME :*/
-#ifdef HAVE_GETTIMEOFDAY_TZ
+#if defined(HAVE_GETTIMEOFDAY_TZ) || defined(HAVE_GETTIMEOFDAY_TZ_VOID)
                        gettimeofday(&tval,NULL);
 #else
                        gettimeofday(&tval);
diff --git a/lib/replace/wscript b/lib/replace/wscript
index 9a8b7f7..0be52f7 100644
--- a/lib/replace/wscript
+++ b/lib/replace/wscript
@@ -506,6 +506,11 @@ removeea setea
                            'int gettimeofday(struct timeval *tv, struct 
timezone *tz)',
                            define='HAVE_GETTIMEOFDAY_TZ', headers='sys/time.h')
 
+    conf.CHECK_C_PROTOTYPE('gettimeofday',
+                           'int gettimeofday(struct timeval *tv, void *tz)',
+                           define='HAVE_GETTIMEOFDAY_TZ_VOID',
+                           headers='sys/time.h')
+
     conf.CHECK_CODE('#include "test/snprintf.c"',
                     define="HAVE_C99_VSNPRINTF",
                     execute=True,
diff --git a/lib/util/time_basic.c b/lib/util/time_basic.c
index e4b0886..8113bb5 100644
--- a/lib/util/time_basic.c
+++ b/lib/util/time_basic.c
@@ -29,7 +29,7 @@ a gettimeofday wrapper
 **/
 _PUBLIC_ void GetTimeOfDay(struct timeval *tval)
 {
-#ifdef HAVE_GETTIMEOFDAY_TZ
+#if defined(HAVE_GETTIMEOFDAY_TZ) || defined(HAVE_GETTIMEOFDAY_TZ_VOID)
        gettimeofday(tval,NULL);
 #else
        gettimeofday(tval);
diff --git a/source3/lib/msghdr.c b/source3/lib/msghdr.c
index de0eed4..2aa2f2e 100644
--- a/source3/lib/msghdr.c
+++ b/source3/lib/msghdr.c
@@ -21,6 +21,8 @@
 #include "lib/util/iov_buf.h"
 #include <sys/socket.h>
 
+#if defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL)
+
 ssize_t msghdr_prep_fds(struct msghdr *msg, uint8_t *buf, size_t bufsize,
                        const int *fds, size_t num_fds)
 {
@@ -58,6 +60,132 @@ ssize_t msghdr_prep_fds(struct msghdr *msg, uint8_t *buf, 
size_t bufsize,
        return cmsg_space;
 }
 
+size_t msghdr_prep_recv_fds(struct msghdr *msg, uint8_t *buf, size_t bufsize,
+                           size_t num_fds)
+{
+       size_t ret = CMSG_SPACE(sizeof(int) * num_fds);
+
+       if (bufsize < ret) {
+               return ret;
+       }
+       if (msg != NULL) {
+               if (num_fds != 0) {
+                       msg->msg_control = buf;
+                       msg->msg_controllen = ret;
+               } else {
+                       msg->msg_control = NULL;
+                       msg->msg_controllen = 0;
+               }
+       }
+       return ret;
+}
+
+size_t msghdr_extract_fds(struct msghdr *msg, int *fds, size_t fds_size)
+{
+       struct cmsghdr *cmsg;
+       size_t num_fds;
+
+       for(cmsg = CMSG_FIRSTHDR(msg);
+           cmsg != NULL;
+           cmsg = CMSG_NXTHDR(msg, cmsg))
+       {
+               if ((cmsg->cmsg_type == SCM_RIGHTS) &&
+                   (cmsg->cmsg_level == SOL_SOCKET)) {
+                       break;
+               }
+       }
+
+       if (cmsg == NULL) {
+               return 0;
+       }
+
+       num_fds = (cmsg->cmsg_len - CMSG_LEN(0)) / sizeof(int);
+
+       if ((num_fds != 0) && (fds != NULL) && (fds_size >= num_fds)) {
+               memcpy(fds, CMSG_DATA(cmsg), num_fds * sizeof(int));
+       }
+
+       return num_fds;
+}
+
+#elif defined(HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS)
+
+ssize_t msghdr_prep_fds(struct msghdr *msg, uint8_t *buf, size_t bufsize,
+                       const int *fds, size_t num_fds)
+{
+       size_t needed;
+
+       if (num_fds > INT8_MAX) {
+               return -1;
+       }
+
+       needed = sizeof(int) * num_fds;
+
+       if ((msg == NULL) || (needed > bufsize)) {
+               return needed;
+       }
+
+       memcpy(buf, fds, needed);
+
+       msg->msg_accrights = (caddr_t) buf;
+       msg->msg_accrightslen = needed;
+
+       return needed;
+}
+
+size_t msghdr_prep_recv_fds(struct msghdr *msg, uint8_t *buf, size_t bufsize,
+                           size_t num_fds)
+{
+       size_t ret = num_fds * sizeof(int);
+
+       if (bufsize < ret) {
+               return ret;
+       }
+
+       if (msg != NULL) {
+               if (num_fds != 0) {
+                       msg->msg_accrights = (caddr_t) buf;
+                       msg->msg_accrightslen = ret;
+               } else {
+                       msg->msg_accrights = NULL;
+                       msg->msg_accrightslen = 0;
+               }
+       }
+       return ret;
+}
+
+size_t msghdr_extract_fds(struct msghdr *msg, int *fds, size_t fds_size)
+{
+       size_t num_fds = msg->msg_accrightslen / sizeof(int);
+
+       if ((fds != 0) && (num_fds <= fds_size)) {
+               memcpy(fds, msg->msg_accrights, msg->msg_accrightslen);
+       }
+
+       return num_fds;
+}
+
+#else
+
+ssize_t msghdr_prep_fds(struct msghdr *msg, uint8_t *buf, size_t bufsize,
+                       const int *fds, size_t num_fds)
+{
+       return -1;
+}
+
+size_t msghdr_prep_recv_fds(struct msghdr *msg, uint8_t *buf, size_t bufsize,
+                           size_t num_fds)
+{
+       return 0;
+}
+
+size_t msghdr_extract_fds(struct msghdr *msg, int *fds, size_t fds_size)
+{
+       return 0;
+}
+
+#endif
+
 struct msghdr_buf {
        struct msghdr msg;
        struct sockaddr_storage addr;
@@ -130,51 +258,3 @@ struct msghdr *msghdr_buf_msghdr(struct msghdr_buf *msg)
 {
        return &msg->msg;
 }
-
-size_t msghdr_prep_recv_fds(struct msghdr *msg, uint8_t *buf, size_t bufsize,
-                           size_t num_fds)
-{
-       size_t ret = CMSG_SPACE(sizeof(int) * num_fds);
-
-       if (bufsize < ret) {
-               return ret;
-       }
-       if (msg != NULL) {
-               if (num_fds != 0) {
-                       msg->msg_control = buf;
-                       msg->msg_controllen = ret;
-               } else {
-                       msg->msg_control = NULL;
-                       msg->msg_controllen = 0;
-               }
-       }
-       return ret;
-}
-
-size_t msghdr_extract_fds(struct msghdr *msg, int *fds, size_t fds_size)
-{
-       struct cmsghdr *cmsg;
-       size_t num_fds;
-
-       for(cmsg = CMSG_FIRSTHDR(msg);
-           cmsg != NULL;
-           cmsg = CMSG_NXTHDR(msg, cmsg))
-       {
-               if ((cmsg->cmsg_type == SCM_RIGHTS) &&
-                   (cmsg->cmsg_level == SOL_SOCKET)) {
-                       break;
-               }
-       }
-
-       if (cmsg == NULL) {
-               return 0;
-       }
-
-       num_fds = (cmsg->cmsg_len - CMSG_LEN(0)) / sizeof(int);
-
-       if ((num_fds != 0) && (fds != NULL) && (fds_size >= num_fds)) {
-               memcpy(fds, CMSG_DATA(cmsg), num_fds * sizeof(int));
-       }
-
-       return num_fds;
-}
diff --git a/source3/lib/unix_msg/unix_msg.c b/source3/lib/unix_msg/unix_msg.c
index 0baaa9d..3221133 100644
--- a/source3/lib/unix_msg/unix_msg.c
+++ b/source3/lib/unix_msg/unix_msg.c
@@ -572,11 +572,11 @@ static int unix_dgram_send(struct unix_dgram_ctx *ctx,
                return EINVAL;
        }
 
-#ifndef HAVE_STRUCT_MSGHDR_MSG_CONTROL
+#if !defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL) && 
!defined(HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS)
        if (num_fds > 0) {
                return ENOSYS;
        }
-#endif /* ! HAVE_STRUCT_MSGHDR_MSG_CONTROL */
+#endif
 
        for (i = 0; i < num_fds; i++) {
                /*
@@ -798,12 +798,6 @@ int unix_msg_send(struct unix_msg_ctx *ctx, const struct 
sockaddr_un *dst,
                return EINVAL;
        }
 
-#ifndef HAVE_STRUCT_MSGHDR_MSG_CONTROL
-       if (num_fds > 0) {
-               return ENOSYS;
-       }
-#endif /* ! HAVE_STRUCT_MSGHDR_MSG_CONTROL */
-
        if (num_fds > INT8_MAX) {
                return EINVAL;
        }


-- 
Samba Shared Repository

Reply via email to