diff options
author | Stefan Metzmacher <metze@samba.org> | 2008-04-14 09:35:15 +0200 |
---|---|---|
committer | Karolin Seeger <kseeger@samba.org> | 2008-04-21 08:40:41 +0200 |
commit | 5fc54f1be39339ae9b4ad41579ea125f7d5a8743 (patch) | |
tree | cfe45a306272b24b4add4dae76d0e597000d2683 /source/nsswitch | |
parent | 260c642da383cec3a9a2349b37ef4d95d022b5fc (diff) | |
download | samba-5fc54f1be39339ae9b4ad41579ea125f7d5a8743.tar.gz |
wbinfo: use wbcResolveWinsByName() and wbcResolveWinsByIP()
metze
(cherry picked from commit a4f628d6c9e2a5761c048e268a29e1f5daae4180)
Diffstat (limited to 'source/nsswitch')
-rw-r--r-- | source/nsswitch/wbinfo.c | 42 |
1 files changed, 16 insertions, 26 deletions
diff --git a/source/nsswitch/wbinfo.c b/source/nsswitch/wbinfo.c index ba358bd1dd7..186ab98717b 100644 --- a/source/nsswitch/wbinfo.c +++ b/source/nsswitch/wbinfo.c @@ -297,52 +297,42 @@ static bool wbinfo_get_userdomgroups(const char *user_sid_str) /* Convert NetBIOS name to IP */ -static bool wbinfo_wins_byname(char *name) +static bool wbinfo_wins_byname(const char *name) { - struct winbindd_request request; - struct winbindd_response response; - - ZERO_STRUCT(request); - ZERO_STRUCT(response); - - /* Send request */ - - fstrcpy(request.data.winsreq, name); + wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE; + const char *ip = NULL; - if (winbindd_request_response(WINBINDD_WINS_BYNAME, &request, &response) != - NSS_STATUS_SUCCESS) { + wbc_status = wbcResolveWinsByName(name, &ip); + if (!WBC_ERROR_IS_OK(wbc_status)) { return false; } /* Display response */ - d_printf("%s\n", response.data.winsresp); + d_printf("%s\n", ip); + + wbcFreeMemory(ip); return true; } /* Convert IP to NetBIOS name */ -static bool wbinfo_wins_byip(char *ip) +static bool wbinfo_wins_byip(const char *ip) { - struct winbindd_request request; - struct winbindd_response response; - - ZERO_STRUCT(request); - ZERO_STRUCT(response); - - /* Send request */ - - fstrcpy(request.data.winsreq, ip); + wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE; + const char *name = NULL; - if (winbindd_request_response(WINBINDD_WINS_BYIP, &request, &response) != - NSS_STATUS_SUCCESS) { + wbc_status = wbcResolveWinsByIP(ip, &name); + if (!WBC_ERROR_IS_OK(wbc_status)) { return false; } /* Display response */ - d_printf("%s\n", response.data.winsresp); + d_printf("%s\n", name); + + wbcFreeMemory(name); return true; } |