summaryrefslogtreecommitdiffstats
path: root/libxrdp/xrdp_mcs.c
diff options
context:
space:
mode:
authorArvidNorr <norrarvid@gmail.com>2013-01-16 01:28:35 -0800
committerArvidNorr <norrarvid@gmail.com>2013-01-16 01:28:35 -0800
commita2bbbd8cc336bedbda61a6af47d90bcccbe6aead (patch)
tree9329f489b5dd4e245ee4c635d7dd18f553e260f3 /libxrdp/xrdp_mcs.c
parentb2c242f50eed96431e19c5905fc1c0269709da7c (diff)
downloadxrdp-proprietary-a2bbbd8cc336bedbda61a6af47d90bcccbe6aead.tar.gz
xrdp-proprietary-a2bbbd8cc336bedbda61a6af47d90bcccbe6aead.zip
Display PAM error in gateway setup, use domain name as IP/DNS, changed how the socket is closed
Diffstat (limited to 'libxrdp/xrdp_mcs.c')
-rw-r--r--libxrdp/xrdp_mcs.c28
1 files changed, 25 insertions, 3 deletions
diff --git a/libxrdp/xrdp_mcs.c b/libxrdp/xrdp_mcs.c
index 77c0d10d..e5481c9c 100644
--- a/libxrdp/xrdp_mcs.c
+++ b/libxrdp/xrdp_mcs.c
@@ -819,6 +819,25 @@ xrdp_mcs_send(struct xrdp_mcs *self, struct stream *s, int chan)
return 0;
}
+/**
+ * Internal help function to close the socket
+ * @param self
+ */
+void close_rdp_socket(struct xrdp_mcs *self)
+{
+ if(self->iso_layer->tcp_layer)
+ {
+ if(self->iso_layer->tcp_layer->trans)
+ {
+ g_tcp_close(self->iso_layer->tcp_layer->trans->sck);
+ self->iso_layer->tcp_layer->trans->sck = 0 ;
+ g_writeln("xrdp_mcs_disconnect - socket closed");
+ return ;
+ }
+ }
+ g_writeln("Failed to close socket");
+}
+
/*****************************************************************************/
/* returns error */
int APP_CC
@@ -833,7 +852,8 @@ xrdp_mcs_disconnect(struct xrdp_mcs *self)
if (xrdp_iso_init(self->iso_layer, s) != 0)
{
free_stream(s);
- DEBUG((" out xrdp_mcs_disconnect error"));
+ close_rdp_socket(self);
+ DEBUG((" out xrdp_mcs_disconnect error - 1"));
return 1;
}
@@ -844,11 +864,13 @@ xrdp_mcs_disconnect(struct xrdp_mcs *self)
if (xrdp_iso_send(self->iso_layer, s) != 0)
{
free_stream(s);
- DEBUG((" out xrdp_mcs_disconnect error"));
+ close_rdp_socket(self);
+ DEBUG((" out xrdp_mcs_disconnect error - 2"));
return 1;
}
free_stream(s);
- DEBUG((" out xrdp_mcs_disconnect"));
+ close_rdp_socket(self);
+ DEBUG(("xrdp_mcs_disconnect - close sent"));
return 0;
}