375 lua_pushboolean(L, 0); |
375 lua_pushboolean(L, 0); |
376 return 1; |
376 return 1; |
377 } |
377 } |
378 } |
378 } |
379 |
379 |
380 void luasec_push_asn1_objname(lua_State* L, ASN1_OBJECT *object, int no_name) |
|
381 { |
|
382 char buffer[256]; |
|
383 int len = OBJ_obj2txt(buffer, sizeof(buffer), object, no_name); |
|
384 lua_pushlstring(L, buffer, min(sizeof(buffer),len)); |
|
385 } |
|
386 |
|
387 void luasec_push_asn1_string(lua_State* L, ASN1_STRING *string) |
|
388 { |
|
389 if(string) |
|
390 lua_pushlstring(L, (char*)ASN1_STRING_data(string), ASN1_STRING_length(string)); |
|
391 else |
|
392 lua_pushnil(L); |
|
393 } |
|
394 |
|
395 int luasec_push_subtable(lua_State* L, int idx) |
|
396 { |
|
397 |
|
398 lua_pushvalue(L, -1); |
|
399 lua_gettable(L, idx-1); |
|
400 |
|
401 if(lua_isnil(L, -1)) |
|
402 { |
|
403 lua_pop(L, 1); |
|
404 lua_newtable(L); |
|
405 lua_pushvalue(L, -2); |
|
406 lua_pushvalue(L, -2); |
|
407 lua_settable(L, idx-3); |
|
408 |
|
409 lua_replace(L, -2); /* Replace key with table */ |
|
410 return 1; |
|
411 } |
|
412 lua_replace(L, -2); /* Replace key with table */ |
|
413 return 0; |
|
414 } |
|
415 |
|
416 /** |
380 /** |
417 * Return the peer certificate. |
381 * Return the peer certificate. |
418 */ |
382 */ |
419 static int meth_getpeercertificate(lua_State *L) |
383 static int meth_getpeercertificate(lua_State *L) |
420 { |
384 { |