This file is indexed.

/usr/bin/neso is in tryton-neso 3.4.0-1.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
#!/usr/bin/python
#This file is part of Tryton.  The COPYRIGHT file at the top level of
#this repository contains the full copyright notices and license terms.
import sys
import os
import time
import threading
import xmlrpclib
import traceback
from functools import partial
from contextlib import contextmanager

import gobject

try:
    DIR = os.path.abspath(os.path.normpath(os.path.join(__file__,
        '..', '..', 'neso')))
    if os.path.isdir(DIR):
        sys.path.insert(0, os.path.dirname(DIR))
except:
    pass

# True only if running as a py2exe app
if os.name == 'nt' and hasattr(sys, "frozen"):
    if not ('-v' in sys.argv or '--verbose' in sys.argv or
            '-l' in sys.argv or '--log-level' in sys.argv):
        sys.stdout = open(os.devnull, 'w')
        sys.stderr = open(os.devnull, 'w')
    etc = os.path.join(os.path.dirname(sys.executable), 'etc')
    os.environ['GTK2_RC_FILES'] = os.path.join(etc, 'gtk-2.0', 'gtkrc')
    os.environ['GDK_PIXBUF_MODULE_FILE'] = os.path.join(etc, 'gtk-2.0',
        'gdk-pixbuf.loaders')
    os.environ['GTK_IM_MODULE_FILE'] = os.path.join(etc, 'gtk-2.0',
        'gtk.immodules')

if os.name == 'mac' or \
        (hasattr(os, 'uname') and os.uname()[0] == 'Darwin'):
    resources = os.path.join(os.path.dirname(sys.argv[0]), '..', 'Resources')
    gtkrc = os.path.join(resources, 'gtkrc')
    pixbuf_loader = os.path.join(resources, 'gdk-pixbuf.loaders')
    pangorc = os.path.join(resources, 'pangorc')
    immodules = os.path.join(resources, 'gtk.immodules')
    if os.path.isdir(resources):
        os.environ['GTK2_RC_FILES'] = gtkrc
        os.environ['GTK_EXE_PREFIX'] = resources
        os.environ['GTK_DATA_PREFIX'] = resources
        os.environ['GDK_PIXBUF_MODULE_FILE'] = pixbuf_loader
        os.environ['PANGO_RC_FILE'] = pangorc
        os.environ['GTK_IM_MODULE_FILE'] = immodules

import gtk
from neso.version import VERSION

for i in ('tryton', 'trytond'):
    try:
        DIR = os.path.abspath(os.path.normpath(os.path.join(__file__,
            '..', '..', i, i)))
        if os.path.isdir(DIR):
            sys.path.insert(0, os.path.dirname(DIR))
            continue
    except:  # Exception with py2exe
        pass
    # try for py2exe
    DIR = os.path.join(os.path.abspath(os.path.normpath(
        os.path.dirname(sys.argv[0]))), i, i)
    if os.path.isdir(DIR):
        sys.path.insert(0, os.path.dirname(DIR))
        continue
    # try for py2app
    DIR = os.path.join(os.path.abspath(os.path.normpath(
        os.path.dirname(sys.argv[0]))), '..', 'Resources', i, i)
    if os.path.isdir(DIR):
        sys.path.insert(0, os.path.dirname(DIR))

import tryton.client
TrytonClient = tryton.client.TrytonClient()

from trytond.config import config
from tryton.config import get_home_dir

DATA_DIR = os.path.join(os.path.abspath(os.path.normpath(
    os.path.dirname(sys.argv[0]))), '.neso')
if not os.path.isdir(DATA_DIR):
    DATA_DIR = os.path.join(unicode(get_home_dir(),
        sys.getfilesystemencoding()), '.neso')
    if not os.path.isdir(DATA_DIR):
        os.mkdir(DATA_DIR, 0700)
