0
     �_’I|¥‰ÓMjqØ‚¦ð¬÷ÃÂ      File not found.
  	   ˆÅÄ0ÃÂ  #   ˆl–ßi~”Ši?u4 Y¸®2ú˜´oÅ„¯¾ßÄÃ ?÷     #!/usr/bin/python3 -Es
#
# Authors: John Dennis <jdennis@redhat.com>
# Authors: Dan Walsh <dwalsh@redhat.com>
#
# Copyright (C) 2006-2010 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#

from __future__ import print_function
import syslog

import gi
GTK_VERSION = '3.0'
from gi.repository import GObject, GLib
GLib.set_prgname('setroubleshoot')

import dbus
import dbus.service
import errno as Errno
import gettext
import os
import re
import signal
import selinux
import socket as Socket
import fcntl
import sys

from dbus.mainloop.glib import DBusGMainLoop
DBusGMainLoop(set_as_default=True)

from setroubleshoot.config import parse_config_setting, get_config
domain = get_config('general', 'i18n_text_domain')
kwargs = {}
if sys.version_info < (3,):
    kwargs['unicode'] = True
gettext.install(domain=domain,
                localedir=get_config('general', 'i18n_locale_dir'),
                **kwargs)

syslog.openlog(sys.argv[0])
from setroubleshoot.errcode import *
from setroubleshoot.util import get_identity, load_plugins, log_init, log_debug
from setroubleshoot.rpc import *

#------------------------------------------------------------------------------
invocation_style = None
status_icon = None
dbus_system_bus_name = get_config('system_dbus', 'bus_name')
dbus_system_object_path = get_config('system_dbus', 'object_path')
dbus_system_interface = get_config('system_dbus', 'interface')

dbus_session_bus_name = get_config('session_dbus', 'bus_name')
dbus_session_object_path = get_config('session_dbus', 'object_path')
dbus_session_interface = get_config('session_dbus', 'interface')
app = None
default_status_icon_tooltip = _("SELinux AVC denial, click to view")

log_init("sealert_log")

#------------------------------------------------------------------------------


def sighandler(signum, frame):
    log_debug("exiting on signal %s" % signum)
    sys.exit()


def get_server_socket_address():
    addr_list = get_socket_list_from_config('client_connect_to')
    if len(addr_list) == 0:
        return None
    return addr_list[0]


def setup_sighandlers():
    signal.signal(signal.SIGHUP, sighandler)
    signal.signal(signal.SIGQUIT, sighandler)
    signal.signal(signal.SIGTERM, sighandler)


def run_app(user):
    global app

    from setroubleshoot.serverconnection import ServerConnectionHandler
    GObject.type_register(ServerConnectionHandler)

    app = SEAlert(user)
    return app.main()


def error(message):
    dlg = Gtk.MessageDialog(modal=True,
                            message_type=Gtk.MessageType.ERROR,
                            buttons=Gtk.ButtonsType.CLOSE,
                            text=message)
    dlg.set_position(Gtk.WindowPosition.CENTER)
    dlg.show_all()
    dlg.run()
    dlg.destroy()


def run_as_dbus_service(user):
    global app
#-----------------------------------------------------------------------------
    if not selinux.is_selinux_enabled():
        log_debug("SELinux not enabled, sealert will not run on non SELinux systems")
        error(_("SELinux not enabled, sealert will not run on non SELinux systems"))
        sys.exit(3)

    try:
        log_debug('starting service')
        dbus_service = DBusSessionService(dbus_session_bus_name)
        app = SEAlert(user, dbus_service.presentation_manager, watch_setroubleshootd=True)
 