]> gitweb.morketsmerke.org Git - immudex.git/commitdiff
immudex-crypt - poprawienie sposobu na określenie RUID oraz RUSER.
authorxf0r3m <jakubstasinski@protonmail.com>
Tue, 9 Jan 2024 09:00:37 +0000 (10:00 +0100)
committerxf0r3m <jakubstasinski@protonmail.com>
Tue, 9 Jan 2024 09:00:37 +0000 (10:00 +0100)
tools/sbin/immudex-crypt

index 91ffd80cfaef85c36b0e695acf42d179249451f0..d966fff5dc77e8db9f98aa9868b7a10ec97c324d 100755 (executable)
@@ -75,7 +75,7 @@ function open() {
     # Różnica w reprezentacji czasu modyfikacji miedzy Debian testing a stable i oldstable 
     #dmDevice=$(ls -l /dev/mapper/immudex-crypt${index} | awk '{printf $10}' | cut -d "/" -f 2);
     lastField=$(ls -l /dev/mapper/immudex-crypt${index} | grep -o ' ' | wc -l);
-    dmDevice=$(ls -al /dev/mapper/immudex-crypt0 | cut -d " " -f ${lastField}- | cut -d "/" -f2);
+    dmDevice=$(ls -al /dev/mapper/immudex-crypt${index} | cut -d " " -f ${lastField}- | cut -d "/" -f2);
     if ! $(sudo file -s /dev/${dmDevice} | grep -q 'ext4'); then
       echo "Could not determine filesystem of unlocked device.";
       echo -n "Format this device to ext4? (y/n): "
@@ -151,10 +151,10 @@ if [ "$1" ]; then
     exit 1;
   fi
  
-  immudexCryptPID=$$;
-  parentProcessPID=$((immudexCryptPID - 1));
+  #immudexCryptPID=$$;
+  #parentProcessPID=$((immudexCryptPID - 1));
   #immudex-crypt RUID is EUID of sudo, which spawning immudex-crypt
-  export RUID=$(grep '^Uid:' /proc/${parentProcessPID}/status | awk '{printf $2}');
+  export RUID=$(grep '^Uid:' /proc/$(pidof -s sudo)/status | awk '{printf $2}');
   export USER=$(grep "$RUID" /etc/passwd | cut -d ":" -f1);
 
   case $1 in