@@ -198,7 +198,9 @@ def make_backup(self, vms, target=None, expect_failure=False, **kwargs):
198198 if target is None :
199199 target = self .backupdir
200200 try :
201- backup = qubes .backup .Backup (self .app , vms , ** kwargs )
201+ backup = qubes .backup .Backup (
202+ self .app , vms , target_dir = target , ** kwargs
203+ )
202204 except qubes .exc .QubesException as e :
203205 if not expect_failure :
204206 self .fail ("QubesException during backup_prepare: %s" % str (e ))
@@ -207,7 +209,6 @@ def make_backup(self, vms, target=None, expect_failure=False, **kwargs):
207209
208210 if "passphrase" not in kwargs :
209211 backup .passphrase = "qubes"
210- backup .target_dir = target
211212
212213 try :
213214 self .loop .run_until_complete (backup .backup_do ())
@@ -575,6 +576,17 @@ def test_100_backup_dom0_no_restore(self):
575576 self .make_backup ([self .app .domains [0 ]])
576577 # TODO: think of some safe way to test restore...
577578
579+ def test_101_backup_dom0_to_dom0_home (self ):
580+ # Assure backing up dom0 to dom0 home itself is refused...
581+ local_user = grp .getgrnam ("qubes" ).gr_mem [0 ]
582+ home_dir = pwd .getpwnam (local_user ).pw_dir
583+ with self .assertRaises (qubes .exc .QubesException ):
584+ self .make_backup ([self .app .domains [0 ]], target = home_dir )
585+ with self .assertRaises (qubes .exc .QubesException ):
586+ self .make_backup (
587+ [self .app .domains [0 ]], target = os .path .join (home_dir , "somedir" )
588+ )
589+
578590 def test_200_restore_over_existing_directory (self ):
579591 """
580592 Regression test for #1386
0 commit comments