rpmluav rpmluavNew(void) { rpmluav var = rpmluavGetPool(_rpmluavPool); var->keyType = RPMLUAV_NIL; var->valueType = RPMLUAV_NIL; var->key.ptr = NULL; var->value.ptr = NULL; var->listmode = 0; return ((rpmluav)rpmioLinkPoolItem((rpmioItem)var, __FUNCTION__, __FILE__, __LINE__)); }
aes-[128|192|256]-ofb 128/192/256 bit AES in OFB mode #endif CIPHER_CTX rpmCipherInit(pgpSymkeyAlgo symkeyalgo, rpmCipherFlags flags) { CIPHER_CTX cph = cphGetPool(_cphPool); cph->symkeyalgo = symkeyalgo; cph->flags = flags; switch (symkeyalgo) { case PGPSYMKEYALGO_DES: cph->name = "des"; cph->paramsize = 64/8; cph->param = DRD_xcalloc(1, cph->paramsize); cph->blocksize = 0; cph->keybitsmin = 0; cph->keybitsmax = 0; cph->keybitsinc = 0; cph->Setup = NULL; cph->SetIV = NULL; cph->SetCTR = NULL; cph->Feedback = NULL; break; case PGPSYMKEYALGO_PLAINTEXT: case PGPSYMKEYALGO_IDEA: case PGPSYMKEYALGO_TRIPLE_DES: case PGPSYMKEYALGO_CAST5: case PGPSYMKEYALGO_BLOWFISH: case PGPSYMKEYALGO_SAFER: case PGPSYMKEYALGO_DES_SK: case PGPSYMKEYALGO_AES_128: case PGPSYMKEYALGO_AES_192: case PGPSYMKEYALGO_AES_256: case PGPSYMKEYALGO_TWOFISH: case PGPSYMKEYALGO_CAMELLIA_128: case PGPSYMKEYALGO_CAMELLIA_192: case PGPSYMKEYALGO_CAMELLIA_256: case PGPSYMKEYALGO_NOENCRYPT: default: break; } DPRINTF((stderr, "==> cph %p ==== Init(%s, %x) param %p\n", cph, cph->name, flags, cph->param)); return (CIPHER_CTX)rpmioLinkPoolItem((rpmioItem)cph, __FUNCTION__, __FILE__, __LINE__); }
Package newPackage(/*@unused@*/ Spec spec) { Package pkg = pkgGetPool(_pkgPool); pkg->header = headerNew(); pkg->ds = NULL; pkg->autoProv = ((_rpmbuildFlags & 0x1) != 0); pkg->autoReq = ((_rpmbuildFlags & 0x2) != 0); #if 0 pkg->reqProv = NULL; pkg->triggers = NULL; pkg->triggerScripts = NULL; #endif pkg->triggerFiles = NULL; pkg->fileFile = NULL; pkg->fileList = NULL; pkg->fi = NULL; pkg->preInFile = NULL; pkg->postInFile = NULL; pkg->preUnFile = NULL; pkg->postUnFile = NULL; pkg->verifyFile = NULL; pkg->sanityCheckFile = NULL; pkg->specialDoc = NULL; pkg->next = NULL; return (Package)rpmioLinkPoolItem((rpmioItem)pkg, __FUNCTION__, __FILE__, __LINE__); }
/*@-globs -mods@*/ /* XXX hide rpmGlobalMacroContext mods for now. */ rpmlua rpmluaNew(void) { rpmlua lua = rpmluaGetPool(_rpmluaPool); lua_State *L = lua_open(); /*@-readonlytrans -nullassign @*/ /*@observer@*/ /*@unchecked@*/ static const luaL_reg lualibs[] = { /* standard LUA libraries */ {"", luaopen_base}, /* XXX 5.1.4 internal has not */ #if defined(LUA_COLIBNAME) && LUA_VERSION_NUM > 501 {LUA_COLIBNAME, luaopen_coroutine}, #endif #if defined(LUA_TABLIBNAME) {LUA_TABLIBNAME, luaopen_table}, #endif #if defined(LUA_IOLIBNAME) {LUA_IOLIBNAME, luaopen_io}, #endif #if defined(LUA_OSLIBNAME) {LUA_OSLIBNAME, luaopen_os}, #endif #if defined(LUA_STRLIBNAME) {LUA_STRLIBNAME, luaopen_string}, #endif #if defined(LUA_BITLIBNAME) /* XXX lua >= 5.2.0 only */ {LUA_BITLIBNAME, luaopen_bit32}, #endif #if defined(LUA_MATHLIBNAME) {LUA_MATHLIBNAME, luaopen_math}, #endif #if defined(LUA_DBLIBNAME) {LUA_DBLIBNAME, luaopen_debug}, #endif #if defined(LUA_LOADLIBNAME) {LUA_LOADLIBNAME, luaopen_package}, #endif #ifdef WITH_SYCK {"lsyck", luaopen_syck}, #endif /* WITH_SYCK */ /* local LUA libraries (RPM only) */ #ifdef WITH_LUA_INTERNAL {"posix", luaopen_posix}, #ifdef HACK {"rex_posix", luaopen_rex_posix}, {"rex_pcre", luaopen_rex_pcre}, #endif {"uuid", luaopen_uuid}, {"wrs", luaopen_wrs}, #ifdef USE_LUA_CRYPTO /* XXX external lua modules instead. */ {"crypto", luaopen_crypto}, {"lxp", luaopen_lxp}, #endif #ifdef USE_LUA_SOCKET /* XXX external lua modules instead. */ {"socket", luaopen_socket_core}, #endif {"local", luaopen_local}, #endif {"rpm", luaopen_rpm}, {NULL, NULL}, }; /*@=readonlytrans =nullassign @*/ /*@observer@*/ /*@unchecked@*/ const luaL_reg *lib = lualibs; char *path_buf; char *path_next; char *path; lua->L = L; lua->pushsize = 0; lua->storeprint = 0; /* XXX TODO: use an rpmiob here. */ lua->printbufsize = 0; lua->printbufused = 0; lua->printbuf = NULL; for (; lib->name; lib++) { /*@-noeffectuncon@*/ lua_pushcfunction(L, lib->func); lua_pushstring(L, lib->name); lua_call(L, 1, 0); /*@=noeffectuncon@*/ } { const char * _lua_path = rpmGetPath(rpmluaPath, NULL); if (_lua_path != NULL) { lua_pushliteral(L, "LUA_PATH"); lua_pushstring(L, _lua_path); _lua_path = _free(_lua_path); } } #if defined(LUA_GLOBALSINDEX) lua_rawset(L, LUA_GLOBALSINDEX); #else lua_pushglobaltable(L); #endif lua_pushliteral(L, "print"); lua_pushcfunction(L, rpm_print); #if defined(LUA_GLOBALSINDEX) lua_rawset(L, LUA_GLOBALSINDEX); #else lua_pushglobaltable(L); #endif rpmluaSetData(lua, "lua", lua); /* load all standard RPM Lua script files */ path_buf = xstrdup(rpmluaFiles); for (path = path_buf; path != NULL && *path != '\0'; path = path_next) { const char **av; struct stat st; int ac, i; /* locate start of next path element */ path_next = strchr(path, ':'); if (path_next != NULL && *path_next == ':') *path_next++ = '\0'; else path_next = path + strlen(path); /* glob-expand the path element */ ac = 0; av = NULL; if ((i = rpmGlob(path, &ac, &av)) != 0) continue; /* work-off each resulting file from the path element */ for (i = 0; i < ac; i++) { const char *fn = av[i]; if (fn[0] == '@' /* attention */) { fn++; #if defined(RPM_VENDOR_OPENPKG) /* stick-with-rpm-file-sanity-checking */ || \ !defined(POPT_ERROR_BADCONFIG) /* XXX POPT 1.15 retrofit */ if (!rpmSecuritySaneFile(fn)) #else if (!poptSaneFile(fn)) #endif { rpmlog(RPMLOG_WARNING, "existing RPM Lua script file \"%s\" considered INSECURE -- not loaded\n", fn); /*@innercontinue@*/ continue; } } if (Stat(fn, &st) != -1) (void)rpmluaRunScriptFile(lua, fn); av[i] = _free(av[i]); } av = _free(av); } path_buf = _free(path_buf); return ((rpmlua)rpmioLinkPoolItem((rpmioItem)lua, __FUNCTION__, __FILE__, __LINE__)); }
Spec newSpec(void) { static const char _spec_line_buffer_size[] = "%{?_spec_line_buffer_size}%{!?_spec_line_buffer_size:100000}"; Spec spec = specGetPool(_specPool); spec->specFile = NULL; spec->sl = newSl(); spec->st = newSt(); spec->fileStack = NULL; spec->lbuf_len = (size_t)rpmExpandNumeric(_spec_line_buffer_size); spec->lbuf = (char *)xmalloc(spec->lbuf_len); spec->lbuf[0] = '\0'; spec->line = spec->lbuf; spec->nextline = NULL; spec->nextpeekc = '\0'; spec->lineNum = 0; spec->readStack = xmalloc(sizeof(*spec->readStack)); spec->readStack->next = NULL; spec->readStack->reading = 1; spec->rootURL = NULL; memset(&spec->sstates, 0, sizeof(spec->sstates)); memset(&spec->smetrics, 0, sizeof(spec->smetrics)); spec->prep = NULL; spec->build = NULL; spec->install = NULL; spec->check = NULL; spec->clean = NULL; spec->foo = NULL; spec->nfoo = 0; spec->dig = NULL; spec->sources = NULL; spec->packages = NULL; spec->noSource = 0; spec->numSources = 0; spec->sourceRpmName = NULL; spec->sourcePkgId = NULL; spec->sourceHeader = headerNew(); spec->fi = NULL; spec->buildSubdir = NULL; spec->passPhrase = NULL; spec->timeCheck = 0; spec->cookie = NULL; spec->BANames = NULL; spec->BACount = 0; spec->recursing = 0; spec->toplevel = 1; spec->BASpecs = NULL; spec->force = 0; spec->anyarch = 0; /*@i@*/ spec->macros = rpmGlobalMacroContext; spec->_parseRCPOT = parseRCPOT; /* XXX hack around backward linkage. */ return (Spec)rpmioLinkPoolItem((rpmioItem)spec, __FUNCTION__, __FILE__, __LINE__); }