From 44ef7f96e16f26780272a5638c009fcd79c21ed2 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Thu, 18 Mar 2021 10:04:23 +0100 Subject: [PATCH] s3:netapi: Use public getters in remote_machine example Signed-off-by: Andreas Schneider Reviewed-by: Guenther Deschner --- .../lib/netapi/examples/join/rename_machine.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/source3/lib/netapi/examples/join/rename_machine.c b/source3/lib/netapi/examples/join/rename_machine.c index a21f9198d87..7be6dc2bf2a 100644 --- a/source3/lib/netapi/examples/join/rename_machine.c +++ b/source3/lib/netapi/examples/join/rename_machine.c @@ -33,6 +33,8 @@ int main(int argc, const char **argv) const char *new_machine_name = NULL; uint32_t rename_opt = 0; struct libnetapi_ctx *ctx = NULL; + const char *username = NULL; + const char *password = NULL; poptContext pc; int opt; @@ -68,10 +70,23 @@ int main(int argc, const char **argv) /* NetRenameMachineInDomain */ + 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 = NetRenameMachineInDomain(host_name, new_machine_name, - ctx->username, - ctx->password, + username, + password, rename_opt); if (status != 0) { printf("failed with: %s\n", -- 2.47.3