From c36bc39594f223cce54dd2aaffc571ab18761568 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Love=20H=C3=B6rnquist=20=C3=85strand?= Date: Tue, 17 Jun 2003 12:53:16 +0000 Subject: [PATCH] use int2HDBFlags/HDBFlags2int From: Alberto Patino , Luke Howard Pointed out by Andrew Bartlett of Samba git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@12379 ec53bebd-3082-4978-b11e-865c3cabbd6b --- lib/hdb/hdb-ldap.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/lib/hdb/hdb-ldap.c b/lib/hdb/hdb-ldap.c index 7caf53ced..0b4cef02b 100644 --- a/lib/hdb/hdb-ldap.c +++ b/lib/hdb/hdb-ldap.c @@ -421,12 +421,10 @@ LDAP_entry2mods(krb5_context context, HDB * db, hdb_entry * ent, } } - 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"); @@ -629,7 +627,7 @@ LDAP_message2entry(krb5_context context, HDB * db, LDAPMessage * msg, char **values; memset(ent, 0, sizeof(*ent)); - memset(&ent->flags, 0, sizeof(HDBFlags)); + ent->flags = int2HDBFlags(0); ret = LDAP_get_string_value(db, msg, "krb5PrincipalName", @@ -801,7 +799,7 @@ LDAP_message2entry(krb5_context context, HDB * db, LDAPMessage * msg, } 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) {