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

« back to all changes in this revision

Viewing changes to linux/include/openswan/passert.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:
 
1
/*
 
2
 * sanitize a string into a printable format.
 
3
 *
 
4
 * Copyright (C) 1998-2002  D. Hugh Redelmeier.
 
5
 * Copyright (C) 2003  Michael Richardson <mcr@freeswan.org>
 
6
 * 
 
7
 * This library is free software; you can redistribute it and/or modify it
 
8
 * under the terms of the GNU Library General Public License as published by
 
9
 * the Free Software Foundation; either version 2 of the License, or (at your
 
10
 * option) any later version.  See <http://www.fsf.org/copyleft/lgpl.txt>.
 
11
 * 
 
12
 * This library 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 Library General Public
 
15
 * License for more details.
 
16
 *
 
17
 * RCSID $Id: passert.h,v 1.7 2004/10/21 18:44:42 mcr Exp $
 
18
 */
 
19
 
 
20
#include "openswan.h"
 
21
 
 
22
#ifndef _OPENSWAN_PASSERT_H
 
23
#define _OPENSWAN_PASSERT_H
 
24
/* our versions of assert: log result */
 
25
 
 
26
#ifdef DEBUG
 
27
 
 
28
typedef void (*openswan_passert_fail_t)(const char *pred_str,
 
29
                                        const char *file_str,
 
30
                                        unsigned long line_no) NEVER_RETURNS;
 
31
 
 
32
openswan_passert_fail_t openswan_passert_fail;
 
33
 
 
34
extern void pexpect_log(const char *pred_str
 
35
                        , const char *file_str, unsigned long line_no);
 
36
 
 
37
# define impossible() do { \
 
38
    if(openswan_passert_fail) {                                 \
 
39
      (*openswan_passert_fail)("impossible", __FILE__, __LINE__); \
 
40
    }} while(0)
 
41
 
 
42
extern void switch_fail(int n
 
43
    , const char *file_str, unsigned long line_no) NEVER_RETURNS;
 
44
 
 
45
# define bad_case(n) switch_fail((int) n, __FILE__, __LINE__)
 
46
 
 
47
# define passert(pred) do { \
 
48
        if (!(pred)) \
 
49
          if(openswan_passert_fail) { \
 
50
            (*openswan_passert_fail)(#pred, __FILE__, __LINE__);        \
 
51
          } \
 
52
  } while(0)
 
53
 
 
54
# define pexpect(pred) do { \
 
55
        if (!(pred)) \
 
56
            pexpect_log(#pred, __FILE__, __LINE__); \
 
57
  } while(0)
 
58
 
 
59
/* assert that an err_t is NULL; evaluate exactly once */
 
60
# define happy(x) { \
 
61
        err_t ugh = x; \
 
62
        if (ugh != NULL) \
 
63
          if(openswan_passert_fail) { (*openswan_passert_fail)(ugh, __FILE__, __LINE__); }  \
 
64
    }
 
65
 
 
66
#else /*!DEBUG*/
 
67
 
 
68
# define impossible() abort()
 
69
# define bad_case(n) abort()
 
70
# define passert(pred)  { }     /* do nothing */
 
71
# define happy(x)  { (void) x; }        /* evaluate non-judgementally */
 
72
 
 
73
#endif /*!DEBUG*/
 
74
 
 
75
#endif /* _OPENSWAN_PASSERT_H */