1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-03 13:47:25 +03:00

dssync keytab: add parsing and logging of servicePrincipalName-s

As with the userPrincipalName, this is for debugging purposes only (for now..).

Michael
(This used to be commit 7a1d526cba4c93bb858a60d04b6486507fc25398)
This commit is contained in:
Michael Adam 2008-07-29 12:55:19 +02:00
parent 7d7e8907ca
commit 31c67f939f

View File

@ -171,6 +171,8 @@ static NTSTATUS parse_object(TALLOC_CTX *mem_ctx,
bool got_pwd = false;
char *upn = NULL;
char **spn = NULL;
uint32_t num_spns = 0;
char *name = NULL;
uint32_t kvno = 0;
uint32_t uacc = 0;
@ -185,6 +187,19 @@ static NTSTATUS parse_object(TALLOC_CTX *mem_ctx,
attr = &cur->object.attribute_ctr.attributes[i];
if (attr->attid == DRSUAPI_ATTRIBUTE_servicePrincipalName) {
uint32_t count;
num_spns = attr->value_ctr.num_values;
spn = TALLOC_ARRAY(mem_ctx, char *, num_spns);
for (count = 0; count < num_spns; count++) {
blob = attr->value_ctr.values[count].blob;
pull_string_talloc(spn, NULL, 0,
&spn[count],
blob->data, blob->length,
STR_UNICODE);
}
}
if (attr->value_ctr.num_values != 1) {
continue;
}
@ -258,6 +273,13 @@ static NTSTATUS parse_object(TALLOC_CTX *mem_ctx,
if (upn) {
DEBUGADD(1,(", upn: %s", upn));
}
if (num_spns > 0) {
DEBUGADD(1, (", spns: ["));
for (i = 0; i < num_spns; i++) {
DEBUGADD(1, ("%s%s", spn[i],
(i+1 == num_spns)?"]":", "));
}
}
DEBUGADD(1,("\n"));
status = add_to_keytab_entries(mem_ctx, ctx, kvno, name, NULL,