The branch, v3-6-test has been updated
       via  d8bc158 libcli-cldap: avoid the case local == remote == NULL 
(cherry picked from commit 4d2d33ee09941ddb211e21788c01d886730224c2)
       via  b301e0e libcli/cldap: make sure the local and remote address family 
matches
      from  b5e1b79 s3:libsmb: consistently use state->size in 
cli_write_andx_create() (bug #5326)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-6-test


- Log -----------------------------------------------------------------
commit d8bc1584df47673ba7f6933af178f8669a61262b
Author: Matthieu Patou <[email protected]>
Date:   Fri Oct 21 16:11:41 2011 +0200

    libcli-cldap: avoid the case local == remote == NULL (cherry picked from 
commit 4d2d33ee09941ddb211e21788c01d886730224c2)
    
    Signed-off-by: Stefan Metzmacher <[email protected]>
    
    The last 2 patches address bug #8600 (cldap doesn't work over ipv6).

commit b301e0e199ec91bdf07a5022e37181d8e570ef3d
Author: Stefan Metzmacher <[email protected]>
Date:   Fri Oct 21 09:49:30 2011 +0200

    libcli/cldap: make sure the local and remote address family matches
    
    metze
    
    Signed-off-by: Matthieu Patou <[email protected]>
    (cherry picked from commit 66530e91498cfa77a9d2e3a031f8a2e1c5ee6804)

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

Summary of changes:
 libcli/cldap/cldap.c |   34 +++++++++++++++++++++++++++++-----
 1 files changed, 29 insertions(+), 5 deletions(-)


Changeset truncated at 500 lines:

diff --git a/libcli/cldap/cldap.c b/libcli/cldap/cldap.c
index f5585c2..363ffbd 100644
--- a/libcli/cldap/cldap.c
+++ b/libcli/cldap/cldap.c
@@ -313,6 +313,27 @@ NTSTATUS cldap_socket_init(TALLOC_CTX *mem_ctx,
        struct tsocket_address *any = NULL;
        NTSTATUS status;
        int ret;
+       const char *fam = NULL;
+
+       if (local_addr == NULL && remote_addr == NULL) {
+               return NT_STATUS_INVALID_PARAMETER_MIX;
+       }
+
+       if (remote_addr) {
+               bool is_ipv4;
+               bool is_ipv6;
+
+               is_ipv4 = tsocket_address_is_inet(remote_addr, "ipv4");
+               is_ipv6 = tsocket_address_is_inet(remote_addr, "ipv6");
+
+               if (is_ipv4) {
+                       fam = "ipv4";
+               } else if (is_ipv6) {
+                       fam = "ipv6";
+               } else {
+                       return NT_STATUS_INVALID_ADDRESS;
+               }
+       }
 
        c = talloc_zero(mem_ctx, struct cldap_socket);
        if (!c) {
@@ -329,11 +350,14 @@ NTSTATUS cldap_socket_init(TALLOC_CTX *mem_ctx,
        c->event.ctx = ev;
 
        if (!local_addr) {
-               /* we use ipv4 here instead of ip, as otherwise we end
-                  up with a PF_INET6 socket, and sendto() for ipv4
-                  addresses will fail. That breaks cldap name
-                  resolution for winbind to IPv4 hosts. */
-               ret = tsocket_address_inet_from_strings(c, "ipv4",
+               /*
+                * Here we know the address family of the remote address.
+                */
+               if (fam == NULL) {
+                       return NT_STATUS_INVALID_PARAMETER_MIX;
+               }
+
+               ret = tsocket_address_inet_from_strings(c, fam,
                                                        NULL, 0,
                                                        &any);
                if (ret != 0) {


-- 
Samba Shared Repository

Reply via email to