Pass LUKS password as needed when resizing open mapping (#59)
This is the final piece which enables GParted to pass the LUKS passphrase when resizing an open LUKS encryption mapping when 'cryptsetup resize' will prompt for it. Closes #59 - Resize of LUKS2 encrypted file system fails with "Nothing to read on input"
This commit is contained in:
parent
d7503fd5ed
commit
f3aec1f4b1
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
#include "FileSystem.h"
|
#include "FileSystem.h"
|
||||||
#include "LUKS_Info.h"
|
#include "LUKS_Info.h"
|
||||||
|
#include "PasswordRAMStore.h"
|
||||||
#include "Utils.h"
|
#include "Utils.h"
|
||||||
#include "luks.h"
|
#include "luks.h"
|
||||||
|
|
||||||
|
@ -158,8 +159,12 @@ bool luks::resize( const Partition & partition_new, OperationDetail & operationd
|
||||||
// device sector size.
|
// device sector size.
|
||||||
size = "--size " + Utils::num_to_str( ( partition_new.get_byte_length() - mapping.offset ) / 512LL ) + " ";
|
size = "--size " + Utils::num_to_str( ( partition_new.get_byte_length() - mapping.offset ) / 512LL ) + " ";
|
||||||
|
|
||||||
|
const char *pw = NULL;
|
||||||
|
if (mapping.key_loc == KEYLOC_KeyRing)
|
||||||
|
pw = PasswordRAMStore::lookup(partition_new.uuid);
|
||||||
|
|
||||||
return ! execute_command("cryptsetup -v " + size + "resize " + Glib::shell_quote(mapping.name),
|
return ! execute_command("cryptsetup -v " + size + "resize " + Glib::shell_quote(mapping.name),
|
||||||
operationdetail, EXEC_CHECK_STATUS );
|
pw, operationdetail, EXEC_CHECK_STATUS);
|
||||||
}
|
}
|
||||||
|
|
||||||
} //GParted
|
} //GParted
|
||||||
|
|
|
@ -40,6 +40,7 @@ test_SupportedFileSystems_LDADD = \
|
||||||
$(top_builddir)/src/Partition.$(OBJEXT) \
|
$(top_builddir)/src/Partition.$(OBJEXT) \
|
||||||
$(top_builddir)/src/PartitionLUKS.$(OBJEXT) \
|
$(top_builddir)/src/PartitionLUKS.$(OBJEXT) \
|
||||||
$(top_builddir)/src/PartitionVector.$(OBJEXT) \
|
$(top_builddir)/src/PartitionVector.$(OBJEXT) \
|
||||||
|
$(top_builddir)/src/PasswordRAMStore.$(OBJEXT) \
|
||||||
$(top_builddir)/src/PipeCapture.$(OBJEXT) \
|
$(top_builddir)/src/PipeCapture.$(OBJEXT) \
|
||||||
$(top_builddir)/src/Proc_Partitions_Info.$(OBJEXT) \
|
$(top_builddir)/src/Proc_Partitions_Info.$(OBJEXT) \
|
||||||
$(top_builddir)/src/ProgressBar.$(OBJEXT) \
|
$(top_builddir)/src/ProgressBar.$(OBJEXT) \
|
||||||
|
|
Loading…
Reference in New Issue