Author: metze
Date: 2007-01-15 09:02:58 +0000 (Mon, 15 Jan 2007)
New Revision: 20795

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=20795

Log:
dom_sid_parse_talloc() gets an null terminated string as input,
the SDDL string has the sid strings embedded, so we need to create
a null terminated string...

metze
Modified:
   branches/SAMBA_4_0/source/libcli/security/sddl.c


Changeset:
Modified: branches/SAMBA_4_0/source/libcli/security/sddl.c
===================================================================
--- branches/SAMBA_4_0/source/libcli/security/sddl.c    2007-01-15 08:17:15 UTC 
(rev 20794)
+++ branches/SAMBA_4_0/source/libcli/security/sddl.c    2007-01-15 09:02:58 UTC 
(rev 20795)
@@ -100,9 +100,17 @@
 
        /* see if its in the numeric format */
        if (strncmp(sddl, "S-", 2) == 0) {
+               struct dom_sid *sid;
+               char *sid_str;
                size_t len = strspn(sddl+2, "-0123456789");
+               sid_str = talloc_strndup(mem_ctx, sddl, len+2);
+               if (!sid_str) {
+                       return NULL;
+               }
                (*sddlp) += len+2;
-               return dom_sid_parse_talloc(mem_ctx, sddl);
+               sid = dom_sid_parse_talloc(mem_ctx, sid_str);
+               talloc_free(sid_str);
+               return sid;
        }
 
        /* now check for one of the special codes */

Reply via email to