/mandos/trunk

To get this branch, use:
bzr branch http://bzr.recompile.se/loggerhead/mandos/trunk

« back to all changes in this revision

Viewing changes to mandos

  • Committer: Teddy Hogeborn
  • Date: 2019-11-03 19:17:57 UTC
  • Revision ID: teddy@recompile.se-20191103191757-1hdpp0u5fxa8iumo
INSTALL: Add "-" argument to "su" invocations.

Show diffs side-by-side

added added

removed removed

Lines of Context:
78
78
import collections
79
79
import codecs
80
80
import unittest
81
 
import random
82
81
 
83
82
import dbus
84
83
import dbus.service
92
91
 
93
92
if sys.version_info.major == 2:
94
93
    __metaclass__ = type
95
 
    str = unicode
96
 
 
97
 
# Add collections.abc.Callable if it does not exist
98
 
try:
99
 
    collections.abc.Callable
100
 
except AttributeError:
101
 
    class abc:
102
 
        Callable = collections.Callable
103
 
    collections.abc = abc
104
 
    del abc
105
94
 
106
95
# Show warnings by default
107
96
if not sys.warnoptions:
133
122
            # No value found
134
123
            SO_BINDTODEVICE = None
135
124
 
 
125
if sys.version_info.major == 2:
 
126
    str = unicode
 
127
 
136
128
if sys.version_info < (3, 2):
137
129
    configparser.Configparser = configparser.SafeConfigParser
138
130
 
1045
1037
        if self.checker_initiator_tag is not None:
1046
1038
            GLib.source_remove(self.checker_initiator_tag)
1047
1039
        self.checker_initiator_tag = GLib.timeout_add(
1048
 
            random.randrange(int(self.interval.total_seconds() * 1000
1049
 
                                 + 1)),
 
1040
            int(self.interval.total_seconds() * 1000),
1050
1041
            self.start_checker)
1051
1042
        # Schedule a disable() when 'timeout' has passed
1052
1043
        if self.disable_initiator_tag is not None:
1422
1413
                raise ValueError("Byte arrays not supported for non-"
1423
1414
                                 "'ay' signature {!r}"
1424
1415
                                 .format(prop._dbus_signature))
1425
 
            value = dbus.ByteArray(bytes(value))
 
1416
            value = dbus.ByteArray(b''.join(chr(byte)
 
1417
                                            for byte in value))
1426
1418
        prop(value)
1427
1419
 
1428
1420
    @dbus.service.method(dbus.PROPERTIES_IFACE,
2757
2749
        if command == 'getattr':
2758
2750
            attrname = request[1]
2759
2751
            if isinstance(client_object.__getattribute__(attrname),
2760
 
                          collections.abc.Callable):
 
2752
                          collections.Callable):
2761
2753
                parent_pipe.send(('function', ))
2762
2754
            else:
2763
2755
                parent_pipe.send((