diff options
-rw-r--r-- | source3/libnet/libnet_dssync_keytab.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/source3/libnet/libnet_dssync_keytab.c b/source3/libnet/libnet_dssync_keytab.c index 6784326baf..0d17fdad3d 100644 --- a/source3/libnet/libnet_dssync_keytab.c +++ b/source3/libnet/libnet_dssync_keytab.c @@ -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, |