netcmd: domain backup offline bug fix - ignore sock files
authorAaron Haslett <aaronhaslett@catalyst.net.nz>
Mon, 24 Sep 2018 04:27:33 +0000 (16:27 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 26 Sep 2018 23:54:27 +0000 (01:54 +0200)
Ignoring autogenerated .sock files and directories during file system based
offline domain backup.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13604
Signed-off-by: Aaron Haslett <aaronhaslett@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
python/samba/netcmd/domain_backup.py

index 5ddc1c18df6d184e0de9075b6254d96a2ff44521..9c8457db4b8b5f2b3ea822e96002020f272cf04d 100644 (file)
@@ -949,6 +949,8 @@ class cmd_domain_backup_offline(samba.netcmd.Command):
             for (working_dir, _, filenames) in os.walk(backup_dir):
                 if working_dir.startswith(paths.sysvol):
                     continue
+                if working_dir.endswith('.sock') or '.sock/' in working_dir:
+                    continue
 
                 for filename in filenames:
                     if filename in all_files:
@@ -959,6 +961,11 @@ class cmd_domain_backup_offline(samba.netcmd.Command):
                     if filename.endswith(self.backup_ext):
                         os.remove(os.path.join(working_dir, filename))
                         continue
+
+                    # Sock files are autogenerated at runtime, ignore.
+                    if filename.endswith('.sock'):
+                        continue
+
                     all_files.append(os.path.join(working_dir, filename))
 
         # Backup secrets, sam.ldb and their downstream files