From: Andreas Schneider Date: Thu, 18 Mar 2021 09:05:26 +0000 (+0100) Subject: s3:netapi: Use public getters in getjoinableous example X-Git-Tag: tevent-0.11.0~1423 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=bcc3945e5384e6f39dc03eaeeee2382a6a7d52be;p=thirdparty%2Fsamba.git s3:netapi: Use public getters in getjoinableous example Signed-off-by: Andreas Schneider Reviewed-by: Guenther Deschner --- 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) {