From 1012c20b6d89d278e79f3040294135bc017b0506 Mon Sep 17 00:00:00 2001 From: Ben Kibbey Date: Sun, 19 Apr 2009 11:20:29 -0400 Subject: [PATCH] Changed the file header again. Added doc/magic for use with file(1). --- doc/Makefile.am | 2 +- doc/magic | 8 ++++++++ src/commands.c | 5 +++++ src/common.h | 5 +++-- 4 files changed, 17 insertions(+), 3 deletions(-) create mode 100644 doc/magic diff --git a/doc/Makefile.am b/doc/Makefile.am index 6c05d826..cab5d513 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -1,2 +1,2 @@ -EXTRA_DIST = config.example COMMANDS +EXTRA_DIST = config.example COMMANDS magic dist_man1_MANS = pwmd.1 diff --git a/doc/magic b/doc/magic new file mode 100644 index 00000000..9a37d9e9 --- /dev/null +++ b/doc/magic @@ -0,0 +1,8 @@ +# This is file(1) magic for pwmd. +0 string \177PWMD Password Manager Daemon data file +>0x6 short <0x30 , version 2 +>0x8 quad >0 , encrypted (%llu iterations) +>0x8 quad =0 , not encrypted + +# Flags (none at this time) +>0x10 quad =0 diff --git a/src/commands.c b/src/commands.c index abc9eafc..1e818711 100644 --- a/src/commands.c +++ b/src/commands.c @@ -1013,6 +1013,11 @@ write_file: crypto->fh->fd = STDOUT_FILENO; do_write_file: + crypto->fh->fh2.magic[0] = '\177'; + crypto->fh->fh2.magic[1] = 'P'; + crypto->fh->fh2.magic[2] = 'W'; + crypto->fh->fh2.magic[3] = 'M'; + crypto->fh->fh2.magic[4] = 'D'; crypto->fh->fh2.version = VERSION_HEX; len = pth_write(crypto->fh->fd, &crypto->fh->fh2, sizeof(crypto->fh->fh2)); pth_cancel_point(); diff --git a/src/common.h b/src/common.h index 22a70a92..483d432a 100644 --- a/src/common.h +++ b/src/common.h @@ -112,10 +112,11 @@ struct pinentry_s { #endif typedef struct { - guint64 iter; - guint8 iv[16]; /* FIXME: is this portable? */ + guint8 magic[5]; guint16 version; + guint64 iter; guint64 flags; + guint8 iv[16]; /* FIXME: is this portable? */ } file_header_t; typedef struct { -- 2.11.4.GIT