Added
Link Here
|
1 |
--- opendkim/opendkim-lua.c.orig 2015-02-04 00:31:11 UTC |
2 |
+++ opendkim/opendkim-lua.c |
3 |
@@ -282,7 +282,7 @@ dkimf_lua_alloc(void *ud, void *ptr, size_t osize, siz |
4 |
free(ptr); |
5 |
return NULL; |
6 |
} |
7 |
-# if LUA_VERSION_NUM == 502 |
8 |
+# if (LUA_VERSION_NUM == 502 || LUA_VERSION_NUM == 503) |
9 |
else if (nsize != 0 && ptr == NULL) |
10 |
# else /* LUA_VERSION_NUM == 502 */ |
11 |
else if (nsize != 0 && osize == 0) |
12 |
@@ -482,7 +482,7 @@ dkimf_lua_setup_hook(void *ctx, const char *script, si |
13 |
** Register functions. |
14 |
*/ |
15 |
|
16 |
-# if LUA_VERSION_NUM == 502 |
17 |
+# if (LUA_VERSION_NUM == 502 || LUA_VERSION_NUM == 503) |
18 |
luaL_newlib(l, dkimf_lua_lib_setup); |
19 |
lua_setglobal(l, "odkim"); |
20 |
# else /* LUA_VERSION_NUM == 502 */ |
21 |
@@ -529,7 +529,7 @@ dkimf_lua_setup_hook(void *ctx, const char *script, si |
22 |
/* import other globals */ |
23 |
dkimf_import_globals(ctx, l); |
24 |
|
25 |
-# if LUA_VERSION_NUM == 502 |
26 |
+# if (LUA_VERSION_NUM == 502 || LUA_VERSION_NUM == 503) |
27 |
switch (lua_load(l, dkimf_lua_reader, (void *) &io, name, NULL)) |
28 |
# else /* LUA_VERSION_NUM == 502 */ |
29 |
switch (lua_load(l, dkimf_lua_reader, (void *) &io, name)) |
30 |
@@ -561,7 +561,11 @@ dkimf_lua_setup_hook(void *ctx, const char *script, si |
31 |
io.lua_io_len = 0; |
32 |
io.lua_io_alloc = 0; |
33 |
|
34 |
+#if (LUA_VERSION_NUM == 503) |
35 |
+ if (lua_dump(l, dkimf_lua_writer, &io, 0) == 0) |
36 |
+#else |
37 |
if (lua_dump(l, dkimf_lua_writer, &io) == 0) |
38 |
+#endif |
39 |
{ |
40 |
*keep = (void *) io.lua_io_script; |
41 |
*funclen = io.lua_io_len; |
42 |
@@ -637,7 +641,7 @@ dkimf_lua_screen_hook(void *ctx, const char *script, s |
43 |
** Register functions. |
44 |
*/ |
45 |
|
46 |
-# if LUA_VERSION_NUM == 502 |
47 |
+# if (LUA_VERSION_NUM == 502 || LUA_VERSION_NUM == 503) |
48 |
luaL_newlib(l, dkimf_lua_lib_screen); |
49 |
lua_setglobal(l, "odkim"); |
50 |
# else /* LUA_VERSION_NUM == 502 */ |
51 |
@@ -674,7 +678,7 @@ dkimf_lua_screen_hook(void *ctx, const char *script, s |
52 |
/* import other globals */ |
53 |
dkimf_import_globals(ctx, l); |
54 |
|
55 |
-# if LUA_VERSION_NUM == 502 |
56 |
+# if (LUA_VERSION_NUM == 502 || LUA_VERSION_NUM == 503) |
57 |
switch (lua_load(l, dkimf_lua_reader, (void *) &io, name, NULL)) |
58 |
# else /* LUA_VERSION_NUM == 502 */ |
59 |
switch (lua_load(l, dkimf_lua_reader, (void *) &io, name)) |
60 |
@@ -706,7 +710,11 @@ dkimf_lua_screen_hook(void *ctx, const char *script, s |
61 |
io.lua_io_len = 0; |
62 |
io.lua_io_alloc = 0; |
63 |
|
64 |
+#if (LUA_VERSION_NUM == 503) |
65 |
+ if (lua_dump(l, dkimf_lua_writer, &io, 0) == 0) |
66 |
+#else |
67 |
if (lua_dump(l, dkimf_lua_writer, &io) == 0) |
68 |
+#endif |
69 |
{ |
70 |
*keep = (void *) io.lua_io_script; |
71 |
*funclen = io.lua_io_len; |
72 |
@@ -782,7 +790,7 @@ dkimf_lua_stats_hook(void *ctx, const char *script, si |
73 |
** Register functions. |
74 |
*/ |
75 |
|
76 |
-# if LUA_VERSION_NUM == 502 |
77 |
+# if (LUA_VERSION_NUM == 502 || LUA_VERSION_NUM == 503) |
78 |
luaL_newlib(l, dkimf_lua_lib_stats); |
79 |
lua_setglobal(l, "odkim"); |
80 |
# else /* LUA_VERSION_NUM == 502 */ |
81 |
@@ -911,7 +919,7 @@ dkimf_lua_stats_hook(void *ctx, const char *script, si |
82 |
/* import other globals */ |
83 |
dkimf_import_globals(ctx, l); |
84 |
|
85 |
-# if LUA_VERSION_NUM == 502 |
86 |
+# if (LUA_VERSION_NUM == 502 || LUA_VERSION_NUM == 503) |
87 |
switch (lua_load(l, dkimf_lua_reader, (void *) &io, name, NULL)) |
88 |
# else /* LUA_VERSION_NUM == 502 */ |
89 |
switch (lua_load(l, dkimf_lua_reader, (void *) &io, name)) |
90 |
@@ -943,7 +951,11 @@ dkimf_lua_stats_hook(void *ctx, const char *script, si |
91 |
io.lua_io_len = 0; |
92 |
io.lua_io_alloc = 0; |
93 |
|
94 |
+#if (LUA_VERSION_NUM == 503) |
95 |
+ if (lua_dump(l, dkimf_lua_writer, &io, 0) == 0) |
96 |
+#else |
97 |
if (lua_dump(l, dkimf_lua_writer, &io) == 0) |
98 |
+#endif |
99 |
{ |
100 |
*keep = (void *) io.lua_io_script; |
101 |
*funclen = io.lua_io_len; |
102 |
@@ -1019,7 +1031,7 @@ dkimf_lua_final_hook(void *ctx, const char *script, si |
103 |
** Register functions. |
104 |
*/ |
105 |
|
106 |
-# if LUA_VERSION_NUM == 502 |
107 |
+# if (LUA_VERSION_NUM == 502 || LUA_VERSION_NUM == 503) |
108 |
luaL_newlib(l, dkimf_lua_lib_final); |
109 |
lua_setglobal(l, "odkim"); |
110 |
# else /* LUA_VERSION_NUM == 502 */ |
111 |
@@ -1148,7 +1160,7 @@ dkimf_lua_final_hook(void *ctx, const char *script, si |
112 |
/* import other globals */ |
113 |
dkimf_import_globals(ctx, l); |
114 |
|
115 |
-# if LUA_VERSION_NUM == 502 |
116 |
+# if (LUA_VERSION_NUM == 502 || LUA_VERSION_NUM == 503) |
117 |
switch (lua_load(l, dkimf_lua_reader, (void *) &io, name, NULL)) |
118 |
# else /* LUA_VERSION_NUM == 502 */ |
119 |
switch (lua_load(l, dkimf_lua_reader, (void *) &io, name)) |
120 |
@@ -1180,7 +1192,11 @@ dkimf_lua_final_hook(void *ctx, const char *script, si |
121 |
io.lua_io_len = 0; |
122 |
io.lua_io_alloc = 0; |
123 |
|
124 |
+#if (LUA_VERSION_NUM == 503) |
125 |
+ if (lua_dump(l, dkimf_lua_writer, &io, 0) == 0) |
126 |
+#else |
127 |
if (lua_dump(l, dkimf_lua_writer, &io) == 0) |
128 |
+#endif |
129 |
{ |
130 |
*keep = (void *) io.lua_io_script; |
131 |
*funclen = io.lua_io_len; |
132 |
@@ -1249,7 +1265,7 @@ dkimf_lua_db_hook(const char *script, size_t scriptlen |
133 |
lua_pushstring(l, query); |
134 |
lua_setglobal(l, "query"); |
135 |
|
136 |
-# if LUA_VERSION_NUM == 502 |
137 |
+# if (LUA_VERSION_NUM == 502 || LUA_VERSION_NUM == 503) |
138 |
switch (lua_load(l, dkimf_lua_reader, (void *) &io, script, NULL)) |
139 |
# else /* LUA_VERSION_NUM == 502 */ |
140 |
switch (lua_load(l, dkimf_lua_reader, (void *) &io, script)) |
141 |
@@ -1281,7 +1297,11 @@ dkimf_lua_db_hook(const char *script, size_t scriptlen |
142 |
io.lua_io_len = 0; |
143 |
io.lua_io_alloc = 0; |
144 |
|
145 |
+#if (LUA_VERSION_NUM == 503) |
146 |
+ if (lua_dump(l, dkimf_lua_writer, &io, 0) == 0) |
147 |
+#else |
148 |
if (lua_dump(l, dkimf_lua_writer, &io) == 0) |
149 |
+#endif |
150 |
{ |
151 |
*keep = (void *) io.lua_io_script; |
152 |
*funclen = io.lua_io_len; |