Get the nametype OID from gss_display_name, print it, and then release
authorTheodore Tso <tytso@mit.edu>
Wed, 28 Feb 1996 16:44:07 +0000 (16:44 +0000)
committerTheodore Tso <tytso@mit.edu>
Wed, 28 Feb 1996 16:44:07 +0000 (16:44 +0000)
the nametype OID.  This tests gss_display_name()'s ability to return a
valid nametype, which can then be freed successfully.

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@7570 dc483132-0cff-0310-8789-dd5450dbe970

src/appl/gss-sample/ChangeLog
src/appl/gss-sample/gss-client.c

index 39b206f78a1a30caf6bb764af8d21591a4348f3d..20c8b64d1893e7c693b7e79d9e916d6cd86cf6c7 100644 (file)
@@ -1,3 +1,10 @@
+Wed Feb 28 11:42:26 1996  Theodore Y. Ts'o  <tytso@dcl>
+
+       * gss-client.c (call_server): Get the nametype OID from
+               gss_display_name, print it, and then release the nametype
+               OID.  This tests gss_display_name()'s ability to return a
+               valid nametype, which can then be freed successfully.
+
 Tue Feb 27 17:26:15 1996  Ezra Peisach  (epeisach@kangaroo.mit.edu)
 
        * configure.in: Add USE_ANAME.
index 3827336ffe349276268a930cb96a7fb009dfd986..986a7968cd308c90ef6890147aa12657ae478487 100644 (file)
@@ -130,7 +130,7 @@ int call_server(host, port, dov2, service_name, msg)
      gss_name_t                src_name, targ_name;
      gss_buffer_desc   sname, tname;
      OM_uint32         lifetime;
-     gss_OID           mechanism;
+     gss_OID           mechanism, name_type;
      int               is_local;
 #ifdef GSSAPI_V2
      OM_uint32         context_flags;
@@ -189,7 +189,7 @@ int call_server(host, port, dov2, service_name, msg)
      }
 
      maj_stat = gss_display_name(&min_stat, src_name, &sname,
-                                (gss_OID *) NULL);
+                                &name_type);
      if (maj_stat != GSS_S_COMPLETE) {
         display_status("displaying context", maj_stat, min_stat);
         return -1;
@@ -217,6 +217,18 @@ int call_server(host, port, dov2, service_name, msg)
      if (dov2) {
         size_t i;
 
+        maj_stat = gss_oid_to_str(&min_stat,
+                                  name_type,
+                                  &oid_name);
+        if (maj_stat != GSS_S_COMPLETE) {
+            display_status("converting oid->string", maj_stat, min_stat);
+            return -1;
+        }
+        fprintf(stderr, "Name type of source name is %s.\n",
+                oid_name.value);
+        (void) gss_release_buffer(&min_stat, &oid_name);
+        (void) gss_release_oid(&min_stat, &name_type);
+
         /* Now get the names supported by the mechanism */
         maj_stat = gss_inquire_names_for_mech(&min_stat,
                                               mechanism,