1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

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>
This commit is contained in:
Stefan Metzmacher 2021-11-22 17:59:48 +01:00
parent 41108b9ed9
commit 9615395b1f

View File

@ -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;
}