[SCM] Samba Shared Repository - branch master updated
Andrew Bartlett
abartlet at samba.org
Sun Nov 10 22:28:05 UTC 2019
The branch, master has been updated
via 6cf443ab1f9 s4-libcli: Remove unused header from composite/composite.c
via 74533b15182 Make sure backup temp directory gets deleted on exception
from f9eaf4dc713 dns: Always return SOA record for records we should know
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 6cf443ab1f9d0d939d721f58386669202d2fb56e
Author: Andrew Bartlett <abartlet at samba.org>
Date: Fri Oct 25 06:59:45 2019 +1300
s4-libcli: Remove unused header from composite/composite.c
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14170
Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Sun Nov 10 22:27:47 UTC 2019 on sn-devel-184
commit 74533b151825416d98912ca8d291637324ccc499
Author: Heiko Baumann <heibau at gmail.com>
Date: Tue Sep 3 16:30:24 2019 +0200
Make sure backup temp directory gets deleted on exception
This fix ensures that the samba-tool backup temp directory is removed
if an exception occurs (e.g. LDAP_INVALID_CREDENTIALS).
Signed-off-by: Heiko Baumann <heibau at gmail.com>
Reviewed-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
-----------------------------------------------------------------------
Summary of changes:
python/samba/netcmd/domain_backup.py | 85 ++++++++++++++++++------------------
source4/libcli/composite/composite.c | 1 -
2 files changed, 43 insertions(+), 43 deletions(-)
Changeset truncated at 500 lines:
diff --git a/python/samba/netcmd/domain_backup.py b/python/samba/netcmd/domain_backup.py
index 8233eafab95..a3dc7fb454f 100644
--- a/python/samba/netcmd/domain_backup.py
+++ b/python/samba/netcmd/domain_backup.py
@@ -251,48 +251,49 @@ class cmd_domain_backup_online(samba.netcmd.Command):
# Run a clone join on the remote
include_secrets = not no_secrets
- ctx = join_clone(logger=logger, creds=creds, lp=lp,
- include_secrets=include_secrets, server=server,
- dns_backend='SAMBA_INTERNAL', targetdir=tmpdir,
- backend_store=backend_store)
-
- # get the paths used for the clone, then drop the old samdb connection
- paths = ctx.paths
- del ctx
-
- # Get a free RID to use as the new DC's SID (when it gets restored)
- remote_sam = SamDB(url='ldap://' + server, credentials=creds,
- session_info=system_session(), lp=lp)
- new_sid = get_sid_for_restore(remote_sam, logger)
- realm = remote_sam.domain_dns_name()
-
- # Grab the remote DC's sysvol files and bundle them into a tar file
- logger.info("Backing up sysvol files (via SMB)...")
- sysvol_tar = os.path.join(tmpdir, 'sysvol.tar.gz')
- smb_conn = smb_sysvol_conn(server, lp, creds)
- backup_online(smb_conn, sysvol_tar, remote_sam.get_domain_sid())
-
- # remove the default sysvol files created by the clone (we want to
- # make sure we restore the sysvol.tar.gz files instead)
- shutil.rmtree(paths.sysvol)
-
- # Edit the downloaded sam.ldb to mark it as a backup
- samdb = SamDB(url=paths.samdb, session_info=system_session(), lp=lp)
- time_str = get_timestamp()
- add_backup_marker(samdb, "backupDate", time_str)
- add_backup_marker(samdb, "sidForRestore", new_sid)
- add_backup_marker(samdb, "backupType", "online")
-
- # ensure the admin user always has a password set (same as provision)
- if no_secrets:
- set_admin_password(logger, samdb)
-
- # Add everything in the tmpdir to the backup tar file
- backup_file = backup_filepath(targetdir, realm, time_str)
- create_log_file(tmpdir, lp, "online", server, include_secrets)
- create_backup_tar(logger, tmpdir, backup_file)
-
- shutil.rmtree(tmpdir)
+ try:
+ ctx = join_clone(logger=logger, creds=creds, lp=lp,
+ include_secrets=include_secrets, server=server,
+ dns_backend='SAMBA_INTERNAL', targetdir=tmpdir,
+ backend_store=backend_store)
+
+ # get the paths used for the clone, then drop the old samdb connection
+ paths = ctx.paths
+ del ctx
+
+ # Get a free RID to use as the new DC's SID (when it gets restored)
+ remote_sam = SamDB(url='ldap://' + server, credentials=creds,
+ session_info=system_session(), lp=lp)
+ new_sid = get_sid_for_restore(remote_sam, logger)
+ realm = remote_sam.domain_dns_name()
+
+ # Grab the remote DC's sysvol files and bundle them into a tar file
+ logger.info("Backing up sysvol files (via SMB)...")
+ sysvol_tar = os.path.join(tmpdir, 'sysvol.tar.gz')
+ smb_conn = smb_sysvol_conn(server, lp, creds)
+ backup_online(smb_conn, sysvol_tar, remote_sam.get_domain_sid())
+
+ # remove the default sysvol files created by the clone (we want to
+ # make sure we restore the sysvol.tar.gz files instead)
+ shutil.rmtree(paths.sysvol)
+
+ # Edit the downloaded sam.ldb to mark it as a backup
+ samdb = SamDB(url=paths.samdb, session_info=system_session(), lp=lp)
+ time_str = get_timestamp()
+ add_backup_marker(samdb, "backupDate", time_str)
+ add_backup_marker(samdb, "sidForRestore", new_sid)
+ add_backup_marker(samdb, "backupType", "online")
+
+ # ensure the admin user always has a password set (same as provision)
+ if no_secrets:
+ set_admin_password(logger, samdb)
+
+ # Add everything in the tmpdir to the backup tar file
+ backup_file = backup_filepath(targetdir, realm, time_str)
+ create_log_file(tmpdir, lp, "online", server, include_secrets)
+ create_backup_tar(logger, tmpdir, backup_file)
+ finally:
+ shutil.rmtree(tmpdir)
class cmd_domain_backup_restore(cmd_fsmo_seize):
diff --git a/source4/libcli/composite/composite.c b/source4/libcli/composite/composite.c
index e8ca6e46fc6..3598637b639 100644
--- a/source4/libcli/composite/composite.c
+++ b/source4/libcli/composite/composite.c
@@ -23,7 +23,6 @@
#include "includes.h"
#include "lib/events/events.h"
-#include "libcli/raw/libcliraw.h"
#include "libcli/smb2/smb2.h"
#include "libcli/composite/composite.h"
#include "../libcli/nbt/libnbt.h"
--
Samba Shared Repository
More information about the samba-cvs
mailing list