From 971cc997debc82a86a653757d0fb16c8d748345f Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Mon, 8 Oct 2007 11:15:28 +0000 Subject: r25570: move code of the locator child into its own file metze (This used to be commit 2dbc168e543b84d05b85bc0a44aa8fc10adc4511) --- source3/winbindd/winbindd_locator.c | 90 +++++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 source3/winbindd/winbindd_locator.c (limited to 'source3/winbindd/winbindd_locator.c') diff --git a/source3/winbindd/winbindd_locator.c b/source3/winbindd/winbindd_locator.c new file mode 100644 index 0000000000..52b6dc06f1 --- /dev/null +++ b/source3/winbindd/winbindd_locator.c @@ -0,0 +1,90 @@ +/* + Unix SMB/CIFS implementation. + + Winbind daemon - miscellaneous other functions + + Copyright (C) Tim Potter 2000 + Copyright (C) Andrew Bartlett 2002 + + 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 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include "includes.h" +#include "winbindd.h" + +#undef DBGC_CLASS +#define DBGC_CLASS DBGC_WINBIND + +static struct winbindd_child static_locator_child; + +void init_locator_child(void) +{ + setup_domain_child(NULL, &static_locator_child, "locator"); +} + +struct winbindd_child *locator_child(void) +{ + return &static_locator_child; +} + +void winbindd_dsgetdcname(struct winbindd_cli_state *state) +{ + state->request.domain_name + [sizeof(state->request.domain_name)-1] = '\0'; + + DEBUG(3, ("[%5lu]: DsGetDcName for %s\n", (unsigned long)state->pid, + state->request.domain_name)); + + sendto_child(state, locator_child()); +} + +enum winbindd_result winbindd_dual_dsgetdcname(struct winbindd_domain *domain, + struct winbindd_cli_state *state) +{ + NTSTATUS result; + struct DS_DOMAIN_CONTROLLER_INFO *info = NULL; + const char *dc = NULL; + + state->request.domain_name + [sizeof(state->request.domain_name)-1] = '\0'; + + DEBUG(3, ("[%5lu]: DsGetDcName for %s\n", (unsigned long)state->pid, + state->request.domain_name)); + + result = DsGetDcName(state->mem_ctx, NULL, state->request.domain_name, + NULL, NULL, state->request.flags, &info); + + if (!NT_STATUS_IS_OK(result)) { + return WINBINDD_ERROR; + } + + if (info->domain_controller_address) { + dc = info->domain_controller_address; + if ((dc[0] == '\\') && (dc[1] == '\\')) { + dc += 2; + } + } + + if ((!dc || !is_ipaddress(dc)) && info->domain_controller_name) { + dc = info->domain_controller_name; + } + + if (!dc || !*dc) { + return WINBINDD_ERROR; + } + + fstrcpy(state->response.data.dc_name, dc); + + return WINBINDD_OK; +} -- cgit From 3c3b9afe7f229a69d051db8a08ece6ec9349e0a0 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Mon, 8 Oct 2007 12:25:57 +0000 Subject: r25571: split up child_dispatch_table into domain, idmap and locator tables metze (This used to be commit abbb36a37c1dba2218a6c7ec31739eba5f250127) --- source3/winbindd/winbindd_locator.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'source3/winbindd/winbindd_locator.c') diff --git a/source3/winbindd/winbindd_locator.c b/source3/winbindd/winbindd_locator.c index 52b6dc06f1..ade2c1539b 100644 --- a/source3/winbindd/winbindd_locator.c +++ b/source3/winbindd/winbindd_locator.c @@ -26,11 +26,17 @@ #undef DBGC_CLASS #define DBGC_CLASS DBGC_WINBIND + +static const struct winbindd_child_dispatch_table locator_dispatch_table[]; + static struct winbindd_child static_locator_child; void init_locator_child(void) { - setup_domain_child(NULL, &static_locator_child, "locator"); + setup_domain_child(NULL, + &static_locator_child, + locator_dispatch_table, + "locator"); } struct winbindd_child *locator_child(void) @@ -49,8 +55,8 @@ void winbindd_dsgetdcname(struct winbindd_cli_state *state) sendto_child(state, locator_child()); } -enum winbindd_result winbindd_dual_dsgetdcname(struct winbindd_domain *domain, - struct winbindd_cli_state *state) +static enum winbindd_result dual_dsgetdcname(struct winbindd_domain *domain, + struct winbindd_cli_state *state) { NTSTATUS result; struct DS_DOMAIN_CONTROLLER_INFO *info = NULL; @@ -88,3 +94,9 @@ enum winbindd_result winbindd_dual_dsgetdcname(struct winbindd_domain *domain, return WINBINDD_OK; } + +static const struct winbindd_child_dispatch_table locator_dispatch_table[] = { + { WINBINDD_DSGETDCNAME, dual_dsgetdcname, "DSGETDCNAME" }, + + { WINBINDD_NUM_CMDS, NULL, "NONE" } +}; -- cgit From e5a951325a6cac8567af3a66de6d2df577508ae4 Mon Sep 17 00:00:00 2001 From: "Gerald (Jerry) Carter" Date: Wed, 10 Oct 2007 15:34:30 -0500 Subject: [GLUE] Rsync SAMBA_3_2_0 SVN r25598 in order to create the v3-2-test branch. (This used to be commit 5c6c8e1fe93f340005110a7833946191659d88ab) --- source3/winbindd/winbindd_locator.c | 102 ------------------------------------ 1 file changed, 102 deletions(-) delete mode 100644 source3/winbindd/winbindd_locator.c (limited to 'source3/winbindd/winbindd_locator.c') diff --git a/source3/winbindd/winbindd_locator.c b/source3/winbindd/winbindd_locator.c deleted file mode 100644 index ade2c1539b..0000000000 --- a/source3/winbindd/winbindd_locator.c +++ /dev/null @@ -1,102 +0,0 @@ -/* - Unix SMB/CIFS implementation. - - Winbind daemon - miscellaneous other functions - - Copyright (C) Tim Potter 2000 - Copyright (C) Andrew Bartlett 2002 - - 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 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -#include "includes.h" -#include "winbindd.h" - -#undef DBGC_CLASS -#define DBGC_CLASS DBGC_WINBIND - - -static const struct winbindd_child_dispatch_table locator_dispatch_table[]; - -static struct winbindd_child static_locator_child; - -void init_locator_child(void) -{ - setup_domain_child(NULL, - &static_locator_child, - locator_dispatch_table, - "locator"); -} - -struct winbindd_child *locator_child(void) -{ - return &static_locator_child; -} - -void winbindd_dsgetdcname(struct winbindd_cli_state *state) -{ - state->request.domain_name - [sizeof(state->request.domain_name)-1] = '\0'; - - DEBUG(3, ("[%5lu]: DsGetDcName for %s\n", (unsigned long)state->pid, - state->request.domain_name)); - - sendto_child(state, locator_child()); -} - -static enum winbindd_result dual_dsgetdcname(struct winbindd_domain *domain, - struct winbindd_cli_state *state) -{ - NTSTATUS result; - struct DS_DOMAIN_CONTROLLER_INFO *info = NULL; - const char *dc = NULL; - - state->request.domain_name - [sizeof(state->request.domain_name)-1] = '\0'; - - DEBUG(3, ("[%5lu]: DsGetDcName for %s\n", (unsigned long)state->pid, - state->request.domain_name)); - - result = DsGetDcName(state->mem_ctx, NULL, state->request.domain_name, - NULL, NULL, state->request.flags, &info); - - if (!NT_STATUS_IS_OK(result)) { - return WINBINDD_ERROR; - } - - if (info->domain_controller_address) { - dc = info->domain_controller_address; - if ((dc[0] == '\\') && (dc[1] == '\\')) { - dc += 2; - } - } - - if ((!dc || !is_ipaddress(dc)) && info->domain_controller_name) { - dc = info->domain_controller_name; - } - - if (!dc || !*dc) { - return WINBINDD_ERROR; - } - - fstrcpy(state->response.data.dc_name, dc); - - return WINBINDD_OK; -} - -static const struct winbindd_child_dispatch_table locator_dispatch_table[] = { - { WINBINDD_DSGETDCNAME, dual_dsgetdcname, "DSGETDCNAME" }, - - { WINBINDD_NUM_CMDS, NULL, "NONE" } -}; -- cgit From 6ded271f7719483faee19aba502d787a279c1689 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Mon, 8 Oct 2007 11:15:28 +0000 Subject: r25570: move code of the locator child into its own file metze (This used to be commit 56640908a6367acfdfd53568a0d329c13330e5eb) --- source3/winbindd/winbindd_locator.c | 90 +++++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 source3/winbindd/winbindd_locator.c (limited to 'source3/winbindd/winbindd_locator.c') diff --git a/source3/winbindd/winbindd_locator.c b/source3/winbindd/winbindd_locator.c new file mode 100644 index 0000000000..3fcb9de7a8 --- /dev/null +++ b/source3/winbindd/winbindd_locator.c @@ -0,0 +1,90 @@ +/* + Unix SMB/CIFS implementation. + + Winbind daemon - miscellaneous other functions + + Copyright (C) Tim Potter 2000 + Copyright (C) Andrew Bartlett 2002 + + 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 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include "includes.h" +#include "winbindd.h" + +#undef DBGC_CLASS +#define DBGC_CLASS DBGC_WINBIND + +static struct winbindd_child static_locator_child; + +void init_locator_child(void) +{ + setup_domain_child(NULL, &static_locator_child, "locator"); +} + +struct winbindd_child *locator_child(void) +{ + return &static_locator_child; +} + +void winbindd_dsgetdcname(struct winbindd_cli_state *state) +{ + state->request.domain_name + [sizeof(state->request.domain_name)-1] = '\0'; + + DEBUG(3, ("[%5lu]: DsGetDcName for %s\n", (unsigned long)state->pid, + state->request.domain_name)); + + sendto_child(state, locator_child()); +} + +enum winbindd_result winbindd_dual_dsgetdcname(struct winbindd_domain *domain, + struct winbindd_cli_state *state) +{ + NTSTATUS result; + struct DS_DOMAIN_CONTROLLER_INFO *info = NULL; + const char *dc = NULL; + + state->request.domain_name + [sizeof(state->request.domain_name)-1] = '\0'; + + DEBUG(3, ("[%5lu]: DsGetDcName for %s\n", (unsigned long)state->pid, + state->request.domain_name)); + + result = DsGetDcName(state->mem_ctx, NULL, state->request.domain_name, + NULL, NULL, state->request.flags, &info); + + if (!NT_STATUS_IS_OK(result)) { + return WINBINDD_ERROR; + } + + if (info->domain_controller_address) { + dc = info->domain_controller_address; + if ((dc[0] == '\\') && (dc[1] == '\\')) { + dc += 2; + } + } + + if ((!dc || !is_ipaddress_v4(dc)) && info->domain_controller_name) { + dc = info->domain_controller_name; + } + + if (!dc || !*dc) { + return WINBINDD_ERROR; + } + + fstrcpy(state->response.data.dc_name, dc); + + return WINBINDD_OK; +} -- cgit From 3d9a578064d46e595a51af5896a51db47bd2da4e Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Mon, 8 Oct 2007 12:25:57 +0000 Subject: r25571: split up child_dispatch_table into domain, idmap and locator tables metze (cherry picked from commit abbb36a37c1dba2218a6c7ec31739eba5f250127) (This used to be commit 5af1b45ed31043f952ec141d0f5f2973aec69d1a) --- source3/winbindd/winbindd_locator.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'source3/winbindd/winbindd_locator.c') diff --git a/source3/winbindd/winbindd_locator.c b/source3/winbindd/winbindd_locator.c index 3fcb9de7a8..7db2e2ada0 100644 --- a/source3/winbindd/winbindd_locator.c +++ b/source3/winbindd/winbindd_locator.c @@ -26,11 +26,17 @@ #undef DBGC_CLASS #define DBGC_CLASS DBGC_WINBIND + +static const struct winbindd_child_dispatch_table locator_dispatch_table[]; + static struct winbindd_child static_locator_child; void init_locator_child(void) { - setup_domain_child(NULL, &static_locator_child, "locator"); + setup_domain_child(NULL, + &static_locator_child, + locator_dispatch_table, + "locator"); } struct winbindd_child *locator_child(void) @@ -49,8 +55,8 @@ void winbindd_dsgetdcname(struct winbindd_cli_state *state) sendto_child(state, locator_child()); } -enum winbindd_result winbindd_dual_dsgetdcname(struct winbindd_domain *domain, - struct winbindd_cli_state *state) +static enum winbindd_result dual_dsgetdcname(struct winbindd_domain *domain, + struct winbindd_cli_state *state) { NTSTATUS result; struct DS_DOMAIN_CONTROLLER_INFO *info = NULL; @@ -88,3 +94,9 @@ enum winbindd_result winbindd_dual_dsgetdcname(struct winbindd_domain *domain, return WINBINDD_OK; } + +static const struct winbindd_child_dispatch_table locator_dispatch_table[] = { + { WINBINDD_DSGETDCNAME, dual_dsgetdcname, "DSGETDCNAME" }, + + { WINBINDD_NUM_CMDS, NULL, "NONE" } +}; -- cgit From 35608af51d4f01c5fe4ed1d91c9261dcaa49f4af Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 7 Dec 2007 16:00:45 +0100 Subject: winbindd: rename child table struct elements Add struct_ prefix to struct based protocol specific elemetens struct winbindd_child_dispatch_table. metze (This used to be commit 4ab9a8aab72a8406659a72e87b2d2a1ec2a2eabf) --- source3/winbindd/winbindd_locator.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'source3/winbindd/winbindd_locator.c') diff --git a/source3/winbindd/winbindd_locator.c b/source3/winbindd/winbindd_locator.c index 7db2e2ada0..67bafc7c07 100644 --- a/source3/winbindd/winbindd_locator.c +++ b/source3/winbindd/winbindd_locator.c @@ -96,7 +96,11 @@ static enum winbindd_result dual_dsgetdcname(struct winbindd_domain *domain, } static const struct winbindd_child_dispatch_table locator_dispatch_table[] = { - { WINBINDD_DSGETDCNAME, dual_dsgetdcname, "DSGETDCNAME" }, - - { WINBINDD_NUM_CMDS, NULL, "NONE" } + { + .name = "DSGETDCNAME", + .struct_cmd = WINBINDD_DSGETDCNAME, + .struct_fn = dual_dsgetdcname, + },{ + .name = NULL, + } }; -- cgit From 873f14ae408d5fa151f8e4f83c3dfe0c9b8a4d2d Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 13 Dec 2007 12:27:57 +0100 Subject: winbindd: move domain child specific stuff into its own file metze (This used to be commit 075d315e0f72d506b70040da10940e4af131b4e2) --- source3/winbindd/winbindd_locator.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'source3/winbindd/winbindd_locator.c') diff --git a/source3/winbindd/winbindd_locator.c b/source3/winbindd/winbindd_locator.c index 67bafc7c07..ee497ebf32 100644 --- a/source3/winbindd/winbindd_locator.c +++ b/source3/winbindd/winbindd_locator.c @@ -33,10 +33,9 @@ static struct winbindd_child static_locator_child; void init_locator_child(void) { - setup_domain_child(NULL, - &static_locator_child, - locator_dispatch_table, - "locator"); + setup_child(&static_locator_child, + locator_dispatch_table, + "log.winbindd", "locator"); } struct winbindd_child *locator_child(void) -- cgit From c79ce2ffa3f7d00ce6a2cd6008c203e3042b0b02 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 11 Jan 2008 15:32:20 +0100 Subject: As long as DsGetDcName is not part of libnetapi, lowercase the fn name. Guenther (This used to be commit 19a980f52044a170618629e5b0484c1f6b586e5f) --- source3/winbindd/winbindd_locator.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source3/winbindd/winbindd_locator.c') diff --git a/source3/winbindd/winbindd_locator.c b/source3/winbindd/winbindd_locator.c index ee497ebf32..05bd74af25 100644 --- a/source3/winbindd/winbindd_locator.c +++ b/source3/winbindd/winbindd_locator.c @@ -48,7 +48,7 @@ void winbindd_dsgetdcname(struct winbindd_cli_state *state) state->request.domain_name [sizeof(state->request.domain_name)-1] = '\0'; - DEBUG(3, ("[%5lu]: DsGetDcName for %s\n", (unsigned long)state->pid, + DEBUG(3, ("[%5lu]: dsgetdcname for %s\n", (unsigned long)state->pid, state->request.domain_name)); sendto_child(state, locator_child()); @@ -64,10 +64,10 @@ static enum winbindd_result dual_dsgetdcname(struct winbindd_domain *domain, state->request.domain_name [sizeof(state->request.domain_name)-1] = '\0'; - DEBUG(3, ("[%5lu]: DsGetDcName for %s\n", (unsigned long)state->pid, + DEBUG(3, ("[%5lu]: dsgetdcname for %s\n", (unsigned long)state->pid, state->request.domain_name)); - result = DsGetDcName(state->mem_ctx, NULL, state->request.domain_name, + result = dsgetdcname(state->mem_ctx, NULL, state->request.domain_name, NULL, NULL, state->request.flags, &info); if (!NT_STATUS_IS_OK(result)) { -- cgit From 5ab43ae0d8e66a1fd4c877089df52282367be7dd Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Sat, 26 Jan 2008 01:39:33 +0100 Subject: Eliminate remote tree of dsgetdcname (which will happen in libnetapi then). Guenther (This used to be commit fd490d236b1fb73a75c457b75128c9b98719418f) --- source3/winbindd/winbindd_locator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/winbindd/winbindd_locator.c') diff --git a/source3/winbindd/winbindd_locator.c b/source3/winbindd/winbindd_locator.c index 05bd74af25..6b1cff99e0 100644 --- a/source3/winbindd/winbindd_locator.c +++ b/source3/winbindd/winbindd_locator.c @@ -67,7 +67,7 @@ static enum winbindd_result dual_dsgetdcname(struct winbindd_domain *domain, DEBUG(3, ("[%5lu]: dsgetdcname for %s\n", (unsigned long)state->pid, state->request.domain_name)); - result = dsgetdcname(state->mem_ctx, NULL, state->request.domain_name, + result = dsgetdcname(state->mem_ctx, state->request.domain_name, NULL, NULL, state->request.flags, &info); if (!NT_STATUS_IS_OK(result)) { -- cgit From 0d8985f2da43d35d8f940af112ad74a199778dd8 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 28 Feb 2008 12:30:18 +0100 Subject: Let dsgetdcname() return a struct netr_DsRGetDCNameInfo. Guenther (This used to be commit b1a4b21f8c35dc23e5c986ebe44d3806055eb39b) --- source3/winbindd/winbindd_locator.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'source3/winbindd/winbindd_locator.c') diff --git a/source3/winbindd/winbindd_locator.c b/source3/winbindd/winbindd_locator.c index 6b1cff99e0..10a6c5afeb 100644 --- a/source3/winbindd/winbindd_locator.c +++ b/source3/winbindd/winbindd_locator.c @@ -58,7 +58,7 @@ static enum winbindd_result dual_dsgetdcname(struct winbindd_domain *domain, struct winbindd_cli_state *state) { NTSTATUS result; - struct DS_DOMAIN_CONTROLLER_INFO *info = NULL; + struct netr_DsRGetDCNameInfo *info = NULL; const char *dc = NULL; state->request.domain_name @@ -74,15 +74,15 @@ static enum winbindd_result dual_dsgetdcname(struct winbindd_domain *domain, return WINBINDD_ERROR; } - if (info->domain_controller_address) { - dc = info->domain_controller_address; + if (info->dc_address) { + dc = info->dc_address; if ((dc[0] == '\\') && (dc[1] == '\\')) { dc += 2; } } - if ((!dc || !is_ipaddress_v4(dc)) && info->domain_controller_name) { - dc = info->domain_controller_name; + if ((!dc || !is_ipaddress_v4(dc)) && info->dc_unc) { + dc = info->dc_unc; } if (!dc || !*dc) { -- cgit From f11acf358225ecf10a8af2a12e304019adc6ee4f Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 8 May 2008 14:23:20 +0200 Subject: Use strip_hostname after dsgetdcname/getdcname calls. Guenther (This used to be commit 82cbb3269b2e764c9c2a2fbcbe9c29feae07fb62) --- source3/winbindd/winbindd_locator.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'source3/winbindd/winbindd_locator.c') diff --git a/source3/winbindd/winbindd_locator.c b/source3/winbindd/winbindd_locator.c index 10a6c5afeb..f154f36c85 100644 --- a/source3/winbindd/winbindd_locator.c +++ b/source3/winbindd/winbindd_locator.c @@ -75,14 +75,11 @@ static enum winbindd_result dual_dsgetdcname(struct winbindd_domain *domain, } if (info->dc_address) { - dc = info->dc_address; - if ((dc[0] == '\\') && (dc[1] == '\\')) { - dc += 2; - } + dc = strip_hostname(info->dc_address); } if ((!dc || !is_ipaddress_v4(dc)) && info->dc_unc) { - dc = info->dc_unc; + dc = strip_hostname(info->dc_unc); } if (!dc || !*dc) { -- cgit From 67c644aa591c051cfe1e3f3536186ecf0b4449f2 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 8 May 2008 18:32:22 +0200 Subject: dsgetdcname: use existing messaging_context if possible. Guenther (This used to be commit 7889516a384c155a9045aad4409c041fddd0d98d) --- source3/winbindd/winbindd_locator.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source3/winbindd/winbindd_locator.c') diff --git a/source3/winbindd/winbindd_locator.c b/source3/winbindd/winbindd_locator.c index f154f36c85..709fbcc5d1 100644 --- a/source3/winbindd/winbindd_locator.c +++ b/source3/winbindd/winbindd_locator.c @@ -67,7 +67,8 @@ static enum winbindd_result dual_dsgetdcname(struct winbindd_domain *domain, DEBUG(3, ("[%5lu]: dsgetdcname for %s\n", (unsigned long)state->pid, state->request.domain_name)); - result = dsgetdcname(state->mem_ctx, state->request.domain_name, + result = dsgetdcname(state->mem_ctx, winbind_messaging_context(), + state->request.domain_name, NULL, NULL, state->request.flags, &info); if (!NT_STATUS_IS_OK(result)) { -- cgit From 34933a5c236ee489e4c11172820cdc0496b9e334 Mon Sep 17 00:00:00 2001 From: coffeedude Date: Tue, 13 May 2008 12:58:52 -0500 Subject: libwbclient: Abstract the DS_XXX flags for DsGetDcName(). The wbcLookupDomainController() call supports a set of flags defined in wbclient.h. Add a mapping function between these flags and the original DS_XXX flags in order to prevent having to include the generated RPC headers in wbclient.h. (This used to be commit 31614cd5e08dd6389c66e6ddf9f2d5429c6ab033) --- source3/winbindd/winbindd_locator.c | 46 ++++++++++++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) (limited to 'source3/winbindd/winbindd_locator.c') diff --git a/source3/winbindd/winbindd_locator.c b/source3/winbindd/winbindd_locator.c index 709fbcc5d1..b2a8bd7e30 100644 --- a/source3/winbindd/winbindd_locator.c +++ b/source3/winbindd/winbindd_locator.c @@ -54,12 +54,54 @@ void winbindd_dsgetdcname(struct winbindd_cli_state *state) sendto_child(state, locator_child()); } +struct wbc_flag_map { + uint32_t wbc_dc_flag; + uint32_t ds_dc_flags; +}; + +static uint32_t get_dsgetdc_flags(uint32_t wbc_flags) +{ + struct wbc_flag_map lookup_dc_flags[] = { + { WBC_LOOKUP_DC_FORCE_REDISCOVERY, DS_FORCE_REDISCOVERY }, + { WBC_LOOKUP_DC_DS_REQUIRED, DS_DIRECTORY_SERVICE_REQUIRED }, + { WBC_LOOKUP_DC_DS_PREFERRED, DS_DIRECTORY_SERVICE_PREFERRED}, + { WBC_LOOKUP_DC_GC_SERVER_REQUIRED, DS_GC_SERVER_REQUIRED }, + { WBC_LOOKUP_DC_PDC_REQUIRED, DS_PDC_REQUIRED}, + { WBC_LOOKUP_DC_BACKGROUND_ONLY, DS_BACKGROUND_ONLY }, + { WBC_LOOKUP_DC_IP_REQUIRED, DS_IP_REQUIRED }, + { WBC_LOOKUP_DC_KDC_REQUIRED, DS_KDC_REQUIRED }, + { WBC_LOOKUP_DC_TIMESERV_REQUIRED, DS_TIMESERV_REQUIRED }, + { WBC_LOOKUP_DC_WRITABLE_REQUIRED, DS_WRITABLE_REQUIRED }, + { WBC_LOOKUP_DC_GOOD_TIMESERV_PREFERRED, DS_GOOD_TIMESERV_PREFERRED }, + { WBC_LOOKUP_DC_AVOID_SELF, DS_AVOID_SELF }, + { WBC_LOOKUP_DC_ONLY_LDAP_NEEDED, DS_ONLY_LDAP_NEEDED }, + { WBC_LOOKUP_DC_IS_FLAT_NAME, DS_IS_FLAT_NAME }, + { WBC_LOOKUP_DC_IS_DNS_NAME, DS_IS_DNS_NAME }, + { WBC_LOOKUP_DC_TRY_NEXTCLOSEST_SITE, DS_TRY_NEXTCLOSEST_SITE }, + { WBC_LOOKUP_DC_DS_6_REQUIRED, DS_DIRECTORY_SERVICE_6_REQUIRED }, + { WBC_LOOKUP_DC_RETURN_DNS_NAME, DS_RETURN_DNS_NAME }, + { WBC_LOOKUP_DC_RETURN_FLAT_NAME, DS_RETURN_FLAT_NAME } + }; + uint32_t ds_flags = 0; + int i = 0 ; + int num_entries = sizeof(lookup_dc_flags) / sizeof(struct wbc_flag_map); + + for (i=0; irequest.domain_name [sizeof(state->request.domain_name)-1] = '\0'; @@ -67,9 +109,11 @@ static enum winbindd_result dual_dsgetdcname(struct winbindd_domain *domain, DEBUG(3, ("[%5lu]: dsgetdcname for %s\n", (unsigned long)state->pid, state->request.domain_name)); + ds_flags = get_dsgetdc_flags(state->request.flags); + result = dsgetdcname(state->mem_ctx, winbind_messaging_context(), state->request.domain_name, - NULL, NULL, state->request.flags, &info); + NULL, NULL, ds_flags, &info); if (!NT_STATUS_IS_OK(result)) { return WINBINDD_ERROR; -- cgit