if 2nd parameter of key_acquire() is NULL it panics.

key_acquire () does not really require 2nd argument.
1.179 -> 1.180 on kame.
This commit is contained in:
itojun 2001-01-10 18:52:51 +00:00
parent 5a91dd00b9
commit a688af5edf
1 changed files with 10 additions and 11 deletions

View File

@ -1,5 +1,5 @@
/* $NetBSD: key.c,v 1.40 2000/10/07 12:08:33 itojun Exp $ */
/* $KAME: key.c,v 1.170 2000/10/07 12:03:02 itojun Exp $ */
/* $NetBSD: key.c,v 1.41 2001/01/10 18:52:51 itojun Exp $ */
/* $KAME: key.c,v 1.180 2001/01/10 16:35:27 sakane Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@ -5525,19 +5525,16 @@ key_acquire(saidx, sp)
#ifndef IPSEC_NONBLOCK_ACQUIRE
struct secacq *newacq;
#endif
struct secpolicyindex *spidx = NULL;
u_int8_t satype;
int error = -1;
u_int32_t seq;
/* sanity check */
if (saidx == NULL || sp == NULL)
if (saidx == NULL)
panic("key_acquire: NULL pointer is passed.\n");
if ((satype = key_proto2satype(saidx->proto)) == 0)
panic("key_acquire: invalid proto is passed.\n");
spidx = &sp->spidx;
#ifndef IPSEC_NONBLOCK_ACQUIRE
/*
* We never do anything about acquirng SA. There is anather
@ -5600,12 +5597,14 @@ key_acquire(saidx, sp)
/* XXX proxy address (optional) */
/* set sadb_x_policy */
m = key_setsadbxpolicy(sp->policy, sp->spidx.dir, sp->id);
if (!m) {
error = ENOBUFS;
goto fail;
if (sp) {
m = key_setsadbxpolicy(sp->policy, sp->spidx.dir, sp->id);
if (!m) {
error = ENOBUFS;
goto fail;
}
m_cat(result, m);
}
m_cat(result, m);
/* XXX identity (optional) */
#if 0