The branch, v4-3-test has been updated
       via  c84322d vfs_fruit: return value of ad_pack in vfs_fruit.c
       via  dff1fd5 lib: We can do ACCRIGHTS style fdpassing
       via  84d80d6 lib: Support fd passing using the 4.3BSD way
       via  088b7e2 lib: Move some routines around in msghdr.c
       via  d4db166 lib: We only need the fd-passing check once
       via  b6bdeb8 vfs_commit: set the fd on open before calling SMB_VFS_FSTAT
       via  5dceb51 s3:ctdbd_conn: make sure we destroy tevent_fd before 
closing the socket
       via  f1ed825 s4: tests: Fix nss_tests build on Solaris.
      from  e765cf9 kerberos: make sure we only use prompter type when 
available.

https://git.samba.org/?p=samba.git;a=shortlog;h=v4-3-test


- Log -----------------------------------------------------------------
commit c84322da084440029e0630a701812380313facf7
Author: Ralph Boehme <s...@samba.org>
Date:   Sun Sep 27 12:11:31 2015 +0200

    vfs_fruit: return value of ad_pack in vfs_fruit.c
    
    ad_pack() in vfs_fruit.c returns false on failure and 0 on success -
    i.e. return value is interpreted as success even when it fails.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=11543
    
    Signed-off-by: Ralph Boehme <s...@samba.org>
    Reviewed-by: Uri Simchoni <u...@samba.org>
    
    Autobuild-User(master): Uri Simchoni <u...@samba.org>
    Autobuild-Date(master): Tue Oct  6 16:14:42 CEST 2015 on sn-devel-104
    
    (cherry picked from commit 5d7eaf959a0f11be878f698305fcb8908d7ba047)
    
    Autobuild-User(v4-3-test): Karolin Seeger <ksee...@samba.org>
    Autobuild-Date(v4-3-test): Tue Oct 13 12:29:33 CEST 2015 on sn-devel-104

commit dff1fd5e57ca5fedfc9546432c4ec1d357e5cad7
Author: Volker Lendecke <v...@samba.org>
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 <v...@samba.org>
    Reviewed-by: Michael Adam <ob...@samba.org>
    
    Autobuild-User(master): Michael Adam <ob...@samba.org>
    Autobuild-Date(master): Thu Oct  1 05:55:42 CEST 2015 on sn-devel-104
    
    (cherry picked from commit 00954a975b45cdb0dcf08c25850d2be26efabe48)

commit 84d80d65090ddbc932b9bc52cbafda5eca6c8303
Author: Volker Lendecke <v...@samba.org>
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 <v...@samba.org>
    Reviewed-by: Michael Adam <ob...@samba.org>
    (cherry picked from commit 0499cee90307d9644271869c86fac2b5401df0e0)

commit 088b7e237ab5e871de53c655d05570b3c542f58f
Author: Volker Lendecke <v...@samba.org>
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 <v...@samba.org>
    Reviewed-by: Michael Adam <ob...@samba.org>
    (cherry picked from commit f4e06a9bce42d60f6c96a21307266a99d2785ae9)

commit d4db166f2526094cc70c4ce11bfa762529052d0a
Author: Volker Lendecke <v...@samba.org>
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 <v...@samba.org>
    Reviewed-by: Michael Adam <ob...@samba.org>
    (cherry picked from commit 2c675aad40e3e0bb412f9fb8558de349ad62860a)

commit b6bdeb8bf9a69e8cb5a334cfdf8c41ef461941ab
Author: Uri Simchoni <u...@samba.org>
Date:   Wed Oct 7 22:44:11 2015 +0300

    vfs_commit: set the fd on open before calling SMB_VFS_FSTAT
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11547
    
    Signed-off-by: Uri Simchoni <u...@samba.org>
    Reviewed-by: Jeremy Allison <j...@samba.org>
    
    Autobuild-User(master): Jeremy Allison <j...@samba.org>
    Autobuild-Date(master): Thu Oct  8 02:56:41 CEST 2015 on sn-devel-104
    
    (cherry picked from commit 5709dece4860f205e31309e31ec4e3e938d9f6a5)

commit 5dceb51442b65d72dd948394e653dedc572a6f38
Author: Stefan Metzmacher <me...@samba.org>
Date:   Mon Oct 5 15:57:42 2015 +0200

    s3:ctdbd_conn: make sure we destroy tevent_fd before closing the socket
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11316
    
    Signed-off-by: Stefan Metzmacher <me...@samba.org>
    Reviewed-by: Volker Lendecke <v...@samba.org>
    Reviewed-by: Günther Deschner <g...@samba.org>
    (cherry picked from commit 70dbba96e311449575f571db68710584fc991234)

commit f1ed825175f337e65a4c901fd7df0e785e308925
Author: Tom Schulz <sch...@adi.com>
Date:   Wed Sep 16 16:55:23 2015 -0700

    s4: tests: Fix nss_tests build on Solaris.
    
    Too many arguments for Solaris getpwent_r() and getgrent_r().
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11508
    
    Signed-off-by: Tom Schulz <sch...@adi.com>
    Reviewed-by: Jeremy Allison <j...@samba.org>
    Reviewed-by: Ralph Böhme <r...@sernet.de>
    
    Autobuild-User(master): Jeremy Allison <j...@samba.org>
    Autobuild-Date(master): Thu Sep 17 05:01:07 CEST 2015 on sn-devel-104
    
    (cherry picked from commit 5866fcc1645366a56e68fc3d8065618131364337)

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

