Lines 1-37
Link Here
|
1 |
--- opendkim/opendkim-lua.c.orig 2015-02-04 00:31:11 UTC |
1 |
--- opendkim/opendkim-lua.c.orig 2015-02-04 00:31:11 UTC |
2 |
+++ opendkim/opendkim-lua.c |
2 |
+++ opendkim/opendkim-lua.c |
3 |
@@ -282,7 +282,7 @@ dkimf_lua_alloc(void *ud, void *ptr, size_t osize, siz |
3 |
@@ -282,11 +282,11 @@ dkimf_lua_alloc(void *ud, void *ptr, size_t osize, siz |
4 |
free(ptr); |
4 |
free(ptr); |
5 |
return NULL; |
5 |
return NULL; |
6 |
} |
6 |
} |
7 |
-# if LUA_VERSION_NUM == 502 |
7 |
-# if LUA_VERSION_NUM == 502 |
8 |
+# if (LUA_VERSION_NUM == 502 || LUA_VERSION_NUM == 503) |
8 |
+# if LUA_VERSION_NUM >= 502 |
9 |
else if (nsize != 0 && ptr == NULL) |
9 |
else if (nsize != 0 && ptr == NULL) |
10 |
# else /* LUA_VERSION_NUM == 502 */ |
10 |
-# else /* LUA_VERSION_NUM == 502 */ |
|
|
11 |
+# else /* LUA_VERSION_NUM >= 502 */ |
11 |
else if (nsize != 0 && osize == 0) |
12 |
else if (nsize != 0 && osize == 0) |
12 |
@@ -482,7 +482,7 @@ dkimf_lua_setup_hook(void *ctx, const char *script, si |
13 |
-# endif /* LUA_VERSION_NUM == 502 */ |
|
|
14 |
+# endif /* LUA_VERSION_NUM >= 502 */ |
15 |
{ |
16 |
return malloc(nsize); |
17 |
} |
18 |
@@ -482,12 +482,12 @@ dkimf_lua_setup_hook(void *ctx, const char *script, si |
13 |
** Register functions. |
19 |
** Register functions. |
14 |
*/ |
20 |
*/ |
15 |
|
21 |
|
16 |
-# if LUA_VERSION_NUM == 502 |
22 |
-# if LUA_VERSION_NUM == 502 |
17 |
+# if (LUA_VERSION_NUM == 502 || LUA_VERSION_NUM == 503) |
23 |
+# if LUA_VERSION_NUM >= 502 |
18 |
luaL_newlib(l, dkimf_lua_lib_setup); |
24 |
luaL_newlib(l, dkimf_lua_lib_setup); |
19 |
lua_setglobal(l, "odkim"); |
25 |
lua_setglobal(l, "odkim"); |
20 |
# else /* LUA_VERSION_NUM == 502 */ |
26 |
-# else /* LUA_VERSION_NUM == 502 */ |
21 |
@@ -529,7 +529,7 @@ dkimf_lua_setup_hook(void *ctx, const char *script, si |
27 |
+# else /* LUA_VERSION_NUM >= 502 */ |
|
|
28 |
luaL_register(l, "odkim", dkimf_lua_lib_setup); |
29 |
-# endif /* LUA_VERSION_NUM == 502 */ |
30 |
+# endif /* LUA_VERSION_NUM >= 502 */ |
31 |
lua_pop(l, 1); |
32 |
|
33 |
/* |
34 |
@@ -529,11 +529,11 @@ dkimf_lua_setup_hook(void *ctx, const char *script, si |
22 |
/* import other globals */ |
35 |
/* import other globals */ |
23 |
dkimf_import_globals(ctx, l); |
36 |
dkimf_import_globals(ctx, l); |
24 |
|
37 |
|
25 |
-# if LUA_VERSION_NUM == 502 |
38 |
-# if LUA_VERSION_NUM == 502 |
26 |
+# if (LUA_VERSION_NUM == 502 || LUA_VERSION_NUM == 503) |
39 |
+# if LUA_VERSION_NUM >= 502 |
27 |
switch (lua_load(l, dkimf_lua_reader, (void *) &io, name, NULL)) |
40 |
switch (lua_load(l, dkimf_lua_reader, (void *) &io, name, NULL)) |
28 |
# else /* LUA_VERSION_NUM == 502 */ |
41 |
-# else /* LUA_VERSION_NUM == 502 */ |
|
|
42 |
+# else /* LUA_VERSION_NUM >= 502 */ |
29 |
switch (lua_load(l, dkimf_lua_reader, (void *) &io, name)) |
43 |
switch (lua_load(l, dkimf_lua_reader, (void *) &io, name)) |
|
|
44 |
-# endif /* LUA_VERSION_NUM == 502 */ |
45 |
+# endif /* LUA_VERSION_NUM >= 502 */ |
46 |
{ |
47 |
case 0: |
48 |
break; |
30 |
@@ -561,7 +561,11 @@ dkimf_lua_setup_hook(void *ctx, const char *script, si |
49 |
@@ -561,7 +561,11 @@ dkimf_lua_setup_hook(void *ctx, const char *script, si |
31 |
io.lua_io_len = 0; |
50 |
io.lua_io_len = 0; |
32 |
io.lua_io_alloc = 0; |
51 |
io.lua_io_alloc = 0; |
33 |
|
52 |
|
34 |
+#if (LUA_VERSION_NUM == 503) |
53 |
+#if (LUA_VERSION_NUM >= 503) |
35 |
+ if (lua_dump(l, dkimf_lua_writer, &io, 0) == 0) |
54 |
+ if (lua_dump(l, dkimf_lua_writer, &io, 0) == 0) |
36 |
+#else |
55 |
+#else |
37 |
if (lua_dump(l, dkimf_lua_writer, &io) == 0) |
56 |
if (lua_dump(l, dkimf_lua_writer, &io) == 0) |
Lines 39-67
Link Here
|
39 |
{ |
58 |
{ |
40 |
*keep = (void *) io.lua_io_script; |
59 |
*keep = (void *) io.lua_io_script; |
41 |
*funclen = io.lua_io_len; |
60 |
*funclen = io.lua_io_len; |
42 |
@@ -637,7 +641,7 @@ dkimf_lua_screen_hook(void *ctx, const char *script, s |
61 |
@@ -637,12 +641,12 @@ dkimf_lua_screen_hook(void *ctx, const char *script, s |
43 |
** Register functions. |
62 |
** Register functions. |
44 |
*/ |
63 |
*/ |
45 |
|
64 |
|
46 |
-# if LUA_VERSION_NUM == 502 |
65 |
-# if LUA_VERSION_NUM == 502 |
47 |
+# if (LUA_VERSION_NUM == 502 || LUA_VERSION_NUM == 503) |
66 |
+# if LUA_VERSION_NUM >= 502 |
48 |
luaL_newlib(l, dkimf_lua_lib_screen); |
67 |
luaL_newlib(l, dkimf_lua_lib_screen); |
49 |
lua_setglobal(l, "odkim"); |
68 |
lua_setglobal(l, "odkim"); |
50 |
# else /* LUA_VERSION_NUM == 502 */ |
69 |
-# else /* LUA_VERSION_NUM == 502 */ |
51 |
@@ -674,7 +678,7 @@ dkimf_lua_screen_hook(void *ctx, const char *script, s |
70 |
+# else /* LUA_VERSION_NUM >= 502 */ |
|
|
71 |
luaL_register(l, "odkim", dkimf_lua_lib_screen); |
72 |
-# endif /* LUA_VERSION_NUM == 502 */ |
73 |
+# endif /* LUA_VERSION_NUM >= 502 */ |
74 |
lua_pop(l, 1); |
75 |
|
76 |
/* |
77 |
@@ -674,11 +678,11 @@ dkimf_lua_screen_hook(void *ctx, const char *script, s |
52 |
/* import other globals */ |
78 |
/* import other globals */ |
53 |
dkimf_import_globals(ctx, l); |
79 |
dkimf_import_globals(ctx, l); |
54 |
|
80 |
|
55 |
-# if LUA_VERSION_NUM == 502 |
81 |
-# if LUA_VERSION_NUM == 502 |
56 |
+# if (LUA_VERSION_NUM == 502 || LUA_VERSION_NUM == 503) |
82 |
+# if LUA_VERSION_NUM >= 502 |
57 |
switch (lua_load(l, dkimf_lua_reader, (void *) &io, name, NULL)) |
83 |
switch (lua_load(l, dkimf_lua_reader, (void *) &io, name, NULL)) |
58 |
# else /* LUA_VERSION_NUM == 502 */ |
84 |
-# else /* LUA_VERSION_NUM == 502 */ |
|
|
85 |
+# else /* LUA_VERSION_NUM >= 502 */ |
59 |
switch (lua_load(l, dkimf_lua_reader, (void *) &io, name)) |
86 |
switch (lua_load(l, dkimf_lua_reader, (void *) &io, name)) |
|
|
87 |
-# endif /* LUA_VERSION_NUM == 502 */ |
88 |
+# endif /* LUA_VERSION_NUM >= 502 */ |
89 |
{ |
90 |
case 0: |
91 |
break; |
60 |
@@ -706,7 +710,11 @@ dkimf_lua_screen_hook(void *ctx, const char *script, s |
92 |
@@ -706,7 +710,11 @@ dkimf_lua_screen_hook(void *ctx, const char *script, s |
61 |
io.lua_io_len = 0; |
93 |
io.lua_io_len = 0; |
62 |
io.lua_io_alloc = 0; |
94 |
io.lua_io_alloc = 0; |
63 |
|
95 |
|
64 |
+#if (LUA_VERSION_NUM == 503) |
96 |
+#if (LUA_VERSION_NUM >= 503) |
65 |
+ if (lua_dump(l, dkimf_lua_writer, &io, 0) == 0) |
97 |
+ if (lua_dump(l, dkimf_lua_writer, &io, 0) == 0) |
66 |
+#else |
98 |
+#else |
67 |
if (lua_dump(l, dkimf_lua_writer, &io) == 0) |
99 |
if (lua_dump(l, dkimf_lua_writer, &io) == 0) |
Lines 69-97
Link Here
|
69 |
{ |
101 |
{ |
70 |
*keep = (void *) io.lua_io_script; |
102 |
*keep = (void *) io.lua_io_script; |
71 |
*funclen = io.lua_io_len; |
103 |
*funclen = io.lua_io_len; |
72 |
@@ -782,7 +790,7 @@ dkimf_lua_stats_hook(void *ctx, const char *script, si |
104 |
@@ -782,12 +790,12 @@ dkimf_lua_stats_hook(void *ctx, const char *script, si |
73 |
** Register functions. |
105 |
** Register functions. |
74 |
*/ |
106 |
*/ |
75 |
|
107 |
|
76 |
-# if LUA_VERSION_NUM == 502 |
108 |
-# if LUA_VERSION_NUM == 502 |
77 |
+# if (LUA_VERSION_NUM == 502 || LUA_VERSION_NUM == 503) |
109 |
+# if LUA_VERSION_NUM >= 502 |
78 |
luaL_newlib(l, dkimf_lua_lib_stats); |
110 |
luaL_newlib(l, dkimf_lua_lib_stats); |
79 |
lua_setglobal(l, "odkim"); |
111 |
lua_setglobal(l, "odkim"); |
80 |
# else /* LUA_VERSION_NUM == 502 */ |
112 |
-# else /* LUA_VERSION_NUM == 502 */ |
81 |
@@ -911,7 +919,7 @@ dkimf_lua_stats_hook(void *ctx, const char *script, si |
113 |
+# else /* LUA_VERSION_NUM >= 502 */ |
|
|
114 |
luaL_register(l, "odkim", dkimf_lua_lib_stats); |
115 |
-# endif /* LUA_VERSION_NUM == 502 */ |
116 |
+# endif /* LUA_VERSION_NUM >= 502 */ |
117 |
lua_pop(l, 1); |
118 |
|
119 |
/* |
120 |
@@ -911,11 +919,11 @@ dkimf_lua_stats_hook(void *ctx, const char *script, si |
82 |
/* import other globals */ |
121 |
/* import other globals */ |
83 |
dkimf_import_globals(ctx, l); |
122 |
dkimf_import_globals(ctx, l); |
84 |
|
123 |
|
85 |
-# if LUA_VERSION_NUM == 502 |
124 |
-# if LUA_VERSION_NUM == 502 |
86 |
+# if (LUA_VERSION_NUM == 502 || LUA_VERSION_NUM == 503) |
125 |
+# if LUA_VERSION_NUM >= 502 |
87 |
switch (lua_load(l, dkimf_lua_reader, (void *) &io, name, NULL)) |
126 |
switch (lua_load(l, dkimf_lua_reader, (void *) &io, name, NULL)) |
88 |
# else /* LUA_VERSION_NUM == 502 */ |
127 |
-# else /* LUA_VERSION_NUM == 502 */ |
|
|
128 |
+# else /* LUA_VERSION_NUM >= 502 */ |
89 |
switch (lua_load(l, dkimf_lua_reader, (void *) &io, name)) |
129 |
switch (lua_load(l, dkimf_lua_reader, (void *) &io, name)) |
|
|
130 |
-# endif /* LUA_VERSION_NUM == 502 */ |
131 |
+# endif /* LUA_VERSION_NUM >= 502 */ |
132 |
{ |
133 |
case 0: |
134 |
break; |
90 |
@@ -943,7 +951,11 @@ dkimf_lua_stats_hook(void *ctx, const char *script, si |
135 |
@@ -943,7 +951,11 @@ dkimf_lua_stats_hook(void *ctx, const char *script, si |
91 |
io.lua_io_len = 0; |
136 |
io.lua_io_len = 0; |
92 |
io.lua_io_alloc = 0; |
137 |
io.lua_io_alloc = 0; |
93 |
|
138 |
|
94 |
+#if (LUA_VERSION_NUM == 503) |
139 |
+#if (LUA_VERSION_NUM >= 503) |
95 |
+ if (lua_dump(l, dkimf_lua_writer, &io, 0) == 0) |
140 |
+ if (lua_dump(l, dkimf_lua_writer, &io, 0) == 0) |
96 |
+#else |
141 |
+#else |
97 |
if (lua_dump(l, dkimf_lua_writer, &io) == 0) |
142 |
if (lua_dump(l, dkimf_lua_writer, &io) == 0) |
Lines 99-127
Link Here
|
99 |
{ |
144 |
{ |
100 |
*keep = (void *) io.lua_io_script; |
145 |
*keep = (void *) io.lua_io_script; |
101 |
*funclen = io.lua_io_len; |
146 |
*funclen = io.lua_io_len; |
102 |
@@ -1019,7 +1031,7 @@ dkimf_lua_final_hook(void *ctx, const char *script, si |
147 |
@@ -1019,12 +1031,12 @@ dkimf_lua_final_hook(void *ctx, const char *script, si |
103 |
** Register functions. |
148 |
** Register functions. |
104 |
*/ |
149 |
*/ |
105 |
|
150 |
|
106 |
-# if LUA_VERSION_NUM == 502 |
151 |
-# if LUA_VERSION_NUM == 502 |
107 |
+# if (LUA_VERSION_NUM == 502 || LUA_VERSION_NUM == 503) |
152 |
+# if LUA_VERSION_NUM >= 502 |
108 |
luaL_newlib(l, dkimf_lua_lib_final); |
153 |
luaL_newlib(l, dkimf_lua_lib_final); |
109 |
lua_setglobal(l, "odkim"); |
154 |
lua_setglobal(l, "odkim"); |
110 |
# else /* LUA_VERSION_NUM == 502 */ |
155 |
-# else /* LUA_VERSION_NUM == 502 */ |
111 |
@@ -1148,7 +1160,7 @@ dkimf_lua_final_hook(void *ctx, const char *script, si |
156 |
+# else /* LUA_VERSION_NUM >= 502 */ |
|
|
157 |
luaL_register(l, "odkim", dkimf_lua_lib_final); |
158 |
-# endif /* LUA_VERSION_NUM == 502 */ |
159 |
+# endif /* LUA_VERSION_NUM >= 502 */ |
160 |
lua_pop(l, 1); |
161 |
|
162 |
/* |
163 |
@@ -1148,11 +1160,11 @@ dkimf_lua_final_hook(void *ctx, const char *script, si |
112 |
/* import other globals */ |
164 |
/* import other globals */ |
113 |
dkimf_import_globals(ctx, l); |
165 |
dkimf_import_globals(ctx, l); |
114 |
|
166 |
|
115 |
-# if LUA_VERSION_NUM == 502 |
167 |
-# if LUA_VERSION_NUM == 502 |
116 |
+# if (LUA_VERSION_NUM == 502 || LUA_VERSION_NUM == 503) |
168 |
+# if LUA_VERSION_NUM >= 502 |
117 |
switch (lua_load(l, dkimf_lua_reader, (void *) &io, name, NULL)) |
169 |
switch (lua_load(l, dkimf_lua_reader, (void *) &io, name, NULL)) |
118 |
# else /* LUA_VERSION_NUM == 502 */ |
170 |
-# else /* LUA_VERSION_NUM == 502 */ |
|
|
171 |
+# else /* LUA_VERSION_NUM >= 502 */ |
119 |
switch (lua_load(l, dkimf_lua_reader, (void *) &io, name)) |
172 |
switch (lua_load(l, dkimf_lua_reader, (void *) &io, name)) |
|
|
173 |
-# endif /* LUA_VERSION_NUM == 502 */ |
174 |
+# endif /* LUA_VERSION_NUM >= 502 */ |
175 |
{ |
176 |
case 0: |
177 |
break; |
120 |
@@ -1180,7 +1192,11 @@ dkimf_lua_final_hook(void *ctx, const char *script, si |
178 |
@@ -1180,7 +1192,11 @@ dkimf_lua_final_hook(void *ctx, const char *script, si |
121 |
io.lua_io_len = 0; |
179 |
io.lua_io_len = 0; |
122 |
io.lua_io_alloc = 0; |
180 |
io.lua_io_alloc = 0; |
123 |
|
181 |
|
124 |
+#if (LUA_VERSION_NUM == 503) |
182 |
+#if (LUA_VERSION_NUM >= 503) |
125 |
+ if (lua_dump(l, dkimf_lua_writer, &io, 0) == 0) |
183 |
+ if (lua_dump(l, dkimf_lua_writer, &io, 0) == 0) |
126 |
+#else |
184 |
+#else |
127 |
if (lua_dump(l, dkimf_lua_writer, &io) == 0) |
185 |
if (lua_dump(l, dkimf_lua_writer, &io) == 0) |
Lines 129-148
Link Here
|
129 |
{ |
187 |
{ |
130 |
*keep = (void *) io.lua_io_script; |
188 |
*keep = (void *) io.lua_io_script; |
131 |
*funclen = io.lua_io_len; |
189 |
*funclen = io.lua_io_len; |
132 |
@@ -1249,7 +1265,7 @@ dkimf_lua_db_hook(const char *script, size_t scriptlen |
190 |
@@ -1249,11 +1265,11 @@ dkimf_lua_db_hook(const char *script, size_t scriptlen |
133 |
lua_pushstring(l, query); |
191 |
lua_pushstring(l, query); |
134 |
lua_setglobal(l, "query"); |
192 |
lua_setglobal(l, "query"); |
135 |
|
193 |
|
136 |
-# if LUA_VERSION_NUM == 502 |
194 |
-# if LUA_VERSION_NUM == 502 |
137 |
+# if (LUA_VERSION_NUM == 502 || LUA_VERSION_NUM == 503) |
195 |
+# if LUA_VERSION_NUM >= 502 |
138 |
switch (lua_load(l, dkimf_lua_reader, (void *) &io, script, NULL)) |
196 |
switch (lua_load(l, dkimf_lua_reader, (void *) &io, script, NULL)) |
139 |
# else /* LUA_VERSION_NUM == 502 */ |
197 |
-# else /* LUA_VERSION_NUM == 502 */ |
|
|
198 |
+# else /* LUA_VERSION_NUM >= 502 */ |
140 |
switch (lua_load(l, dkimf_lua_reader, (void *) &io, script)) |
199 |
switch (lua_load(l, dkimf_lua_reader, (void *) &io, script)) |
|
|
200 |
-# endif /* LUA_VERSION_NUM == 502 */ |
201 |
+# endif /* LUA_VERSION_NUM >= 502 */ |
202 |
{ |
203 |
case 0: |
204 |
break; |
141 |
@@ -1281,7 +1297,11 @@ dkimf_lua_db_hook(const char *script, size_t scriptlen |
205 |
@@ -1281,7 +1297,11 @@ dkimf_lua_db_hook(const char *script, size_t scriptlen |
142 |
io.lua_io_len = 0; |
206 |
io.lua_io_len = 0; |
143 |
io.lua_io_alloc = 0; |
207 |
io.lua_io_alloc = 0; |
144 |
|
208 |
|
145 |
+#if (LUA_VERSION_NUM == 503) |
209 |
+#if (LUA_VERSION_NUM >= 503) |
146 |
+ if (lua_dump(l, dkimf_lua_writer, &io, 0) == 0) |
210 |
+ if (lua_dump(l, dkimf_lua_writer, &io, 0) == 0) |
147 |
+#else |
211 |
+#else |
148 |
if (lua_dump(l, dkimf_lua_writer, &io) == 0) |
212 |
if (lua_dump(l, dkimf_lua_writer, &io) == 0) |