[tryton-debian-vcs] tryton-server branch upstream-3.8 updated. upstream/3.8.7-1-gd9b9a58
Mathias Behrle
tryton-debian-vcs at alioth.debian.org
Tue Aug 30 14:17:33 UTC 2016
The following commit has been merged in the upstream-3.8 branch:
https://alioth.debian.org/plugins/scmgit/cgi-bin/gitweb.cgi/?p=tryton/tryton-server.git;a=commitdiff;h=upstream/3.8.7-1-gd9b9a58
commit d9b9a5831e4be5c7d1ed960bb94baadcfa0eabc0
Author: Mathias Behrle <mathiasb at m9s.biz>
Date: Tue Aug 30 15:08:34 2016 +0200
Adding upstream version 3.8.8.
Signed-off-by: Mathias Behrle <mathiasb at m9s.biz>
diff --git a/CHANGELOG b/CHANGELOG
index 72a0ab6..408f44d 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,8 @@
+Version 3.8.8 - 2016-08-30
+* Bug fixes (see mercurial logs for details)
+* Sanitize path in file_open (CVE-2016-1242)
+* Prevent read of user password hash (CVE-2016-1241)
+
Version 3.8.7 - 2016-08-02
* Bug fixes (see mercurial logs for details)
diff --git a/PKG-INFO b/PKG-INFO
index 6c69ebe..5303d8c 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: trytond
-Version: 3.8.7
+Version: 3.8.8
Summary: Tryton server
Home-page: http://www.tryton.org/
Author: Tryton
diff --git a/trytond.egg-info/PKG-INFO b/trytond.egg-info/PKG-INFO
index 6c69ebe..5303d8c 100644
--- a/trytond.egg-info/PKG-INFO
+++ b/trytond.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: trytond
-Version: 3.8.7
+Version: 3.8.8
Summary: Tryton server
Home-page: http://www.tryton.org/
Author: Tryton
diff --git a/trytond/__init__.py b/trytond/__init__.py
index 407e42f..e0d312c 100644
--- a/trytond/__init__.py
+++ b/trytond/__init__.py
@@ -4,7 +4,7 @@ import os
import time
from email import charset
-__version__ = "3.8.7"
+__version__ = "3.8.8"
os.environ['TZ'] = 'UTC'
if hasattr(time, 'tzset'):
diff --git a/trytond/ir/sequence.py b/trytond/ir/sequence.py
index b992878..6524aec 100644
--- a/trytond/ir/sequence.py
+++ b/trytond/ir/sequence.py
@@ -151,7 +151,7 @@ class Sequence(ModelSQL, ModelView):
@staticmethod
def default_last_timestamp():
- return 0.0
+ return 0
@staticmethod
def default_code():
@@ -249,7 +249,8 @@ class Sequence(ModelSQL, ModelView):
for sequence in sequences:
next_timestamp = cls._timestamp(sequence)
- if sequence.last_timestamp > next_timestamp:
+ if (sequence.last_timestamp is not None
+ and sequence.last_timestamp > next_timestamp):
cls.raise_user_error('future_last_timestamp', (
sequence.rec_name,))
diff --git a/trytond/model/fields/many2many.py b/trytond/model/fields/many2many.py
index b0b81f8..4f6e9c1 100644
--- a/trytond/model/fields/many2many.py
+++ b/trytond/model/fields/many2many.py
@@ -162,11 +162,13 @@ class Many2Many(Field):
(self.target, 'in', list(sub_ids)),
])
for relation in relations:
- existing_ids.add(getattr(relation, self.target).id)
+ existing_ids.add((
+ getattr(relation, self.origin).id,
+ getattr(relation, self.target).id))
for new_id in target_ids:
- if new_id in existing_ids:
- continue
for record_id in ids:
+ if (record_id, new_id) in existing_ids:
+ continue
relation_to_create.append({
self.origin: field_value(record_id),
self.target: new_id,
diff --git a/trytond/model/modelsql.py b/trytond/model/modelsql.py
index 068c567..b88bfbb 100644
--- a/trytond/model/modelsql.py
+++ b/trytond/model/modelsql.py
@@ -735,11 +735,13 @@ class ModelSQL(ModelStorage):
_datetime=row[datetime_field]):
date_results = field.get([row['id']], cls, field_list,
values=[row])
- for fname, date_result in date_results.iteritems():
+ for fname in field_list:
+ date_result = date_results[fname]
row[fname] = date_result[row['id']]
else:
getter_results = field.get(ids, cls, field_list, values=result)
- for fname, getter_result in getter_results.iteritems():
+ for fname in field_list:
+ getter_result = getter_results[fname]
for row in result:
row[fname] = getter_result[row['id']]
diff --git a/trytond/model/modelstorage.py b/trytond/model/modelstorage.py
index 0d447dc..e88b15c 100644
--- a/trytond/model/modelstorage.py
+++ b/trytond/model/modelstorage.py
@@ -1421,46 +1421,49 @@ class ModelStorage(Model):
@dualmethod
def save(cls, records):
- if not records:
- return
- values = {}
- save_values = {}
- to_create = []
- to_write = []
- cursor = records[0]._cursor
- user = records[0]._user
- context = records[0]._context
- for record in records:
- assert cursor == record._cursor
- assert user == record._user
- assert context == record._context
- save_values[record] = record._save_values
- values[record] = record._values
- record._values = None
- if record.id is None or record.id < 0:
- to_create.append(record)
- elif save_values[record]:
- to_write.append(record)
- transaction = Transaction()
- try:
- with transaction.set_cursor(cursor), \
- transaction.set_user(user), \
- transaction.set_context(context):
- if to_create:
- news = cls.create([save_values[r] for r in to_create])
- for record, new in izip(to_create, news):
- record._ids.remove(record.id)
- record.id = new.id
- record._ids.append(record.id)
- if to_write:
- cls.write(*sum(
- (([r], save_values[r]) for r in to_write), ()))
- except:
+ while records:
+ latter = []
+ values = {}
+ save_values = {}
+ to_create = []
+ to_write = []
+ cursor = records[0]._cursor
+ user = records[0]._user
+ context = records[0]._context
for record in records:
- record._values = values[record]
- raise
- for record in records:
- record._init_values = None
+ if (record._cursor != cursor
+ or user != record._user
+ or context != record._context):
+ latter.append(record)
+ continue
+ save_values[record] = record._save_values
+ values[record] = record._values
+ record._values = None
+ if record.id is None or record.id < 0:
+ to_create.append(record)
+ elif save_values[record]:
+ to_write.append(record)
+ transaction = Transaction()
+ try:
+ with transaction.set_cursor(cursor), \
+ transaction.set_user(user), \
+ transaction.set_context(context):
+ if to_create:
+ news = cls.create([save_values[r] for r in to_create])
+ for record, new in izip(to_create, news):
+ record._ids.remove(record.id)
+ record.id = new.id
+ record._ids.append(record.id)
+ if to_write:
+ cls.write(*sum(
+ (([r], save_values[r]) for r in to_write), ()))
+ except:
+ for record in to_create + to_write:
+ record._values = values[record]
+ raise
+ for record in to_create + to_write:
+ record._init_values = None
+ records = latter
class EvalEnvironment(dict):
diff --git a/trytond/res/user.py b/trytond/res/user.py
index 7fd6f60..caf2c95 100644
--- a/trytond/res/user.py
+++ b/trytond/res/user.py
@@ -227,6 +227,14 @@ class User(ModelSQL, ModelView):
return vals
@classmethod
+ def read(cls, ids, fields_names=None):
+ result = super(User, cls).read(ids, fields_names=fields_names)
+ if not fields_names or 'password_hash' in fields_names:
+ for values in result:
+ values['password_hash'] = None
+ return result
+
+ @classmethod
def create(cls, vlist):
vlist = [cls._convert_vals(vals) for vals in vlist]
res = super(User, cls).create(vlist)
diff --git a/trytond/tools/misc.py b/trytond/tools/misc.py
index 16f65fa..a5cfab0 100644
--- a/trytond/tools/misc.py
+++ b/trytond/tools/misc.py
@@ -56,6 +56,14 @@ def file_open(name, mode="r", subdir='modules'):
root_path = os.path.dirname(os.path.dirname(os.path.abspath(
unicode(__file__, sys.getfilesystemencoding()))))
+ def secure_join(root, *paths):
+ "Join paths and ensure it still below root"
+ path = os.path.join(root, *paths)
+ path = os.path.normpath(path)
+ if not path.startswith(root):
+ raise IOError("Permission denied: %s" % name)
+ return path
+
egg_name = False
if subdir == 'modules':
module_name = name.split(os.sep)[0]
@@ -63,19 +71,19 @@ def file_open(name, mode="r", subdir='modules'):
epoint = EGG_MODULES[module_name]
mod_path = os.path.join(epoint.dist.location,
*epoint.module_name.split('.')[:-1])
- egg_name = os.path.join(mod_path, name)
+ egg_name = secure_join(mod_path, name)
if not os.path.isfile(egg_name):
# Find module in path
for path in sys.path:
mod_path = os.path.join(path,
*epoint.module_name.split('.')[:-1])
- egg_name = os.path.join(mod_path, name)
+ egg_name = secure_join(mod_path, name)
if os.path.isfile(egg_name):
break
if not os.path.isfile(egg_name):
# When testing modules from setuptools location is the
# module directory
- egg_name = os.path.join(
+ egg_name = secure_join(
os.path.dirname(epoint.dist.location), name)
if subdir:
@@ -84,11 +92,11 @@ def file_open(name, mode="r", subdir='modules'):
or name.startswith('res' + os.sep)
or name.startswith('webdav' + os.sep)
or name.startswith('tests' + os.sep))):
- name = os.path.join(root_path, name)
+ name = secure_join(root_path, name)
else:
- name = os.path.join(root_path, subdir, name)
+ name = secure_join(root_path, subdir, name)
else:
- name = os.path.join(root_path, name)
+ name = secure_join(root_path, name)
for i in (name, egg_name):
if i and os.path.isfile(i):
--
tryton-server
More information about the tryton-debian-vcs
mailing list