~ubuntu-branches/ubuntu/hardy/openswan/hardy-updates

« back to all changes in this revision

Viewing changes to programs/starter/cmp.c

  • Committer: Bazaar Package Importer
  • Author(s): Rene Mayrhofer
  • Date: 2005-01-27 16:10:11 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20050127161011-idgybmyz3vwhpfiq
Tags: 2.3.0-2
Urgency HIGH due to security issue and problems with build-deps in sarge.
* Fix the security issue. Please see
  http://www.idefense.com/application/poi/display?id=190&
      type=vulnerabilities&flashstatus=false
  for more details. Thanks to Martin Schulze for informing me about
  this issue.
  Closes: #292458: Openswan XAUTH/PAM Buffer Overflow Vulnerability
* Added a Build-Dependency to lynx.
  Closes: #291143: openswan: FTBFS: Missing build dependency.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* FreeS/WAN comparisons functions (cmp.c)
 
2
 * Copyright (C) 2001-2002 Mathieu Lafon - Arkoon Network Security
 
3
 *
 
4
 * This program is free software; you can redistribute it and/or modify it
 
5
 * under the terms of the GNU General Public License as published by the
 
6
 * Free Software Foundation; either version 2 of the License, or (at your
 
7
 * option) any later version.  See <http://www.fsf.org/copyleft/gpl.txt>.
 
8
 *
 
9
 * This program is distributed in the hope that it will be useful, but
 
10
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 
11
 * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 
12
 * for more details.
 
13
 *
 
14
 * RCSID $Id: cmp.c,v 1.7 2004/12/01 07:33:14 ken Exp $
 
15
 */
 
16
 
 
17
#include <sys/queue.h>
 
18
#include <string.h>
 
19
 
 
20
#include "keywords.h"
 
21
 
 
22
#include "confread.h"
 
23
#include "cmp.h"
 
24
 
 
25
#define streqn(a,b) (a)?((b)?(strcmp(a,b)):(-1)):(b!=NULL)
 
26
 
 
27
#define STRCMP(obj) if (streqn(c1->obj,c2->obj)) return -1
 
28
#define VARCMP(obj) if (c1->obj!=c2->obj) return -1
 
29
#define MEMCMP(obj) if (memcmp(&c1->obj,&c2->obj,sizeof(c1->obj))) return -1
 
30
#define ADDCMP(obj) if (addrcmp(&c1->obj,&c2->obj)) return -1
 
31
#define SUBCMP(obj) if (samesubnet(&c1->obj,&c2->obj)==0) return -1
 
32
 
 
33
static int starter_cmp_end (struct starter_end *c1, struct starter_end *c2)
 
34
{
 
35
        if ((!c1) || (!c2)) return -1;
 
36
        VARCMP(addr_family);
 
37
        ADDCMP(addr);
 
38
        ADDCMP(nexthop);
 
39
        VARCMP(has_client);
 
40
        SUBCMP(subnet);
 
41
        STRCMP(iface);
 
42
        STRCMP(id);
 
43
        STRCMP(rsakey1);
 
44
        STRCMP(rsakey2);
 
45
        STRCMP(strings[KSCF_UPDOWN]);
 
46
        STRCMP(cert);
 
47
        VARCMP(has_client_wildcard);
 
48
        VARCMP(port);
 
49
        VARCMP(protocol);
 
50
#ifdef VIRTUAL_IP
 
51
        STRCMP(virt);
 
52
#endif
 
53
        return 0;
 
54
}
 
55
 
 
56
int starter_cmp_conn (struct starter_conn *c1, struct starter_conn *c2)
 
57
{
 
58
        if ((!c1) || (!c2)) return -1;
 
59
        STRCMP(name);
 
60
        VARCMP(policy);
 
61
        VARCMP(options[KBF_IKELIFETIME]);
 
62
        VARCMP(options[KBF_SALIFETIME]);
 
63
        VARCMP(options[KBF_REKEYMARGIN]);
 
64
        VARCMP(options[KBF_REKEYFUZZ]);
 
65
        VARCMP(options[KBF_KEYINGTRIES]);
 
66
        if (starter_cmp_end(&c1->left,&c2->left)) return -1;
 
67
        if (starter_cmp_end(&c1->right,&c2->right)) return -1;
 
68
        VARCMP(options[KBF_AUTO]);
 
69
        STRCMP(esp);
 
70
        STRCMP(ike);
 
71
        return 0;
 
72
}
 
73
 
 
74
int starter_cmp_klips (struct starter_config *c1, struct starter_config *c2)
 
75
{
 
76
        if ((!c1) || (!c2)) return -1;
 
77
        VARCMP(setup.options[KBF_KLIPSDEBUG]);
 
78
        VARCMP(setup.options[KBF_FRAGICMP]);
 
79
        VARCMP(setup.options[KBF_HIDETOS]);
 
80
        return 0;
 
81
}
 
82
 
 
83
int starter_cmp_pluto (struct starter_config *c1, struct starter_config *c2)
 
84
{
 
85
        if ((!c1) || (!c2)) return -1;
 
86
        VARCMP(setup.options[KBF_PLUTODEBUG]);
 
87
        STRCMP(setup.strings[KSF_PREPLUTO]);
 
88
        STRCMP(setup.strings[KSF_POSTPLUTO]);
 
89
        VARCMP(setup.options[KBF_UNIQUEIDS]);
 
90
        VARCMP(setup.options[KBF_STRICTCRLPOLICY]);
 
91
        VARCMP(setup.options[KBF_NOCRSEND]);
 
92
        VARCMP(setup.options[KBF_NHELPERS]);
 
93
#ifdef NAT_TRAVERSAL
 
94
        VARCMP(setup.options[KBF_NATTRAVERSAL]);
 
95
        VARCMP(setup.options[KBF_KEEPALIVE]);
 
96
#endif
 
97
#ifdef VIRTUAL_IP
 
98
        STRCMP(setup.strings[KSF_VIRTUALPRIVATE]);
 
99
#endif
 
100
        return 0;
 
101
}
 
102