diff options
author | Stefan Metzmacher <metze@samba.org> | 2021-11-22 17:59:48 +0100 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2021-11-30 15:53:34 +0000 |
commit | 9615395b1fdaa4509a9739bada93c3bb72903b2c (patch) | |
tree | 31f58ef8b09302d00f0065d4606a8328413d193b /nsswitch | |
parent | 41108b9ed9f32ca9ad1b3d4a48a91a6f22c65db6 (diff) | |
download | samba-9615395b1fdaa4509a9739bada93c3bb72903b2c.tar.gz |
nsswitch/wbinfo: use wbcRequestResponse() instead of winbindd_request_response()
We should try to route everything through libwbclient.so, because we'll
soon don't have a single library providing winbindd_request_response().
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14780
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Diffstat (limited to 'nsswitch')
-rw-r--r-- | nsswitch/wbinfo.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/nsswitch/wbinfo.c b/nsswitch/wbinfo.c index 1656f02f0e6..55b9e268c39 100644 --- a/nsswitch/wbinfo.c +++ b/nsswitch/wbinfo.c @@ -22,8 +22,9 @@ */ #include "includes.h" -#include "winbind_client.h" #include "libwbclient/wbclient.h" +#include "winbind_struct_protocol.h" +#include "libwbclient/wbclient_internal.h" #include "../libcli/auth/libcli_auth.h" #include "lib/cmdline/cmdline.h" #include "lib/afs/afs_settoken.h" @@ -697,6 +698,7 @@ static bool wbinfo_domain_info(const char *domain) /* Get a foreign DC's name */ static bool wbinfo_getdcname(const char *domain_name) { + wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE; struct winbindd_request request; struct winbindd_response response; @@ -707,8 +709,9 @@ static bool wbinfo_getdcname(const char *domain_name) /* Send request */ - if (winbindd_request_response(NULL, WINBINDD_GETDCNAME, &request, - &response) != NSS_STATUS_SUCCESS) { + wbc_status = wbcRequestResponse(NULL, WINBINDD_GETDCNAME, + &request, &response); + if (!WBC_ERROR_IS_OK(wbc_status)) { d_fprintf(stderr, "Could not get dc name for %s\n",domain_name); return false; } @@ -2054,9 +2057,9 @@ static bool wbinfo_ccache_save(char *username) static bool wbinfo_klog(char *username) { + wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE; struct winbindd_request request; struct winbindd_response response; - NSS_STATUS result; char *p; /* Send off request */ @@ -2081,13 +2084,13 @@ static bool wbinfo_klog(char *username) request.flags |= WBFLAG_PAM_AFS_TOKEN; - result = winbindd_request_response(NULL, WINBINDD_PAM_AUTH, &request, - &response); + wbc_status = wbcRequestResponse(NULL, WINBINDD_PAM_AUTH, + &request, &response); /* Display response */ d_printf("plaintext password authentication %s\n", - (result == NSS_STATUS_SUCCESS) ? "succeeded" : "failed"); + WBC_ERROR_IS_OK(wbc_status) ? "succeeded" : "failed"); if (response.data.auth.nt_status) d_fprintf(stderr, @@ -2096,7 +2099,7 @@ static bool wbinfo_klog(char *username) response.data.auth.nt_status, response.data.auth.error_string); - if (result != NSS_STATUS_SUCCESS) + if (!WBC_ERROR_IS_OK(wbc_status)) return false; if (response.extra_data.data == NULL) { @@ -2105,10 +2108,12 @@ static bool wbinfo_klog(char *username) } if (!afs_settoken_str((char *)response.extra_data.data)) { + winbindd_free_response(&response); d_fprintf(stderr, "Could not set token\n"); return false; } + winbindd_free_response(&response); d_printf("Successfully created AFS token\n"); return true; } |