Show More
@@ -16,7 +16,7 b' class ui(object):' | |||||
16 | def __init__(self, src=None): |
|
16 | def __init__(self, src=None): | |
17 | self._buffers = [] |
|
17 | self._buffers = [] | |
18 | self.quiet = self.verbose = self.debugflag = self.traceback = False |
|
18 | self.quiet = self.verbose = self.debugflag = self.traceback = False | |
19 |
self.interactive = self.report |
|
19 | self.interactive = self._reportuntrusted = True | |
20 | self._ocfg = config.config() # overlay |
|
20 | self._ocfg = config.config() # overlay | |
21 | self._tcfg = config.config() # trusted |
|
21 | self._tcfg = config.config() # trusted | |
22 | self._ucfg = config.config() # untrusted |
|
22 | self._ucfg = config.config() # untrusted | |
@@ -63,7 +63,7 b' class ui(object):' | |||||
63 | if user in tusers or group in tgroups or user == util.username(): |
|
63 | if user in tusers or group in tgroups or user == util.username(): | |
64 | return True |
|
64 | return True | |
65 |
|
65 | |||
66 |
if self.report |
|
66 | if self._reportuntrusted: | |
67 | self.warn(_('Not trusting file %s from untrusted ' |
|
67 | self.warn(_('Not trusting file %s from untrusted ' | |
68 | 'user %s, group %s\n') % (f, user, group)) |
|
68 | 'user %s, group %s\n') % (f, user, group)) | |
69 | return False |
|
69 | return False | |
@@ -111,7 +111,7 b' class ui(object):' | |||||
111 | self.quiet = not self.debugflag and self.configbool('ui', 'quiet') |
|
111 | self.quiet = not self.debugflag and self.configbool('ui', 'quiet') | |
112 | if self.verbose and self.quiet: |
|
112 | if self.verbose and self.quiet: | |
113 | self.quiet = self.verbose = False |
|
113 | self.quiet = self.verbose = False | |
114 |
self.report |
|
114 | self._reportuntrusted = self.configbool("ui", "report_untrusted", True) | |
115 | self.interactive = self.configbool("ui", "interactive", self.isatty()) |
|
115 | self.interactive = self.configbool("ui", "interactive", self.isatty()) | |
116 | self.traceback = self.configbool('ui', 'traceback', False) |
|
116 | self.traceback = self.configbool('ui', 'traceback', False) | |
117 |
|
117 | |||
@@ -134,10 +134,10 b' class ui(object):' | |||||
134 |
|
134 | |||
135 | def config(self, section, name, default=None, untrusted=False): |
|
135 | def config(self, section, name, default=None, untrusted=False): | |
136 | value = self._data(untrusted).get(section, name, default) |
|
136 | value = self._data(untrusted).get(section, name, default) | |
137 | if self.debugflag and not untrusted: |
|
137 | if self.debugflag and not untrusted and self._reportuntrusted: | |
138 | uvalue = self._ucfg.get(section, name) |
|
138 | uvalue = self._ucfg.get(section, name) | |
139 | if uvalue is not None and uvalue != value: |
|
139 | if uvalue is not None and uvalue != value: | |
140 |
self. |
|
140 | self.debug(_("ignoring untrusted configuration option " | |
141 | "%s.%s = %s\n") % (section, name, uvalue)) |
|
141 | "%s.%s = %s\n") % (section, name, uvalue)) | |
142 | return value |
|
142 | return value | |
143 |
|
143 | |||
@@ -165,10 +165,10 b' class ui(object):' | |||||
165 |
|
165 | |||
166 | def configitems(self, section, untrusted=False): |
|
166 | def configitems(self, section, untrusted=False): | |
167 | items = self._data(untrusted).items(section) |
|
167 | items = self._data(untrusted).items(section) | |
168 | if self.debugflag and not untrusted: |
|
168 | if self.debugflag and not untrusted and self._reportuntrusted: | |
169 | for k,v in self._ucfg.items(section): |
|
169 | for k,v in self._ucfg.items(section): | |
170 | if self._tcfg.get(section, k) != v: |
|
170 | if self._tcfg.get(section, k) != v: | |
171 |
self. |
|
171 | self.debug(_("ignoring untrusted configuration option " | |
172 | "%s.%s = %s\n") % (section, k, v)) |
|
172 | "%s.%s = %s\n") % (section, k, v)) | |
173 | return items |
|
173 | return items | |
174 |
|
174 |
@@ -129,12 +129,12 b' untrusted' | |||||
129 | # different user, different group |
|
129 | # different user, different group | |
130 | Not trusting file .hg/hgrc from untrusted user abc, group def |
|
130 | Not trusting file .hg/hgrc from untrusted user abc, group def | |
131 | trusted |
|
131 | trusted | |
132 |
|
|
132 | ignoring untrusted configuration option paths.local = /another/path | |
133 | global = /some/path |
|
133 | global = /some/path | |
134 | untrusted |
|
134 | untrusted | |
135 | . . global = /some/path |
|
135 | . . global = /some/path | |
136 |
. |
|
136 | .ignoring untrusted configuration option paths.local = /another/path | |
137 |
|
|
137 | . local = /another/path | |
138 |
|
138 | |||
139 | # ui.readconfig sections |
|
139 | # ui.readconfig sections | |
140 | quux |
|
140 | quux | |
@@ -142,7 +142,7 b' quux' | |||||
142 | # read trusted, untrusted, new ui, trusted |
|
142 | # read trusted, untrusted, new ui, trusted | |
143 | Not trusting file foobar from untrusted user abc, group def |
|
143 | Not trusting file foobar from untrusted user abc, group def | |
144 | trusted: |
|
144 | trusted: | |
145 |
|
|
145 | ignoring untrusted configuration option foobar.baz = quux | |
146 | None |
|
146 | None | |
147 | untrusted: |
|
147 | untrusted: | |
148 | quux |
|
148 | quux |
General Comments 0
You need to be logged in to leave comments.
Login now