Use new gss_{im,ex}port_sec_context
authorPaul Park <pjpark@mit.edu>
Tue, 29 Aug 1995 18:44:47 +0000 (18:44 +0000)
committerPaul Park <pjpark@mit.edu>
Tue, 29 Aug 1995 18:44:47 +0000 (18:44 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@6630 dc483132-0cff-0310-8789-dd5450dbe970

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

index bb2ec0d8b4aa1e0e346bc668cebf7b2b159c968c..189914dc8ed02dfa851f9f2543b3a008dd4850f3 100644 (file)
@@ -1,4 +1,8 @@
 
+Tue Aug 29 13:24:50 EDT 1995   Paul Park       (pjpark@mit.edu)
+       * gss-{client,server}.c - Test gss_{ex,im}port_sec_context().
+
+
 Fri Jul 7 15:41:47 EDT 1995    Paul Park       (pjpark@mit.edu)
        * Makefile.in - Remove all explicit library handling.
        * configure.in - Add KRB5_LIBRARIES.
index da95f8449fa84499a61367711d04ffe04d249788..c57678610eb73512041fff96ac3983cd266d3f67 100644 (file)
@@ -110,7 +110,7 @@ int call_server(host, port, service_name, msg)
      char *msg;
 {
      gss_ctx_id_t context;
-     gss_buffer_desc in_buf, out_buf;
+     gss_buffer_desc in_buf, out_buf, context_token;
      int s, state;
      OM_uint32 maj_stat, min_stat;
 
@@ -122,6 +122,25 @@ int call_server(host, port, service_name, msg)
      if (client_establish_context(s, service_name, &context) < 0)
          return -1;
 
+     /*
+      * Attempt to save and then restore the context.
+      */
+     maj_stat = gss_export_sec_context(&min_stat,
+                                      &context,
+                                      &context_token);
+     if (maj_stat != GSS_S_COMPLETE) {
+        display_status("exporting context", maj_stat, min_stat);
+        return -1;
+     }
+     maj_stat = gss_import_sec_context(&min_stat,
+                                      &context_token,
+                                      &context);
+     if (maj_stat != GSS_S_COMPLETE) {
+        display_status("importing context", maj_stat, min_stat);
+        return -1;
+     }
+     (void) gss_release_buffer(&min_stat, &context_token);
+
      /* Seal the message */
      in_buf.value = msg;
      in_buf.length = strlen(msg) + 1;
index b90bd37fe28db069197fffca1c432649d31a3702..e4014457899b6f683855c1fbdc0c0807b096a21d 100644 (file)
@@ -180,7 +180,7 @@ int sign_server(s, service_name)
      char *service_name;
 {
      gss_cred_id_t server_creds;     
-     gss_buffer_desc client_name, xmit_buf, msg_buf;
+     gss_buffer_desc client_name, xmit_buf, msg_buf, context_token;
      gss_ctx_id_t context;
      OM_uint32 maj_stat, min_stat;
      int s2;
@@ -209,6 +209,25 @@ int sign_server(s, service_name)
                  client_name.value, ctime(&now));
          (void) gss_release_buffer(&min_stat, &client_name);
 
+         /*
+          * Attempt to save and then restore the context.
+          */
+         maj_stat = gss_export_sec_context(&min_stat,
+                                           &context,
+                                           &context_token);
+         if (maj_stat != GSS_S_COMPLETE) {
+              display_status("exporting context", maj_stat, min_stat);
+              break;
+         }
+         maj_stat = gss_import_sec_context(&min_stat,
+                                           &context_token,
+                                           &context);
+         if (maj_stat != GSS_S_COMPLETE) {
+              display_status("importing context", maj_stat, min_stat);
+              break;
+         }
+         (void) gss_release_buffer(&min_stat, &context_token);
+
          /* Receive the sealed message token */
          if (recv_token(s2, &xmit_buf) < 0)
               break;