Author: obnox
Date: 2007-06-01 12:24:57 +0000 (Fri, 01 Jun 2007)
New Revision: 23291

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

Log:
Undo the somewhat naive change of r23279:
The clear text presentaion of the sid in the ldap expression
does work with w2k3 but not with w2k....

Thanks to Guenther for advising me of this issue.

Michael


Modified:
   branches/SAMBA_3_0/source/nsswitch/winbindd_ads.c
   branches/SAMBA_3_0_26/source/nsswitch/winbindd_ads.c


Changeset:
Modified: branches/SAMBA_3_0/source/nsswitch/winbindd_ads.c
===================================================================
--- branches/SAMBA_3_0/source/nsswitch/winbindd_ads.c   2007-06-01 12:18:16 UTC 
(rev 23290)
+++ branches/SAMBA_3_0/source/nsswitch/winbindd_ads.c   2007-06-01 12:24:57 UTC 
(rev 23291)
@@ -901,6 +901,7 @@
        ADS_STRUCT *ads = NULL;
        char *ldap_exp;
        NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
+       char *sidbinstr;
        char **members = NULL;
        int i;
        size_t num_members = 0;
@@ -939,14 +940,21 @@
                goto done;
        }
 
+       if ((sidbinstr = sid_binstring(group_sid)) == NULL) {
+               status = NT_STATUS_NO_MEMORY;
+               goto done;
+       }
+
        /* search for all members of the group */
-       if (!(ldap_exp = talloc_asprintf(tmp_ctx, "(objectSid=%s)",
-                                        sid_string_static(group_sid)))) 
+       if (!(ldap_exp = talloc_asprintf(tmp_ctx, "(objectSid=%s)", 
+                                        sidbinstr))) 
        {
+               SAFE_FREE(sidbinstr);
                DEBUG(1, ("ads: lookup_groupmem: talloc_asprintf for ldap_exp 
failed!\n"));
                status = NT_STATUS_NO_MEMORY;
                goto done;
        }
+       SAFE_FREE(sidbinstr);
 
        args.control = ADS_EXTENDED_DN_OID;
        args.val = ADS_EXTENDED_DN_HEX_STRING;

Modified: branches/SAMBA_3_0_26/source/nsswitch/winbindd_ads.c
===================================================================
--- branches/SAMBA_3_0_26/source/nsswitch/winbindd_ads.c        2007-06-01 
12:18:16 UTC (rev 23290)
+++ branches/SAMBA_3_0_26/source/nsswitch/winbindd_ads.c        2007-06-01 
12:24:57 UTC (rev 23291)
@@ -901,6 +901,7 @@
        ADS_STRUCT *ads = NULL;
        char *ldap_exp;
        NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
+       char *sidbinstr;
        char **members = NULL;
        int i;
        size_t num_members = 0;
@@ -939,14 +940,21 @@
                goto done;
        }
 
+       if ((sidbinstr = sid_binstring(group_sid)) == NULL) {
+               status = NT_STATUS_NO_MEMORY;
+               goto done;
+       }
+
        /* search for all members of the group */
-       if (!(ldap_exp = talloc_asprintf(tmp_ctx, "(objectSid=%s)",
-                                        sid_string_static(group_sid)))) 
+       if (!(ldap_exp = talloc_asprintf(tmp_ctx, "(objectSid=%s)", 
+                                        sidbinstr))) 
        {
+               SAFE_FREE(sidbinstr);
                DEBUG(1, ("ads: lookup_groupmem: talloc_asprintf for ldap_exp 
failed!\n"));
                status = NT_STATUS_NO_MEMORY;
                goto done;
        }
+       SAFE_FREE(sidbinstr);
 
        args.control = ADS_EXTENDED_DN_OID;
        args.val = ADS_EXTENDED_DN_HEX_STRING;

Reply via email to