RPM Package Manager, CVS Repository http://rpm5.org/cvs/ ____________________________________________________________________________
Server: rpm5.org Name: Jeff Johnson Root: /v/rpm/cvs Email: [email protected] Module: rpm Date: 20-Dec-2008 23:56:34 Branch: HEAD Handle: 2008122022563301 Modified files: rpm CHANGES rpm/lib poptALL.c rpm/rpmio macro.c poptIO.c rpmlua.c Log: - use poptSaneFile() when available (popt-1.15). - use poptReadConfigFiles() when available (popt-1.15). Summary: Revision Changes Path 1.2696 +2 -0 rpm/CHANGES 2.103 +17 -6 rpm/lib/poptALL.c 2.210 +8 -1 rpm/rpmio/macro.c 1.29 +19 -8 rpm/rpmio/poptIO.c 2.62 +7 -1 rpm/rpmio/rpmlua.c ____________________________________________________________________________ patch -p0 <<'@@ .' Index: rpm/CHANGES ============================================================================ $ cvs diff -u -r1.2695 -r1.2696 CHANGES --- rpm/CHANGES 20 Dec 2008 06:40:57 -0000 1.2695 +++ rpm/CHANGES 20 Dec 2008 22:56:33 -0000 1.2696 @@ -1,5 +1,7 @@ 5.2a2 -> 5.2a3: + - jbj: use poptSaneFile() when available (popt-1.15). + - jbj: use poptReadConfigFiles() when available (popt-1.15). - provyind: python: build with -fno-strict-aliasing. - proyvind: tevr: fix build issues. - proyvind: add RPMTAG_DISTTAG to optionalTags so that it may be used as @@ . patch -p0 <<'@@ .' Index: rpm/lib/poptALL.c ============================================================================ $ cvs diff -u -r2.102 -r2.103 poptALL.c --- rpm/lib/poptALL.c 13 Dec 2008 20:37:56 -0000 2.102 +++ rpm/lib/poptALL.c 20 Dec 2008 22:56:34 -0000 2.103 @@ -525,7 +525,6 @@ /*...@modifies rpmpoptfiles @*/ { poptContext optCon; - char *path_buf, *path, *path_next; int rc; int xx; int i; @@ -576,10 +575,6 @@ return NULL; } -/*...@-nullpass -temptr...@*/ - optCon = poptGetContext(__progname, argc, (const char **)argv, optionsTable, 0); -/*...@=nullpass =temptr...@*/ - /* read all RPM POPT configuration files */ for (i = 1; i < argc; i++) { if (strcmp(argv[i], "--rpmpopt") == 0 && i+1 < argc) { @@ -591,7 +586,16 @@ break; } } - path_buf = xstrdup(rpmpoptfiles); + +/*...@-nullpass -temptr...@*/ + optCon = poptGetContext(__progname, argc, (const char **)argv, optionsTable, 0); +/*...@=nullpass =temptr...@*/ + +#if !defined(POPT_ERROR_BADCONFIG) /* XXX popt-1.15- retrofit */ + { char * path_buf = xstrdup(rpmpoptfiles); + char *path; + char *path_next; + for (path = path_buf; path != NULL && *path != '\0'; path = path_next) { const char **av; int ac; @@ -625,6 +629,12 @@ av = _free(av); } path_buf = _free(path_buf); + } +#else + /* XXX FIXME: better error message is needed. */ + if ((xx = poptReadConfigFiles(optCon, rpmpoptfiles)) != 0) + rpmlog(RPMLOG_WARNING, "existing POPT configuration file \"%s\" considered INSECURE -- not loaded\n", rpmpoptfiles); +#endif #if defined(RPM_VENDOR_WINDRIVER) { const char * poptAliasFn = rpmGetPath(__usrlibrpm, "/rpmpopt", NULL); @@ -634,6 +644,7 @@ #endif /* read standard POPT configuration files */ + /* XXX FIXME: the 2nd arg useEnv flag is UNUSED. */ (void) poptReadDefaultConfig(optCon, 1); #if defined(RPM_VENDOR_WINDRIVER) @@ . patch -p0 <<'@@ .' Index: rpm/rpmio/macro.c ============================================================================ $ cvs diff -u -r2.209 -r2.210 macro.c --- rpm/rpmio/macro.c 15 Dec 2008 22:43:44 -0000 2.209 +++ rpm/rpmio/macro.c 20 Dec 2008 22:56:34 -0000 2.210 @@ -1853,6 +1853,7 @@ return rc; } +#if !defined(POPT_ERROR_BADCONFIG) /* XXX popt-1.15- retrofit */ int rpmSecuritySaneFile(const char *filename) { struct stat sb; @@ -1869,6 +1870,7 @@ return 0; return 1; } +#endif #if !defined(DEBUG_MACROS) /* =============================================================== */ @@ -2370,7 +2372,12 @@ if (fn[0] == '@' /* attention */) { fn++; - if (!rpmSecuritySaneFile(fn)) { +#if !defined(POPT_ERROR_BADCONFIG) /* XXX popt-1.15- retrofit */ + if (!rpmSecuritySaneFile(fn)) +#else + if (!poptSaneFile(fn)) +#endif + { rpmlog(RPMLOG_WARNING, "existing RPM macros file \"%s\" considered INSECURE -- not loaded\n", fn); /*...@innercontinue@*/ continue; } @@ . patch -p0 <<'@@ .' Index: rpm/rpmio/poptIO.c ============================================================================ $ cvs diff -u -r1.28 -r1.29 poptIO.c --- rpm/rpmio/poptIO.c 11 Dec 2008 21:55:14 -0000 1.28 +++ rpm/rpmio/poptIO.c 20 Dec 2008 22:56:34 -0000 1.29 @@ -447,9 +447,6 @@ rpmioInit(int argc, char *const argv[], struct poptOption * optionsTable) { poptContext optCon; -#ifdef NOTYET - char *path_buf, *path, *path_next; -#endif int rc; #ifdef NOTYET int i; @@ -497,10 +494,6 @@ return NULL; } -/*...@-nullpass -temptr...@*/ - optCon = poptGetContext(__progname, argc, (const char **)argv, optionsTable, 0); -/*...@=nullpass =temptr...@*/ - #ifdef NOTYET /* read all RPM POPT configuration files */ for (i = 1; i < argc; i++) { @@ -513,7 +506,18 @@ break; } } - path_buf = xstrdup(rpmpoptfiles); +#endif /* NOTYET */ + +/*...@-nullpass -temptr...@*/ + optCon = poptGetContext(__progname, argc, (const char **)argv, optionsTable, 0); +/*...@=nullpass =temptr...@*/ + +#ifdef NOTYET +#if !defined(POPT_ERROR_BADCONFIG) /* XXX popt-1.15- retrofit */ + { char * path_buf = xstrdup(rpmpoptfiles); + char *path; + char *path_next; + for (path = path_buf; path != NULL && *path != '\0'; path = path_next) { const char **av; int ac, i; @@ -549,8 +553,15 @@ av = _free(av); } path_buf = _free(path_buf); + } +#else + /* XXX FIXME: better error message is needed. */ + if ((xx = poptReadConfigFiles(optCon, rpmpoptfiles)) != 0) + rpmlog(RPMLOG_WARNING, "existing POPT configuration file \"%s\" considered INSECURE -- not loaded\n", rpmpoptfiles); +#endif /* read standard POPT configuration files */ + /* XXX FIXME: the 2nd arg useEnv flag is UNUSED. */ (void) poptReadDefaultConfig(optCon, 1); poptSetExecPath(optCon, USRLIBRPM, 1); @@ . patch -p0 <<'@@ .' Index: rpm/rpmio/rpmlua.c ============================================================================ $ cvs diff -u -r2.61 -r2.62 rpmlua.c --- rpm/rpmio/rpmlua.c 11 Dec 2008 21:55:14 -0000 2.61 +++ rpm/rpmio/rpmlua.c 20 Dec 2008 22:56:34 -0000 2.62 @@ -11,6 +11,7 @@ #include <rpmhook.h> #include <rpmcb.h> #include <argv.h> +#include <popt.h> /* XXX poptSaneFile test */ #include <lua.h> #include <lualib.h> @@ -165,7 +166,12 @@ const char *fn = av[i]; if (fn[0] == '@' /* attention */) { fn++; - if (!rpmSecuritySaneFile(fn)) { +#if !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; } @@ . ______________________________________________________________________ RPM Package Manager http://rpm5.org CVS Sources Repository [email protected]
