Skip to content

Commit

Permalink
Remove BDB RPC "support"
Browse files Browse the repository at this point in the history
- it's insecure, used by nobody (its been rather broken for a long
  time) and all, but BDB 4.8.x removed RPC support from upstream so we
  cant very well support in the future even if we wanted to
  • Loading branch information
pmatilai committed Sep 21, 2009
1 parent 510c676 commit baa1cf0
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 74 deletions.
2 changes: 1 addition & 1 deletion db3/configure
Expand Up @@ -11,7 +11,7 @@ rm -f config.cache
ARGS="`echo $* | sed -e 's% [^ ]*CFLAGS=[^ ]*%%' -e 's% -[^-][^ ]*%%g' -e 's% --param=[^ ]*%%g' -e 's%--cache-file=.*$%%'`"

CC="$CC" CFLAGS="$CFLAGS" $db_dist/configure $ARGS \
--enable-shared --enable-static --enable-rpc \
--enable-shared --enable-static \
--with-uniquename=_rpmdb --srcdir=$db_dist

mv Makefile Makefile.orig
Expand Down
69 changes: 20 additions & 49 deletions lib/backend/db3.c
Expand Up @@ -19,10 +19,6 @@ static int _debug = 1; /* XXX if < 0 debugging, > 0 unusual error returns */

#include "debug.h"

#if !defined(DB_CLIENT) /* XXX db-4.2.42 retrofit */
#define DB_CLIENT DB_RPCCLIENT
#endif

