#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
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",
d_printf(_("* fetching token "));
if (uac & UF_WORKSTATION_TRUST_ACCOUNT) {
- status = gp_get_machine_token(ads, mem_ctx, NULL, dn, &token);
+ status = gp_get_machine_token(ads, mem_ctx, dn, &token);
} else {
status = ads_get_sid_token(ads, mem_ctx, dn, &token);
}
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));
for (gpo = gpo_list; gpo; gpo = gpo->next) {
- dump_gpo(ads, mem_ctx, gpo, 0);
+ dump_gpo(gpo, 0);
#if 0
char *server, *share, *nt_path, *unix_path;
{
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));
for (gpo = read_list; gpo; gpo = gpo->next) {
- dump_gpo(ads, mem_ctx, gpo, 0);
+ dump_gpo(gpo, 0);
#if 0
char *server, *share, *nt_path, *unix_path;
LDAP_SCOPE_SUBTREE,
"(objectclass=groupPolicyContainer)",
attrs,
- DACL_SECURITY_INFORMATION,
+ SECINFO_DACL,
&res);
if (!ADS_ERR_OK(status)) {
goto out;
}
- dump_gpo(ads, mem_ctx, &gpo, 0);
+ dump_gpo(&gpo, 0);
}
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;
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",
argv[0], dn);
if (uac & UF_WORKSTATION_TRUST_ACCOUNT) {
- status = gp_get_machine_token(ads, mem_ctx, NULL, dn, &token);
+ status = gp_get_machine_token(ads, mem_ctx, dn, &token);
} else {
status = ads_get_sid_token(ads, mem_ctx, dn, &token);
}
goto out;
}
- dump_gpo_list(ads, mem_ctx, gpo_list, 0);
+ dump_gpo_list(gpo_list, 0);
out:
ads_msgfree(ads, res);
return 0;
}
-#if 0
static int net_ads_gpo_apply(struct net_context *c, int argc, const char **argv)
{
TALLOC_CTX *mem_ctx;
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) {
}
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;
argv[0], dn);
if (uac & UF_WORKSTATION_TRUST_ACCOUNT) {
- status = gp_get_machine_token(ads, mem_ctx, NULL, dn, &token);
+ status = gp_get_machine_token(ads, mem_ctx, dn, &token);
} else {
status = ads_get_sid_token(ads, mem_ctx, dn, &token);
}
goto out;
}
- status = gpo_process_gpo_list(ads, mem_ctx, token, gpo_list,
- filter, flags);
+ status = ADS_ERROR_NT(gpo_process_gpo_list(mem_ctx, token, gpo_list,
+ filter, flags));
if (!ADS_ERR_OK(status)) {
d_printf("failed to process gpo list: %s\n",
ads_errstr(status));
talloc_destroy(mem_ctx);
return 0;
}
-#endif
static int net_ads_gpo_link_get(struct net_context *c, int argc, const char **argv)
{
goto out;
}
- dump_gplink(ads, mem_ctx, &gp_link);
+ dump_gplink(&gp_link);
out:
talloc_destroy(mem_ctx);
goto out;
}
- dump_gpo(ads, mem_ctx, &gpo, 1);
+ dump_gpo(&gpo, 1);
out:
talloc_destroy(mem_ctx);
int net_ads_gpo(struct net_context *c, int argc, const char **argv)
{
struct functable func[] = {
-#if 0
{
"apply",
net_ads_gpo_apply,
"net ads gpo apply\n"
" Apply GPO to container"
},
-#endif
{
"getgpo",
net_ads_gpo_get_gpo,