#include <CoreFoundation/CoreFoundation.h>
#if HAVE_SECURITY_FRAMEWORK
#include <Security/Security.h>
#else
typedef void * SecKeychainRef;
#endif
#include <CoreFoundation/CoreFoundation.h>
#if HAVE_SECURITY_FRAMEWORK
#include <Security/Security.h>
#else
typedef void * SecKeychainRef;
#endif
id = racoon_calloc(1, 1 + id0->l - sizeof(struct ipsecdoi_id_b));
if (id == NULL) {
plog(LLV_ERROR, LOCATION, NULL,
id = racoon_calloc(1, 1 + id0->l - sizeof(struct ipsecdoi_id_b));
if (id == NULL) {
plog(LLV_ERROR, LOCATION, NULL,
status = SecKeychainSetPreferenceDomain(kSecPreferencesDomainSystem);
if (status != noErr) {
plog(LLV_ERROR, LOCATION, NULL,
status = SecKeychainSetPreferenceDomain(kSecPreferencesDomainSystem);
if (status != noErr) {
plog(LLV_ERROR, LOCATION, NULL,
if (secrettype == SECRETTYPE_KEYCHAIN_BY_ID && etype == ISAKMP_ETYPE_AGG) {
/* try looking up based on peers id */
if (secrettype == SECRETTYPE_KEYCHAIN_BY_ID && etype == ISAKMP_ETYPE_AGG) {
/* try looking up based on peers id */
int idlen = id_p->l - sizeof(struct ipsecdoi_id_b);
u_int8_t id_type = ((struct ipsecdoi_id_b *)(id_p->v))->type;
int idlen = id_p->l - sizeof(struct ipsecdoi_id_b);
u_int8_t id_type = ((struct ipsecdoi_id_b *)(id_p->v))->type;
if (key == NULL) {
plog(LLV_ERROR, LOCATION, NULL,
"failed to allocate key buffer.\n");
if (key == NULL) {
plog(LLV_ERROR, LOCATION, NULL,
"failed to allocate key buffer.\n");
- } else {
- memcpy(key->v, cur_password, key->l);
- key->v[cur_password_len] = 0;
- }
+ } else
+ memcpy(key->v, cur_password, cur_password_len);
if (safefile(lcconf->pathinfo[LC_PATHTYPE_PSK], 1) == 0)
fp = fopen(lcconf->pathinfo[LC_PATHTYPE_PSK], "r");
if (safefile(lcconf->pathinfo[LC_PATHTYPE_PSK], 1) == 0)
fp = fopen(lcconf->pathinfo[LC_PATHTYPE_PSK], "r");