diff --git a/include/freerdp/peer.h b/include/freerdp/peer.h index bbe120cf5..9798b966b 100644 --- a/include/freerdp/peer.h +++ b/include/freerdp/peer.h @@ -30,6 +30,7 @@ typedef boolean (*psPeerInitialize)(freerdp_peer* client); typedef boolean (*psPeerGetFileDescriptor)(freerdp_peer* client, void** rfds, int* rcount); typedef boolean (*psPeerCheckFileDescriptor)(freerdp_peer* client); typedef void (*psPeerDisconnect)(freerdp_peer* client); +typedef boolean (*psPeerPostConnect)(freerdp_peer* client); struct rdp_freerdp_peer { @@ -45,6 +46,8 @@ struct rdp_freerdp_peer psPeerGetFileDescriptor GetFileDescriptor; psPeerCheckFileDescriptor CheckFileDescriptor; psPeerDisconnect Disconnect; + + psPeerPostConnect PostConnect; }; FREERDP_API freerdp_peer* freerdp_peer_new(int sockfd); diff --git a/libfreerdp-core/peer.c b/libfreerdp-core/peer.c index 36f3952f0..7593bf581 100644 --- a/libfreerdp-core/peer.c +++ b/libfreerdp-core/peer.c @@ -82,6 +82,11 @@ static boolean peer_read_data_pdu(rdpPeer* peer, STREAM* s) case DATA_PDU_TYPE_FONT_LIST: if (!rdp_server_accept_client_font_list_pdu(peer->rdp, s)) return False; + if (peer->client->PostConnect) + { + if (!peer->client->PostConnect(peer->client)) + return False; + } break; default: diff --git a/server/test/freerdp_server.c b/server/test/freerdp_server.c index 5d9e58f74..899fb894f 100644 --- a/server/test/freerdp_server.c +++ b/server/test/freerdp_server.c @@ -26,6 +26,29 @@ #include #include +boolean test_peer_post_connect(freerdp_peer* client) +{ + /** + * This callback is called when the entire connection sequence is done, i.e. we've received the + * Font List PDU from the client and sent out the Font Map PDU. + * The server may start sending graphics output and receiving keyboard/mouse input after this + * callback returns. + */ + printf("Client %s is activated", client->settings->hostname); + if (client->settings->autologon) + { + printf(" and wants to login automatically as %s\\%s", + client->settings->domain ? client->settings->domain : "", + client->settings->username); + + /* A real server may perform OS login here if NLA is not executed previously. */ + } + printf("\n"); + + /* Return False here would stop the execution of the peer mainloop. */ + return True; +} + static void* test_peer_mainloop(void* arg) { freerdp_peer* client = (freerdp_peer*)arg; @@ -43,6 +66,8 @@ static void* test_peer_mainloop(void* arg) client->settings->cert_file = xstrdup("server.crt"); client->settings->privatekey_file = xstrdup("server.key"); client->settings->nla_security = False; + + client->PostConnect = test_peer_post_connect; client->Initialize(client); while (1)