Thu Jan 24 06:47:51 2013 UTC ()
Fix handling of deletion notification.


(tteras)
diff -r1.48 -r1.49 src/crypto/dist/ipsec-tools/src/racoon/isakmp_inf.c

cvs diff -r1.48 -r1.49 src/crypto/dist/ipsec-tools/src/racoon/isakmp_inf.c (expand / switch to unified diff)

--- src/crypto/dist/ipsec-tools/src/racoon/isakmp_inf.c 2012/08/29 12:01:30 1.48
+++ src/crypto/dist/ipsec-tools/src/racoon/isakmp_inf.c 2013/01/24 06:47:50 1.49
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: isakmp_inf.c,v 1.48 2012/08/29 12:01:30 tteras Exp $ */ 1/* $NetBSD: isakmp_inf.c,v 1.49 2013/01/24 06:47:50 tteras Exp $ */
2 2
3/* Id: isakmp_inf.c,v 1.44 2006/05/06 20:45:52 manubsd Exp */ 3/* Id: isakmp_inf.c,v 1.44 2006/05/06 20:45:52 manubsd Exp */
4 4
5/* 5/*
6 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. 6 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
7 * All rights reserved. 7 * All rights reserved.
8 *  8 *
9 * Redistribution and use in source and binary forms, with or without 9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions 10 * modification, are permitted provided that the following conditions
11 * are met: 11 * are met:
12 * 1. Redistributions of source code must retain the above copyright 12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer. 13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright 14 * 2. Redistributions in binary form must reproduce the above copyright
@@ -482,27 +482,27 @@ isakmp_info_recv_d(iph1, delete, msgid,  @@ -482,27 +482,27 @@ isakmp_info_recv_d(iph1, delete, msgid,
482 num_spi = ntohs(delete->num_spi); 482 num_spi = ntohs(delete->num_spi);
483 tlen = ntohs(delete->h.len) - sizeof(struct isakmp_pl_d); 483 tlen = ntohs(delete->h.len) - sizeof(struct isakmp_pl_d);
484 484
485 if (tlen != num_spi * delete->spi_size) { 485 if (tlen != num_spi * delete->spi_size) {
486 plog(LLV_ERROR, LOCATION, iph1->remote, 486 plog(LLV_ERROR, LOCATION, iph1->remote,
487 "deletion payload with invalid length.\n"); 487 "deletion payload with invalid length.\n");
488 return 0; 488 return 0;
489 } 489 }
490 490
491 plog(LLV_DEBUG, LOCATION, iph1->remote, 491 plog(LLV_DEBUG, LOCATION, iph1->remote,
492 "delete payload for protocol %s\n", 492 "delete payload for protocol %s\n",
493 s_ipsecdoi_proto(delete->proto_id)); 493 s_ipsecdoi_proto(delete->proto_id));
494 494
495 if(!iph1->rmconf->weak_phase1_check && !encrypted) { 495 if((iph1 == NULL || !iph1->rmconf->weak_phase1_check) && !encrypted) {
496 plog(LLV_WARNING, LOCATION, iph1->remote, 496 plog(LLV_WARNING, LOCATION, iph1->remote,
497 "Ignoring unencrypted delete payload " 497 "Ignoring unencrypted delete payload "
498 "(check the weak_phase1_check option)\n"); 498 "(check the weak_phase1_check option)\n");
499 return 0; 499 return 0;
500 } 500 }
501 501
502 switch (delete->proto_id) { 502 switch (delete->proto_id) {
503 case IPSECDOI_PROTO_ISAKMP: 503 case IPSECDOI_PROTO_ISAKMP:
504 if (delete->spi_size != sizeof(isakmp_index)) { 504 if (delete->spi_size != sizeof(isakmp_index)) {
505 plog(LLV_ERROR, LOCATION, iph1->remote, 505 plog(LLV_ERROR, LOCATION, iph1->remote,
506 "delete payload with strange spi " 506 "delete payload with strange spi "
507 "size %d(proto_id:%d)\n", 507 "size %d(proto_id:%d)\n",
508 delete->spi_size, delete->proto_id); 508 delete->spi_size, delete->proto_id);