s4:torture: Migrate smbtorture to new cmdline option parser
[samba.git] / source4 / torture / rpc / dsgetinfo.c
index bbe7a3b0ea5f18458ed72a60039acfb81c11d987..b47d6ee9e5348bc6ce15b2dc2f37f06bc87ad100 100644 (file)
@@ -20,7 +20,7 @@
 */
 
 #include "includes.h"
-#include "lib/cmdline/popt_common.h"
+#include "lib/cmdline/cmdline.h"
 #include "librpc/gen_ndr/ndr_drsuapi_c.h"
 #include "librpc/gen_ndr/ndr_drsblobs.h"
 #include "libcli/cldap/cldap.h"
@@ -31,6 +31,7 @@
 #include "dsdb/samdb/samdb.h"
 #include "torture/rpc/torture_rpc.h"
 #include "torture/drs/proto.h"
+#include "lib/util/util_paths.h"
 
 
 struct DsGetinfoBindInfo {
@@ -134,7 +135,7 @@ static struct DsGetinfoTest *test_create_context(struct torture_context *tctx)
        }
 
        /* ctx->admin ...*/
-       ctx->admin.credentials                          = cmdline_credentials;
+       ctx->admin.credentials = samba_cmdline_get_creds();
 
        our_bind_info28                         = &ctx->admin.drsuapi.our_bind_info28;
        our_bind_info28->supported_extensions   = 0xFFFFFFFF;
@@ -247,7 +248,7 @@ static bool test_getinfo(struct torture_context *tctx,
        union drsuapi_DsReplicaInfo info;
        enum drsuapi_DsReplicaInfoType info_type;
        int i;
-       int invalid_levels = 0;
+       bool no_invalid_levels = true;
        struct {
                int32_t level;
                int32_t infotype;
@@ -381,18 +382,14 @@ static bool test_getinfo(struct torture_context *tctx,
                        torture_comment(tctx,
                                        "DsReplicaGetInfo level %d and/or infotype %d not yet supported by server\n",
                                        array[i].level, array[i].infotype);
-                       invalid_levels++;
+                       no_invalid_levels = false;
                        continue;
                }
 
                torture_drsuapi_assert_call(tctx, p, status, &r, "dcerpc_drsuapi_DsReplicaGetInfo");
        }
 
-       if (invalid_levels > 0) {
-               return false;
-       }
-
-       return true;
+       return no_invalid_levels;
 }
 
 /**
@@ -428,7 +425,10 @@ static bool torture_dsgetinfo_tcase_teardown(struct torture_context *tctx, void
 
        /* Unbing admin handle */
        r.in.bind_handle = &ctx->admin.drsuapi.bind_handle;
-       dcerpc_drsuapi_DsUnbind_r(ctx->admin.drsuapi.drs_handle, ctx, &r);
+       if (ctx->admin.drsuapi.drs_handle) {
+               dcerpc_drsuapi_DsUnbind_r(ctx->admin.drsuapi.drs_handle,
+                                         ctx, &r);
+       }
 
        talloc_free(ctx);