~ubuntu-branches/ubuntu/natty/freeradius/natty-updates

« back to all changes in this revision

Viewing changes to src/include/libradius.h

  • Committer: Bazaar Package Importer
  • Author(s): Josip Rodin
  • Date: 2009-11-23 03:57:37 UTC
  • mfrom: (1.2.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 28.
  • Revision ID: james.westby@ubuntu.com-20091123035737-zsgtzhfych8hir68
Tags: 2.1.7+dfsg-1
* Adopting the package, closes: #536623.
* New upstream version, closes: #513484.
  + Fixes the blooper in unlang evaluation logic, closes: #526175.
* Used quilt (and added README.source), and moved upstream file patching
  into debian/patches/. The source is no longer in collab-maint git
  (to make it simpler for me to finally get this out the door), but
  kept the .gitignore should we need that again.
* Dropped the dialup_admin/bin/backup_radacct patch (integrated upstream).
* Dropped the raddb/Makefile patch (problem no longer exists upstream).
* Dropped the lib/packet.c lib/radius.c main/listen.c patches (was from
  upstream 2.0.5 anyway).
* Dropped references to otp.conf, it no longer exists upstream.
  Keep removing the conffile statoverride in prerm.
* Dropped references to snmp.conf, it no longer exists upstream.
  Keep removing the conffile statoverride in prerm.
* Ship /etc/freeradius/modules/* in the freeradius package.
* Stop shipping sites-enabled symlinks in the package and instead create
  them only on initial install, thanks to Matej Vela, closes: #533396.
* Add export PATH="${PATH:+$PATH:}/usr/sbin:/sbin" to the init script
  at the request of John Morrissey, closes: #550143.
* Stop installing /var/run/freeradius in the package to silence Lintian.
  The init script already recreates it at will.
* Remove executable bit from example.pl to silence Lintian.

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
 * libradius.h  Structures and prototypes
6
6
 *              for the radius library.
7
7
 *
8
 
 * Version:     $Id: libradius.h,v 1.153 2008/04/17 08:24:28 aland Exp $
 
8
 * Version:     $Id$
9
9
 *
10
10
 *   This program is free software; you can redistribute it and/or modify
11
11
 *   it under the terms of the GNU General Public License as published by
25
25
 */
26
26
 
27
27
#include <freeradius-devel/ident.h>
28
 
RCSIDH(libradius_h, "$Id: libradius.h,v 1.153 2008/04/17 08:24:28 aland Exp $")
 
28
RCSIDH(libradius_h, "$Id$")
29
29
 
30
30
#include <freeradius-devel/missing.h>
31
31
 
59
59
#define CHAP_VALUE_LENGTH       16
60
60
#define MAX_STRING_LEN          254     /* RFC2138: string 0-253 octets */
61
61
 
62
 
#  define VENDOR(x)             ((x >> 16) & 0x7fff)
 
62
#  define VENDOR(x)             ((x >> 16) & 0xffff)
63
63
 
64
64
#ifdef _LIBRADIUS
65
65
#  define AUTH_HDR_LEN          20
66
66
#  define VENDORPEC_USR         429
67
67
#define VENDORPEC_LUCENT        4846
68
68
#define VENDORPEC_STARENT       8164
69
 
#ifndef NDEBUG
70
 
#  define DEBUG                 fr_printf_log
71
 
#else
72
 
        /*
73
 
         *      Rely on the compiler to optimize it out.
74
 
         */
75
 
#  define DEBUG                 if (0) fr_printf_log
76
 
#endif
77
 
#  define debug_pair(vp)        do { if (librad_debug && fr_log_fp) { \
 
69
#  define DEBUG                 if (fr_debug_flag && fr_log_fp) fr_printf_log
 
70
#  define debug_pair(vp)        do { if (fr_debug_flag && fr_log_fp) { \
78
71
                                        fputc('\t', fr_log_fp); \
79
72
                                        vp_print(fr_log_fp, vp); \
80
73
                                        fputc('\n', fr_log_fp); \
105
98
        unsigned int            array : 1; /* pack multiples into 1 attr */
106
99
        unsigned int            has_value : 1; /* has a value */
107
100
        unsigned int            has_value_alias : 1; /* has a value alias */
 
101
        unsigned int            has_tlv : 1; /* has sub attributes */
 
102
        unsigned int            is_tlv : 1; /* is a sub attribute */
 
103
        unsigned int            encoded : 1; /* has been put into packet */
108
104
 
109
105
        int8_t                  tag;          /* tag for tunneled attributes */
110
106
        uint8_t                 encrypt;      /* encryption method */
119
115
#define FLAG_ENCRYPT_ASCEND_SECRET   (3)
120
116
 
121
117
typedef struct dict_attr {
122
 
        char                    name[40];
123
 
        int                     attr;
 
118
        unsigned int            attr;
124
119
        int                     type;
125
120
        int                     vendor;
126
121
        ATTR_FLAGS              flags;
 
122
        char                    name[1];
127
123
} DICT_ATTR;
128
124
 
129
125
typedef struct dict_value {
130
 
        int                     attr;
 
126
        unsigned int            attr;
131
127
        int                     value;
132
128
        char                    name[1];
133
129
} DICT_VALUE;
136
132
        int                     vendorpec;
137
133
        int                     type; /* length of type data */
138
134
        int                     length; /* length of length data */
 
135
        int                     flags;
139
136
        char                    name[1];
140
137
} DICT_VENDOR;
141
138
 
