Incorporate into kadmin.

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@4033 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Johan Danielsson
1997-11-16 11:00:53 +00:00
parent a66ce0dd11
commit fc3c776c5b
2 changed files with 30 additions and 2 deletions

View File

@@ -36,7 +36,8 @@
* SUCH DAMAGE.
*/
#include "admin_locl.h"
#include "kadmin_locl.h"
#include <kadm5/private.h>
RCSID("$Id$");
@@ -73,6 +74,29 @@ append_hex(char *str, krb5_data *data)
free(p);
}
char *
time2str(time_t t)
{
static char buf[128];
strftime(buf, sizeof(buf), "%Y%m%d%H%M%S", gmtime(&t));
return buf;
}
void
event2string(Event *ev, char **str)
{
char *p;
char *pr;
if(ev == NULL){
*str = strdup("-");
return;
}
krb5_unparse_name(context, ev->principal, &pr);
asprintf(&p, "%s:%s", time2str(ev->time), pr);
free(pr);
*str = p;
}
static int
hdb_entry2string(hdb_entry *ent, char **str)
{
@@ -172,6 +196,8 @@ dump(int argc, char **argv)
krb5_error_code ret;
FILE *f;
HDB *db = _kadm5_s_get_db(kadm_handle);
if(argc < 2)
f = stdout;
else

View File

@@ -36,7 +36,8 @@
* SUCH DAMAGE.
*/
#include "admin_locl.h"
#include "kadmin_locl.h"
#include <kadm5/private.h>
RCSID("$Id$");
@@ -192,6 +193,7 @@ doit(char *filename, int merge)
int flags = O_RDWR;
struct entry e;
hdb_entry ent;
HDB *db = _kadm5_s_get_db(kadm_handle);
f = fopen(filename, "r");
if(f == NULL){