diff options
author | Andreas Schneider <asn@samba.org> | 2021-03-18 10:04:23 +0100 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2021-03-24 00:55:32 +0000 |
commit | 44ef7f96e16f26780272a5638c009fcd79c21ed2 (patch) | |
tree | bd82a6a7387f4d5202e4b21a0ed2e86342edd87f /source3/lib/netapi | |
parent | c9222ab838844bca698a64b2125a19244ee6f008 (diff) | |
download | samba-44ef7f96e16f26780272a5638c009fcd79c21ed2.tar.gz |
s3:netapi: Use public getters in remote_machine example
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
Diffstat (limited to 'source3/lib/netapi')
-rw-r--r-- | source3/lib/netapi/examples/join/rename_machine.c | 19 |
1 files 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", |