aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/GNUmakefile1
-rw-r--r--src/openssl.auxlib.lua21
-rw-r--r--src/openssl.x509.altname.lua3
-rw-r--r--src/openssl.x509.name.lua3
4 files changed, 26 insertions, 2 deletions
diff --git a/src/GNUmakefile b/src/GNUmakefile
index 3aff30a..f0eefde 100644
--- a/src/GNUmakefile
+++ b/src/GNUmakefile
@@ -88,6 +88,7 @@ LUAC$(1)_$(d) = $$(or $$(call LUAPATH_$(d), $(1), luac), true)
MODS$(1)_$(d) = \
$$(DESTDIR)$(2)/_openssl.so \
$$(DESTDIR)$(3)/openssl.lua \
+ $$(DESTDIR)$(3)/openssl/auxlib.lua \
$$(DESTDIR)$(3)/openssl/bignum.lua \
$$(DESTDIR)$(3)/openssl/pkey.lua \
$$(DESTDIR)$(3)/openssl/pubkey.lua \
diff --git a/src/openssl.auxlib.lua b/src/openssl.auxlib.lua
new file mode 100644
index 0000000..4f00c25
--- /dev/null
+++ b/src/openssl.auxlib.lua
@@ -0,0 +1,21 @@
+local auxlib = {}
+
+if _VERSION == "Lua 5.1" then
+ local _pairs = pairs
+
+ function auxlib.pairs(t)
+ if type(t) == "userdata" then
+ local mt = getmetatable(t)
+
+ if mt and mt.__pairs then
+ return mt.__pairs(t)
+ else
+ return _pairs(t)
+ end
+ end
+ end
+else
+ auxlib.pairs = pairs
+end
+
+return auxlib
diff --git a/src/openssl.x509.altname.lua b/src/openssl.x509.altname.lua
index 66f16e7..e8222a0 100644
--- a/src/openssl.x509.altname.lua
+++ b/src/openssl.x509.altname.lua
@@ -1,9 +1,10 @@
local altname = require"_openssl.x509.altname"
+local auxlib = require"openssl.auxlib"
altname.interpose("__tostring", function (self)
local t = { }
- for k, v in pairs(self) do
+ for k, v in auxlib.pairs(self) do
t[#t + 1] = k .. ":" .. v
end
diff --git a/src/openssl.x509.name.lua b/src/openssl.x509.name.lua
index a531502..f33339a 100644
--- a/src/openssl.x509.name.lua
+++ b/src/openssl.x509.name.lua
@@ -1,9 +1,10 @@
local name = require"_openssl.x509.name"
+local auxlib = require"openssl.auxlib"
name.interpose("__tostring", function (self)
local t = { }
- for k, v in pairs(self) do
+ for k, v in auxlib.pairs(self) do
t[#t + 1] = k .. "=" .. v
end