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

« back to all changes in this revision

Viewing changes to linux/lib/libfreeswan/pfkey_v2_debug.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
 
/*
2
 
 * @(#) pfkey version 2 debugging messages
3
 
 *
4
 
 * Copyright (C) 2001  Richard Guy Briggs  <rgb@freeswan.org>
5
 
 *                 and Michael Richardson  <mcr@freeswan.org>
6
 
 * 
7
 
 * This program is free software; you can redistribute it and/or modify it
8
 
 * under the terms of the GNU General Public License as published by the
9
 
 * Free Software Foundation; either version 2 of the License, or (at your
10
 
 * option) any later version.  See <http://www.fsf.org/copyleft/gpl.txt>.
11
 
 * 
12
 
 * This program is distributed in the hope that it will be useful, but
13
 
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14
 
 * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15
 
 * for more details.
16
 
 *
17
 
 * RCSID $Id: pfkey_v2_debug.c,v 1.8.4.2 2004/04/16 12:32:56 mcr Exp $
18
 
 *
19
 
 */
20
 
 
21
 
#ifdef __KERNEL__
22
 
 
23
 
# include <linux/kernel.h>  /* for printk */
24
 
 
25
 
# include "freeswan/ipsec_kversion.h" /* for malloc switch */
26
 
# ifdef MALLOC_SLAB
27
 
#  include <linux/slab.h> /* kmalloc() */
28
 
# else /* MALLOC_SLAB */
29
 
#  include <linux/malloc.h> /* kmalloc() */
30
 
# endif /* MALLOC_SLAB */
31
 
# include <linux/errno.h>  /* error codes */
32
 
# include <linux/types.h>  /* size_t */
33
 
# include <linux/interrupt.h> /* mark_bh */
34
 
 
35
 
# include <linux/netdevice.h>   /* struct device, and other headers */
36
 
# include <linux/etherdevice.h> /* eth_type_trans */
37
 
extern int debug_pfkey;
38
 
 
39
 
#else /* __KERNEL__ */
40
 
 
41
 
# include <sys/types.h>
42
 
# include <linux/types.h>
43
 
# include <linux/errno.h>
44
 
 
45
 
#endif /* __KERNEL__ */
46
 
 
47
 
#include "freeswan.h"
48
 
#include "pfkeyv2.h"
49
 
#include "pfkey.h"
50
 
 
51
 
/* 
52
 
 * This file provides ASCII translations of PF_KEY magic numbers.
53
 
 *
54
 
 */
55
 
 
56
 
static char *pfkey_sadb_ext_strings[]={
57
 
  "reserved",                     /* SADB_EXT_RESERVED             0 */
58
 
  "security-association",         /* SADB_EXT_SA                   1 */
59
 
  "lifetime-current",             /* SADB_EXT_LIFETIME_CURRENT     2 */
60
 
  "lifetime-hard",                /* SADB_EXT_LIFETIME_HARD        3 */
61
 
  "lifetime-soft",                /* SADB_EXT_LIFETIME_SOFT        4 */
62
 
  "source-address",               /* SADB_EXT_ADDRESS_SRC          5 */
63
 
  "destination-address",          /* SADB_EXT_ADDRESS_DST          6 */
64
 
  "proxy-address",                /* SADB_EXT_ADDRESS_PROXY        7 */
65
 
  "authentication-key",           /* SADB_EXT_KEY_AUTH             8 */
66
 
  "cipher-key",                   /* SADB_EXT_KEY_ENCRYPT          9 */
67
 
  "source-identity",              /* SADB_EXT_IDENTITY_SRC         10 */
68
 
  "destination-identity",         /* SADB_EXT_IDENTITY_DST         11 */
69
 
  "sensitivity-label",            /* SADB_EXT_SENSITIVITY          12 */
70
 
  "proposal",                     /* SADB_EXT_PROPOSAL             13 */
71
 
  "supported-auth",               /* SADB_EXT_SUPPORTED_AUTH       14 */
72
 
  "supported-cipher",             /* SADB_EXT_SUPPORTED_ENCRYPT    15 */
73
 
  "spi-range",                    /* SADB_EXT_SPIRANGE             16 */
74
 
  "X-kmpprivate",                 /* SADB_X_EXT_KMPRIVATE          17 */
75
 
  "X-satype2",                    /* SADB_X_EXT_SATYPE2            18 */
76
 
  "X-security-association",       /* SADB_X_EXT_SA2                19 */
77
 
  "X-destination-address2",       /* SADB_X_EXT_ADDRESS_DST2       20 */
78
 
  "X-source-flow-address",        /* SADB_X_EXT_ADDRESS_SRC_FLOW   21 */
79
 
  "X-dest-flow-address",          /* SADB_X_EXT_ADDRESS_DST_FLOW   22 */
80
 
  "X-source-mask",                /* SADB_X_EXT_ADDRESS_SRC_MASK   23 */
81
 
  "X-dest-mask",                  /* SADB_X_EXT_ADDRESS_DST_MASK   24 */
82
 
  "X-set-debug",                  /* SADB_X_EXT_DEBUG              25 */
83
 
#ifdef NAT_TRAVERSAL
84
 
  "X-NAT-T-type",                 /* SADB_X_EXT_NAT_T_TYPE         26 */
85
 
  "X-NAT-T-sport",                /* SADB_X_EXT_NAT_T_SPORT        27 */
86
 
  "X-NAT-T-dport",                /* SADB_X_EXT_NAT_T_DPORT        28 */
87
 
  "X-NAT-T-OA",                   /* SADB_X_EXT_NAT_T_OA           29 */
88
 
#endif
89
 
};
90
 
 
91
 