VERSION_DATA_DIR = os.path.join(DATA_DIR, VERSION.rsplit('.', 1)[0])
if not os.path.isdir(VERSION_DATA_DIR):
    os.mkdir(VERSION_DATA_DIR, 0700)

config.set('database', 'path', VERSION_DATA_DIR)

for mod in sys.modules.keys():
    if mod.startswith('trytond.') \
            and not mod.startswith('trytond.config'):
        del sys.modules[mod]

from trytond.pool import Pool
Pool.start()

from trytond import security

security.check_super = lambda *a: True

from trytond.protocols.dispatcher import dispatch
from trytond.exceptions import UserError, UserWarning, NotLogged, \
    ConcurrencyException

import tryton.rpc as rpc
from tryton.exceptions import TrytonServerError


class LocalProxy(xmlrpclib.ServerProxy):

    def __init__(self, host, port, database='', verbose=0,
            fingerprints=None, ca_certs=None):
        self.__host = host
        self.__port = port
        self.__database = database
        self.__verbose = verbose

    def __request(self, methodname, params):
        method_list = methodname.split('.')
        object_type = method_list[0]
        object_name = '.'.join(method_list[1:-1])
        method = method_list[-1]
        args = (self.__host, self.__port, 'local', self.__database, params[0],
            params[1], object_type, object_name, method) + tuple(params[2:])
        try:
            return dispatch(*args)
        except (UserError, UserWarning, NotLogged,
                ConcurrencyException), exception:
            raise TrytonServerError(*exception.args)
        except Exception:
            tb_s = ''
            for line in traceback.format_exception(*sys.exc_info()):
                try:
                    line = line.encode('utf-8', 'ignore')
                except Exception:
                    continue
                tb_s += line
            for path in sys.path:
                tb_s = tb_s.replace(path, '')
            raise TrytonServerError(str(sys.exc_value), tb_s)

    def __repr__(self):
        return "<LocalProxy for %s>" % self.__database

    __str__ = __repr__

    def close(self):
        pass

    @property
    def ssl(self):
        return False

    def __getattr__(self, name):
        # Override to force to use LocalProxy.__request
        return xmlrpclib._Method(self.__request, name)

rpc.ServerProxy = LocalProxy


# TODO: replace LocalPool by ServerPool using a parameter for ServerProxy
class LocalPool(object):

    def __init__(self, *args, **kwargs):
        self.LocalProxy = partial(LocalProxy, *args, **kwargs)
        self._lock = threading.Lock()
        self._pool = []
        self._used = {}

    def getconn(self):
        with self._lock:
            if self._pool:
                conn = self._pool.pop()
            else:
                conn = self.LocalProxy()
            self._used[id(conn)] = conn
            return conn

    def putconn(self, conn):
        with self._lock:
            self._pool.append(conn)
            del self._used[id(conn)]

    def close(self):
        with self._lock:
            for conn in self._pool + self._used.values():
                conn.close()

    @property
    def ssl(self):
        for conn in self._pool + self._used.values():
            return conn.ssl
        return False

    @contextmanager
    def __call__(self):
        conn = self.getconn()
        yield conn
        self.putconn(conn)

rpc.ServerPool = LocalPool

CRON_RUNNING = True


def cron():
    threads = {}
    while CRON_RUNNING:
        for dbname in Pool.database_list():
            thread = threads.get(dbname)
            if thread and thread.is_alive():
                continue
            pool = Pool(dbname)
            if 'ir.cron' not in pool.object_name_list():
                continue
            Cron = pool.get('ir.cron')
            thread = threading.Thread(
                    target=Cron.run,
                    args=(dbname,), kwargs={})
            thread.start()
            threads[dbname] = thread
        for i in xrange(60):
            time.sleep(1)
            if not CRON_RUNNING:
                break
thread = threading.Thread(target=cron)
thread.start()

from tryton.config import CONFIG as CLIENT_CONFIG
CLIENT_CONFIG.__setitem__('login.host', False, config=False)
CLIENT_CONFIG.__setitem__('login.server', 'localhost', config=False)
CLIENT_CONFIG.__setitem__('login.port', 8000, config=False)

