summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2008-04-14 09:35:15 +0200
committerStefan Metzmacher <metze@samba.org>2008-04-17 00:25:00 +0200
commit31b3a1fc3ff884bf311db3ffe5a85c1ef9dac344 (patch)
tree53ce351736eed25534ced20479d731f2d2f3a88d
parent3458b708d280685bd8d66a8cc86661af0b707381 (diff)
downloadsamba-31b3a1fc3ff884bf311db3ffe5a85c1ef9dac344.tar.gz
samba-31b3a1fc3ff884bf311db3ffe5a85c1ef9dac344.tar.bz2
samba-31b3a1fc3ff884bf311db3ffe5a85c1ef9dac344.zip
wbinfo: use wbcResolveWinsByName() and wbcResolveWinsByIP()
metze (This used to be commit a4f628d6c9e2a5761c048e268a29e1f5daae4180)
-rw-r--r--source3/nsswitch/wbinfo.c42
1 files changed, 16 insertions, 26 deletions
diff --git a/source3/nsswitch/wbinfo.c b/source3/nsswitch/wbinfo.c
index ba358bd1dd..186ab98717 100644
--- a/source3/nsswitch/wbinfo.c
+++ b/source3/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;
}