summaryrefslogtreecommitdiff
path: root/source3/nsswitch
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2008-03-28 16:55:53 +0100
committerStefan Metzmacher <metze@samba.org>2008-04-01 18:30:10 +0200
commit175622fa58b2c9a0e3afaf3d5045ee4f569bf508 (patch)
treef761280f4993fa1fc0895d81b3d4c56147c9569c /source3/nsswitch
parent949a3823f2e24f5e465d7dc6256ee29de0914153 (diff)
downloadsamba-175622fa58b2c9a0e3afaf3d5045ee4f569bf508.tar.gz
samba-175622fa58b2c9a0e3afaf3d5045ee4f569bf508.tar.bz2
samba-175622fa58b2c9a0e3afaf3d5045ee4f569bf508.zip
wbinfo: use wbcInterfaceDetails()
metze (This used to be commit ff87260f1268d190170608b0808c191ef8f3e942)
Diffstat (limited to 'source3/nsswitch')
-rw-r--r--source3/nsswitch/wbinfo.c44
1 files changed, 25 insertions, 19 deletions
diff --git a/source3/nsswitch/wbinfo.c b/source3/nsswitch/wbinfo.c
index d62e82a659..6707f9d927 100644
--- a/source3/nsswitch/wbinfo.c
+++ b/source3/nsswitch/wbinfo.c
@@ -27,21 +27,35 @@
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_WINBIND
+static struct wbcInterfaceDetails *init_interface_details(void)
+{
+ wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
+ static struct wbcInterfaceDetails *details;
+
+ if (details) {
+ return details;
+ }
+
+ wbc_status = wbcInterfaceDetails(&details);
+ if (!WBC_ERROR_IS_OK(wbc_status)) {
+ d_fprintf(stderr, "could not obtain winbind interface details!\n");
+ }
+
+ return details;
+}
+
static char winbind_separator_int(bool strict)
{
- struct winbindd_response response;
+ struct wbcInterfaceDetails *details;
static bool got_sep;
static char sep;
if (got_sep)
return sep;
- ZERO_STRUCT(response);
-
- /* Send off request */
+ details = init_interface_details();
- if (winbindd_request_response(WINBINDD_INFO, NULL, &response) !=
- NSS_STATUS_SUCCESS) {
+ if (!details) {
d_fprintf(stderr, "could not obtain winbind separator!\n");
if (strict) {
return 0;
@@ -50,7 +64,7 @@ static char winbind_separator_int(bool strict)
return *lp_winbind_separator();
}
- sep = response.data.info.winbind_separator;
+ sep = details->winbind_separator;
got_sep = true;
if (!sep) {
@@ -72,26 +86,18 @@ static char winbind_separator(void)
static const char *get_winbind_domain(void)
{
- wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
- struct wbcDomainInfo *dinfo = NULL;
- static fstring winbind_domain;
+ static struct wbcInterfaceDetails *details;
- ZERO_STRUCT(dinfo);
+ details = init_interface_details();
- wbc_status = wbcDomainInfo(".", &dinfo);
-
- if (!WBC_ERROR_IS_OK(wbc_status)) {
+ if (!details) {
d_fprintf(stderr, "could not obtain winbind domain name!\n");
/* HACK: (this module should not call lp_ functions) */
return lp_workgroup();
}
- fstrcpy(winbind_domain, dinfo->short_name);
-
- wbcFreeMemory(dinfo);
-
- return winbind_domain;
+ return details->netbios_domain;
}
/* Copy of parse_domain_user from winbindd_util.c. Parse a string of the