static int cvtdberr(dbiIndex dbi, const char * msg, int error, int printit)
{
if (printit && error) {
Expand Down Expand Up @@ -97,7 +93,7 @@ static int db_init(dbiIndex dbi, const char * dbhome, DB_ENV ** dbenvp)
rpmdb rpmdb = dbi->dbi_rpmdb;
DB_ENV *dbenv = NULL;
int eflags;
int rc;
int rc, xx;

if (dbenvp == NULL)
return 1;
Expand All @@ -114,10 +110,6 @@ static int db_init(dbiIndex dbi, const char * dbhome, DB_ENV ** dbenvp)
free(fstr);
}

/* XXX Can't do RPC w/o host. */
if (dbi->dbi_host == NULL)
dbi->dbi_ecflags &= ~DB_CLIENT;

/* XXX Set a default shm_key. */
if ((dbi->dbi_eflags & DB_SYSTEM_MEM) && dbi->dbi_shmkey == 0) {
#if defined(HAVE_FTOK)
Expand All @@ -132,8 +124,6 @@ static int db_init(dbiIndex dbi, const char * dbhome, DB_ENV ** dbenvp)
if (dbenv == NULL || rc)
goto errxit;

{ int xx;

dbenv->set_alloc(dbenv,rpmdb->db_malloc, rpmdb->db_realloc, rpmdb->db_free);
dbenv->set_errcall(dbenv, (void *) rpmdb->db_errcall);
dbenv->set_errfile(dbenv, rpmdb->db_errfile);
Expand All @@ -148,44 +138,27 @@ static int db_init(dbiIndex dbi, const char * dbhome, DB_ENV ** dbenvp)
dbenv->set_isalive(dbenv, db3isalive);
#endif

if ((dbi->dbi_ecflags & DB_CLIENT) && dbi->dbi_host) {
const char * home;
int retry = 0;

if ((home = strrchr(dbhome, '/')) != NULL)
dbhome = ++home;

while (retry++ < 5) {
xx = dbenv->set_rpc_server(dbenv, NULL, dbi->dbi_host,
dbi->dbi_cl_timeout, dbi->dbi_sv_timeout, 0);
xx = cvtdberr(dbi, "dbenv->set_server", xx, _debug);
if (!xx)
break;
(void) sleep(15);
}
} else {
#if !(DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 3)
xx = dbenv->set_verbose(dbenv, DB_VERB_CHKPOINT,
(dbi->dbi_verbose & DB_VERB_CHKPOINT));
dbenv->set_verbose(dbenv, DB_VERB_CHKPOINT,
(dbi->dbi_verbose & DB_VERB_CHKPOINT));
#endif
xx = dbenv->set_verbose(dbenv, DB_VERB_DEADLOCK,
(dbi->dbi_verbose & DB_VERB_DEADLOCK));
xx = dbenv->set_verbose(dbenv, DB_VERB_RECOVERY,
(dbi->dbi_verbose & DB_VERB_RECOVERY));
xx = dbenv->set_verbose(dbenv, DB_VERB_WAITSFOR,
(dbi->dbi_verbose & DB_VERB_WAITSFOR));

if (dbi->dbi_mmapsize) {
xx = dbenv->set_mp_mmapsize(dbenv, dbi->dbi_mmapsize);
xx = cvtdberr(dbi, "dbenv->set_mp_mmapsize", xx, _debug);
}
if (dbi->dbi_tmpdir) {
const char * root = rpmdb->db_chrootDone ? NULL : rpmdb->db_root;
char * tmpdir = rpmGenPath(root, dbi->dbi_tmpdir, NULL);
xx = dbenv->set_tmp_dir(dbenv, tmpdir);
xx = cvtdberr(dbi, "dbenv->set_tmp_dir", xx, _debug);
tmpdir = _free(tmpdir);
}
dbenv->set_verbose(dbenv, DB_VERB_DEADLOCK,
(dbi->dbi_verbose & DB_VERB_DEADLOCK));
dbenv->set_verbose(dbenv, DB_VERB_RECOVERY,
(dbi->dbi_verbose & DB_VERB_RECOVERY));
dbenv->set_verbose(dbenv, DB_VERB_WAITSFOR,
(dbi->dbi_verbose & DB_VERB_WAITSFOR));

if (dbi->dbi_mmapsize) {
xx = dbenv->set_mp_mmapsize(dbenv, dbi->dbi_mmapsize);
xx = cvtdberr(dbi, "dbenv->set_mp_mmapsize", xx, _debug);
}
if (dbi->dbi_tmpdir) {
const char * root = rpmdb->db_chrootDone ? NULL : rpmdb->db_root;
char * tmpdir = rpmGenPath(root, dbi->dbi_tmpdir, NULL);
xx = dbenv->set_tmp_dir(dbenv, tmpdir);
xx = cvtdberr(dbi, "dbenv->set_tmp_dir", xx, _debug);
tmpdir = _free(tmpdir);
}

if (dbi->dbi_cachesize) {
Expand All @@ -202,7 +175,6 @@ static int db_init(dbiIndex dbi, const char * dbhome, DB_ENV ** dbenvp)
xx = dbenv->set_shm_key(dbenv, dbi->dbi_shmkey);
xx = cvtdberr(dbi, "dbenv->set_shm_key", xx, _debug);
}
}

rc = (dbenv->open)(dbenv, dbhome, eflags, dbi->dbi_perms);
rc = cvtdberr(dbi, "dbenv->open", rc, _debug);
Expand Down Expand Up @@ -839,7 +811,6 @@ static int db3open(rpmdb rpmdb, rpmTag rpmtag, dbiIndex * dbip)
* glibc/kernel combinations.
*/
if (rc == 0 && dbi->dbi_lockdbfd &&
!((dbi->dbi_ecflags & DB_CLIENT) && dbi->dbi_host) &&
(!dbi->dbi_use_dbenv || _lockdbfd++ == 0))
{
int fdno = -1;
Expand Down
20 changes: 0 additions & 20 deletions lib/backend/dbconfig.c
Expand Up @@ -29,16 +29,6 @@ static int dbi_tear_down;
*/
struct poptOption rdbOptions[] = {
/* XXX DB_CXX_NO_EXCEPTIONS */
#if defined(DB_CLIENT)
{ "client", 0,POPT_BIT_SET, &db3dbi.dbi_ecflags, DB_CLIENT,
NULL, NULL },
#endif
#if defined(DB_RPCCLIENT)
{ "client", 0,POPT_BIT_SET, &db3dbi.dbi_ecflags, DB_RPCCLIENT,
NULL, NULL },
{ "rpcclient", 0,POPT_BIT_SET, &db3dbi.dbi_ecflags, DB_RPCCLIENT,
NULL, NULL },
#endif

{ "create", 0,POPT_BIT_SET, &db3dbi.dbi_oeflags, DB_CREATE,
NULL, NULL },
Expand Down Expand Up @@ -116,15 +106,6 @@ struct poptOption rdbOptions[] = {
{ "tmpdir", 0,POPT_ARG_STRING, &db3dbi.dbi_tmpdir, 0,
NULL, NULL },

{ "host", 0,POPT_ARG_STRING, &db3dbi.dbi_host, 0,
NULL, NULL },
{ "server", 0,POPT_ARG_STRING, &db3dbi.dbi_host, 0,
NULL, NULL },
{ "cl_timeout", 0,POPT_ARG_LONG, &db3dbi.dbi_cl_timeout, 0,
NULL, NULL },
{ "sv_timeout", 0,POPT_ARG_LONG, &db3dbi.dbi_sv_timeout, 0,
NULL, NULL },

{ "verify", 0,POPT_ARG_NONE, &db3dbi.dbi_verify_on_close, 0,
NULL, NULL },
{ "teardown", 0,POPT_ARG_NONE, &dbi_tear_down, 0,
Expand Down Expand Up @@ -244,7 +225,6 @@ dbiIndex db3Free(dbiIndex dbi)
dbi->dbi_file = _free(dbi->dbi_file);
dbi->dbi_subfile = _free(dbi->dbi_subfile);
dbi->dbi_tmpdir = _free(dbi->dbi_tmpdir);
dbi->dbi_host = _free(dbi->dbi_host);
dbi->dbi_errpfx = _free(dbi->dbi_errpfx);
dbi->dbi_re_source = _free(dbi->dbi_re_source);
dbi->dbi_stats = _free(dbi->dbi_stats);
Expand Down
4 changes: 0 additions & 4 deletions lib/rpmdb_internal.h
Expand Up @@ -188,10 +188,6 @@ struct _dbiIndex {
int dbi_debug;
int dbi_byteswapped;

char * dbi_host;
unsigned long dbi_cl_timeout;
unsigned long dbi_sv_timeout;

/* dbenv parameters */
int dbi_lorder;
/* XXX db-4.3.14 adds dbenv as 1st arg. */
Expand Down

0 comments on commit baa1cf0

Please sign in to comment.