From: Paul Park Date: Wed, 31 May 1995 15:22:15 +0000 (+0000) Subject: Use kdb5_db_destroy instead of explicitly unlinking files X-Git-Tag: krb5-1.0-beta6~1877 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=a22d456dda905e13b78f5c96b5c99a0b00f0b775;p=krb5.git Use kdb5_db_destroy instead of explicitly unlinking files git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@5925 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/admin/destroy/ChangeLog b/src/admin/destroy/ChangeLog index 4338bf6af..7812b968b 100644 --- a/src/admin/destroy/ChangeLog +++ b/src/admin/destroy/ChangeLog @@ -1,9 +1,7 @@ -Fri May 26 17:48:41 EDT 1995 Paul Park (pjpark@mit.edu) - * kdb5_destroy.c - Conditionalize implicit knowledge of filename - suffix under BERK_DB_DBM. If this is set, then use ".db" - otherwise, use ".dir" and ".pag". - * Makefile.in - Set BERK_DB_DBM when compiling. +Tue May 30 14:41:50 EDT 1995 Paul Park (pjpark@mit.edu) + * kdb5_destroy.c: Remove knowledge of database files. Use kdb5_db_ + destroy to destroy the database. Thu Mar 2 12:18:36 1995 Theodore Y. Ts'o diff --git a/src/admin/destroy/Makefile.in b/src/admin/destroy/Makefile.in index 4beae3d32..01303acab 100644 --- a/src/admin/destroy/Makefile.in +++ b/src/admin/destroy/Makefile.in @@ -1,4 +1,4 @@ -CFLAGS = $(CCOPTS) $(DEFS) $(LOCALINCLUDE) -DBERK_DB_DBM +CFLAGS = $(CCOPTS) $(DEFS) $(LOCALINCLUDE) LDFLAGS = -g COMERRLIB=$(BUILDTOP)/util/et/libcom_err.a diff --git a/src/admin/destroy/kdb5_destroy.c b/src/admin/destroy/kdb5_destroy.c index 964aa4d4a..bdb5076fc 100644 --- a/src/admin/destroy/kdb5_destroy.c +++ b/src/admin/destroy/kdb5_destroy.c @@ -87,49 +87,16 @@ main(argc, argv) exit(1); printf("OK, deleting database '%s'...\n", dbname); } -#ifndef BERK_DB_DBM - (void) strcpy(dbfilename, dbname); - (void) strcat(dbfilename, ".dir"); - if (unlink(dbfilename) == -1) { - retval = errno; - com_err(argv[0], retval, "deleting database file '%s'",dbfilename); - if (retval == ENOENT) - fprintf(stderr, - "Database appears to not exist--inspect files manually!\n"); - else - fprintf(stderr, - "Database may be partially deleted--inspect files manually!\n"); - exit(1); - } - (void) strcpy(dbfilename, dbname); - (void) strcat(dbfilename, ".pag"); - if (unlink(dbfilename) == -1) { - retval = errno; - com_err(argv[0], retval, "deleting database file '%s'",dbfilename); - fprintf(stderr, - "Database may be partially deleted--inspect files manually!\n"); - exit(1); - } -#else /* BERK_DB_DBM */ - (void) strcpy(dbfilename, dbname); - (void) strcat(dbfilename, ".db"); - if (unlink(dbfilename) == -1) { - retval = errno; - com_err(argv[0], retval, "deleting database file '%s'",dbfilename); - fprintf(stderr, - "Database may be partially deleted--inspect files manually!\n"); + + if (retval = krb5_db_set_name(context, dbname)) { + com_err(argv[0], retval, "'%s'",dbname); exit(1); } -#endif /* BERK_DB_DBM */ - (void) strcpy(dbfilename, dbname); - (void) strcat(dbfilename, ".ok"); - if (unlink(dbfilename) == -1) { - retval = errno; - com_err(argv[0], retval, "deleting database file '%s'",dbfilename); - fprintf(stderr, - "Database partially deleted--inspect files manually!\n"); + if (retval = kdb5_db_destroy(context, dbname)) { + com_err(argv[0], retval, "deleting database '%s'",dbname); exit(1); } + printf("** Database '%s' destroyed.\n", dbname); exit(0); }