~yolanda.robla/ubuntu/saucy/freeradius/dep-8-tests

« back to all changes in this revision

Viewing changes to src/main/valuepair.c

  • Committer: Bazaar Package Importer
  • Author(s): Josip Rodin
  • Date: 2009-11-23 03:57:37 UTC
  • mto: This revision was merged to the branch mainline in revision 7.
  • Revision ID: james.westby@ubuntu.com-20091123035737-snauioz5r9tf8sdr
Tags: upstream-2.1.7+dfsg
ImportĀ upstreamĀ versionĀ 2.1.7+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 * valuepair.c  Valuepair functions that are radiusd-specific
3
3
 *              and as such do not belong in the library.
4
4
 *
5
 
 * Version:     $Id: valuepair.c,v 1.90 2008/03/07 09:49:49 aland Exp $
 
5
 * Version:     $Id$
6
6
 *
7
7
 *   This program is free software; you can redistribute it and/or modify
8
8
 *   it under the terms of the GNU General Public License as published by
23
23
 */
24
24
 
25
25
#include <freeradius-devel/ident.h>
26
 
RCSID("$Id: valuepair.c,v 1.90 2008/03/07 09:49:49 aland Exp $")
 
26
RCSID("$Id$")
27
27
 
28
28
#include <freeradius-devel/radiusd.h>
29
29
#include <freeradius-devel/rad_assert.h>
80
80
                /*
81
81
                 *      Include substring matches.
82
82
                 */
83
 
                regcomp(&reg, (char *)check->vp_strvalue,
84
 
                        REG_EXTENDED);
 
83
                compare = regcomp(&reg, check->vp_strvalue, REG_EXTENDED);
 
84
                if (compare != 0) {
 
85
                        char buffer[256];
 
86
                        regerror(compare, &reg, buffer, sizeof(buffer));
 
87
 
 
88
                        RDEBUG("Invalid regular expression %s: %s",
 
89
                               check->vp_strvalue, buffer);
 
90
                        return -1;
 
91
                }
85
92
                compare = regexec(&reg, value,  REQUEST_MAX_REGEX + 1,
86
93
                                  rxmatch, 0);
87
94
                regfree(&reg);
150
157
                /*
151
158
                 *      Include substring matches.
152
159
                 */
153
 
                regcomp(&reg, (char *)check->vp_strvalue,
154
 
                        REG_EXTENDED);
 
160
                compare = regcomp(&reg, (char *)check->vp_strvalue,
 
161
                                  REG_EXTENDED);
 
162
                if (compare != 0) {
 
163
                        char buffer[256];
 
164
                        regerror(compare, &reg, buffer, sizeof(buffer));
 
165
 
 
166
                        RDEBUG("Invalid regular expression %s: %s",
 
167
                               check->vp_strvalue, buffer);
 
168
                        return -1;
 
169
                }
155
170
                compare = regexec(&reg, value,  REQUEST_MAX_REGEX + 1,
156
171
                                  rxmatch, 0);
157
172
                regfree(&reg);
166
181
         *      Tagged attributes are equal if and only if both the
167
182
         *      tag AND value match.
168
183
         */
169
 
        if ((ret == 0) && check->flags.has_tag) {
 
184
        if (check->flags.has_tag) {
170
185
                ret = ((int) vp->flags.tag) - ((int) check->flags.tag);
171
186
                if (ret != 0) return ret;
172
187
        }
263
278
 
264
279
 
265
280
/*
 
281
 *      Find a comparison function for two attributes.
 
282
 */
 
283
int radius_find_compare(int attribute)
 
284
{
 
285
        struct cmp *c;
 
286
 
 
287
        for (c = cmp; c; c = c->next) {
 
288
                if (c->attribute == attribute) {
 
289
                        return TRUE;
 
290
                }
 
291
        }
 
292
 
 
293
        return FALSE;
 
294
}
 
295
 
 
296
 
 
297
/*
266
298
 *      See what attribute we want to compare with.
267
299
 */
268
300
static int otherattr(int attr)
719
751
                fputc('\n', fr_log_fp);
720
752
                vp = vp->next;
721
753
        }
 
754
        fflush(fr_log_fp);
722
755
}