s4/libnet: Add "dNSHostName" attribute when joining the Site
authorKamen Mazdrashki <kamenim@samba.org>
Tue, 27 Apr 2010 01:43:26 +0000 (04:43 +0300)
committerKamen Mazdrashki <kamenim@samba.org>
Tue, 27 Apr 2010 01:43:26 +0000 (04:43 +0300)
"dNSHostName" attribute is important part of Server object
and it is Server's recored owner responsibility to maintain
this attribute value.

source4/libnet/libnet_site.c

index 3147cbb0f91e0b03fbd5f369ed13e945c4fbe96f..24311df5a2791c7b8d3f1603ddf689cb61970917 100644 (file)
@@ -153,6 +153,7 @@ NTSTATUS libnet_JoinSite(struct libnet_context *ctx,
        const char *config_dn_str;
        struct nbt_name name;
        const char *dest_addr = NULL;
+       char *dns_host_name;
 
        tmp_ctx = talloc_named(libnet_r, 0, "libnet_JoinSite temp context");
        if (!tmp_ctx) {
@@ -220,6 +221,15 @@ NTSTATUS libnet_JoinSite(struct libnet_context *ctx,
                talloc_free(tmp_ctx);
                return NT_STATUS_NO_MEMORY;
        }
+       dns_host_name = talloc_asprintf(tmp_ctx, "%s.%s",
+                                       libnet_r->in.netbios_name, libnet_r->out.realm);
+       if (!dns_host_name) {
+               r->out.error_string = NULL;
+               talloc_free(tmp_ctx);
+               return NT_STATUS_NO_MEMORY;
+       }
+       strlower_m(dns_host_name);
+       rtn = ldb_msg_add_string(msg, "dNSHostName", dns_host_name);
 
        server_dn = ldb_dn_new(tmp_ctx, remote_ldb, server_dn_str);
        if ( ! ldb_dn_validate(server_dn)) {