Commit | Line | Data |
---|---|---|
ee37813c C |
1 | /* |
2 | * $Source: /usr/src/kerberosIV/kdb_destroy/RCS/kdb_destroy.c,v $ | |
3 | * $Author: kfall $ | |
4 | * | |
5 | * Copyright 1988 by the Massachusetts Institute of Technology. | |
6 | * | |
7 | * For copying and distribution information, please see the file | |
8 | * <mit-copyright.h>. | |
9 | * | |
10 | * Description. | |
11 | */ | |
12 | ||
13 | #ifndef lint | |
14 | static char rcsid_kdb_destroy_c[] = | |
15 | "$Header: /usr/src/kerberosIV/kdb_destroy/RCS/kdb_destroy.c,v 4.1 90/06/25 21:03:10 kfall Exp $"; | |
16 | #endif lint | |
17 | ||
18 | #include <mit-copyright.h> | |
19 | #include <strings.h> | |
20 | #include <stdio.h> | |
21 | #include "des.h" | |
22 | #include "krb.h" | |
23 | #include "krb_db.h" | |
24 | ||
25 | main() | |
26 | { | |
27 | char answer[10]; /* user input */ | |
28 | char dbm[256]; /* database path and name */ | |
29 | char dbm1[256]; /* database path and name */ | |
30 | char *file1, *file2; /* database file names */ | |
31 | ||
32 | strcpy(dbm, DBM_FILE); | |
33 | strcpy(dbm1, DBM_FILE); | |
34 | file1 = strcat(dbm, ".dir"); | |
35 | file2 = strcat(dbm1, ".pag"); | |
36 | ||
37 | printf("You are about to destroy the Kerberos database "); | |
38 | printf("on this machine.\n"); | |
39 | printf("Are you sure you want to do this (y/n)? "); | |
40 | fgets(answer, sizeof(answer), stdin); | |
41 | ||
42 | if (answer[0] == 'y' || answer[0] == 'Y') { | |
43 | if (unlink(file1) == 0 && unlink(file2) == 0) | |
44 | fprintf(stderr, "Database deleted at %s\n", DBM_FILE); | |
45 | else | |
46 | fprintf(stderr, "Database cannot be deleted at %s\n", | |
47 | DBM_FILE); | |
48 | } else | |
49 | fprintf(stderr, "Database not deleted.\n"); | |
50 | } |