Changeset 4763
- Timestamp:
- 06/07/09 11:15:12 (4 years ago)
- Location:
- luci/trunk/libs
- Files:
-
- 4 added
- 4 modified
-
nixio/root (added)
-
nixio/root/etc (added)
-
nixio/root/etc/nixio (added)
-
nixio/root/etc/nixio/.nixio_stamp (added)
-
nixio/src/tls-context.c (modified) (1 diff)
-
px5g/lua/px5g/util.lua (modified) (2 diffs)
-
px5g/root/usr/sbin/px5g-genkeys (modified) (1 diff)
-
px5g/src/px5g.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
luci/trunk/libs/nixio/src/tls-context.c
r4757 r4763 114 114 SSL_CTX *ctx = nixio__checktlsctx(L); 115 115 const char *cert = luaL_checkstring(L, 2); 116 return nixio__tls_pstatus(L, SSL_CTX_use_certificate_chain_file(ctx, cert)); 116 const char *type = luaL_optstring(L, 3, "chain"); 117 int ktype; 118 119 if (!strcmp(type, "chain")) { 120 return nixio__tls_pstatus(L, 121 SSL_CTX_use_certificate_chain_file(ctx, cert)); 122 } else if (!strcmp(type, "pem")) { 123 ktype = SSL_FILETYPE_PEM; 124 } else if (!strcmp(type, "asn1")) { 125 ktype = SSL_FILETYPE_ASN1; 126 } else { 127 return luaL_argerror(L, 3, "supported values: chain, pem, asn1"); 128 } 129 130 return nixio__tls_pstatus(L, 131 SSL_CTX_use_certificate_file(ctx, cert, ktype)); 117 132 } 118 133 -
luci/trunk/libs/px5g/lua/px5g/util.lua
r4761 r4763 30 30 31 31 local outdata = {preamble[type]} 32 for i = 1, 64, #b64 + 63do32 for i = 1, #b64, 64 do 33 33 outdata[#outdata + 1] = b64:sub(i, i + 63) 34 34 end … … 38 38 return table.concat(outdata, "\n") 39 39 end 40 41 function pem2der(data) 42 local b64 = data:gsub({["\n"] = "", ["%-%-%-%-%-.-%-%-%-%-%-"] = ""}) 43 return nixio.bin.b64decode(b64) 44 end -
luci/trunk/libs/px5g/root/usr/sbin/px5g-genkeys
r4761 r4763 7 7 local fs = require "nixio.fs" 8 8 local os = require "os" 9 nixio.umask(77) 9 10 10 11 if not fs.access(certfile) then -
luci/trunk/libs/px5g/src/px5g.c
r4761 r4763 86 86 4, "Invalid Time"); 87 87 88 size_t join = 1; 88 89 lua_pushliteral(L, ""); 89 90 for (int i = 0; i < (sizeof(xfields) / sizeof(*xfields)); i++) { … … 92 93 if (lua_isstring(L, -1)) { 93 94 const char *val = lua_tostring(L, -1); 94 luaL_argcheck(L, !strchr(val, '\''), 2, "Invalid Value"); 95 lua_pushfstring(L, "%s%s='%s';", 96 lua_tostring(L, -2), xfields[i], val); 95 luaL_argcheck(L, !strchr(val, ';'), 2, "Invalid Value"); 96 lua_pushfstring(L, "%s=%s;", xfields[i], val); 97 97 lua_remove(L, -2); 98 lua_remove(L, -2);98 join++; 99 99 } else { 100 100 lua_pop(L, 1); 101 101 } 102 102 } 103 lua_concat(L, join); 103 104 104 105 x509_raw cert;
