struct GROUP_POLICY_OBJECT *gpo_list;
const char *attrs[] = {"distinguishedName", "userAccountControl", NULL};
char *filter, *dn;
- void *res = NULL;
+ LDAPMessage *res = NULL;
uint32 uac;
return ADS_ERROR_NT(NT_STATUS_NOT_IMPLEMENTED);
}
if (!ads_pull_uint32(ads, res, "userAccountControl", &uac)) {
+ ads_memfree(ads, dn);
return ADS_ERROR(LDAP_NO_MEMORY);
}
if (!(uac & UF_WORKSTATION_TRUST_ACCOUNT)) {
+ ads_memfree(ads, dn);
return ADS_ERROR(LDAP_NO_SUCH_OBJECT);
}
status = ads_get_gpo_list(ads, mem_ctx, dn, GPO_LIST_FLAG_MACHINE, &gpo_list);
if (!ADS_ERR_OK(status)) {
+ ads_memfree(ads, dn);
return status;
}
cse_gpo_name_to_guid_string("Security"),
GPO_LIST_FLAG_MACHINE);
if (!ADS_ERR_OK(status)) {
+ ads_memfree(ads, dn);
return status;
}
+ ads_memfree(ads, dn);
return ADS_ERROR(LDAP_SUCCESS);
}
ADS_STRUCT *ads;
ADS_STATUS status;
const char *attrs[] = {"distinguishedName", "userAccountControl", NULL};
- void *res = NULL;
+ LDAPMessage *res = NULL;
const char *filter;
char *dn = NULL;
struct GROUP_POLICY_OBJECT *gpo_list;
goto out;
}
- if (!(ads = ads_startup())) {
+ status = ads_startup(False, &ads);
+ if (!ADS_ERR_OK(status)) {
goto out;
}
{
ADS_STRUCT *ads;
ADS_STATUS status;
- void *res = NULL;
+ LDAPMessage *res = NULL;
int num_reply = 0;
void *msg = NULL;
struct GROUP_POLICY_OBJECT gpo;
TALLOC_CTX *mem_ctx;
+ char *dn;
mem_ctx = talloc_init("net_ads_gpo_list");
if (mem_ctx == NULL) {
return -1;
}
- if (!(ads = ads_startup())) {
+ status = ads_startup(False, &ads);
+ if (!ADS_ERR_OK(status)) {
goto out;
}
/* dump the results */
for (msg = ads_first_entry(ads, res); msg; msg = ads_next_entry(ads, msg)) {
-
- status = ads_parse_gpo(ads, mem_ctx, msg, ads_get_dn(ads, msg), &gpo);
+
+ if ((dn = ads_get_dn(ads, msg)) == NULL) {
+ goto out;
+ }
+
+ status = ads_parse_gpo(ads, mem_ctx, msg, dn, &gpo);
if (!ADS_ERR_OK(status)) {
d_printf("parse failed: %s\n", ads_errstr(status));
}
out:
+ ads_memfree(ads, dn);
ads_msgfree(ads, res);
talloc_destroy(mem_ctx);
ADS_STRUCT *ads;
ADS_STATUS status;
const char *attrs[] = {"distinguishedName", "userAccountControl", NULL};
- void *res = NULL;
+ LDAPMessage *res = NULL;
const char *filter;
char *dn = NULL;
struct GROUP_POLICY_OBJECT *gpo_list;
goto out;
}
- if (!(ads = ads_startup())) {
+ status = ads_startup(False, &ads);
+ if (!ADS_ERR_OK(status)) {
goto out;
}
return -1;
}
- if (!(ads = ads_startup())) {
+ status = ads_startup(False, &ads);
+ if (!ADS_ERR_OK(status)) {
goto out;
}
gpo_opt = atoi(argv[2]);
}
- if (!(ads = ads_startup())) {
+ status = ads_startup(False, &ads);
+ if (!ADS_ERR_OK(status)) {
goto out;
}
return -1;
}
- if (!(ads = ads_startup())) {
+ status = ads_startup(False, &ads);
+ if (!ADS_ERR_OK(status)) {
goto out;
}
return -1;
}
- if (!(ads = ads_startup())) {
+ status = ads_startup(False, &ads);
+ if (!ADS_ERR_OK(status)) {
goto out;
}