From: Michael Adam Date: Tue, 29 Jul 2008 10:55:19 +0000 (+0200) Subject: dssync keytab: add parsing and logging of servicePrincipalName-s X-Git-Tag: samba-3.3.0pre1~323 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7a1d526cba4c93bb858a60d04b6486507fc25398;p=thirdparty%2Fsamba.git dssync keytab: add parsing and logging of servicePrincipalName-s As with the userPrincipalName, this is for debugging purposes only (for now..). Michael --- diff --git a/source/libnet/libnet_dssync_keytab.c b/source/libnet/libnet_dssync_keytab.c index 6784326baf6..0d17fdad3d7 100644 --- a/source/libnet/libnet_dssync_keytab.c +++ b/source/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,