dssync keytab: add parsing and logging of servicePrincipalName-s
authorMichael Adam <obnox@samba.org>
Tue, 29 Jul 2008 10:55:19 +0000 (12:55 +0200)
committerMichael Adam <obnox@samba.org>
Fri, 1 Aug 2008 14:04:42 +0000 (16:04 +0200)
As with the userPrincipalName, this is for debugging purposes only (for now..).

Michael
(This used to be commit 7a1d526cba4c93bb858a60d04b6486507fc25398)

source3/libnet/libnet_dssync_keytab.c

index 6784326baf6340d86ad1f90b6f4bff0da700c2f0..0d17fdad3d7927793c97b9150a0c9895520a3f87 100644 (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,