+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.
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;
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;
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;
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;