Adjust samba 3 to the new gpo API. Still untested code.
[kai/samba.git] / source3 / utils / net_ads_gpo.c
index 181cba221d82c92763dcc59c76e98c7454afa7bc..9e41905d797a3cd20592bb2b960ca6ab02c71ecc 100644 (file)
@@ -73,7 +73,7 @@ static int net_ads_gpo_refresh(struct net_context *c, int argc, const char **arg
 
        d_printf("* fetching token ");
        if (uac & UF_WORKSTATION_TRUST_ACCOUNT) {
-               status = gp_get_machine_token(ads, mem_ctx, dn, &token);
+               status = gp_get_machine_token(ads, mem_ctx, NULL, dn, &token);
        } else {
                status = ads_get_sid_token(ads, mem_ctx, dn, &token);
        }
@@ -94,6 +94,8 @@ static int net_ads_gpo_refresh(struct net_context *c, int argc, const char **arg
 
        d_printf("* refreshing Group Policy Data ");
        if (!NT_STATUS_IS_OK(result = check_refresh_gpo_list(ads, mem_ctx,
+                                                            cache_path(GPO_CACHE_DIR),
+                                                            NULL,
                                                             flags,
                                                             gpo_list))) {
                d_printf("failed: %s\n", nt_errstr(result));
@@ -257,7 +259,7 @@ static int net_ads_gpo_list_all(struct net_context *c, int argc, const char **ar
             msg;
             msg = ads_next_entry(ads, msg)) {
 
-               if ((dn = ads_get_dn(ads, msg)) == NULL) {
+               if ((dn = ads_get_dn(ads, mem_ctx, msg)) == NULL) {
                        goto out;
                }
 
@@ -266,18 +268,16 @@ static int net_ads_gpo_list_all(struct net_context *c, int argc, const char **ar
                if (!ADS_ERR_OK(status)) {
                        d_printf("ads_parse_gpo failed: %s\n",
                                ads_errstr(status));
-                       ads_memfree(ads, dn);
                        goto out;
                }
 
                dump_gpo(ads, mem_ctx, &gpo, 0);
-               ads_memfree(ads, dn);
        }
 
 out:
        ads_msgfree(ads, res);
 
-       talloc_destroy(mem_ctx);
+       TALLOC_FREE(mem_ctx);
        ads_destroy(&ads);
 
        return 0;
@@ -328,7 +328,7 @@ static int net_ads_gpo_list(struct net_context *c, int argc, const char **argv)
                argv[0], dn);
 
        if (uac & UF_WORKSTATION_TRUST_ACCOUNT) {
-               status = gp_get_machine_token(ads, mem_ctx, dn, &token);
+               status = gp_get_machine_token(ads, mem_ctx, NULL, dn, &token);
        } else {
                status = ads_get_sid_token(ads, mem_ctx, dn, &token);
        }