svn rev #25667: trunk/src/tests/gssapi/

ghudson@MIT.EDU ghudson at MIT.EDU
Thu Feb 2 22:19:28 EST 2012


http://src.mit.edu/fisheye/changelog/krb5/?cs=25667
Commit By: ghudson
Log Message:
Dump attributes differently in t_saslname

Dump the known attributes only once, before iterating over the
mechanisms, and display the short and long desc as well as the names
when doing so.


Changed Files:
U   trunk/src/tests/gssapi/t_saslname.c
Modified: trunk/src/tests/gssapi/t_saslname.c
===================================================================
--- trunk/src/tests/gssapi/t_saslname.c	2012-01-31 21:35:34 UTC (rev 25666)
+++ trunk/src/tests/gssapi/t_saslname.c	2012-02-03 03:19:28 UTC (rev 25667)
@@ -57,8 +57,8 @@
     displayStatus_1(msg, min_stat, GSS_C_MECH_CODE);
 }
 
-static
-OM_uint32 dumpMechAttrs(OM_uint32 *minor, gss_OID mech)
+static OM_uint32
+dumpKnownMechAttrs(OM_uint32 *minor, gss_OID mech)
 {
     OM_uint32 major, tmpMinor;
     gss_OID_set mech_attrs = GSS_C_NO_OID_SET;
@@ -71,34 +71,54 @@
         return major;
     }
 
-    printf("Mech attrs:  ");
-
-    for (i = 0; i < mech_attrs->count; i++) {
+    printf("Known attributes\n");
+    printf("----------------\n");
+    for (i = 0; i < known_attrs->count; i++) {
         gss_buffer_desc name = GSS_C_EMPTY_BUFFER;
         gss_buffer_desc short_desc = GSS_C_EMPTY_BUFFER;
         gss_buffer_desc long_desc = GSS_C_EMPTY_BUFFER;
 
-        major = gss_display_mech_attr(minor, &mech_attrs->elements[i],
+        major = gss_display_mech_attr(minor, &known_attrs->elements[i],
                                       &name, &short_desc, &long_desc);
         if (GSS_ERROR(major)) {
             displayStatus("gss_display_mech_attr", major, *minor);
             continue;
         }
-        printf("%.*s ", (int)name.length, (char *)name.value);
+        printf("%.*s (%.*s): %.*s\n", (int)short_desc.length,
+               (char *)short_desc.value, (int)name.length, (char *)name.value,
+               (int)long_desc.length, (char *)long_desc.value);
         gss_release_buffer(minor, &name);
         gss_release_buffer(minor, &short_desc);
         gss_release_buffer(minor, &long_desc);
     }
     printf("\n");
+    gss_release_oid_set(&tmpMinor, &mech_attrs);
+    gss_release_oid_set(&tmpMinor, &known_attrs);
+    return GSS_S_COMPLETE;
+}
 
-    printf("Known attrs: ");
+static
+OM_uint32 dumpMechAttrs(OM_uint32 *minor, gss_OID mech)
+{
+    OM_uint32 major, tmpMinor;
+    gss_OID_set mech_attrs = GSS_C_NO_OID_SET;
+    gss_OID_set known_attrs = GSS_C_NO_OID_SET;
+    size_t i;
 
-    for (i = 0; i < known_attrs->count; i++) {
+    major = gss_inquire_attrs_for_mech(minor, mech, &mech_attrs, &known_attrs);
+    if (GSS_ERROR(major)) {
+        displayStatus("gss_inquire_attrs_for_mech", major, *minor);
+        return major;
+    }
+
+    printf("Mech attrs:  ");
+
+    for (i = 0; i < mech_attrs->count; i++) {
         gss_buffer_desc name = GSS_C_EMPTY_BUFFER;
         gss_buffer_desc short_desc = GSS_C_EMPTY_BUFFER;
         gss_buffer_desc long_desc = GSS_C_EMPTY_BUFFER;
 
-        major = gss_display_mech_attr(minor, &known_attrs->elements[i],
+        major = gss_display_mech_attr(minor, &mech_attrs->elements[i],
                                       &name, &short_desc, &long_desc);
         if (GSS_ERROR(major)) {
             displayStatus("gss_display_mech_attr", major, *minor);
@@ -129,6 +149,8 @@
         return major;
     }
 
+    if (mechs->count > 0)
+        dumpKnownMechAttrs(&minor, mechs->elements);
     for (i = 0; i < mechs->count; i++) {
         gss_buffer_desc oidstr = GSS_C_EMPTY_BUFFER;
         gss_buffer_desc sasl_mech_name = GSS_C_EMPTY_BUFFER;



More information about the cvs-krb5 mailing list