Module: check_mk
Branch: master
Commit: dbd467c014df21201c90cd44efb41db4ab91eb16
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=dbd467c014df21…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Jul 14 12:14:00 2017 +0200
4996 FIX Backup targets: Fixed possible MemoryError exception when editing a target
When saving a backup target a MemoryException() could occur while checking whether
or not the target is writable for the current user.
Change-Id: I2b8ff90eb914b48af213af11433357520b80073f
---
.werks/4996 | 12 ++++++++++++
web/htdocs/backup.py | 4 ++--
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/.werks/4996 b/.werks/4996
new file mode 100644
index 0000000..1e2f1f3
--- /dev/null
+++ b/.werks/4996
@@ -0,0 +1,12 @@
+Title: Backup targets: Fixed possible MemoryError exception when editing a target
+Level: 1
+Component: wato
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.5.0i1
+Date: 1500027168
+
+When saving a backup target a MemoryException() could occur while checking whether
+or not the target is writable for the current user.
diff --git a/web/htdocs/backup.py b/web/htdocs/backup.py
index 8dfa7dd..28a2f98 100644
--- a/web/htdocs/backup.py
+++ b/web/htdocs/backup.py
@@ -36,6 +36,7 @@ import shutil
import signal
import socket
import subprocess
+import time
try:
import simplejson as json
@@ -1361,9 +1362,8 @@ class BackupTargetLocal(BackupTargetType):
"need to specify an already existing
directory."))
# Check write access for the site user
- test_file_path = os.tempnam(value, "write_test")
try:
- file(test_file_path, "w")
+ file(os.path.join(value, "write_test_%d" % time.time()),
"w")
os.unlink(test_file_path)
except IOError, e:
if is_cma():