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

« back to all changes in this revision

Viewing changes to src/modules/rlm_policy/parse.c

  • 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:
1
1
/*
2
2
 * parse.c              Parse a policy language
3
3
 *
4
 
 * Version:     $Id: parse.c,v 1.25 2008/03/07 10:03:35 aland Exp $
 
4
 * Version:     $Id$
5
5
 *
6
6
 *   This program is free software; you can redistribute it and/or modify
7
7
 *   it under the terms of the GNU General Public License as published by
22
22
 */
23
23
 
24
24
#include <freeradius-devel/ident.h>
25
 
RCSID("$Id: parse.c,v 1.25 2008/03/07 10:03:35 aland Exp $")
 
25
RCSID("$Id$")
26
26
 
27
27
#include "rlm_policy.h"
28
28
 
141
141
                                     char *buffer, size_t buflen)
142
142
{
143
143
        rad_assert(input != NULL);
144
 
 
145
 
        if (buffer) *buffer = '\0';
 
144
        rad_assert(buffer != NULL);
146
145
 
147
146
        switch (*input) {
148
147
        case '\0':
907
906
                          POLICY_RESERVED_UNKNOWN) == POLICY_RESERVED_ELSE)) {
908
907
                debug_tokens("[ELSE] ");
909
908
                token = policy_lex_file(lexer, 0, mystring, sizeof(mystring));
 
909
                rad_assert(token == POLICY_LEX_BARE_WORD);
910
910
 
911
911
                token = policy_lex_file(lexer, POLICY_LEX_FLAG_PEEK,
912
912
                                        mystring, sizeof(mystring));
915
915
                                  POLICY_RESERVED_UNKNOWN) == POLICY_RESERVED_IF)) {
916
916
                        token = policy_lex_file(lexer, 0,
917
917
                                                mystring, sizeof(mystring));
 
918
                        rad_assert(token == POLICY_LEX_BARE_WORD);
918
919
                        rcode = parse_if(lexer, &(this->if_false));
919
920
                } else {
920
921
                        rcode = parse_block(lexer, &(this->if_false));
1002
1003
        }
1003
1004
        memset(this, 0, sizeof(*this));
1004
1005
        this->item.type = POLICY_TYPE_ATTRIBUTE_LIST;
 
1006
        this->item.lineno = lexer->lineno;
 
1007
        this->where = where;
1005
1008
 
1006
1009
        token = policy_lex_file(lexer, 0, buffer, sizeof(buffer));
 
1010
        this->how = token;
 
1011
 
1007
1012
        switch (token) {
1008
1013
        case POLICY_LEX_BEFORE_WHERE_EQUALS:
1009
1014
        case POLICY_LEX_AFTER_WHERE_EQUALS:
1030
1035
                return 0;       /* unknown */
1031
1036
        }
1032
1037
 
1033
 
        this = rad_malloc(sizeof(*this));
1034
 
        memset(this, 0, sizeof(*this));
1035
 
 
1036
 
        this->item.type = POLICY_TYPE_ATTRIBUTE_LIST;
1037
 
        this->item.lineno = lexer->lineno;
1038
 
        this->where = where;
1039
 
        this->how = token;
1040
 
 
1041
1038
        if (!parse_block(lexer, &(this->attributes))) {
1042
1039
                rlm_policy_free_item((policy_item_t *) this);
1043
1040
                return 0;
1098
1095
        { "pre-proxy", RLM_COMPONENT_PRE_PROXY },
1099
1096
        { "post-proxy", RLM_COMPONENT_POST_PROXY },
1100
1097
        { "post-auth", RLM_COMPONENT_POST_AUTH },
 
1098
#ifdef WITH_COA
 
1099
        { "recv-coa", RLM_COMPONENT_RECV_COA },
 
1100
        { "send-coa", RLM_COMPONENT_SEND_COA },
 
1101
#endif
1101
1102
        { NULL, RLM_COMPONENT_COUNT }
1102
1103
};
1103
1104
 
1398
1399
                return 0;
1399
1400
        }
1400
1401
 
1401
 
        rcode = 0;
1402
1402
        while ((rcode = parse_statement(lexer, tail)) != 0) {
1403
1403
                if (rcode == 2) {
1404
1404
                        token = policy_lex_file(lexer, 0, NULL, 0);