xpra icon
Bug tracker and wiki

This bug tracker and wiki are being discontinued
please use https://github.com/Xpra-org/xpra instead.


Ticket #2125: paket handler.patch

File paket handler.patch, 3.7 KB (added by brief, 3 years ago)
  • trunk/src/xpra/server/server_core.py

     
    677677        netlog("initializing packet handlers")
    678678        self._default_packet_handlers = {
    679679            "hello":                                self._process_hello,
     680            "register":                             self._process_register,
    680681            "disconnect":                           self._process_disconnect,
    681682            "udp-control":                          self._process_udp_control,
    682683            Protocol.CONNECTION_LOST:               self._process_connection_lost,
     
    14111412        proto.send_now(("hello", {"version" : version}))
    14121413        #client is meant to close the connection itself, but just in case:
    14131414        self.timeout_add(5*1000, self.send_disconnect, proto, DONE, "version sent")
     1415    def _process_hello(self, proto, packet):
     1416        success, c = self._process(proto, packet)
     1417        if not success:
     1418            return
    14141419
    1415     def _process_hello(self, proto, packet):
     1420        #this will call auth_verified if successful
     1421        #it may also just send challenge packets,
     1422        #in which case we'll end up here parsing the hello again
     1423        start_thread(self.verify_auth, "authenticate connection", daemon=True, args=(proto, packet, c))
     1424    # process:
     1425    def _process(self, proto, packet):
    14161426        capabilities = packet[1]
    14171427        c = typedict(capabilities)
    14181428        proto.set_compression_level(c.intget("compression_level", self.compression_level))
     
    14221432            #if we got here, we parsed a packet from the client!
    14231433            #(maybe the client used an encoding it claims not to support?)
    14241434            self.disconnect_client(proto, PROTOCOL_ERROR, "failed to negotiate a packet encoder")
    1425             return
     1435            return False, null
    14261436
    14271437        log("process_hello: capabilities=%s", capabilities)
    14281438        if c.boolget("version_request"):
    14291439            self.send_version_info(proto, c.boolget("full-version-request"))
    1430             return
     1440            return True, null
    14311441        #verify version:
    14321442        remote_version = c.strget("version")
    14331443        verr = version_compat_check(remote_version)
     
    14341444        if verr is not None:
    14351445            self.disconnect_client(proto, VERSION_ERROR, "incompatible version: %s" % verr)
    14361446            proto.close()
     1447            return False, null
     1448
     1449        return True, c
     1450
     1451    ######################################################################
     1452    # register:
     1453    def _process_register(self, proto, packet):
     1454        log.error("register_server")
     1455
     1456        success, c = self._process(proto, packet)
     1457        if not success:
    14371458            return
    1438         #this will call auth_verified if successful
    1439         #it may also just send challenge packets,
    1440         #in which case we'll end up here parsing the hello again
    1441         start_thread(self.verify_auth, "authenticate connection", daemon=True, args=(proto, packet, c))
    14421459
     1460        options = c.dictget("register-options")
     1461        log.error(csv(options))
     1462
     1463        from mod_python import apache
     1464        session = self.get_remote_host(apache.REMOTE_NOLOOKUP)
     1465        log.error(csv(session))
     1466
     1467        answer = {}
     1468        answer.message =  add_user(self.filename, "foo", "bar", "nonody", "nobody", session, "", "")
     1469
     1470        log.error(csv(answer))
     1471
     1472        proto.send_now(("registered", answer))
     1473
     1474
     1475
     1476    ######################################################################
     1477
     1478
    14431479    def make_authenticators(self, socktype, username, conn):
    14441480        authlog("make_authenticators%s", (socktype, username, conn))
    14451481        authenticators = []