AM_CONDITIONAL(HAVE_WAYLAND_ONLY, [test "x${have_wayland_only}" = xyes])
if test "x${have_wayland_only}" = "xyes"; then
- PKG_CHECK_MODULES(ENLIGHTENMENT, [enlightenment, dlog, libtbm, pixman-1, wayland-server, tizen-extension-server, freerdp2])
+ PKG_CHECK_MODULES(ENLIGHTENMENT, [enlightenment, dlog, libtbm, pixman-1, wayland-server, tizen-extension-server, freerdp2, winpr2, winpr-tools2])
PKG_CHECK_MODULES(WAYLAND_SCANNER, wayland-scanner)
else
PKG_CHECK_MODULES(ENLIGHTENMENT, [enlightenment, dlog, libtbm, pixman-1, x11, utilX])
#include <freerdp/locale/keyboard.h>
#include <winpr/input.h>
#include <winpr/ssl.h>
+#include <winpr/tools/makecert.h>
#include <pixman.h>
#include <tbm_surface.h>
#define RDP_DEBUG 0
#define RDP_CURSOR_DEBUG 0
+#define RDP_PATH_LEN 1024
+
#define E_RDP_WIDTH 1280
#define E_RDP_HEIGHT 720
#define E_RDP_DEVICE_NAME "rdp_input"
return temp_y * output->mouse_scale_h;
}
+static Eina_Bool
+_e_rdp_file_check(const char *fname)
+{
+ struct stat info;
+
+ if (stat(fname, &info) == 0)
+ return EINA_TRUE;
+
+ return EINA_FALSE;
+}
+
+static Eina_Bool
+_e_rdp_dir_check(const char *dname)
+{
+ struct stat info;
+
+ if (stat(dname, &info) != 0)
+ return EINA_FALSE;
+ else if (info.st_mode & S_IFDIR)
+ return EINA_TRUE;
+
+ return EINA_FALSE;
+}
+
+static void
+_e_rdp_certificate(E_Rdp_Backend *b)
+{
+ MAKECERT_CONTEXT* makecert = NULL;
+ char path[RDP_PATH_LEN] = {0,};
+ char name[RDP_PATH_LEN] = {0,};
+ char temp[RDP_PATH_LEN] = {0,};
+ char key[RDP_PATH_LEN] = {0,};
+ char *buf = NULL, *buf_ptr = NULL, *buf2 = NULL, *buf_ptr2 = NULL;
+ char *makecert_parameter[13] = {"makecert", "-rdp", "-silent", "-n", NULL, "-path", NULL, "-y", "100", "-format", "crt", "-a", "sha256"};
+
+ // certificate already exist
+ if (_e_rdp_file_check(b->server_key) && _e_rdp_file_check(b->server_cert))
+ return;
+
+ strncpy(key, b->server_key, RDP_PATH_LEN - 1);
+
+ buf = strtok_r(key, "/", &buf_ptr);
+ if (buf == NULL)
+ {
+ ERR("certificate name error");
+ return;
+ }
+ path[0] = '/';
+ path[1] = '\0';
+
+ while (buf)
+ {
+ strncpy(temp, buf, RDP_PATH_LEN - 1);
+ buf = strtok_r(NULL, "/", &buf_ptr);
+ if (buf == NULL)
+ {
+ buf2 = strtok_r(temp, ".", &buf_ptr2);
+ strncpy(name, buf2, RDP_PATH_LEN - 1);
+ }
+ else
+ {
+ strncat(path, temp, RDP_PATH_LEN - strlen(path));
+ strncat(path, "/", 1);
+ if (_e_rdp_dir_check(path) == EINA_FALSE)
+ {
+ if ((mkdir(path, 0755)) < 0)
+ {
+ ERR("mkdir failed %s", path);
+ return;
+ }
+ }
+ }
+ }
+ makecert_parameter[4] = name;
+ makecert_parameter[6] = path;
+
+ makecert = makecert_context_new();
+ if (!makecert)
+ {
+ ERR("makecert_context_new failed");
+ return;
+ }
+
+ if (makecert_context_process(makecert, 13, makecert_parameter) < 0)
+ {
+ ERR("makecert_context_process failed");
+ goto out;
+ }
+
+ INF("create certificate - path:%s, name:%s", path, name);
+ sync();
+
+out:
+ makecert_context_free(makecert);
+}
+
static BOOL
e_rdp_peer_capabilities(freerdp_peer *client)
{
goto err_config;
b->tls_enabled = 1;
}
+ if (b->tls_enabled == 0 && b->rdp_key == NULL)
+ ERR("need key or certificate");
+
+ if (b->tls_enabled == 1 && config->auto_cert == 1)
+ _e_rdp_certificate(b);
b->output = e_rdp_output_create();
if (!b->output)
return EINA_FALSE;
}
- DBG("bindaddress:%s, rdp_key:%s, server_cert:%s, server_key:%s, port:%d, noresize:%d, nocompress:%d, motionless:%d",
+ DBG("bindaddress:%s, rdp_key:%s, server_cert:%s, server_key:%s, port:%d, noresize:%d, nocompress:%d, motionless:%d, auto_cert:%d",
config->conf->bind_address?:"no_bind_address", config->conf->rdp_key?:"no_rdp_key",
config->conf->server_cert?:"no_server_cert", config->conf->server_key?:"no_server_key",
- config->conf->port, config->conf->no_clients_resize, config->conf->force_no_compression, config->conf->motionless);
+ config->conf->port, config->conf->no_clients_resize, config->conf->force_no_compression, config->conf->motionless,
+ config->conf->auto_cert);
return EINA_TRUE;
}
E_CONFIG_VAL(D, T, no_clients_resize, INT);
E_CONFIG_VAL(D, T, force_no_compression, INT);
E_CONFIG_VAL(D, T, motionless, INT);
+ E_CONFIG_VAL(D, T, auto_cert, INT);
#undef T
#undef D
config->conf = e_config_domain_load("module.rdp", config->conf_edd);