svn commit: samba r22459 - in branches/SAMBA_3_0/source/libads: .
gd at samba.org
gd at samba.org
Sun Apr 22 15:13:51 GMT 2007
Author: gd
Date: 2007-04-22 15:13:50 +0000 (Sun, 22 Apr 2007)
New Revision: 22459
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=22459
Log:
Adding ads_get_dn_from_extended_dn(), in preparation of making ranged LDAP
queries more generic. Michael, feel free to overwrite these and the following.
Guenther
Modified:
branches/SAMBA_3_0/source/libads/ldap.c
Changeset:
Modified: branches/SAMBA_3_0/source/libads/ldap.c
===================================================================
--- branches/SAMBA_3_0/source/libads/ldap.c 2007-04-22 14:51:07 UTC (rev 22458)
+++ branches/SAMBA_3_0/source/libads/ldap.c 2007-04-22 15:13:50 UTC (rev 22459)
@@ -2678,23 +2678,57 @@
}
/**
+ * pull a dn from an extended dn string
+ * @param mem_ctx TALLOC_CTX
+ * @param extended_dn string
+ * @param dn pointer to the dn
+ * @return boolean inidicating success
+ **/
+BOOL ads_get_dn_from_extended_dn(TALLOC_CTX *mem_ctx,
+ const char *extended_dn,
+ char **dn)
+{
+ char *p;
+ pstring tok;
+
+ if (!extended_dn) {
+ return False;
+ }
+
+ while (next_token(&extended_dn, tok, ";", sizeof(tok))) {
+ p = tok;
+ }
+
+ if ((*dn = talloc_strdup(mem_ctx, p)) == NULL) {
+ return False;
+ }
+
+ return True;
+}
+
+/**
* pull a DOM_SID from an extended dn string
* @param mem_ctx TALLOC_CTX
+ * @param extended_dn string
* @param flags string type of extended_dn
* @param sid pointer to a DOM_SID
* @return boolean inidicating success
**/
BOOL ads_get_sid_from_extended_dn(TALLOC_CTX *mem_ctx,
- const char *dn,
+ const char *extended_dn,
enum ads_extended_dn_flags flags,
DOM_SID *sid)
{
- char *p, *q;
+ char *p, *q, *dn;
- if (!dn) {
+ if (!extended_dn) {
return False;
}
+ /* otherwise extended_dn gets stripped off */
+ if ((dn = talloc_strdup(mem_ctx, extended_dn)) == NULL) {
+ return False;
+ }
/*
* ADS_EXTENDED_DN_HEX_STRING:
* <GUID=238e1963cb390f4bb032ba0105525a29>;<SID=010500000000000515000000bb68c8fd6b61b427572eb04556040000>;CN=gd,OU=berlin,OU=suse,DC=ber,DC=suse,DC=de
More information about the samba-cvs
mailing list