summaryrefslogtreecommitdiff
path: root/source3/libads
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2001-11-28 03:56:30 +0000
committerAndrew Tridgell <tridge@samba.org>2001-11-28 03:56:30 +0000
commiteec9e8a052407611df223fec982588e7a2bd7f49 (patch)
tree70742ae3dd80f86aca5b61afc079811d8aa2f826 /source3/libads
parenta6b73b9767524fa6997bd31398d558a7cf1e4ac8 (diff)
downloadsamba-eec9e8a052407611df223fec982588e7a2bd7f49.tar.gz
samba-eec9e8a052407611df223fec982588e7a2bd7f49.tar.bz2
samba-eec9e8a052407611df223fec982588e7a2bd7f49.zip
fix a bunch of places where we can double-free a cli structure
(This used to be commit e2ba2383c9f679c076749a8f4fccefc3559e37ec)
Diffstat (limited to 'source3/libads')
-rw-r--r--source3/libads/ldap.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c
index 604a11aa5b..49e803a49d 100644
--- a/source3/libads/ldap.c
+++ b/source3/libads/ldap.c
@@ -270,7 +270,7 @@ static int ads_add_machine_acct(ADS_STRUCT *ads, const char *hostname)
asprintf(&new_dn, "cn=%s,cn=Computers,%s", hostname, ads->bind_path);
asprintf(&samAccountName, "%s$", hostname);
asprintf(&controlstr, "%u",
- UF_DONT_EXPIRE_PASSWD | UF_WORKSTATION_TRUST_ACCOUNT |
+ UF_DONT_EXPIRE_PASSWD | UF_WORKSTATION_TRUST_ACCOUNT |
UF_TRUSTED_FOR_DELEGATION | UF_USE_DES_KEY_ONLY);
ret = ads_gen_add(ads, new_dn,
@@ -466,4 +466,17 @@ NTSTATUS ads_set_machine_password(ADS_STRUCT *ads,
return ret;
}
+/* find the update serial number - this is the core of the ldap cache */
+BOOL ads_USN(ADS_STRUCT *ads, unsigned *usn)
+{
+ const char *attrs[] = {"highestCommittedUSN", NULL};
+ int rc;
+ void *res;
+
+ rc = ldap_search_s(ads->ld, ads->bind_path,
+ LDAP_SCOPE_BASE, "(objectclass=*)", (char **)attrs, 0, (LDAPMessage *)&res);
+ if (rc || ads_count_replies(ads, res) != 1) return False;
+ return False;
+}
+
#endif