chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
man: document sd_journal_get_cursor()
[elogind.git]
/
src
/
cryptsetup
/
cryptsetup.c
diff --git
a/src/cryptsetup/cryptsetup.c
b/src/cryptsetup/cryptsetup.c
index 3ff0ddf2cc8b2285e554e3fc264716e2ef369327..f570724b9d8c0105d26c12715e0a3521c42b55b4 100644
(file)
--- a/
src/cryptsetup/cryptsetup.c
+++ b/
src/cryptsetup/cryptsetup.c
@@
-29,6
+29,7
@@
#include "log.h"
#include "util.h"
#include "log.h"
#include "util.h"
+#include "path-util.h"
#include "strv.h"
#include "ask-password-api.h"
#include "def.h"
#include "strv.h"
#include "ask-password-api.h"
#include "def.h"
@@
-36,10
+37,12
@@
static const char *opt_type = NULL; /* LUKS1 or PLAIN */
static char *opt_cipher = NULL;
static unsigned opt_key_size = 0;
static const char *opt_type = NULL; /* LUKS1 or PLAIN */
static char *opt_cipher = NULL;
static unsigned opt_key_size = 0;
+static unsigned opt_keyfile_offset = 0;
static char *opt_hash = NULL;
static unsigned opt_tries = 0;
static bool opt_readonly = false;
static bool opt_verify = false;
static char *opt_hash = NULL;
static unsigned opt_tries = 0;
static bool opt_readonly = false;
static bool opt_verify = false;
+static bool opt_discards = false;
static usec_t opt_timeout = DEFAULT_TIMEOUT_USEC;
/* Options Debian's crypttab knows we don't:
static usec_t opt_timeout = DEFAULT_TIMEOUT_USEC;
/* Options Debian's crypttab knows we don't:
@@
-77,6
+80,13
@@
static int parse_one_option(const char *option) {
return 0;
}
return 0;
}
+ } else if (startswith(option, "keyfile-offset=")) {
+
+ if (safe_atou(option+15, &opt_keyfile_offset) < 0) {
+ log_error("keyfile-offset= parse failure, ignoring.");
+ return 0;
+ }
+
} else if (startswith(option, "hash=")) {
char *t;
} else if (startswith(option, "hash=")) {
char *t;
@@
-97,6
+107,8
@@
static int parse_one_option(const char *option) {
opt_readonly = true;
else if (streq(option, "verify"))
opt_verify = true;
opt_readonly = true;
else if (streq(option, "verify"))
opt_verify = true;
+ else if (streq(option, "allow-discards"))
+ opt_discards = true;
else if (streq(option, "luks"))
opt_type = CRYPT_LUKS1;
else if (streq(option, "plain") ||
else if (streq(option, "luks"))
opt_type = CRYPT_LUKS1;
else if (streq(option, "plain") ||
@@
-313,6
+325,9
@@
int main(int argc, char *argv[]) {
if (opt_readonly)
flags |= CRYPT_ACTIVATE_READONLY;
if (opt_readonly)
flags |= CRYPT_ACTIVATE_READONLY;
+ if (opt_discards)
+ flags |= CRYPT_ACTIVATE_ALLOW_DISCARDS;
+
if (opt_timeout > 0)
until = now(CLOCK_MONOTONIC) + opt_timeout;
else
if (opt_timeout > 0)
until = now(CLOCK_MONOTONIC) + opt_timeout;
else
@@
-455,7
+470,8
@@
int main(int argc, char *argv[]) {
argv[3]);
if (key_file)
argv[3]);
if (key_file)
- k = crypt_activate_by_keyfile(cd, argv[2], CRYPT_ANY_SLOT, key_file, keyfile_size, flags);
+ k = crypt_activate_by_keyfile_offset(cd, argv[2], CRYPT_ANY_SLOT, key_file, keyfile_size,
+ opt_keyfile_offset, flags);
else {
char **p;
else {
char **p;