talloc_set_destructor(p, samba_kdc_entry_destructor);
- entry_ex->ctx = p;
+ entry_ex->entry.skdc_entry = p;
userAccountControl = ldb_msg_find_attr_as_uint(msg, "userAccountControl", 0);
sdb_free_entry(entry_ex);
ZERO_STRUCTP(entry_ex);
} else {
- talloc_steal(kdc_db_ctx, entry_ex->ctx);
+ talloc_steal(kdc_db_ctx, p);
}
return ret;
/* make sure we do not have bogus data in there */
memset(&entry_ex->entry, 0, sizeof(struct sdb_entry));
- entry_ex->ctx = p;
+ entry_ex->entry.skdc_entry = p;
/* use 'whenCreated' */
entry_ex->entry.created_by.time = ldb_msg_find_krb5time_ldap_time(msg, "whenCreated", 0);
/* This doesn't free ent itself, that is for the eventual caller to do */
sdb_free_entry(entry_ex);
} else {
- talloc_steal(kdc_db_ctx, entry_ex->ctx);
+ talloc_steal(kdc_db_ctx, p);
}
return ret;
};
struct sdb_entry {
+ struct samba_kdc_entry *skdc_entry;
krb5_principal principal;
unsigned int kvno;
struct sdb_keys keys;
};
struct sdb_entry_ex {
- void *ctx;
struct sdb_entry entry;
};
const struct sdb_entry *s,
hdb_entry *h)
{
+ struct samba_kdc_entry *ske = s->skdc_entry;
unsigned int i;
int rc;
}
}
+ h->context = ske;
return 0;
error:
free_hdb_entry(h);
const struct sdb_entry_ex *s,
hdb_entry *h)
{
- int ret;
-
- ret = sdb_entry_to_hdb_entry(context, &s->entry, h);
- if (ret != 0) {
- return ret;
- }
-
- if (s->ctx != NULL) {
- struct samba_kdc_entry *skdc_entry;
-
- skdc_entry = talloc_get_type(s->ctx, struct samba_kdc_entry);
-
- h->context = skdc_entry;
- }
-
- return 0;
+ return sdb_entry_to_hdb_entry(context, &s->entry, h);
}
const struct sdb_entry *s,
krb5_db_entry *k)
{
+ struct samba_kdc_entry *ske = s->skdc_entry;
krb5_error_code ret;
int i;
}
}
+ k->e_data = (void *)ske;
return 0;
}
const struct sdb_entry_ex *s,
krb5_db_entry *k)
{
- int ret;
-
- ret = sdb_entry_ex_to_krb5_db_entry(context, &s->entry, k);
- if (ret != 0) {
- return ret;
- }
-
- if (s->ctx != NULL) {
- struct samba_kdc_entry *skdc_entry;
-
- skdc_entry = talloc_get_type(s->ctx, struct samba_kdc_entry);
-
- k->e_data = (void *)skdc_entry;
- }
-
- return 0;
+ return sdb_entry_ex_to_krb5_db_entry(context, &s->entry, k);
}