Merge pull request #17154 from keszybz/crypttab-commas
Allow escaping commas in crypttab
This commit is contained in:
@@ -622,7 +622,6 @@ static int parse_proc_cmdline_item(const char *key, const char *value, void *dat
|
||||
static int add_crypttab_devices(void) {
|
||||
_cleanup_fclose_ FILE *f = NULL;
|
||||
unsigned crypttab_line = 0;
|
||||
struct stat st;
|
||||
int r;
|
||||
|
||||
if (!arg_read_crypttab)
|
||||
@@ -635,11 +634,6 @@ static int add_crypttab_devices(void) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (fstat(fileno(f), &st) < 0) {
|
||||
log_error_errno(errno, "Failed to stat %s: %m", arg_crypttab);
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
_cleanup_free_ char *line = NULL, *name = NULL, *device = NULL, *keyspec = NULL, *options = NULL, *keyfile = NULL, *keydev = NULL;
|
||||
crypto_device *d = NULL;
|
||||
|
||||
@@ -294,9 +294,9 @@ static int parse_options(const char *options) {
|
||||
_cleanup_free_ char *word = NULL;
|
||||
int r;
|
||||
|
||||
r = extract_first_word(&options, &word, ",", EXTRACT_DONT_COALESCE_SEPARATORS);
|
||||
r = extract_first_word(&options, &word, ",", EXTRACT_DONT_COALESCE_SEPARATORS | EXTRACT_UNESCAPE_SEPARATORS);
|
||||
if (r < 0)
|
||||
return log_debug_errno(r, "Failed to parse options: %m");
|
||||
return log_error_errno(r, "Failed to parse options: %m");
|
||||
if (r == 0)
|
||||
break;
|
||||
|
||||
@@ -874,6 +874,9 @@ static int run(int argc, char *argv[]) {
|
||||
return r;
|
||||
}
|
||||
|
||||
log_debug("%s %s ← %s type=%s cipher=%s", __func__,
|
||||
argv[2], argv[3], strempty(arg_type), strempty(arg_cipher));
|
||||
|
||||
/* A delicious drop of snake oil */
|
||||
(void) mlockall(MCL_FUTURE);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user