From c74a30b50c7afe0a492c77751cbccd638a0b9f69 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Mon, 2 Jul 2018 16:14:10 +0200 Subject: Ogon RDP support: initial draft to support Ogon RDP as remote desktop technology. --- src/rda.c | 17 +++++++++++ src/rda.h | 1 + src/rda_ogon.c | 94 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/rda_ogon.h | 41 +++++++++++++++++++++++++ 4 files changed, 153 insertions(+) create mode 100644 src/rda_ogon.c create mode 100644 src/rda_ogon.h (limited to 'src') diff --git a/src/rda.c b/src/rda.c index 4a1e662..055d0a2 100644 --- a/src/rda.c +++ b/src/rda.c @@ -26,6 +26,7 @@ #include #include +#include #include guint @@ -58,6 +59,9 @@ rda_session_is_remote (void) if (rda_session_is_x2go()) return TRUE; + if (rda_session_is_ogon()) + return TRUE; + /* possibly add more checks for other remote desktop technologies */ else if (rda_session_is_local()) @@ -96,6 +100,10 @@ rda_get_remote_technology_name (void) remote_technology_name = _("X2Go"); break; + case REMOTE_TECHNOLOGY_OGON: + remote_technology_name = _("OgonRDP"); + break; + case REMOTE_TECHNOLOGY_UNKNOWN: remote_technology_name = _("unknown"); @@ -113,6 +121,9 @@ rda_session_can_be_suspended(void) if (rda_session_is_x2go()) return TRUE; + if (rda_session_is_ogon()) + return TRUE; + /* possibly add more checks for other remote desktop frameworks that have a session suspension feature */ @@ -125,6 +136,9 @@ rda_session_suspend(void) if (rda_session_is_x2go()) return rda_session_suspend_x2go(); + if (rda_session_is_ogon()) + return rda_session_suspend_ogon(); + return FALSE; } @@ -134,5 +148,8 @@ rda_session_terminate(void) if (rda_session_is_x2go()) return rda_session_terminate_x2go(); + if (rda_session_is_ogon()) + return rda_session_terminate_ogon(); + return FALSE; } diff --git a/src/rda.h b/src/rda.h index 9752b64..366e0ce 100644 --- a/src/rda.h +++ b/src/rda.h @@ -31,6 +31,7 @@ enum { REMOTE_TECHNOLOGY_NONE, REMOTE_TECHNOLOGY_UNKNOWN, REMOTE_TECHNOLOGY_X2GO, + REMOTE_TECHNOLOGY_OGON, }; extern guint diff --git a/src/rda_ogon.c b/src/rda_ogon.c new file mode 100644 index 0000000..ab86b57 --- /dev/null +++ b/src/rda_ogon.c @@ -0,0 +1,94 @@ +/* -*- Mode: C; c-set-style: linux indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ + +/* rda_ogon.c - Remote Desktop Awareness for Ogon RDP Sessions + + Copyright (C) 2018 Mike Gabriel + All rights reserved. + + The RDA Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The RDA Library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the Mate Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + Boston, MA 02110-1301, USA. + */ + +#include +#include + +#include + +gboolean +rda_session_is_ogon (void) +{ + if (remote_technology == REMOTE_TECHNOLOGY_OGON) + return TRUE; + + if (g_getenv("OGON_SID")) + { + remote_technology = REMOTE_TECHNOLOGY_OGON; + return TRUE; + } + + return FALSE; +} + +gboolean +rda_session_suspend_ogon(void) +{ + if (!rda_session_is_ogon()) + return FALSE; + + gint exit_status = 0; + gchar *std_out, *std_err; + GError *error = NULL; + + g_spawn_command_line_sync("ogon-disonnect", + &std_out, + &std_err, + &exit_status, + &error); + + if (error == NULL) + { + return TRUE; + } else { + // FIXME: Maybe put some error reporting to a higher API level + // here... + return FALSE; + } +} + +gboolean +rda_session_terminate_ogon(void) +{ + if (!rda_session_is_ogon()) + return FALSE; + + gint exit_status = 0; + gchar *std_out, *std_err; + GError *error = NULL; + + g_spawn_command_line_sync("ogon-logout", + &std_out, + &std_err, + &exit_status, + &error); + + if (error == NULL) + { + return TRUE; + } else { + // FIXME: Maybe put some error reporting to a higher API level + // here... + return FALSE; + } +} diff --git a/src/rda_ogon.h b/src/rda_ogon.h new file mode 100644 index 0000000..081856c --- /dev/null +++ b/src/rda_ogon.h @@ -0,0 +1,41 @@ +/* -*- Mode: C; c-set-style: linux indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ + +/* rda_x2go.c - Remote Desktop Awareness for Ogon RDP Sessions + + Copyright (C) 2018 Mike Gabriel + All rights reserved. + + The RDA Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The RDA Library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the Mate Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + Boston, MA 02110-1301, USA. + */ + +#ifndef RDA_OGON_H +#define RDA_OGON_H + +#include +#include + +#include + +gboolean +rda_session_is_ogon (void); + +gboolean +rda_session_suspend_ogon (void); + +gboolean +rda_session_terminate_ogon (void); + +#endif /* RDA_OGON_H */ -- cgit v1.2.3