This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
+ the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
void winbindd_list_trusted_domains(struct winbindd_cli_state *state)
{
+ struct winbindd_domain *d = NULL;
+ int extra_data_len = 0;
+ char *extra_data = NULL;
+
DEBUG(3, ("[%5lu]: list trusted domains\n",
(unsigned long)state->pid));
- sendto_domain(state, find_our_domain());
+ for ( d=domain_list(); d; d=d->next ) {
+ if ( !extra_data ) {
+ extra_data = talloc_asprintf(state->mem_ctx, "%s\\%s\\%s",
+ d->name,
+ d->alt_name ? d->alt_name : d->name,
+ sid_string_static(&d->sid));
+ } else {
+ extra_data = talloc_asprintf(state->mem_ctx, "%s\n%s\\%s\\%s",
+ extra_data,
+ d->name,
+ d->alt_name ? d->alt_name : d->name,
+ sid_string_static(&d->sid));
+ }
+ }
+
+ extra_data_len = 0;
+ if (extra_data != NULL) {
+ extra_data_len = strlen(extra_data);
+ }
+
+ if (extra_data_len > 0) {
+ state->response.extra_data.data = SMB_STRDUP(extra_data);
+ state->response.length += extra_data_len+1;
+ }
+
+ TALLOC_FREE( extra_data );
+
+ request_ok(state);
}
enum winbindd_result winbindd_dual_list_trusted_domains(struct winbindd_domain *domain,
&num_domains, &names,
&alt_names, &sids);
+ if (!NT_STATUS_IS_OK(result)) {
+ DEBUG(3, ("winbindd_dual_list_trusted_domains: trusted_domains returned %s\n",
+ nt_errstr(result) ));
+ return WINBINDD_ERROR;
+ }
+
extra_data = talloc_strdup(state->mem_ctx, "");
if (num_domains > 0)
char *p;
struct rpc_pipe_client *netlogon_pipe;
NTSTATUS result;
+ WERROR werr;
+ unsigned int orig_timeout;
state->request.domain_name
[sizeof(state->request.domain_name)-1] = '\0';
return WINBINDD_ERROR;
}
- result = rpccli_netlogon_getdcname(netlogon_pipe, state->mem_ctx, domain->dcname,
- state->request.domain_name,
- dcname_slash);
+ /* This call can take a long time - allow the server to time out.
+ 35 seconds should do it. */
- if (!NT_STATUS_IS_OK(result)) {
- DEBUG(5, ("Error requesting DCname: %s\n", nt_errstr(result)));
+ orig_timeout = cli_set_timeout(netlogon_pipe->cli, 35000);
+
+ werr = rpccli_netlogon_getanydcname(netlogon_pipe, state->mem_ctx, domain->dcname,
+ state->request.domain_name,
+ dcname_slash);
+ /* And restore our original timeout. */
+ cli_set_timeout(netlogon_pipe->cli, orig_timeout);
+
+ if (!W_ERROR_IS_OK(werr)) {
+ DEBUG(5, ("Error requesting DCname: %s\n", dos_errstr(werr)));
return WINBINDD_ERROR;
}
static void sequence_recv(void *private_data, BOOL success)
{
- struct sequence_state *state = private_data;
+ struct sequence_state *state =
+ (struct sequence_state *)private_data;
uint32 seq = DOM_SEQUENCE_NONE;
if ((success) && (state->response->result == WINBINDD_OK))
static void domain_info_init_recv(void *private_data, BOOL success)
{
- struct domain_info_state *istate = private_data;
+ struct domain_info_state *istate =
+ (struct domain_info_state *)private_data;
struct winbindd_cli_state *state = istate->cli_state;
struct winbindd_domain *domain = istate->domain;