add a testing path for setting initiator credentials meeting/moonshot2
authorLuke Howard <lukeh@padl.com>
Tue, 15 Mar 2011 07:56:27 +0000 (18:56 +1100)
committerLuke Howard <lukeh@padl.com>
Tue, 15 Mar 2011 09:01:04 +0000 (20:01 +1100)
requires GSSEAP_DEBUG to be defined, set environment variable
GSSEAP_CREDS to password

util_cred.c

index 6330118..64b9284 100644 (file)
@@ -120,6 +120,9 @@ gssEapAcquireCred(OM_uint32 *minor,
 {
     OM_uint32 major, tmpMinor;
     gss_cred_id_t cred;
+#ifdef GSSEAP_DEBUG
+    gss_buffer_desc envPassword;
+#endif
 
     /* XXX TODO validate with changed set_cred_option API */
     *pCred = GSS_C_NO_CREDENTIAL;
@@ -189,6 +192,15 @@ gssEapAcquireCred(OM_uint32 *minor,
         cred->flags |= CRED_FLAG_DEFAULT_IDENTITY;
     }
 
+#ifdef GSSEAP_DEBUG
+    if (password == GSS_C_NO_BUFFER &&
+        (envPassword.value = getenv("GSSEAP_CREDS")) != NULL) {
+        envPassword.length = strlen((char *)envPassword.value);
+        major = duplicateBuffer(minor, &envPassword, &cred->password);
+        if (GSS_ERROR(major))
+            goto cleanup;
+    } else
+#endif /* GSSEAP_DEBUG */
     if (password != GSS_C_NO_BUFFER) {
         major = duplicateBuffer(minor, password, &cred->password);
         if (GSS_ERROR(major))