]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:netapi: Use public getters in remote_machine example
authorAndreas Schneider <asn@samba.org>
Thu, 18 Mar 2021 09:04:23 +0000 (10:04 +0100)
committerGünther Deschner <gd@samba.org>
Wed, 24 Mar 2021 00:55:32 +0000 (00:55 +0000)
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
source3/lib/netapi/examples/join/rename_machine.c

index a21f9198d879fe0078af51292308419d1ce386fe..7be6dc2bf2ab3299e205f75faf1cc2c0ba97d3db 100644 (file)
@@ -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",