The branch, v3-2-test has been updated
       via  65d3822182a4a4d1c2970a40e708844ddc319e3d (commit)
       via  d4984ac18a907773134cc906c689655338d3949e (commit)
      from  8476d8a6f21f31dfa75bbed86ab956c9397182b3 (commit)

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


- Log -----------------------------------------------------------------
commit 65d3822182a4a4d1c2970a40e708844ddc319e3d
Author: Günther Deschner <[EMAIL PROTECTED]>
Date:   Tue May 6 17:09:44 2008 +0200

    netapi: add -f switch for DsGetDCName() example and be more verbose on 
output.
    
    Guenther
    (cherry picked from commit 3feaa9829cc5bdeb7a5401c3c24b3811816396ce)

commit d4984ac18a907773134cc906c689655338d3949e
Author: Günther Deschner <[EMAIL PROTECTED]>
Date:   Tue May 6 17:02:31 2008 +0200

    wins: fix null pointer crash in nss_wins module.
    
    Guenther
    (cherry picked from commit 5bf47ebf0fb9f7d94ed36bce6bcaa31b508009bd)

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

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

Reply via email to