Wrap hdb_entry with hdb_entry_ex, patch originally from Andrew Bartlet

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@16378 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Love Hörnquist Åstrand
2005-12-12 12:40:12 +00:00
parent eb128f4928
commit 0c2369acd0
29 changed files with 445 additions and 409 deletions

View File

@@ -221,7 +221,7 @@ mit_prop_dump(void *arg, const char *file)
char line [2048];
FILE *f;
int lineno = 0;
struct hdb_entry ent;
struct hdb_entry_ex ent;
struct prop_data *pd = arg;
@@ -274,28 +274,28 @@ mit_prop_dump(void *arg, const char *file)
num_key_data = getint(&p); /* number of key-data */
extra_data_length = getint(&p); /* length of extra data */
q = nexttoken(&p); /* principal name */
krb5_parse_name(pd->context, q, &ent.principal);
krb5_parse_name(pd->context, q, &ent.entry.principal);
attributes = getint(&p); /* attributes */
attr_to_flags(attributes, &ent.flags);
attr_to_flags(attributes, &ent.entry.flags);
tmp = getint(&p); /* max life */
if(tmp != 0) {
ALLOC(ent.max_life);
*ent.max_life = tmp;
ALLOC(ent.entry.max_life);
*ent.entry.max_life = tmp;
}
tmp = getint(&p); /* max renewable life */
if(tmp != 0) {
ALLOC(ent.max_renew);
*ent.max_renew = tmp;
ALLOC(ent.entry.max_renew);
*ent.entry.max_renew = tmp;
}
tmp = getint(&p); /* expiration */
if(tmp != 0 && tmp != 2145830400) {
ALLOC(ent.valid_end);
*ent.valid_end = tmp;
ALLOC(ent.entry.valid_end);
*ent.entry.valid_end = tmp;
}
tmp = getint(&p); /* pw expiration */
if(tmp != 0) {
ALLOC(ent.pw_end);
*ent.pw_end = tmp;
ALLOC(ent.entry.pw_end);
*ent.entry.pw_end = tmp;
}
q = nexttoken(&p); /* last auth */
q = nexttoken(&p); /* last failed auth */
@@ -318,48 +318,49 @@ mit_prop_dump(void *arg, const char *file)
val = buf[0] | (buf[1] << 8) | (buf[2] << 16) | (buf[3] << 24);
ret = krb5_parse_name(pd->context, (char *)buf + 4, &princ);
free(buf);
ALLOC(ent.modified_by);
ent.modified_by->time = val;
ent.modified_by->principal = princ;
ALLOC(ent.entry.modified_by);
ent.entry.modified_by->time = val;
ent.entry.modified_by->principal = princ;
break;
default:
nexttoken(&p);
break;
}
}
ALLOC_SEQ(&ent.keys, num_key_data);
ALLOC_SEQ(&ent.entry.keys, num_key_data);
for(i = 0; i < num_key_data; i++) {
int key_versions;
key_versions = getint(&p); /* key data version */
ent.kvno = getint(&p); /* XXX kvno */
ent.entry.kvno = getint(&p); /* XXX kvno */
ALLOC(ent.keys.val[i].mkvno);
*ent.keys.val[i].mkvno = 0;
ALLOC(ent.entry.keys.val[i].mkvno);
*ent.entry.keys.val[i].mkvno = 0;
/* key version 0 -- actual key */
ent.keys.val[i].key.keytype = getint(&p); /* key type */
ent.entry.keys.val[i].key.keytype = getint(&p); /* key type */
tmp = getint(&p); /* key length */
/* the first two bytes of the key is the key length --
skip it */
krb5_data_alloc(&ent.keys.val[i].key.keyvalue, tmp - 2);
krb5_data_alloc(&ent.entry.keys.val[i].key.keyvalue, tmp - 2);
q = nexttoken(&p); /* key itself */
hex_to_octet_string(q + 4, &ent.keys.val[i].key.keyvalue);
hex_to_octet_string(q + 4, &ent.entry.keys.val[i].key.keyvalue);
if(key_versions > 1) {
/* key version 1 -- optional salt */
ALLOC(ent.keys.val[i].salt);
ent.keys.val[i].salt->type = getint(&p); /* salt type */
ALLOC(ent.entry.keys.val[i].salt);
ent.entry.keys.val[i].salt->type = getint(&p); /* salt type */
tmp = getint(&p); /* salt length */
if(tmp > 0) {
krb5_data_alloc(&ent.keys.val[i].salt->salt, tmp - 2);
krb5_data_alloc(&ent.entry.keys.val[i].salt->salt, tmp - 2);
q = nexttoken(&p); /* salt itself */
hex_to_octet_string(q + 4, &ent.keys.val[i].salt->salt);
hex_to_octet_string(q + 4,
&ent.entry.keys.val[i].salt->salt);
} else {
ent.keys.val[i].salt->salt.length = 0;
ent.keys.val[i].salt->salt.data = NULL;
ent.entry.keys.val[i].salt->salt.length = 0;
ent.entry.keys.val[i].salt->salt.data = NULL;
tmp = getint(&p); /* -1, if no data. */
}
fix_salt(pd->context, &ent, i);
fix_salt(pd->context, &ent.entry, i);
}
}
q = nexttoken(&p); /* extra data */