Add tainted checking to iscsi_lunid
- So we do not have to change the /usr/bin/pvedaemon a small fix to
check the $item->{'iscsi_target'} varaible from the API call is needed.
This closes issue #3.
			
			
This commit is contained in:
		
							parent
							
								
									1943a454a2
								
							
						
					
					
						commit
						23990fc008
					
				|  | @ -19,11 +19,6 @@ Please be aware that this enhancment uses the FreeNAS APIs and NOT the ssh/scp l | ||||||
|     cp perl5/PVE/Storage/LunCmd/FreeNAS.pm /usr/share/perl5/PVE/Storage/LunCmd/FreeNAS.pm |     cp perl5/PVE/Storage/LunCmd/FreeNAS.pm /usr/share/perl5/PVE/Storage/LunCmd/FreeNAS.pm | ||||||
|     ``` |     ``` | ||||||
| 
 | 
 | ||||||
| 1. Remove the `-T` taint directive from `/usr/bin/pvedaemon`. Not sure why this is needed. I need to do some research on this PERL directive option. |  | ||||||
|     ```bash |  | ||||||
|     sed -E -i.orig 's|^(#!/usr/bin/perl) -T|\1|' /usr/bin/pvedaemon |  | ||||||
|     ``` |  | ||||||
| 
 |  | ||||||
| 1. Execute the following at a console command prompt to active the above | 1. Execute the following at a console command prompt to active the above | ||||||
|     ```bash |     ```bash | ||||||
|     systemctl restart pvedaemon |     systemctl restart pvedaemon | ||||||
|  |  | ||||||
|  | @ -438,6 +438,7 @@ sub freenas_list_lu { | ||||||
|     my $target_id = freenas_get_targetid($scfg); |     my $target_id = freenas_get_targetid($scfg); | ||||||
| 
 | 
 | ||||||
|     my @luns        = (); |     my @luns        = (); | ||||||
|  |     my $iscsi_lunid = undef; | ||||||
| 
 | 
 | ||||||
|     if(defined($target_id)) { |     if(defined($target_id)) { | ||||||
|         my $target2extents = freenas_iscsi_get_target_to_extent($scfg); |         my $target2extents = freenas_iscsi_get_target_to_extent($scfg); | ||||||
|  | @ -447,7 +448,13 @@ sub freenas_list_lu { | ||||||
|             if($item->{'iscsi_target'} == $target_id) { |             if($item->{'iscsi_target'} == $target_id) { | ||||||
|                 foreach my $node (@$extents) { |                 foreach my $node (@$extents) { | ||||||
|                     if($node->{'id'} == $item->{'iscsi_extent'}) { |                     if($node->{'id'} == $item->{'iscsi_extent'}) { | ||||||
|                         $node->{'iscsi_lunid'} .= $item->{'iscsi_lunid'}; |                         if ($item->{'iscsi_lunid'} =~ /(\d+)/) { | ||||||
|  |                             my $iscsi_lunid = "$1"; | ||||||
|  |                         } else { | ||||||
|  |                             syslog("info", "FreeNAS::API::freenas_list_lu : iscsi_lunid did not pass tainted testing"); | ||||||
|  |                             next; | ||||||
|  |                         } | ||||||
|  |                         $node->{'iscsi_lunid'} .= $iscsi_lunid; | ||||||
|                         push(@luns , $node); |                         push(@luns , $node); | ||||||
|                     } |                     } | ||||||
|                 } |                 } | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue