/* Copyright (c) 2017-2018 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "llist.h"
#include "istream.h"
#include "sha1.h"
#include "hex-binary.h"
#include "eacces-error.h"
#include "dlua-script-private.h"
#include <fcntl.h>
#include <unistd.h>
{
switch(err) {
#ifdef LUA_OK
case LUA_OK:
return "ok";
#endif
case LUA_YIELD:
return "yield";
case LUA_ERRRUN:
return "runtime error";
case LUA_ERRSYNTAX:
return "syntax error";
case LUA_ERRMEM:
return "out of memory";
#ifdef LUA_ERRGCMM
case LUA_ERRGCMM:
return "gc management error";
#endif
case LUA_ERRERR:
return "error while handling error";
#ifdef LUA_ERRFILE
case LUA_ERRFILE:
return "error loading file";
#endif
default:
return "unknown error";
}
}
{
(struct dlua_script*)ctx;
if (nsize == 0) {
return NULL;
} else {
}
}
{
(struct dlua_script*)ctx;
const unsigned char *data;
*size_r = 0;
return NULL;
}
return (const char*)data;
}
{
if (script->L == L)
return script;
i_unreached();
}
{
int ret = 0;
return 0;
/* see if there is a symbol for init */
if (ret != 0) {
ret = -1;
if (ret != 0)
*error_r = "Script init failed";
} else {
ret = -1;
}
}
return ret;
}
{
/* lua API says that lua_newstate will return NULL only if it's out of
memory. this cannot really happen with our allocator as it will
call i_fatal_status anyways if it runs out of memory */
luaL_openlibs(script->L);
return script;
}
{
if (err != 0) {
return -1;
}
return 0;
}
static struct dlua_script *
{
return script;
return NULL;
}
static int
const char **error_r)
{
return -1;
}
return 0;
}
const char **error_r)
{
int err;
const char *fn;
return 0;
}
dlua_errstr(err));
return -1;
}
}
const char **error_r)
{
int err;
return 0;
}
/* lua reports file access errors poorly */
else
file);
return -1;
}
return -1;
}
}
const char **error_r)
{
int err;
return 0;
}
return -1;
}
}
{
/* courtesy call */
int ret;
/* see if there is a symbol for deinit */
if (ret != 0) {
}
} else {
}
/* then just release memory */
}
{
}
{
return;
}
{
return ret;
}
{
case DLUA_TABLE_VALUE_STRING:
break;
case DLUA_TABLE_VALUE_INTEGER:
break;
case DLUA_TABLE_VALUE_DOUBLE:
break;
case DLUA_TABLE_VALUE_BOOLEAN:
break;
case DLUA_TABLE_VALUE_NULL:
lua_pushnil(script->L);
break;
default:
i_unreached();
}
values++;
}
}