[SCM] Samba Shared Repository - branch v4-0-test updated

Karolin Seeger kseeger at samba.org
Mon Oct 15 05:43:04 MDT 2012


The branch, v4-0-test has been updated
       via  293b100 WHATSNEW: Update changes since rc2.
       via  97954c8 s4-dns: Ignore zones that shouldn't be returned currently
       via  4a774ab kcc: return invalid parameter if the taskId is not 0
       via  203908d libcli/dns: Time out requests after a while
       via  4a98baf s4-repl: make dreplsrv_partition_find_for_nc return BAD_NC only
       via  d26fcd4 drsuapi-idl: Fix the encoding of the source_dsa_dns
       via  e7c2853 drs-replica-info: level_not_supported is wrong when we do support (partialy the level)
       via  88c9751 lib-addns: ensure that allocated buffer are pre set to 0
       via  0aed1b5 ldap-server: sscanf result was never used due to mistyped var
       via  848d0d9 ldap-server: remove warning for the ret not being used
       via  473170d s4-drs: fix the logic to allow REPL_SECRET if the account has GET_ALL_CHANGES
       via  2133f90 s4-drs: EXOP_REPL_SECRETS can be called by RW DC as well
       via  792cac9 drs-getncchanges: do not set the highestUsn to 0
       via  0ba137f drs-crackname: if there is no sid do not return the domain
       via  5aad3a5 Implement the LIST_INFO_FOR_SERVER input format
       via  1d13a9b WHATSNEW: Add more changes since rc2.
      from  d5c51e9 WHATSNEW: Start release notes for Samba 4.0.0rc3.

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


- Log -----------------------------------------------------------------
commit 293b100d577ecd29e1ac5c72e074d6aca58d1594
Author: Karolin Seeger <kseeger at samba.org>
Date:   Mon Oct 15 11:55:35 2012 +0200

    WHATSNEW: Update changes since rc2.
    
    Karolin
    
    Autobuild-User(v4-0-test): Karolin Seeger <kseeger at samba.org>
    Autobuild-Date(v4-0-test): Mon Oct 15 13:42:13 CEST 2012 on sn-devel-104

commit 97954c846f45c84f63909bfa994682bb11e07584
Author: Matthieu Patou <mat at matws.net>
Date:   Mon Oct 1 21:36:34 2012 -0700

    s4-dns: Ignore zones that shouldn't be returned currently
    
    RootDNSServers should never be returned (Windows DNS server don't)
    ..TrustAnchors should never be returned as is, (Windows returns
    TrustAnchors) and for the moment we don't support DNSSEC so we'd better
    not return this zone.
    
    Fix bug #9265 - Bind dlz fails to start if there is a trustedanchors zone.

commit 4a774ab993b93ec056173551d6105c244c7f3611
Author: Matthieu Patou <mat at matws.net>
Date:   Tue Sep 25 13:27:04 2012 -0700

    kcc: return invalid parameter if the taskId is not 0
    
    Fix bug #9254 - DsExecuteKCC returns wrong error code if taskid != 0.

commit 203908d754d5dbeb970066926bfc4cce2f6a19cd
Author: Kai Blin <kai at samba.org>
Date:   Sat Oct 13 02:09:57 2012 +0200

    libcli/dns: Time out requests after a while
    
    Time out UDP requests after DNS_REQUEST_TIMEOUT seconds. Currently set
    to 2 seconds.
    
    This should fix bug #8878.

commit 4a98baf166d99d174b31b35b6f2307728dbfc9b1
Author: Matthieu Patou <mat at matws.net>
Date:   Thu Sep 27 18:38:29 2012 -0700

    s4-repl: make dreplsrv_partition_find_for_nc return BAD_NC only
    
    Fix bug #9264 - getncchanges returns invalid_parameters when it should return bad_nc

commit d26fcd4ccaeedd1e3df2334377553add7e9b9969
Author: Matthieu Patou <mat at matws.net>
Date:   Thu Sep 27 14:20:26 2012 -0700

    drsuapi-idl: Fix the encoding of the source_dsa_dns
    
    astring is not aligned and is not conformant
    
    Fix bug #9261 - ds_replica_sync fails when specifying a name and not a guid.

commit e7c2853b41838ac9e54d2104d99e229e9922b473
Author: Matthieu Patou <mat at matws.net>
Date:   Thu Sep 27 01:27:50 2012 -0700

    drs-replica-info: level_not_supported is wrong when we do support (partialy the level)
    
    Fix bug #9260 - kccdrs_replica_get_info returns invalid level when non supported
    should be returned.

commit 88c97513891c00981bf42047aa20db2625d54def
Author: Matthieu Patou <mat at matws.net>
Date:   Thu Sep 27 01:22:57 2012 -0700

    lib-addns: ensure that allocated buffer are pre set to 0
    
    It avoid bugs when one of the buffer is supposed to contain a string
    that is not null terminated (ie. label->label) and that we don't force
    the last byte to 0.
    
    Fix bug #9259 - rodc join fails complaining that it can't find a RWDC.

commit 0aed1b5f6b78d6745de9bad8b497817cc313c0de
Author: Matthieu Patou <mat at matws.net>
Date:   Wed Sep 26 18:32:28 2012 -0700

    ldap-server: sscanf result was never used due to mistyped var
    
    Fix bug #9258 - ldap server ignore configuration values set in the database for
    timeout.

commit 848d0d9fa84af034d64133286235d7f4c4b2b41d
Author: Matthieu Patou <mat at matws.net>
Date:   Wed Sep 26 18:31:39 2012 -0700

    ldap-server: remove warning for the ret not being used
    
    Fix bug #9257 - ldap server has at least one un-initialized variable.

commit 473170d334881e427e97c341232bfdfdfd4c2bb2
Author: Matthieu Patou <mat at matws.net>
Date:   Wed Sep 26 11:49:07 2012 -0700

    s4-drs: fix the logic to allow REPL_SECRET if the account has GET_ALL_CHANGES
    
    The last 2 patches address bug #9256 - getncchanges with exop for
    repl_obj_with_secrets should always be allowed for RWDC.

commit 2133f909798e69018106449a2143aa9ea9c0b871
Author: Matthieu Patou <mat at matws.net>
Date:   Wed Sep 26 11:44:58 2012 -0700

    s4-drs: EXOP_REPL_SECRETS can be called by RW DC as well

commit 792cac92088c9cbbab9a37bead89bf585be6119b
Author: Matthieu Patou <mat at matws.net>
Date:   Tue Sep 25 14:02:55 2012 -0700

    drs-getncchanges: do not set the highestUsn to 0
    
    Paragraph 4.1.10.5 says that
             if err = 0 then
             msgOut.pNC := msgIn.pNC
             msgOut.usnvecFrom := msgIn.usnvecFrom
    so no need to set the highestUsn to 0
    
    Fix bug #9255 - getncchanges with exop for repl_obj returns highest_usn.

commit 0ba137f0a0263f8fda16451face34c96646e6e4f
Author: Matthieu Patou <mat at matws.net>
Date:   Tue Sep 25 10:51:47 2012 -0700

    drs-crackname: if there is no sid do not return the domain
    
    Fix bug #9253 - crackname returns a dns domain name even if there is no cracked
    SID.

commit 5aad3a5e7e9e5e6a2ccf8e061746f58a864ec646
Author: Matthieu Patou <mat at matws.net>
Date:   Mon Sep 24 21:34:02 2012 -0700

    Implement the LIST_INFO_FOR_SERVER input format
    
    Fix bug #9252 - preliminary tests for dcpromo in Windows 2012 fails with Samba
    DC.

commit 1d13a9bb27f7ea8f1675df5b0d36de28702b587b
Author: Karolin Seeger <kseeger at samba.org>
Date:   Mon Oct 15 10:35:14 2012 +0200

    WHATSNEW: Add more changes since rc2.
    
    To be continued...
    
    Karolin

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

Summary of changes:
 WHATSNEW.txt                                |   50 ++++++++++++
 lib/addns/dnsmarshall.c                     |   24 +++---
 libcli/dns/dns.c                            |    8 ++
 librpc/idl/drsuapi.idl                      |    2 +-
 source4/dns_server/dns_server.c             |   15 ++++-
 source4/dsdb/kcc/kcc_drs_replica_info.c     |   22 +++--
 source4/dsdb/repl/drepl_partitions.c        |    9 ++-
 source4/dsdb/samdb/cracknames.c             |  109 +++++++++++++++++++++++++++
 source4/ldap_server/ldap_server.c           |    6 +-
 source4/rpc_server/drsuapi/dcesrv_drsuapi.c |    7 +-
 source4/rpc_server/drsuapi/getncchanges.c   |   47 ++++++++++--
 11 files changed, 260 insertions(+), 39 deletions(-)


Changeset truncated at 500 lines:

diff --git a/WHATSNEW.txt b/WHATSNEW.txt
index d920c8a..d1e36ec 100644
--- a/WHATSNEW.txt
+++ b/WHATSNEW.txt
@@ -170,18 +170,40 @@ o   Jeremy Allison <jra at samba.org>
     * BUG 9209: Parse of invalid SMB2 create blob can cause smbd crash.
     * BUG 9214: Bad user supplied SMB2 credit value can cause smbd to call
       smb_panic.
+    * BUG 9222: Document that signing cannot be disabled for SMB2 by design.
 
 
 o   Andrew Bartlett <abartlet at samba.org>
     * BUG 9235: Update Samba3-HOWTO Collection.
+    * BUG 9271: samba-tool: Skip chown in sysvolreset when it would fail on
+      a GID.
+    * BUG 9274: Update Samba3-HOWTO Collection.
 
 
 o   Björn Baumbach <bb at sernet.de>
     * BUG 9235: Fix opening and ending tag mismatch in Samba3-HOWTO.
+    * BUG 9271: Fix typos in samba_backup.
+    * BUG 9274: Add delete_lost option to vfs_streams_depot.8.
 
 
 o   Kai Blin <kai at samba.org>
     * BUG 9225: Fix return code for deleted DNS records.
+    * BUG 8878: Time out UDP requests after DNS_REQUEST_TIMEOUT seconds.
+
+
+o   Günther Deschner <gd at samba.org>
+    * BUG 9177: pam_winbind: Match more return codes when wbcGetPwnam has
+    failed.
+
+
+o   David Disseldorp <ddiss at samba.org>
+    * BUG 9269: Fix 64bit-portability-issue.
+
+
+o   Björn Jacke <bj at sernet.de>
+    * BUG 5670: Apply some Solaris packaging fixes.
+    * BUG 8107: Fix poll replacement to become a msleep replacement.
+    * BUG 8344: Fix --with(out)-sendfile-support option handling.
 
 
 o   Volker Lendecke <vl at samba.org>
@@ -190,11 +212,30 @@ o   Volker Lendecke <vl at samba.org>
 
 
 o   Stefan Metzmacher <metze at samba.org>
+    * BUG 9271: Several samba-tool fixes.
     * BUG 9196: Don't take 'state->te' as indication for "was_deferred".
 
 
 o   Matthieu Patou <mat at matws.net>
     * BUG 9240: Remove unused variable in DNS server.
+    * BUG 9252: Preliminary tests for dcpromo in Windows 2012 fails with
+      Samba DC.
+    * BUG 9253: Crackname returns a dns domain name even if there is no cracked
+      SID.
+    * BUG 9255: Getncchanges with exop for repl_obj returns highest_usn.
+    * BUG 9256: Getncchanges with exop for repl_obj_with_secrets should always
+      be allowed for RWDC.
+    * BUG 9257: LDAP server has at least one un-initialized variable.
+    * BUG 9258: LDAP server ignore configuration values set in the database for
+      timeout.
+    * BUG 9259: rodc join fails complaining that it can't find a RWDC.
+    * BUG 9260: kccdrs_replica_get_info returns invalid level when non
+      supported should be returned.
+    * BUG 9261: ds_replica_sync fails when specifying a name and not a guid.
+    * BUG 9264: getncchanges returns invalid_parameters when it should return
+      bad_nc.
+    * BUG 9254: DsExecuteKCC returns wrong error code if taskid != 0.
+    * BUG 9265: Bind dlz fails to start if there is a trustedanchors zone.
 
 
 o   Rusty Russell <rusty at rustcorp.com.au>
@@ -202,17 +243,26 @@ o   Rusty Russell <rusty at rustcorp.com.au>
 
 
 o   Andreas Schneider <asn at samba.org>
+    * BUG 8769: Fix RAW printing for normal users.
+    * BUG 9112: Increase debug level for info that the db is empty.
     * BUG 9244: Build pam_smbpass module only if enabled.
     * BUG 9245: Make sure the registry is set up before we init printing.
+    * BUG 9276: Add config for systemd-tmpfiles.
+    * BUG 9280: Add support for reloading systemd services.
 
 
 o   Karolin Seeger <kseeger at samba.org>
     * BUG 7826: Remove link to Using Samba.
+    * BUG 8802: Add basic manpages for 'samba' and 'samba-tool'.
+    * BUG 9165: Fix makerpms.sh on RHEL.
     * BUG 9243: Remove duplicate synonym min protocol.
+    * BUG 9271: Several samba-tool fixes.
 
 
 o   Jelmer Vernooij <jelmer at samba.org>
     * BUG 9243: Add basic documentation for 'server min protocol'.
+    * BUG 9271: Several samba-tool fixes.
+    * BUG 9274: Add documentation for several parameters.
 
 
 o   Matthias Dieter Wallnöfer <mdw at samba.org>
diff --git a/lib/addns/dnsmarshall.c b/lib/addns/dnsmarshall.c
index b0211c8..846fd5b 100644
--- a/lib/addns/dnsmarshall.c
+++ b/lib/addns/dnsmarshall.c
@@ -27,7 +27,7 @@ struct dns_buffer *dns_create_buffer(TALLOC_CTX *mem_ctx)
 {
 	struct dns_buffer *result;
 
-	if (!(result = talloc(mem_ctx, struct dns_buffer))) {
+	if (!(result = talloc_zero(mem_ctx, struct dns_buffer))) {
 		return NULL;
 	}
 
@@ -39,7 +39,7 @@ struct dns_buffer *dns_create_buffer(TALLOC_CTX *mem_ctx)
 	 */
 	result->size = 2;
 
-	if (!(result->data = talloc_array(result, uint8_t, result->size))) {
+	if (!(result->data = talloc_zero_array(result, uint8_t, result->size))) {
 		TALLOC_FREE(result);
 		return NULL;
 	}
@@ -216,14 +216,14 @@ static void dns_unmarshall_label(TALLOC_CTX *mem_ctx,
 		return;
 	}
 
-	if (!(label = talloc(mem_ctx, struct dns_domain_label))) {
+	if (!(label = talloc_zero(mem_ctx, struct dns_domain_label))) {
 		buf->error = ERROR_DNS_NO_MEMORY;
 		return;
 	}
 
 	label->len = len;
 
-	if (!(label->label = talloc_array(label, char, len+1))) {
+	if (!(label->label = talloc_zero_array(label, char, len+1))) {
 		buf->error = ERROR_DNS_NO_MEMORY;
 		goto error;
 	}
@@ -250,7 +250,7 @@ void dns_unmarshall_domain_name(TALLOC_CTX *mem_ctx,
 
 	if (!ERR_DNS_IS_OK(buf->error)) return;
 
-	if (!(name = talloc(mem_ctx, struct dns_domain_name))) {
+	if (!(name = talloc_zero(mem_ctx, struct dns_domain_name))) {
 		buf->error = ERROR_DNS_NO_MEMORY;
 		return;
 	}
@@ -281,7 +281,7 @@ static void dns_unmarshall_question(TALLOC_CTX *mem_ctx,
 
 	if (!(ERR_DNS_IS_OK(buf->error))) return;
 
-	if (!(q = talloc(mem_ctx, struct dns_question))) {
+	if (!(q = talloc_zero(mem_ctx, struct dns_question))) {
 		buf->error = ERROR_DNS_NO_MEMORY;
 		return;
 	}
@@ -314,7 +314,7 @@ static void dns_unmarshall_rr(TALLOC_CTX *mem_ctx,
 
 	if (!(ERR_DNS_IS_OK(buf->error))) return;
 
-	if (!(r = talloc(mem_ctx, struct dns_rrec))) {
+	if (!(r = talloc_zero(mem_ctx, struct dns_rrec))) {
 		buf->error = ERROR_DNS_NO_MEMORY;
 		return;
 	}
@@ -329,7 +329,7 @@ static void dns_unmarshall_rr(TALLOC_CTX *mem_ctx,
 	if (!(ERR_DNS_IS_OK(buf->error))) return;
 
 	if (r->data_length != 0) {
-		if (!(r->data = talloc_array(r, uint8_t, r->data_length))) {
+		if (!(r->data = talloc_zero_array(r, uint8_t, r->data_length))) {
 			buf->error = ERROR_DNS_NO_MEMORY;
 			return;
 		}
@@ -406,22 +406,22 @@ DNS_ERROR dns_unmarshall_request(TALLOC_CTX *mem_ctx,
 	err = ERROR_DNS_NO_MEMORY;
 
 	if ((req->num_questions != 0) &&
-	    !(req->questions = talloc_array(req, struct dns_question *,
+	    !(req->questions = talloc_zero_array(req, struct dns_question *,
 					    req->num_questions))) {
 		goto error;
 	}
 	if ((req->num_answers != 0) &&
-	    !(req->answers = talloc_array(req, struct dns_rrec *,
+	    !(req->answers = talloc_zero_array(req, struct dns_rrec *,
 					  req->num_answers))) {
 		goto error;
 	}
 	if ((req->num_auths != 0) &&
-	    !(req->auths = talloc_array(req, struct dns_rrec *,
+	    !(req->auths = talloc_zero_array(req, struct dns_rrec *,
 					req->num_auths))) {
 		goto error;
 	}
 	if ((req->num_additionals != 0) &&
-	    !(req->additionals = talloc_array(req, struct dns_rrec *,
+	    !(req->additionals = talloc_zero_array(req, struct dns_rrec *,
 					      req->num_additionals))) {
 		goto error;
 	}
diff --git a/libcli/dns/dns.c b/libcli/dns/dns.c
index da65ce4..43e1c4e 100644
--- a/libcli/dns/dns.c
+++ b/libcli/dns/dns.c
@@ -38,6 +38,8 @@ struct dns_udp_request_state {
 	size_t reply_len;
 };
 
+#define DNS_REQUEST_TIMEOUT 2
+
 /* Declare callback functions used below. */
 static void dns_udp_request_get_reply(struct tevent_req *subreq);
 static void dns_udp_request_done(struct tevent_req *subreq);
@@ -92,6 +94,12 @@ struct tevent_req *dns_udp_request_send(TALLOC_CTX *mem_ctx,
 		return tevent_req_post(req, ev);
 	}
 
+	if (!tevent_req_set_endtime(req, ev,
+				timeval_current_ofs(DNS_REQUEST_TIMEOUT, 0))) {
+		return tevent_req_post(req, ev);
+	}
+
+
 	tevent_req_set_callback(subreq, dns_udp_request_get_reply, req);
 	return req;
 }
diff --git a/librpc/idl/drsuapi.idl b/librpc/idl/drsuapi.idl
index 9dadcdb..ed85205 100644
--- a/librpc/idl/drsuapi.idl
+++ b/librpc/idl/drsuapi.idl
@@ -204,7 +204,7 @@ interface drsuapi
 	typedef struct {
 		[ref] drsuapi_DsReplicaObjectIdentifier *naming_context;
 		GUID source_dsa_guid;
-		astring *source_dsa_dns; /* Source DSA dns_name in <guid>._msdcs.<domain_dns> form */
+		[charset(DOS),string] char *source_dsa_dns; /* Source DSA dns_name in <guid>._msdcs.<domain_dns> form */
 		drsuapi_DrsOptions options;
 	} drsuapi_DsReplicaSyncRequest1;
 
diff --git a/source4/dns_server/dns_server.c b/source4/dns_server/dns_server.c
index b768feb..5be5379 100644
--- a/source4/dns_server/dns_server.c
+++ b/source4/dns_server/dns_server.c
@@ -832,7 +832,20 @@ static void dns_task_init(struct task_server *task)
 
 		z->name = ldb_msg_find_attr_as_string(res->msgs[i], "name", NULL);
 		z->dn = talloc_move(z, &res->msgs[i]->dn);
-
+		/*
+		 * Ignore the RootDNSServers zone and zones that we don't support yet
+		 * RootDNSServers should never be returned (Windows DNS server don't)
+		 * ..TrustAnchors should never be returned as is, (Windows returns
+		 * TrustAnchors) and for the moment we don't support DNSSEC so we'd better
+		 * not return this zone.
+		 */
+		if ((strcmp(z->name, "RootDNSServers") == 0) ||
+		    (strcmp(z->name, "..TrustAnchors") == 0))
+		{
+			DEBUG(10, ("Ignoring zone %s\n", z->name));
+			talloc_free(z);
+			continue;
+		}
 		DLIST_ADD_END(dns->zones, z, NULL);
 	}
 
diff --git a/source4/dsdb/kcc/kcc_drs_replica_info.c b/source4/dsdb/kcc/kcc_drs_replica_info.c
index 8075242..0b6b82a 100644
--- a/source4/dsdb/kcc/kcc_drs_replica_info.c
+++ b/source4/dsdb/kcc/kcc_drs_replica_info.c
@@ -862,35 +862,39 @@ NTSTATUS kccdrs_replica_get_info(struct irpc_message *msg,
 							     ldb_dn_new(mem_ctx, samdb, object_dn_str));
 		break;
 	case DRSUAPI_DS_REPLICA_INFO_CURSORS3: /* On MS-DRSR it is DS_REPL_INFO_CURSORS_3_FOR_NC */
-		status = WERR_INVALID_LEVEL;
+		status = WERR_NOT_SUPPORTED;
 		break;
 	case DRSUAPI_DS_REPLICA_INFO_UPTODATE_VECTOR_V1: /* On MS-DRSR it is DS_REPL_INFO_UPTODATE_VECTOR_V1 */
-		status = WERR_INVALID_LEVEL;
+		status = WERR_NOT_SUPPORTED;
 		break;
 	case DRSUAPI_DS_REPLICA_INFO_OBJ_METADATA: /* On MS-DRSR it is DS_REPL_INFO_METADATA_FOR_OBJ */
-		status = WERR_INVALID_LEVEL;
+		/*
+		 * It should be too complicated to filter the metadata2 to remove the additional data
+		 * as metadata2 is a superset of metadata
+		 */
+		status = WERR_NOT_SUPPORTED;
 		break;
 	case DRSUAPI_DS_REPLICA_INFO_OBJ_METADATA2: /* On MS-DRSR it is DS_REPL_INFO_METADATA_FOR_OBJ */
 		status = kccdrs_replica_get_info_obj_metadata2(mem_ctx, samdb, req, reply,
 							       ldb_dn_new(mem_ctx, samdb, object_dn_str), base_index);
 		break;
 	case DRSUAPI_DS_REPLICA_INFO_ATTRIBUTE_VALUE_METADATA: /* On MS-DRSR it is DS_REPL_INFO_METADATA_FOR_ATTR_VALUE */
-		status = WERR_INVALID_LEVEL;
+		status = WERR_NOT_SUPPORTED;
 		break;
 	case DRSUAPI_DS_REPLICA_INFO_ATTRIBUTE_VALUE_METADATA2: /* On MS-DRSR it is DS_REPL_INFO_METADATA_2_FOR_ATTR_VALUE */
-		status = WERR_INVALID_LEVEL;
+		status = WERR_NOT_SUPPORTED;
 		break;
 	case DRSUAPI_DS_REPLICA_INFO_KCC_DSA_CONNECT_FAILURES: /* On MS-DRSR it is DS_REPL_INFO_KCC_DSA_CONNECT_FAILURES */
-		status = WERR_INVALID_LEVEL;
+		status = WERR_NOT_SUPPORTED;
 		break;
 	case DRSUAPI_DS_REPLICA_INFO_KCC_DSA_LINK_FAILURES: /* On MS-DRSR it is DS_REPL_INFO_KCC_LINK_FAILURES */
-		status = WERR_INVALID_LEVEL;
+		status = WERR_NOT_SUPPORTED;
 		break;
 	case DRSUAPI_DS_REPLICA_INFO_CLIENT_CONTEXTS: /* On MS-DRSR it is DS_REPL_INFO_CLIENT_CONTEXTS */
-		status = WERR_INVALID_LEVEL;
+		status = WERR_NOT_SUPPORTED;
 		break;
 	case DRSUAPI_DS_REPLICA_INFO_SERVER_OUTGOING_CALLS: /* On MS-DRSR it is DS_REPL_INFO_SERVER_OUTGOING_CALLS */
-		status = WERR_INVALID_LEVEL;
+		status = WERR_NOT_SUPPORTED;
 		break;
 	default:
 		DEBUG(1,(__location__ ": Unsupported DsReplicaGetInfo info_type %u\n",
diff --git a/source4/dsdb/repl/drepl_partitions.c b/source4/dsdb/repl/drepl_partitions.c
index 5949f42..2a16a45 100644
--- a/source4/dsdb/repl/drepl_partitions.c
+++ b/source4/dsdb/repl/drepl_partitions.c
@@ -413,6 +413,11 @@ static WERROR dreplsrv_partition_add_source_dsa(struct dreplsrv_service *s,
 	return WERR_OK;
 }
 
+/**
+ * Find a partition when given a NC
+ * If the NC can't be found it will return BAD_NC
+ * Initial checks for invalid parameters have to be done beforehand
+ */
 WERROR dreplsrv_partition_find_for_nc(struct dreplsrv_service *s,
 				      struct GUID *nc_guid,
 				      struct dom_sid *nc_sid,
@@ -429,8 +434,8 @@ WERROR dreplsrv_partition_find_for_nc(struct dreplsrv_service *s,
 	valid_sid  = nc_sid && !dom_sid_equal(&null_sid, nc_sid);
 	valid_guid = nc_guid && !GUID_all_zero(nc_guid);
 
-	if (!valid_sid && !valid_guid && !nc_dn_str) {
-		return WERR_DS_DRA_INVALID_PARAMETER;
+	if (!valid_sid && !valid_guid && (!nc_dn_str)) {
+		return WERR_DS_DRA_BAD_NC;
 	}
 
 	for (p = s->partitions; p; p = p->next) {
diff --git a/source4/dsdb/samdb/cracknames.c b/source4/dsdb/samdb/cracknames.c
index 504f1b2..c366019 100644
--- a/source4/dsdb/samdb/cracknames.c
+++ b/source4/dsdb/samdb/cracknames.c
@@ -638,6 +638,7 @@ WERROR DsCrackNameOneName(struct ldb_context *sam_ctx, TALLOC_CTX *mem_ctx,
 
 		domain_filter = NULL;
 		if (!sid) {
+			info1->dns_domain_name = NULL;
 			info1->status = DRSUAPI_DS_NAME_STATUS_NOT_FOUND;
 			return WERR_OK;
 		}
@@ -1195,6 +1196,7 @@ static WERROR DsCrackNameOneFilter(struct ldb_context *sam_ctx, TALLOC_CTX *mem_
 	}
 	case DRSUAPI_DS_NAME_FORMAT_DNS_DOMAIN:	
 	case DRSUAPI_DS_NAME_FORMAT_SID_OR_SID_HISTORY: {
+		info1->dns_domain_name = NULL;
 		info1->status = DRSUAPI_DS_NAME_STATUS_RESOLVE_ERROR;
 		return WERR_OK;
 	}
@@ -1494,3 +1496,110 @@ WERROR dcesrv_drsuapi_CrackNamesByNameFormat(struct ldb_context *sam_ctx, TALLOC
 
 	return WERR_OK;
 }
+
+WERROR dcesrv_drsuapi_ListInfoServer(struct ldb_context *sam_ctx, TALLOC_CTX *mem_ctx,
+				     const struct drsuapi_DsNameRequest1 *req1,
+				     struct drsuapi_DsNameCtr1 **_ctr1)
+{
+	struct drsuapi_DsNameInfo1 *names;
+	struct ldb_result *res;
+	struct ldb_dn *server_dn, *dn;
+	struct drsuapi_DsNameCtr1 *ctr1;
+	int ret, i;
+	const char *str;
+	const char *attrs[] = {
+		"dn",
+		"dNSHostName",
+		"serverReference",
+		NULL
+	};
+
+	*_ctr1 = NULL;
+
+	ctr1 = talloc_zero(mem_ctx, struct drsuapi_DsNameCtr1);
+	W_ERROR_HAVE_NO_MEMORY(ctr1);
+
+	/*
+	 * No magic value here, we have to return 3 entries according to the
+	 * MS-DRSR.pdf
+	 */
+	ctr1->count = 3;
+	names = talloc_zero_array(ctr1, struct drsuapi_DsNameInfo1,
+				  ctr1->count);
+	W_ERROR_HAVE_NO_MEMORY(names);
+	ctr1->array = names;
+
+	for (i=0; i < ctr1->count; i++) {
+		names[i].status = DRSUAPI_DS_NAME_STATUS_NOT_FOUND;
+	}
+	*_ctr1 = ctr1;
+
+	if (req1->count != 1) {
+		DEBUG(1, ("Expected a count of 1 for the ListInfoServer crackname \n"));
+		return WERR_OK;
+	}
+
+	if (req1->names[0].str == NULL) {
+		return WERR_OK;
+	}
+
+	server_dn = ldb_dn_new(mem_ctx, sam_ctx, req1->names[0].str);
+	W_ERROR_HAVE_NO_MEMORY(server_dn);
+
+	ret = ldb_search(sam_ctx, mem_ctx, &res, server_dn, LDB_SCOPE_ONELEVEL,
+			 NULL, "(objectClass=nTDSDSA)");
+
+	if (ret != LDB_SUCCESS) {
+		DEBUG(1, ("Search for objectClass=nTDSDSA "
+			  "returned less than 1 objects\n"));
+		return WERR_OK;
+	}
+
+	if (res->count != 1) {
+		DEBUG(1, ("Search for objectClass=nTDSDSA "
+			  "returned less than 1 objects\n"));
+		return WERR_OK;
+	}
+
+	if (res->msgs[0]->dn) {
+		names[0].result_name = ldb_dn_alloc_linearized(names, res->msgs[0]->dn);
+		W_ERROR_HAVE_NO_MEMORY(names[0].result_name);
+		names[0].status = DRSUAPI_DS_NAME_STATUS_OK;
+	}
+
+	talloc_free(res);
+
+	ret = ldb_search(sam_ctx, mem_ctx, &res, server_dn, LDB_SCOPE_BASE,
+			 attrs, "(objectClass=*)");
+	if (ret != LDB_SUCCESS) {
+		DEBUG(1, ("Search for objectClass=* on dn %s"
+			  "returned %s\n", req1->names[0].str,
+			  ldb_strerror(ret)));
+		return WERR_OK;
+	}
+
+	if (res->count != 1) {
+		DEBUG(1, ("Search for objectClass=* on dn %s"
+			  "returned less than 1 objects\n", req1->names[0].str));
+		return WERR_OK;
+	}
+
+	str = ldb_msg_find_attr_as_string(res->msgs[0], "dNSHostName", NULL);
+	if (str != NULL) {
+		names[1].result_name = talloc_strdup(names, str);
+		W_ERROR_HAVE_NO_MEMORY(names[1].result_name);
+		names[1].status = DRSUAPI_DS_NAME_STATUS_OK;
+	}
+
+	dn = ldb_msg_find_attr_as_dn(sam_ctx, mem_ctx, res->msgs[0], "serverReference");
+	if (dn != NULL) {
+		names[2].result_name = ldb_dn_alloc_linearized(names, dn);
+		W_ERROR_HAVE_NO_MEMORY(names[2].result_name);
+		names[2].status = DRSUAPI_DS_NAME_STATUS_OK;
+	}
+
+	talloc_free(dn);
+	talloc_free(res);
+
+	return WERR_OK;
+}
diff --git a/source4/ldap_server/ldap_server.c b/source4/ldap_server/ldap_server.c
index 886c684..a06feb0 100644
--- a/source4/ldap_server/ldap_server.c
+++ b/source4/ldap_server/ldap_server.c
@@ -99,10 +99,9 @@ static void ldapsrv_terminate_connection_done(struct tevent_req *subreq)
 	struct ldapsrv_connection *conn =
 		tevent_req_callback_data(subreq,
 		struct ldapsrv_connection);
-	int ret;
 	int sys_errno;
 
-	ret = tstream_disconnect_recv(subreq, &sys_errno);
+	tstream_disconnect_recv(subreq, &sys_errno);
 	TALLOC_FREE(subreq);
 
 	if (conn->sockets.active == conn->sockets.raw) {
@@ -218,9 +217,8 @@ static int ldapsrv_load_limits(struct ldapsrv_connection *conn)
 		int policy_value, s;
 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list