s3-auth Use the common gensec_ntlmssp_update in gensec_ntlmssp3_server
[ira/wip.git] / source3 / utils / net_ads_gpo.c
index 14bc3786335c3e6146fa326880f9bdd070bd366a..56451ab11e1c2332680149f5db5e919c36b1e5fe 100644 (file)
 
 #include "includes.h"
 #include "utils/net.h"
+#include "ads.h"
+#include "../libgpo/gpo.h"
+#include "libgpo/gpo_proto.h"
+#include "../libds/common/flags.h"
 
 #ifdef HAVE_ADS
 
@@ -34,7 +38,7 @@ static int net_ads_gpo_refresh(struct net_context *c, int argc, const char **arg
        uint32 flags = 0;
        struct GROUP_POLICY_OBJECT *gpo;
        NTSTATUS result;
-       struct nt_user_token *token = NULL;
+       struct security_token *token = NULL;
 
        if (argc < 1 || c->display_usage) {
                d_printf("%s\n%s\n%s",
@@ -153,7 +157,7 @@ static int net_ads_gpo_refresh(struct net_context *c, int argc, const char **arg
 
        {
                WERROR werr = gp_reg_state_read(mem_ctx, flags,
-                                               &token->user_sids[0],
+                                               &token->sids[0],
                                                &read_list);
                if (!W_ERROR_IS_OK(werr)) {
                        d_printf(_("failed: %s\n"), win_errstr(werr));
@@ -246,7 +250,7 @@ static int net_ads_gpo_list_all(struct net_context *c, int argc, const char **ar
                                            LDAP_SCOPE_SUBTREE,
                                            "(objectclass=groupPolicyContainer)",
                                            attrs,
-                                           DACL_SECURITY_INFORMATION,
+                                           SECINFO_DACL,
                                            &res);
 
        if (!ADS_ERR_OK(status)) {
@@ -289,7 +293,7 @@ out:
 
 static int net_ads_gpo_list(struct net_context *c, int argc, const char **argv)
 {
-       ADS_STRUCT *ads;
+       ADS_STRUCT *ads = NULL;
        ADS_STATUS status;
        LDAPMessage *res = NULL;
        TALLOC_CTX *mem_ctx;
@@ -297,7 +301,7 @@ static int net_ads_gpo_list(struct net_context *c, int argc, const char **argv)
        uint32 uac = 0;
        uint32 flags = 0;
        struct GROUP_POLICY_OBJECT *gpo_list;
-       struct nt_user_token *token = NULL;
+       struct security_token *token = NULL;
 
        if (argc < 1 || c->display_usage) {
                d_printf("%s\n%s\n%s",
@@ -358,7 +362,6 @@ out:
        return 0;
 }
 
-#if 0
 static int net_ads_gpo_apply(struct net_context *c, int argc, const char **argv)
 {
        TALLOC_CTX *mem_ctx;
@@ -368,7 +371,7 @@ static int net_ads_gpo_apply(struct net_context *c, int argc, const char **argv)
        struct GROUP_POLICY_OBJECT *gpo_list;
        uint32 uac = 0;
        uint32 flags = 0;
-       struct nt_user_token *token = NULL;
+       struct security_token *token = NULL;
        const char *filter = NULL;
 
        if (argc < 1 || c->display_usage) {
@@ -390,6 +393,8 @@ static int net_ads_gpo_apply(struct net_context *c, int argc, const char **argv)
        }
 
        status = ads_startup(c, false, &ads);
+       /* filter = cse_gpo_name_to_guid_string("Security"); */
+
        if (!ADS_ERR_OK(status)) {
                d_printf("got: %s\n", ads_errstr(status));
                goto out;
@@ -442,7 +447,6 @@ out:
        talloc_destroy(mem_ctx);
        return 0;
 }
-#endif
 
 static int net_ads_gpo_link_get(struct net_context *c, int argc, const char **argv)
 {
@@ -624,7 +628,6 @@ out:
 int net_ads_gpo(struct net_context *c, int argc, const char **argv)
 {
        struct functable func[] = {
-#if 0
                {
                        "apply",
                        net_ads_gpo_apply,
@@ -633,7 +636,6 @@ int net_ads_gpo(struct net_context *c, int argc, const char **argv)
                        "net ads gpo apply\n"
                        "    Apply GPO to container"
                },
-#endif
                {
                        "getgpo",
                        net_ads_gpo_get_gpo,