[SCM] Samba Shared Repository - branch v3-3-test updated - release-3-2-0pre2-2320-g3feaa98

Günther Deschner gd at samba.org
Wed May 7 08:43:33 GMT 2008


The branch, v3-3-test has been updated
       via  3feaa9829cc5bdeb7a5401c3c24b3811816396ce (commit)
       via  5bf47ebf0fb9f7d94ed36bce6bcaa31b508009bd (commit)
      from  ec2d301a7aac173aba41dd2074037f27d05095ce (commit)

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


- Log -----------------------------------------------------------------
commit 3feaa9829cc5bdeb7a5401c3c24b3811816396ce
Author: Günther Deschner <gd at samba.org>
Date:   Tue May 6 17:09:44 2008 +0200

    netapi: add -f switch for DsGetDCName() example and be more verbose on output.
    
    Guenther

commit 5bf47ebf0fb9f7d94ed36bce6bcaa31b508009bd
Author: Günther Deschner <gd at samba.org>
Date:   Tue May 6 17:02:31 2008 +0200

    wins: fix null pointer crash in nss_wins module.
    
    Guenther

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

Summary of changes:
 source/lib/netapi/examples/dsgetdc/dsgetdc.c |   18 +++++++++++++++---
 source/nsswitch/wins.c                       |    3 +++
 2 files changed, 18 insertions(+), 3 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/lib/netapi/examples/dsgetdc/dsgetdc.c b/source/lib/netapi/examples/dsgetdc/dsgetdc.c
index 7c0ec4d..6265e66 100644
--- a/source/lib/netapi/examples/dsgetdc/dsgetdc.c
+++ b/source/lib/netapi/examples/dsgetdc/dsgetdc.c
@@ -34,6 +34,7 @@ int main(int argc, const char **argv)
 
 	const char *hostname = NULL;
 	const char *domain = NULL;
+	uint32_t flags = 0;
 	struct DOMAIN_CONTROLLER_INFO *info = NULL;
 
 	poptContext pc;
@@ -42,6 +43,7 @@ int main(int argc, const char **argv)
 	struct poptOption long_options[] = {
 		POPT_AUTOHELP
 		POPT_COMMON_LIBNETAPI_EXAMPLES
+		{ "flags", 0, POPT_ARG_INT, NULL, 'f', "Query flags", "FLAGS" },
 		POPT_TABLEEND
 	};
 
@@ -54,6 +56,10 @@ int main(int argc, const char **argv)
 
 	poptSetOtherOptionHelp(pc, "hostname domainname");
 	while((opt = poptGetNextOpt(pc)) != -1) {
+		switch (opt) {
+			case 'f':
+				sscanf(poptGetOptArg(pc), "%x", &flags);
+		}
 	}
 
 	if (!poptPeekArg(pc)) {
@@ -70,15 +76,21 @@ int main(int argc, const char **argv)
 
 	/* DsGetDcName */
 
-	status = DsGetDcName(hostname, domain, NULL, NULL, 0, &info);
+	status = DsGetDcName(hostname, domain, NULL, NULL, flags, &info);
 	if (status != 0) {
 		printf("DsGetDcName failed with: %s\n",
 			libnetapi_errstr(status));
 		return status;
 	}
 
-	printf("domain %s has name: %s\n",
-		info->domain_name, info->domain_controller_name);
+	printf("DC Name:\t\t%s\n", info->domain_controller_name);
+	printf("DC Address:\t\t%s\n", info->domain_controller_address);
+	printf("DC Address Type:\t%d\n", info->domain_controller_address_type);
+	printf("Domain Name:\t\t%s\n", info->domain_name);
+	printf("DNS Forest Name:\t%s\n", info->dns_forest_name);
+	printf("DC flags:\t\t0x%08x\n", info->flags);
+	printf("DC Sitename:\t\t%s\n", info->dc_site_name);
+	printf("Client Sitename:\t%s\n", info->client_site_name);
 
  out:
 	NetApiBufferFree(info);
diff --git a/source/nsswitch/wins.c b/source/nsswitch/wins.c
index 36415c4..7d42381 100644
--- a/source/nsswitch/wins.c
+++ b/source/nsswitch/wins.c
@@ -140,6 +140,9 @@ static struct in_addr *lookup_byname_backend(const char *name, int *count)
 		in_addr_to_sockaddr_storage(&ss, *bcast);
 		pss = name_query(fd,name,0x00,True,True,&ss,count, &flags, NULL);
 		if (pss) {
+			if ((ret = SMB_MALLOC_P(struct in_addr)) == NULL) {
+				return NULL;
+			}
 			*ret = ((struct sockaddr_in *)pss)->sin_addr;
 			break;
 		}


-- 
Samba Shared Repository


More information about the samba-cvs mailing list