File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change 2828import  itertools 
2929import  logging 
3030import  os 
31+ from  pathlib  import  Path 
3132import  pwd 
3233import  shutil 
3334import  stat 
@@ -452,6 +453,15 @@ def get_files_to_backup(self):
452453        if  0  in  [vm .qid  for  vm  in  self .vms_for_backup ]:
453454            local_user  =  grp .getgrnam ("qubes" ).gr_mem [0 ]
454455            home_dir  =  pwd .getpwnam (local_user ).pw_dir 
456+ 
457+             # Checking if target is not user home directory in dom0 
458+             if  self .target_dir  ==  home_dir  \
459+                     or  Path (home_dir ) in  Path (self .target_dir ).parents  \
460+                     or  not  self .target_dir :
461+                 raise  qubes .exc .QubesException (
462+                     "ERROR: Can not backup dom0 home directory to itself!" 
463+                 )
464+ 
455465            # Home dir should have only user-owned files, so fix it now 
456466            # to prevent permissions problems - some root-owned files can 
457467            # left after 'sudo bash' and similar commands 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments