From bcc3945e5384e6f39dc03eaeeee2382a6a7d52be Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Thu, 18 Mar 2021 10:05:26 +0100 Subject: [PATCH] s3:netapi: Use public getters in getjoinableous example Signed-off-by: Andreas Schneider Reviewed-by: Guenther Deschner --- .../lib/netapi/examples/join/getjoinableous.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/source3/lib/netapi/examples/join/getjoinableous.c b/source3/lib/netapi/examples/join/getjoinableous.c index 732f73dd572..c0fba576eae 100644 --- a/source3/lib/netapi/examples/join/getjoinableous.c +++ b/source3/lib/netapi/examples/join/getjoinableous.c @@ -35,6 +35,8 @@ int main(int argc, const char **argv) uint32_t num_ous = 0; struct libnetapi_ctx *ctx = NULL; int i; + const char *username = NULL; + const char *password = NULL; poptContext pc; int opt; @@ -70,10 +72,23 @@ int main(int argc, const char **argv) /* NetGetJoinableOUs */ + status = libnetapi_get_username(ctx, &username); + if (status != 0) { + printf("failed with: %s\n", + libnetapi_get_error_string(ctx, status)); + goto out; + } + status = libnetapi_get_password(ctx, &password); + if (status != 0) { + printf("failed with: %s\n", + libnetapi_get_error_string(ctx, status)); + goto out; + } + status = NetGetJoinableOUs(host_name, domain_name, - ctx->username, - ctx->password, + username, + password, &num_ous, &ous); if (status != 0) { -- 2.34.1