예제 #1
0
파일: lcm.py 프로젝트: we-mi/lcm
def openSocket():
    try:
        s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        if config_backend.getEncryption() is None:
            s.connect((config_backend.getIP(), config_backend.getPort()))
            return s
        else:
            ssl_sock = ssl.wrap_socket(s)
            ssl_sock.connect((config_backend.getIP(), config_backend.getPort()))
            return ssl_sock
    except Exception as e:
        log.writeLogLV(config_backend.getLogfile(),
                        "Konnte keine Verbindung zum Server aufbauen (%s:%s). Fehler: %s\n" %
                            (config_backend.getIP(), config_backend.getPort(), e.args),
                        log.LOGLEVEL["fatal"])
        if config_backend.getDebug():
            print traceback.print_exc()
        exit(1)
예제 #2
0
파일: lcm.py 프로젝트: we-mi/lcm
                        "Konnte die Gruppe nicht auf '%s' wechseln, da sie anscheinend nicht existiert\n" %
                            (config_backend.getGroup()),
                        log.LOGLEVEL["fatal"])
        exit(1)
except OSError:
        log.writeLogLV(config_backend.getLogfile(),
                        "Konnte die Gruppe nicht auf '%s' wechseln, da die Rechte dazu fehlen\n" %
                            (config_backend.getGroup()),
                        log.LOGLEVEL["fatal"])
        exit(1)
except:
        log.writeLogLV(config_backend.getLogfile(),
                        "Konnte die Gruppe aus unbekannten Gründen nicht auf '%s' wechseln\n" %
                            (config_backend.getGroup()),
                        log.LOGLEVEL["fatal"])
        if config_backend.getDebug():
            traceback.print_exc()
        exit(1)

log.writeLogLV(config_backend.getLogfile(),
                    "Setze User '%s' für Prozess %s\n" % (config_backend.getUser(), os.getpid()),
                    log.LOGLEVEL["debug"])
try:
    core.setuid(config_backend.getUser())
except KeyError:
        log.writeLogLV(config_backend.getLogfile(),
                        "Konnte den User nicht auf '%s' wechseln, da er anscheinend nicht existiert\n" %
                            (config_backend.getUser()),
                        log.LOGLEVEL["fatal"])
        exit(1)
except OSError: