wbinfo: use wbcCheckTrustCredentials()
authorStefan Metzmacher <metze@samba.org>
Wed, 16 Apr 2008 22:17:06 +0000 (00:17 +0200)
committerStefan Metzmacher <metze@samba.org>
Wed, 16 Apr 2008 22:32:03 +0000 (00:32 +0200)
metze
(This used to be commit 2cbe5a006a6df79c38f4aaa68d498cd6d5a34dba)

source3/nsswitch/wbinfo.c

index 186ab98717be1c1b759de348e77dd2a0bc7afd3d..1e943a5eee36d1019da7d609d2541bb98d4b47a3 100644 (file)
@@ -591,22 +591,24 @@ static bool wbinfo_dsgetdcname(const char *domain_name, uint32_t flags)
 
 static bool wbinfo_check_secret(void)
 {
-       struct winbindd_response response;
-       NSS_STATUS result;
-
-       ZERO_STRUCT(response);
+       wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
+       struct wbcAuthErrorInfo *error = NULL;
 
-       result = winbindd_request_response(WINBINDD_CHECK_MACHACC, NULL, &response);
+       wbc_status = wbcCheckTrustCredentials(NULL, &error);
 
        d_printf("checking the trust secret via RPC calls %s\n",
-                (result == NSS_STATUS_SUCCESS) ? "succeeded" : "failed");
+                WBC_ERROR_IS_OK(wbc_status) ? "succeeded" : "failed");
 
-       if (result != NSS_STATUS_SUCCESS)
+       if (wbc_status == WBC_ERR_AUTH_ERROR) {
                d_fprintf(stderr, "error code was %s (0x%x)\n",
-                        response.data.auth.nt_status_string,
-                        response.data.auth.nt_status);
+                         error->nt_string, error->nt_status);
+               wbcFreeMemory(error);
+       }
+       if (!WBC_ERROR_IS_OK(wbc_status)) {
+               return false;
+       }
 
-       return result == NSS_STATUS_SUCCESS;    
+       return true;
 }
 
 /* Convert uid to sid */