from tryton.gui.window.dbcreate import DBCreate
_DBCreate_run = DBCreate.run


def DBCreate_run(self):
    self.entry_serverpasswd.set_text('admin')
    self.event_show_button_create(self.dialog, None)
    return _DBCreate_run(self)

DBCreate.run = DBCreate_run

from tryton.gui.window.dbdumpdrop import DBBackupDrop
_DBBackupDrop_run = DBBackupDrop.run


def DBBackupDrop_run(self):
    self.entry_serverpasswd.set_text('admin')
    self.event_show_button_ok(self.dialog, None)
    self.button_ok.set_sensitive(True)
    return _DBBackupDrop_run(self)

DBBackupDrop.run = DBBackupDrop_run

from tryton.gui.window.dbrestore import DBRestore
_DBRestore_run = DBRestore.run


def DBRestore_run(self):
    self.entry_server_password.set_text('admin')
    self.event_show_button_restore(self.dialog, None)
    return _DBRestore_run(self)

DBRestore.run = DBRestore_run

from tryton.common import refresh_dblist
from tryton.gui.window.dblogin import DBLogin
from tryton.exceptions import TrytonError


def DBLogin_run(self):
    self.combo_profile.destroy()
    self.profile_button.destroy()
    self.expander.destroy()
    self.label_host.destroy()
    self.entry_host.destroy()
    self.label_database.destroy()
    self.entry_database.destroy()
    self.profile_label.set_text('Database')
    dbstore = gtk.ListStore(gobject.TYPE_STRING)
    self.database_combo = gtk.ComboBox()
    self.database_combo.set_model(dbstore)
    cell = gtk.CellRendererText()
    self.database_combo.pack_start(cell, True)
    self.database_combo.add_attribute(cell, 'text', 0)

    dbs = refresh_dblist('localhost', 8000)
    if dbs:
        current_db = CLIENT_CONFIG['login.db']
        for idx, dbname in enumerate(dbs):
            dbstore.append((dbname,))
            if current_db == dbname:
                self.database_combo.set_active(idx)
        self.table_main.attach(self.database_combo, 1, 3, 1, 2,
            xoptions=gtk.FILL)
    else:
        dbname = None

        def db_create(button):
            dia = DBCreate('localhost', 8000)
            dbname = dia.run()
            button.hide()
            self.table_main.attach(self.database_combo, 1, 3, 1, 2,
                xoptions=gtk.FILL)
            self.database_combo.show()
            dbstore.append((dbname,))
            self.database_combo.set_active(len(dbstore) - 1)
        image = gtk.Image()
        image.set_from_stock('tryton-new', gtk.ICON_SIZE_BUTTON)
        create_button = gtk.Button(u'Create')
        create_button.set_image(image)
        create_button.connect('clicked', db_create)
        self.table_main.attach(create_button, 1, 3, 1, 2, xoptions=gtk.FILL)

    self.dialog.show_all()
    self.dialog.reshow_with_initial_size()
    res, result = None, ('', '', '', '', '')
    while not (res in (gtk.RESPONSE_CANCEL, gtk.RESPONSE_DELETE_EVENT)
            or (res == gtk.RESPONSE_OK and all(result))):
        self.database_combo.grab_focus()
        res = self.dialog.run()
        database = self.database_combo.get_active()
        if database != -1:
            db_name = dbstore[database][0]
            CLIENT_CONFIG['login.db'] = db_name
            result = (self.entry_login.get_text(),
                self.entry_password.get_text(), 'localhost', 8000, db_name)

    self.parent.present()
    self.dialog.destroy()
    if res != gtk.RESPONSE_OK:
        rpc.logout()
        raise TrytonError('QueryCanceled')
    return result

DBLogin.run = DBLogin_run

TrytonClient.run()
CRON_RUNNING = False
thread.join()
sys.exit(0)