implement winbindd_ndr_child_get_domain_info() with DOMAIN_INFO_LEVEL_COMPAT
authorStefan Metzmacher <metze@sernet.de>
Wed, 12 Sep 2007 07:14:03 +0000 (09:14 +0200)
committerStefan Metzmacher <metze@sernet.de>
Thu, 11 Oct 2007 15:21:47 +0000 (17:21 +0200)
metze

source/winbindd/winbindd_dual.c
source/winbindd/winbindd_util.c

index dad9d3c..2092a2f 100644 (file)
@@ -1185,6 +1185,10 @@ static const struct winbind_ndr_cmd {
        void (*fn)(struct winbindd_domain *domain,
                   struct winbindd_cli_state *state);
 } ndr_child_cmd_table[] = {
+       {
+               .opnum  = NDR_WINBIND_GET_DOMAIN_INFO,
+               .fn     = winbindd_ndr_child_get_domain_info
+       }
 };
 
 static void child_reply_ndr_error(struct winbindd_cli_state *state,
index 49d20c5..d45b8ee 100644 (file)
@@ -682,6 +682,50 @@ enum winbindd_result winbindd_dual_init_connection(struct winbindd_domain *domai
        return WINBINDD_OK;
 }
 
+void winbindd_ndr_child_get_domain_info(struct winbindd_domain *domain,
+                                       struct winbindd_cli_state *state)
+{
+       struct winbind_get_domain_info *r;
+
+       r = talloc_get_type_abort(state->c.ndr.r,
+                                 struct winbind_get_domain_info);
+
+       if (r->in.dc_name) {
+               fstrcpy(domain->dcname, r->in.dc_name);
+       }
+
+       init_dc_connection(domain);
+
+       if (!domain->initialized) {
+               /* If we return error here we can't do any cached authentication,
+                  but we may be in disconnected mode and can't initialize correctly.
+                  Do what the previous code did and just return without initialization,
+                  once we go online we'll re-initialize.
+               */
+               DEBUG(5, ("winbindd_ndr_child_get_domain_info: "
+                       "%s returning without initialization online = %d\n",
+                       domain->name, (int)domain->online ));
+       }
+
+       switch (*r->in.level) {
+       case WINBIND_DOMAIN_INFO_LEVEL_COMPAT: {
+               struct winbind_domain_info_compat *compat;
+
+               compat                          = &r->out.domain_info->compat;
+               compat->netbios_name            = domain->name;
+               compat->dns_name                = domain->alt_name;
+               compat->sid                     = &domain->sid;
+               compat->is_native_mode          = domain->native_mode;
+               compat->is_active_directory     = domain->active_directory;
+               compat->is_primary              = domain->primary;
+
+               r->out.result = WINBIND_STATUS_OK;
+               return;
+       }}
+
+       r->out.result = WINBIND_STATUS_UNKNOWN_LEVEL;
+}
+
 /* Look up global info for the winbind daemon */
 BOOL init_domain_list(void)
 {