const char *
92
 
pfkey_v2_sadb_ext_string(int ext)
93
 
{
94
 
  if(ext <= SADB_EXT_MAX) {
95
 
    return pfkey_sadb_ext_strings[ext];
96
 
  } else {
97
 
    return "unknown-ext";
98
 
  }
99
 
}
100
 
 
101
 
 
102
 
static char *pfkey_sadb_type_strings[]={
103
 
        "reserved",                     /* SADB_RESERVED      */
104
 
        "getspi",                       /* SADB_GETSPI        */
105
 
        "update",                       /* SADB_UPDATE        */
106
 
        "add",                          /* SADB_ADD           */
107
 
        "delete",                       /* SADB_DELETE        */
108
 
        "get",                          /* SADB_GET           */
109
 
        "acquire",                      /* SADB_ACQUIRE       */
110
 
        "register",                     /* SADB_REGISTER      */
111
 
        "expire",                       /* SADB_EXPIRE        */
112
 
        "flush",                        /* SADB_FLUSH         */
113
 
        "dump",                         /* SADB_DUMP          */
114
 
        "x-promisc",                    /* SADB_X_PROMISC     */
115
 
        "x-pchange",                    /* SADB_X_PCHANGE     */
116
 
        "x-groupsa",                    /* SADB_X_GRPSA       */
117
 
        "x-addflow(eroute)",            /* SADB_X_ADDFLOW     */
118
 
        "x-delflow(eroute)",            /* SADB_X_DELFLOW     */
119
 
        "x-debug",                      /* SADB_X_DEBUG       */
120
 
};
121
 
 
122
 
const char *
123
 
pfkey_v2_sadb_type_string(int sadb_type)
124
 
{
125
 
  if(sadb_type <= SADB_MAX) {
126
 
    return pfkey_sadb_type_strings[sadb_type];
127
 
  } else {
128
 
    return "unknown-sadb-type";
129
 
  }
130
 
}
131
 
 
132
 
 
133
 
 
134
 
 
135
 
/*
136
 
 * $Log: pfkey_v2_debug.c,v $
137
 
 * Revision 1.8.4.2  2004/04/16 12:32:56  mcr
138
 
 *      erroneously pullup some freeswan->openswan changes that
139
 
 *      are really for 2.2.
140
 
 *
141
 
 * Revision 1.8.4.1  2004/03/21 05:23:31  mcr
142
 
 *     pullup of freeswan->openswan and CR/CERT patches from HEAD
143
 
 *
144
 
 * Revision 1.9  2004/03/08 01:59:08  ken
145
 
 * freeswan.h -> openswan.h
146
 
 *
147
 
 * Revision 1.8  2003/12/10 01:20:19  mcr
148
 
 *      NAT-traversal patches to KLIPS.
149
 
 *
150
 
 * Revision 1.7  2002/09/20 05:01:26  rgb
151
 
 * Fixed limit inclusion error in both type and ext string conversion.
152
 
 *
153
 
 * Revision 1.6  2002/04/24 07:55:32  mcr
154
 
 *      #include patches and Makefiles for post-reorg compilation.
155
 
 *
156
 
 * Revision 1.5  2002/04/24 07:36:40  mcr
157
 
 * Moved from ./lib/pfkey_v2_debug.c,v
158
 
 *
159
 
 * Revision 1.4  2002/01/29 22:25:36  rgb
160
 
 * Re-add ipsec_kversion.h to keep MALLOC happy.
161
 
 *
162
 
 * Revision 1.3  2002/01/29 01:59:09  mcr
163
 
 *      removal of kversions.h - sources that needed it now use ipsec_param.h.
164
 
 *      updating of IPv6 structures to match latest in6.h version.
165
 
 *      removed dead code from openswan.h that also duplicated kversions.h
166
 
 *      code.
167
 
 *
168
 
 * Revision 1.2  2002/01/20 20:34:50  mcr
169
 
 *      added pfkey_v2_sadb_type_string to decode sadb_type to string.
170
 
 *
171
 
 * Revision 1.1  2001/11/27 05:30:06  mcr
172
 
 *      initial set of debug strings for pfkey debugging.
173
 
 *      this will eventually only be included for debug builds.
174
 
 *
175
 
 * Revision 1.1  2001/09/21 04:12:03  mcr
176
 
 *      first compilable version.
177
 
 *
178
 
 *
179
 
 * Local variables:
180
 
 * c-file-style: "linux"
181
 
 * End:
182
 
 *
183
 
 */