Summary of changes:
 source3/lib/ctdbd_conn.c          |   6 +-
 source3/lib/msghdr.c              | 176 +++++++++++++++++++++++++++-----------
 source3/lib/unix_msg/unix_msg.c   |  10 +--
 source3/modules/vfs_commit.c      |  11 ++-
 source3/modules/vfs_fruit.c       |  14 +--
 source4/torture/local/nss_tests.c |   8 ++
 6 files changed, 161 insertions(+), 64 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/lib/ctdbd_conn.c b/source3/lib/ctdbd_conn.c
index 1acce12..c19b6e5 100644
--- a/source3/lib/ctdbd_conn.c
+++ b/source3/lib/ctdbd_conn.c
@@ -421,7 +421,11 @@ static int ctdb_read_req(struct ctdbd_connection *conn, 
uint32_t reqid,
 
 static int ctdbd_connection_destructor(struct ctdbd_connection *c)
 {
-       close(c->fd);
+       TALLOC_FREE(c->fde);
+       if (c->fd != -1) {
+               close(c->fd);
+               c->fd = -1;
+       }
        return 0;
 }
 /*
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;
        }
diff --git a/source3/modules/vfs_commit.c b/source3/modules/vfs_commit.c
index a6bc2a4..f1e2743 100644
--- a/source3/modules/vfs_commit.c
+++ b/source3/modules/vfs_commit.c
@@ -230,7 +230,16 @@ static int commit_open(
         /* EOF commit modes require us to know the initial file size. */
         if (c && (c->on_eof != EOF_NONE)) {
                 SMB_STRUCT_STAT st;
-                if (SMB_VFS_FSTAT(fsp, &st) == -1) {
+               /*
+                * Setting the fd of the FSP is a hack
+                * but also practiced elsewhere -
+                * needed for calling the VFS.
+                */
+               fsp->fh->fd = fd;
+               if (SMB_VFS_FSTAT(fsp, &st) == -1) {
+                       int saved_errno = errno;
+                       SMB_VFS_CLOSE(fsp);
+                       errno = saved_errno;
                         return -1;
                 }
                c->eof = st.st_ex_size;
diff --git a/source3/modules/vfs_fruit.c b/source3/modules/vfs_fruit.c
index 21b49f9..ecce85d 100644
--- a/source3/modules/vfs_fruit.c
+++ b/source3/modules/vfs_fruit.c
@@ -567,7 +567,7 @@ static bool ad_pack(struct adouble *ad)
        }
        RSSVAL(ad->ad_data, ADEDOFF_NENTRIES, nent);
 
-       return 0;
+       return true;
 }
 
 /**
@@ -949,8 +949,9 @@ static ssize_t ad_header_read_rsrc(struct adouble *ad, 
const char *path)
                        /*
                         * Can't use ad_write() because we might not have a fsp
                         */
-                       rc = ad_pack(ad);
-                       if (rc != 0) {
+                       ok = ad_pack(ad);
+                       if (!ok) {
+                               rc = -1;
                                goto exit;
                        }
                        /* FIXME: direct sys_pwrite(), don't have an fsp */
@@ -1211,10 +1212,11 @@ static int ad_write(struct adouble *ad, const char 
*path)
 {
        int rc = 0;
        ssize_t len;
+       bool ok;
 
-       rc = ad_pack(ad);
-       if (rc != 0) {
-               goto exit;
+       ok = ad_pack(ad);
+       if (!ok) {
+               return -1;
        }
 
        switch (ad->ad_type) {
diff --git a/source4/torture/local/nss_tests.c 
b/source4/torture/local/nss_tests.c
index 546d7eb..e814dba 100644
--- a/source4/torture/local/nss_tests.c
+++ b/source4/torture/local/nss_tests.c
@@ -349,7 +349,11 @@ static bool test_enum_r_passwd(struct torture_context 
*tctx,
        while (1) {
                torture_comment(tctx, "Testing getpwent_r\n");
 
+#ifdef SOLARIS_GETPWENT_R
+               ret = getpwent_r(&pwd, buffer, sizeof(buffer));
+#else /* SOLARIS_GETPWENT_R */
                ret = getpwent_r(&pwd, buffer, sizeof(buffer), &pwdp);
+#endif /* SOLARIS_GETPWENT_R */
                if (ret != 0) {
                        if (ret != ENOENT) {
                                torture_comment(tctx, "got %d return code\n", 
ret);
@@ -543,7 +547,11 @@ static bool test_enum_r_group(struct torture_context *tctx,
        while (1) {
                torture_comment(tctx, "Testing getgrent_r\n");
 
+#ifdef SOLARIS_GETGRENT_R
+               ret = getgrent_r(&grp, buffer, sizeof(buffer));
+#else /* SOLARIS_GETGRENT_R */
                ret = getgrent_r(&grp, buffer, sizeof(buffer), &grpp);
+#endif /* SOLARIS_GETGRENT_R */
                if (ret != 0) {
                        if (ret != ENOENT) {
                                torture_comment(tctx, "got %d return code\n", 
ret);


-- 
Samba Shared Repository

Reply via email to