#ifdef __APPLE__
#include <CoreFoundation/CoreFoundation.h>
+#if HAVE_SECURITY_FRAMEWORK
#include <Security/Security.h>
+#else
+typedef void * SecKeychainRef;
+#endif
#endif
struct localconf *lcconf;
setdefault();
lcconf->sock_vpncontrol = -1; /* not to be done during flush */
lcconf->racoon_conf = LC_DEFAULT_CF;
+ TAILQ_INIT(&lcconf->saved_msg_queue);
}
void
lcconf->natt_ka_interval = LC_DEFAULT_NATT_KA_INTERVAL;
lcconf->auto_exit_delay = 0;
lcconf->auto_exit_state &= ~LC_AUTOEXITSTATE_SET;
+ lcconf->auto_exit_state |= LC_AUTOEXITSTATE_CLIENT; /* always auto exit as default */
}
/*
return key;
}
-#ifdef __APPLE__
+#if defined(__APPLE__) && HAVE_KEYCHAIN
/*
* get PSK from keyChain.
*/
case IPSECDOI_ID_IPV6_ADDR_RANGE:
case IPSECDOI_ID_DER_ASN1_DN:
case IPSECDOI_ID_DER_ASN1_GN:
- goto end;
+ goto no_id;
break;
case IPSECDOI_ID_FQDN:
&cur_password,
NULL);
+ /* try find it using using only the peer id. */
+ if (status == errSecItemNotFound)
+ status = SecKeychainFindGenericPassword(keychain,
+ idlen,
+ peer_id,
+ 0,
+ 0,
+ &cur_password_len,
+ &cur_password,
+ NULL);
+
if (status == noErr)
goto end;
/* otherwise fall through to use the default value */
}
+no_id:
/* use the value in remote config sharedsecret field
this is either the value specified for lookup or the
default when lookup by id fails.
return -1;
}
+
+