BSD 4_3_Reno development
authorCSRG <csrg@ucbvax.Berkeley.EDU>
Mon, 25 Jun 1990 07:03:14 +0000 (23:03 -0800)
committerCSRG <csrg@ucbvax.Berkeley.EDU>
Mon, 25 Jun 1990 07:03:14 +0000 (23:03 -0800)
Work on file usr/src/kerberosIV/kdb_destroy/kdb_destroy.c

Synthesized-from: CSRG/cd2/4.3reno

usr/src/kerberosIV/kdb_destroy/kdb_destroy.c [new file with mode: 0644]

diff --git a/usr/src/kerberosIV/kdb_destroy/kdb_destroy.c b/usr/src/kerberosIV/kdb_destroy/kdb_destroy.c
new file mode 100644 (file)
index 0000000..dc600a6
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * $Source: /usr/src/kerberosIV/kdb_destroy/RCS/kdb_destroy.c,v $
+ * $Author: kfall $
+ *
+ * Copyright 1988 by the Massachusetts Institute of Technology.
+ *
+ * For copying and distribution information, please see the file
+ * <mit-copyright.h>.
+ *
+ * Description.
+ */
+
+#ifndef        lint
+static char rcsid_kdb_destroy_c[] =
+"$Header: /usr/src/kerberosIV/kdb_destroy/RCS/kdb_destroy.c,v 4.1 90/06/25 21:03:10 kfall Exp $";
+#endif lint
+
+#include <mit-copyright.h>
+#include <strings.h>
+#include <stdio.h>
+#include "des.h"
+#include "krb.h"
+#include "krb_db.h"
+
+main()
+{
+    char    answer[10];                /* user input */
+    char    dbm[256];          /* database path and name */
+    char    dbm1[256];         /* database path and name */
+    char   *file1, *file2;     /* database file names */
+
+    strcpy(dbm, DBM_FILE);
+    strcpy(dbm1, DBM_FILE);
+    file1 = strcat(dbm, ".dir");
+    file2 = strcat(dbm1, ".pag");
+
+    printf("You are about to destroy the Kerberos database ");
+    printf("on this machine.\n");
+    printf("Are you sure you want to do this (y/n)? ");
+    fgets(answer, sizeof(answer), stdin);
+
+    if (answer[0] == 'y' || answer[0] == 'Y') {
+       if (unlink(file1) == 0 && unlink(file2) == 0)
+           fprintf(stderr, "Database deleted at %s\n", DBM_FILE);
+       else
+           fprintf(stderr, "Database cannot be deleted at %s\n",
+                   DBM_FILE);
+    } else
+       fprintf(stderr, "Database not deleted.\n");
+}