/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-09-03 18:52:20 UTC
  • mfrom: (1176 trunk)
  • mto: This revision was merged to the branch mainline in revision 1177.
  • Revision ID: teddy@recompile.se-20190903185220-lsldutcamh5es7pv
MergeĀ fromĀ trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/python3 -bI
 
1
#!/usr/bin/python3 -b
2
2
# -*- mode: python; after-save-hook: (lambda () (let ((command (if (fboundp 'file-local-name) (file-local-name (buffer-file-name)) (or (file-remote-p (buffer-file-name) 'localname) (buffer-file-name))))) (if (= (progn (if (get-buffer "*Test*") (kill-buffer "*Test*")) (process-file-shell-command (format "%s --check" (shell-quote-argument command)) nil "*Test*")) 0) (let ((w (get-buffer-window "*Test*"))) (if w (delete-window w))) (progn (with-current-buffer "*Test*" (compilation-mode)) (display-buffer "*Test*" '(display-buffer-in-side-window)))))); coding: utf-8 -*-
3
3
#
4
4
# Mandos server - give out binary blobs to connecting clients.
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
94
 
97
95
# Show warnings by default
98
96
if not sys.warnoptions:
124
122
            # No value found
125
123
            SO_BINDTODEVICE = None
126
124
 
 
125
if sys.version_info.major == 2:
 
126
    str = unicode
 
127
 
127
128
if sys.version_info < (3, 2):
128
129
    configparser.Configparser = configparser.SafeConfigParser
129
130
 
130
 
version = "1.8.9"
 
131
version = "1.8.8"
131
132
stored_state_file = "clients.pickle"
132
133
 
133
134
logger = logging.getLogger()
1036
1037
        if self.checker_initiator_tag is not None:
1037
1038
            GLib.source_remove(self.checker_initiator_tag)
1038
1039
        self.checker_initiator_tag = GLib.timeout_add(
1039
 
            random.randrange(int(self.interval.total_seconds() * 1000
1040
 
                                 + 1)),
 
1040
            int(self.interval.total_seconds() * 1000),
1041
1041
            self.start_checker)
1042
1042
        # Schedule a disable() when 'timeout' has passed
1043
1043
        if self.disable_initiator_tag is not None:
1413
1413
                raise ValueError("Byte arrays not supported for non-"
1414
1414
                                 "'ay' signature {!r}"
1415
1415
                                 .format(prop._dbus_signature))
1416
 
            value = dbus.ByteArray(bytes(value))
 
1416
            value = dbus.ByteArray(b''.join(chr(byte)
 
1417
                                            for byte in value))
1417
1418
        prop(value)
1418
1419
 
1419
1420
    @dbus.service.method(dbus.PROPERTIES_IFACE,