diff options
author | Werner Koch <[email protected]> | 2015-10-21 06:38:10 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2015-11-30 11:32:10 +0000 |
commit | 286a89da7c39333e0883c2050cf798905d48c4f5 (patch) | |
tree | a5979c428067adb0c4deebfd5cb6ec6dce12efa1 /g13/backend.c | |
parent | doc: Typo fix. (diff) | |
download | gnupg-wk/g13work.tar.gz gnupg-wk/g13work.zip |
g13: First chunk of code to support dm-crypt.wk/g13work
* g13/call-syshelp.c, g13/call-syshelp.h: New.
* g13/g13-syshelp.c, g13/g13-syshelp.h: New.
* g13/sh-cmd.c: New.
* g13/sh-blockdev.c: New.
* g13/sh-exectool.c: New.
* g13/sh-dmcrypt.c: New.
* g13/Makefile.am (sbin_PROGRAMS): Add g13-syshelp.c
(g13_syshelp_SOURCES): New.
(g13_syshelp_LDADD): New.
* g13/g13.c (opts): Add option --type.
(g13_deinit_default_ctrl): New.
(main): Implement that option. Call g13_deinit_default_ctrl.
* g13/g13.h (struct call_syshelp_s): New declaration.
(server_control_s): Add field syshelp_local.
* g13/keyblob.h (KEYBLOB_TAG_CREATED): New.
(KEYBLOB_TAG_ALGOSTR): New.
(KEYBLOB_TAG_HDRCOPY): New.
* g13/backend.c (be_parse_conttype_name): New.
(be_get_detached_name): Add CONTTYPE_DM_CRYPT.
Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'g13/backend.c')
-rw-r--r-- | g13/backend.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/g13/backend.c b/g13/backend.c index 7b08cd52a..52e1e0a34 100644 --- a/g13/backend.c +++ b/g13/backend.c @@ -41,6 +41,38 @@ no_such_backend (int conttype) } +/* Parse NAME and return the corresponding content type. If the name + is not known, a error message is printed and zero returned. If + NAME is NULL the supported backend types are listed and 0 is + returned. */ +int +be_parse_conttype_name (const char *name) +{ + static struct { const char *name; int conttype; } names[] = { + { "encfs", CONTTYPE_ENCFS }, + { "dm-crypt", CONTTYPE_DM_CRYPT } + }; + int i; + + if (!name) + { + log_info ("Known backend types:\n"); + for (i=0; i < DIM (names); i++) + log_info (" %s\n", names[i].name); + return 0; + } + + for (i=0; i < DIM (names); i++) + { + if (!strcmp (names[i].name, name)) + return names[i].conttype; + } + + log_error ("invalid backend type '%s' given\n", name); + return 0; +} + + /* Return true if CONTTYPE is supported by us. */ int be_is_supported_conttype (int conttype) @@ -75,6 +107,9 @@ be_get_detached_name (int conttype, const char *fname, case CONTTYPE_ENCFS: return be_encfs_get_detached_name (fname, r_name, r_isdir); + case CONTTYPE_DM_CRYPT: + return 0; + default: return no_such_backend (conttype); } |