[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Heimdal PATCH] LDAP backend support for OpenLDAP 2.1.x
- To: lukeh@PADL.COM
- Subject: Re: [Heimdal PATCH] LDAP backend support for OpenLDAP 2.1.x
- From: Alberto Patino <jalbertop@aranea.com.mx>
- Date: 09 Jun 2003 18:15:29 -0500
- Cc: lha@stacken.kth.se, heimdal-discuss@sics.se
- In-Reply-To: <200305291159.VAA11350@au.padl.com>
- References: <001701c315dc$ca3894c0$0e01a8c0@CELLO><1052511670.1966.69.camel@newton><amptm7qmav.fsf@nutcracker.stacken.kth.se><1053972016.3370.54.camel@newton> <200305262321.JAA76809@au.padl.com><amvfvwn1oo.fsf@nutcracker.stacken.kth.se> <200305291159.VAA11350@au.padl.com>
- Sender: owner-heimdal-discuss@sics.se
On Thu, 2003-05-29 at 06:59, Luke Howard wrote:
>
> There's another, subtle bug in the LDAP backend that Andrew Bartlett
> of the SAMBA team discovered: storing HDBFlags as an integer is both
> compiler and byte-order dependent.
>
> -- Luke
Sorry; I don't catch the problem very well. Those the heimdal
implementation of HDBFlags2int and int2HDBFlags are buggy?
Cause I patched the hdb-ldap.c with this code but I',m not sure if I got
back to the same problem. :-(
--- heimdal-0.6/lib/hdb/hdb-ldap.c 2003-06-09 17:34:24.000000000 -0500
+++ heimdal-0.6-work/lib/hdb/hdb-ldap.c 2003-06-09 17:26:20.000000000 -0500
@@ -421,12 +421,10 @@
}
}
- memset(&oflags, 0, sizeof(oflags));
- memcpy(&oflags, &orig.flags, sizeof(HDBFlags));
- memset(&nflags, 0, sizeof(nflags));
- memcpy(&nflags, &ent->flags, sizeof(HDBFlags));
+ oflags=HDBFlags2int(orig.flags);
+ nflags=HDBFlags2int(ent->flags);
- if (memcmp(&oflags, &nflags, sizeof(HDBFlags))) {
+ if ( oflags != nflags ){
rc = asprintf(&tmp, "%lu", nflags);
if (rc < 0) {
krb5_set_error_string(context, "asprintf: out of memory");
@@ -801,7 +799,8 @@
} else {
tmp = 0;
}
- memcpy(&ent->flags, &tmp, sizeof(HDBFlags));
+
+ ent->flags = int2HDBFlags(tmp);
values = ldap_get_values((LDAP *) db->db, msg, "krb5EncryptionType");
if (values != NULL) {