146
143
        struct in6_addr         ipv6addr;
147
144
        uint32_t                date;
148
145
        uint32_t                integer;
 
146
        int32_t                 sinteger;
149
147
        uint8_t                 filter[32];
150
148
        uint8_t                 ifid[8]; /* struct? */
151
149
        uint8_t                 ipv6prefix[18]; /* struct? */
152
150
        uint8_t                 ether[6];
 
151
        uint8_t                 *tlv;
153
152
} VALUE_PAIR_DATA;
154
153
 
155
154
typedef struct value_pair {
171
170
#define vp_ipv6prefix data.ipv6prefix
172
171
#define vp_filter     data.filter
173
172
#define vp_ether      data.ether
 
173
#define vp_signed     data.sinteger
 
174
#define vp_tlv        data.tlv
174
175
 
175
176
#if 0
176
177
#define vp_ipaddr     data.ipaddr.s_addr
224
225
/*
225
226
 *      Printing functions.
226
227
 */
227
 
void            librad_safeprint(char *in, size_t inlen,
 
228
int             fr_utf8_char(const uint8_t *str);
 
229
void            fr_print_string(const char *in, size_t inlen,
228
230
                                 char *out, size_t outlen);
229
231
int             vp_prints_value(char *out, size_t outlen,
230
232
                                VALUE_PAIR *vp, int delimitst);
242
244
int             dict_addvalue(const char *namestr, const char *attrstr, int value);
243
245
int             dict_init(const char *dir, const char *fn);
244
246
void            dict_free(void);
245
 
DICT_ATTR       *dict_attrbyvalue(int attr);
 
247
DICT_ATTR       *dict_attrbyvalue(unsigned int attr);
246
248
DICT_ATTR       *dict_attrbyname(const char *attr);
247
 
DICT_VALUE      *dict_valbyattr(int attr, int val);
248
 
DICT_VALUE      *dict_valbyname(int attr, const char *val);
 
249
DICT_VALUE      *dict_valbyattr(unsigned int attr, int val);
 
250
DICT_VALUE      *dict_valbyname(unsigned int attr, const char *val);
249
251
int             dict_vendorbyname(const char *name);
250
252
DICT_VENDOR     *dict_vendorbyvalue(int vendor);
251
253
 
299
301
                         const char *secret);
300
302
 
301
303
RADIUS_PACKET   *rad_alloc(int newvector);
 
304
RADIUS_PACKET   *rad_alloc_reply(RADIUS_PACKET *);
302
305
void            rad_free(RADIUS_PACKET **);
303
306
int             rad_pwencode(char *encpw, size_t *len, const char *secret,
304
307
                             const uint8_t *vector);
342
345
 *      Error functions.
343
346
 */
344
347
#ifdef _LIBRADIUS
345
 
void            librad_log(const char *, ...)
346
 
#ifdef __GNUC__
347
 
                __attribute__ ((format (printf, 1, 2)))
348
 
#endif
349
 
;
350
 
#endif
351
 
void            librad_perror(const char *, ...)
352
 
#ifdef __GNUC__
353
 
                __attribute__ ((format (printf, 1, 2)))
354
 
#endif
355
 
;
356
 
extern char     librad_errstr[];
357
 
extern int      librad_dodns;   /* 0 = no dns lookups */
358
 
extern int      librad_debug;   /* 0 = no debugging information */
359
 
extern int      librad_max_attributes; /* per incoming packet */
 
348
void            fr_strerror_printf(const char *, ...)
 
349
#ifdef __GNUC__
 
350
                __attribute__ ((format (printf, 1, 2)))
 
351
#endif
 
352
;
 
353
#endif
 
354
void            fr_perror(const char *, ...)
 
355
#ifdef __GNUC__
 
356
                __attribute__ ((format (printf, 1, 2)))
 
357
#endif
 
358
;
 
359
extern const char *fr_strerror(void);
 
360
extern int      fr_dns_lookups; /* 0 = no dns lookups */
 
361
extern int      fr_debug_flag;  /* 0 = no debugging information */
 
362
extern int      fr_max_attributes; /* per incoming packet */
 
363
#define FR_MAX_PACKET_CODE (52)
 
364
extern const char *fr_packet_codes[FR_MAX_PACKET_CODE];
360
365
extern FILE     *fr_log_fp;
361
366
void            fr_printf_log(const char *, ...)
362
367
#ifdef __GNUC__
388
393
 
389
394
int             ip_hton(const char *src, int af, fr_ipaddr_t *dst);
390
395
const char      *ip_ntoh(const fr_ipaddr_t *src, char *dst, size_t cnt);
391
 
 
 
396
int fr_ipaddr2sockaddr(const fr_ipaddr_t *ipaddr, int port,
 
397
                       struct sockaddr_storage *sa, socklen_t *salen);
 
398
int fr_sockaddr2ipaddr(const struct sockaddr_storage *sa, socklen_t salen,
 
399
                       fr_ipaddr_t *ipaddr, int * port);
392
400
 
393
401
 
394
402
#ifdef ASCEND_BINARY