Fix immediate bug where the idmap can't tell the difference between an entry
[ira/wip.git] / source3 / nsswitch / winbindd_misc.c
index d656c3ca4d7cdfb1f1f2140371055d2190fe67a5..8d7cdc4731721194a0e1a179d1940c7ac98fc651 100644 (file)
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_WINBIND
 
-/************************************************************************
- Routine to get the trust account password for a domain
-************************************************************************/
-static BOOL _get_trust_account_password(const char *domain, unsigned char *ret_pwd, 
-                                       time_t *pass_last_set_time)
-{
-       if (!secrets_fetch_trust_account_password(domain, ret_pwd, pass_last_set_time)) {
-                return False;
-       }
-
-       return True;
-}
-
 /* Check the machine account password is valid */
 
 enum winbindd_result winbindd_check_machine_acct(struct winbindd_cli_state *state)
@@ -47,13 +34,14 @@ enum winbindd_result winbindd_check_machine_acct(struct winbindd_cli_state *stat
        uchar trust_passwd[16];
         int num_retries = 0;
         struct cli_state *cli;
+       uint32 sec_channel_type;
        DEBUG(3, ("[%5d]: check machine account\n", state->pid));
 
        /* Get trust account password */
 
  again:
-       if (!_get_trust_account_password(lp_workgroup(), trust_passwd, 
-                                         NULL)) {
+       if (!secrets_fetch_trust_account_password(
+                   lp_workgroup(), trust_passwd, NULL, &sec_channel_type)) {
                result = NT_STATUS_INTERNAL_ERROR;
                goto done;
        }
@@ -62,7 +50,7 @@ enum winbindd_result winbindd_check_machine_acct(struct winbindd_cli_state *stat
            the trust account password. */
 
        /* Don't shut this down - it belongs to the connection cache code */
-        result = cm_get_netlogon_cli(lp_workgroup(), trust_passwd, &cli);
+        result = cm_get_netlogon_cli(lp_workgroup(), trust_passwd, sec_channel_type, True, &cli);
 
         if (!NT_STATUS_IS_OK(result)) {
                 DEBUG(3, ("could not open handle to NETLOGON pipe\n"));
@@ -113,7 +101,11 @@ enum winbindd_result winbindd_list_trusted_domains(struct winbindd_cli_state
           have changed since we last looked.  There may be a sequence
           number or something we should use but I haven't found it yet. */
 
-       init_domain_list();
+       if (!init_domain_list()) {
+               DEBUG(1, ("winbindd_list_trusted_domains: could not "
+                         "refresh trusted domain list\n"));
+               return WINBINDD_ERROR;
+       }
 
        for(domain = domain_list(); domain; domain = domain->next) {
 
@@ -230,3 +222,32 @@ enum winbindd_result winbindd_domain_name(struct winbindd_cli_state *state)
 
        return WINBINDD_OK;
 }
+
+/* What's my name again? */
+
+enum winbindd_result winbindd_netbios_name(struct winbindd_cli_state *state)
+{
+
+       DEBUG(3, ("[%5d]: request netbios name\n", state->pid));
+       
+       fstrcpy(state->response.data.netbios_name, global_myname());
+
+       return WINBINDD_OK;
+}
+
+/* Where can I find the privilaged pipe? */
+
+enum winbindd_result winbindd_priv_pipe_dir(struct winbindd_cli_state *state)
+{
+
+       DEBUG(3, ("[%5d]: request location of privileged pipe\n", state->pid));
+       
+       state->response.extra_data = strdup(get_winbind_priv_pipe_dir());
+       if (!state->response.extra_data)
+               return WINBINDD_ERROR;
+
+       /* must add one to length to copy the 0 for string termination */
+       state->response.length += strlen((char *)state->response.extra_data) + 1;
+
+       return WINBINDD_OK;
+}