diff options
author | Herb Lewis <herb@samba.org> | 2007-02-16 19:49:12 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:18:02 -0500 |
commit | 2b302791695fe29af369c3c17dc740f45d3cadd9 (patch) | |
tree | f33ba9f90570d21138c0115b6a923ee1be6f6065 | |
parent | 4a18f37f22f7bfbfecd479d5e5363427c8e9a7ca (diff) | |
download | samba-2b302791695fe29af369c3c17dc740f45d3cadd9.tar.gz samba-2b302791695fe29af369c3c17dc740f45d3cadd9.tar.bz2 samba-2b302791695fe29af369c3c17dc740f45d3cadd9.zip |
r21396: fix wbinfo --lookup-rids command
allow detection of libbiconv if all others fail - need for FreeBSD
(This used to be commit 7acc9421b0643cb04bff1f1d98ecb899f9b09601)
-rw-r--r-- | source3/aclocal.m4 | 17 | ||||
-rw-r--r-- | source3/nsswitch/wb_common.c | 2 | ||||
-rw-r--r-- | source3/nsswitch/wbinfo.c | 21 |
3 files changed, 36 insertions, 4 deletions
diff --git a/source3/aclocal.m4 b/source3/aclocal.m4 index b66a1c253e..00c57bacee 100644 --- a/source3/aclocal.m4 +++ b/source3/aclocal.m4 @@ -362,6 +362,23 @@ AC_DEFUN(jm_ICONV, jm_cv_func_iconv=yes jm_cv_lib_iconv="iconv") LIBS="$jm_save_LIBS" + + if test "$jm_cv_lib_iconv" != yes; then + jm_save_LIBS="$LIBS" + LIBS="$LIBS -lbiconv" + AC_TRY_LINK([#include <stdlib.h> +#include <biconv.h>], + [iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd);], + jm_cv_lib_iconv=yes + jm_cv_func_iconv=yes + jm_cv_include="biconv.h" + jm_cv_biconv=yes + jm_cv_lib_iconv="biconv") + + LIBS="$jm_save_LIBS" + fi fi fi fi diff --git a/source3/nsswitch/wb_common.c b/source3/nsswitch/wb_common.c index 05d2a660e7..13cefd135d 100644 --- a/source3/nsswitch/wb_common.c +++ b/source3/nsswitch/wb_common.c @@ -504,7 +504,7 @@ int read_reply(struct winbindd_response *response) /* Mallocate memory for extra data */ - if (!(response->extra_data.data = malloc(extra_data_len))) { + if (!(response->extra_data.data = SMB_MALLOC(extra_data_len))) { return -1; } diff --git a/source3/nsswitch/wbinfo.c b/source3/nsswitch/wbinfo.c index cabf995042..826b4fc040 100644 --- a/source3/nsswitch/wbinfo.c +++ b/source3/nsswitch/wbinfo.c @@ -638,7 +638,7 @@ static BOOL wbinfo_lookupsid(char *sid) /* Lookup a list of RIDs */ -static BOOL wbinfo_lookuprids(char *domain_sid, char *arg) +static BOOL wbinfo_lookuprids(char *domain, char *arg) { size_t i; DOM_SID sid; @@ -650,9 +650,24 @@ static BOOL wbinfo_lookuprids(char *domain_sid, char *arg) enum lsa_SidType *types; const char *domain_name; TALLOC_CTX *mem_ctx; + struct winbindd_request request; + struct winbindd_response response; + + if ((domain == NULL) || (strequal(domain, ".")) || (domain[0] == '\0')) + fstrcpy(request.domain_name, get_winbind_domain()); + else + fstrcpy(request.domain_name, domain); + + /* Send request */ + + if (winbindd_request_response(WINBINDD_DOMAIN_INFO, &request, &response) != + NSS_STATUS_SUCCESS) { + d_printf("Could not get domain sid for %s\n", request.domain_name); + return False; + } - if (!string_to_sid(&sid, domain_sid)) { - d_printf("Could not convert %s to sid\n", domain_sid); + if (!string_to_sid(&sid, response.data.domain_info.sid)) { + d_printf("Could not convert %s to sid\n", response.data.domain_info.sid); return False; } |