diff options
author | coffeedude <coffeedude@drizzt.ad.plainjoe.org> | 2008-05-13 12:52:20 -0500 |
---|---|---|
committer | coffeedude <coffeedude@drizzt.ad.plainjoe.org> | 2008-05-13 12:56:36 -0500 |
commit | 9cd646c166f2c9511158c09354e4f103ff681bcf (patch) | |
tree | 47ba883f9f4249f8ec25d65d1d8f43d4c2b9a571 /source3/nsswitch/libwbclient/wbc_util.c | |
parent | 44b7f672b87f103a2fd5cffeff48d2f7819042f8 (diff) | |
download | samba-9cd646c166f2c9511158c09354e4f103ff681bcf.tar.gz samba-9cd646c166f2c9511158c09354e4f103ff681bcf.tar.bz2 samba-9cd646c166f2c9511158c09354e4f103ff681bcf.zip |
libwbclient: Add wbcLogoffUser() and wbcLookupDomainController().
Add new APIs calls for WINBINDD_PAM_LOGOFF and WINBINDD_DSGETDCNAME
ops.
(This used to be commit cb5e8f60ac3313aec726c01687a040e6e0e42c10)
Diffstat (limited to 'source3/nsswitch/libwbclient/wbc_util.c')
-rw-r--r-- | source3/nsswitch/libwbclient/wbc_util.c | 62 |
1 files changed, 60 insertions, 2 deletions
diff --git a/source3/nsswitch/libwbclient/wbc_util.c b/source3/nsswitch/libwbclient/wbc_util.c index 3afd8a29d3..24568f9101 100644 --- a/source3/nsswitch/libwbclient/wbc_util.c +++ b/source3/nsswitch/libwbclient/wbc_util.c @@ -272,7 +272,7 @@ wbcErr wbcResolveWinsByIP(const char *ip, char **name) /** */ -static wbcErr process_domain_info_string(TALLOC_CTX *ctx, +static wbcErr process_domain_info_string(TALLOC_CTX *ctx, struct wbcDomainInfo *info, char *info_string) { @@ -437,7 +437,7 @@ wbcErr wbcListTrusts(struct wbcDomainInfo **domains, size_t *num_domains) p = (char *)response.extra_data.data; if (strlen(p) == 0) { - /* We should always at least get back our + /* We should always at least get back our own SAM domain */ wbc_status = WBC_ERR_DOMAIN_NOT_FOUND; @@ -492,3 +492,61 @@ wbcErr wbcListTrusts(struct wbcDomainInfo **domains, size_t *num_domains) return wbc_status; } + +/** @brief Enumerate the domain trusts known by Winbind + * + * @param domain Name of the domain to query for a DC + * @flags Bit flags used to control the domain location query + * @param *dc_info Pointer to the returned domain controller information + * + * @return #wbcErr + * + **/ + + + +wbcErr wbcLookupDomainController(const char *domain, + uint32_t flags, + struct wbcDomainControllerInfo **dc_info) +{ + wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE; + struct winbindd_request request; + struct winbindd_response response; + struct wbcDomainControllerInfo *dc = NULL; + + /* validate input params */ + + if (!domain || !dc_info) { + wbc_status = WBC_ERR_INVALID_PARAM; + BAIL_ON_WBC_ERROR(wbc_status); + } + + ZERO_STRUCT(request); + ZERO_STRUCT(response); + + strncpy(request.domain_name, domain, sizeof(request.domain_name)-1); + + request.flags = flags; + + dc = talloc(NULL, struct wbcDomainControllerInfo); + BAIL_ON_PTR_ERROR(dc, wbc_status); + + /* Send request */ + + wbc_status = wbcRequestResponse(WINBINDD_DSGETDCNAME, + &request, + &response); + BAIL_ON_WBC_ERROR(wbc_status); + + dc->dc_name = talloc_strdup(dc, response.data.dc_name); + BAIL_ON_PTR_ERROR(dc->dc_name, wbc_status); + + *dc_info = dc; + +done: + if (!WBC_ERROR_IS_OK(wbc_status)) { + talloc_free(dc); + } + + return wbc_status; +} |