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

« back to all changes in this revision

Viewing changes to scripts/snmp-proxy/net-radius-freeradius-dictionary.diff

  • 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:
 
1
--- Net-Radius-1.56.orig/Radius/Dictionary.pm   2008-06-20 14:08:57.000000000 +0100
 
2
+++ Net-Radius-1.56.1/Radius/Dictionary.pm      2008-06-20 15:54:33.000000000 +0100
 
3
@@ -30,14 +30,23 @@
 
4
 
 
5
 sub readfile {
 
6
   my ($self, $filename) = @_;
 
7
+  my $dict;
 
8
 
 
9
-  open DICT, "<$filename";
 
10
+  open $dict, "<$filename";
 
11
 
 
12
-  while (defined(my $l = <DICT>)) {
 
13
+  my @in_vendor = ();
 
14
+
 
15
+  while (defined(my $l = <$dict>)) {
 
16
     next if $l =~ /^\#/;
 
17
     next unless my @l = split /\s+/, $l;
 
18
 
 
19
-    if ($l[0] =~ m/^vendor$/i) 
 
20
+    if ($l[0] =~ m/^\$include$/i)
 
21
+    {
 
22
+        my @fn = split /\//, $filename;
 
23
+        $fn[$#fn] = $l[1];
 
24
+        $self->readfile(join '/', @fn);
 
25
+    }
 
26
+    elsif ($l[0] =~ m/^vendor$/i) 
 
27
     {
 
28
        if (defined $l[1] and defined $l[2] and $l[2] =~ /^[xo0-9]+$/)
 
29
        {
 
30
@@ -53,8 +62,42 @@
 
31
            warn "Garbled VENDOR line $l\n";
 
32
        }
 
33
     }
 
34
+    elsif ($l[0] =~ m/^begin-vendor$/i)
 
35
+    {
 
36
+    if ( defined $l[1] )
 
37
+    {
 
38
+        push @in_vendor, $l[1];
 
39
+    }
 
40
+    else
 
41
+    {
 
42
+           warn "Garbled BEGIN-VENDOR line $l\n";
 
43
+    }
 
44
+    }
 
45
+    elsif ($l[0] =~ m/^end-vendor$/i)
 
46
+    {
 
47
+    if ( defined $l[1] )
 
48
+    {
 
49
+        if ( $in_vendor[$#in_vendor] eq $l[1] ) {
 
50
+            pop @in_vendor;
 
51
+        }else {
 
52
+            warn "mismatched END-VENDOR line $l\n";
 
53
+        }
 
54
+    }
 
55
+    else
 
56
+    {
 
57
+           warn "Garbled END-VENDOR line $l\n";
 
58
+    }
 
59
+    }
 
60
     elsif ($l[0] =~ m/^attribute$/i) 
 
61
     {
 
62
+    if (@l == 5) {
 
63
+        my @tags = grep { not ( m/^encrypt=\d$/ or m/^has_tag$/ ) } split /,/, pop @l;
 
64
+        push @l, join ',', @tags if scalar @tags;
 
65
+    }
 
66
+    if (@l == 4 and scalar @in_vendor) {
 
67
+        push @l, $in_vendor[$#in_vendor];
 
68
+    }
 
69
+
 
70
        if (@l == 4)
 
71
        {
 
72
            $self->{attr}->{$l[1]}  = [@l[2,3]];
 
73
@@ -166,7 +209,7 @@
 
74
       warn "Warning: Weird dictionary line: $l\n";
 
75
     }
 
76
   }
 
77
-  close DICT;
 
78
+  close $dict;
 
79
 }
 
80
 
 
81
 # Accessors for standard attributes