s3:netapi: Use public getters in getjoinableous example
authorAndreas Schneider <asn@samba.org>
Thu, 18 Mar 2021 09:05:26 +0000 (10:05 +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/getjoinableous.c

index 732f73dd572556b513d94a7125746d0c6b4714cd..c0fba576eaebff506cd1b46a6194712c2d648e11 100644 (file)
@@ -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) {