diff --git a/dist/adastra-vtl-installer-1.0.0.tar.gz b/dist/adastra-vtl-installer-1.0.0.tar.gz index 5082390..cea81f2 100644 Binary files a/dist/adastra-vtl-installer-1.0.0.tar.gz and b/dist/adastra-vtl-installer-1.0.0.tar.gz differ diff --git a/dist/adastra-vtl-installer/VERSION b/dist/adastra-vtl-installer/VERSION index b719cc8..f086f9a 100644 --- a/dist/adastra-vtl-installer/VERSION +++ b/dist/adastra-vtl-installer/VERSION @@ -1,4 +1,4 @@ Adastra VTL Installer Version: 1.0.0 -Build Date: 2025-12-10 12:20:01 +Build Date: 2025-12-10 12:25:11 Build Host: vtl-dev diff --git a/dist/adastra-vtl-installer/web-ui/api.php b/dist/adastra-vtl-installer/web-ui/api.php index a1a27e8..70908cb 100644 --- a/dist/adastra-vtl-installer/web-ui/api.php +++ b/dist/adastra-vtl-installer/web-ui/api.php @@ -325,17 +325,20 @@ function addLun($params) { return; } - // Determine backing store type (simplify to just bstype) + // For generic SCSI devices (sg), we MUST specify bstype=sg AND device-type=pt (passthrough) $bstypeParam = ''; - if (strpos($device, '/dev/sg') === 0) { - $bstypeParam = '--bstype sg'; + + // Validate device path strictly to avoid needing escapeshellarg (which adds quotes that might confuse tgtadm parsing in some versions) + // Regex allows /dev/sg0-999 or /dev/st0-999 or /dev/nst0-999 + if (preg_match('#^/dev/(sg|st|nst)[0-9]+$#', $device)) { + $bstypeParam = '--bstype sg --device-type pt'; } $command = sprintf( 'sudo /usr/sbin/tgtadm --lld iscsi --mode logicalunit --op new --tid %d --lun %d --backing-store %s %s 2>&1', $tid, $lun, - escapeshellarg($device), + $device, // Safe to use raw because we validated usage above or in previous regex check $bstypeParam ); diff --git a/web-ui/api.php b/web-ui/api.php index a1a27e8..70908cb 100644 --- a/web-ui/api.php +++ b/web-ui/api.php @@ -325,17 +325,20 @@ function addLun($params) { return; } - // Determine backing store type (simplify to just bstype) + // For generic SCSI devices (sg), we MUST specify bstype=sg AND device-type=pt (passthrough) $bstypeParam = ''; - if (strpos($device, '/dev/sg') === 0) { - $bstypeParam = '--bstype sg'; + + // Validate device path strictly to avoid needing escapeshellarg (which adds quotes that might confuse tgtadm parsing in some versions) + // Regex allows /dev/sg0-999 or /dev/st0-999 or /dev/nst0-999 + if (preg_match('#^/dev/(sg|st|nst)[0-9]+$#', $device)) { + $bstypeParam = '--bstype sg --device-type pt'; } $command = sprintf( 'sudo /usr/sbin/tgtadm --lld iscsi --mode logicalunit --op new --tid %d --lun %d --backing-store %s %s 2>&1', $tid, $lun, - escapeshellarg($device), + $device, // Safe to use raw because we validated usage above or in previous regex check $bstypeParam );