summaryrefslogtreecommitdiff
path: root/source4/pidl/lib/Parse/Pidl
diff options
context:
space:
mode:
Diffstat (limited to 'source4/pidl/lib/Parse/Pidl')
-rw-r--r--source4/pidl/lib/Parse/Pidl/Expr.pm1211
-rw-r--r--source4/pidl/lib/Parse/Pidl/NDR.pm7
-rw-r--r--source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm96
-rw-r--r--source4/pidl/lib/Parse/Pidl/Util.pm8
4 files changed, 722 insertions, 600 deletions
diff --git a/source4/pidl/lib/Parse/Pidl/Expr.pm b/source4/pidl/lib/Parse/Pidl/Expr.pm
index 34c30b824f..f64db508d6 100644
--- a/source4/pidl/lib/Parse/Pidl/Expr.pm
+++ b/source4/pidl/lib/Parse/Pidl/Expr.pm
@@ -38,7 +38,9 @@ sub new {
},
GOTOS => {
'exp' => 2,
- 'func' => 11
+ 'var' => 11,
+ 'func' => 12,
+ 'possible_pointer' => 13
}
},
{#State 1
@@ -54,33 +56,33 @@ sub new {
'VAR' => 10
},
GOTOS => {
- 'exp' => 12,
- 'func' => 11
+ 'exp' => 14,
+ 'var' => 11,
+ 'func' => 12,
+ 'possible_pointer' => 13
}
},
{#State 2
ACTIONS => {
- '' => 14,
- "-" => 13,
- "<" => 15,
- "+" => 16,
- "%" => 17,
- "==" => 18,
- "^" => 19,
- "*" => 20,
- ">>" => 21,
- "!=" => 22,
- "?" => 23,
- "&&" => 24,
- "||" => 25,
- "&" => 26,
- "/" => 27,
- "->" => 28,
- "|" => 29,
- "<<" => 31,
- "=>" => 30,
+ '' => 16,
+ "-" => 15,
+ "<" => 17,
+ "+" => 18,
+ "%" => 19,
+ "==" => 20,
+ "^" => 21,
+ "*" => 22,
+ ">>" => 23,
+ "!=" => 24,
+ "?" => 25,
+ "||" => 26,
+ "&&" => 27,
+ "&" => 28,
+ "/" => 29,
+ "|" => 30,
+ "<<" => 32,
+ "=>" => 31,
"<=" => 33,
- "." => 32,
">" => 34
}
},
@@ -98,7 +100,9 @@ sub new {
},
GOTOS => {
'exp' => 35,
- 'func' => 11
+ 'var' => 11,
+ 'func' => 12,
+ 'possible_pointer' => 13
}
},
{#State 4
@@ -115,7 +119,9 @@ sub new {
},
GOTOS => {
'exp' => 36,
- 'func' => 11
+ 'var' => 11,
+ 'func' => 12,
+ 'possible_pointer' => 13
}
},
{#State 5
@@ -137,8 +143,10 @@ sub new {
'VAR' => 10
},
GOTOS => {
- 'exp' => 37,
- 'func' => 11
+ 'exp' => 38,
+ 'var' => 37,
+ 'func' => 12,
+ 'possible_pointer' => 13
}
},
{#State 8
@@ -154,46 +162,49 @@ sub new {
'VAR' => 10
},
GOTOS => {
- 'exp' => 38,
- 'func' => 11
+ 'exp' => 39,
+ 'var' => 11,
+ 'func' => 12,
+ 'possible_pointer' => 13
}
},
{#State 9
ACTIONS => {
- "-" => 1,
- "~" => 3,
- "&" => 4,
- 'TEXT' => 6,
- 'NUM' => 5,
- "!" => 8,
- "(" => 7,
"*" => 9,
- 'VAR' => 10
+ 'VAR' => 41
},
GOTOS => {
- 'exp' => 39,
- 'func' => 11
+ 'possible_pointer' => 40
}
},
{#State 10
ACTIONS => {
- "(" => 40
+ "(" => 42
},
- DEFAULT => -5
+ DEFAULT => -30
},
{#State 11
- DEFAULT => -3
+ ACTIONS => {
+ "->" => 43,
+ "." => 44
+ },
+ DEFAULT => -4
},
{#State 12
+ DEFAULT => -3
+ },
+ {#State 13
+ DEFAULT => -32
+ },
+ {#State 14
ACTIONS => {
- "^" => 19,
- "=>" => 30,
- "." => 32,
+ "^" => 21,
+ "=>" => 31,
"<=" => 33
},
- DEFAULT => -29
+ DEFAULT => -26
},
- {#State 13
+ {#State 15
ACTIONS => {
"-" => 1,
"~" => 3,
@@ -206,14 +217,16 @@ sub new {
'VAR' => 10
},
GOTOS => {
- 'exp' => 41,
- 'func' => 11
+ 'exp' => 45,
+ 'var' => 11,
+ 'func' => 12,
+ 'possible_pointer' => 13
}
},
- {#State 14
+ {#State 16
DEFAULT => 0
},
- {#State 15
+ {#State 17
ACTIONS => {
"-" => 1,
"~" => 3,
@@ -226,11 +239,13 @@ sub new {
'VAR' => 10
},
GOTOS => {
- 'exp' => 42,
- 'func' => 11
+ 'exp' => 46,
+ 'var' => 11,
+ 'func' => 12,
+ 'possible_pointer' => 13
}
},
- {#State 16
+ {#State 18
ACTIONS => {
"-" => 1,
"~" => 3,
@@ -243,11 +258,13 @@ sub new {
'VAR' => 10
},
GOTOS => {
- 'exp' => 43,
- 'func' => 11
+ 'exp' => 47,
+ 'var' => 11,
+ 'func' => 12,
+ 'possible_pointer' => 13
}
},
- {#State 17
+ {#State 19
ACTIONS => {
"-" => 1,
"~" => 3,
@@ -260,11 +277,13 @@ sub new {
'VAR' => 10
},
GOTOS => {
- 'exp' => 44,
- 'func' => 11
+ 'exp' => 48,
+ 'var' => 11,
+ 'func' => 12,
+ 'possible_pointer' => 13
}
},
- {#State 18
+ {#State 20
ACTIONS => {
"-" => 1,
"~" => 3,
@@ -277,11 +296,13 @@ sub new {
'VAR' => 10
},
GOTOS => {
- 'exp' => 45,
- 'func' => 11
+ 'exp' => 49,
+ 'var' => 11,
+ 'func' => 12,
+ 'possible_pointer' => 13
}
},
- {#State 19
+ {#State 21
ACTIONS => {
"-" => 1,
"~" => 3,
@@ -294,11 +315,13 @@ sub new {
'VAR' => 10
},
GOTOS => {
- 'exp' => 46,
- 'func' => 11
+ 'exp' => 50,
+ 'var' => 11,
+ 'func' => 12,
+ 'possible_pointer' => 13
}
},
- {#State 20
+ {#State 22
ACTIONS => {
"-" => 1,
"~" => 3,
@@ -311,11 +334,13 @@ sub new {
'VAR' => 10
},
GOTOS => {
- 'exp' => 47,
- 'func' => 11
+ 'exp' => 51,
+ 'var' => 11,
+ 'func' => 12,
+ 'possible_pointer' => 13
}
},
- {#State 21
+ {#State 23
ACTIONS => {
"-" => 1,
"~" => 3,
@@ -328,11 +353,13 @@ sub new {
'VAR' => 10
},
GOTOS => {
- 'exp' => 48,
- 'func' => 11
+ 'exp' => 52,
+ 'var' => 11,
+ 'func' => 12,
+ 'possible_pointer' => 13
}
},
- {#State 22
+ {#State 24
ACTIONS => {
"-" => 1,
"~" => 3,
@@ -345,11 +372,13 @@ sub new {
'VAR' => 10
},
GOTOS => {
- 'exp' => 49,
- 'func' => 11
+ 'exp' => 53,
+ 'var' => 11,
+ 'func' => 12,
+ 'possible_pointer' => 13
}
},
- {#State 23
+ {#State 25
ACTIONS => {
"-" => 1,
"~" => 3,
@@ -362,11 +391,13 @@ sub new {
'VAR' => 10
},
GOTOS => {
- 'exp' => 50,
- 'func' => 11
+ 'exp' => 54,
+ 'var' => 11,
+ 'func' => 12,
+ 'possible_pointer' => 13
}
},
- {#State 24
+ {#State 26
ACTIONS => {
"-" => 1,
"~" => 3,
@@ -379,11 +410,13 @@ sub new {
'VAR' => 10
},
GOTOS => {
- 'exp' => 51,
- 'func' => 11
+ 'exp' => 55,
+ 'var' => 11,
+ 'func' => 12,
+ 'possible_pointer' => 13
}
},
- {#State 25
+ {#State 27
ACTIONS => {
"-" => 1,
"~" => 3,
@@ -396,11 +429,13 @@ sub new {
'VAR' => 10
},
GOTOS => {
- 'exp' => 52,
- 'func' => 11
+ 'exp' => 56,
+ 'var' => 11,
+ 'func' => 12,
+ 'possible_pointer' => 13
}
},
- {#State 26
+ {#State 28
ACTIONS => {
"-" => 1,
"~" => 3,
@@ -413,11 +448,13 @@ sub new {
'VAR' => 10
},
GOTOS => {
- 'exp' => 53,
- 'func' => 11
+ 'exp' => 57,
+ 'var' => 11,
+ 'func' => 12,
+ 'possible_pointer' => 13
}
},
- {#State 27
+ {#State 29
ACTIONS => {
"-" => 1,
"~" => 3,
@@ -430,16 +467,13 @@ sub new {
'VAR' => 10
},
GOTOS => {
- 'exp' => 54,
- 'func' => 11
- }
- },
- {#State 28
- ACTIONS => {
- 'VAR' => 55
+ 'exp' => 58,
+ 'var' => 11,
+ 'func' => 12,
+ 'possible_pointer' => 13
}
},
- {#State 29
+ {#State 30
ACTIONS => {
"-" => 1,
"~" => 3,
@@ -452,11 +486,13 @@ sub new {
'VAR' => 10
},
GOTOS => {
- 'exp' => 56,
- 'func' => 11
+ 'exp' => 59,
+ 'var' => 11,
+ 'func' => 12,
+ 'possible_pointer' => 13
}
},
- {#State 30
+ {#State 31
ACTIONS => {
"-" => 1,
"~" => 3,
@@ -469,11 +505,13 @@ sub new {
'VAR' => 10
},
GOTOS => {
- 'exp' => 57,
- 'func' => 11
+ 'exp' => 60,
+ 'var' => 11,
+ 'func' => 12,
+ 'possible_pointer' => 13
}
},
- {#State 31
+ {#State 32
ACTIONS => {
"-" => 1,
"~" => 3,
@@ -486,13 +524,10 @@ sub new {
'VAR' => 10
},
GOTOS => {
- 'exp' => 58,
- 'func' => 11
- }
- },
- {#State 32
- ACTIONS => {
- 'VAR' => 59
+ 'exp' => 61,
+ 'var' => 11,
+ 'func' => 12,
+ 'possible_pointer' => 13
}
},
{#State 33
@@ -508,8 +543,10 @@ sub new {
'VAR' => 10
},
GOTOS => {
- 'exp' => 60,
- 'func' => 11
+ 'exp' => 62,
+ 'var' => 11,
+ 'func' => 12,
+ 'possible_pointer' => 13
}
},
{#State 34
@@ -525,89 +562,91 @@ sub new {
'VAR' => 10
},
GOTOS => {
- 'exp' => 61,
- 'func' => 11
+ 'exp' => 63,
+ 'var' => 11,
+ 'func' => 12,
+ 'possible_pointer' => 13
}
},
{#State 35
ACTIONS => {
- "^" => 19,
- "=>" => 30,
- "." => 32,
+ "^" => 21,
+ "=>" => 31,
"<=" => 33
},
- DEFAULT => -7
+ DEFAULT => -5
},
{#State 36
ACTIONS => {
- "^" => 19,
- "=>" => 30,
- "." => 32,
+ "^" => 21,
+ "=>" => 31,
"<=" => 33
},
- DEFAULT => -30
+ DEFAULT => -27
},
{#State 37
ACTIONS => {
- "-" => 13,
- "<" => 15,
- "+" => 16,
- "%" => 17,
- "==" => 18,
- "^" => 19,
- "*" => 20,
- ")" => 62,
- ">>" => 21,
- "!=" => 22,
- "?" => 23,
- "&&" => 24,
- "||" => 25,
- "&" => 26,
- "/" => 27,
- "->" => 28,
- "|" => 29,
- "=>" => 30,
- "<<" => 31,
- "." => 32,
- "<=" => 33,
- ">" => 34
- }
+ ")" => 64,
+ "->" => 43,
+ "." => 44
+ },
+ DEFAULT => -4
},
{#State 38
ACTIONS => {
- "-" => 13,
- "<" => 15,
- "+" => 16,
- "%" => 17,
- "==" => 18,
- "^" => 19,
- "*" => 20,
- ">>" => 21,
- "!=" => 22,
- "?" => 23,
- "&&" => 24,
- "||" => 25,
- "&" => 26,
- "/" => 27,
- "|" => 29,
- "=>" => 30,
- "<<" => 31,
- "." => 32,
+ "-" => 15,
+ "<" => 17,
+ "+" => 18,
+ "%" => 19,
+ "==" => 20,
+ "^" => 21,
+ "*" => 22,
+ ")" => 65,
+ ">>" => 23,
+ "!=" => 24,
+ "?" => 25,
+ "&&" => 27,
+ "||" => 26,
+ "&" => 28,
+ "/" => 29,
+ "|" => 30,
+ "=>" => 31,
+ "<<" => 32,
"<=" => 33,
">" => 34
- },
- DEFAULT => -27
+ }
},
{#State 39
ACTIONS => {
- "^" => 19,
- "=>" => 30,
- "." => 32,
- "<=" => 33
+ "-" => 15,
+ "<" => 17,
+ "+" => 18,
+ "%" => 19,
+ "==" => 20,
+ "^" => 21,
+ "*" => 22,
+ ">>" => 23,
+ "!=" => 24,
+ "?" => 25,
+ "&&" => 27,
+ "||" => 26,
+ "&" => 28,
+ "/" => 29,
+ "|" => 30,
+ "=>" => 31,
+ "<<" => 32,
+ "<=" => 33,
+ ">" => 34
},
- DEFAULT => -6
+ DEFAULT => -24
},
{#State 40
+ DEFAULT => -31
+ },
+ {#State 41
+ DEFAULT => -30
+ },
+ {#State 42
ACTIONS => {
"-" => 1,
"~" => 3,
@@ -619,411 +658,410 @@ sub new {
"*" => 9,
'VAR' => 10
},
- DEFAULT => -34,
+ DEFAULT => -37,
GOTOS => {
- 'exp' => 64,
- 'args' => 63,
- 'func' => 11,
- 'opt_args' => 65
+ 'exp' => 69,
+ 'var' => 11,
+ 'args' => 66,
+ 'func' => 12,
+ 'opt_args' => 70,
+ 'exp_or_possible_pointer' => 67,
+ 'possible_pointer' => 68
}
},
- {#State 41
+ {#State 43
+ ACTIONS => {
+ 'VAR' => 71
+ }
+ },
+ {#State 44
ACTIONS => {
- "<" => 15,
- "==" => 18,
- "^" => 19,
- ">>" => 21,
- "!=" => 22,
- "?" => 23,
- "&&" => 24,
- "||" => 25,
- "&" => 26,
- "|" => 29,
- "=>" => 30,
- "<<" => 31,
- "." => 32,
+ 'VAR' => 72
+ }
+ },
+ {#State 45
+ ACTIONS => {
+ "<" => 17,
+ "==" => 20,
+ "^" => 21,
+ ">>" => 23,
+ "!=" => 24,
+ "?" => 25,
+ "&&" => 27,
+ "||" => 26,
+ "&" => 28,
+ "|" => 30,
+ "=>" => 31,
+ "<<" => 32,
"<=" => 33,
">" => 34
},
- DEFAULT => -9
+ DEFAULT => -7
},
- {#State 42
+ {#State 46
ACTIONS => {
- "==" => 18,
- "^" => 19,
- "!=" => 22,
- "?" => 23,
- "&&" => 24,
- "||" => 25,
- "&" => 26,
- "|" => 29,
- "=>" => 30,
- "." => 32,
+ "==" => 20,
+ "^" => 21,
+ "!=" => 24,
+ "?" => 25,
+ "&&" => 27,
+ "||" => 26,
+ "&" => 28,
+ "|" => 30,
+ "=>" => 31,
"<=" => 33
},
- DEFAULT => -12
+ DEFAULT => -10
},
- {#State 43
+ {#State 47
ACTIONS => {
- "<" => 15,
- "==" => 18,
- "^" => 19,
- ">>" => 21,
- "!=" => 22,
- "?" => 23,
- "&&" => 24,
- "||" => 25,
- "&" => 26,
- "|" => 29,
- "=>" => 30,
- "<<" => 31,
- "." => 32,
+ "<" => 17,
+ "==" => 20,
+ "^" => 21,
+ ">>" => 23,
+ "!=" => 24,
+ "?" => 25,
+ "&&" => 27,
+ "||" => 26,
+ "&" => 28,
+ "|" => 30,
+ "=>" => 31,
+ "<<" => 32,
"<=" => 33,
">" => 34
},
- DEFAULT => -8
+ DEFAULT => -6
},
- {#State 44
+ {#State 48
ACTIONS => {
- "-" => 13,
- "<" => 15,
- "+" => 16,
- "==" => 18,
- "^" => 19,
- ">>" => 21,
- "!=" => 22,
- "?" => 23,
- "&&" => 24,
- "||" => 25,
- "&" => 26,
- "|" => 29,
- "=>" => 30,
- "<<" => 31,
- "." => 32,
+ "-" => 15,
+ "<" => 17,
+ "+" => 18,
+ "==" => 20,
+ "^" => 21,
+ ">>" => 23,
+ "!=" => 24,
+ "?" => 25,
+ "&&" => 27,
+ "||" => 26,
+ "&" => 28,
+ "|" => 30,
+ "=>" => 31,
+ "<<" => 32,
"<=" => 33,
">" => 34
},
- DEFAULT => -11
+ DEFAULT => -9
},
- {#State 45
+ {#State 49
ACTIONS => {
- "^" => 19,
- "?" => 23,
- "&&" => 24,
- "||" => 25,
- "&" => 26,
- "|" => 29,
- "=>" => 30,
- "." => 32,
+ "^" => 21,
+ "?" => 25,
+ "&&" => 27,
+ "||" => 26,
+ "&" => 28,
+ "|" => 30,
+ "=>" => 31,
"<=" => 33
},
- DEFAULT => -15
+ DEFAULT => -13
},
- {#State 46
+ {#State 50
ACTIONS => {
- "-" => 13,
- "<" => 15,
- "+" => 16,
- "%" => 17,
- "==" => 18,
- "^" => 19,
- "*" => 20,
- ">>" => 21,
- "!=" => 22,
- "?" => 23,
- "&&" => 24,
- "||" => 25,
- "&" => 26,
- "/" => 27,
- "->" => 28,
- "|" => 29,
- "=>" => 30,
- "<<" => 31,
- "." => 32,
+ "-" => 15,
+ "<" => 17,
+ "+" => 18,
+ "%" => 19,
+ "==" => 20,
+ "^" => 21,
+ "*" => 22,
+ ">>" => 23,
+ "!=" => 24,
+ "?" => 25,
+ "&&" => 27,
+ "||" => 26,
+ "&" => 28,
+ "/" => 29,
+ "|" => 30,
+ "=>" => 31,
+ "<<" => 32,
"<=" => 33,
">" => 34
},
- DEFAULT => -31
+ DEFAULT => -28
},
- {#State 47
+ {#State 51
ACTIONS => {
- "-" => 13,
- "<" => 15,
- "+" => 16,
- "==" => 18,
- "^" => 19,
- ">>" => 21,
- "!=" => 22,
- "?" => 23,
- "&&" => 24,
- "||" => 25,
- "&" => 26,
- "|" => 29,
- "=>" => 30,
- "<<" => 31,
- "." => 32,
+ "-" => 15,
+ "<" => 17,
+ "+" => 18,
+ "==" => 20,
+ "^" => 21,
+ ">>" => 23,
+ "!=" => 24,
+ "?" => 25,
+ "&&" => 27,
+ "||" => 26,
+ "&" => 28,
+ "|" => 30,
+ "=>" => 31,
+ "<<" => 32,
"<=" => 33,
">" => 34
},
- DEFAULT => -10
+ DEFAULT => -8
},
- {#State 48
+ {#State 52
ACTIONS => {
- "<" => 15,
- "==" => 18,
- "^" => 19,
- "!=" => 22,
- "?" => 23,
- "&&" => 24,
- "||" => 25,
- "&" => 26,
- "|" => 29,
- "=>" => 30,
- "." => 32,
+ "<" => 17,
+ "==" => 20,
+ "^" => 21,
+ "!=" => 24,
+ "?" => 25,
+ "&&" => 27,
+ "||" => 26,
+ "&" => 28,
+ "|" => 30,
+ "=>" => 31,
"<=" => 33,
">" => 34
},
- DEFAULT => -19
+ DEFAULT => -17
},
- {#State 49
+ {#State 53
ACTIONS => {
- "^" => 19,
- "?" => 23,
- "&&" => 24,
- "||" => 25,
- "&" => 26,
- "|" => 29,
- "=>" => 30,
- "." => 32,
+ "^" => 21,
+ "?" => 25,
+ "&&" => 27,
+ "||" => 26,
+ "&" => 28,
+ "|" => 30,
+ "=>" => 31,
"<=" => 33
},
- DEFAULT => -20
+ DEFAULT => -18
},
- {#State 50
+ {#State 54
ACTIONS => {
- ":" => 66,
- "-" => 13,
- "<" => 15,
- "+" => 16,
- "%" => 17,
- "==" => 18,
- "^" => 19,
- "*" => 20,
- ">>" => 21,
- "!=" => 22,
- "?" => 23,
- "&&" => 24,
- "||" => 25,
- "&" => 26,
- "/" => 27,
- "->" => 28,
- "|" => 29,
- "=>" => 30,
- "<<" => 31,
- "." => 32,
+ ":" => 73,
+ "-" => 15,
+ "<" => 17,
+ "+" => 18,
+ "%" => 19,
+ "==" => 20,
+ "^" => 21,
+ "*" => 22,
+ ">>" => 23,
+ "!=" => 24,
+ "?" => 25,
+ "&&" => 27,
+ "||" => 26,
+ "&" => 28,
+ "/" => 29,
+ "|" => 30,
+ "=>" => 31,
+ "<<" => 32,
"<=" => 33,
">" => 34
}
},
- {#State 51
+ {#State 55
ACTIONS => {
- "^" => 19,
- "?" => 23,
- "||" => 25,
- "=>" => 30,
- "." => 32,
+ "^" => 21,
+ "?" => 25,
+ "=>" => 31,
"<=" => 33
},
- DEFAULT => -22
+ DEFAULT => -19
},
- {#State 52
+ {#State 56
ACTIONS => {
- "^" => 19,
- "?" => 23,
- "=>" => 30,
- "." => 32,
+ "^" => 21,
+ "?" => 25,
+ "||" => 26,
+ "=>" => 31,
"<=" => 33
},
- DEFAULT => -21
+ DEFAULT => -20
},
- {#State 53
+ {#State 57
ACTIONS => {
- "^" => 19,
- "?" => 23,
- "&&" => 24,
- "||" => 25,
- "|" => 29,
- "=>" => 30,
- "." => 32,
+ "^" => 21,
+ "?" => 25,
+ "&&" => 27,
+ "||" => 26,
+ "|" => 30,
+ "=>" => 31,
"<=" => 33
},
- DEFAULT => -23
+ DEFAULT => -21
},
- {#State 54
+ {#State 58
ACTIONS => {
- "-" => 13,
- "<" => 15,
- "+" => 16,
- "==" => 18,
- "^" => 19,
- ">>" => 21,
- "!=" => 22,
- "?" => 23,
- "&&" => 24,
- "||" => 25,
- "&" => 26,
- "|" => 29,
- "=>" => 30,
- "<<" => 31,
- "." => 32,
+ "-" => 15,
+ "<" => 17,
+ "+" => 18,
+ "==" => 20,
+ "^" => 21,
+ ">>" => 23,
+ "!=" => 24,
+ "?" => 25,
+ "&&" => 27,
+ "||" => 26,
+ "&" => 28,
+ "|" => 30,
+ "=>" => 31,
+ "<<" => 32,
"<=" => 33,
">" => 34
},
- DEFAULT => -28
- },
- {#State 55
- DEFAULT => -24
+ DEFAULT => -25
},
- {#State 56
+ {#State 59
ACTIONS => {
- "^" => 19,
- "?" => 23,
- "&&" => 24,
- "||" => 25,
- "=>" => 30,
- "." => 32,
+ "^" => 21,
+ "?" => 25,
+ "&&" => 27,
+ "||" => 26,
+ "=>" => 31,
"<=" => 33
},
- DEFAULT => -14
+ DEFAULT => -12
},
- {#State 57
+ {#State 60
ACTIONS => {
- "-" => 13,
- "<" => 15,
- "+" => 16,
- "%" => 17,
- "==" => 18,
- "^" => 19,
- "*" => 20,
- ">>" => 21,
- "!=" => 22,
- "?" => 23,
- "&&" => 24,
- "||" => 25,
- "&" => 26,
- "/" => 27,
- "->" => 28,
- "|" => 29,
- "=>" => 30,
- "<<" => 31,
- "." => 32,
+ "-" => 15,
+ "<" => 17,
+ "+" => 18,
+ "%" => 19,
+ "==" => 20,
+ "^" => 21,
+ "*" => 22,
+ ">>" => 23,
+ "!=" => 24,
+ "?" => 25,
+ "&&" => 27,
+ "||" => 26,
+ "&" => 28,
+ "/" => 29,
+ "|" => 30,
+ "=>" => 31,
+ "<<" => 32,
"<=" => 33,
">" => 34
},
- DEFAULT => -17
+ DEFAULT => -15
},
- {#State 58
+ {#State 61
ACTIONS => {
- "<" => 15,
- "==" => 18,
- "^" => 19,
- "!=" => 22,
- "?" => 23,
- "&&" => 24,
- "||" => 25,
- "&" => 26,
- "|" => 29,
- "=>" => 30,
- "." => 32,
+ "<" => 17,
+ "==" => 20,
+ "^" => 21,
+ "!=" => 24,
+ "?" => 25,
+ "&&" => 27,
+ "||" => 26,
+ "&" => 28,
+ "|" => 30,
+ "=>" => 31,
"<=" => 33,
">" => 34
},
- DEFAULT => -18
- },
- {#State 59
- DEFAULT => -4
+ DEFAULT => -16
},
- {#State 60
+ {#State 62
ACTIONS => {
- "-" => 13,
- "<" => 15,
- "+" => 16,
- "%" => 17,
- "==" => 18,
- "^" => 19,
- "*" => 20,
- ">>" => 21,
- "!=" => 22,
- "?" => 23,
- "&&" => 24,
- "||" => 25,
- "&" => 26,
- "/" => 27,
- "->" => 28,
- "|" => 29,
- "=>" => 30,
- "<<" => 31,
- "." => 32,
+ "-" => 15,
+ "<" => 17,
+ "+" => 18,
+ "%" => 19,
+ "==" => 20,
+ "^" => 21,
+ "*" => 22,
+ ">>" => 23,
+ "!=" => 24,
+ "?" => 25,
+ "&&" => 27,
+ "||" => 26,
+ "&" => 28,
+ "/" => 29,
+ "|" => 30,
+ "=>" => 31,
+ "<<" => 32,
"<=" => 33,
">" => 34
},
- DEFAULT => -16
+ DEFAULT => -14
},
- {#State 61
+ {#State 63
ACTIONS => {
- "==" => 18,
- "^" => 19,
- "!=" => 22,
- "?" => 23,
- "&&" => 24,
- "||" => 25,
- "&" => 26,
- "|" => 29,
- "=>" => 30,
- "." => 32,
+ "==" => 20,
+ "^" => 21,
+ "!=" => 24,
+ "?" => 25,
+ "&&" => 27,
+ "||" => 26,
+ "&" => 28,
+ "|" => 30,
+ "=>" => 31,
"<=" => 33
},
- DEFAULT => -13
+ DEFAULT => -11
},
- {#State 62
- DEFAULT => -32
+ {#State 64
+ DEFAULT => -34
},
- {#State 63
- DEFAULT => -35
+ {#State 65
+ DEFAULT => -29
},
- {#State 64
+ {#State 66
+ DEFAULT => -38
+ },
+ {#State 67
+ ACTIONS => {
+ "," => 74
+ },
+ DEFAULT => -41
+ },
+ {#State 68
+ DEFAULT => -32
+ },
+ {#State 69
ACTIONS => {
- "-" => 13,
- "<" => 15,
- "+" => 16,
- "%" => 17,
- "," => 67,
- "==" => 18,
- "^" => 19,
- "*" => 20,
- ">>" => 21,
- "!=" => 22,
- "?" => 23,
- "&&" => 24,
- "||" => 25,
- "&" => 26,
- "->" => 28,
- "/" => 27,
- "|" => 29,
- "=>" => 30,
- "<<" => 31,
- "." => 32,
+ "-" => 15,
+ "<" => 17,
+ "+" => 18,
+ "%" => 19,
+ "==" => 20,
+ "^" => 21,
+ "*" => 22,
+ ">>" => 23,
+ "!=" => 24,
+ "?" => 25,
+ "&&" => 27,
+ "||" => 26,
+ "&" => 28,
+ "/" => 29,
+ "|" => 30,
+ "=>" => 31,
+ "<<" => 32,
"<=" => 33,
">" => 34
},
- DEFAULT => -36
+ DEFAULT => -39
},
- {#State 65
+ {#State 70
ACTIONS => {
- ")" => 68
+ ")" => 75
}
},
- {#State 66
+ {#State 71
+ DEFAULT => -35
+ },
+ {#State 72
+ DEFAULT => -33
+ },
+ {#State 73
ACTIONS => {
"-" => 1,
"~" => 3,
@@ -1036,11 +1074,13 @@ sub new {
'VAR' => 10
},
GOTOS => {
- 'exp' => 69,
- 'func' => 11
+ 'exp' => 76,
+ 'var' => 11,
+ 'func' => 12,
+ 'possible_pointer' => 13
}
},
- {#State 67
+ {#State 74
ACTIONS => {
"-" => 1,
"~" => 3,
@@ -1053,25 +1093,27 @@ sub new {
'VAR' => 10
},
GOTOS => {
- 'exp' => 64,
- 'args' => 70,
- 'func' => 11
+ 'exp' => 69,
+ 'var' => 11,
+ 'args' => 77,
+ 'func' => 12,
+ 'exp_or_possible_pointer' => 67,
+ 'possible_pointer' => 68
}
},
- {#State 68
- DEFAULT => -33
+ {#State 75
+ DEFAULT => -36
},
- {#State 69
+ {#State 76
ACTIONS => {
- "^" => 19,
- "=>" => 30,
- "." => 32,
+ "^" => 21,
+ "=>" => 31,
"<=" => 33
},
- DEFAULT => -25
+ DEFAULT => -22
},
- {#State 70
- DEFAULT => -37
+ {#State 77
+ DEFAULT => -42
}
],
yyrules =>
@@ -1085,208 +1127,229 @@ sub new {
[#Rule 2
'exp', 1,
sub
-#line 22 "pidl/expr.yp"
+#line 22 "expr.yp"
{ "\"$_[1]\"" }
],
[#Rule 3
'exp', 1, undef
],
[#Rule 4
- 'exp', 3,
-sub
-#line 24 "pidl/expr.yp"
-{ "$_[1].$_[3]" }
+ 'exp', 1, undef
],
[#Rule 5
- 'exp', 1,
-sub
-#line 25 "pidl/expr.yp"
-{ $_[0]->_Lookup($_[1]) }
- ],
- [#Rule 6
- 'exp', 2,
-sub
-#line 26 "pidl/expr.yp"
-{ $_[0]->_Dereference($_[2]); "*$_[2]" }
- ],
- [#Rule 7
'exp', 2,
sub
-#line 27 "pidl/expr.yp"
+#line 25 "expr.yp"
{ "~$_[2]" }
],
- [#Rule 8
+ [#Rule 6
'exp', 3,
sub
-#line 28 "pidl/expr.yp"
+#line 26 "expr.yp"
{ "$_[1] + $_[3]" }
],
- [#Rule 9
+ [#Rule 7
'exp', 3,
sub
-#line 29 "pidl/expr.yp"
+#line 27 "expr.yp"
{ "$_[1] - $_[3]" }
],
- [#Rule 10
+ [#Rule 8
'exp', 3,
sub
-#line 30 "pidl/expr.yp"
+#line 28 "expr.yp"
{ "$_[1] * $_[3]" }
],
- [#Rule 11
+ [#Rule 9
'exp', 3,
sub
-#line 31 "pidl/expr.yp"
+#line 29 "expr.yp"
{ "$_[1] % $_[3]" }
],
- [#Rule 12
+ [#Rule 10
'exp', 3,
sub
-#line 32 "pidl/expr.yp"
+#line 30 "expr.yp"
{ "$_[1] < $_[3]" }
],
- [#Rule 13
+ [#Rule 11
'exp', 3,
sub
-#line 33 "pidl/expr.yp"
+#line 31 "expr.yp"
{ "$_[1] > $_[3]" }
],
- [#Rule 14
+ [#Rule 12
'exp', 3,
sub
-#line 34 "pidl/expr.yp"
+#line 32 "expr.yp"
{ "$_[1] | $_[3]" }
],
- [#Rule 15
+ [#Rule 13
'exp', 3,
sub
-#line 35 "pidl/expr.yp"
+#line 33 "expr.yp"
{ "$_[1] == $_[3]" }
],
- [#Rule 16
+ [#Rule 14
'exp', 3,
sub
-#line 36 "pidl/expr.yp"
+#line 34 "expr.yp"
{ "$_[1] <= $_[3]" }
],
- [#Rule 17
+ [#Rule 15
'exp', 3,
sub
-#line 37 "pidl/expr.yp"
+#line 35 "expr.yp"
{ "$_[1] => $_[3]" }
],
- [#Rule 18
+ [#Rule 16
'exp', 3,
sub
-#line 38 "pidl/expr.yp"
+#line 36 "expr.yp"
{ "$_[1] << $_[3]" }
],
- [#Rule 19
+ [#Rule 17
'exp', 3,
sub
-#line 39 "pidl/expr.yp"
+#line 37 "expr.yp"
{ "$_[1] >> $_[3]" }
],
- [#Rule 20
+ [#Rule 18
'exp', 3,
sub
-#line 40 "pidl/expr.yp"
+#line 38 "expr.yp"
{ "$_[1] != $_[3]" }
],
- [#Rule 21
+ [#Rule 19
'exp', 3,
sub
-#line 41 "pidl/expr.yp"
+#line 39 "expr.yp"
{ "$_[1] || $_[3]" }
],
- [#Rule 22
+ [#Rule 20
'exp', 3,
sub
-#line 42 "pidl/expr.yp"
+#line 40 "expr.yp"
{ "$_[1] && $_[3]" }
],
- [#Rule 23
+ [#Rule 21
'exp', 3,
sub
-#line 43 "pidl/expr.yp"
+#line 41 "expr.yp"
{ "$_[1] & $_[3]" }
],
- [#Rule 24
- 'exp', 3,
-sub
-#line 44 "pidl/expr.yp"
-{ $_[1]."->".$_[3] }
- ],
- [#Rule 25
+ [#Rule 22
'exp', 5,
sub
-#line 45 "pidl/expr.yp"
+#line 42 "expr.yp"
{ "$_[1]?$_[3]:$_[5]" }
],
- [#Rule 26
+ [#Rule 23
'exp', 2,
sub
-#line 46 "pidl/expr.yp"
+#line 43 "expr.yp"
{ "~$_[1]" }
],
- [#Rule 27
+ [#Rule 24
'exp', 2,
sub
-#line 47 "pidl/expr.yp"
+#line 44 "expr.yp"
{ "not $_[1]" }
],
- [#Rule 28
+ [#Rule 25
'exp', 3,
sub
-#line 48 "pidl/expr.yp"
+#line 45 "expr.yp"
{ "$_[1] / $_[3]" }
],
- [#Rule 29
+ [#Rule 26
'exp', 2,
sub
-#line 49 "pidl/expr.yp"
+#line 46 "expr.yp"
{ "-$_[2]" }
],
- [#Rule 30
+ [#Rule 27
'exp', 2,
sub
-#line 50 "pidl/expr.yp"
+#line 47 "expr.yp"
{ "&$_[2]" }
],
- [#Rule 31
+ [#Rule 28
'exp', 3,
sub
-#line 51 "pidl/expr.yp"
+#line 48 "expr.yp"
{ "$_[1]^$_[3]" }
],
- [#Rule 32
+ [#Rule 29
'exp', 3,
sub
-#line 52 "pidl/expr.yp"
+#line 49 "expr.yp"
{ "($_[2])" }
],
+ [#Rule 30
+ 'possible_pointer', 1,
+sub
+#line 53 "expr.yp"
+{ $_[0]->_Lookup($_[1]) }
+ ],
+ [#Rule 31
+ 'possible_pointer', 2,
+sub
+#line 54 "expr.yp"
+{ $_[0]->_Dereference($_[2]); "*$_[2]" }
+ ],
+ [#Rule 32
+ 'var', 1,
+sub
+#line 57 "expr.yp"
+{ $_[0]->_Use($_[1]) }
+ ],
[#Rule 33
+ 'var', 3,
+sub
+#line 58 "expr.yp"
+{ $_[0]->_Use("$_[1].$_[3]") }
+ ],
+ [#Rule 34
+ 'var', 3,
+sub
+#line 59 "expr.yp"
+{ "($_[2])" }
+ ],
+ [#Rule 35
+ 'var', 3,
+sub
+#line 60 "expr.yp"
+{ $_[0]->_Use("*$_[1]"); $_[1]."->".$_[3] }
+ ],
+ [#Rule 36
'func', 4,
sub
-#line 55 "pidl/expr.yp"
+#line 64 "expr.yp"
{ "$_[1]($_[3])" }
],
- [#Rule 34
+ [#Rule 37
'opt_args', 0,
sub
-#line 56 "pidl/expr.yp"
+#line 65 "expr.yp"
{ "" }
],
- [#Rule 35
+ [#Rule 38
'opt_args', 1, undef
],
- [#Rule 36
+ [#Rule 39
+ 'exp_or_possible_pointer', 1, undef
+ ],
+ [#Rule 40
+ 'exp_or_possible_pointer', 1, undef
+ ],
+ [#Rule 41
'args', 1, undef
],
- [#Rule 37
+ [#Rule 42
'args', 3,
sub
-#line 57 "pidl/expr.yp"
+#line 68 "expr.yp"
{ "$_[1], $_[3]" }
]
],
@@ -1294,7 +1357,7 @@ sub
bless($self,$class);
}
-#line 59 "pidl/expr.yp"
+#line 71 "expr.yp"
package Parse::Pidl::Expr;
@@ -1332,6 +1395,15 @@ sub _Lexer {
}
}
+sub _Use($$)
+{
+ my ($self, $x) = @_;
+ if (defined($self->YYData->{USE})) {
+ return $self->YYData->{USE}->($x);
+ }
+ return $x;
+}
+
sub _Lookup($$)
{
my ($self, $x) = @_;
@@ -1357,12 +1429,13 @@ sub _Error($)
}
sub Run {
- my($self, $data, $error, $lookup, $deref) = @_;
+ my($self, $data, $error, $lookup, $deref, $use) = @_;
$self->YYData->{FULL_INPUT} = $data;
$self->YYData->{INPUT} = $data;
$self->YYData->{LOOKUP} = $lookup;
$self->YYData->{DEREFERENCE} = $deref;
$self->YYData->{ERROR} = $error;
+ $self->YYData->{USE} = $use;
return $self->YYParse( yylex => \&_Lexer, yyerror => \&_Error);
}
diff --git a/source4/pidl/lib/Parse/Pidl/NDR.pm b/source4/pidl/lib/Parse/Pidl/NDR.pm
index 462e577cdd..2ba8461e4a 100644
--- a/source4/pidl/lib/Parse/Pidl/NDR.pm
+++ b/source4/pidl/lib/Parse/Pidl/NDR.pm
@@ -35,7 +35,7 @@ use vars qw($VERSION);
$VERSION = '0.01';
@ISA = qw(Exporter);
@EXPORT = qw(GetPrevLevel GetNextLevel ContainsDeferred ContainsString);
-@EXPORT_OK = qw(GetElementLevelTable ParseElement);
+@EXPORT_OK = qw(GetElementLevelTable ParseElement ValidElement);
use strict;
use Parse::Pidl qw(warning fatal);
@@ -902,7 +902,6 @@ sub ValidElement($)
}
}
-
if (has_property($e, "subcontext") and has_property($e, "represent_as")) {
fatal($e, el_name($e) . " : subcontext() and represent_as() can not be used on the same element");
}
@@ -919,6 +918,10 @@ sub ValidElement($)
fatal($e, el_name($e) . " : represent_as() and value() can not be used on the same element");
}
+ if (has_property($e, "subcontext")) {
+ warning($e, "subcontext() is deprecated. Use represent_as() or transmit_as() instead");
+ }
+
if (defined (has_property($e, "subcontext_size")) and not defined(has_property($e, "subcontext"))) {
fatal($e, el_name($e) . " : subcontext_size() on non-subcontext element");
}
diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm b/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
index a1bd3e1f96..1e199ba62b 100644
--- a/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
+++ b/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
@@ -304,6 +304,51 @@ sub ParseArrayPushHeader($$$$$)
return $length;
}
+sub check_fully_dereferenced($$)
+{
+ my ($element, $env) = @_;
+
+ return sub ($) {
+ my $origvar = shift;
+ my $check = 0;
+
+ # Figure out the number of pointers in $ptr
+ my $expandedvar = $origvar;
+ $expandedvar =~ s/^(\**)//;
+ my $ptr = $1;
+
+ my $var = undef;
+ foreach (keys %$env) {
+ if ($env->{$_} eq $expandedvar) {
+ $var = $_;
+ last;
+ }
+ }
+
+ return($origvar) unless (defined($var));
+ my $e;
+ foreach (@{$element->{PARENT}->{ELEMENTS}}) {
+ if ($_->{NAME} eq $var) {
+ $e = $_;
+ last;
+ }
+ }
+
+ $e or die("Environment doesn't match siblings");
+
+ # See if pointer at pointer level $level
+ # needs to be checked.
+ my $nump = 0;
+ foreach (@{$e->{LEVELS}}) {
+ if ($_->{TYPE} eq "POINTER") {
+ $nump = $_->{POINTER_INDEX}+1;
+ }
+ }
+ warning($element->{ORIGINAL}, "Got pointer for `$e->{NAME}', expected fully derefenced variable") if ($nump > length($ptr));
+ return ($origvar);
+ }
+}
+
sub check_null_pointer($$$$)
{
my ($element, $env, $print_fn, $return) = @_;
@@ -373,8 +418,8 @@ sub ParseArrayPullHeader($$$$$)
} elsif ($l->{IS_ZERO_TERMINATED}) { # Noheader arrays
$length = $size = "ndr_get_string_size($ndr, sizeof(*$var_name))";
} else {
- $length = $size = ParseExprExt($l->{SIZE_IS}, $env, $e,
- check_null_pointer($e, $env, \&pidl, "return NT_STATUS_INVALID_PARAMETER_MIX;"));
+ $length = $size = ParseExprExt($l->{SIZE_IS}, $env, $e->{ORIGINAL},
+ check_null_pointer($e, $env, \&pidl, "return NT_STATUS_INVALID_PARAMETER_MIX;"), check_fully_dereferenced($e, $env));
}
if ((!$l->{IS_SURROUNDING}) and $l->{IS_CONFORMANT}) {
@@ -397,7 +442,7 @@ sub ParseArrayPullHeader($$$$$)
if ($l->{IS_CONFORMANT} and not $l->{IS_ZERO_TERMINATED}) {
defer "if ($var_name) {";
defer_indent;
- my $size = ParseExprExt($l->{SIZE_IS}, $env, $e, check_null_pointer($e, $env, \&defer, "return NT_STATUS_INVALID_PARAMETER_MIX;"));
+ my $size = ParseExprExt($l->{SIZE_IS}, $env, $e->{ORIGINAL}, check_null_pointer($e, $env, \&defer, "return NT_STATUS_INVALID_PARAMETER_MIX;"), check_fully_dereferenced($e, $env));
defer "NDR_CHECK(ndr_check_array_size(ndr, (void*)" . get_pointer_to($var_name) . ", $size));";
defer_deindent;
defer "}";
@@ -406,7 +451,7 @@ sub ParseArrayPullHeader($$$$$)
if ($l->{IS_VARYING} and not $l->{IS_ZERO_TERMINATED}) {
defer "if ($var_name) {";
defer_indent;
- my $length = ParseExprExt($l->{LENGTH_IS}, $env, $e, check_null_pointer($e, $env, \&defer, "return NT_STATUS_INVALID_PARAMETER_MIX;"));
+ my $length = ParseExprExt($l->{LENGTH_IS}, $env, $e->{ORIGINAL}, check_null_pointer($e, $env, \&defer, "return NT_STATUS_INVALID_PARAMETER_MIX;"), check_fully_dereferenced($e, $env));
defer "NDR_CHECK(ndr_check_array_length(ndr, (void*)" . get_pointer_to($var_name) . ", $length));";
defer_deindent;
defer "}"
@@ -432,7 +477,7 @@ sub compression_clen($$$)
my ($e, $l, $env) = @_;
my ($alg, $clen, $dlen) = split(/ /, $l->{COMPRESSION});
- return ParseExpr($clen, $env, $e);
+ return ParseExpr($clen, $env, $e->{ORIGINAL});
}
sub compression_dlen($$$)
@@ -440,7 +485,7 @@ sub compression_dlen($$$)
my ($e,$l,$env) = @_;
my ($alg, $clen, $dlen) = split(/ /, $l->{COMPRESSION});
- return ParseExpr($dlen, $env, $e);
+ return ParseExpr($dlen, $env, $e->{ORIGINAL});
}
sub ParseCompressionPushStart($$$$)
@@ -501,7 +546,7 @@ sub ParseSubcontextPushStart($$$$)
{
my ($e,$l,$ndr,$env) = @_;
my $subndr = "_ndr_$e->{NAME}";
- my $subcontext_size = ParseExpr($l->{SUBCONTEXT_SIZE}, $env, $e);
+ my $subcontext_size = ParseExpr($l->{SUBCONTEXT_SIZE}, $env, $e->{ORIGINAL});
pidl "{";
indent;
@@ -519,7 +564,7 @@ sub ParseSubcontextPushEnd($$$$)
{
my ($e,$l,$ndr,$env) = @_;
my $subndr = "_ndr_$e->{NAME}";
- my $subcontext_size = ParseExpr($l->{SUBCONTEXT_SIZE}, $env, $e);
+ my $subcontext_size = ParseExpr($l->{SUBCONTEXT_SIZE}, $env, $e->{ORIGINAL});
if (defined $l->{COMPRESSION}) {
ParseCompressionPushEnd($e, $l, $subndr, $env);
@@ -534,7 +579,7 @@ sub ParseSubcontextPullStart($$$$)
{
my ($e,$l,$ndr,$env) = @_;
my $subndr = "_ndr_$e->{NAME}";
- my $subcontext_size = ParseExpr($l->{SUBCONTEXT_SIZE}, $env, $e);
+ my $subcontext_size = ParseExpr($l->{SUBCONTEXT_SIZE}, $env, $e->{ORIGINAL});
pidl "{";
indent;
@@ -552,7 +597,7 @@ sub ParseSubcontextPullEnd($$$$)
{
my ($e,$l,$ndr,$env) = @_;
my $subndr = "_ndr_$e->{NAME}";
- my $subcontext_size = ParseExpr($l->{SUBCONTEXT_SIZE}, $env, $e);
+ my $subcontext_size = ParseExpr($l->{SUBCONTEXT_SIZE}, $env, $e->{ORIGINAL});
if (defined $l->{COMPRESSION}) {
ParseCompressionPullEnd($e, $l, $subndr, $env);
@@ -617,7 +662,7 @@ sub ParseElementPushLevel
}
} elsif ($l->{TYPE} eq "ARRAY" and not has_fast_array($e,$l) and
not is_charset_array($e, $l)) {
- my $length = ParseExpr($l->{LENGTH_IS}, $env, $e);
+ my $length = ParseExpr($l->{LENGTH_IS}, $env, $e->{ORIGINAL});
my $counter = "cntr_$e->{NAME}_$l->{LEVEL_INDEX}";
$var_name = $var_name . "[$counter]";
@@ -668,7 +713,7 @@ sub ParseElementPush($$$$$$)
start_flags($e);
if (my $value = has_property($e, "value")) {
- $var_name = ParseExpr($value, $env, $e);
+ $var_name = ParseExpr($value, $env, $e->{ORIGINAL});
}
ParseElementPushLevel($e, $e->{LEVELS}[0], $ndr, $var_name, $env, $primitives, $deferred);
@@ -719,7 +764,7 @@ sub ParseElementPrint($$$)
$var_name = append_prefix($e, $var_name);
if (my $value = has_property($e, "value")) {
- $var_name = "(ndr->flags & LIBNDR_PRINT_SET_VALUES)?" . ParseExpr($value,$env, $e) . ":$var_name";
+ $var_name = "(ndr->flags & LIBNDR_PRINT_SET_VALUES)?" . ParseExpr($value,$env, $e->{ORIGINAL}) . ":$var_name";
}
foreach my $l (@{$e->{LEVELS}}) {
@@ -741,8 +786,8 @@ sub ParseElementPrint($$$)
if ($l->{IS_ZERO_TERMINATED}) {
$length = "ndr_string_length($var_name, sizeof(*$var_name))";
} else {
- $length = ParseExprExt($l->{LENGTH_IS}, $env, $e,
- check_null_pointer($e, $env, \&pidl, "return;"));
+ $length = ParseExprExt($l->{LENGTH_IS}, $env, $e->{ORIGINAL},
+ check_null_pointer($e, $env, \&pidl, "return;"), check_fully_dereferenced($e, $env));
}
if (is_charset_array($e,$l)) {
@@ -772,8 +817,8 @@ sub ParseElementPrint($$$)
}
pidl "ndr_print_$l->{DATA_TYPE}(ndr, \"$e->{NAME}\", $var_name);";
} elsif ($l->{TYPE} eq "SWITCH") {
- my $switch_var = ParseExprExt($l->{SWITCH_IS}, $env, $e,
- check_null_pointer($e, $env, \&pidl, "return;"));
+ my $switch_var = ParseExprExt($l->{SWITCH_IS}, $env, $e->{ORIGINAL},
+ check_null_pointer($e, $env, \&pidl, "return;"), check_fully_dereferenced($e, $env));
pidl "ndr_print_set_switch_value(ndr, " . get_pointer_to($var_name) . ", $switch_var);";
}
}
@@ -803,8 +848,8 @@ sub ParseElementPrint($$$)
sub ParseSwitchPull($$$$$$)
{
my($e,$l,$ndr,$var_name,$ndr_flags,$env) = @_;
- my $switch_var = ParseExprExt($l->{SWITCH_IS}, $env, $e,
- check_null_pointer($e, $env, \&pidl, "return NT_STATUS_INVALID_PARAMETER_MIX;"));
+ my $switch_var = ParseExprExt($l->{SWITCH_IS}, $env, $e->{ORIGINAL},
+ check_null_pointer($e, $env, \&pidl, "return NT_STATUS_INVALID_PARAMETER_MIX;"), check_fully_dereferenced($e, $env));
$var_name = get_pointer_to($var_name);
pidl "NDR_CHECK(ndr_pull_set_switch_value($ndr, $var_name, $switch_var));";
@@ -815,8 +860,8 @@ sub ParseSwitchPull($$$$$$)
sub ParseSwitchPush($$$$$$)
{
my($e,$l,$ndr,$var_name,$ndr_flags,$env) = @_;
- my $switch_var = ParseExprExt($l->{SWITCH_IS}, $env, $e,
- check_null_pointer($e, $env, \&pidl, "return NT_STATUS_INVALID_PARAMETER_MIX;"));
+ my $switch_var = ParseExprExt($l->{SWITCH_IS}, $env, $e->{ORIGINAL},
+ check_null_pointer($e, $env, \&pidl, "return NT_STATUS_INVALID_PARAMETER_MIX;"), check_fully_dereferenced($e, $env));
$var_name = get_pointer_to($var_name);
pidl "NDR_CHECK(ndr_push_set_switch_value($ndr, $var_name, $switch_var));";
@@ -1012,7 +1057,7 @@ sub ParseElementPullLevel
}
} elsif ($l->{TYPE} eq "ARRAY" and
not has_fast_array($e,$l) and not is_charset_array($e, $l)) {
- my $length = ParseExpr($l->{LENGTH_IS}, $env, $e);
+ my $length = ParseExpr($l->{LENGTH_IS}, $env, $e->{ORIGINAL});
my $counter = "cntr_$e->{NAME}_$l->{LEVEL_INDEX}";
my $array_name = $var_name;
@@ -1181,7 +1226,7 @@ sub ParseStructPush($$)
$size = "ndr_string_length(r->$e->{NAME}, sizeof(*r->$e->{NAME}))";
}
} else {
- $size = ParseExpr($e->{LEVELS}[0]->{SIZE_IS}, $env, $e);
+ $size = ParseExpr($e->{LEVELS}[0]->{SIZE_IS}, $env, $e->{ORIGINAL});
}
pidl "NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, $size));";
@@ -2038,7 +2083,7 @@ sub AllocateArrayLevel($$$$$)
{
my ($e,$l,$ndr,$env,$size) = @_;
- my $var = ParseExpr($e->{NAME}, $env, $e);
+ my $var = ParseExpr($e->{NAME}, $env, $e->{ORIGINAL});
my $pl = GetPrevLevel($e, $l);
if (defined($pl) and
@@ -2118,7 +2163,8 @@ sub ParseFunctionPull($)
and $e->{LEVELS}[1]->{IS_ZERO_TERMINATED});
if ($e->{LEVELS}[1]->{TYPE} eq "ARRAY") {
- my $size = ParseExprExt($e->{LEVELS}[1]->{SIZE_IS}, $env, $e, check_null_pointer($e, $env, \&pidl, "return NT_STATUS_INVALID_PARAMETER_MIX;"));
+ my $size = ParseExprExt($e->{LEVELS}[1]->{SIZE_IS}, $env, $e->{ORIGINAL}, check_null_pointer($e, $env, \&pidl, "return NT_STATUS_INVALID_PARAMETER_MIX;"),
+ check_fully_dereferenced($e, $env));
pidl "NDR_PULL_ALLOC_N(ndr, r->out.$e->{NAME}, $size);";
diff --git a/source4/pidl/lib/Parse/Pidl/Util.pm b/source4/pidl/lib/Parse/Pidl/Util.pm
index 3ca79b6c1c..00185fbef7 100644
--- a/source4/pidl/lib/Parse/Pidl/Util.pm
+++ b/source4/pidl/lib/Parse/Pidl/Util.pm
@@ -101,12 +101,12 @@ sub ParseExpr($$$)
return($varlist->{$x}) if (defined($varlist->{$x}));
return $x;
},
- undef);
+ undef, undef);
}
-sub ParseExprExt($$$$)
+sub ParseExprExt($$$$$)
{
- my($expr, $varlist, $e, $deref) = @_;
+ my($expr, $varlist, $e, $deref, $use) = @_;
die("Undefined value in ParseExpr") if not defined($expr);
@@ -118,7 +118,7 @@ sub ParseExprExt($$$$)
return($varlist->{$x}) if (defined($varlist->{$x}));
return $x;
},
- $deref);
+ $deref, $use);
}
1;