fix build error
[mech_eap.git] / inquire_context.c
index fec50af..0553040 100644 (file)
@@ -53,27 +53,40 @@ gss_inquire_context(OM_uint32 *minor,
     }
 
     if (src_name != NULL) {
-        major = gss_duplicate_name(minor, ctx->initiatorName, src_name);
+        major = gssEapDuplicateName(minor, ctx->initiatorName, src_name);
         if (GSS_ERROR(major))
             goto cleanup;
     }
 
     if (targ_name != NULL) {
-        major = gss_duplicate_name(minor, ctx->acceptorName, targ_name);
+        major = gssEapDuplicateName(minor, ctx->acceptorName, targ_name);
         if (GSS_ERROR(major))
             goto cleanup;
     }
 
     if (lifetime_rec != NULL) {
-        time_t now = time(NULL);
-        time_t lifetime = now - ctx->expiryTime;
+        time_t now, lifetime;
 
-        if (lifetime < 0)
-            lifetime = 0;
+        if (ctx->expiryTime == 0) {
+            lifetime = GSS_C_INDEFINITE;
+        } else {
+            now = time(NULL);
+            lifetime = now - ctx->expiryTime;
+            if (lifetime < 0)
+                lifetime = 0;
+        }
 
         *lifetime_rec = lifetime;
     }
 
+    if (mech_type != NULL) {
+        if (!gssEapInternalizeOid(ctx->mechanismUsed, mech_type)) {
+            major = duplicateOid(minor, ctx->mechanismUsed, mech_type);
+            if (GSS_ERROR(major))
+                goto cleanup;
+        }
+    }
+
     if (ctx_flags != NULL) {
         *ctx_flags = ctx->gssFlags;
     }