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

« back to all changes in this revision

Viewing changes to programs/pluto/defs.h

  • 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:
12
12
 * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
13
13
 * for more details.
14
14
 *
15
 
 * RCSID $Id: defs.h,v 1.34 2003/10/31 02:37:51 mcr Exp $
 
15
 * RCSID $Id: defs.h,v 1.36 2004/05/27 00:39:59 mcr Exp $
16
16
 */
17
17
 
 
18
#include "oswalloc.h"
 
19
 
18
20
#ifdef KLIPS
19
21
# define USED_BY_KLIPS  /* ignore */
20
22
#else
40
42
#define SOS_NOBODY      0       /* null serial number */
41
43
#define SOS_FIRST       1       /* first normal serial number */
42
44
 
43
 
/* memory allocation */
44
 
 
45
 
extern void *alloc_bytes(size_t size, const char *name);
46
 
#define alloc_thing(thing, name) (alloc_bytes(sizeof(thing), (name)))
47
 
 
48
 
extern void *clone_bytes(const void *orig, size_t size, const char *name);
49
 
#define clone_thing(orig, name) clone_bytes((const void *)&(orig), sizeof(orig), (name))
50
 
#define clone_str(str, name) \
51
 
    ((str) == NULL? NULL : clone_bytes((str), strlen((str))+1, (name)))
52
 
 
53
 
#ifdef LEAK_DETECTIVE
54
 
  extern void pfree(void *ptr);
55
 
  extern void report_leaks(void);
56
 
#else
57
 
# define pfree(ptr) free(ptr)   /* ordinary stdc free */
58
 
#endif
59
 
#define pfreeany(p) { if ((p) != NULL) pfree(p); }
60
 
#define replace(p, q) { pfreeany(p); (p) = (q); }
61
 
 
62
 
 
63
 
/* chunk is a simple pointer-and-size abstraction */
64
 
 
65
 
struct chunk {
66
 
    u_char *ptr;
67
 
    size_t len;
68
 
    };
69
 
typedef struct chunk chunk_t;
70
 
 
71
 
#define setchunk(ch, addr, size) { (ch).ptr = (addr); (ch).len = (size); }
72
 
/* NOTE: freeanychunk, unlike pfreeany, NULLs .ptr */
73
 
#define freeanychunk(ch) { pfreeany((ch).ptr); (ch).ptr = NULL; }
74
 
#define clonetochunk(ch, addr, size, name) \
75
 
    { (ch).ptr = clone_bytes((addr), (ch).len = (size), name); }
76
 
#define clonereplacechunk(ch, addr, size, name) \
77
 
    { pfreeany((ch).ptr); clonetochunk(ch, addr, size, name); }
78
 
#define chunkcpy(dst, chunk) \
79
 
    { memcpy(dst, chunk.ptr, chunk.len); dst += chunk.len;}
80
 
 
81
 
extern const chunk_t empty_chunk;
82
 
 
83
45
/* display a date either in local or UTC time */
84
 
extern char* timetoa(const time_t *time, bool utc);
 
46
extern char* timetoa(const time_t *time, bool utc, char *buf, size_t blen);
85
47
 
86
48
/* warns a predefined interval before expiry */
87
49
extern const char* check_expiry(time_t expiration_date,