From 2a2fe635038e5c56ea21c3e7c620c9fd4d45aa2a Mon Sep 17 00:00:00 2001 From: Nathan Wagner Date: Sat, 15 Feb 2025 18:32:52 -0500 Subject: [PATCH 001/150] Update websocket.c Host header, Connection, and Authorization header should not be case sensitive --- common/network/websocket.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/common/network/websocket.c b/common/network/websocket.c index f128ffe..49d3a25 100644 --- a/common/network/websocket.c +++ b/common/network/websocket.c @@ -644,7 +644,7 @@ int parse_handshake(ws_ctx_t *ws_ctx, char *handshake) { strncpy(headers->path, start, end-start); headers->path[end-start] = '\0'; - start = strstr(handshake, "\r\nHost: "); + start = strcasestr(handshake, "\r\nHost: "); if (!start) { err("missing Host header"); return 0; } start += 8; end = strstr(start, "\r\n"); @@ -681,7 +681,7 @@ int parse_handshake(ws_ctx_t *ws_ctx, char *handshake) { strncpy(headers->key1, start, end-start); headers->key1[end-start] = '\0'; - start = strstr(handshake, "\r\nConnection: "); + start = strcasestr(handshake, "\r\nConnection: "); if (!start) { err("missing Connection header"); return 0; } start += 14; end = strstr(start, "\r\n"); @@ -1883,7 +1883,7 @@ ws_ctx_t *do_handshake(int sock, char * const ip) { unsigned char owner = 0; char inuser[USERNAME_LEN] = "-"; if (!settings.disablebasicauth) { - const char *hdr = strstr(handshake, "Authorization: Basic "); + const char *hdr = strcasestr(handshake, "Authorization: Basic "); if (!hdr) { bl_addFailure(ip); wserr("Authentication attempt failed, BasicAuth required, but client didn't send any\n"); From 462060189159c0056d98b9cc701e5126a154908e Mon Sep 17 00:00:00 2001 From: El Date: Mon, 17 Mar 2025 17:15:52 +0500 Subject: [PATCH 002/150] KASM-6773 Define WS_MAX_BUF_SIZE for buffer size standardization --- common/network/websocket.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/common/network/websocket.c b/common/network/websocket.c index f128ffe..bba66aa 100644 --- a/common/network/websocket.c +++ b/common/network/websocket.c @@ -70,6 +70,8 @@ void fatal(char *msg) exit(1); } +#define WS_MAX_BUF_SIZE 4096 + // 2022-05-18 19:51:26,810 [INFO] websocket 0: 71.62.44.0 172.12.15.5 - "GET /api/get_frame_stats?client=auto HTTP/1.1" 403 2 static void weblog(const unsigned code, const unsigned websocket, const uint8_t debug, @@ -834,7 +836,7 @@ static uint8_t isValidIp(const char *str, const unsigned len) { static void dirlisting(ws_ctx_t *ws_ctx, const char fullpath[], const char path[], const char * const user, const char * const ip, const char * const origip) { - char buf[4096]; + char buf[WS_MAX_BUF_SIZE]; char enc[PATH_MAX * 3 + 1]; unsigned i; @@ -895,7 +897,7 @@ static void dirlisting(ws_ctx_t *ws_ctx, const char fullpath[], const char path[ static void servefile(ws_ctx_t *ws_ctx, const char *in, const char * const user, const char * const ip, const char * const origip) { - char buf[4096], path[4096], fullpath[4096]; + char buf[WS_MAX_BUF_SIZE], path[PATH_MAX], fullpath[PATH_MAX]; //fprintf(stderr, "http servefile input '%s'\n", in); @@ -965,7 +967,7 @@ static void servefile(ws_ctx_t *ws_ctx, const char *in, const char * const user, //fprintf(stderr, "http servefile output '%s'\n", buf); unsigned count; - while ((count = fread(buf, 1, 4096, f))) { + while ((count = fread(buf, 1, WS_MAX_BUF_SIZE, f))) { ws_send(ws_ctx, buf, count); } fclose(f); @@ -1020,7 +1022,7 @@ notfound: } static void send403(ws_ctx_t *ws_ctx, const char * const origip, const char * const ip) { - char buf[4096]; + char buf[WS_MAX_BUF_SIZE]; sprintf(buf, "HTTP/1.1 403 Forbidden\r\n" "Server: KasmVNC/4.0\r\n" "Connection: close\r\n" @@ -1034,7 +1036,7 @@ static void send403(ws_ctx_t *ws_ctx, const char * const origip, const char * co static void send400(ws_ctx_t *ws_ctx, const char * const origip, const char * const ip, const char *info) { - char buf[4096]; + char buf[WS_MAX_BUF_SIZE]; sprintf(buf, "HTTP/1.1 400 Bad Request\r\n" "Server: KasmVNC/4.0\r\n" "Connection: close\r\n" @@ -1048,7 +1050,7 @@ static void send400(ws_ctx_t *ws_ctx, const char * const origip, const char * co static uint8_t ownerapi_post(ws_ctx_t *ws_ctx, const char *in, const char * const user, const char * const ip, const char * const origip) { - char buf[4096], path[4096]; + char buf[WS_MAX_BUF_SIZE], path[PATH_MAX]; uint8_t ret = 0; // 0 = continue checking in += 5; @@ -1237,7 +1239,7 @@ nope: static uint8_t ownerapi(ws_ctx_t *ws_ctx, const char *in, const char * const user, const char * const ip, const char * const origip) { - char buf[4096], path[4096], args[4096] = "", origpath[4096]; + char buf[WS_MAX_BUF_SIZE], path[PATH_MAX], args[PATH_MAX] = "", origpath[PATH_MAX]; uint8_t ret = 0; // 0 = continue checking if (strncmp(in, "GET ", 4)) { From 4e087ba790c239a0795cbac03f56e55812678e45 Mon Sep 17 00:00:00 2001 From: El Date: Mon, 17 Mar 2025 17:17:03 +0500 Subject: [PATCH 003/150] KASM-6773 Refactor JSON_escape to use switch-case and handle NULL input --- common/network/jsonescape.c | 56 ++++++++++++++++++++++--------------- 1 file changed, 33 insertions(+), 23 deletions(-) diff --git a/common/network/jsonescape.c b/common/network/jsonescape.c index 4bb0ef8..748e9e1 100644 --- a/common/network/jsonescape.c +++ b/common/network/jsonescape.c @@ -24,30 +24,40 @@ #include "cJSON.h" void JSON_escape(const char *in, char *out) { + if (!in) + return; + for (; *in; in++) { - if (in[0] == '\b') { - *out++ = '\\'; - *out++ = 'b'; - } else if (in[0] == '\f') { - *out++ = '\\'; - *out++ = 'f'; - } else if (in[0] == '\n') { - *out++ = '\\'; - *out++ = 'n'; - } else if (in[0] == '\r') { - *out++ = '\\'; - *out++ = 'r'; - } else if (in[0] == '\t') { - *out++ = '\\'; - *out++ = 't'; - } else if (in[0] == '"') { - *out++ = '\\'; - *out++ = '"'; - } else if (in[0] == '\\') { - *out++ = '\\'; - *out++ = '\\'; - } else { - *out++ = *in; + switch (*in) { + case '\b': + *out++ = '\\'; + *out++ = 'b'; + break; + case '\f': + *out++ = '\\'; + *out++ = 'f'; + case '\n': + *out++ = '\\'; + *out++ = 'n'; + break; + case '\r': + *out++ = '\\'; + *out++ = 'r'; + break; + case '\t': + *out++ = '\\'; + *out++ = 't'; + break; + case '"': + *out++ = '\\'; + *out++ = '"'; + break; + case '\\': + *out++ = '\\'; + *out++ = '\\'; + break; + default: + *out++ = *in; } } From 4973781a8f8926bd5b8102424529a59299494c4a Mon Sep 17 00:00:00 2001 From: El Date: Mon, 17 Mar 2025 17:19:57 +0500 Subject: [PATCH 004/150] KASM-6773 Use snprintf instead of sprintf for safer path handling --- common/network/websocket.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/network/websocket.c b/common/network/websocket.c index bba66aa..549181a 100644 --- a/common/network/websocket.c +++ b/common/network/websocket.c @@ -1689,7 +1689,7 @@ static uint8_t ownerapi(ws_ctx_t *ws_ctx, const char *in, const char * const use if (!strcmp(ent->d_name, ".") || !strcmp(ent->d_name, "..")) continue; - sprintf(path, "%s/%s", allpath, ent->d_name); + snprintf(path, PATH_MAX, "%s/%s", allpath, ent->d_name); struct stat st; if (lstat(path, &st)) continue; From 0df5d5bd728953aa9e247ae324cd018b6d08a768 Mon Sep 17 00:00:00 2001 From: El Date: Mon, 17 Mar 2025 17:20:26 +0500 Subject: [PATCH 005/150] KASM-6773 Escape JSON filenames in WebSocket file list responses --- common/network/websocket.c | 56 +++++++++++++++++++++++--------------- 1 file changed, 34 insertions(+), 22 deletions(-) diff --git a/common/network/websocket.c b/common/network/websocket.c index 549181a..808d8d8 100644 --- a/common/network/websocket.c +++ b/common/network/websocket.c @@ -1673,11 +1673,11 @@ static uint8_t ownerapi(ws_ctx_t *ws_ctx, const char *in, const char * const use } sprintf(buf, "HTTP/1.1 200 OK\r\n" - "Server: KasmVNC/4.0\r\n" - "Connection: close\r\n" - "Content-type: text/json\r\n" - "%s" - "\r\n", extra_headers ? extra_headers : ""); + "Server: KasmVNC/4.0\r\n" + "Connection: close\r\n" + "Content-type: text/json\r\n" + "%s" + "\r\n", extra_headers ? extra_headers : ""); ws_send(ws_ctx, buf, strlen(buf)); len = 15; @@ -1711,23 +1711,35 @@ static uint8_t ownerapi(ws_ctx_t *ws_ctx, const char *in, const char * const use strcpy(grp, grpt.gr_name); } - sprintf(buf, "%s{ \"filename\": \"%s\", " - "\"date_modified\": %lu, " - "\"date_created\": %lu, " - "\"is_dir\": %s, " - "\"size\": %lu, " - "\"owner\": \"%s\", " - "\"group\": \"%s\", " - "\"perms\": \"%s\" }", - sent ? ",\n" : "", - ent->d_name, - st.st_mtime, - st.st_ctime, - S_ISDIR(st.st_mode) ? "true" : "false", - S_ISDIR(st.st_mode) ? 0 : st.st_size, - own, - grp, - perms); + sprintf(buf, "%s{ \"filename\": \"", sent ? ",\n" : ""); + ws_send(ws_ctx, buf, strlen(buf)); + len += strlen(buf); + + size_t max_out_length = 2 * strlen(ent->d_name) + 1; // worst case scenario + char *filename = malloc(max_out_length); + + JSON_escape(ent->d_name, filename); + size_t size = strlen(filename); + ws_send(ws_ctx, filename, size); + len += size; + + free(filename); + + sprintf(buf, "\", " + "\"date_modified\": %lu, " + "\"date_created\": %lu, " + "\"is_dir\": %s, " + "\"size\": %lu, " + "\"owner\": \"%s\", " + "\"group\": \"%s\", " + "\"perms\": \"%s\" }", + st.st_mtime, + st.st_ctime, + S_ISDIR(st.st_mode) ? "true" : "false", + S_ISDIR(st.st_mode) ? 0 : st.st_size, + own, + grp, + perms); sent = 1; ws_send(ws_ctx, buf, strlen(buf)); len += strlen(buf); From f2a19e6e091f9d1c0456806dfe79f5ab7f13219a Mon Sep 17 00:00:00 2001 From: Dmitry Maksyoma Date: Thu, 20 Mar 2025 16:24:07 +1300 Subject: [PATCH 006/150] KASM-7051 Set KasmVNC version to 1.3.4 --- alpine/kasmvncserver/APKBUILD | 4 ++-- debian/changelog | 6 ++++++ fedora/kasmvncserver.spec | 4 +++- opensuse/kasmvncserver.spec | 4 +++- oracle/kasmvncserver.spec | 4 +++- oracle/kasmvncserver9.spec | 4 +++- unix/xserver/hw/vnc/xvnc.c | 2 +- 7 files changed, 21 insertions(+), 7 deletions(-) diff --git a/alpine/kasmvncserver/APKBUILD b/alpine/kasmvncserver/APKBUILD index b98d00b..2e8ba2a 100644 --- a/alpine/kasmvncserver/APKBUILD +++ b/alpine/kasmvncserver/APKBUILD @@ -3,8 +3,8 @@ # Contributor: # Maintainer: Kasm Technologies LLC pkgname=kasmvncserver -pkgver=1.3.3 -pkgrel=0 +pkgver=1.3.4 +pkgver=0 pkgdesc="KasmVNC provides remote web-based access to a Desktop or application." url="https://github.com/kasmtech/KasmVNC" arch="x86_64 aarch64" diff --git a/debian/changelog b/debian/changelog index 4e2536b..4641ac3 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +kasmvnc (1.3.4-1) unstable; urgency=medium + + * New upstream release. + + -- Kasm Technologies LLC Thu, 20 Mar 2025 03:21:46 +0000 + kasmvnc (1.3.3-1) unstable; urgency=medium * Allow disabling IP blacklist diff --git a/fedora/kasmvncserver.spec b/fedora/kasmvncserver.spec index 739530c..d7e45c5 100644 --- a/fedora/kasmvncserver.spec +++ b/fedora/kasmvncserver.spec @@ -1,5 +1,5 @@ Name: kasmvncserver -Version: 1.3.3 +Version: 1.3.4 Release: 1%{?dist} Summary: VNC server accessible from a web browser @@ -83,6 +83,8 @@ cd $DST_MAN && ln -s vncpasswd.1 kasmvncpasswd.1; %doc /usr/share/doc/kasmvncserver/README.md %changelog +* Thu Mar 20 2025 KasmTech - 1.3.4-1 +- Upstream release * Fri Oct 25 2024 KasmTech - 1.3.3-1 - Allow disabling IP blacklist - Downloads API for detailed file downloads information diff --git a/opensuse/kasmvncserver.spec b/opensuse/kasmvncserver.spec index e7fdba1..9840e24 100644 --- a/opensuse/kasmvncserver.spec +++ b/opensuse/kasmvncserver.spec @@ -1,5 +1,5 @@ Name: kasmvncserver -Version: 1.3.3 +Version: 1.3.4 Release: leap15 Summary: VNC server accessible from a web browser @@ -81,6 +81,8 @@ cd $DST_MAN && ln -s vncpasswd.1 kasmvncpasswd.1; %doc /usr/share/doc/kasmvncserver/README.md %changelog +* Thu Mar 20 2025 KasmTech - 1.3.4-leap15 +- Upstream release * Fri Oct 25 2024 KasmTech - 1.3.3-1 - Allow disabling IP blacklist - Downloads API for detailed file downloads information diff --git a/oracle/kasmvncserver.spec b/oracle/kasmvncserver.spec index 5edd055..15344ba 100644 --- a/oracle/kasmvncserver.spec +++ b/oracle/kasmvncserver.spec @@ -1,5 +1,5 @@ Name: kasmvncserver -Version: 1.3.3 +Version: 1.3.4 Release: 1%{?dist} Summary: VNC server accessible from a web browser @@ -82,6 +82,8 @@ cd $DST_MAN && ln -s vncpasswd.1 kasmvncpasswd.1; %doc /usr/share/doc/kasmvncserver/README.md %changelog +* Thu Mar 20 2025 KasmTech - 1.3.4-1 +- Upstream release * Fri Oct 25 2024 KasmTech - 1.3.3-1 - Allow disabling IP blacklist - Downloads API for detailed file downloads information diff --git a/oracle/kasmvncserver9.spec b/oracle/kasmvncserver9.spec index 482587c..40dd966 100644 --- a/oracle/kasmvncserver9.spec +++ b/oracle/kasmvncserver9.spec @@ -1,5 +1,5 @@ Name: kasmvncserver -Version: 1.3.3 +Version: 1.3.4 Release: 1%{?dist} Summary: VNC server accessible from a web browser @@ -82,6 +82,8 @@ cd $DST_MAN && ln -s vncpasswd.1 kasmvncpasswd.1; %doc /usr/share/doc/kasmvncserver/README.md %changelog +* Thu Mar 20 2025 KasmTech - 1.3.4-1 +- Upstream release * Fri Oct 25 2024 KasmTech - 1.3.3-1 - Allow disabling IP blacklist - Downloads API for detailed file downloads information diff --git a/unix/xserver/hw/vnc/xvnc.c b/unix/xserver/hw/vnc/xvnc.c index cc500f4..7c196dc 100644 --- a/unix/xserver/hw/vnc/xvnc.c +++ b/unix/xserver/hw/vnc/xvnc.c @@ -95,7 +95,7 @@ from the X Consortium. #undef VENDOR_STRING #include "version-config.h" -#define XVNCVERSION "KasmVNC 1.3.3" +#define XVNCVERSION "KasmVNC 1.3.4" #define XVNCCOPYRIGHT ("Copyright (C) 1999-2018 KasmVNC Team and many others (see README.me)\n" \ "See http://kasmweb.com for information on KasmVNC.\n") From 16d02f6c2f9f6327d491e33a05a9c6a85f7ea6bf Mon Sep 17 00:00:00 2001 From: Dmitry Maksyoma Date: Thu, 20 Mar 2025 17:21:44 +1300 Subject: [PATCH 007/150] KASM-7051 Fix APKBUILD by adding pkgrel --- alpine/kasmvncserver/APKBUILD | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/alpine/kasmvncserver/APKBUILD b/alpine/kasmvncserver/APKBUILD index 2e8ba2a..f5fb900 100644 --- a/alpine/kasmvncserver/APKBUILD +++ b/alpine/kasmvncserver/APKBUILD @@ -4,7 +4,7 @@ # Maintainer: Kasm Technologies LLC pkgname=kasmvncserver pkgver=1.3.4 -pkgver=0 +pkgrel=0 pkgdesc="KasmVNC provides remote web-based access to a Desktop or application." url="https://github.com/kasmtech/KasmVNC" arch="x86_64 aarch64" From 297554dd671e5eedbea45af69a691a11ce9d7200 Mon Sep 17 00:00:00 2001 From: Dmitry Maksyoma Date: Thu, 20 Mar 2025 17:23:11 +1300 Subject: [PATCH 008/150] KASM-7051 bump-package-version-apk: fix to produce pkgrel --- builder/bump-package-version-apk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builder/bump-package-version-apk b/builder/bump-package-version-apk index adf77fe..359fcd3 100755 --- a/builder/bump-package-version-apk +++ b/builder/bump-package-version-apk @@ -7,7 +7,7 @@ spec_file=alpine/kasmvncserver/APKBUILD bump_version() { sed -i "s/^pkgver=.\+/pkgver=$new_version/" "$1" - sed -i "s/^pkgrel=.\+/pkgver=0/" "$1" + sed -i "s/^pkgrel=.\+/pkgrel=0/" "$1" } bump_version $spec_file From 2e0da8f034c595cedc20e2fb0afddb8e84ebf939 Mon Sep 17 00:00:00 2001 From: Dmitry Maksyoma Date: Mon, 24 Mar 2025 17:11:51 +1300 Subject: [PATCH 009/150] KASM-7051 Fill release notes for deb and rpm --- debian/changelog | 5 ++++- fedora/kasmvncserver.spec | 5 ++++- opensuse/kasmvncserver.spec | 5 ++++- oracle/kasmvncserver.spec | 5 ++++- oracle/kasmvncserver9.spec | 5 ++++- 5 files changed, 20 insertions(+), 5 deletions(-) diff --git a/debian/changelog b/debian/changelog index 4641ac3..19f0a73 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,9 @@ kasmvnc (1.3.4-1) unstable; urgency=medium - * New upstream release. + * Add configuration key network.udp.payload_size. + * Remove support for distro versions that reached end-of-life. + * Add missing dependency on libdatetime-perl. + * Remove webpack to reduce security vulnerabilities. -- Kasm Technologies LLC Thu, 20 Mar 2025 03:21:46 +0000 diff --git a/fedora/kasmvncserver.spec b/fedora/kasmvncserver.spec index d7e45c5..f3873fb 100644 --- a/fedora/kasmvncserver.spec +++ b/fedora/kasmvncserver.spec @@ -84,7 +84,10 @@ cd $DST_MAN && ln -s vncpasswd.1 kasmvncpasswd.1; %changelog * Thu Mar 20 2025 KasmTech - 1.3.4-1 -- Upstream release +- Add configuration key network.udp.payload_size. +- Remove support for distro versions that reached end-of-life. +- Add missing dependency on hostname. +- Remove webpack to reduce security vulnerabilities. * Fri Oct 25 2024 KasmTech - 1.3.3-1 - Allow disabling IP blacklist - Downloads API for detailed file downloads information diff --git a/opensuse/kasmvncserver.spec b/opensuse/kasmvncserver.spec index 9840e24..cad1809 100644 --- a/opensuse/kasmvncserver.spec +++ b/opensuse/kasmvncserver.spec @@ -82,7 +82,10 @@ cd $DST_MAN && ln -s vncpasswd.1 kasmvncpasswd.1; %changelog * Thu Mar 20 2025 KasmTech - 1.3.4-leap15 -- Upstream release +- Add configuration key network.udp.payload_size. +- Remove support for distro versions that reached end-of-life. +- Add missing dependency on hostname. +- Remove webpack to reduce security vulnerabilities. * Fri Oct 25 2024 KasmTech - 1.3.3-1 - Allow disabling IP blacklist - Downloads API for detailed file downloads information diff --git a/oracle/kasmvncserver.spec b/oracle/kasmvncserver.spec index 15344ba..dd8a302 100644 --- a/oracle/kasmvncserver.spec +++ b/oracle/kasmvncserver.spec @@ -83,7 +83,10 @@ cd $DST_MAN && ln -s vncpasswd.1 kasmvncpasswd.1; %changelog * Thu Mar 20 2025 KasmTech - 1.3.4-1 -- Upstream release +- Add configuration key network.udp.payload_size. +- Remove support for distro versions that reached end-of-life. +- Add missing dependency on hostname. +- Remove webpack to reduce security vulnerabilities. * Fri Oct 25 2024 KasmTech - 1.3.3-1 - Allow disabling IP blacklist - Downloads API for detailed file downloads information diff --git a/oracle/kasmvncserver9.spec b/oracle/kasmvncserver9.spec index 40dd966..b317506 100644 --- a/oracle/kasmvncserver9.spec +++ b/oracle/kasmvncserver9.spec @@ -83,7 +83,10 @@ cd $DST_MAN && ln -s vncpasswd.1 kasmvncpasswd.1; %changelog * Thu Mar 20 2025 KasmTech - 1.3.4-1 -- Upstream release +- Add configuration key network.udp.payload_size. +- Remove support for distro versions that reached end-of-life. +- Add missing dependency on hostname. +- Remove webpack to reduce security vulnerabilities. * Fri Oct 25 2024 KasmTech - 1.3.3-1 - Allow disabling IP blacklist - Downloads API for detailed file downloads information From 6f13eac2d75edaabc8528eecbb95811cba4d3bb8 Mon Sep 17 00:00:00 2001 From: Dmitry Maksyoma Date: Mon, 24 Mar 2025 17:26:46 +1300 Subject: [PATCH 010/150] KASM-7051 Fill release notes for deb and rpm --- debian/changelog | 1 + fedora/kasmvncserver.spec | 1 + opensuse/kasmvncserver.spec | 1 + oracle/kasmvncserver.spec | 1 + oracle/kasmvncserver9.spec | 1 + 5 files changed, 5 insertions(+) diff --git a/debian/changelog b/debian/changelog index 19f0a73..3cb1e97 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,6 +4,7 @@ kasmvnc (1.3.4-1) unstable; urgency=medium * Remove support for distro versions that reached end-of-life. * Add missing dependency on libdatetime-perl. * Remove webpack to reduce security vulnerabilities. + * Special characters in filenames are now properly escaped, preventing invalid JSON. -- Kasm Technologies LLC Thu, 20 Mar 2025 03:21:46 +0000 diff --git a/fedora/kasmvncserver.spec b/fedora/kasmvncserver.spec index f3873fb..d9232b3 100644 --- a/fedora/kasmvncserver.spec +++ b/fedora/kasmvncserver.spec @@ -88,6 +88,7 @@ cd $DST_MAN && ln -s vncpasswd.1 kasmvncpasswd.1; - Remove support for distro versions that reached end-of-life. - Add missing dependency on hostname. - Remove webpack to reduce security vulnerabilities. +- Special characters in filenames are now properly escaped, preventing invalid JSON. * Fri Oct 25 2024 KasmTech - 1.3.3-1 - Allow disabling IP blacklist - Downloads API for detailed file downloads information diff --git a/opensuse/kasmvncserver.spec b/opensuse/kasmvncserver.spec index cad1809..275eb21 100644 --- a/opensuse/kasmvncserver.spec +++ b/opensuse/kasmvncserver.spec @@ -86,6 +86,7 @@ cd $DST_MAN && ln -s vncpasswd.1 kasmvncpasswd.1; - Remove support for distro versions that reached end-of-life. - Add missing dependency on hostname. - Remove webpack to reduce security vulnerabilities. +- Special characters in filenames are now properly escaped, preventing invalid JSON. * Fri Oct 25 2024 KasmTech - 1.3.3-1 - Allow disabling IP blacklist - Downloads API for detailed file downloads information diff --git a/oracle/kasmvncserver.spec b/oracle/kasmvncserver.spec index dd8a302..85751bd 100644 --- a/oracle/kasmvncserver.spec +++ b/oracle/kasmvncserver.spec @@ -87,6 +87,7 @@ cd $DST_MAN && ln -s vncpasswd.1 kasmvncpasswd.1; - Remove support for distro versions that reached end-of-life. - Add missing dependency on hostname. - Remove webpack to reduce security vulnerabilities. +- Special characters in filenames are now properly escaped, preventing invalid JSON. * Fri Oct 25 2024 KasmTech - 1.3.3-1 - Allow disabling IP blacklist - Downloads API for detailed file downloads information diff --git a/oracle/kasmvncserver9.spec b/oracle/kasmvncserver9.spec index b317506..8611c30 100644 --- a/oracle/kasmvncserver9.spec +++ b/oracle/kasmvncserver9.spec @@ -87,6 +87,7 @@ cd $DST_MAN && ln -s vncpasswd.1 kasmvncpasswd.1; - Remove support for distro versions that reached end-of-life. - Add missing dependency on hostname. - Remove webpack to reduce security vulnerabilities. +- Special characters in filenames are now properly escaped, preventing invalid JSON. * Fri Oct 25 2024 KasmTech - 1.3.3-1 - Allow disabling IP blacklist - Downloads API for detailed file downloads information From e647af5e281735d1c7fc676ca089201aeae7130a Mon Sep 17 00:00:00 2001 From: matt Date: Mon, 24 Mar 2025 12:18:11 +0000 Subject: [PATCH 011/150] Update novnc ref --- .gitmodules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index e43a13a..74a470e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +1,4 @@ [submodule "kasmweb"] path = kasmweb url = https://github.com/kasmtech/noVNC.git - branch = master + branch = release/1.2.3 From 0017991a5512939ca823287dd4d0e0d3ddb97b8e Mon Sep 17 00:00:00 2001 From: "ryan.kuba" Date: Tue, 11 Feb 2025 09:51:18 -0500 Subject: [PATCH 012/150] KASM-6788 use thread and future instead of openmp for image encoding --- common/rfb/EncodeManager.cxx | 41 ++++++++++++++++++++++++++++-------- common/rfb/EncodeManager.h | 3 ++- 2 files changed, 34 insertions(+), 10 deletions(-) diff --git a/common/rfb/EncodeManager.cxx b/common/rfb/EncodeManager.cxx index 1cbd32d..5730352 100644 --- a/common/rfb/EncodeManager.cxx +++ b/common/rfb/EncodeManager.cxx @@ -22,6 +22,12 @@ #include #include +#include +#include +#include +#include + + #include #include #include @@ -210,6 +216,7 @@ EncodeManager::EncodeManager(SConnection* conn_, EncCache *encCache_) : conn(con dynamicQualityMin = Server::dynamicQualityMin; dynamicQualityOff = Server::dynamicQualityMax - Server::dynamicQualityMin; } + std::atomic webpTookTooLong{false}; } EncodeManager::~EncodeManager() @@ -886,8 +893,7 @@ void EncodeManager::checkWebpFallback(const struct timeval *start) { unsigned us; us = msSince(start) * 1024; if (us > webpFallbackUs) - #pragma omp atomic - webpTookTooLong |= true; + webpTookTooLong = true; } } @@ -1130,8 +1136,10 @@ void EncodeManager::writeRects(const Region& changed, const PixelBuffer* pb, std::vector ms; uint32_t i; - if (rfb::Server::rectThreads > 0) - omp_set_num_threads(rfb::Server::rectThreads); + int num_threads = std::thread::hardware_concurrency(); + if (rfb::Server::rectThreads > 0) { + num_threads = rfb::Server::rectThreads; + } webpTookTooLong = false; changed.get_rects(&rects); @@ -1249,12 +1257,27 @@ void EncodeManager::writeRects(const Region& changed, const PixelBuffer* pb, } scalingTime = msSince(&scalestart); - #pragma omp parallel for schedule(dynamic, 1) + std::vector> futures; + futures.reserve(subrects.size()); for (i = 0; i < subrects.size(); ++i) { - encoderTypes[i] = getEncoderType(subrects[i], pb, &palettes[i], compresseds[i], - &isWebp[i], &fromCache[i], - scaledpb, scaledrects[i], ms[i]); - checkWebpFallback(start); + Rect subrect = subrects[i]; + const PixelBuffer* current_pb = pb; + uint8_t* current_encoderTypes = &encoderTypes[i]; + uint8_t* current_fromCache = &fromCache[i]; + const PixelBuffer* current_scaledpb = scaledpb; + Rect current_scaledrect = scaledrects[i]; + uint32_t* current_ms = &ms[i]; + const struct timeval* current_start = start; + auto task = [this, subrect, current_pb, &palettes, &compresseds, &isWebp, current_encoderTypes, current_fromCache, current_scaledpb, current_scaledrect, current_ms, current_start, i]() { + *current_encoderTypes = getEncoderType(subrect, current_pb, &palettes[i], compresseds[i], + &isWebp[i], current_fromCache, + current_scaledpb, current_scaledrect, *current_ms); + checkWebpFallback(current_start); + }; + futures.push_back(std::async(std::launch::async, task)); + } + for (auto& future : futures) { + future.get(); } for (i = 0; i < subrects.size(); ++i) { diff --git a/common/rfb/EncodeManager.h b/common/rfb/EncodeManager.h index 20ba837..7ff24bf 100644 --- a/common/rfb/EncodeManager.h +++ b/common/rfb/EncodeManager.h @@ -32,6 +32,7 @@ #include #include +#include #include namespace rfb { @@ -199,7 +200,7 @@ namespace rfb { size_t curMaxUpdateSize; unsigned webpFallbackUs; unsigned webpBenchResult; - bool webpTookTooLong; + std::atomic webpTookTooLong; unsigned encodingTime; unsigned maxEncodingTime, framesSinceEncPrint; unsigned scalingTime; From 84aa133511ccaf3c71df30b9f988980757e87263 Mon Sep 17 00:00:00 2001 From: El Date: Fri, 7 Mar 2025 01:04:46 +0500 Subject: [PATCH 013/150] KASM-6788 Refactor EncodeManager to use std::execution with parallel algorithms. Removes OpenMP dependency, improves atomic usage, and fixes various minor code quality issues including initialization and memory management --- common/rfb/EncodeManager.cxx | 117 ++++++++++++++--------------------- common/rfb/EncodeManager.h | 18 +++--- 2 files changed, 55 insertions(+), 80 deletions(-) diff --git a/common/rfb/EncodeManager.cxx b/common/rfb/EncodeManager.cxx index 5730352..5e94cdc 100644 --- a/common/rfb/EncodeManager.cxx +++ b/common/rfb/EncodeManager.cxx @@ -19,14 +19,7 @@ * USA. */ -#include -#include - -#include -#include -#include -#include - +#include #include #include @@ -50,6 +43,7 @@ #include #include #include +#include using namespace rfb; @@ -99,9 +93,9 @@ struct RectInfo { }; struct QualityInfo { - struct timeval lastUpdate; + struct timeval lastUpdate{}; Rect rect; - unsigned score; + unsigned score{}; }; }; @@ -216,7 +210,6 @@ EncodeManager::EncodeManager(SConnection* conn_, EncCache *encCache_) : conn(con dynamicQualityMin = Server::dynamicQualityMin; dynamicQualityOff = Server::dynamicQualityMax - Server::dynamicQualityMin; } - std::atomic webpTookTooLong{false}; } EncodeManager::~EncodeManager() @@ -887,13 +880,12 @@ void EncodeManager::findSolidRect(const Rect& rect, Region *changed, } } -void EncodeManager::checkWebpFallback(const struct timeval *start) { +void EncodeManager::checkWebpFallback(const timeval *start) { // Have we taken too long for the frame? If so, drop from WEBP to JPEG - if (start && activeEncoders[encoderFullColour] == encoderTightWEBP && !webpTookTooLong) { - unsigned us; - us = msSince(start) * 1024; + if (start && activeEncoders[encoderFullColour] == encoderTightWEBP && !webpTookTooLong.load(std::memory_order_relaxed)) { + const auto us = msSince(start) * 1024; if (us > webpFallbackUs) - webpTookTooLong = true; + webpTookTooLong.store(true, std::memory_order_relaxed); } } @@ -1128,20 +1120,13 @@ void EncodeManager::writeRects(const Region& changed, const PixelBuffer* pb, const bool mainScreen) { std::vector rects, subrects, scaledrects; - std::vector::const_iterator rect; std::vector encoderTypes; std::vector isWebp, fromCache; std::vector palettes; std::vector > compresseds; std::vector ms; - uint32_t i; - int num_threads = std::thread::hardware_concurrency(); - if (rfb::Server::rectThreads > 0) { - num_threads = rfb::Server::rectThreads; - } - - webpTookTooLong = false; + webpTookTooLong.store(false, std::memory_order_relaxed); changed.get_rects(&rects); // Update stats @@ -1156,18 +1141,18 @@ void EncodeManager::writeRects(const Region& changed, const PixelBuffer* pb, subrects.reserve(rects.size() * 1.5f); - for (rect = rects.begin(); rect != rects.end(); ++rect) { - int w, h, sw, sh; + for (const auto& rect : rects) { + int sw, sh; Rect sr; - w = rect->width(); - h = rect->height(); + const auto w = rect.width(); + const auto h = rect.height(); // No split necessary? if ((((w*h) < SubRectMaxArea) && (w < SubRectMaxWidth)) || (videoDetected && !encoders[encoderTightWEBP]->isSupported())) { - subrects.push_back(*rect); - trackRectQuality(*rect); + subrects.push_back(rect); + trackRectQuality(rect); continue; } @@ -1178,15 +1163,15 @@ void EncodeManager::writeRects(const Region& changed, const PixelBuffer* pb, sh = SubRectMaxArea / sw; - for (sr.tl.y = rect->tl.y; sr.tl.y < rect->br.y; sr.tl.y += sh) { + for (sr.tl.y = rect.tl.y; sr.tl.y < rect.br.y; sr.tl.y += sh) { sr.br.y = sr.tl.y + sh; - if (sr.br.y > rect->br.y) - sr.br.y = rect->br.y; + if (sr.br.y > rect.br.y) + sr.br.y = rect.br.y; - for (sr.tl.x = rect->tl.x; sr.tl.x < rect->br.x; sr.tl.x += sw) { + for (sr.tl.x = rect.tl.x; sr.tl.x < rect.br.x; sr.tl.x += sw) { sr.br.x = sr.tl.x + sw; - if (sr.br.x > rect->br.x) - sr.br.x = rect->br.x; + if (sr.br.x > rect.br.x) + sr.br.x = rect.br.x; subrects.push_back(sr); trackRectQuality(sr); @@ -1194,13 +1179,18 @@ void EncodeManager::writeRects(const Region& changed, const PixelBuffer* pb, } } - encoderTypes.resize(subrects.size()); - isWebp.resize(subrects.size()); - fromCache.resize(subrects.size()); - palettes.resize(subrects.size()); - compresseds.resize(subrects.size()); - scaledrects.resize(subrects.size()); - ms.resize(subrects.size()); + const size_t subrects_size = subrects.size(); + + std::vector indices(subrects_size); + std::iota(std::begin(indices), std::end(indices), 0); + + encoderTypes.resize(subrects_size); + isWebp.resize(subrects_size); + fromCache.resize(subrects_size); + palettes.resize(subrects_size); + compresseds.resize(subrects_size); + scaledrects.resize(subrects_size); + ms.resize(subrects_size); // In case the current resolution is above the max video res, and video was detected, // scale to that res, keeping aspect ratio @@ -1232,7 +1222,7 @@ void EncodeManager::writeRects(const Region& changed, const PixelBuffer* pb, break; } - for (i = 0; i < subrects.size(); ++i) { + for (uint32_t i = 0; i < subrects_size; ++i) { const Rect old = scaledrects[i] = subrects[i]; scaledrects[i].br.x *= diff; scaledrects[i].br.y *= diff; @@ -1257,30 +1247,15 @@ void EncodeManager::writeRects(const Region& changed, const PixelBuffer* pb, } scalingTime = msSince(&scalestart); - std::vector> futures; - futures.reserve(subrects.size()); - for (i = 0; i < subrects.size(); ++i) { - Rect subrect = subrects[i]; - const PixelBuffer* current_pb = pb; - uint8_t* current_encoderTypes = &encoderTypes[i]; - uint8_t* current_fromCache = &fromCache[i]; - const PixelBuffer* current_scaledpb = scaledpb; - Rect current_scaledrect = scaledrects[i]; - uint32_t* current_ms = &ms[i]; - const struct timeval* current_start = start; - auto task = [this, subrect, current_pb, &palettes, &compresseds, &isWebp, current_encoderTypes, current_fromCache, current_scaledpb, current_scaledrect, current_ms, current_start, i]() { - *current_encoderTypes = getEncoderType(subrect, current_pb, &palettes[i], compresseds[i], - &isWebp[i], current_fromCache, - current_scaledpb, current_scaledrect, *current_ms); - checkWebpFallback(current_start); - }; - futures.push_back(std::async(std::launch::async, task)); - } - for (auto& future : futures) { - future.get(); - } + std::for_each(std::execution::par_unseq, std::begin(indices), std::end(indices), [&](size_t i) + { + encoderTypes[i] = getEncoderType(subrects[i], pb, &palettes[i], compresseds[i], + &isWebp[i], &fromCache[i], + scaledpb, scaledrects[i], ms[i]); + checkWebpFallback(start); + }); - for (i = 0; i < subrects.size(); ++i) { + for (uint32_t i = 0; i < subrects_size; ++i) { if (encoderTypes[i] == encoderFullColour) { if (isWebp[i]) webpstats.ms += ms[i]; @@ -1292,7 +1267,7 @@ void EncodeManager::writeRects(const Region& changed, const PixelBuffer* pb, if (start) { encodingTime = msSince(start); - if (vlog.getLevel() >= vlog.LEVEL_DEBUG) { + if (vlog.getLevel() >= rfb::LogWriter::LEVEL_DEBUG) { framesSinceEncPrint++; if (maxEncodingTime < encodingTime) maxEncodingTime = encodingTime; @@ -1307,11 +1282,11 @@ void EncodeManager::writeRects(const Region& changed, const PixelBuffer* pb, } } - if (webpTookTooLong) + if (webpTookTooLong.load(std::memory_order_relaxed)) activeEncoders[encoderFullColour] = encoderTightJPEG; - for (i = 0; i < subrects.size(); ++i) { - if (encCache->enabled && compresseds[i].size() && !fromCache[i] && + for (uint32_t i = 0; i < subrects_size; ++i) { + if (encCache->enabled && !compresseds[i].empty() && !fromCache[i] && !encoders[encoderTightQOI]->isSupported()) { void *tmp = malloc(compresseds[i].size()); memcpy(tmp, &compresseds[i][0], compresseds[i].size()); diff --git a/common/rfb/EncodeManager.h b/common/rfb/EncodeManager.h index 7ff24bf..7844faa 100644 --- a/common/rfb/EncodeManager.h +++ b/common/rfb/EncodeManager.h @@ -29,7 +29,6 @@ #include #include #include -#include #include #include @@ -51,7 +50,7 @@ namespace rfb { class EncodeManager: public Timer::Callback { public: EncodeManager(SConnection* conn, EncCache *encCache); - ~EncodeManager(); + ~EncodeManager() override; void logStats(); @@ -73,10 +72,10 @@ namespace rfb { encodingTime = 0; }; - unsigned getEncodingTime() const { + [[nodiscard]] unsigned getEncodingTime() const { return encodingTime; }; - unsigned getScalingTime() const { + [[nodiscard]] unsigned getScalingTime() const { return scalingTime; }; @@ -125,7 +124,8 @@ namespace rfb { uint8_t *fromCache, const PixelBuffer *scaledpb, const Rect& scaledrect, uint32_t &ms) const; - virtual bool handleTimeout(Timer* t); + + bool handleTimeout(Timer* t) override; bool checkSolidTile(const Rect& r, const rdr::U8* colourValue, const PixelBuffer *pb); @@ -200,7 +200,7 @@ namespace rfb { size_t curMaxUpdateSize; unsigned webpFallbackUs; unsigned webpBenchResult; - std::atomic webpTookTooLong; + std::atomic webpTookTooLong{false}; unsigned encodingTime; unsigned maxEncodingTime, framesSinceEncPrint; unsigned scalingTime; @@ -209,14 +209,14 @@ namespace rfb { class OffsetPixelBuffer : public FullFramePixelBuffer { public: - OffsetPixelBuffer() {} - virtual ~OffsetPixelBuffer() {} + OffsetPixelBuffer() = default; + ~OffsetPixelBuffer() override = default; void update(const PixelFormat& pf, int width, int height, const rdr::U8* data_, int stride); private: - virtual rdr::U8* getBufferRW(const Rect& r, int* stride); + rdr::U8* getBufferRW(const Rect& r, int* stride) override; }; }; From 59792ee93c674a6dbddbf17531c2661a7e3c7afb Mon Sep 17 00:00:00 2001 From: El Date: Fri, 7 Mar 2025 01:05:32 +0500 Subject: [PATCH 014/150] KASM-6788 Updates CMake configuration to use C++20 standard --- CMakeLists.txt | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1c3bded..96c566e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -74,13 +74,10 @@ set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} -UNDEBUG") # Make sure we get a sane C version set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99") +set(CMAKE_CXX_STANDARD 20) # Enable OpenMP set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fopenmp") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp") - -# Enable C++ 11 -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11") # Tell the compiler to be stringent set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wformat=2") From f54ec77e440f7334af0506840f8e620eac3d0a26 Mon Sep 17 00:00:00 2001 From: El Date: Thu, 20 Mar 2025 05:51:18 +0500 Subject: [PATCH 015/150] KASM-6788 Specify C and CXX languages in the project() definition for better clarity and compatibility. Additionally, link the TBB library for builds using GCC versions earlier than 10 to address dependency requirements --- CMakeLists.txt | 2 +- common/rfb/CMakeLists.txt | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 96c566e..22f21dc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,7 +21,7 @@ include(CheckCSourceRuns) include(CMakeMacroLibtoolFile) -project(kasmvnc) +project(kasmvnc LANGUAGES C CXX) set(VERSION 0.9) # The RC version must always be four comma-separated numbers diff --git a/common/rfb/CMakeLists.txt b/common/rfb/CMakeLists.txt index 905e76e..88936bc 100644 --- a/common/rfb/CMakeLists.txt +++ b/common/rfb/CMakeLists.txt @@ -82,6 +82,12 @@ endif(WIN32) set(RFB_LIBRARIES ${JPEG_LIBRARIES} ${PNG_LIBRARIES} os rdr Xregion) +if (CMAKE_CXX_COMPILER_ID MATCHES "GNU") + if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 10) + set(RFB_LIBRARIES ${RFB_LIBRARIES} tbb) + endif () +endif () + if(HAVE_PAM) set(RFB_SOURCES ${RFB_SOURCES} UnixPasswordValidator.cxx UnixPasswordValidator.h pam.c pam.h) From 4ea5f734ec4a36db1c16858759e1207ee92e0161 Mon Sep 17 00:00:00 2001 From: El Date: Thu, 20 Mar 2025 14:58:29 +0500 Subject: [PATCH 016/150] KASM-6788 Switch to gcc14-c++ on openSUSE and add libtbb-dev for Ubuntu Focal --- builder/dockerfile.opensuse_15.build | 4 +++- builder/dockerfile.ubuntu_focal.build | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/builder/dockerfile.opensuse_15.build b/builder/dockerfile.opensuse_15.build index db2f130..3d4cfe3 100644 --- a/builder/dockerfile.opensuse_15.build +++ b/builder/dockerfile.opensuse_15.build @@ -14,7 +14,7 @@ RUN zypper install -ny \ fonttosfnt \ font-util \ gcc \ - gcc-c++ \ + gcc14-c++ \ giflib-devel \ git \ gzip \ @@ -45,6 +45,8 @@ RUN zypper install -ny \ xorg-x11-util-devel \ zlib-devel +RUN update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++-14 100 + ENV SCRIPTS_DIR=/tmp/scripts COPY builder/scripts $SCRIPTS_DIR RUN $SCRIPTS_DIR/build-webp diff --git a/builder/dockerfile.ubuntu_focal.build b/builder/dockerfile.ubuntu_focal.build index c734715..1e356b0 100644 --- a/builder/dockerfile.ubuntu_focal.build +++ b/builder/dockerfile.ubuntu_focal.build @@ -13,7 +13,7 @@ RUN apt-get update && \ RUN apt-get update && apt-get install -y --no-install-recommends tzdata RUN apt-get update && apt-get -y build-dep xorg-server libxfont-dev RUN apt-get update && apt-get -y install cmake git vim wget curl -RUN apt-get update && apt-get -y install libpng-dev libtiff-dev libgif-dev libavcodec-dev libssl-dev libxrandr-dev libxcursor-dev +RUN apt-get update && apt-get -y install libtbb-dev libpng-dev libtiff-dev libgif-dev libavcodec-dev libssl-dev libxrandr-dev libxcursor-dev ENV SCRIPTS_DIR=/tmp/scripts COPY builder/scripts $SCRIPTS_DIR From b3f2dd1196dbd87f4ec07283b317b48e2d6fa4b5 Mon Sep 17 00:00:00 2001 From: El Date: Thu, 20 Mar 2025 18:46:33 +0500 Subject: [PATCH 017/150] KASM-6788 Update Dockerfiles to use GCC Toolset 14 and add libSM-devel --- builder/dockerfile.opensuse_15.build | 2 +- builder/dockerfile.oracle_8.build | 6 +++++- builder/dockerfile.oracle_9.build | 6 +++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/builder/dockerfile.opensuse_15.build b/builder/dockerfile.opensuse_15.build index 3d4cfe3..2a4b5ec 100644 --- a/builder/dockerfile.opensuse_15.build +++ b/builder/dockerfile.opensuse_15.build @@ -13,7 +13,7 @@ RUN zypper install -ny \ ffmpeg-4-libavcodec-devel \ fonttosfnt \ font-util \ - gcc \ + gcc14 \ gcc14-c++ \ giflib-devel \ git \ diff --git a/builder/dockerfile.oracle_8.build b/builder/dockerfile.oracle_8.build index 4a98a19..4aa7e5b 100644 --- a/builder/dockerfile.oracle_8.build +++ b/builder/dockerfile.oracle_8.build @@ -15,6 +15,7 @@ RUN \ dnf-plugins-core \ gcc \ gcc-c++ \ + gcc-toolset-14 \ git \ gnutls-devel \ libjpeg-turbo-devel \ @@ -48,7 +49,10 @@ RUN dnf install -y \ xorg-x11-xtrans-devel \ libXrandr-devel \ libXtst-devel \ - libXcursor-devel + libXcursor-devel \ + libSM-devel + +RUN scl enable gcc-toolset-14 bash ENV SCRIPTS_DIR=/tmp/scripts COPY builder/scripts $SCRIPTS_DIR diff --git a/builder/dockerfile.oracle_9.build b/builder/dockerfile.oracle_9.build index ca94b69..41f5830 100644 --- a/builder/dockerfile.oracle_9.build +++ b/builder/dockerfile.oracle_9.build @@ -15,6 +15,7 @@ RUN \ dnf-plugins-core \ gcc \ gcc-c++ \ + gcc-toolset-14 \ git \ gnutls-devel \ libjpeg-turbo-devel \ @@ -47,7 +48,10 @@ RUN dnf install -y \ xorg-x11-xtrans-devel \ libXrandr-devel \ libXtst-devel \ - libXcursor-devel + libXcursor-devel \ + libSM-devel + +RUN scl enable gcc-toolset-14 bash ENV SCRIPTS_DIR=/tmp/scripts From aa40f59af52d6b9e21788e3670e7607ffc302574 Mon Sep 17 00:00:00 2001 From: El Date: Sat, 22 Mar 2025 23:22:16 +0500 Subject: [PATCH 018/150] KASM-6788 Add TBB dependency for EL8 platform and older GCC versions --- common/rfb/CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/common/rfb/CMakeLists.txt b/common/rfb/CMakeLists.txt index 88936bc..70217fe 100644 --- a/common/rfb/CMakeLists.txt +++ b/common/rfb/CMakeLists.txt @@ -82,10 +82,10 @@ endif(WIN32) set(RFB_LIBRARIES ${JPEG_LIBRARIES} ${PNG_LIBRARIES} os rdr Xregion) -if (CMAKE_CXX_COMPILER_ID MATCHES "GNU") - if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 10) - set(RFB_LIBRARIES ${RFB_LIBRARIES} tbb) - endif () +cmake_host_system_information(RESULT DISTRO QUERY DISTRIB_INFO) +if ((CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 10) OR +(DISTRO_PLATFORM_ID MATCHES "platform:el8")) + set(RFB_LIBRARIES ${RFB_LIBRARIES} tbb) endif () if(HAVE_PAM) From 7eddf5fd65b3cc48a165258117f0a1139bbacd09 Mon Sep 17 00:00:00 2001 From: El Date: Sun, 23 Mar 2025 15:11:24 +0500 Subject: [PATCH 019/150] KASM-6788 Update Dockerfile to install CMake from source --- builder/dockerfile.debian_bullseye.build | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/builder/dockerfile.debian_bullseye.build b/builder/dockerfile.debian_bullseye.build index f626bb7..077a2e5 100644 --- a/builder/dockerfile.debian_bullseye.build +++ b/builder/dockerfile.debian_bullseye.build @@ -12,9 +12,22 @@ RUN apt-get update && \ RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends tzdata RUN apt-get update && apt-get -y build-dep xorg-server libxfont-dev -RUN apt-get update && apt-get -y install cmake git libgnutls28-dev vim wget tightvncserver curl +RUN apt-get update && apt-get -y install git libgnutls28-dev vim wget tightvncserver curl RUN apt-get update && apt-get -y install libpng-dev libtiff-dev libgif-dev libavcodec-dev libssl-dev libxrandr-dev libxcursor-dev +RUN CMAKE_URL="https://cmake.org/files/v3.22/cmake-3.22.0" && \ + ARCH=$(arch) && \ + if [ "$ARCH" = "x86_64" ]; then \ + CMAKE_URL="${CMAKE_URL}-linux-x86_64.sh"; \ + elif [ "$ARCH" = "aarch64" ]; then \ + CMAKE_URL="${CMAKE_URL}-linux-aarch64.sh"; \ + else \ + echo "Unsupported architecture: $ARCH" && exit 1; \ + fi && \ + curl -fsSL $CMAKE_URL -o cmake.sh && \ + (echo y; echo n) | bash cmake.sh --prefix=/usr/local --skip-license && \ + rm cmake.sh + ENV SCRIPTS_DIR=/tmp/scripts COPY builder/scripts $SCRIPTS_DIR RUN $SCRIPTS_DIR/build-webp From 130c7fef9346826f0ec608f5b3aeb18f3a9f733a Mon Sep 17 00:00:00 2001 From: El Date: Sun, 23 Mar 2025 15:44:20 +0500 Subject: [PATCH 020/150] KASM-6788 Update Dockerfile to install CMake from source --- builder/dockerfile.opensuse_15.build | 13 +++++++++++++ builder/dockerfile.ubuntu_focal.build | 13 +++++++++++++ 2 files changed, 26 insertions(+) diff --git a/builder/dockerfile.opensuse_15.build b/builder/dockerfile.opensuse_15.build index 2a4b5ec..4bbb558 100644 --- a/builder/dockerfile.opensuse_15.build +++ b/builder/dockerfile.opensuse_15.build @@ -56,6 +56,19 @@ RUN useradd -u 1000 docker && \ groupadd -g 1000 docker && \ usermod -a -G docker docker +RUN ARCH=$(arch) && \ + CMAKE_URL="https://cmake.org/files/v3.22/cmake-3.22.0" && \ + if [ "$ARCH" = "x86_64" ]; then \ + CMAKE_URL="${CMAKE_URL}-linux-x86_64.sh"; \ + elif [ "$ARCH" = "aarch64" ]; then \ + CMAKE_URL="${CMAKE_URL}-linux-aarch64.sh"; \ + else \ + echo "Unsupported architecture: $ARCH" && exit 1; \ + fi && \ + curl -fsSL $CMAKE_URL -o cmake.sh && \ + (echo y; echo n) | bash cmake.sh --prefix=/usr/local --skip-license && \ + rm cmake.sh + COPY --chown=docker:docker . /src/ diff --git a/builder/dockerfile.ubuntu_focal.build b/builder/dockerfile.ubuntu_focal.build index 1e356b0..bdfad4c 100644 --- a/builder/dockerfile.ubuntu_focal.build +++ b/builder/dockerfile.ubuntu_focal.build @@ -22,6 +22,19 @@ RUN $SCRIPTS_DIR/build-libjpeg-turbo RUN useradd -m docker && echo "docker:docker" | chpasswd && adduser docker sudo +RUN ARCH=$(arch) && \ + CMAKE_URL="https://cmake.org/files/v3.22/cmake-3.22.0" && \ + if [ "$ARCH" = "x86_64" ]; then \ + CMAKE_URL="${CMAKE_URL}-linux-x86_64.sh"; \ + elif [ "$ARCH" = "aarch64" ]; then \ + CMAKE_URL="${CMAKE_URL}-linux-aarch64.sh"; \ + else \ + echo "Unsupported architecture: $ARCH" && exit 1; \ + fi && \ + curl -fsSL $CMAKE_URL -o cmake.sh && \ + (echo y; echo n) | bash cmake.sh --prefix=/usr/local --skip-license && \ + rm cmake.sh + COPY --chown=docker:docker . /src/ USER docker From 4284f8f8a6937b6813c5920a7cf22e0e28f4a4fe Mon Sep 17 00:00:00 2001 From: El Date: Sun, 23 Mar 2025 16:37:28 +0500 Subject: [PATCH 021/150] KASM-6788 Refactor Dockerfile to streamline build process --- builder/dockerfile.oracle_8.build | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/builder/dockerfile.oracle_8.build b/builder/dockerfile.oracle_8.build index 4aa7e5b..f28c1df 100644 --- a/builder/dockerfile.oracle_8.build +++ b/builder/dockerfile.oracle_8.build @@ -39,6 +39,7 @@ RUN dnf install -y --nogpgcheck https://mirrors.rpmfusion.org/free/el/rpmfusion- # Install from new repos RUN dnf install -y \ + tbb-devel \ ffmpeg-devel \ giflib-devel \ lbzip2 \ @@ -52,16 +53,13 @@ RUN dnf install -y \ libXcursor-devel \ libSM-devel -RUN scl enable gcc-toolset-14 bash - ENV SCRIPTS_DIR=/tmp/scripts COPY builder/scripts $SCRIPTS_DIR -RUN $SCRIPTS_DIR/build-webp -RUN $SCRIPTS_DIR/build-libjpeg-turbo - -RUN useradd -m docker && echo "docker:docker" | chpasswd +RUN echo "source /opt/rh/gcc-toolset-14/enable" > /etc/profile.d/gcc-toolset.sh && \ + $SCRIPTS_DIR/build-webp && $SCRIPTS_DIR/build-libjpeg-turbo && \ + useradd -m docker && echo "docker:docker" | chpasswd COPY --chown=docker:docker . /src/ USER docker -ENTRYPOINT ["/src/builder/build.sh"] +ENTRYPOINT ["bash", "-l", "-c", "/src/builder/build.sh"] From 4091cc3ae6e83b3b6b6175b3962be8c802c8e65d Mon Sep 17 00:00:00 2001 From: El Date: Sun, 23 Mar 2025 19:24:59 +0500 Subject: [PATCH 022/150] KASM-6788 Refactor Dockerfile to streamline build process --- builder/dockerfile.ubuntu_focal.deb.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builder/dockerfile.ubuntu_focal.deb.build b/builder/dockerfile.ubuntu_focal.deb.build index 8a4db12..ffe6402 100644 --- a/builder/dockerfile.ubuntu_focal.deb.build +++ b/builder/dockerfile.ubuntu_focal.deb.build @@ -3,7 +3,7 @@ FROM ubuntu:focal ENV DEBIAN_FRONTEND noninteractive RUN apt-get update && \ - apt-get -y install vim build-essential devscripts equivs + apt-get -y install vim build-essential devscripts equivs libtbb-dev # Install build-deps for the package. COPY ./debian/control /tmp From 90c38a0da8ac5ce861ee3fec639996e723417e12 Mon Sep 17 00:00:00 2001 From: El Date: Mon, 24 Mar 2025 16:07:18 +0500 Subject: [PATCH 023/150] KASM-6788 Refactor Dockerfile to streamline build process --- builder/dockerfile.opensuse_15.build | 12 +++++------- builder/dockerfile.oracle_9.build | 12 ++++-------- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/builder/dockerfile.opensuse_15.build b/builder/dockerfile.opensuse_15.build index 4bbb558..954ada8 100644 --- a/builder/dockerfile.opensuse_15.build +++ b/builder/dockerfile.opensuse_15.build @@ -47,11 +47,6 @@ RUN zypper install -ny \ RUN update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++-14 100 -ENV SCRIPTS_DIR=/tmp/scripts -COPY builder/scripts $SCRIPTS_DIR -RUN $SCRIPTS_DIR/build-webp -RUN $SCRIPTS_DIR/build-libjpeg-turbo - RUN useradd -u 1000 docker && \ groupadd -g 1000 docker && \ usermod -a -G docker docker @@ -69,8 +64,11 @@ RUN ARCH=$(arch) && \ (echo y; echo n) | bash cmake.sh --prefix=/usr/local --skip-license && \ rm cmake.sh +ENV SCRIPTS_DIR=/tmp/scripts +COPY builder/scripts $SCRIPTS_DIR +RUN $SCRIPTS_DIR/build-webp && $SCRIPTS_DIR/build-libjpeg-turbo + COPY --chown=docker:docker . /src/ - USER docker -ENTRYPOINT ["/src/builder/build.sh"] +ENTRYPOINT ["bash", "-l", "-c", "/src/builder/build.sh"] diff --git a/builder/dockerfile.oracle_9.build b/builder/dockerfile.oracle_9.build index 41f5830..ca6e705 100644 --- a/builder/dockerfile.oracle_9.build +++ b/builder/dockerfile.oracle_9.build @@ -51,17 +51,13 @@ RUN dnf install -y \ libXcursor-devel \ libSM-devel -RUN scl enable gcc-toolset-14 bash - - ENV SCRIPTS_DIR=/tmp/scripts COPY builder/scripts $SCRIPTS_DIR -RUN $SCRIPTS_DIR/build-webp -RUN $SCRIPTS_DIR/build-libjpeg-turbo - -RUN useradd -m docker && echo "docker:docker" | chpasswd +RUN echo "source /opt/rh/gcc-toolset-14/enable" > /etc/profile.d/gcc-toolset.sh && \ + $SCRIPTS_DIR/build-webp && $SCRIPTS_DIR/build-libjpeg-turbo && \ + useradd -m docker && echo "docker:docker" | chpasswd COPY --chown=docker:docker . /src/ USER docker -ENTRYPOINT ["/src/builder/build.sh"] +ENTRYPOINT ["bash", "-l", "-c", "/src/builder/build.sh"] From 5c6e913fcab7653d36e47a05075ea3fb6750b7aa Mon Sep 17 00:00:00 2001 From: Rodwin Spruel Date: Mon, 14 Apr 2025 23:29:41 +0000 Subject: [PATCH 024/150] upgrading to libwebp 1.5.0 abd adding sharpyuv and an included library based on the change in how it is included with libwebp --- builder/scripts/build-webp | 4 ++-- unix/xserver/hw/vnc/Makefile.am | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/builder/scripts/build-webp b/builder/scripts/build-webp index a6b2fd0..1254230 100755 --- a/builder/scripts/build-webp +++ b/builder/scripts/build-webp @@ -2,7 +2,7 @@ set -euo pipefail -WEBP_VERSION="1.2.4" +WEBP_VERSION="1.5.0" WEBP_TAR_URL="https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-${WEBP_VERSION}.tar.gz" WEBP_TAR_FILE="/tmp/libwebp-${WEBP_VERSION}.tar.gz" WEBP_SRC_DIR="/tmp/libwebp-${WEBP_VERSION}" @@ -21,7 +21,7 @@ prepare_source() { build_and_install() { export MAKEFLAGS=-j$(nproc) - ./configure --enable-static --disable-shared + ./configure --enable-static --disable-shared --enable-threading --enable-sse2 make make install } diff --git a/unix/xserver/hw/vnc/Makefile.am b/unix/xserver/hw/vnc/Makefile.am index a25d214..c3226eb 100644 --- a/unix/xserver/hw/vnc/Makefile.am +++ b/unix/xserver/hw/vnc/Makefile.am @@ -52,7 +52,7 @@ Xvnc_CPPFLAGS = $(XVNC_CPPFLAGS) -DKASMVNC -DNO_MODULE_EXTS \ -I$(top_srcdir)/dri3 @LIBDRM_CFLAGS@ Xvnc_LDADD = $(XVNC_LIBS) libvnccommon.la $(COMMON_LIBS) \ - $(XSERVER_LIBS) $(XSERVER_SYS_LIBS) $(XVNC_SYS_LIBS) -lX11 -lwebp -lssl -lcrypto -lcrypt \ + $(XSERVER_LIBS) $(XSERVER_SYS_LIBS) $(XVNC_SYS_LIBS) -lX11 -lwebp -lsharpyuv -lssl -lcrypto -lcrypt \ -lfreetype Xvnc_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG) -fopenmp From fd78b3fe62730f8334fb567e9ca23165e4b0f9e1 Mon Sep 17 00:00:00 2001 From: Rodwin Spruel Date: Tue, 15 Apr 2025 23:16:01 +0000 Subject: [PATCH 025/150] updaing opensuse docker file to --- builder/dockerfile.opensuse_15.build | 5 ++++- builder/scripts/build-webp | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/builder/dockerfile.opensuse_15.build b/builder/dockerfile.opensuse_15.build index 954ada8..800c752 100644 --- a/builder/dockerfile.opensuse_15.build +++ b/builder/dockerfile.opensuse_15.build @@ -45,7 +45,10 @@ RUN zypper install -ny \ xorg-x11-util-devel \ zlib-devel -RUN update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++-14 100 +RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 140 \ + --slave /usr/bin/g++ g++ /usr/bin/g++-14 \ + --slave /usr/bin/gcov gcov /usr/bin/gcov-14 + RUN useradd -u 1000 docker && \ groupadd -g 1000 docker && \ diff --git a/builder/scripts/build-webp b/builder/scripts/build-webp index 1254230..e5e19f1 100755 --- a/builder/scripts/build-webp +++ b/builder/scripts/build-webp @@ -21,7 +21,7 @@ prepare_source() { build_and_install() { export MAKEFLAGS=-j$(nproc) - ./configure --enable-static --disable-shared --enable-threading --enable-sse2 + ./configure --enable-static --disable-shared --enable-threading --enable-sse2 --enable-neon make make install } From c2b9721fdc2b35b063d4f1bd61f0c619b8e6c5bd Mon Sep 17 00:00:00 2001 From: El Date: Wed, 5 Mar 2025 15:41:05 +0500 Subject: [PATCH 026/150] KASM-7194 Removed package installation from this script since they're already included in the Docker image. Switched to Ninja for faster builds --- builder/scripts/build-libjpeg-turbo | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/builder/scripts/build-libjpeg-turbo b/builder/scripts/build-libjpeg-turbo index 13d1f3f..ed8a737 100755 --- a/builder/scripts/build-libjpeg-turbo +++ b/builder/scripts/build-libjpeg-turbo @@ -3,20 +3,8 @@ set -euo pipefail build_and_install() { - export MAKEFLAGS=-j`nproc` - export CFLAGS="-fpic" - cmake -DCMAKE_INSTALL_PREFIX=/usr/local -G"Unix Makefiles" - make - make install -} - -install_build_dependencies() { - install_packages cmake gcc - ensure_libjpeg_is_fast -} - -ensure_libjpeg_is_fast() { - install_packages nasm + cmake -B build -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_POSITION_INDEPENDENT_CODE=ON -GNinja . + ninja -C build install } prepare_libjpeg_source() { @@ -32,6 +20,5 @@ prepare_libjpeg_source() { source_dir=$(dirname "$0") . "$source_dir/common.sh" -install_build_dependencies prepare_libjpeg_source build_and_install From f38ad7122cf25d129fab0f8fe84c37d9bc36ddae Mon Sep 17 00:00:00 2001 From: El Date: Wed, 5 Mar 2025 15:41:54 +0500 Subject: [PATCH 027/150] KASM-7194 Fixed a typo --- BUILDING.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BUILDING.txt b/BUILDING.txt index 4bfaa3f..34b6ab8 100644 --- a/BUILDING.txt +++ b/BUILDING.txt @@ -91,7 +91,7 @@ npm run build # <-- only run this on subsequent changes to front-end code cd .. # build dependencies sudo builder/scripts/build-webp -sudo builder/scripts/build-build-libjpeg-turbo +sudo builder/scripts/build-libjpeg-turbo # Build KasmVNC builder/build.sh ``` From c0d73ebd28b6867f4d6bf4064956a7f340d043d1 Mon Sep 17 00:00:00 2001 From: El Date: Wed, 12 Mar 2025 21:01:52 +0500 Subject: [PATCH 028/150] KASM-7194 Add additional tools and scripts to Dockerfile for dev setup KASM-7194 Add WebP and libjpeg-turbo build scripts to Dockerfile --- builder/dockerfile.ubuntu_jammy.dev | 46 ++++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/builder/dockerfile.ubuntu_jammy.dev b/builder/dockerfile.ubuntu_jammy.dev index d13638d..7201cf2 100644 --- a/builder/dockerfile.ubuntu_jammy.dev +++ b/builder/dockerfile.ubuntu_jammy.dev @@ -12,11 +12,55 @@ USER root RUN sed -i 's$# deb-src$deb-src$' /etc/apt/sources.list && \ apt update && \ - apt install -y socat sudo libxfont-dev cmake git libgnutls28-dev vim wget tightvncserver curl libpng-dev libtiff-dev libgif-dev libavcodec-dev libssl-dev libxrandr-dev libxcursor-dev pkg-config libfreetype6-dev libxtst-dev autoconf automake libtool xutils-dev libpixman-1-dev libxshmfence-dev libxcvt-dev libxkbfile-dev x11proto-dev libgbm-dev inotify-tools && \ + apt install -y \ + ninja-build \ + gdb \ + valgrind \ + rsync \ + dos2unix \ + socat \ + sudo \ + libxfont-dev \ + cmake \ + nasm \ + git \ + libgnutls28-dev \ + vim \ + wget \ + tightvncserver \ + curl \ + libpng-dev \ + libtiff-dev \ + libgif-dev \ + libavcodec-dev \ + libssl-dev \ + libxrandr-dev \ + libxcursor-dev \ + pkg-config \ + libfreetype6-dev \ + libxtst-dev \ + autoconf \ + automake \ + libtool \ + xutils-dev \ + libpixman-1-dev \ + libxshmfence-dev \ + libxcvt-dev \ + libxkbfile-dev \ + x11proto-dev \ + libgbm-dev \ + inotify-tools && \ echo "kasm-user ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers RUN curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash - RUN apt install -y nodejs + +COPY builder/scripts/build-webp /tmp +COPY builder/scripts/build-libjpeg-turbo /tmp +COPY builder/common.sh /tmp + +RUN chmod +x /tmp/build-webp && /tmp/build-webp +RUN chmod +x /tmp/build-libjpeg-turbo && /tmp/build-libjpeg-turbo USER 1000 From 62a1c210c9e795d147b2e1972b06e3903371c357 Mon Sep 17 00:00:00 2001 From: El Date: Fri, 14 Mar 2025 15:25:52 +0500 Subject: [PATCH 029/150] KASM-7194 Add NASM to all builder Dockerfiles --- builder/dockerfile.alpine_318.build | 1 + builder/dockerfile.alpine_319.build | 1 + builder/dockerfile.alpine_320.build | 1 + builder/dockerfile.alpine_321.build | 1 + builder/dockerfile.debian_bookworm.build | 2 +- builder/dockerfile.debian_bullseye.build | 2 +- builder/dockerfile.debian_buster.build | 2 +- builder/dockerfile.fedora_forty.build | 1 + builder/dockerfile.fedora_fortyone.build | 1 + builder/dockerfile.fedora_thirtynine.build | 1 + builder/dockerfile.kali_kali-rolling.build | 2 +- builder/dockerfile.opensuse_15.build | 1 + builder/dockerfile.oracle_8.build | 1 + builder/dockerfile.oracle_9.build | 1 + builder/dockerfile.ubuntu_focal.build | 7 ++++--- builder/dockerfile.ubuntu_jammy.build | 2 +- builder/dockerfile.ubuntu_noble.build | 2 +- 17 files changed, 20 insertions(+), 9 deletions(-) diff --git a/builder/dockerfile.alpine_318.build b/builder/dockerfile.alpine_318.build index 8a01ac8..b163664 100644 --- a/builder/dockerfile.alpine_318.build +++ b/builder/dockerfile.alpine_318.build @@ -14,6 +14,7 @@ RUN \ bash \ ca-certificates \ cmake \ + nasm \ coreutils \ curl \ eudev-dev \ diff --git a/builder/dockerfile.alpine_319.build b/builder/dockerfile.alpine_319.build index a73670b..c0b18b7 100644 --- a/builder/dockerfile.alpine_319.build +++ b/builder/dockerfile.alpine_319.build @@ -14,6 +14,7 @@ RUN \ bash \ ca-certificates \ cmake \ + nasm \ coreutils \ curl \ eudev-dev \ diff --git a/builder/dockerfile.alpine_320.build b/builder/dockerfile.alpine_320.build index 42995f1..8212b60 100644 --- a/builder/dockerfile.alpine_320.build +++ b/builder/dockerfile.alpine_320.build @@ -14,6 +14,7 @@ RUN \ bash \ ca-certificates \ cmake \ + nasm \ coreutils \ curl \ eudev-dev \ diff --git a/builder/dockerfile.alpine_321.build b/builder/dockerfile.alpine_321.build index e73d31f..5ccb9ac 100644 --- a/builder/dockerfile.alpine_321.build +++ b/builder/dockerfile.alpine_321.build @@ -14,6 +14,7 @@ RUN \ bash \ ca-certificates \ cmake \ + nasm \ coreutils \ curl \ eudev-dev \ diff --git a/builder/dockerfile.debian_bookworm.build b/builder/dockerfile.debian_bookworm.build index 8c0e8de..c0c9212 100644 --- a/builder/dockerfile.debian_bookworm.build +++ b/builder/dockerfile.debian_bookworm.build @@ -22,7 +22,7 @@ RUN apt-get update && \ RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends tzdata RUN apt-get update && apt-get -y build-dep xorg-server libxfont-dev -RUN apt-get update && apt-get -y install cmake git libgnutls28-dev vim wget tightvncserver curl +RUN apt-get update && apt-get -y install ninja-build cmake nasm git libgnutls28-dev vim wget tightvncserver curl RUN apt-get update && apt-get -y install libpng-dev libtiff-dev libgif-dev libavcodec-dev libssl-dev libxrandr-dev libxcursor-dev ENV SCRIPTS_DIR=/tmp/scripts diff --git a/builder/dockerfile.debian_bullseye.build b/builder/dockerfile.debian_bullseye.build index 077a2e5..528b179 100644 --- a/builder/dockerfile.debian_bullseye.build +++ b/builder/dockerfile.debian_bullseye.build @@ -12,7 +12,7 @@ RUN apt-get update && \ RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends tzdata RUN apt-get update && apt-get -y build-dep xorg-server libxfont-dev -RUN apt-get update && apt-get -y install git libgnutls28-dev vim wget tightvncserver curl +RUN apt-get update && apt-get -y install ninja-build nasm git libgnutls28-dev vim wget tightvncserver curl RUN apt-get update && apt-get -y install libpng-dev libtiff-dev libgif-dev libavcodec-dev libssl-dev libxrandr-dev libxcursor-dev RUN CMAKE_URL="https://cmake.org/files/v3.22/cmake-3.22.0" && \ diff --git a/builder/dockerfile.debian_buster.build b/builder/dockerfile.debian_buster.build index c8f8008..a1e2afd 100644 --- a/builder/dockerfile.debian_buster.build +++ b/builder/dockerfile.debian_buster.build @@ -12,7 +12,7 @@ RUN apt-get update && \ RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends tzdata RUN apt-get update && apt-get -y build-dep xorg-server libxfont-dev -RUN apt-get update && apt-get -y install cmake git libgnutls28-dev vim wget tightvncserver curl +RUN apt-get update && apt-get -y install ninja-build cmake nasm git libgnutls28-dev vim wget tightvncserver curl RUN apt-get update && apt-get -y install libpng-dev libtiff-dev libgif-dev libavcodec-dev libssl-dev libxrandr-dev libxcursor-dev ENV SCRIPTS_DIR=/tmp/scripts diff --git a/builder/dockerfile.fedora_forty.build b/builder/dockerfile.fedora_forty.build index d5ad068..686feb6 100644 --- a/builder/dockerfile.fedora_forty.build +++ b/builder/dockerfile.fedora_forty.build @@ -16,6 +16,7 @@ RUN \ byacc \ bzip2 \ cmake \ + nasm \ diffutils \ doxygen \ file \ diff --git a/builder/dockerfile.fedora_fortyone.build b/builder/dockerfile.fedora_fortyone.build index 5c2bf48..81c44b4 100644 --- a/builder/dockerfile.fedora_fortyone.build +++ b/builder/dockerfile.fedora_fortyone.build @@ -17,6 +17,7 @@ RUN \ byacc \ bzip2 \ cmake \ + nasm \ diffutils \ doxygen \ file \ diff --git a/builder/dockerfile.fedora_thirtynine.build b/builder/dockerfile.fedora_thirtynine.build index 0854956..aa10cf4 100644 --- a/builder/dockerfile.fedora_thirtynine.build +++ b/builder/dockerfile.fedora_thirtynine.build @@ -16,6 +16,7 @@ RUN \ byacc \ bzip2 \ cmake \ + nasm \ diffutils \ doxygen \ file \ diff --git a/builder/dockerfile.kali_kali-rolling.build b/builder/dockerfile.kali_kali-rolling.build index 0812308..43a1e3a 100644 --- a/builder/dockerfile.kali_kali-rolling.build +++ b/builder/dockerfile.kali_kali-rolling.build @@ -13,7 +13,7 @@ RUN apt-get update && \ RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends tzdata RUN apt-get update && apt-get -y build-dep xorg-server libxfont-dev RUN apt-get update && apt-get -y install gcc g++ curl -RUN apt-get update && apt-get -y install cmake git libgnutls28-dev vim wget tightvncserver +RUN apt-get update && apt-get -y install ninja-build cmake nasm git libgnutls28-dev vim wget tightvncserver RUN apt-get update && apt-get -y install libpng-dev libtiff-dev libgif-dev libavcodec-dev libssl-dev libxrandr-dev libxcursor-dev ENV SCRIPTS_DIR=/tmp/scripts diff --git a/builder/dockerfile.opensuse_15.build b/builder/dockerfile.opensuse_15.build index 800c752..d00eb4b 100644 --- a/builder/dockerfile.opensuse_15.build +++ b/builder/dockerfile.opensuse_15.build @@ -9,6 +9,7 @@ RUN zypper install -ny \ bdftopcf \ bigreqsproto-devel \ cmake \ + nasm \ curl \ ffmpeg-4-libavcodec-devel \ fonttosfnt \ diff --git a/builder/dockerfile.oracle_8.build b/builder/dockerfile.oracle_8.build index f28c1df..59c09f1 100644 --- a/builder/dockerfile.oracle_8.build +++ b/builder/dockerfile.oracle_8.build @@ -12,6 +12,7 @@ RUN \ bzip2-devel \ ca-certificates \ cmake \ + nasm \ dnf-plugins-core \ gcc \ gcc-c++ \ diff --git a/builder/dockerfile.oracle_9.build b/builder/dockerfile.oracle_9.build index ca6e705..fb27999 100644 --- a/builder/dockerfile.oracle_9.build +++ b/builder/dockerfile.oracle_9.build @@ -12,6 +12,7 @@ RUN \ bzip2-devel \ ca-certificates \ cmake \ + nasm \ dnf-plugins-core \ gcc \ gcc-c++ \ diff --git a/builder/dockerfile.ubuntu_focal.build b/builder/dockerfile.ubuntu_focal.build index bdfad4c..03f5253 100644 --- a/builder/dockerfile.ubuntu_focal.build +++ b/builder/dockerfile.ubuntu_focal.build @@ -12,13 +12,11 @@ RUN apt-get update && \ RUN apt-get update && apt-get install -y --no-install-recommends tzdata RUN apt-get update && apt-get -y build-dep xorg-server libxfont-dev -RUN apt-get update && apt-get -y install cmake git vim wget curl +RUN apt-get update && apt-get -y install ninja-build nasm git vim wget curl RUN apt-get update && apt-get -y install libtbb-dev libpng-dev libtiff-dev libgif-dev libavcodec-dev libssl-dev libxrandr-dev libxcursor-dev ENV SCRIPTS_DIR=/tmp/scripts COPY builder/scripts $SCRIPTS_DIR -RUN $SCRIPTS_DIR/build-webp -RUN $SCRIPTS_DIR/build-libjpeg-turbo RUN useradd -m docker && echo "docker:docker" | chpasswd && adduser docker sudo @@ -35,6 +33,9 @@ RUN ARCH=$(arch) && \ (echo y; echo n) | bash cmake.sh --prefix=/usr/local --skip-license && \ rm cmake.sh +RUN $SCRIPTS_DIR/build-webp +RUN $SCRIPTS_DIR/build-libjpeg-turbo + COPY --chown=docker:docker . /src/ USER docker diff --git a/builder/dockerfile.ubuntu_jammy.build b/builder/dockerfile.ubuntu_jammy.build index 933fc90..cc6c4ff 100644 --- a/builder/dockerfile.ubuntu_jammy.build +++ b/builder/dockerfile.ubuntu_jammy.build @@ -12,7 +12,7 @@ RUN apt-get update && \ RUN apt-get update && apt-get install -y --no-install-recommends tzdata RUN apt-get update && apt-get -y build-dep xorg-server libxfont-dev -RUN apt-get update && apt-get -y install cmake git libgnutls28-dev vim wget tightvncserver curl +RUN apt-get update && apt-get -y install ninja-build cmake nasm git libgnutls28-dev vim wget tightvncserver curl RUN apt-get update && apt-get -y install libpng-dev libtiff-dev libgif-dev libavcodec-dev libssl-dev libxrandr-dev libxcursor-dev ENV SCRIPTS_DIR=/tmp/scripts diff --git a/builder/dockerfile.ubuntu_noble.build b/builder/dockerfile.ubuntu_noble.build index a71ad86..a4c3a6f 100644 --- a/builder/dockerfile.ubuntu_noble.build +++ b/builder/dockerfile.ubuntu_noble.build @@ -12,7 +12,7 @@ RUN apt-get update && \ RUN apt-get update && apt-get install -y --no-install-recommends tzdata RUN apt-get update && apt-get -y build-dep xorg-server libxfont-dev -RUN apt-get update && apt-get -y install cmake git libgnutls28-dev vim wget curl +RUN apt-get update && apt-get -y install ninja-build cmake nasm git libgnutls28-dev vim wget curl RUN apt-get update && apt-get -y install libpng-dev libtiff-dev libgif-dev libavcodec-dev libssl-dev libxrandr-dev libxcursor-dev ENV SCRIPTS_DIR=/tmp/scripts From 81fa5f8f653f974c9b89ddff93d97d34aa0d0048 Mon Sep 17 00:00:00 2001 From: El Date: Sun, 16 Mar 2025 17:04:27 +0500 Subject: [PATCH 030/150] KASM-7194 Use `ln -sf` to force symbolic link creation --- builder/build.sh | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/builder/build.sh b/builder/build.sh index be9d899..b35f83d 100755 --- a/builder/build.sh +++ b/builder/build.sh @@ -44,7 +44,10 @@ if [[ "${XORG_VER}" == 21* ]]; then else XORG_PATCH=$(echo "$XORG_VER" | grep -Po '^\d.\d+' | sed 's#\.##') fi -wget --no-check-certificate https://www.x.org/archive/individual/xserver/xorg-server-${XORG_VER}.tar.gz + +if [ ! -f xorg-server-"${XORG_VER}".tar.gz ]; then + wget --no-check-certificate https://www.x.org/archive/individual/xserver/xorg-server-"${XORG_VER}".tar.gz +fi #git clone https://kasmweb@bitbucket.org/kasmtech/kasmvnc.git #cd kasmvnc @@ -59,7 +62,7 @@ sed -i -e '/find_package(FLTK/s@^@#@' \ cmake -D CMAKE_BUILD_TYPE=RelWithDebInfo . -DBUILD_VIEWER:BOOL=OFF \ -DENABLE_GNUTLS:BOOL=OFF -make -j5 +make -j"$(nproc)" tar -C unix/xserver -xf /tmp/xorg-server-${XORG_VER}.tar.gz --strip-components=1 @@ -114,18 +117,22 @@ fi # remove array bounds errors for new versions of GCC find . -name "Makefile" -exec sed -i 's/-Werror=array-bounds//g' {} \; -make -j5 +make -j"$(nproc)" # modifications for the servertarball cd /src mkdir -p xorg.build/bin cd xorg.build/bin/ -ln -s /src/unix/xserver/hw/vnc/Xvnc Xvnc +ln -sf /src/unix/xserver/hw/vnc/Xvnc Xvnc cd .. mkdir -p man/man1 touch man/man1/Xserver.1 cp /src/unix/xserver/hw/vnc/Xvnc.man man/man1/Xvnc.1 -mkdir lib + +if [ ! -d lib ]; then + mkdir lib +fi + cd lib if [ -d /usr/lib/x86_64-linux-gnu/dri ]; then ln -s /usr/lib/x86_64-linux-gnu/dri dri From 35d1d49d208b9ec9dddb8533b76425687acf1250 Mon Sep 17 00:00:00 2001 From: El Date: Thu, 17 Apr 2025 22:34:38 +0500 Subject: [PATCH 031/150] KASM-7194 Add ninja-build and libSM-devel to Docker build files --- builder/dockerfile.opensuse_15.build | 1 + builder/dockerfile.oracle_8.build | 1 + builder/dockerfile.oracle_9.build | 1 + 3 files changed, 3 insertions(+) diff --git a/builder/dockerfile.opensuse_15.build b/builder/dockerfile.opensuse_15.build index d00eb4b..6c2cd1b 100644 --- a/builder/dockerfile.opensuse_15.build +++ b/builder/dockerfile.opensuse_15.build @@ -8,6 +8,7 @@ ENV XORG_VER 1.20.3 RUN zypper install -ny \ bdftopcf \ bigreqsproto-devel \ + ninja \ cmake \ nasm \ curl \ diff --git a/builder/dockerfile.oracle_8.build b/builder/dockerfile.oracle_8.build index 59c09f1..0a9ecfe 100644 --- a/builder/dockerfile.oracle_8.build +++ b/builder/dockerfile.oracle_8.build @@ -11,6 +11,7 @@ RUN \ dnf install -y \ bzip2-devel \ ca-certificates \ + ninja-build \ cmake \ nasm \ dnf-plugins-core \ diff --git a/builder/dockerfile.oracle_9.build b/builder/dockerfile.oracle_9.build index fb27999..aaa9184 100644 --- a/builder/dockerfile.oracle_9.build +++ b/builder/dockerfile.oracle_9.build @@ -11,6 +11,7 @@ RUN \ dnf install -y \ bzip2-devel \ ca-certificates \ + ninja-build \ cmake \ nasm \ dnf-plugins-core \ From cb00ca07c897b5a725b918e434dc654511552154 Mon Sep 17 00:00:00 2001 From: matt Date: Fri, 18 Apr 2025 16:44:46 +0000 Subject: [PATCH 032/150] KASM-7202 run web code from source using node --- BUILDING.txt | 33 +++++++++++++++++++++++ CMakeLists.txt | 2 +- builder/build.sh | 15 ++++++----- builder/conf/nginx_kasm.conf | 42 +++++++++++++++++++++++++++++ builder/dockerfile.ubuntu_jammy.dev | 9 +++++-- 5 files changed, 91 insertions(+), 10 deletions(-) create mode 100644 builder/conf/nginx_kasm.conf diff --git a/BUILDING.txt b/BUILDING.txt index 4bfaa3f..21c33f6 100644 --- a/BUILDING.txt +++ b/BUILDING.txt @@ -105,6 +105,39 @@ Now run Xvnc and Xfce4 from inside the container Now open a browser and navigate to your dev VM on port 6901. +Running noVNC from source +------------------------- +If you need to debug or make changes to the UI code, use the following procedures to use npm to serve the web code. The code will automatically rebuild when changes are made and the code will not be packaged. +These steps assume you have already built the docker image covered in the previous section named `kasmvnc:dev`. + +```bash +# run an instance of the dev container, expose an additional port +sudo docker run -it -v ./:/src -p 6901:6901 -p 8443:8443 --name kasmvnc_dev kasmvnc:dev +``` + +Now from inside the container. **This assumes KasmVNC is already built, follow steps above if you need to build KasmVNC** + +```bash +# Run KasmVNC +/src/xorg.build/bin/Xvnc -interface 0.0.0.0 -PublicIP 127.0.0.1 -disableBasicAuth -RectThreads 0 -Log *:stdout:100 -httpd /src/kasmweb/dist -sslOnly 0 -SecurityTypes None -websocketPort 6901 :1 & +/usr/bin/xfce4-session --display :1 & + +sudo nginx +cd kasmweb +npm install +npm run serve # <-- Needs to run in foreground +``` + +Now open a browser and navigate to your dev VM on port 8443 over https. + +NGINX is proxying the websocket to KasmVNC and all other requests go to the node server. NGINX listens on 8443 with ssl. + +Since `npm run serve` needs to run in the foreground, you may need to exec into the container from another terminal to run additional commands like stopping Xvnc, rebuilding KasmVNC, etc. + +```bash +sudo docker exec -it kasmvnc_dev /bin/bash +``` + Building the KasmVNC Server on Modern Unix/Linux Systems --------------------------------------------------------- diff --git a/CMakeLists.txt b/CMakeLists.txt index 22f21dc..2276b74 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -242,7 +242,7 @@ if(ENABLE_NLS) add_subdirectory(po) endif() -####add_subdirectory(tests) +#############add_subdirectory(tests) include(cmake/BuildPackages.cmake) diff --git a/builder/build.sh b/builder/build.sh index be9d899..2957e64 100755 --- a/builder/build.sh +++ b/builder/build.sh @@ -119,24 +119,25 @@ make -j5 # modifications for the servertarball cd /src mkdir -p xorg.build/bin +mkdir -p xorg.build/lib cd xorg.build/bin/ -ln -s /src/unix/xserver/hw/vnc/Xvnc Xvnc +ln -sf /src/unix/xserver/hw/vnc/Xvnc Xvnc cd .. mkdir -p man/man1 touch man/man1/Xserver.1 cp /src/unix/xserver/hw/vnc/Xvnc.man man/man1/Xvnc.1 -mkdir lib + cd lib if [ -d /usr/lib/x86_64-linux-gnu/dri ]; then - ln -s /usr/lib/x86_64-linux-gnu/dri dri + ln -sfn /usr/lib/x86_64-linux-gnu/dri dri elif [ -d /usr/lib/aarch64-linux-gnu/dri ]; then - ln -s /usr/lib/aarch64-linux-gnu/dri dri + ln -sfn /usr/lib/aarch64-linux-gnu/dri dri elif [ -d /usr/lib/arm-linux-gnueabihf/dri ]; then - ln -s /usr/lib/arm-linux-gnueabihf/dri dri + ln -sfn /usr/lib/arm-linux-gnueabihf/dri dri elif [ -d /usr/lib/xorg/modules/dri ]; then - ln -s /usr/lib/xorg/modules/dri dri + ln -sfn /usr/lib/xorg/modules/dri dri else - ln -s /usr/lib64/dri dri + ln -sfn /usr/lib64/dri dri fi cd /src diff --git a/builder/conf/nginx_kasm.conf b/builder/conf/nginx_kasm.conf new file mode 100644 index 0000000..a341c59 --- /dev/null +++ b/builder/conf/nginx_kasm.conf @@ -0,0 +1,42 @@ +server { + listen 8443 ssl; + ssl_certificate /etc/ssl/certs/ssl-cert-snakeoil.pem; + ssl_certificate_key /etc/ssl/private/ssl-cert-snakeoil.key; + + location / { + proxy_pass http://127.0.0.1:5173; + } + + location /api/ { + proxy_pass https://127.0.0.1:6901; + } + + location /websockify { + # The following configurations must be configured when proxying to Kasm Workspaces + + # WebSocket Support + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + + # Host and X headers + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + + # Connectivity Options + proxy_http_version 1.1; + proxy_read_timeout 1800s; + proxy_send_timeout 1800s; + proxy_connect_timeout 1800s; + proxy_buffering off; + + # Allow large requests to support file uploads to sessions + client_max_body_size 10M; + + # # Proxy to KasmVNC using SSL + #proxy_pass https://127.0.0.1:6901; + # Proxy to KasmVNC without SSL + proxy_pass http://127.0.0.1:6901; + } + } \ No newline at end of file diff --git a/builder/dockerfile.ubuntu_jammy.dev b/builder/dockerfile.ubuntu_jammy.dev index d13638d..803e2a6 100644 --- a/builder/dockerfile.ubuntu_jammy.dev +++ b/builder/dockerfile.ubuntu_jammy.dev @@ -10,13 +10,18 @@ EXPOSE 6901 USER root +COPY builder/conf/nginx_kasm.conf /etc/nginx/conf.d/ + RUN sed -i 's$# deb-src$deb-src$' /etc/apt/sources.list && \ apt update && \ - apt install -y socat sudo libxfont-dev cmake git libgnutls28-dev vim wget tightvncserver curl libpng-dev libtiff-dev libgif-dev libavcodec-dev libssl-dev libxrandr-dev libxcursor-dev pkg-config libfreetype6-dev libxtst-dev autoconf automake libtool xutils-dev libpixman-1-dev libxshmfence-dev libxcvt-dev libxkbfile-dev x11proto-dev libgbm-dev inotify-tools && \ + apt install -y socat vim wget tightvncserver curl inotify-tools sudo \ + libxfont-dev libgnutls28-dev libpng-dev libtiff-dev libgif-dev libavcodec-dev libssl-dev libxrandr-dev libxcursor-dev pkg-config libfreetype6-dev \ + libxtst-dev xutils-dev libpixman-1-dev libxshmfence-dev libxcvt-dev libxkbfile-dev x11proto-dev libgbm-dev \ + cmake git autoconf automake libtool && \ echo "kasm-user ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers RUN curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash - -RUN apt install -y nodejs +RUN apt install -y nodejs nginx USER 1000 From 4a4c5f1c499527b23da29c274b62d16b2e7948bb Mon Sep 17 00:00:00 2001 From: El Date: Sat, 19 Apr 2025 00:43:29 +0500 Subject: [PATCH 033/150] KASM-7194 Refactor build scripts and enable conditional test builds --- CMakeLists.txt | 5 +- builder/build.sh | 129 +++++++++++++++++++++++------------------------ 2 files changed, 66 insertions(+), 68 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 22f21dc..537063e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -242,8 +242,9 @@ if(ENABLE_NLS) add_subdirectory(po) endif() -####add_subdirectory(tests) - +if (TESTS) + add_subdirectory(tests) +endif () include(cmake/BuildPackages.cmake) diff --git a/builder/build.sh b/builder/build.sh index b35f83d..ed481df 100755 --- a/builder/build.sh +++ b/builder/build.sh @@ -45,8 +45,10 @@ else XORG_PATCH=$(echo "$XORG_VER" | grep -Po '^\d.\d+' | sed 's#\.##') fi -if [ ! -f xorg-server-"${XORG_VER}".tar.gz ]; then - wget --no-check-certificate https://www.x.org/archive/individual/xserver/xorg-server-"${XORG_VER}".tar.gz +TARBALL="xorg-server-${XORG_VER}.tar.gz" + +if [ ! -f "$TARBALL" ]; then + wget --no-check-certificate https://www.x.org/archive/individual/xserver/"$TARBALL" fi #git clone https://kasmweb@bitbucket.org/kasmtech/kasmvnc.git @@ -54,96 +56,91 @@ fi #git checkout dynjpeg cd /src -# We only want the server, so FLTK and manual tests aren't useful. -# Alternatively, install fltk 1.3 and its dev packages. -sed -i -e '/find_package(FLTK/s@^@#@' \ - -e '/add_subdirectory(tests/s@^@#@' \ - CMakeLists.txt - cmake -D CMAKE_BUILD_TYPE=RelWithDebInfo . -DBUILD_VIEWER:BOOL=OFF \ -DENABLE_GNUTLS:BOOL=OFF make -j"$(nproc)" -tar -C unix/xserver -xf /tmp/xorg-server-${XORG_VER}.tar.gz --strip-components=1 +if [ ! -d unix/xserver/include ]; then + tar -C unix/xserver -xf /tmp/"$TARBALL" --strip-components=1 -cd unix/xserver -# Apply patches -patch -Np1 -i ../xserver${XORG_PATCH}.patch -case "$XORG_VER" in - 1.20.*) - patch -s -p0 < ../CVE-2022-2320-v1.20.patch - if [ -f ../xserver120.7.patch ]; then - patch -Np1 -i ../xserver120.7.patch - fi ;; - 1.19.*) - patch -s -p0 < ../CVE-2022-2320-v1.19.patch - ;; -esac + cd unix/xserver + # Apply patches + patch -Np1 -i ../xserver"${XORG_PATCH}".patch + case "$XORG_VER" in + 1.20.*) + patch -s -p0 < ../CVE-2022-2320-v1.20.patch + if [ -f ../xserver120.7.patch ]; then + patch -Np1 -i ../xserver120.7.patch + fi ;; + 1.19.*) + patch -s -p0 < ../CVE-2022-2320-v1.19.patch + ;; + esac -autoreconf -i -# Configuring Xorg is long and has many distro-specific paths. -# The distro paths start after prefix and end with the font path, -# everything after that is based on BUILDING.txt to remove unneeded -# components. -# remove gl check for opensuse -if [ "${KASMVNC_BUILD_OS}" == "opensuse" ] || ([ "${KASMVNC_BUILD_OS}" == "oracle" ] && [ "${KASMVNC_BUILD_OS_CODENAME}" == 9 ]); then - sed -i 's/LIBGL="gl >= 7.1.0"/LIBGL="gl >= 1.1"/g' configure + autoreconf -i + # Configuring Xorg is long and has many distro-specific paths. + # The distro paths start after prefix and end with the font path, + # everything after that is based on BUILDING.txt to remove unneeded + # components. + # remove gl check for opensuse + if [ "${KASMVNC_BUILD_OS}" == "opensuse" ] || ([ "${KASMVNC_BUILD_OS}" == "oracle" ] && [ "${KASMVNC_BUILD_OS_CODENAME}" == 9 ]); then + sed -i 's/LIBGL="gl >= 7.1.0"/LIBGL="gl >= 1.1"/g' configure + fi + + # build X11 + ./configure \ + --disable-config-hal \ + --disable-config-udev \ + --disable-dmx \ + --disable-dri \ + --disable-dri2 \ + --disable-kdrive \ + --disable-static \ + --disable-xephyr \ + --disable-xinerama \ + --disable-xnest \ + --disable-xorg \ + --disable-xvfb \ + --disable-xwayland \ + --disable-xwin \ + --enable-glx \ + --prefix=/opt/kasmweb \ + --with-default-font-path="/usr/share/fonts/X11/misc,/usr/share/fonts/X11/cyrillic,/usr/share/fonts/X11/100dpi/:unscaled,/usr/share/fonts/X11/75dpi/:unscaled,/usr/share/fonts/X11/Type1,/usr/share/fonts/X11/100dpi,/usr/share/fonts/X11/75dpi,built-ins" \ + --without-dtrace \ + --with-sha1=libcrypto \ + --with-xkb-bin-directory=/usr/bin \ + --with-xkb-output=/var/lib/xkb \ + --with-xkb-path=/usr/share/X11/xkb "${CONFIG_OPTIONS}" + + # remove array bounds errors for new versions of GCC + find . -name "Makefile" -exec sed -i 's/-Werror=array-bounds//g' {} \; fi -# build X11 -./configure \ - --disable-config-hal \ - --disable-config-udev \ - --disable-dmx \ - --disable-dri \ - --disable-dri2 \ - --disable-kdrive \ - --disable-static \ - --disable-xephyr \ - --disable-xinerama \ - --disable-xnest \ - --disable-xorg \ - --disable-xvfb \ - --disable-xwayland \ - --disable-xwin \ - --enable-glx \ - --prefix=/opt/kasmweb \ - --with-default-font-path="/usr/share/fonts/X11/misc,/usr/share/fonts/X11/cyrillic,/usr/share/fonts/X11/100dpi/:unscaled,/usr/share/fonts/X11/75dpi/:unscaled,/usr/share/fonts/X11/Type1,/usr/share/fonts/X11/100dpi,/usr/share/fonts/X11/75dpi,built-ins" \ - --without-dtrace \ - --with-sha1=libcrypto \ - --with-xkb-bin-directory=/usr/bin \ - --with-xkb-output=/var/lib/xkb \ - --with-xkb-path=/usr/share/X11/xkb ${CONFIG_OPTIONS} - -# remove array bounds errors for new versions of GCC -find . -name "Makefile" -exec sed -i 's/-Werror=array-bounds//g' {} \; make -j"$(nproc)" # modifications for the servertarball cd /src mkdir -p xorg.build/bin cd xorg.build/bin/ -ln -sf /src/unix/xserver/hw/vnc/Xvnc Xvnc +ln -sfn /src/unix/xserver/hw/vnc/Xvnc Xvnc cd .. mkdir -p man/man1 touch man/man1/Xserver.1 cp /src/unix/xserver/hw/vnc/Xvnc.man man/man1/Xvnc.1 -if [ ! -d lib ]; then - mkdir lib -fi +mkdir -p lib cd lib if [ -d /usr/lib/x86_64-linux-gnu/dri ]; then - ln -s /usr/lib/x86_64-linux-gnu/dri dri + ln -sfn /usr/lib/x86_64-linux-gnu/dri dri elif [ -d /usr/lib/aarch64-linux-gnu/dri ]; then - ln -s /usr/lib/aarch64-linux-gnu/dri dri + ln -sfn /usr/lib/aarch64-linux-gnu/dri dri elif [ -d /usr/lib/arm-linux-gnueabihf/dri ]; then - ln -s /usr/lib/arm-linux-gnueabihf/dri dri + ln -sfn /usr/lib/arm-linux-gnueabihf/dri dri elif [ -d /usr/lib/xorg/modules/dri ]; then - ln -s /usr/lib/xorg/modules/dri dri + ln -sfn /usr/lib/xorg/modules/dri dri else - ln -s /usr/lib64/dri dri + ln -sfn /usr/lib64/dri dri fi cd /src From 60f015b1997f3ff8eb1ed29739342b74fa430d7a Mon Sep 17 00:00:00 2001 From: Rodwin Spruel Date: Tue, 22 Apr 2025 11:22:20 +0000 Subject: [PATCH 034/150] Adding ability to override webp benchmark value --- common/rfb/EncodeManager.cxx | 2 +- common/rfb/ServerCore.cxx | 5 +++++ common/rfb/ServerCore.h | 1 + common/rfb/TightWEBPEncoder.cxx | 5 +++-- unix/vncserver | 9 +++++++++ 5 files changed, 19 insertions(+), 3 deletions(-) diff --git a/common/rfb/EncodeManager.cxx b/common/rfb/EncodeManager.cxx index 5e94cdc..30bfdce 100644 --- a/common/rfb/EncodeManager.cxx +++ b/common/rfb/EncodeManager.cxx @@ -395,7 +395,7 @@ void EncodeManager::doUpdate(bool allowLossy, const Region& changed_, screenArea = pb->getRect().width() * pb->getRect().height(); screenArea *= 1024; screenArea /= 256 * 256; - screenArea *= webpBenchResult; + screenArea *= screenArea *= Server::webpEncodingTime > 0 ? Server::webpEncodingTime : webpBenchResult; // Encoding the entire screen would take this many 1024*msecs, worst case // Calculate how many us we can send webp for, before switching to jpeg diff --git a/common/rfb/ServerCore.cxx b/common/rfb/ServerCore.cxx index 03a69d9..3c15be6 100644 --- a/common/rfb/ServerCore.cxx +++ b/common/rfb/ServerCore.cxx @@ -287,3 +287,8 @@ rfb::PresetParameter rfb::Server::preferBandwidth ("PreferBandwidth", "Set various options for lower bandwidth use. The default is off, aka to prefer quality.", false, bandwidthPreset); + +rfb::IntParameter rfb::Server::webpEncodingTime +("udpPort", + "Sets the benchmak WebP encoding time in KasmVNC. Default is calculated in TightWEBPEncoder benchmark function", + 0, 0, 10000); diff --git a/common/rfb/ServerCore.h b/common/rfb/ServerCore.h index 2035cf6..c3a53e5 100644 --- a/common/rfb/ServerCore.h +++ b/common/rfb/ServerCore.h @@ -91,6 +91,7 @@ namespace rfb { static BoolParameter ignoreClientSettingsKasm; static BoolParameter selfBench; static PresetParameter preferBandwidth; + static IntParameter webpEncodingTime; }; }; diff --git a/common/rfb/TightWEBPEncoder.cxx b/common/rfb/TightWEBPEncoder.cxx index 89d9b3a..2e79c6c 100644 --- a/common/rfb/TightWEBPEncoder.cxx +++ b/common/rfb/TightWEBPEncoder.cxx @@ -259,13 +259,14 @@ void TightWEBPEncoder::writeRect(const PixelBuffer* pb, const Palette& palette) WebPMemoryWriterClear(&wrt); } -// How many milliseconds would it take to encode a 256x256 block at quality 8 +// How many milliseconds would it take to encode a 256x256 block at quality 5 rdr::U32 TightWEBPEncoder::benchmark() const { rdr::U8* buffer; struct timeval start; int stride, i; - const uint8_t quality = 8, method = 2; + // the minimum WebP quality settings used in KasmVNC + const uint8_t quality = 5, method = 0; WebPConfig cfg; WebPPicture pic; WebPMemoryWriter wrt; diff --git a/unix/vncserver b/unix/vncserver index 41fc1be..eb2695f 100755 --- a/unix/vncserver +++ b/unix/vncserver @@ -2068,6 +2068,15 @@ sub DefineConfigToCLIConversion { $value; } }), + KasmVNC::CliOption->new({ + name => 'webpEncodingTime', + configKeys => [ + KasmVNC::ConfigKey->new({ + name => "encoding.video_encoding_mode.webp_encoding_time", + type => KasmVNC::ConfigKey::INT + }) + ] + }), KasmVNC::CliOption->new({ name => 'CompareFB', configKeys => [ From 2dbcd283545921d4c9a53196e0bd461d2d2fd25d Mon Sep 17 00:00:00 2001 From: Rodwin Spruel Date: Tue, 22 Apr 2025 11:22:20 +0000 Subject: [PATCH 035/150] Adding ability to override webp benchmark value --- common/rfb/EncodeManager.cxx | 2 +- common/rfb/ServerCore.cxx | 5 +++++ common/rfb/ServerCore.h | 1 + common/rfb/TightWEBPEncoder.cxx | 5 +++-- unix/vncserver | 9 +++++++++ 5 files changed, 19 insertions(+), 3 deletions(-) diff --git a/common/rfb/EncodeManager.cxx b/common/rfb/EncodeManager.cxx index 5e94cdc..30bfdce 100644 --- a/common/rfb/EncodeManager.cxx +++ b/common/rfb/EncodeManager.cxx @@ -395,7 +395,7 @@ void EncodeManager::doUpdate(bool allowLossy, const Region& changed_, screenArea = pb->getRect().width() * pb->getRect().height(); screenArea *= 1024; screenArea /= 256 * 256; - screenArea *= webpBenchResult; + screenArea *= screenArea *= Server::webpEncodingTime > 0 ? Server::webpEncodingTime : webpBenchResult; // Encoding the entire screen would take this many 1024*msecs, worst case // Calculate how many us we can send webp for, before switching to jpeg diff --git a/common/rfb/ServerCore.cxx b/common/rfb/ServerCore.cxx index 03a69d9..3c15be6 100644 --- a/common/rfb/ServerCore.cxx +++ b/common/rfb/ServerCore.cxx @@ -287,3 +287,8 @@ rfb::PresetParameter rfb::Server::preferBandwidth ("PreferBandwidth", "Set various options for lower bandwidth use. The default is off, aka to prefer quality.", false, bandwidthPreset); + +rfb::IntParameter rfb::Server::webpEncodingTime +("udpPort", + "Sets the benchmak WebP encoding time in KasmVNC. Default is calculated in TightWEBPEncoder benchmark function", + 0, 0, 10000); diff --git a/common/rfb/ServerCore.h b/common/rfb/ServerCore.h index 2035cf6..c3a53e5 100644 --- a/common/rfb/ServerCore.h +++ b/common/rfb/ServerCore.h @@ -91,6 +91,7 @@ namespace rfb { static BoolParameter ignoreClientSettingsKasm; static BoolParameter selfBench; static PresetParameter preferBandwidth; + static IntParameter webpEncodingTime; }; }; diff --git a/common/rfb/TightWEBPEncoder.cxx b/common/rfb/TightWEBPEncoder.cxx index 89d9b3a..2e79c6c 100644 --- a/common/rfb/TightWEBPEncoder.cxx +++ b/common/rfb/TightWEBPEncoder.cxx @@ -259,13 +259,14 @@ void TightWEBPEncoder::writeRect(const PixelBuffer* pb, const Palette& palette) WebPMemoryWriterClear(&wrt); } -// How many milliseconds would it take to encode a 256x256 block at quality 8 +// How many milliseconds would it take to encode a 256x256 block at quality 5 rdr::U32 TightWEBPEncoder::benchmark() const { rdr::U8* buffer; struct timeval start; int stride, i; - const uint8_t quality = 8, method = 2; + // the minimum WebP quality settings used in KasmVNC + const uint8_t quality = 5, method = 0; WebPConfig cfg; WebPPicture pic; WebPMemoryWriter wrt; diff --git a/unix/vncserver b/unix/vncserver index 41fc1be..eb2695f 100755 --- a/unix/vncserver +++ b/unix/vncserver @@ -2068,6 +2068,15 @@ sub DefineConfigToCLIConversion { $value; } }), + KasmVNC::CliOption->new({ + name => 'webpEncodingTime', + configKeys => [ + KasmVNC::ConfigKey->new({ + name => "encoding.video_encoding_mode.webp_encoding_time", + type => KasmVNC::ConfigKey::INT + }) + ] + }), KasmVNC::CliOption->new({ name => 'CompareFB', configKeys => [ From 7353f386524c4ee6baf7ecb558322a65375e04e1 Mon Sep 17 00:00:00 2001 From: "Rodwin.Spruel" Date: Tue, 22 Apr 2025 10:39:53 -0400 Subject: [PATCH 036/150] Adding defaults and fixing typo --- common/rfb/ServerCore.cxx | 4 ++-- unix/kasmvnc_defaults.yaml | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/common/rfb/ServerCore.cxx b/common/rfb/ServerCore.cxx index 3c15be6..f242b54 100644 --- a/common/rfb/ServerCore.cxx +++ b/common/rfb/ServerCore.cxx @@ -289,6 +289,6 @@ rfb::PresetParameter rfb::Server::preferBandwidth false, bandwidthPreset); rfb::IntParameter rfb::Server::webpEncodingTime -("udpPort", - "Sets the benchmak WebP encoding time in KasmVNC. Default is calculated in TightWEBPEncoder benchmark function", +("webpEncodingTime", + "Sets a weighted value that determines how much webp is used to balance bandwidth and CPU usage.", 0, 0, 10000); diff --git a/unix/kasmvnc_defaults.yaml b/unix/kasmvnc_defaults.yaml index 3d0551c..e75591e 100644 --- a/unix/kasmvnc_defaults.yaml +++ b/unix/kasmvnc_defaults.yaml @@ -129,6 +129,7 @@ encoding: logging: level: off scaling_algorithm: progressive_bilinear + webp_encoding_time: 0 compare_framebuffer: auto zrle_zlib_level: auto From 3bc040387767544dc3932aba1e50a7e07a1477a6 Mon Sep 17 00:00:00 2001 From: "Rodwin.Spruel" Date: Tue, 22 Apr 2025 17:17:58 -0400 Subject: [PATCH 037/150] Updating weighting function and limits Signed-off-by: Rodwin.Spruel --- common/rfb/EncodeManager.cxx | 3 ++- common/rfb/ServerCore.cxx | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/common/rfb/EncodeManager.cxx b/common/rfb/EncodeManager.cxx index 30bfdce..69142c0 100644 --- a/common/rfb/EncodeManager.cxx +++ b/common/rfb/EncodeManager.cxx @@ -395,7 +395,8 @@ void EncodeManager::doUpdate(bool allowLossy, const Region& changed_, screenArea = pb->getRect().width() * pb->getRect().height(); screenArea *= 1024; screenArea /= 256 * 256; - screenArea *= screenArea *= Server::webpEncodingTime > 0 ? Server::webpEncodingTime : webpBenchResult; + screenArea *= screenArea; + screenArea /= Server::webpEncodingTime > 1 ? Server::webpEncodingTime : 1; // Encoding the entire screen would take this many 1024*msecs, worst case // Calculate how many us we can send webp for, before switching to jpeg diff --git a/common/rfb/ServerCore.cxx b/common/rfb/ServerCore.cxx index f242b54..91174d6 100644 --- a/common/rfb/ServerCore.cxx +++ b/common/rfb/ServerCore.cxx @@ -291,4 +291,4 @@ rfb::PresetParameter rfb::Server::preferBandwidth rfb::IntParameter rfb::Server::webpEncodingTime ("webpEncodingTime", "Sets a weighted value that determines how much webp is used to balance bandwidth and CPU usage.", - 0, 0, 10000); + 1, 1, 1000); From f674e2c58df88038dab84f01baa4b7498e681b19 Mon Sep 17 00:00:00 2001 From: Rodwin Spruel Date: Tue, 22 Apr 2025 21:45:16 +0000 Subject: [PATCH 038/150] Fixing default value --- unix/kasmvnc_defaults.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unix/kasmvnc_defaults.yaml b/unix/kasmvnc_defaults.yaml index e75591e..c4e2a03 100644 --- a/unix/kasmvnc_defaults.yaml +++ b/unix/kasmvnc_defaults.yaml @@ -129,7 +129,7 @@ encoding: logging: level: off scaling_algorithm: progressive_bilinear - webp_encoding_time: 0 + webp_encoding_time: 1 compare_framebuffer: auto zrle_zlib_level: auto From 02852185a86475737bb047a3abbd099a9274af08 Mon Sep 17 00:00:00 2001 From: "Rodwin.Spruel" Date: Thu, 24 Apr 2025 05:57:25 -0400 Subject: [PATCH 039/150] Fixing webp usage calculation and updating default value --- common/rfb/EncodeManager.cxx | 4 ++-- unix/kasmvnc_defaults.yaml | 24 ++++++++++++------------ unix/vncserver | 18 +++++++++++++++--- 3 files changed, 29 insertions(+), 17 deletions(-) diff --git a/common/rfb/EncodeManager.cxx b/common/rfb/EncodeManager.cxx index 69142c0..cd855e9 100644 --- a/common/rfb/EncodeManager.cxx +++ b/common/rfb/EncodeManager.cxx @@ -395,8 +395,8 @@ void EncodeManager::doUpdate(bool allowLossy, const Region& changed_, screenArea = pb->getRect().width() * pb->getRect().height(); screenArea *= 1024; screenArea /= 256 * 256; - screenArea *= screenArea; - screenArea /= Server::webpEncodingTime > 1 ? Server::webpEncodingTime : 1; + screenArea *= webpBenchResult; + screenArea /= Server::webpEncodingTime; // Encoding the entire screen would take this many 1024*msecs, worst case // Calculate how many us we can send webp for, before switching to jpeg diff --git a/unix/kasmvnc_defaults.yaml b/unix/kasmvnc_defaults.yaml index c4e2a03..1f042ee 100644 --- a/unix/kasmvnc_defaults.yaml +++ b/unix/kasmvnc_defaults.yaml @@ -37,7 +37,7 @@ user_session: keyboard: remap_keys: - # - 0x22->0x40 + # - 0x22->0x40 ignore_numlock: false raw_keyboard: false @@ -92,16 +92,16 @@ data_loss_prevention: enabled: true rate_limit: unlimited watermark: - # image: /etc/kasmvnc/picture.png - # location: 10,10 - # tint: 255,20,20,128 - # repeat_spacing: 10 - #text: - # template: "${USER} %H:%M" - # font: auto - # font_size: 48 - # timezone_name: Australia/Adelaide - # angle: 0 + # image: /etc/kasmvnc/picture.png + # location: 10,10 + # tint: 255,20,20,128 + # repeat_spacing: 10 + #text: + # template: "${USER} %H:%M" + # font: auto + # font_size: 48 + # timezone_name: Australia/Adelaide + # angle: 0 logging: # "verbose" SETTING LOGS YOUR PRIVATE INFORMATION. Keypresses and clipboard content level: off @@ -129,7 +129,7 @@ encoding: logging: level: off scaling_algorithm: progressive_bilinear - webp_encoding_time: 1 + webp_encoding_time: auto compare_framebuffer: auto zrle_zlib_level: auto diff --git a/unix/vncserver b/unix/vncserver index eb2695f..975d4a9 100755 --- a/unix/vncserver +++ b/unix/vncserver @@ -2069,13 +2069,25 @@ sub DefineConfigToCLIConversion { } }), KasmVNC::CliOption->new({ - name => 'webpEncodingTime', + name => 'WebpEncodingTime', configKeys => [ KasmVNC::ConfigKey->new({ name => "encoding.video_encoding_mode.webp_encoding_time", - type => KasmVNC::ConfigKey::INT + validator => KasmVNC::PatternValidator->new({ + pattern => qr/^(auto|[1-9][0-9]{0,2}|1000)$/, + errorMessage => "must be 'auto' or a number in 1..1000" + }), }) - ] + ], + deriveValueSub => sub { + my $self = shift; + my $value = $self->configValue(); + + if ($value eq "auto") { + $value = 1; + } + $value; + } }), KasmVNC::CliOption->new({ name => 'CompareFB', From 00b8d025db7ab77471e29652c2f0d7bb22a144f7 Mon Sep 17 00:00:00 2001 From: matt Date: Thu, 24 Apr 2025 16:50:44 +0000 Subject: [PATCH 040/150] KASM-7125 fixed issue with rebuilding Xvnc, switched to simplier webp mix math. --- builder/build.sh | 79 +++++++++++++++++++----------------- common/rfb/EncodeManager.cxx | 15 +------ common/rfb/ServerCore.cxx | 4 +- unix/kasmvnc_defaults.yaml | 22 +++++----- unix/vncserver | 30 ++++---------- 5 files changed, 65 insertions(+), 85 deletions(-) diff --git a/builder/build.sh b/builder/build.sh index ed481df..332fd27 100755 --- a/builder/build.sh +++ b/builder/build.sh @@ -76,46 +76,49 @@ if [ ! -d unix/xserver/include ]; then patch -s -p0 < ../CVE-2022-2320-v1.19.patch ;; esac - - autoreconf -i - # Configuring Xorg is long and has many distro-specific paths. - # The distro paths start after prefix and end with the font path, - # everything after that is based on BUILDING.txt to remove unneeded - # components. - # remove gl check for opensuse - if [ "${KASMVNC_BUILD_OS}" == "opensuse" ] || ([ "${KASMVNC_BUILD_OS}" == "oracle" ] && [ "${KASMVNC_BUILD_OS_CODENAME}" == 9 ]); then - sed -i 's/LIBGL="gl >= 7.1.0"/LIBGL="gl >= 1.1"/g' configure - fi - - # build X11 - ./configure \ - --disable-config-hal \ - --disable-config-udev \ - --disable-dmx \ - --disable-dri \ - --disable-dri2 \ - --disable-kdrive \ - --disable-static \ - --disable-xephyr \ - --disable-xinerama \ - --disable-xnest \ - --disable-xorg \ - --disable-xvfb \ - --disable-xwayland \ - --disable-xwin \ - --enable-glx \ - --prefix=/opt/kasmweb \ - --with-default-font-path="/usr/share/fonts/X11/misc,/usr/share/fonts/X11/cyrillic,/usr/share/fonts/X11/100dpi/:unscaled,/usr/share/fonts/X11/75dpi/:unscaled,/usr/share/fonts/X11/Type1,/usr/share/fonts/X11/100dpi,/usr/share/fonts/X11/75dpi,built-ins" \ - --without-dtrace \ - --with-sha1=libcrypto \ - --with-xkb-bin-directory=/usr/bin \ - --with-xkb-output=/var/lib/xkb \ - --with-xkb-path=/usr/share/X11/xkb "${CONFIG_OPTIONS}" - - # remove array bounds errors for new versions of GCC - find . -name "Makefile" -exec sed -i 's/-Werror=array-bounds//g' {} \; +else + cd unix/xserver fi +autoreconf -i +# Configuring Xorg is long and has many distro-specific paths. +# The distro paths start after prefix and end with the font path, +# everything after that is based on BUILDING.txt to remove unneeded +# components. +# remove gl check for opensuse +if [ "${KASMVNC_BUILD_OS}" == "opensuse" ] || ([ "${KASMVNC_BUILD_OS}" == "oracle" ] && [ "${KASMVNC_BUILD_OS_CODENAME}" == 9 ]); then + sed -i 's/LIBGL="gl >= 7.1.0"/LIBGL="gl >= 1.1"/g' configure +fi + +# build X11 +./configure \ + --disable-config-hal \ + --disable-config-udev \ + --disable-dmx \ + --disable-dri \ + --disable-dri2 \ + --disable-kdrive \ + --disable-static \ + --disable-xephyr \ + --disable-xinerama \ + --disable-xnest \ + --disable-xorg \ + --disable-xvfb \ + --disable-xwayland \ + --disable-xwin \ + --enable-glx \ + --prefix=/opt/kasmweb \ + --with-default-font-path="/usr/share/fonts/X11/misc,/usr/share/fonts/X11/cyrillic,/usr/share/fonts/X11/100dpi/:unscaled,/usr/share/fonts/X11/75dpi/:unscaled,/usr/share/fonts/X11/Type1,/usr/share/fonts/X11/100dpi,/usr/share/fonts/X11/75dpi,built-ins" \ + --without-dtrace \ + --with-sha1=libcrypto \ + --with-xkb-bin-directory=/usr/bin \ + --with-xkb-output=/var/lib/xkb \ + --with-xkb-path=/usr/share/X11/xkb "${CONFIG_OPTIONS}" + +# remove array bounds errors for new versions of GCC +find . -name "Makefile" -exec sed -i 's/-Werror=array-bounds//g' {} \; + + make -j"$(nproc)" # modifications for the servertarball diff --git a/common/rfb/EncodeManager.cxx b/common/rfb/EncodeManager.cxx index cd855e9..5dbf1dc 100644 --- a/common/rfb/EncodeManager.cxx +++ b/common/rfb/EncodeManager.cxx @@ -360,7 +360,6 @@ void EncodeManager::doUpdate(bool allowLossy, const Region& changed_, int nRects; Region changed, cursorRegion; struct timeval start; - unsigned screenArea; updates++; if (conn->cp.supportsUdp) @@ -390,17 +389,7 @@ void EncodeManager::doUpdate(bool allowLossy, const Region& changed_, memset(&webpstats, 0, sizeof(codecstats_t)); if (allowLossy && activeEncoders[encoderFullColour] == encoderTightWEBP) { - const unsigned rate = 1024 * 1000 / rfb::Server::frameRate; - - screenArea = pb->getRect().width() * pb->getRect().height(); - screenArea *= 1024; - screenArea /= 256 * 256; - screenArea *= webpBenchResult; - screenArea /= Server::webpEncodingTime; - // Encoding the entire screen would take this many 1024*msecs, worst case - - // Calculate how many us we can send webp for, before switching to jpeg - webpFallbackUs = rate * rate / screenArea; + webpFallbackUs = (1000 * 1000 / rfb::Server::frameRate) * (static_cast(Server::webpEncodingTime) / 100.0); } /* @@ -884,7 +873,7 @@ void EncodeManager::findSolidRect(const Rect& rect, Region *changed, void EncodeManager::checkWebpFallback(const timeval *start) { // Have we taken too long for the frame? If so, drop from WEBP to JPEG if (start && activeEncoders[encoderFullColour] == encoderTightWEBP && !webpTookTooLong.load(std::memory_order_relaxed)) { - const auto us = msSince(start) * 1024; + const auto us = msSince(start) * 1000; if (us > webpFallbackUs) webpTookTooLong.store(true, std::memory_order_relaxed); } diff --git a/common/rfb/ServerCore.cxx b/common/rfb/ServerCore.cxx index 91174d6..3881693 100644 --- a/common/rfb/ServerCore.cxx +++ b/common/rfb/ServerCore.cxx @@ -290,5 +290,5 @@ rfb::PresetParameter rfb::Server::preferBandwidth rfb::IntParameter rfb::Server::webpEncodingTime ("webpEncodingTime", - "Sets a weighted value that determines how much webp is used to balance bandwidth and CPU usage.", - 1, 1, 1000); + "Percentage of time allotted for encoding a frame, that can be used for encoding rects in webp.", + 30, 0, 100); diff --git a/unix/kasmvnc_defaults.yaml b/unix/kasmvnc_defaults.yaml index 1f042ee..afad666 100644 --- a/unix/kasmvnc_defaults.yaml +++ b/unix/kasmvnc_defaults.yaml @@ -92,16 +92,16 @@ data_loss_prevention: enabled: true rate_limit: unlimited watermark: - # image: /etc/kasmvnc/picture.png - # location: 10,10 - # tint: 255,20,20,128 - # repeat_spacing: 10 - #text: - # template: "${USER} %H:%M" - # font: auto - # font_size: 48 - # timezone_name: Australia/Adelaide - # angle: 0 + # image: /etc/kasmvnc/picture.png + # location: 10,10 + # tint: 255,20,20,128 + # repeat_spacing: 10 + #text: + # template: "${USER} %H:%M" + # font: auto + # font_size: 48 + # timezone_name: Australia/Adelaide + # angle: 0 logging: # "verbose" SETTING LOGS YOUR PRIVATE INFORMATION. Keypresses and clipboard content level: off @@ -129,7 +129,7 @@ encoding: logging: level: off scaling_algorithm: progressive_bilinear - webp_encoding_time: auto + webp_encoding_time: 30 compare_framebuffer: auto zrle_zlib_level: auto diff --git a/unix/vncserver b/unix/vncserver index 975d4a9..1ac99c8 100755 --- a/unix/vncserver +++ b/unix/vncserver @@ -2068,27 +2068,15 @@ sub DefineConfigToCLIConversion { $value; } }), - KasmVNC::CliOption->new({ - name => 'WebpEncodingTime', - configKeys => [ - KasmVNC::ConfigKey->new({ - name => "encoding.video_encoding_mode.webp_encoding_time", - validator => KasmVNC::PatternValidator->new({ - pattern => qr/^(auto|[1-9][0-9]{0,2}|1000)$/, - errorMessage => "must be 'auto' or a number in 1..1000" - }), - }) - ], - deriveValueSub => sub { - my $self = shift; - my $value = $self->configValue(); - - if ($value eq "auto") { - $value = 1; - } - $value; - } - }), + KasmVNC::CliOption->new({ + name => 'WebpEncodingTime', + configKeys => [ + KasmVNC::ConfigKey->new({ + name => "encoding.video_encoding_mode.webp_encoding_time", + type => KasmVNC::ConfigKey::INT + }) + ] + }), KasmVNC::CliOption->new({ name => 'CompareFB', configKeys => [ From 49906f1d6bcd926ed08e3ccc74d9307553145925 Mon Sep 17 00:00:00 2001 From: El Date: Fri, 28 Mar 2025 15:59:07 +0500 Subject: [PATCH 041/150] KASM-6984 Add `elapsedMs` function for time measurement in milliseconds using modern C++ --- common/rfb/util.cxx | 9 +++++++-- common/rfb/util.h | 14 ++++++++++++-- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/common/rfb/util.cxx b/common/rfb/util.cxx index 649eb0b..a0f5cac 100644 --- a/common/rfb/util.cxx +++ b/common/rfb/util.cxx @@ -21,8 +21,8 @@ #include #endif -#include -#include +#include +#include #include #include @@ -572,6 +572,11 @@ namespace rfb { return msBetween(then, &now); } + uint64_t elapsedMs(std::chrono::high_resolution_clock::time_point start) + { + return std::chrono::duration_cast(std::chrono::high_resolution_clock::now() - start).count(); + } + bool isBefore(const struct timeval *first, const struct timeval *second) { diff --git a/common/rfb/util.h b/common/rfb/util.h index 3100f90..18d38ac 100644 --- a/common/rfb/util.h +++ b/common/rfb/util.h @@ -28,8 +28,9 @@ #include #endif -#include -#include +#include +#include +#include struct timeval; @@ -127,6 +128,15 @@ namespace rfb { // Returns time elapsed since given moment in milliseconds. unsigned msSince(const struct timeval *then); + /** + * Calculates the number of milliseconds elapsed since a given starting point. + * + * @param start The starting time point of type `std::chrono::high_resolution_clock::time_point`. + * + * @return The elapsed time in milliseconds as an unsigned 64-bit integer. + */ + uint64_t elapsedMs(std::chrono::high_resolution_clock::time_point start); + // Returns true if first happened before seconds bool isBefore(const struct timeval *first, const struct timeval *second); From f6c0fa9a53164fbf11d29165f6330018861eb4c2 Mon Sep 17 00:00:00 2001 From: El Date: Fri, 28 Mar 2025 16:01:11 +0500 Subject: [PATCH 042/150] KASM-6984 Replaced macros with constexpr for readability and type safety. Introduced a generalized benchmarking template for reuse and cleaned up repetitive code. Added XML output for test results using TinyXML2 to improve reporting and analysis. --- common/rfb/SelfBench.cxx | 182 +++++++++++++++++++-------------------- 1 file changed, 89 insertions(+), 93 deletions(-) diff --git a/common/rfb/SelfBench.cxx b/common/rfb/SelfBench.cxx index fd224d3..550d6dd 100644 --- a/common/rfb/SelfBench.cxx +++ b/common/rfb/SelfBench.cxx @@ -26,27 +26,42 @@ #include #include #include -#include -#include +#include +#include +#include +#include using namespace rfb; static LogWriter vlog("SelfBench"); static const PixelFormat pfRGBX(32, 24, false, true, 255, 255, 255, 0, 8, 16); -#define RUNS 64 +static constexpr uint32_t RUNS = 64; -#define W 1600 -#define H 1200 +static constexpr uint32_t WIDTH = 1600; +static constexpr uint32_t HEIGHT = 1200; + +template +constexpr bool has_no_args = std::is_invocable_v; + +template +constexpr bool has_one_arg = std::is_invocable_v; void SelfBench() { + tinyxml2::XMLDocument doc; - unsigned i, runs; - struct timeval start; + auto *root = doc.NewElement("testsuites"); + root->SetAttribute("name", "Benchmarking"); - ManagedPixelBuffer f1(pfRGBX, W, H); - ManagedPixelBuffer f2(pfRGBX, W, H); - ManagedPixelBuffer screen(pfRGBX, W, H); + auto *test_suits = doc.InsertFirstChild(root); + + auto *test_suit = doc.NewElement("testsuit"); + test_suit->SetAttribute("name", "SelfBench"); + test_suits->InsertEndChild(test_suit); + + ManagedPixelBuffer f1(pfRGBX, WIDTH, HEIGHT); + ManagedPixelBuffer f2(pfRGBX, WIDTH, HEIGHT); + ManagedPixelBuffer screen(pfRGBX, WIDTH, HEIGHT); int stride; rdr::U8 *f1ptr = f1.getBufferRW(f1.getRect(), &stride); @@ -56,7 +71,7 @@ void SelfBench() { rdr::U8 * const f1orig = f1ptr; rdr::U8 * const f2orig = f2ptr; - for (i = 0; i < W * H * 4; i += 4) { + for (uint32_t i = 0; i < WIDTH * HEIGHT * 4; i += 4) { f1ptr[0] = rand(); f1ptr[1] = rand(); f1ptr[2] = rand(); @@ -74,124 +89,105 @@ void SelfBench() { // Encoding std::vector vec; - TightJPEGEncoder jpeg(NULL); + TightJPEGEncoder jpeg(nullptr); - gettimeofday(&start, NULL); - runs = RUNS; - for (i = 0; i < runs; i++) { + auto benchmark = [&doc, &test_suit](const char *name, uint32_t runs, auto func) { + auto now = std::chrono::high_resolution_clock::now(); + for (uint32_t i = 0; i < runs; i++) { + func(i); + } + + auto value = elapsedMs(now); + vlog.info("%s took %lu ms (%u runs)", name, value, RUNS); + auto *test_case = doc.NewElement("testcase"); + test_case->SetAttribute("name", name); + test_case->SetAttribute("time", value); + test_case->SetAttribute("runs", RUNS); + test_suit->InsertEndChild(test_case); + }; + + benchmark("Jpeg compression at quality 8", RUNS, [&jpeg, &vec, &f1](uint32_t) { jpeg.compressOnly(&f1, 8, vec, false); - } - vlog.info("Jpeg compression at quality 8 took %u ms (%u runs)", msSince(&start), runs); + }); - gettimeofday(&start, NULL); - runs = RUNS; - for (i = 0; i < runs; i++) { + benchmark("Jpeg compression at quality 4", RUNS, [&jpeg, &vec, &f1](uint32_t) { jpeg.compressOnly(&f1, 4, vec, false); - } - vlog.info("Jpeg compression at quality 4 took %u ms (%u runs)", msSince(&start), runs); + }); + TightWEBPEncoder webp(nullptr); - TightWEBPEncoder webp(NULL); - - gettimeofday(&start, NULL); - runs = RUNS / 8; - for (i = 0; i < runs; i++) { + benchmark("Webp compression at quality 8", RUNS / 8, [&webp,&f1, &vec](uint32_t) { webp.compressOnly(&f1, 8, vec, false); - } - vlog.info("Webp compression at quality 8 took %u ms (%u runs)", msSince(&start), runs); + }); - gettimeofday(&start, NULL); - runs = RUNS / 4; - for (i = 0; i < runs; i++) { + benchmark("Webp compression at quality 4", RUNS / 4, [&webp, &f1, &vec](uint32_t) { webp.compressOnly(&f1, 4, vec, false); - } - vlog.info("Webp compression at quality 4 took %u ms (%u runs)", msSince(&start), runs); + }); // Scaling - gettimeofday(&start, NULL); - runs = RUNS; - for (i = 0; i < runs; i++) { - PixelBuffer *pb = nearestScale(&f1, W * 0.8, H * 0.8, 0.8); + benchmark("Nearest scaling to 80%", RUNS, [&f1](uint32_t) { + PixelBuffer *pb = nearestScale(&f1, WIDTH * 0.8, HEIGHT * 0.8, 0.8); delete pb; - } - vlog.info("Nearest scaling to 80%% took %u ms (%u runs)", msSince(&start), runs); + }); - gettimeofday(&start, NULL); - runs = RUNS; - for (i = 0; i < runs; i++) { - PixelBuffer *pb = nearestScale(&f1, W * 0.4, H * 0.4, 0.4); + benchmark("Nearest scaling to 40%", RUNS, [&f1](uint32_t) { + PixelBuffer *pb = nearestScale(&f1, WIDTH * 0.4, HEIGHT * 0.4, 0.4); delete pb; - } - vlog.info("Nearest scaling to 40%% took %u ms (%u runs)", msSince(&start), runs); + }); - gettimeofday(&start, NULL); - runs = RUNS; - for (i = 0; i < runs; i++) { - PixelBuffer *pb = bilinearScale(&f1, W * 0.8, H * 0.8, 0.8); + benchmark("Bilinear scaling to 80%", RUNS, [&f1](uint32_t) { + PixelBuffer *pb = bilinearScale(&f1, WIDTH * 0.8, HEIGHT * 0.8, 0.8); delete pb; - } - vlog.info("Bilinear scaling to 80%% took %u ms (%u runs)", msSince(&start), runs); + }); - gettimeofday(&start, NULL); - runs = RUNS; - for (i = 0; i < runs; i++) { - PixelBuffer *pb = bilinearScale(&f1, W * 0.4, H * 0.4, 0.4); + benchmark("Bilinear scaling to 40%", RUNS, [&f1](uint32_t) { + PixelBuffer *pb = bilinearScale(&f1, WIDTH * 0.4, HEIGHT * 0.4, 0.4); delete pb; - } - vlog.info("Bilinear scaling to 40%% took %u ms (%u runs)", msSince(&start), runs); + }); - gettimeofday(&start, NULL); - runs = RUNS; - for (i = 0; i < runs; i++) { - PixelBuffer *pb = progressiveBilinearScale(&f1, W * 0.8, H * 0.8, 0.8); - delete pb; - } - vlog.info("Progressive bilinear scaling to 80%% took %u ms (%u runs)", msSince(&start), runs); - gettimeofday(&start, NULL); - runs = RUNS; - for (i = 0; i < runs; i++) { - PixelBuffer *pb = progressiveBilinearScale(&f1, W * 0.4, H * 0.4, 0.4); + benchmark("Progressive bilinear scaling to 80%", RUNS, [&f1](uint32_t) { + PixelBuffer *pb = progressiveBilinearScale(&f1, WIDTH * 0.8, HEIGHT * 0.8, 0.8); delete pb; - } - vlog.info("Progressive bilinear scaling to 40%% took %u ms (%u runs)", msSince(&start), runs); + }); + benchmark("Progressive bilinear scaling to 40%", RUNS, [&f1](uint32_t) { + PixelBuffer *pb = progressiveBilinearScale(&f1, WIDTH * 0.4, HEIGHT * 0.4, 0.4); + delete pb; + }); // Analysis - ComparingUpdateTracker *comparer = new ComparingUpdateTracker(&screen); + auto *comparer = new ComparingUpdateTracker(&screen); Region cursorReg; Server::detectScrolling.setParam(false); Server::detectHorizontal.setParam(false); - gettimeofday(&start, NULL); - runs = RUNS; - for (i = 0; i < runs; i++) { - memcpy(screenptr, i % 2 ? f1orig : f2orig, W * H * 4); - comparer->compare(true, cursorReg); - } - vlog.info("Analysis took %u ms (%u runs) (incl. memcpy overhead)", msSince(&start), runs); + benchmark("Analysis (incl. memcpy overhead)", RUNS, + [&screenptr, &comparer, &cursorReg, f1orig, f2orig](uint32_t i) { + memcpy(screenptr, i % 2 ? f1orig : f2orig, WIDTH * HEIGHT * 4); + comparer->compare(true, cursorReg); + }); Server::detectScrolling.setParam(true); - gettimeofday(&start, NULL); - runs = RUNS; - for (i = 0; i < runs; i++) { - memcpy(screenptr, i % 2 ? f1orig : f2orig, W * H * 4); - comparer->compare(false, cursorReg); - } - vlog.info("Analysis w/ scroll detection took %u ms (%u runs) (incl. memcpy overhead)", msSince(&start), runs); + benchmark("Analysis w/ scroll detection (incl. memcpy overhead)", RUNS, + [&screenptr, &comparer, &cursorReg, f1orig, f2orig](uint32_t i) { + memcpy(screenptr, i % 2 ? f1orig : f2orig, WIDTH * HEIGHT * 4); + comparer->compare(false, cursorReg); + }); Server::detectHorizontal.setParam(true); delete comparer; comparer = new ComparingUpdateTracker(&screen); - gettimeofday(&start, NULL); - runs = RUNS / 2; - for (i = 0; i < runs; i++) { - memcpy(screenptr, i % 2 ? f1orig : f2orig, W * H * 4); - comparer->compare(false, cursorReg); - } - vlog.info("Analysis w/ horizontal scroll detection took %u ms (%u runs) (incl. memcpy overhead)", msSince(&start), runs); + benchmark("Analysis w/ horizontal scroll detection (incl. memcpy overhead)", RUNS / 2, + [&screenptr, &comparer, &cursorReg, f1orig, f2orig](uint32_t i) { + memcpy(screenptr, i % 2 ? f1orig : f2orig, WIDTH * HEIGHT * 4); + comparer->compare(false, cursorReg); + }); + vlog.info("Before"); + doc.SaveFile("SelfBench.xml"); + vlog.info("after"); exit(0); } From 35b77ae244e43d803e1e8ec98061c1687bf08dd2 Mon Sep 17 00:00:00 2001 From: El Date: Mon, 31 Mar 2025 03:50:58 +0500 Subject: [PATCH 043/150] KASM-6984 Add tinyxml2 library to the project --- third_party/tinyxml2/LICENSE.txt | 18 + third_party/tinyxml2/tinyxml2.cpp | 3019 +++++++++++++++++++++++++++++ third_party/tinyxml2/tinyxml2.h | 2383 +++++++++++++++++++++++ 3 files changed, 5420 insertions(+) create mode 100644 third_party/tinyxml2/LICENSE.txt create mode 100644 third_party/tinyxml2/tinyxml2.cpp create mode 100644 third_party/tinyxml2/tinyxml2.h diff --git a/third_party/tinyxml2/LICENSE.txt b/third_party/tinyxml2/LICENSE.txt new file mode 100644 index 0000000..85a6a36 --- /dev/null +++ b/third_party/tinyxml2/LICENSE.txt @@ -0,0 +1,18 @@ +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any +damages arising from the use of this software. + +Permission is granted to anyone to use this software for any +purpose, including commercial applications, and to alter it and +redistribute it freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must +not claim that you wrote the original software. If you use this +software in a product, an acknowledgment in the product documentation +would be appreciated but is not required. + +2. Altered source versions must be plainly marked as such, and +must not be misrepresented as being the original software. + +3. This notice may not be removed or altered from any source +distribution. diff --git a/third_party/tinyxml2/tinyxml2.cpp b/third_party/tinyxml2/tinyxml2.cpp new file mode 100644 index 0000000..8bb9635 --- /dev/null +++ b/third_party/tinyxml2/tinyxml2.cpp @@ -0,0 +1,3019 @@ +/* +Original code by Lee Thomason (www.grinninglizard.com) + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any +damages arising from the use of this software. + +Permission is granted to anyone to use this software for any +purpose, including commercial applications, and to alter it and +redistribute it freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must +not claim that you wrote the original software. If you use this +software in a product, an acknowledgment in the product documentation +would be appreciated but is not required. + +2. Altered source versions must be plainly marked as such, and +must not be misrepresented as being the original software. + +3. This notice may not be removed or altered from any source +distribution. +*/ + +#include "tinyxml2.h" + +#include // yes, this one new style header, is in the Android SDK. +#if defined(ANDROID_NDK) || defined(__BORLANDC__) || defined(__QNXNTO__) || defined(__CC_ARM) +# include +# include +#else +# include +# include +#endif + +#if defined(_MSC_VER) && (_MSC_VER >= 1400 ) && (!defined WINCE) + // Microsoft Visual Studio, version 2005 and higher. Not WinCE. + /*int _snprintf_s( + char *buffer, + size_t sizeOfBuffer, + size_t count, + const char *format [, + argument] ... + );*/ + static inline int TIXML_SNPRINTF( char* buffer, size_t size, const char* format, ... ) + { + va_list va; + va_start( va, format ); + const int result = vsnprintf_s( buffer, size, _TRUNCATE, format, va ); + va_end( va ); + return result; + } + + static inline int TIXML_VSNPRINTF( char* buffer, size_t size, const char* format, va_list va ) + { + const int result = vsnprintf_s( buffer, size, _TRUNCATE, format, va ); + return result; + } + + #define TIXML_VSCPRINTF _vscprintf + #define TIXML_SSCANF sscanf_s +#elif defined _MSC_VER + // Microsoft Visual Studio 2003 and earlier or WinCE + #define TIXML_SNPRINTF _snprintf + #define TIXML_VSNPRINTF _vsnprintf + #define TIXML_SSCANF sscanf + #if (_MSC_VER < 1400 ) && (!defined WINCE) + // Microsoft Visual Studio 2003 and not WinCE. + #define TIXML_VSCPRINTF _vscprintf // VS2003's C runtime has this, but VC6 C runtime or WinCE SDK doesn't have. + #else + // Microsoft Visual Studio 2003 and earlier or WinCE. + static inline int TIXML_VSCPRINTF( const char* format, va_list va ) + { + int len = 512; + for (;;) { + len = len*2; + char* str = new char[len](); + const int required = _vsnprintf(str, len, format, va); + delete[] str; + if ( required != -1 ) { + TIXMLASSERT( required >= 0 ); + len = required; + break; + } + } + TIXMLASSERT( len >= 0 ); + return len; + } + #endif +#else + // GCC version 3 and higher + //#warning( "Using sn* functions." ) + #define TIXML_SNPRINTF snprintf + #define TIXML_VSNPRINTF vsnprintf + static inline int TIXML_VSCPRINTF( const char* format, va_list va ) + { + int len = vsnprintf( 0, 0, format, va ); + TIXMLASSERT( len >= 0 ); + return len; + } + #define TIXML_SSCANF sscanf +#endif + +#if defined(_WIN64) + #define TIXML_FSEEK _fseeki64 + #define TIXML_FTELL _ftelli64 +#elif defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__) || defined(__CYGWIN__) + #define TIXML_FSEEK fseeko + #define TIXML_FTELL ftello +#elif defined(__ANDROID__) && __ANDROID_API__ > 24 + #define TIXML_FSEEK fseeko64 + #define TIXML_FTELL ftello64 +#else + #define TIXML_FSEEK fseek + #define TIXML_FTELL ftell +#endif + + +static const char LINE_FEED = static_cast(0x0a); // all line endings are normalized to LF +static const char LF = LINE_FEED; +static const char CARRIAGE_RETURN = static_cast(0x0d); // CR gets filtered out +static const char CR = CARRIAGE_RETURN; +static const char SINGLE_QUOTE = '\''; +static const char DOUBLE_QUOTE = '\"'; + +// Bunch of unicode info at: +// http://www.unicode.org/faq/utf_bom.html +// ef bb bf (Microsoft "lead bytes") - designates UTF-8 + +static const unsigned char TIXML_UTF_LEAD_0 = 0xefU; +static const unsigned char TIXML_UTF_LEAD_1 = 0xbbU; +static const unsigned char TIXML_UTF_LEAD_2 = 0xbfU; + +namespace tinyxml2 +{ + +struct Entity { + const char* pattern; + int length; + char value; +}; + +static const int NUM_ENTITIES = 5; +static const Entity entities[NUM_ENTITIES] = { + { "quot", 4, DOUBLE_QUOTE }, + { "amp", 3, '&' }, + { "apos", 4, SINGLE_QUOTE }, + { "lt", 2, '<' }, + { "gt", 2, '>' } +}; + + +StrPair::~StrPair() +{ + Reset(); +} + + +void StrPair::TransferTo( StrPair* other ) +{ + if ( this == other ) { + return; + } + // This in effect implements the assignment operator by "moving" + // ownership (as in auto_ptr). + + TIXMLASSERT( other != 0 ); + TIXMLASSERT( other->_flags == 0 ); + TIXMLASSERT( other->_start == 0 ); + TIXMLASSERT( other->_end == 0 ); + + other->Reset(); + + other->_flags = _flags; + other->_start = _start; + other->_end = _end; + + _flags = 0; + _start = 0; + _end = 0; +} + + +void StrPair::Reset() +{ + if ( _flags & NEEDS_DELETE ) { + delete [] _start; + } + _flags = 0; + _start = 0; + _end = 0; +} + + +void StrPair::SetStr( const char* str, int flags ) +{ + TIXMLASSERT( str ); + Reset(); + size_t len = strlen( str ); + TIXMLASSERT( _start == 0 ); + _start = new char[ len+1 ]; + memcpy( _start, str, len+1 ); + _end = _start + len; + _flags = flags | NEEDS_DELETE; +} + + +char* StrPair::ParseText( char* p, const char* endTag, int strFlags, int* curLineNumPtr ) +{ + TIXMLASSERT( p ); + TIXMLASSERT( endTag && *endTag ); + TIXMLASSERT(curLineNumPtr); + + char* start = p; + const char endChar = *endTag; + size_t length = strlen( endTag ); + + // Inner loop of text parsing. + while ( *p ) { + if ( *p == endChar && strncmp( p, endTag, length ) == 0 ) { + Set( start, p, strFlags ); + return p + length; + } else if (*p == '\n') { + ++(*curLineNumPtr); + } + ++p; + TIXMLASSERT( p ); + } + return 0; +} + + +char* StrPair::ParseName( char* p ) +{ + if ( !p || !(*p) ) { + return 0; + } + if ( !XMLUtil::IsNameStartChar( static_cast(*p) ) ) { + return 0; + } + + char* const start = p; + ++p; + while ( *p && XMLUtil::IsNameChar( static_cast(*p) ) ) { + ++p; + } + + Set( start, p, 0 ); + return p; +} + + +void StrPair::CollapseWhitespace() +{ + // Adjusting _start would cause undefined behavior on delete[] + TIXMLASSERT( ( _flags & NEEDS_DELETE ) == 0 ); + // Trim leading space. + _start = XMLUtil::SkipWhiteSpace( _start, 0 ); + + if ( *_start ) { + const char* p = _start; // the read pointer + char* q = _start; // the write pointer + + while( *p ) { + if ( XMLUtil::IsWhiteSpace( *p )) { + p = XMLUtil::SkipWhiteSpace( p, 0 ); + if ( *p == 0 ) { + break; // don't write to q; this trims the trailing space. + } + *q = ' '; + ++q; + } + *q = *p; + ++q; + ++p; + } + *q = 0; + } +} + + +const char* StrPair::GetStr() +{ + TIXMLASSERT( _start ); + TIXMLASSERT( _end ); + if ( _flags & NEEDS_FLUSH ) { + *_end = 0; + _flags ^= NEEDS_FLUSH; + + if ( _flags ) { + const char* p = _start; // the read pointer + char* q = _start; // the write pointer + + while( p < _end ) { + if ( (_flags & NEEDS_NEWLINE_NORMALIZATION) && *p == CR ) { + // CR-LF pair becomes LF + // CR alone becomes LF + // LF-CR becomes LF + if ( *(p+1) == LF ) { + p += 2; + } + else { + ++p; + } + *q = LF; + ++q; + } + else if ( (_flags & NEEDS_NEWLINE_NORMALIZATION) && *p == LF ) { + if ( *(p+1) == CR ) { + p += 2; + } + else { + ++p; + } + *q = LF; + ++q; + } + else if ( (_flags & NEEDS_ENTITY_PROCESSING) && *p == '&' ) { + // Entities handled by tinyXML2: + // - special entities in the entity table [in/out] + // - numeric character reference [in] + // 中 or 中 + + if ( *(p+1) == '#' ) { + const int buflen = 10; + char buf[buflen] = { 0 }; + int len = 0; + const char* adjusted = const_cast( XMLUtil::GetCharacterRef( p, buf, &len ) ); + if ( adjusted == 0 ) { + *q = *p; + ++p; + ++q; + } + else { + TIXMLASSERT( 0 <= len && len <= buflen ); + TIXMLASSERT( q + len <= adjusted ); + p = adjusted; + memcpy( q, buf, len ); + q += len; + } + } + else { + bool entityFound = false; + for( int i = 0; i < NUM_ENTITIES; ++i ) { + const Entity& entity = entities[i]; + if ( strncmp( p + 1, entity.pattern, entity.length ) == 0 + && *( p + entity.length + 1 ) == ';' ) { + // Found an entity - convert. + *q = entity.value; + ++q; + p += entity.length + 2; + entityFound = true; + break; + } + } + if ( !entityFound ) { + // fixme: treat as error? + ++p; + ++q; + } + } + } + else { + *q = *p; + ++p; + ++q; + } + } + *q = 0; + } + // The loop below has plenty going on, and this + // is a less useful mode. Break it out. + if ( _flags & NEEDS_WHITESPACE_COLLAPSING ) { + CollapseWhitespace(); + } + _flags = (_flags & NEEDS_DELETE); + } + TIXMLASSERT( _start ); + return _start; +} + + + + +// --------- XMLUtil ----------- // + +const char* XMLUtil::writeBoolTrue = "true"; +const char* XMLUtil::writeBoolFalse = "false"; + +void XMLUtil::SetBoolSerialization(const char* writeTrue, const char* writeFalse) +{ + static const char* defTrue = "true"; + static const char* defFalse = "false"; + + writeBoolTrue = (writeTrue) ? writeTrue : defTrue; + writeBoolFalse = (writeFalse) ? writeFalse : defFalse; +} + + +const char* XMLUtil::ReadBOM( const char* p, bool* bom ) +{ + TIXMLASSERT( p ); + TIXMLASSERT( bom ); + *bom = false; + const unsigned char* pu = reinterpret_cast(p); + // Check for BOM: + if ( *(pu+0) == TIXML_UTF_LEAD_0 + && *(pu+1) == TIXML_UTF_LEAD_1 + && *(pu+2) == TIXML_UTF_LEAD_2 ) { + *bom = true; + p += 3; + } + TIXMLASSERT( p ); + return p; +} + + +void XMLUtil::ConvertUTF32ToUTF8( unsigned long input, char* output, int* length ) +{ + const unsigned long BYTE_MASK = 0xBF; + const unsigned long BYTE_MARK = 0x80; + const unsigned long FIRST_BYTE_MARK[7] = { 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC }; + + if (input < 0x80) { + *length = 1; + } + else if ( input < 0x800 ) { + *length = 2; + } + else if ( input < 0x10000 ) { + *length = 3; + } + else if ( input < 0x200000 ) { + *length = 4; + } + else { + *length = 0; // This code won't convert this correctly anyway. + return; + } + + output += *length; + + // Scary scary fall throughs are annotated with carefully designed comments + // to suppress compiler warnings such as -Wimplicit-fallthrough in gcc + switch (*length) { + case 4: + --output; + *output = static_cast((input | BYTE_MARK) & BYTE_MASK); + input >>= 6; + //fall through + case 3: + --output; + *output = static_cast((input | BYTE_MARK) & BYTE_MASK); + input >>= 6; + //fall through + case 2: + --output; + *output = static_cast((input | BYTE_MARK) & BYTE_MASK); + input >>= 6; + //fall through + case 1: + --output; + *output = static_cast(input | FIRST_BYTE_MARK[*length]); + break; + default: + TIXMLASSERT( false ); + } +} + + +const char* XMLUtil::GetCharacterRef(const char* p, char* value, int* length) +{ + // Assume an entity, and pull it out. + *length = 0; + + static const uint32_t MAX_CODE_POINT = 0x10FFFF; + + if (*(p + 1) == '#' && *(p + 2)) { + uint32_t ucs = 0; + ptrdiff_t delta = 0; + uint32_t mult = 1; + static const char SEMICOLON = ';'; + + bool hex = false; + uint32_t radix = 10; + const char* q = 0; + char terminator = '#'; + + if (*(p + 2) == 'x') { + // Hexadecimal. + hex = true; + radix = 16; + terminator = 'x'; + + q = p + 3; + } + else { + // Decimal. + q = p + 2; + } + if (!(*q)) { + return 0; + } + + q = strchr(q, SEMICOLON); + if (!q) { + return 0; + } + TIXMLASSERT(*q == SEMICOLON); + + delta = q - p; + --q; + + while (*q != terminator) { + uint32_t digit = 0; + + if (*q >= '0' && *q <= '9') { + digit = *q - '0'; + } + else if (hex && (*q >= 'a' && *q <= 'f')) { + digit = *q - 'a' + 10; + } + else if (hex && (*q >= 'A' && *q <= 'F')) { + digit = *q - 'A' + 10; + } + else { + return 0; + } + TIXMLASSERT(digit < radix); + + const unsigned int digitScaled = mult * digit; + ucs += digitScaled; + mult *= radix; + + // Security check: could a value exist that is out of range? + // Easily; limit to the MAX_CODE_POINT, which also allows for a + // bunch of leading zeroes. + if (mult > MAX_CODE_POINT) { + mult = MAX_CODE_POINT; + } + --q; + } + // Out of range: + if (ucs > MAX_CODE_POINT) { + return 0; + } + // convert the UCS to UTF-8 + ConvertUTF32ToUTF8(ucs, value, length); + if (length == 0) { + // If length is 0, there was an error. (Security? Bad input?) + // Fail safely. + return 0; + } + return p + delta + 1; + } + return p + 1; +} + +void XMLUtil::ToStr( int v, char* buffer, int bufferSize ) +{ + TIXML_SNPRINTF( buffer, bufferSize, "%d", v ); +} + + +void XMLUtil::ToStr( unsigned v, char* buffer, int bufferSize ) +{ + TIXML_SNPRINTF( buffer, bufferSize, "%u", v ); +} + + +void XMLUtil::ToStr( bool v, char* buffer, int bufferSize ) +{ + TIXML_SNPRINTF( buffer, bufferSize, "%s", v ? writeBoolTrue : writeBoolFalse); +} + +/* + ToStr() of a number is a very tricky topic. + https://github.com/leethomason/tinyxml2/issues/106 +*/ +void XMLUtil::ToStr( float v, char* buffer, int bufferSize ) +{ + TIXML_SNPRINTF( buffer, bufferSize, "%.8g", v ); +} + + +void XMLUtil::ToStr( double v, char* buffer, int bufferSize ) +{ + TIXML_SNPRINTF( buffer, bufferSize, "%.17g", v ); +} + + +void XMLUtil::ToStr( int64_t v, char* buffer, int bufferSize ) +{ + // horrible syntax trick to make the compiler happy about %lld + TIXML_SNPRINTF(buffer, bufferSize, "%lld", static_cast(v)); +} + +void XMLUtil::ToStr( uint64_t v, char* buffer, int bufferSize ) +{ + // horrible syntax trick to make the compiler happy about %llu + TIXML_SNPRINTF(buffer, bufferSize, "%llu", static_cast(v)); +} + +bool XMLUtil::ToInt(const char* str, int* value) +{ + if (IsPrefixHex(str)) { + unsigned v; + if (TIXML_SSCANF(str, "%x", &v) == 1) { + *value = static_cast(v); + return true; + } + } + else { + if (TIXML_SSCANF(str, "%d", value) == 1) { + return true; + } + } + return false; +} + +bool XMLUtil::ToUnsigned(const char* str, unsigned* value) +{ + if (TIXML_SSCANF(str, IsPrefixHex(str) ? "%x" : "%u", value) == 1) { + return true; + } + return false; +} + +bool XMLUtil::ToBool( const char* str, bool* value ) +{ + int ival = 0; + if ( ToInt( str, &ival )) { + *value = (ival==0) ? false : true; + return true; + } + static const char* TRUE_VALS[] = { "true", "True", "TRUE", 0 }; + static const char* FALSE_VALS[] = { "false", "False", "FALSE", 0 }; + + for (int i = 0; TRUE_VALS[i]; ++i) { + if (StringEqual(str, TRUE_VALS[i])) { + *value = true; + return true; + } + } + for (int i = 0; FALSE_VALS[i]; ++i) { + if (StringEqual(str, FALSE_VALS[i])) { + *value = false; + return true; + } + } + return false; +} + + +bool XMLUtil::ToFloat( const char* str, float* value ) +{ + if ( TIXML_SSCANF( str, "%f", value ) == 1 ) { + return true; + } + return false; +} + + +bool XMLUtil::ToDouble( const char* str, double* value ) +{ + if ( TIXML_SSCANF( str, "%lf", value ) == 1 ) { + return true; + } + return false; +} + + +bool XMLUtil::ToInt64(const char* str, int64_t* value) +{ + if (IsPrefixHex(str)) { + unsigned long long v = 0; // horrible syntax trick to make the compiler happy about %llx + if (TIXML_SSCANF(str, "%llx", &v) == 1) { + *value = static_cast(v); + return true; + } + } + else { + long long v = 0; // horrible syntax trick to make the compiler happy about %lld + if (TIXML_SSCANF(str, "%lld", &v) == 1) { + *value = static_cast(v); + return true; + } + } + return false; +} + + +bool XMLUtil::ToUnsigned64(const char* str, uint64_t* value) { + unsigned long long v = 0; // horrible syntax trick to make the compiler happy about %llu + if(TIXML_SSCANF(str, IsPrefixHex(str) ? "%llx" : "%llu", &v) == 1) { + *value = static_cast(v); + return true; + } + return false; +} + + +char* XMLDocument::Identify( char* p, XMLNode** node, bool first ) +{ + TIXMLASSERT( node ); + TIXMLASSERT( p ); + char* const start = p; + int const startLine = _parseCurLineNum; + p = XMLUtil::SkipWhiteSpace( p, &_parseCurLineNum ); + if( !*p ) { + *node = 0; + TIXMLASSERT( p ); + return p; + } + + // These strings define the matching patterns: + static const char* xmlHeader = { "( _commentPool ); + returnNode->_parseLineNum = _parseCurLineNum; + p += xmlHeaderLen; + } + else if ( XMLUtil::StringEqual( p, commentHeader, commentHeaderLen ) ) { + returnNode = CreateUnlinkedNode( _commentPool ); + returnNode->_parseLineNum = _parseCurLineNum; + p += commentHeaderLen; + } + else if ( XMLUtil::StringEqual( p, cdataHeader, cdataHeaderLen ) ) { + XMLText* text = CreateUnlinkedNode( _textPool ); + returnNode = text; + returnNode->_parseLineNum = _parseCurLineNum; + p += cdataHeaderLen; + text->SetCData( true ); + } + else if ( XMLUtil::StringEqual( p, dtdHeader, dtdHeaderLen ) ) { + returnNode = CreateUnlinkedNode( _commentPool ); + returnNode->_parseLineNum = _parseCurLineNum; + p += dtdHeaderLen; + } + else if ( XMLUtil::StringEqual( p, elementHeader, elementHeaderLen ) ) { + + // Preserve whitespace pedantically before closing tag, when it's immediately after opening tag + if (WhitespaceMode() == PEDANTIC_WHITESPACE && first && p != start && *(p + elementHeaderLen) == '/') { + returnNode = CreateUnlinkedNode(_textPool); + returnNode->_parseLineNum = startLine; + p = start; // Back it up, all the text counts. + _parseCurLineNum = startLine; + } + else { + returnNode = CreateUnlinkedNode(_elementPool); + returnNode->_parseLineNum = _parseCurLineNum; + p += elementHeaderLen; + } + } + else { + returnNode = CreateUnlinkedNode( _textPool ); + returnNode->_parseLineNum = _parseCurLineNum; // Report line of first non-whitespace character + p = start; // Back it up, all the text counts. + _parseCurLineNum = startLine; + } + + TIXMLASSERT( returnNode ); + TIXMLASSERT( p ); + *node = returnNode; + return p; +} + + +bool XMLDocument::Accept( XMLVisitor* visitor ) const +{ + TIXMLASSERT( visitor ); + if ( visitor->VisitEnter( *this ) ) { + for ( const XMLNode* node=FirstChild(); node; node=node->NextSibling() ) { + if ( !node->Accept( visitor ) ) { + break; + } + } + } + return visitor->VisitExit( *this ); +} + + +// --------- XMLNode ----------- // + +XMLNode::XMLNode( XMLDocument* doc ) : + _document( doc ), + _parent( 0 ), + _value(), + _parseLineNum( 0 ), + _firstChild( 0 ), _lastChild( 0 ), + _prev( 0 ), _next( 0 ), + _userData( 0 ), + _memPool( 0 ) +{ +} + + +XMLNode::~XMLNode() +{ + DeleteChildren(); + if ( _parent ) { + _parent->Unlink( this ); + } +} + +// ChildElementCount was originally suggested by msteiger on the sourceforge page for TinyXML and modified by KB1SPH for TinyXML-2. + +int XMLNode::ChildElementCount(const char *value) const { + int count = 0; + + const XMLElement *e = FirstChildElement(value); + + while (e) { + e = e->NextSiblingElement(value); + count++; + } + + return count; +} + +int XMLNode::ChildElementCount() const { + int count = 0; + + const XMLElement *e = FirstChildElement(); + + while (e) { + e = e->NextSiblingElement(); + count++; + } + + return count; +} + +const char* XMLNode::Value() const +{ + // Edge case: XMLDocuments don't have a Value. Return null. + if ( this->ToDocument() ) + return 0; + return _value.GetStr(); +} + +void XMLNode::SetValue( const char* str, bool staticMem ) +{ + if ( staticMem ) { + _value.SetInternedStr( str ); + } + else { + _value.SetStr( str ); + } +} + +XMLNode* XMLNode::DeepClone(XMLDocument* target) const +{ + XMLNode* clone = this->ShallowClone(target); + if (!clone) return 0; + + for (const XMLNode* child = this->FirstChild(); child; child = child->NextSibling()) { + XMLNode* childClone = child->DeepClone(target); + TIXMLASSERT(childClone); + clone->InsertEndChild(childClone); + } + return clone; +} + +void XMLNode::DeleteChildren() +{ + while( _firstChild ) { + TIXMLASSERT( _lastChild ); + DeleteChild( _firstChild ); + } + _firstChild = _lastChild = 0; +} + + +void XMLNode::Unlink( XMLNode* child ) +{ + TIXMLASSERT( child ); + TIXMLASSERT( child->_document == _document ); + TIXMLASSERT( child->_parent == this ); + if ( child == _firstChild ) { + _firstChild = _firstChild->_next; + } + if ( child == _lastChild ) { + _lastChild = _lastChild->_prev; + } + + if ( child->_prev ) { + child->_prev->_next = child->_next; + } + if ( child->_next ) { + child->_next->_prev = child->_prev; + } + child->_next = 0; + child->_prev = 0; + child->_parent = 0; +} + + +void XMLNode::DeleteChild( XMLNode* node ) +{ + TIXMLASSERT( node ); + TIXMLASSERT( node->_document == _document ); + TIXMLASSERT( node->_parent == this ); + Unlink( node ); + TIXMLASSERT(node->_prev == 0); + TIXMLASSERT(node->_next == 0); + TIXMLASSERT(node->_parent == 0); + DeleteNode( node ); +} + + +XMLNode* XMLNode::InsertEndChild( XMLNode* addThis ) +{ + TIXMLASSERT( addThis ); + if ( addThis->_document != _document ) { + TIXMLASSERT( false ); + return 0; + } + InsertChildPreamble( addThis ); + + if ( _lastChild ) { + TIXMLASSERT( _firstChild ); + TIXMLASSERT( _lastChild->_next == 0 ); + _lastChild->_next = addThis; + addThis->_prev = _lastChild; + _lastChild = addThis; + + addThis->_next = 0; + } + else { + TIXMLASSERT( _firstChild == 0 ); + _firstChild = _lastChild = addThis; + + addThis->_prev = 0; + addThis->_next = 0; + } + addThis->_parent = this; + return addThis; +} + + +XMLNode* XMLNode::InsertFirstChild( XMLNode* addThis ) +{ + TIXMLASSERT( addThis ); + if ( addThis->_document != _document ) { + TIXMLASSERT( false ); + return 0; + } + InsertChildPreamble( addThis ); + + if ( _firstChild ) { + TIXMLASSERT( _lastChild ); + TIXMLASSERT( _firstChild->_prev == 0 ); + + _firstChild->_prev = addThis; + addThis->_next = _firstChild; + _firstChild = addThis; + + addThis->_prev = 0; + } + else { + TIXMLASSERT( _lastChild == 0 ); + _firstChild = _lastChild = addThis; + + addThis->_prev = 0; + addThis->_next = 0; + } + addThis->_parent = this; + return addThis; +} + + +XMLNode* XMLNode::InsertAfterChild( XMLNode* afterThis, XMLNode* addThis ) +{ + TIXMLASSERT( addThis ); + if ( addThis->_document != _document ) { + TIXMLASSERT( false ); + return 0; + } + + TIXMLASSERT( afterThis ); + + if ( afterThis->_parent != this ) { + TIXMLASSERT( false ); + return 0; + } + if ( afterThis == addThis ) { + // Current state: BeforeThis -> AddThis -> OneAfterAddThis + // Now AddThis must disappear from it's location and then + // reappear between BeforeThis and OneAfterAddThis. + // So just leave it where it is. + return addThis; + } + + if ( afterThis->_next == 0 ) { + // The last node or the only node. + return InsertEndChild( addThis ); + } + InsertChildPreamble( addThis ); + addThis->_prev = afterThis; + addThis->_next = afterThis->_next; + afterThis->_next->_prev = addThis; + afterThis->_next = addThis; + addThis->_parent = this; + return addThis; +} + + + + +const XMLElement* XMLNode::FirstChildElement( const char* name ) const +{ + for( const XMLNode* node = _firstChild; node; node = node->_next ) { + const XMLElement* element = node->ToElementWithName( name ); + if ( element ) { + return element; + } + } + return 0; +} + + +const XMLElement* XMLNode::LastChildElement( const char* name ) const +{ + for( const XMLNode* node = _lastChild; node; node = node->_prev ) { + const XMLElement* element = node->ToElementWithName( name ); + if ( element ) { + return element; + } + } + return 0; +} + + +const XMLElement* XMLNode::NextSiblingElement( const char* name ) const +{ + for( const XMLNode* node = _next; node; node = node->_next ) { + const XMLElement* element = node->ToElementWithName( name ); + if ( element ) { + return element; + } + } + return 0; +} + + +const XMLElement* XMLNode::PreviousSiblingElement( const char* name ) const +{ + for( const XMLNode* node = _prev; node; node = node->_prev ) { + const XMLElement* element = node->ToElementWithName( name ); + if ( element ) { + return element; + } + } + return 0; +} + + +char* XMLNode::ParseDeep( char* p, StrPair* parentEndTag, int* curLineNumPtr ) +{ + // This is a recursive method, but thinking about it "at the current level" + // it is a pretty simple flat list: + // + // + // + // With a special case: + // + // + // + // + // Where the closing element (/foo) *must* be the next thing after the opening + // element, and the names must match. BUT the tricky bit is that the closing + // element will be read by the child. + // + // 'endTag' is the end tag for this node, it is returned by a call to a child. + // 'parentEnd' is the end tag for the parent, which is filled in and returned. + + XMLDocument::DepthTracker tracker(_document); + if (_document->Error()) + return 0; + + bool first = true; + while( p && *p ) { + XMLNode* node = 0; + + p = _document->Identify( p, &node, first ); + TIXMLASSERT( p ); + if ( node == 0 ) { + break; + } + first = false; + + const int initialLineNum = node->_parseLineNum; + + StrPair endTag; + p = node->ParseDeep( p, &endTag, curLineNumPtr ); + if ( !p ) { + _document->DeleteNode( node ); + if ( !_document->Error() ) { + _document->SetError( XML_ERROR_PARSING, initialLineNum, 0); + } + break; + } + + const XMLDeclaration* const decl = node->ToDeclaration(); + if ( decl ) { + // Declarations are only allowed at document level + // + // Multiple declarations are allowed but all declarations + // must occur before anything else. + // + // Optimized due to a security test case. If the first node is + // a declaration, and the last node is a declaration, then only + // declarations have so far been added. + bool wellLocated = false; + + if (ToDocument()) { + if (FirstChild()) { + wellLocated = + FirstChild() && + FirstChild()->ToDeclaration() && + LastChild() && + LastChild()->ToDeclaration(); + } + else { + wellLocated = true; + } + } + if ( !wellLocated ) { + _document->SetError( XML_ERROR_PARSING_DECLARATION, initialLineNum, "XMLDeclaration value=%s", decl->Value()); + _document->DeleteNode( node ); + break; + } + } + + XMLElement* ele = node->ToElement(); + if ( ele ) { + // We read the end tag. Return it to the parent. + if ( ele->ClosingType() == XMLElement::CLOSING ) { + if ( parentEndTag ) { + ele->_value.TransferTo( parentEndTag ); + } + node->_memPool->SetTracked(); // created and then immediately deleted. + DeleteNode( node ); + return p; + } + + // Handle an end tag returned to this level. + // And handle a bunch of annoying errors. + bool mismatch = false; + if ( endTag.Empty() ) { + if ( ele->ClosingType() == XMLElement::OPEN ) { + mismatch = true; + } + } + else { + if ( ele->ClosingType() != XMLElement::OPEN ) { + mismatch = true; + } + else if ( !XMLUtil::StringEqual( endTag.GetStr(), ele->Name() ) ) { + mismatch = true; + } + } + if ( mismatch ) { + _document->SetError( XML_ERROR_MISMATCHED_ELEMENT, initialLineNum, "XMLElement name=%s", ele->Name()); + _document->DeleteNode( node ); + break; + } + } + InsertEndChild( node ); + } + return 0; +} + +/*static*/ void XMLNode::DeleteNode( XMLNode* node ) +{ + if ( node == 0 ) { + return; + } + TIXMLASSERT(node->_document); + if (!node->ToDocument()) { + node->_document->MarkInUse(node); + } + + MemPool* pool = node->_memPool; + node->~XMLNode(); + pool->Free( node ); +} + +void XMLNode::InsertChildPreamble( XMLNode* insertThis ) const +{ + TIXMLASSERT( insertThis ); + TIXMLASSERT( insertThis->_document == _document ); + + if (insertThis->_parent) { + insertThis->_parent->Unlink( insertThis ); + } + else { + insertThis->_document->MarkInUse(insertThis); + insertThis->_memPool->SetTracked(); + } +} + +const XMLElement* XMLNode::ToElementWithName( const char* name ) const +{ + const XMLElement* element = this->ToElement(); + if ( element == 0 ) { + return 0; + } + if ( name == 0 ) { + return element; + } + if ( XMLUtil::StringEqual( element->Name(), name ) ) { + return element; + } + return 0; +} + +// --------- XMLText ---------- // +char* XMLText::ParseDeep( char* p, StrPair*, int* curLineNumPtr ) +{ + if ( this->CData() ) { + p = _value.ParseText( p, "]]>", StrPair::NEEDS_NEWLINE_NORMALIZATION, curLineNumPtr ); + if ( !p ) { + _document->SetError( XML_ERROR_PARSING_CDATA, _parseLineNum, 0 ); + } + return p; + } + else { + int flags = _document->ProcessEntities() ? StrPair::TEXT_ELEMENT : StrPair::TEXT_ELEMENT_LEAVE_ENTITIES; + if ( _document->WhitespaceMode() == COLLAPSE_WHITESPACE ) { + flags |= StrPair::NEEDS_WHITESPACE_COLLAPSING; + } + + p = _value.ParseText( p, "<", flags, curLineNumPtr ); + if ( p && *p ) { + return p-1; + } + if ( !p ) { + _document->SetError( XML_ERROR_PARSING_TEXT, _parseLineNum, 0 ); + } + } + return 0; +} + + +XMLNode* XMLText::ShallowClone( XMLDocument* doc ) const +{ + if ( !doc ) { + doc = _document; + } + XMLText* text = doc->NewText( Value() ); // fixme: this will always allocate memory. Intern? + text->SetCData( this->CData() ); + return text; +} + + +bool XMLText::ShallowEqual( const XMLNode* compare ) const +{ + TIXMLASSERT( compare ); + const XMLText* text = compare->ToText(); + return ( text && XMLUtil::StringEqual( text->Value(), Value() ) ); +} + + +bool XMLText::Accept( XMLVisitor* visitor ) const +{ + TIXMLASSERT( visitor ); + return visitor->Visit( *this ); +} + + +// --------- XMLComment ---------- // + +XMLComment::XMLComment( XMLDocument* doc ) : XMLNode( doc ) +{ +} + + +XMLComment::~XMLComment() +{ +} + + +char* XMLComment::ParseDeep( char* p, StrPair*, int* curLineNumPtr ) +{ + // Comment parses as text. + p = _value.ParseText( p, "-->", StrPair::COMMENT, curLineNumPtr ); + if ( p == 0 ) { + _document->SetError( XML_ERROR_PARSING_COMMENT, _parseLineNum, 0 ); + } + return p; +} + + +XMLNode* XMLComment::ShallowClone( XMLDocument* doc ) const +{ + if ( !doc ) { + doc = _document; + } + XMLComment* comment = doc->NewComment( Value() ); // fixme: this will always allocate memory. Intern? + return comment; +} + + +bool XMLComment::ShallowEqual( const XMLNode* compare ) const +{ + TIXMLASSERT( compare ); + const XMLComment* comment = compare->ToComment(); + return ( comment && XMLUtil::StringEqual( comment->Value(), Value() )); +} + + +bool XMLComment::Accept( XMLVisitor* visitor ) const +{ + TIXMLASSERT( visitor ); + return visitor->Visit( *this ); +} + + +// --------- XMLDeclaration ---------- // + +XMLDeclaration::XMLDeclaration( XMLDocument* doc ) : XMLNode( doc ) +{ +} + + +XMLDeclaration::~XMLDeclaration() +{ + //printf( "~XMLDeclaration\n" ); +} + + +char* XMLDeclaration::ParseDeep( char* p, StrPair*, int* curLineNumPtr ) +{ + // Declaration parses as text. + p = _value.ParseText( p, "?>", StrPair::NEEDS_NEWLINE_NORMALIZATION, curLineNumPtr ); + if ( p == 0 ) { + _document->SetError( XML_ERROR_PARSING_DECLARATION, _parseLineNum, 0 ); + } + return p; +} + + +XMLNode* XMLDeclaration::ShallowClone( XMLDocument* doc ) const +{ + if ( !doc ) { + doc = _document; + } + XMLDeclaration* dec = doc->NewDeclaration( Value() ); // fixme: this will always allocate memory. Intern? + return dec; +} + + +bool XMLDeclaration::ShallowEqual( const XMLNode* compare ) const +{ + TIXMLASSERT( compare ); + const XMLDeclaration* declaration = compare->ToDeclaration(); + return ( declaration && XMLUtil::StringEqual( declaration->Value(), Value() )); +} + + + +bool XMLDeclaration::Accept( XMLVisitor* visitor ) const +{ + TIXMLASSERT( visitor ); + return visitor->Visit( *this ); +} + +// --------- XMLUnknown ---------- // + +XMLUnknown::XMLUnknown( XMLDocument* doc ) : XMLNode( doc ) +{ +} + + +XMLUnknown::~XMLUnknown() +{ +} + + +char* XMLUnknown::ParseDeep( char* p, StrPair*, int* curLineNumPtr ) +{ + // Unknown parses as text. + p = _value.ParseText( p, ">", StrPair::NEEDS_NEWLINE_NORMALIZATION, curLineNumPtr ); + if ( !p ) { + _document->SetError( XML_ERROR_PARSING_UNKNOWN, _parseLineNum, 0 ); + } + return p; +} + + +XMLNode* XMLUnknown::ShallowClone( XMLDocument* doc ) const +{ + if ( !doc ) { + doc = _document; + } + XMLUnknown* text = doc->NewUnknown( Value() ); // fixme: this will always allocate memory. Intern? + return text; +} + + +bool XMLUnknown::ShallowEqual( const XMLNode* compare ) const +{ + TIXMLASSERT( compare ); + const XMLUnknown* unknown = compare->ToUnknown(); + return ( unknown && XMLUtil::StringEqual( unknown->Value(), Value() )); +} + + +bool XMLUnknown::Accept( XMLVisitor* visitor ) const +{ + TIXMLASSERT( visitor ); + return visitor->Visit( *this ); +} + +// --------- XMLAttribute ---------- // + +const char* XMLAttribute::Name() const +{ + return _name.GetStr(); +} + +const char* XMLAttribute::Value() const +{ + return _value.GetStr(); +} + +char* XMLAttribute::ParseDeep( char* p, bool processEntities, int* curLineNumPtr ) +{ + // Parse using the name rules: bug fix, was using ParseText before + p = _name.ParseName( p ); + if ( !p || !*p ) { + return 0; + } + + // Skip white space before = + p = XMLUtil::SkipWhiteSpace( p, curLineNumPtr ); + if ( *p != '=' ) { + return 0; + } + + ++p; // move up to opening quote + p = XMLUtil::SkipWhiteSpace( p, curLineNumPtr ); + if ( *p != '\"' && *p != '\'' ) { + return 0; + } + + const char endTag[2] = { *p, 0 }; + ++p; // move past opening quote + + p = _value.ParseText( p, endTag, processEntities ? StrPair::ATTRIBUTE_VALUE : StrPair::ATTRIBUTE_VALUE_LEAVE_ENTITIES, curLineNumPtr ); + return p; +} + + +void XMLAttribute::SetName( const char* n ) +{ + _name.SetStr( n ); +} + + +XMLError XMLAttribute::QueryIntValue( int* value ) const +{ + if ( XMLUtil::ToInt( Value(), value )) { + return XML_SUCCESS; + } + return XML_WRONG_ATTRIBUTE_TYPE; +} + + +XMLError XMLAttribute::QueryUnsignedValue( unsigned int* value ) const +{ + if ( XMLUtil::ToUnsigned( Value(), value )) { + return XML_SUCCESS; + } + return XML_WRONG_ATTRIBUTE_TYPE; +} + + +XMLError XMLAttribute::QueryInt64Value(int64_t* value) const +{ + if (XMLUtil::ToInt64(Value(), value)) { + return XML_SUCCESS; + } + return XML_WRONG_ATTRIBUTE_TYPE; +} + + +XMLError XMLAttribute::QueryUnsigned64Value(uint64_t* value) const +{ + if(XMLUtil::ToUnsigned64(Value(), value)) { + return XML_SUCCESS; + } + return XML_WRONG_ATTRIBUTE_TYPE; +} + + +XMLError XMLAttribute::QueryBoolValue( bool* value ) const +{ + if ( XMLUtil::ToBool( Value(), value )) { + return XML_SUCCESS; + } + return XML_WRONG_ATTRIBUTE_TYPE; +} + + +XMLError XMLAttribute::QueryFloatValue( float* value ) const +{ + if ( XMLUtil::ToFloat( Value(), value )) { + return XML_SUCCESS; + } + return XML_WRONG_ATTRIBUTE_TYPE; +} + + +XMLError XMLAttribute::QueryDoubleValue( double* value ) const +{ + if ( XMLUtil::ToDouble( Value(), value )) { + return XML_SUCCESS; + } + return XML_WRONG_ATTRIBUTE_TYPE; +} + + +void XMLAttribute::SetAttribute( const char* v ) +{ + _value.SetStr( v ); +} + + +void XMLAttribute::SetAttribute( int v ) +{ + char buf[BUF_SIZE]; + XMLUtil::ToStr( v, buf, BUF_SIZE ); + _value.SetStr( buf ); +} + + +void XMLAttribute::SetAttribute( unsigned v ) +{ + char buf[BUF_SIZE]; + XMLUtil::ToStr( v, buf, BUF_SIZE ); + _value.SetStr( buf ); +} + + +void XMLAttribute::SetAttribute(int64_t v) +{ + char buf[BUF_SIZE]; + XMLUtil::ToStr(v, buf, BUF_SIZE); + _value.SetStr(buf); +} + +void XMLAttribute::SetAttribute(uint64_t v) +{ + char buf[BUF_SIZE]; + XMLUtil::ToStr(v, buf, BUF_SIZE); + _value.SetStr(buf); +} + + +void XMLAttribute::SetAttribute( bool v ) +{ + char buf[BUF_SIZE]; + XMLUtil::ToStr( v, buf, BUF_SIZE ); + _value.SetStr( buf ); +} + +void XMLAttribute::SetAttribute( double v ) +{ + char buf[BUF_SIZE]; + XMLUtil::ToStr( v, buf, BUF_SIZE ); + _value.SetStr( buf ); +} + +void XMLAttribute::SetAttribute( float v ) +{ + char buf[BUF_SIZE]; + XMLUtil::ToStr( v, buf, BUF_SIZE ); + _value.SetStr( buf ); +} + + +// --------- XMLElement ---------- // +XMLElement::XMLElement( XMLDocument* doc ) : XMLNode( doc ), + _closingType( OPEN ), + _rootAttribute( 0 ) +{ +} + + +XMLElement::~XMLElement() +{ + while( _rootAttribute ) { + XMLAttribute* next = _rootAttribute->_next; + DeleteAttribute( _rootAttribute ); + _rootAttribute = next; + } +} + + +const XMLAttribute* XMLElement::FindAttribute( const char* name ) const +{ + for( XMLAttribute* a = _rootAttribute; a; a = a->_next ) { + if ( XMLUtil::StringEqual( a->Name(), name ) ) { + return a; + } + } + return 0; +} + + +const char* XMLElement::Attribute( const char* name, const char* value ) const +{ + const XMLAttribute* a = FindAttribute( name ); + if ( !a ) { + return 0; + } + if ( !value || XMLUtil::StringEqual( a->Value(), value )) { + return a->Value(); + } + return 0; +} + +int XMLElement::IntAttribute(const char* name, int defaultValue) const +{ + int i = defaultValue; + QueryIntAttribute(name, &i); + return i; +} + +unsigned XMLElement::UnsignedAttribute(const char* name, unsigned defaultValue) const +{ + unsigned i = defaultValue; + QueryUnsignedAttribute(name, &i); + return i; +} + +int64_t XMLElement::Int64Attribute(const char* name, int64_t defaultValue) const +{ + int64_t i = defaultValue; + QueryInt64Attribute(name, &i); + return i; +} + +uint64_t XMLElement::Unsigned64Attribute(const char* name, uint64_t defaultValue) const +{ + uint64_t i = defaultValue; + QueryUnsigned64Attribute(name, &i); + return i; +} + +bool XMLElement::BoolAttribute(const char* name, bool defaultValue) const +{ + bool b = defaultValue; + QueryBoolAttribute(name, &b); + return b; +} + +double XMLElement::DoubleAttribute(const char* name, double defaultValue) const +{ + double d = defaultValue; + QueryDoubleAttribute(name, &d); + return d; +} + +float XMLElement::FloatAttribute(const char* name, float defaultValue) const +{ + float f = defaultValue; + QueryFloatAttribute(name, &f); + return f; +} + +const char* XMLElement::GetText() const +{ + /* skip comment node */ + const XMLNode* node = FirstChild(); + while (node) { + if (node->ToComment()) { + node = node->NextSibling(); + continue; + } + break; + } + + if ( node && node->ToText() ) { + return node->Value(); + } + return 0; +} + + +void XMLElement::SetText( const char* inText ) +{ + if ( FirstChild() && FirstChild()->ToText() ) + FirstChild()->SetValue( inText ); + else { + XMLText* theText = GetDocument()->NewText( inText ); + InsertFirstChild( theText ); + } +} + + +void XMLElement::SetText( int v ) +{ + char buf[BUF_SIZE]; + XMLUtil::ToStr( v, buf, BUF_SIZE ); + SetText( buf ); +} + + +void XMLElement::SetText( unsigned v ) +{ + char buf[BUF_SIZE]; + XMLUtil::ToStr( v, buf, BUF_SIZE ); + SetText( buf ); +} + + +void XMLElement::SetText(int64_t v) +{ + char buf[BUF_SIZE]; + XMLUtil::ToStr(v, buf, BUF_SIZE); + SetText(buf); +} + +void XMLElement::SetText(uint64_t v) { + char buf[BUF_SIZE]; + XMLUtil::ToStr(v, buf, BUF_SIZE); + SetText(buf); +} + + +void XMLElement::SetText( bool v ) +{ + char buf[BUF_SIZE]; + XMLUtil::ToStr( v, buf, BUF_SIZE ); + SetText( buf ); +} + + +void XMLElement::SetText( float v ) +{ + char buf[BUF_SIZE]; + XMLUtil::ToStr( v, buf, BUF_SIZE ); + SetText( buf ); +} + + +void XMLElement::SetText( double v ) +{ + char buf[BUF_SIZE]; + XMLUtil::ToStr( v, buf, BUF_SIZE ); + SetText( buf ); +} + + +XMLError XMLElement::QueryIntText( int* ival ) const +{ + if ( FirstChild() && FirstChild()->ToText() ) { + const char* t = FirstChild()->Value(); + if ( XMLUtil::ToInt( t, ival ) ) { + return XML_SUCCESS; + } + return XML_CAN_NOT_CONVERT_TEXT; + } + return XML_NO_TEXT_NODE; +} + + +XMLError XMLElement::QueryUnsignedText( unsigned* uval ) const +{ + if ( FirstChild() && FirstChild()->ToText() ) { + const char* t = FirstChild()->Value(); + if ( XMLUtil::ToUnsigned( t, uval ) ) { + return XML_SUCCESS; + } + return XML_CAN_NOT_CONVERT_TEXT; + } + return XML_NO_TEXT_NODE; +} + + +XMLError XMLElement::QueryInt64Text(int64_t* ival) const +{ + if (FirstChild() && FirstChild()->ToText()) { + const char* t = FirstChild()->Value(); + if (XMLUtil::ToInt64(t, ival)) { + return XML_SUCCESS; + } + return XML_CAN_NOT_CONVERT_TEXT; + } + return XML_NO_TEXT_NODE; +} + + +XMLError XMLElement::QueryUnsigned64Text(uint64_t* uval) const +{ + if(FirstChild() && FirstChild()->ToText()) { + const char* t = FirstChild()->Value(); + if(XMLUtil::ToUnsigned64(t, uval)) { + return XML_SUCCESS; + } + return XML_CAN_NOT_CONVERT_TEXT; + } + return XML_NO_TEXT_NODE; +} + + +XMLError XMLElement::QueryBoolText( bool* bval ) const +{ + if ( FirstChild() && FirstChild()->ToText() ) { + const char* t = FirstChild()->Value(); + if ( XMLUtil::ToBool( t, bval ) ) { + return XML_SUCCESS; + } + return XML_CAN_NOT_CONVERT_TEXT; + } + return XML_NO_TEXT_NODE; +} + + +XMLError XMLElement::QueryDoubleText( double* dval ) const +{ + if ( FirstChild() && FirstChild()->ToText() ) { + const char* t = FirstChild()->Value(); + if ( XMLUtil::ToDouble( t, dval ) ) { + return XML_SUCCESS; + } + return XML_CAN_NOT_CONVERT_TEXT; + } + return XML_NO_TEXT_NODE; +} + + +XMLError XMLElement::QueryFloatText( float* fval ) const +{ + if ( FirstChild() && FirstChild()->ToText() ) { + const char* t = FirstChild()->Value(); + if ( XMLUtil::ToFloat( t, fval ) ) { + return XML_SUCCESS; + } + return XML_CAN_NOT_CONVERT_TEXT; + } + return XML_NO_TEXT_NODE; +} + +int XMLElement::IntText(int defaultValue) const +{ + int i = defaultValue; + QueryIntText(&i); + return i; +} + +unsigned XMLElement::UnsignedText(unsigned defaultValue) const +{ + unsigned i = defaultValue; + QueryUnsignedText(&i); + return i; +} + +int64_t XMLElement::Int64Text(int64_t defaultValue) const +{ + int64_t i = defaultValue; + QueryInt64Text(&i); + return i; +} + +uint64_t XMLElement::Unsigned64Text(uint64_t defaultValue) const +{ + uint64_t i = defaultValue; + QueryUnsigned64Text(&i); + return i; +} + +bool XMLElement::BoolText(bool defaultValue) const +{ + bool b = defaultValue; + QueryBoolText(&b); + return b; +} + +double XMLElement::DoubleText(double defaultValue) const +{ + double d = defaultValue; + QueryDoubleText(&d); + return d; +} + +float XMLElement::FloatText(float defaultValue) const +{ + float f = defaultValue; + QueryFloatText(&f); + return f; +} + + +XMLAttribute* XMLElement::FindOrCreateAttribute( const char* name ) +{ + XMLAttribute* last = 0; + XMLAttribute* attrib = 0; + for( attrib = _rootAttribute; + attrib; + last = attrib, attrib = attrib->_next ) { + if ( XMLUtil::StringEqual( attrib->Name(), name ) ) { + break; + } + } + if ( !attrib ) { + attrib = CreateAttribute(); + TIXMLASSERT( attrib ); + if ( last ) { + TIXMLASSERT( last->_next == 0 ); + last->_next = attrib; + } + else { + TIXMLASSERT( _rootAttribute == 0 ); + _rootAttribute = attrib; + } + attrib->SetName( name ); + } + return attrib; +} + + +void XMLElement::DeleteAttribute( const char* name ) +{ + XMLAttribute* prev = 0; + for( XMLAttribute* a=_rootAttribute; a; a=a->_next ) { + if ( XMLUtil::StringEqual( name, a->Name() ) ) { + if ( prev ) { + prev->_next = a->_next; + } + else { + _rootAttribute = a->_next; + } + DeleteAttribute( a ); + break; + } + prev = a; + } +} + + +char* XMLElement::ParseAttributes( char* p, int* curLineNumPtr ) +{ + XMLAttribute* prevAttribute = 0; + + // Read the attributes. + while( p ) { + p = XMLUtil::SkipWhiteSpace( p, curLineNumPtr ); + if ( !(*p) ) { + _document->SetError( XML_ERROR_PARSING_ELEMENT, _parseLineNum, "XMLElement name=%s", Name() ); + return 0; + } + + // attribute. + if (XMLUtil::IsNameStartChar( static_cast(*p) ) ) { + XMLAttribute* attrib = CreateAttribute(); + TIXMLASSERT( attrib ); + attrib->_parseLineNum = _document->_parseCurLineNum; + + const int attrLineNum = attrib->_parseLineNum; + + p = attrib->ParseDeep( p, _document->ProcessEntities(), curLineNumPtr ); + if ( !p || Attribute( attrib->Name() ) ) { + DeleteAttribute( attrib ); + _document->SetError( XML_ERROR_PARSING_ATTRIBUTE, attrLineNum, "XMLElement name=%s", Name() ); + return 0; + } + // There is a minor bug here: if the attribute in the source xml + // document is duplicated, it will not be detected and the + // attribute will be doubly added. However, tracking the 'prevAttribute' + // avoids re-scanning the attribute list. Preferring performance for + // now, may reconsider in the future. + if ( prevAttribute ) { + TIXMLASSERT( prevAttribute->_next == 0 ); + prevAttribute->_next = attrib; + } + else { + TIXMLASSERT( _rootAttribute == 0 ); + _rootAttribute = attrib; + } + prevAttribute = attrib; + } + // end of the tag + else if ( *p == '>' ) { + ++p; + break; + } + // end of the tag + else if ( *p == '/' && *(p+1) == '>' ) { + _closingType = CLOSED; + return p+2; // done; sealed element. + } + else { + _document->SetError( XML_ERROR_PARSING_ELEMENT, _parseLineNum, 0 ); + return 0; + } + } + return p; +} + +void XMLElement::DeleteAttribute( XMLAttribute* attribute ) +{ + if ( attribute == 0 ) { + return; + } + MemPool* pool = attribute->_memPool; + attribute->~XMLAttribute(); + pool->Free( attribute ); +} + +XMLAttribute* XMLElement::CreateAttribute() +{ + TIXMLASSERT( sizeof( XMLAttribute ) == _document->_attributePool.ItemSize() ); + XMLAttribute* attrib = new (_document->_attributePool.Alloc() ) XMLAttribute(); + TIXMLASSERT( attrib ); + attrib->_memPool = &_document->_attributePool; + attrib->_memPool->SetTracked(); + return attrib; +} + + +XMLElement* XMLElement::InsertNewChildElement(const char* name) +{ + XMLElement* node = _document->NewElement(name); + return InsertEndChild(node) ? node : 0; +} + +XMLComment* XMLElement::InsertNewComment(const char* comment) +{ + XMLComment* node = _document->NewComment(comment); + return InsertEndChild(node) ? node : 0; +} + +XMLText* XMLElement::InsertNewText(const char* text) +{ + XMLText* node = _document->NewText(text); + return InsertEndChild(node) ? node : 0; +} + +XMLDeclaration* XMLElement::InsertNewDeclaration(const char* text) +{ + XMLDeclaration* node = _document->NewDeclaration(text); + return InsertEndChild(node) ? node : 0; +} + +XMLUnknown* XMLElement::InsertNewUnknown(const char* text) +{ + XMLUnknown* node = _document->NewUnknown(text); + return InsertEndChild(node) ? node : 0; +} + + + +// +// +// foobar +// +char* XMLElement::ParseDeep( char* p, StrPair* parentEndTag, int* curLineNumPtr ) +{ + // Read the element name. + p = XMLUtil::SkipWhiteSpace( p, curLineNumPtr ); + + // The closing element is the form. It is + // parsed just like a regular element then deleted from + // the DOM. + if ( *p == '/' ) { + _closingType = CLOSING; + ++p; + } + + p = _value.ParseName( p ); + if ( _value.Empty() ) { + return 0; + } + + p = ParseAttributes( p, curLineNumPtr ); + if ( !p || !*p || _closingType != OPEN ) { + return p; + } + + p = XMLNode::ParseDeep( p, parentEndTag, curLineNumPtr ); + return p; +} + + + +XMLNode* XMLElement::ShallowClone( XMLDocument* doc ) const +{ + if ( !doc ) { + doc = _document; + } + XMLElement* element = doc->NewElement( Value() ); // fixme: this will always allocate memory. Intern? + for( const XMLAttribute* a=FirstAttribute(); a; a=a->Next() ) { + element->SetAttribute( a->Name(), a->Value() ); // fixme: this will always allocate memory. Intern? + } + return element; +} + + +bool XMLElement::ShallowEqual( const XMLNode* compare ) const +{ + TIXMLASSERT( compare ); + const XMLElement* other = compare->ToElement(); + if ( other && XMLUtil::StringEqual( other->Name(), Name() )) { + + const XMLAttribute* a=FirstAttribute(); + const XMLAttribute* b=other->FirstAttribute(); + + while ( a && b ) { + if ( !XMLUtil::StringEqual( a->Value(), b->Value() ) ) { + return false; + } + a = a->Next(); + b = b->Next(); + } + if ( a || b ) { + // different count + return false; + } + return true; + } + return false; +} + + +bool XMLElement::Accept( XMLVisitor* visitor ) const +{ + TIXMLASSERT( visitor ); + if ( visitor->VisitEnter( *this, _rootAttribute ) ) { + for ( const XMLNode* node=FirstChild(); node; node=node->NextSibling() ) { + if ( !node->Accept( visitor ) ) { + break; + } + } + } + return visitor->VisitExit( *this ); +} + + +// --------- XMLDocument ----------- // + +// Warning: List must match 'enum XMLError' +const char* XMLDocument::_errorNames[XML_ERROR_COUNT] = { + "XML_SUCCESS", + "XML_NO_ATTRIBUTE", + "XML_WRONG_ATTRIBUTE_TYPE", + "XML_ERROR_FILE_NOT_FOUND", + "XML_ERROR_FILE_COULD_NOT_BE_OPENED", + "XML_ERROR_FILE_READ_ERROR", + "XML_ERROR_PARSING_ELEMENT", + "XML_ERROR_PARSING_ATTRIBUTE", + "XML_ERROR_PARSING_TEXT", + "XML_ERROR_PARSING_CDATA", + "XML_ERROR_PARSING_COMMENT", + "XML_ERROR_PARSING_DECLARATION", + "XML_ERROR_PARSING_UNKNOWN", + "XML_ERROR_EMPTY_DOCUMENT", + "XML_ERROR_MISMATCHED_ELEMENT", + "XML_ERROR_PARSING", + "XML_CAN_NOT_CONVERT_TEXT", + "XML_NO_TEXT_NODE", + "XML_ELEMENT_DEPTH_EXCEEDED" +}; + + +XMLDocument::XMLDocument( bool processEntities, Whitespace whitespaceMode ) : + XMLNode( 0 ), + _writeBOM( false ), + _processEntities( processEntities ), + _errorID(XML_SUCCESS), + _whitespaceMode( whitespaceMode ), + _errorStr(), + _errorLineNum( 0 ), + _charBuffer( 0 ), + _parseCurLineNum( 0 ), + _parsingDepth(0), + _unlinked(), + _elementPool(), + _attributePool(), + _textPool(), + _commentPool() +{ + // avoid VC++ C4355 warning about 'this' in initializer list (C4355 is off by default in VS2012+) + _document = this; +} + + +XMLDocument::~XMLDocument() +{ + Clear(); +} + + +void XMLDocument::MarkInUse(const XMLNode* const node) +{ + TIXMLASSERT(node); + TIXMLASSERT(node->_parent == 0); + + for (size_t i = 0; i < _unlinked.Size(); ++i) { + if (node == _unlinked[i]) { + _unlinked.SwapRemove(i); + break; + } + } +} + +void XMLDocument::Clear() +{ + DeleteChildren(); + while( _unlinked.Size()) { + DeleteNode(_unlinked[0]); // Will remove from _unlinked as part of delete. + } + +#ifdef TINYXML2_DEBUG + const bool hadError = Error(); +#endif + ClearError(); + + delete [] _charBuffer; + _charBuffer = 0; + _parsingDepth = 0; + +#if 0 + _textPool.Trace( "text" ); + _elementPool.Trace( "element" ); + _commentPool.Trace( "comment" ); + _attributePool.Trace( "attribute" ); +#endif + +#ifdef TINYXML2_DEBUG + if ( !hadError ) { + TIXMLASSERT( _elementPool.CurrentAllocs() == _elementPool.Untracked() ); + TIXMLASSERT( _attributePool.CurrentAllocs() == _attributePool.Untracked() ); + TIXMLASSERT( _textPool.CurrentAllocs() == _textPool.Untracked() ); + TIXMLASSERT( _commentPool.CurrentAllocs() == _commentPool.Untracked() ); + } +#endif +} + + +void XMLDocument::DeepCopy(XMLDocument* target) const +{ + TIXMLASSERT(target); + if (target == this) { + return; // technically success - a no-op. + } + + target->Clear(); + for (const XMLNode* node = this->FirstChild(); node; node = node->NextSibling()) { + target->InsertEndChild(node->DeepClone(target)); + } +} + +XMLElement* XMLDocument::NewElement( const char* name ) +{ + XMLElement* ele = CreateUnlinkedNode( _elementPool ); + ele->SetName( name ); + return ele; +} + + +XMLComment* XMLDocument::NewComment( const char* str ) +{ + XMLComment* comment = CreateUnlinkedNode( _commentPool ); + comment->SetValue( str ); + return comment; +} + + +XMLText* XMLDocument::NewText( const char* str ) +{ + XMLText* text = CreateUnlinkedNode( _textPool ); + text->SetValue( str ); + return text; +} + + +XMLDeclaration* XMLDocument::NewDeclaration( const char* str ) +{ + XMLDeclaration* dec = CreateUnlinkedNode( _commentPool ); + dec->SetValue( str ? str : "xml version=\"1.0\" encoding=\"UTF-8\"" ); + return dec; +} + + +XMLUnknown* XMLDocument::NewUnknown( const char* str ) +{ + XMLUnknown* unk = CreateUnlinkedNode( _commentPool ); + unk->SetValue( str ); + return unk; +} + +static FILE* callfopen( const char* filepath, const char* mode ) +{ + TIXMLASSERT( filepath ); + TIXMLASSERT( mode ); +#if defined(_MSC_VER) && (_MSC_VER >= 1400 ) && (!defined WINCE) + FILE* fp = 0; + const errno_t err = fopen_s( &fp, filepath, mode ); + if ( err ) { + return 0; + } +#else + FILE* fp = fopen( filepath, mode ); +#endif + return fp; +} + +void XMLDocument::DeleteNode( XMLNode* node ) { + TIXMLASSERT( node ); + TIXMLASSERT(node->_document == this ); + if (node->_parent) { + node->_parent->DeleteChild( node ); + } + else { + // Isn't in the tree. + // Use the parent delete. + // Also, we need to mark it tracked: we 'know' + // it was never used. + node->_memPool->SetTracked(); + // Call the static XMLNode version: + XMLNode::DeleteNode(node); + } +} + + +XMLError XMLDocument::LoadFile( const char* filename ) +{ + if ( !filename ) { + TIXMLASSERT( false ); + SetError( XML_ERROR_FILE_COULD_NOT_BE_OPENED, 0, "filename=" ); + return _errorID; + } + + Clear(); + FILE* fp = callfopen( filename, "rb" ); + if ( !fp ) { + SetError( XML_ERROR_FILE_NOT_FOUND, 0, "filename=%s", filename ); + return _errorID; + } + LoadFile( fp ); + fclose( fp ); + return _errorID; +} + +XMLError XMLDocument::LoadFile( FILE* fp ) +{ + Clear(); + + TIXML_FSEEK( fp, 0, SEEK_SET ); + if ( fgetc( fp ) == EOF && ferror( fp ) != 0 ) { + SetError( XML_ERROR_FILE_READ_ERROR, 0, 0 ); + return _errorID; + } + + TIXML_FSEEK( fp, 0, SEEK_END ); + + unsigned long long filelength; + { + const long long fileLengthSigned = TIXML_FTELL( fp ); + TIXML_FSEEK( fp, 0, SEEK_SET ); + if ( fileLengthSigned == -1L ) { + SetError( XML_ERROR_FILE_READ_ERROR, 0, 0 ); + return _errorID; + } + TIXMLASSERT( fileLengthSigned >= 0 ); + filelength = static_cast(fileLengthSigned); + } + + const size_t maxSizeT = static_cast(-1); + // We'll do the comparison as an unsigned long long, because that's guaranteed to be at + // least 8 bytes, even on a 32-bit platform. + if ( filelength >= static_cast(maxSizeT) ) { + // Cannot handle files which won't fit in buffer together with null terminator + SetError( XML_ERROR_FILE_READ_ERROR, 0, 0 ); + return _errorID; + } + + if ( filelength == 0 ) { + SetError( XML_ERROR_EMPTY_DOCUMENT, 0, 0 ); + return _errorID; + } + + const size_t size = static_cast(filelength); + TIXMLASSERT( _charBuffer == 0 ); + _charBuffer = new char[size+1]; + const size_t read = fread( _charBuffer, 1, size, fp ); + if ( read != size ) { + SetError( XML_ERROR_FILE_READ_ERROR, 0, 0 ); + return _errorID; + } + + _charBuffer[size] = 0; + + Parse(); + return _errorID; +} + + +XMLError XMLDocument::SaveFile( const char* filename, bool compact ) +{ + if ( !filename ) { + TIXMLASSERT( false ); + SetError( XML_ERROR_FILE_COULD_NOT_BE_OPENED, 0, "filename=" ); + return _errorID; + } + + FILE* fp = callfopen( filename, "w" ); + if ( !fp ) { + SetError( XML_ERROR_FILE_COULD_NOT_BE_OPENED, 0, "filename=%s", filename ); + return _errorID; + } + SaveFile(fp, compact); + fclose( fp ); + return _errorID; +} + + +XMLError XMLDocument::SaveFile( FILE* fp, bool compact ) +{ + // Clear any error from the last save, otherwise it will get reported + // for *this* call. + ClearError(); + XMLPrinter stream( fp, compact ); + Print( &stream ); + return _errorID; +} + + +XMLError XMLDocument::Parse( const char* xml, size_t nBytes ) +{ + Clear(); + + if ( nBytes == 0 || !xml || !*xml ) { + SetError( XML_ERROR_EMPTY_DOCUMENT, 0, 0 ); + return _errorID; + } + if ( nBytes == static_cast(-1) ) { + nBytes = strlen( xml ); + } + TIXMLASSERT( _charBuffer == 0 ); + _charBuffer = new char[ nBytes+1 ]; + memcpy( _charBuffer, xml, nBytes ); + _charBuffer[nBytes] = 0; + + Parse(); + if ( Error() ) { + // clean up now essentially dangling memory. + // and the parse fail can put objects in the + // pools that are dead and inaccessible. + DeleteChildren(); + _elementPool.Clear(); + _attributePool.Clear(); + _textPool.Clear(); + _commentPool.Clear(); + } + return _errorID; +} + + +void XMLDocument::Print( XMLPrinter* streamer ) const +{ + if ( streamer ) { + Accept( streamer ); + } + else { + XMLPrinter stdoutStreamer( stdout ); + Accept( &stdoutStreamer ); + } +} + + +void XMLDocument::ClearError() { + _errorID = XML_SUCCESS; + _errorLineNum = 0; + _errorStr.Reset(); +} + + +void XMLDocument::SetError( XMLError error, int lineNum, const char* format, ... ) +{ + TIXMLASSERT(error >= 0 && error < XML_ERROR_COUNT); + _errorID = error; + _errorLineNum = lineNum; + _errorStr.Reset(); + + const size_t BUFFER_SIZE = 1000; + char* buffer = new char[BUFFER_SIZE]; + + TIXMLASSERT(sizeof(error) <= sizeof(int)); + TIXML_SNPRINTF(buffer, BUFFER_SIZE, "Error=%s ErrorID=%d (0x%x) Line number=%d", + ErrorIDToName(error), static_cast(error), static_cast(error), lineNum); + + if (format) { + size_t len = strlen(buffer); + TIXML_SNPRINTF(buffer + len, BUFFER_SIZE - len, ": "); + len = strlen(buffer); + + va_list va; + va_start(va, format); + TIXML_VSNPRINTF(buffer + len, BUFFER_SIZE - len, format, va); + va_end(va); + } + _errorStr.SetStr(buffer); + delete[] buffer; +} + + +/*static*/ const char* XMLDocument::ErrorIDToName(XMLError errorID) +{ + TIXMLASSERT( errorID >= 0 && errorID < XML_ERROR_COUNT ); + const char* errorName = _errorNames[errorID]; + TIXMLASSERT( errorName && errorName[0] ); + return errorName; +} + +const char* XMLDocument::ErrorStr() const +{ + return _errorStr.Empty() ? "" : _errorStr.GetStr(); +} + + +void XMLDocument::PrintError() const +{ + printf("%s\n", ErrorStr()); +} + +const char* XMLDocument::ErrorName() const +{ + return ErrorIDToName(_errorID); +} + +void XMLDocument::Parse() +{ + TIXMLASSERT( NoChildren() ); // Clear() must have been called previously + TIXMLASSERT( _charBuffer ); + _parseCurLineNum = 1; + _parseLineNum = 1; + char* p = _charBuffer; + p = XMLUtil::SkipWhiteSpace( p, &_parseCurLineNum ); + p = const_cast( XMLUtil::ReadBOM( p, &_writeBOM ) ); + if ( !*p ) { + SetError( XML_ERROR_EMPTY_DOCUMENT, 0, 0 ); + return; + } + ParseDeep(p, 0, &_parseCurLineNum ); +} + +void XMLDocument::PushDepth() +{ + _parsingDepth++; + if (_parsingDepth == TINYXML2_MAX_ELEMENT_DEPTH) { + SetError(XML_ELEMENT_DEPTH_EXCEEDED, _parseCurLineNum, "Element nesting is too deep." ); + } +} + +void XMLDocument::PopDepth() +{ + TIXMLASSERT(_parsingDepth > 0); + --_parsingDepth; +} + +XMLPrinter::XMLPrinter( FILE* file, bool compact, int depth ) : + _elementJustOpened( false ), + _stack(), + _firstElement( true ), + _fp( file ), + _depth( depth ), + _textDepth( -1 ), + _processEntities( true ), + _compactMode( compact ), + _buffer() +{ + for( int i=0; i(entityValue); + TIXMLASSERT( flagIndex < ENTITY_RANGE ); + _entityFlag[flagIndex] = true; + } + _restrictedEntityFlag[static_cast('&')] = true; + _restrictedEntityFlag[static_cast('<')] = true; + _restrictedEntityFlag[static_cast('>')] = true; // not required, but consistency is nice + _buffer.Push( 0 ); +} + + +void XMLPrinter::Print( const char* format, ... ) +{ + va_list va; + va_start( va, format ); + + if ( _fp ) { + vfprintf( _fp, format, va ); + } + else { + const int len = TIXML_VSCPRINTF( format, va ); + // Close out and re-start the va-args + va_end( va ); + TIXMLASSERT( len >= 0 ); + va_start( va, format ); + TIXMLASSERT( _buffer.Size() > 0 && _buffer[_buffer.Size() - 1] == 0 ); + char* p = _buffer.PushArr( len ) - 1; // back up over the null terminator. + TIXML_VSNPRINTF( p, len+1, format, va ); + } + va_end( va ); +} + + +void XMLPrinter::Write( const char* data, size_t size ) +{ + if ( _fp ) { + fwrite ( data , sizeof(char), size, _fp); + } + else { + char* p = _buffer.PushArr( static_cast(size) ) - 1; // back up over the null terminator. + memcpy( p, data, size ); + p[size] = 0; + } +} + + +void XMLPrinter::Putc( char ch ) +{ + if ( _fp ) { + fputc ( ch, _fp); + } + else { + char* p = _buffer.PushArr( sizeof(char) ) - 1; // back up over the null terminator. + p[0] = ch; + p[1] = 0; + } +} + + +void XMLPrinter::PrintSpace( int depth ) +{ + for( int i=0; i 0 && *q < ENTITY_RANGE ) { + // Check for entities. If one is found, flush + // the stream up until the entity, write the + // entity, and keep looking. + if ( flag[static_cast(*q)] ) { + while ( p < q ) { + const size_t delta = q - p; + const int toPrint = ( INT_MAX < delta ) ? INT_MAX : static_cast(delta); + Write( p, toPrint ); + p += toPrint; + } + bool entityPatternPrinted = false; + for( int i=0; i(delta); + Write( p, toPrint ); + } + } + else { + Write( p ); + } +} + + +void XMLPrinter::PushHeader( bool writeBOM, bool writeDec ) +{ + if ( writeBOM ) { + static const unsigned char bom[] = { TIXML_UTF_LEAD_0, TIXML_UTF_LEAD_1, TIXML_UTF_LEAD_2, 0 }; + Write( reinterpret_cast< const char* >( bom ) ); + } + if ( writeDec ) { + PushDeclaration( "xml version=\"1.0\"" ); + } +} + +void XMLPrinter::PrepareForNewNode( bool compactMode ) +{ + SealElementIfJustOpened(); + + if ( compactMode ) { + return; + } + + if ( _firstElement ) { + PrintSpace (_depth); + } else if ( _textDepth < 0) { + Putc( '\n' ); + PrintSpace( _depth ); + } + + _firstElement = false; +} + +void XMLPrinter::OpenElement( const char* name, bool compactMode ) +{ + PrepareForNewNode( compactMode ); + _stack.Push( name ); + + Write ( "<" ); + Write ( name ); + + _elementJustOpened = true; + ++_depth; +} + + +void XMLPrinter::PushAttribute( const char* name, const char* value ) +{ + TIXMLASSERT( _elementJustOpened ); + Putc ( ' ' ); + Write( name ); + Write( "=\"" ); + PrintString( value, false ); + Putc ( '\"' ); +} + + +void XMLPrinter::PushAttribute( const char* name, int v ) +{ + char buf[BUF_SIZE]; + XMLUtil::ToStr( v, buf, BUF_SIZE ); + PushAttribute( name, buf ); +} + + +void XMLPrinter::PushAttribute( const char* name, unsigned v ) +{ + char buf[BUF_SIZE]; + XMLUtil::ToStr( v, buf, BUF_SIZE ); + PushAttribute( name, buf ); +} + + +void XMLPrinter::PushAttribute(const char* name, int64_t v) +{ + char buf[BUF_SIZE]; + XMLUtil::ToStr(v, buf, BUF_SIZE); + PushAttribute(name, buf); +} + + +void XMLPrinter::PushAttribute(const char* name, uint64_t v) +{ + char buf[BUF_SIZE]; + XMLUtil::ToStr(v, buf, BUF_SIZE); + PushAttribute(name, buf); +} + + +void XMLPrinter::PushAttribute( const char* name, bool v ) +{ + char buf[BUF_SIZE]; + XMLUtil::ToStr( v, buf, BUF_SIZE ); + PushAttribute( name, buf ); +} + + +void XMLPrinter::PushAttribute( const char* name, double v ) +{ + char buf[BUF_SIZE]; + XMLUtil::ToStr( v, buf, BUF_SIZE ); + PushAttribute( name, buf ); +} + + +void XMLPrinter::CloseElement( bool compactMode ) +{ + --_depth; + const char* name = _stack.Pop(); + + if ( _elementJustOpened ) { + Write( "/>" ); + } + else { + if ( _textDepth < 0 && !compactMode) { + Putc( '\n' ); + PrintSpace( _depth ); + } + Write ( "" ); + } + + if ( _textDepth == _depth ) { + _textDepth = -1; + } + if ( _depth == 0 && !compactMode) { + Putc( '\n' ); + } + _elementJustOpened = false; +} + + +void XMLPrinter::SealElementIfJustOpened() +{ + if ( !_elementJustOpened ) { + return; + } + _elementJustOpened = false; + Putc( '>' ); +} + + +void XMLPrinter::PushText( const char* text, bool cdata ) +{ + _textDepth = _depth-1; + + SealElementIfJustOpened(); + if ( cdata ) { + Write( "" ); + } + else { + PrintString( text, true ); + } +} + + +void XMLPrinter::PushText( int64_t value ) +{ + char buf[BUF_SIZE]; + XMLUtil::ToStr( value, buf, BUF_SIZE ); + PushText( buf, false ); +} + + +void XMLPrinter::PushText( uint64_t value ) +{ + char buf[BUF_SIZE]; + XMLUtil::ToStr(value, buf, BUF_SIZE); + PushText(buf, false); +} + + +void XMLPrinter::PushText( int value ) +{ + char buf[BUF_SIZE]; + XMLUtil::ToStr( value, buf, BUF_SIZE ); + PushText( buf, false ); +} + + +void XMLPrinter::PushText( unsigned value ) +{ + char buf[BUF_SIZE]; + XMLUtil::ToStr( value, buf, BUF_SIZE ); + PushText( buf, false ); +} + + +void XMLPrinter::PushText( bool value ) +{ + char buf[BUF_SIZE]; + XMLUtil::ToStr( value, buf, BUF_SIZE ); + PushText( buf, false ); +} + + +void XMLPrinter::PushText( float value ) +{ + char buf[BUF_SIZE]; + XMLUtil::ToStr( value, buf, BUF_SIZE ); + PushText( buf, false ); +} + + +void XMLPrinter::PushText( double value ) +{ + char buf[BUF_SIZE]; + XMLUtil::ToStr( value, buf, BUF_SIZE ); + PushText( buf, false ); +} + + +void XMLPrinter::PushComment( const char* comment ) +{ + PrepareForNewNode( _compactMode ); + + Write( "" ); +} + + +void XMLPrinter::PushDeclaration( const char* value ) +{ + PrepareForNewNode( _compactMode ); + + Write( "" ); +} + + +void XMLPrinter::PushUnknown( const char* value ) +{ + PrepareForNewNode( _compactMode ); + + Write( "' ); +} + + +bool XMLPrinter::VisitEnter( const XMLDocument& doc ) +{ + _processEntities = doc.ProcessEntities(); + if ( doc.HasBOM() ) { + PushHeader( true, false ); + } + return true; +} + + +bool XMLPrinter::VisitEnter( const XMLElement& element, const XMLAttribute* attribute ) +{ + const XMLElement* parentElem = 0; + if ( element.Parent() ) { + parentElem = element.Parent()->ToElement(); + } + const bool compactMode = parentElem ? CompactMode( *parentElem ) : _compactMode; + OpenElement( element.Name(), compactMode ); + while ( attribute ) { + PushAttribute( attribute->Name(), attribute->Value() ); + attribute = attribute->Next(); + } + return true; +} + + +bool XMLPrinter::VisitExit( const XMLElement& element ) +{ + CloseElement( CompactMode(element) ); + return true; +} + + +bool XMLPrinter::Visit( const XMLText& text ) +{ + PushText( text.Value(), text.CData() ); + return true; +} + + +bool XMLPrinter::Visit( const XMLComment& comment ) +{ + PushComment( comment.Value() ); + return true; +} + +bool XMLPrinter::Visit( const XMLDeclaration& declaration ) +{ + PushDeclaration( declaration.Value() ); + return true; +} + + +bool XMLPrinter::Visit( const XMLUnknown& unknown ) +{ + PushUnknown( unknown.Value() ); + return true; +} + +} // namespace tinyxml2 diff --git a/third_party/tinyxml2/tinyxml2.h b/third_party/tinyxml2/tinyxml2.h new file mode 100644 index 0000000..9626be8 --- /dev/null +++ b/third_party/tinyxml2/tinyxml2.h @@ -0,0 +1,2383 @@ +/* +Original code by Lee Thomason (www.grinninglizard.com) + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any +damages arising from the use of this software. + +Permission is granted to anyone to use this software for any +purpose, including commercial applications, and to alter it and +redistribute it freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must +not claim that you wrote the original software. If you use this +software in a product, an acknowledgment in the product documentation +would be appreciated but is not required. + +2. Altered source versions must be plainly marked as such, and +must not be misrepresented as being the original software. + +3. This notice may not be removed or altered from any source +distribution. +*/ + +#ifndef TINYXML2_INCLUDED +#define TINYXML2_INCLUDED + +#if defined(ANDROID_NDK) || defined(__BORLANDC__) || defined(__QNXNTO__) +# include +# include +# include +# include +# include +# if defined(__PS3__) +# include +# endif +#else +# include +# include +# include +# include +# include +#endif +#include + +/* + gcc: + g++ -Wall -DTINYXML2_DEBUG tinyxml2.cpp xmltest.cpp -o gccxmltest.exe + + Formatting, Artistic Style: + AStyle.exe --style=1tbs --indent-switches --break-closing-brackets --indent-preprocessor tinyxml2.cpp tinyxml2.h +*/ + +#if defined( _DEBUG ) || defined (__DEBUG__) +# ifndef TINYXML2_DEBUG +# define TINYXML2_DEBUG +# endif +#endif + +#ifdef _MSC_VER +# pragma warning(push) +# pragma warning(disable: 4251) +#endif + +#ifdef _MSC_VER +# ifdef TINYXML2_EXPORT +# define TINYXML2_LIB __declspec(dllexport) +# elif defined(TINYXML2_IMPORT) +# define TINYXML2_LIB __declspec(dllimport) +# else +# define TINYXML2_LIB +# endif +#elif __GNUC__ >= 4 +# define TINYXML2_LIB __attribute__((visibility("default"))) +#else +# define TINYXML2_LIB +#endif + + +#if !defined(TIXMLASSERT) +#if defined(TINYXML2_DEBUG) +# if defined(_MSC_VER) +# // "(void)0," is for suppressing C4127 warning in "assert(false)", "assert(true)" and the like +# define TIXMLASSERT( x ) do { if ( !((void)0,(x))) { __debugbreak(); } } while(false) +# elif defined (ANDROID_NDK) +# include +# define TIXMLASSERT( x ) do { if ( !(x)) { __android_log_assert( "assert", "grinliz", "ASSERT in '%s' at %d.", __FILE__, __LINE__ ); } } while(false) +# else +# include +# define TIXMLASSERT assert +# endif +#else +# define TIXMLASSERT( x ) do {} while(false) +#endif +#endif + +/* Versioning, past 1.0.14: + http://semver.org/ +*/ +static const int TIXML2_MAJOR_VERSION = 11; +static const int TIXML2_MINOR_VERSION = 0; +static const int TIXML2_PATCH_VERSION = 0; + +#define TINYXML2_MAJOR_VERSION 11 +#define TINYXML2_MINOR_VERSION 0 +#define TINYXML2_PATCH_VERSION 0 + +// A fixed element depth limit is problematic. There needs to be a +// limit to avoid a stack overflow. However, that limit varies per +// system, and the capacity of the stack. On the other hand, it's a trivial +// attack that can result from ill, malicious, or even correctly formed XML, +// so there needs to be a limit in place. +static const int TINYXML2_MAX_ELEMENT_DEPTH = 500; + +namespace tinyxml2 +{ +class XMLDocument; +class XMLElement; +class XMLAttribute; +class XMLComment; +class XMLText; +class XMLDeclaration; +class XMLUnknown; +class XMLPrinter; + +/* + A class that wraps strings. Normally stores the start and end + pointers into the XML file itself, and will apply normalization + and entity translation if actually read. Can also store (and memory + manage) a traditional char[] + + Isn't clear why TINYXML2_LIB is needed; but seems to fix #719 +*/ +class TINYXML2_LIB StrPair +{ +public: + enum Mode { + NEEDS_ENTITY_PROCESSING = 0x01, + NEEDS_NEWLINE_NORMALIZATION = 0x02, + NEEDS_WHITESPACE_COLLAPSING = 0x04, + + TEXT_ELEMENT = NEEDS_ENTITY_PROCESSING | NEEDS_NEWLINE_NORMALIZATION, + TEXT_ELEMENT_LEAVE_ENTITIES = NEEDS_NEWLINE_NORMALIZATION, + ATTRIBUTE_NAME = 0, + ATTRIBUTE_VALUE = NEEDS_ENTITY_PROCESSING | NEEDS_NEWLINE_NORMALIZATION, + ATTRIBUTE_VALUE_LEAVE_ENTITIES = NEEDS_NEWLINE_NORMALIZATION, + COMMENT = NEEDS_NEWLINE_NORMALIZATION + }; + + StrPair() : _flags( 0 ), _start( 0 ), _end( 0 ) {} + ~StrPair(); + + void Set( char* start, char* end, int flags ) { + TIXMLASSERT( start ); + TIXMLASSERT( end ); + Reset(); + _start = start; + _end = end; + _flags = flags | NEEDS_FLUSH; + } + + const char* GetStr(); + + bool Empty() const { + return _start == _end; + } + + void SetInternedStr( const char* str ) { + Reset(); + _start = const_cast(str); + } + + void SetStr( const char* str, int flags=0 ); + + char* ParseText( char* in, const char* endTag, int strFlags, int* curLineNumPtr ); + char* ParseName( char* in ); + + void TransferTo( StrPair* other ); + void Reset(); + +private: + void CollapseWhitespace(); + + enum { + NEEDS_FLUSH = 0x100, + NEEDS_DELETE = 0x200 + }; + + int _flags; + char* _start; + char* _end; + + StrPair( const StrPair& other ); // not supported + void operator=( const StrPair& other ); // not supported, use TransferTo() +}; + + +/* + A dynamic array of Plain Old Data. Doesn't support constructors, etc. + Has a small initial memory pool, so that low or no usage will not + cause a call to new/delete +*/ +template +class DynArray +{ +public: + DynArray() : + _mem( _pool ), + _allocated( INITIAL_SIZE ), + _size( 0 ) + { + } + + ~DynArray() { + if ( _mem != _pool ) { + delete [] _mem; + } + } + + void Clear() { + _size = 0; + } + + void Push( T t ) { + TIXMLASSERT( _size < INT_MAX ); + EnsureCapacity( _size+1 ); + _mem[_size] = t; + ++_size; + } + + T* PushArr( size_t count ) { + TIXMLASSERT( _size <= SIZE_MAX - count ); + EnsureCapacity( _size+count ); + T* ret = &_mem[_size]; + _size += count; + return ret; + } + + T Pop() { + TIXMLASSERT( _size > 0 ); + --_size; + return _mem[_size]; + } + + void PopArr( size_t count ) { + TIXMLASSERT( _size >= count ); + _size -= count; + } + + bool Empty() const { + return _size == 0; + } + + T& operator[](size_t i) { + TIXMLASSERT( i < _size ); + return _mem[i]; + } + + const T& operator[](size_t i) const { + TIXMLASSERT( i < _size ); + return _mem[i]; + } + + const T& PeekTop() const { + TIXMLASSERT( _size > 0 ); + return _mem[ _size - 1]; + } + + size_t Size() const { + TIXMLASSERT( _size >= 0 ); + return _size; + } + + size_t Capacity() const { + TIXMLASSERT( _allocated >= INITIAL_SIZE ); + return _allocated; + } + + void SwapRemove(size_t i) { + TIXMLASSERT(i < _size); + TIXMLASSERT(_size > 0); + _mem[i] = _mem[_size - 1]; + --_size; + } + + const T* Mem() const { + TIXMLASSERT( _mem ); + return _mem; + } + + T* Mem() { + TIXMLASSERT( _mem ); + return _mem; + } + +private: + DynArray( const DynArray& ); // not supported + void operator=( const DynArray& ); // not supported + + void EnsureCapacity( size_t cap ) { + TIXMLASSERT( cap > 0 ); + if ( cap > _allocated ) { + TIXMLASSERT( cap <= SIZE_MAX / 2 / sizeof(T)); + const size_t newAllocated = cap * 2; + T* newMem = new T[newAllocated]; + TIXMLASSERT( newAllocated >= _size ); + memcpy( newMem, _mem, sizeof(T) * _size ); // warning: not using constructors, only works for PODs + if ( _mem != _pool ) { + delete [] _mem; + } + _mem = newMem; + _allocated = newAllocated; + } + } + + T* _mem; + T _pool[INITIAL_SIZE]; + size_t _allocated; // objects allocated + size_t _size; // number objects in use +}; + + +/* + Parent virtual class of a pool for fast allocation + and deallocation of objects. +*/ +class MemPool +{ +public: + MemPool() {} + virtual ~MemPool() {} + + virtual size_t ItemSize() const = 0; + virtual void* Alloc() = 0; + virtual void Free( void* ) = 0; + virtual void SetTracked() = 0; +}; + + +/* + Template child class to create pools of the correct type. +*/ +template< size_t ITEM_SIZE > +class MemPoolT : public MemPool +{ +public: + MemPoolT() : _blockPtrs(), _root(0), _currentAllocs(0), _nAllocs(0), _maxAllocs(0), _nUntracked(0) {} + ~MemPoolT() { + MemPoolT< ITEM_SIZE >::Clear(); + } + + void Clear() { + // Delete the blocks. + while( !_blockPtrs.Empty()) { + Block* lastBlock = _blockPtrs.Pop(); + delete lastBlock; + } + _root = 0; + _currentAllocs = 0; + _nAllocs = 0; + _maxAllocs = 0; + _nUntracked = 0; + } + + virtual size_t ItemSize() const override { + return ITEM_SIZE; + } + size_t CurrentAllocs() const { + return _currentAllocs; + } + + virtual void* Alloc() override{ + if ( !_root ) { + // Need a new block. + Block* block = new Block; + _blockPtrs.Push( block ); + + Item* blockItems = block->items; + for( size_t i = 0; i < ITEMS_PER_BLOCK - 1; ++i ) { + blockItems[i].next = &(blockItems[i + 1]); + } + blockItems[ITEMS_PER_BLOCK - 1].next = 0; + _root = blockItems; + } + Item* const result = _root; + TIXMLASSERT( result != 0 ); + _root = _root->next; + + ++_currentAllocs; + if ( _currentAllocs > _maxAllocs ) { + _maxAllocs = _currentAllocs; + } + ++_nAllocs; + ++_nUntracked; + return result; + } + + virtual void Free( void* mem ) override { + if ( !mem ) { + return; + } + --_currentAllocs; + Item* item = static_cast( mem ); +#ifdef TINYXML2_DEBUG + memset( item, 0xfe, sizeof( *item ) ); +#endif + item->next = _root; + _root = item; + } + void Trace( const char* name ) { + printf( "Mempool %s watermark=%d [%dk] current=%d size=%d nAlloc=%d blocks=%d\n", + name, _maxAllocs, _maxAllocs * ITEM_SIZE / 1024, _currentAllocs, + ITEM_SIZE, _nAllocs, _blockPtrs.Size() ); + } + + void SetTracked() override { + --_nUntracked; + } + + size_t Untracked() const { + return _nUntracked; + } + + // This number is perf sensitive. 4k seems like a good tradeoff on my machine. + // The test file is large, 170k. + // Release: VS2010 gcc(no opt) + // 1k: 4000 + // 2k: 4000 + // 4k: 3900 21000 + // 16k: 5200 + // 32k: 4300 + // 64k: 4000 21000 + // Declared public because some compilers do not accept to use ITEMS_PER_BLOCK + // in private part if ITEMS_PER_BLOCK is private + enum { ITEMS_PER_BLOCK = (4 * 1024) / ITEM_SIZE }; + +private: + MemPoolT( const MemPoolT& ); // not supported + void operator=( const MemPoolT& ); // not supported + + union Item { + Item* next; + char itemData[static_cast(ITEM_SIZE)]; + }; + struct Block { + Item items[ITEMS_PER_BLOCK]; + }; + DynArray< Block*, 10 > _blockPtrs; + Item* _root; + + size_t _currentAllocs; + size_t _nAllocs; + size_t _maxAllocs; + size_t _nUntracked; +}; + + + +/** + Implements the interface to the "Visitor pattern" (see the Accept() method.) + If you call the Accept() method, it requires being passed a XMLVisitor + class to handle callbacks. For nodes that contain other nodes (Document, Element) + you will get called with a VisitEnter/VisitExit pair. Nodes that are always leafs + are simply called with Visit(). + + If you return 'true' from a Visit method, recursive parsing will continue. If you return + false, no children of this node or its siblings will be visited. + + All flavors of Visit methods have a default implementation that returns 'true' (continue + visiting). You need to only override methods that are interesting to you. + + Generally Accept() is called on the XMLDocument, although all nodes support visiting. + + You should never change the document from a callback. + + @sa XMLNode::Accept() +*/ +class TINYXML2_LIB XMLVisitor +{ +public: + virtual ~XMLVisitor() {} + + /// Visit a document. + virtual bool VisitEnter( const XMLDocument& /*doc*/ ) { + return true; + } + /// Visit a document. + virtual bool VisitExit( const XMLDocument& /*doc*/ ) { + return true; + } + + /// Visit an element. + virtual bool VisitEnter( const XMLElement& /*element*/, const XMLAttribute* /*firstAttribute*/ ) { + return true; + } + /// Visit an element. + virtual bool VisitExit( const XMLElement& /*element*/ ) { + return true; + } + + /// Visit a declaration. + virtual bool Visit( const XMLDeclaration& /*declaration*/ ) { + return true; + } + /// Visit a text node. + virtual bool Visit( const XMLText& /*text*/ ) { + return true; + } + /// Visit a comment node. + virtual bool Visit( const XMLComment& /*comment*/ ) { + return true; + } + /// Visit an unknown node. + virtual bool Visit( const XMLUnknown& /*unknown*/ ) { + return true; + } +}; + +// WARNING: must match XMLDocument::_errorNames[] +enum XMLError { + XML_SUCCESS = 0, + XML_NO_ATTRIBUTE, + XML_WRONG_ATTRIBUTE_TYPE, + XML_ERROR_FILE_NOT_FOUND, + XML_ERROR_FILE_COULD_NOT_BE_OPENED, + XML_ERROR_FILE_READ_ERROR, + XML_ERROR_PARSING_ELEMENT, + XML_ERROR_PARSING_ATTRIBUTE, + XML_ERROR_PARSING_TEXT, + XML_ERROR_PARSING_CDATA, + XML_ERROR_PARSING_COMMENT, + XML_ERROR_PARSING_DECLARATION, + XML_ERROR_PARSING_UNKNOWN, + XML_ERROR_EMPTY_DOCUMENT, + XML_ERROR_MISMATCHED_ELEMENT, + XML_ERROR_PARSING, + XML_CAN_NOT_CONVERT_TEXT, + XML_NO_TEXT_NODE, + XML_ELEMENT_DEPTH_EXCEEDED, + + XML_ERROR_COUNT +}; + + +/* + Utility functionality. +*/ +class TINYXML2_LIB XMLUtil +{ +public: + static const char* SkipWhiteSpace( const char* p, int* curLineNumPtr ) { + TIXMLASSERT( p ); + + while( IsWhiteSpace(*p) ) { + if (curLineNumPtr && *p == '\n') { + ++(*curLineNumPtr); + } + ++p; + } + TIXMLASSERT( p ); + return p; + } + static char* SkipWhiteSpace( char* const p, int* curLineNumPtr ) { + return const_cast( SkipWhiteSpace( const_cast(p), curLineNumPtr ) ); + } + + // Anything in the high order range of UTF-8 is assumed to not be whitespace. This isn't + // correct, but simple, and usually works. + static bool IsWhiteSpace( char p ) { + return !IsUTF8Continuation(p) && isspace( static_cast(p) ); + } + + inline static bool IsNameStartChar( unsigned char ch ) { + if ( ch >= 128 ) { + // This is a heuristic guess in attempt to not implement Unicode-aware isalpha() + return true; + } + if ( isalpha( ch ) ) { + return true; + } + return ch == ':' || ch == '_'; + } + + inline static bool IsNameChar( unsigned char ch ) { + return IsNameStartChar( ch ) + || isdigit( ch ) + || ch == '.' + || ch == '-'; + } + + inline static bool IsPrefixHex( const char* p) { + p = SkipWhiteSpace(p, 0); + return p && *p == '0' && ( *(p + 1) == 'x' || *(p + 1) == 'X'); + } + + inline static bool StringEqual( const char* p, const char* q, int nChar=INT_MAX ) { + if ( p == q ) { + return true; + } + TIXMLASSERT( p ); + TIXMLASSERT( q ); + TIXMLASSERT( nChar >= 0 ); + return strncmp( p, q, static_cast(nChar) ) == 0; + } + + inline static bool IsUTF8Continuation( const char p ) { + return ( p & 0x80 ) != 0; + } + + static const char* ReadBOM( const char* p, bool* hasBOM ); + // p is the starting location, + // the UTF-8 value of the entity will be placed in value, and length filled in. + static const char* GetCharacterRef( const char* p, char* value, int* length ); + static void ConvertUTF32ToUTF8( unsigned long input, char* output, int* length ); + + // converts primitive types to strings + static void ToStr( int v, char* buffer, int bufferSize ); + static void ToStr( unsigned v, char* buffer, int bufferSize ); + static void ToStr( bool v, char* buffer, int bufferSize ); + static void ToStr( float v, char* buffer, int bufferSize ); + static void ToStr( double v, char* buffer, int bufferSize ); + static void ToStr(int64_t v, char* buffer, int bufferSize); + static void ToStr(uint64_t v, char* buffer, int bufferSize); + + // converts strings to primitive types + static bool ToInt( const char* str, int* value ); + static bool ToUnsigned( const char* str, unsigned* value ); + static bool ToBool( const char* str, bool* value ); + static bool ToFloat( const char* str, float* value ); + static bool ToDouble( const char* str, double* value ); + static bool ToInt64(const char* str, int64_t* value); + static bool ToUnsigned64(const char* str, uint64_t* value); + // Changes what is serialized for a boolean value. + // Default to "true" and "false". Shouldn't be changed + // unless you have a special testing or compatibility need. + // Be careful: static, global, & not thread safe. + // Be sure to set static const memory as parameters. + static void SetBoolSerialization(const char* writeTrue, const char* writeFalse); + +private: + static const char* writeBoolTrue; + static const char* writeBoolFalse; +}; + + +/** XMLNode is a base class for every object that is in the + XML Document Object Model (DOM), except XMLAttributes. + Nodes have siblings, a parent, and children which can + be navigated. A node is always in a XMLDocument. + The type of a XMLNode can be queried, and it can + be cast to its more defined type. + + A XMLDocument allocates memory for all its Nodes. + When the XMLDocument gets deleted, all its Nodes + will also be deleted. + + @verbatim + A Document can contain: Element (container or leaf) + Comment (leaf) + Unknown (leaf) + Declaration( leaf ) + + An Element can contain: Element (container or leaf) + Text (leaf) + Attributes (not on tree) + Comment (leaf) + Unknown (leaf) + + @endverbatim +*/ +class TINYXML2_LIB XMLNode +{ + friend class XMLDocument; + friend class XMLElement; +public: + + /// Get the XMLDocument that owns this XMLNode. + const XMLDocument* GetDocument() const { + TIXMLASSERT( _document ); + return _document; + } + /// Get the XMLDocument that owns this XMLNode. + XMLDocument* GetDocument() { + TIXMLASSERT( _document ); + return _document; + } + + /// Safely cast to an Element, or null. + virtual XMLElement* ToElement() { + return 0; + } + /// Safely cast to Text, or null. + virtual XMLText* ToText() { + return 0; + } + /// Safely cast to a Comment, or null. + virtual XMLComment* ToComment() { + return 0; + } + /// Safely cast to a Document, or null. + virtual XMLDocument* ToDocument() { + return 0; + } + /// Safely cast to a Declaration, or null. + virtual XMLDeclaration* ToDeclaration() { + return 0; + } + /// Safely cast to an Unknown, or null. + virtual XMLUnknown* ToUnknown() { + return 0; + } + + virtual const XMLElement* ToElement() const { + return 0; + } + virtual const XMLText* ToText() const { + return 0; + } + virtual const XMLComment* ToComment() const { + return 0; + } + virtual const XMLDocument* ToDocument() const { + return 0; + } + virtual const XMLDeclaration* ToDeclaration() const { + return 0; + } + virtual const XMLUnknown* ToUnknown() const { + return 0; + } + + // ChildElementCount was originally suggested by msteiger on the sourceforge page for TinyXML and modified by KB1SPH for TinyXML-2. + + int ChildElementCount(const char *value) const; + + int ChildElementCount() const; + + /** The meaning of 'value' changes for the specific type. + @verbatim + Document: empty (NULL is returned, not an empty string) + Element: name of the element + Comment: the comment text + Unknown: the tag contents + Text: the text string + @endverbatim + */ + const char* Value() const; + + /** Set the Value of an XML node. + @sa Value() + */ + void SetValue( const char* val, bool staticMem=false ); + + /// Gets the line number the node is in, if the document was parsed from a file. + int GetLineNum() const { return _parseLineNum; } + + /// Get the parent of this node on the DOM. + const XMLNode* Parent() const { + return _parent; + } + + XMLNode* Parent() { + return _parent; + } + + /// Returns true if this node has no children. + bool NoChildren() const { + return !_firstChild; + } + + /// Get the first child node, or null if none exists. + const XMLNode* FirstChild() const { + return _firstChild; + } + + XMLNode* FirstChild() { + return _firstChild; + } + + /** Get the first child element, or optionally the first child + element with the specified name. + */ + const XMLElement* FirstChildElement( const char* name = 0 ) const; + + XMLElement* FirstChildElement( const char* name = 0 ) { + return const_cast(const_cast(this)->FirstChildElement( name )); + } + + /// Get the last child node, or null if none exists. + const XMLNode* LastChild() const { + return _lastChild; + } + + XMLNode* LastChild() { + return _lastChild; + } + + /** Get the last child element or optionally the last child + element with the specified name. + */ + const XMLElement* LastChildElement( const char* name = 0 ) const; + + XMLElement* LastChildElement( const char* name = 0 ) { + return const_cast(const_cast(this)->LastChildElement(name) ); + } + + /// Get the previous (left) sibling node of this node. + const XMLNode* PreviousSibling() const { + return _prev; + } + + XMLNode* PreviousSibling() { + return _prev; + } + + /// Get the previous (left) sibling element of this node, with an optionally supplied name. + const XMLElement* PreviousSiblingElement( const char* name = 0 ) const ; + + XMLElement* PreviousSiblingElement( const char* name = 0 ) { + return const_cast(const_cast(this)->PreviousSiblingElement( name ) ); + } + + /// Get the next (right) sibling node of this node. + const XMLNode* NextSibling() const { + return _next; + } + + XMLNode* NextSibling() { + return _next; + } + + /// Get the next (right) sibling element of this node, with an optionally supplied name. + const XMLElement* NextSiblingElement( const char* name = 0 ) const; + + XMLElement* NextSiblingElement( const char* name = 0 ) { + return const_cast(const_cast(this)->NextSiblingElement( name ) ); + } + + /** + Add a child node as the last (right) child. + If the child node is already part of the document, + it is moved from its old location to the new location. + Returns the addThis argument or 0 if the node does not + belong to the same document. + */ + XMLNode* InsertEndChild( XMLNode* addThis ); + + XMLNode* LinkEndChild( XMLNode* addThis ) { + return InsertEndChild( addThis ); + } + /** + Add a child node as the first (left) child. + If the child node is already part of the document, + it is moved from its old location to the new location. + Returns the addThis argument or 0 if the node does not + belong to the same document. + */ + XMLNode* InsertFirstChild( XMLNode* addThis ); + /** + Add a node after the specified child node. + If the child node is already part of the document, + it is moved from its old location to the new location. + Returns the addThis argument or 0 if the afterThis node + is not a child of this node, or if the node does not + belong to the same document. + */ + XMLNode* InsertAfterChild( XMLNode* afterThis, XMLNode* addThis ); + + /** + Delete all the children of this node. + */ + void DeleteChildren(); + + /** + Delete a child of this node. + */ + void DeleteChild( XMLNode* node ); + + /** + Make a copy of this node, but not its children. + You may pass in a Document pointer that will be + the owner of the new Node. If the 'document' is + null, then the node returned will be allocated + from the current Document. (this->GetDocument()) + + Note: if called on a XMLDocument, this will return null. + */ + virtual XMLNode* ShallowClone( XMLDocument* document ) const = 0; + + /** + Make a copy of this node and all its children. + + If the 'target' is null, then the nodes will + be allocated in the current document. If 'target' + is specified, the memory will be allocated in the + specified XMLDocument. + + NOTE: This is probably not the correct tool to + copy a document, since XMLDocuments can have multiple + top level XMLNodes. You probably want to use + XMLDocument::DeepCopy() + */ + XMLNode* DeepClone( XMLDocument* target ) const; + + /** + Test if 2 nodes are the same, but don't test children. + The 2 nodes do not need to be in the same Document. + + Note: if called on a XMLDocument, this will return false. + */ + virtual bool ShallowEqual( const XMLNode* compare ) const = 0; + + /** Accept a hierarchical visit of the nodes in the TinyXML-2 DOM. Every node in the + XML tree will be conditionally visited and the host will be called back + via the XMLVisitor interface. + + This is essentially a SAX interface for TinyXML-2. (Note however it doesn't re-parse + the XML for the callbacks, so the performance of TinyXML-2 is unchanged by using this + interface versus any other.) + + The interface has been based on ideas from: + + - http://www.saxproject.org/ + - http://c2.com/cgi/wiki?HierarchicalVisitorPattern + + Which are both good references for "visiting". + + An example of using Accept(): + @verbatim + XMLPrinter printer; + tinyxmlDoc.Accept( &printer ); + const char* xmlcstr = printer.CStr(); + @endverbatim + */ + virtual bool Accept( XMLVisitor* visitor ) const = 0; + + /** + Set user data into the XMLNode. TinyXML-2 in + no way processes or interprets user data. + It is initially 0. + */ + void SetUserData(void* userData) { _userData = userData; } + + /** + Get user data set into the XMLNode. TinyXML-2 in + no way processes or interprets user data. + It is initially 0. + */ + void* GetUserData() const { return _userData; } + +protected: + explicit XMLNode( XMLDocument* ); + virtual ~XMLNode(); + + virtual char* ParseDeep( char* p, StrPair* parentEndTag, int* curLineNumPtr); + + XMLDocument* _document; + XMLNode* _parent; + mutable StrPair _value; + int _parseLineNum; + + XMLNode* _firstChild; + XMLNode* _lastChild; + + XMLNode* _prev; + XMLNode* _next; + + void* _userData; + +private: + MemPool* _memPool; + void Unlink( XMLNode* child ); + static void DeleteNode( XMLNode* node ); + void InsertChildPreamble( XMLNode* insertThis ) const; + const XMLElement* ToElementWithName( const char* name ) const; + + XMLNode( const XMLNode& ); // not supported + XMLNode& operator=( const XMLNode& ); // not supported +}; + + +/** XML text. + + Note that a text node can have child element nodes, for example: + @verbatim + This is bold + @endverbatim + + A text node can have 2 ways to output the next. "normal" output + and CDATA. It will default to the mode it was parsed from the XML file and + you generally want to leave it alone, but you can change the output mode with + SetCData() and query it with CData(). +*/ +class TINYXML2_LIB XMLText : public XMLNode +{ + friend class XMLDocument; +public: + virtual bool Accept( XMLVisitor* visitor ) const override; + + virtual XMLText* ToText() override { + return this; + } + virtual const XMLText* ToText() const override { + return this; + } + + /// Declare whether this should be CDATA or standard text. + void SetCData( bool isCData ) { + _isCData = isCData; + } + /// Returns true if this is a CDATA text element. + bool CData() const { + return _isCData; + } + + virtual XMLNode* ShallowClone( XMLDocument* document ) const override; + virtual bool ShallowEqual( const XMLNode* compare ) const override; + +protected: + explicit XMLText( XMLDocument* doc ) : XMLNode( doc ), _isCData( false ) {} + virtual ~XMLText() {} + + char* ParseDeep( char* p, StrPair* parentEndTag, int* curLineNumPtr ) override; + +private: + bool _isCData; + + XMLText( const XMLText& ); // not supported + XMLText& operator=( const XMLText& ); // not supported +}; + + +/** An XML Comment. */ +class TINYXML2_LIB XMLComment : public XMLNode +{ + friend class XMLDocument; +public: + virtual XMLComment* ToComment() override { + return this; + } + virtual const XMLComment* ToComment() const override { + return this; + } + + virtual bool Accept( XMLVisitor* visitor ) const override; + + virtual XMLNode* ShallowClone( XMLDocument* document ) const override; + virtual bool ShallowEqual( const XMLNode* compare ) const override; + +protected: + explicit XMLComment( XMLDocument* doc ); + virtual ~XMLComment(); + + char* ParseDeep( char* p, StrPair* parentEndTag, int* curLineNumPtr) override; + +private: + XMLComment( const XMLComment& ); // not supported + XMLComment& operator=( const XMLComment& ); // not supported +}; + + +/** In correct XML the declaration is the first entry in the file. + @verbatim + + @endverbatim + + TinyXML-2 will happily read or write files without a declaration, + however. + + The text of the declaration isn't interpreted. It is parsed + and written as a string. +*/ +class TINYXML2_LIB XMLDeclaration : public XMLNode +{ + friend class XMLDocument; +public: + virtual XMLDeclaration* ToDeclaration() override { + return this; + } + virtual const XMLDeclaration* ToDeclaration() const override { + return this; + } + + virtual bool Accept( XMLVisitor* visitor ) const override; + + virtual XMLNode* ShallowClone( XMLDocument* document ) const override; + virtual bool ShallowEqual( const XMLNode* compare ) const override; + +protected: + explicit XMLDeclaration( XMLDocument* doc ); + virtual ~XMLDeclaration(); + + char* ParseDeep( char* p, StrPair* parentEndTag, int* curLineNumPtr ) override; + +private: + XMLDeclaration( const XMLDeclaration& ); // not supported + XMLDeclaration& operator=( const XMLDeclaration& ); // not supported +}; + + +/** Any tag that TinyXML-2 doesn't recognize is saved as an + unknown. It is a tag of text, but should not be modified. + It will be written back to the XML, unchanged, when the file + is saved. + + DTD tags get thrown into XMLUnknowns. +*/ +class TINYXML2_LIB XMLUnknown : public XMLNode +{ + friend class XMLDocument; +public: + virtual XMLUnknown* ToUnknown() override { + return this; + } + virtual const XMLUnknown* ToUnknown() const override { + return this; + } + + virtual bool Accept( XMLVisitor* visitor ) const override; + + virtual XMLNode* ShallowClone( XMLDocument* document ) const override; + virtual bool ShallowEqual( const XMLNode* compare ) const override; + +protected: + explicit XMLUnknown( XMLDocument* doc ); + virtual ~XMLUnknown(); + + char* ParseDeep( char* p, StrPair* parentEndTag, int* curLineNumPtr ) override; + +private: + XMLUnknown( const XMLUnknown& ); // not supported + XMLUnknown& operator=( const XMLUnknown& ); // not supported +}; + + + +/** An attribute is a name-value pair. Elements have an arbitrary + number of attributes, each with a unique name. + + @note The attributes are not XMLNodes. You may only query the + Next() attribute in a list. +*/ +class TINYXML2_LIB XMLAttribute +{ + friend class XMLElement; +public: + /// The name of the attribute. + const char* Name() const; + + /// The value of the attribute. + const char* Value() const; + + /// Gets the line number the attribute is in, if the document was parsed from a file. + int GetLineNum() const { return _parseLineNum; } + + /// The next attribute in the list. + const XMLAttribute* Next() const { + return _next; + } + + /** IntValue interprets the attribute as an integer, and returns the value. + If the value isn't an integer, 0 will be returned. There is no error checking; + use QueryIntValue() if you need error checking. + */ + int IntValue() const { + int i = 0; + QueryIntValue(&i); + return i; + } + + int64_t Int64Value() const { + int64_t i = 0; + QueryInt64Value(&i); + return i; + } + + uint64_t Unsigned64Value() const { + uint64_t i = 0; + QueryUnsigned64Value(&i); + return i; + } + + /// Query as an unsigned integer. See IntValue() + unsigned UnsignedValue() const { + unsigned i=0; + QueryUnsignedValue( &i ); + return i; + } + /// Query as a boolean. See IntValue() + bool BoolValue() const { + bool b=false; + QueryBoolValue( &b ); + return b; + } + /// Query as a double. See IntValue() + double DoubleValue() const { + double d=0; + QueryDoubleValue( &d ); + return d; + } + /// Query as a float. See IntValue() + float FloatValue() const { + float f=0; + QueryFloatValue( &f ); + return f; + } + + /** QueryIntValue interprets the attribute as an integer, and returns the value + in the provided parameter. The function will return XML_SUCCESS on success, + and XML_WRONG_ATTRIBUTE_TYPE if the conversion is not successful. + */ + XMLError QueryIntValue( int* value ) const; + /// See QueryIntValue + XMLError QueryUnsignedValue( unsigned int* value ) const; + /// See QueryIntValue + XMLError QueryInt64Value(int64_t* value) const; + /// See QueryIntValue + XMLError QueryUnsigned64Value(uint64_t* value) const; + /// See QueryIntValue + XMLError QueryBoolValue( bool* value ) const; + /// See QueryIntValue + XMLError QueryDoubleValue( double* value ) const; + /// See QueryIntValue + XMLError QueryFloatValue( float* value ) const; + + /// Set the attribute to a string value. + void SetAttribute( const char* value ); + /// Set the attribute to value. + void SetAttribute( int value ); + /// Set the attribute to value. + void SetAttribute( unsigned value ); + /// Set the attribute to value. + void SetAttribute(int64_t value); + /// Set the attribute to value. + void SetAttribute(uint64_t value); + /// Set the attribute to value. + void SetAttribute( bool value ); + /// Set the attribute to value. + void SetAttribute( double value ); + /// Set the attribute to value. + void SetAttribute( float value ); + +private: + enum { BUF_SIZE = 200 }; + + XMLAttribute() : _name(), _value(),_parseLineNum( 0 ), _next( 0 ), _memPool( 0 ) {} + virtual ~XMLAttribute() {} + + XMLAttribute( const XMLAttribute& ); // not supported + void operator=( const XMLAttribute& ); // not supported + void SetName( const char* name ); + + char* ParseDeep( char* p, bool processEntities, int* curLineNumPtr ); + + mutable StrPair _name; + mutable StrPair _value; + int _parseLineNum; + XMLAttribute* _next; + MemPool* _memPool; +}; + + +/** The element is a container class. It has a value, the element name, + and can contain other elements, text, comments, and unknowns. + Elements also contain an arbitrary number of attributes. +*/ +class TINYXML2_LIB XMLElement : public XMLNode +{ + friend class XMLDocument; +public: + /// Get the name of an element (which is the Value() of the node.) + const char* Name() const { + return Value(); + } + /// Set the name of the element. + void SetName( const char* str, bool staticMem=false ) { + SetValue( str, staticMem ); + } + + virtual XMLElement* ToElement() override { + return this; + } + virtual const XMLElement* ToElement() const override { + return this; + } + virtual bool Accept( XMLVisitor* visitor ) const override; + + /** Given an attribute name, Attribute() returns the value + for the attribute of that name, or null if none + exists. For example: + + @verbatim + const char* value = ele->Attribute( "foo" ); + @endverbatim + + The 'value' parameter is normally null. However, if specified, + the attribute will only be returned if the 'name' and 'value' + match. This allow you to write code: + + @verbatim + if ( ele->Attribute( "foo", "bar" ) ) callFooIsBar(); + @endverbatim + + rather than: + @verbatim + if ( ele->Attribute( "foo" ) ) { + if ( strcmp( ele->Attribute( "foo" ), "bar" ) == 0 ) callFooIsBar(); + } + @endverbatim + */ + const char* Attribute( const char* name, const char* value=0 ) const; + + /** Given an attribute name, IntAttribute() returns the value + of the attribute interpreted as an integer. The default + value will be returned if the attribute isn't present, + or if there is an error. (For a method with error + checking, see QueryIntAttribute()). + */ + int IntAttribute(const char* name, int defaultValue = 0) const; + /// See IntAttribute() + unsigned UnsignedAttribute(const char* name, unsigned defaultValue = 0) const; + /// See IntAttribute() + int64_t Int64Attribute(const char* name, int64_t defaultValue = 0) const; + /// See IntAttribute() + uint64_t Unsigned64Attribute(const char* name, uint64_t defaultValue = 0) const; + /// See IntAttribute() + bool BoolAttribute(const char* name, bool defaultValue = false) const; + /// See IntAttribute() + double DoubleAttribute(const char* name, double defaultValue = 0) const; + /// See IntAttribute() + float FloatAttribute(const char* name, float defaultValue = 0) const; + + /** Given an attribute name, QueryIntAttribute() returns + XML_SUCCESS, XML_WRONG_ATTRIBUTE_TYPE if the conversion + can't be performed, or XML_NO_ATTRIBUTE if the attribute + doesn't exist. If successful, the result of the conversion + will be written to 'value'. If not successful, nothing will + be written to 'value'. This allows you to provide default + value: + + @verbatim + int value = 10; + QueryIntAttribute( "foo", &value ); // if "foo" isn't found, value will still be 10 + @endverbatim + */ + XMLError QueryIntAttribute( const char* name, int* value ) const { + const XMLAttribute* a = FindAttribute( name ); + if ( !a ) { + return XML_NO_ATTRIBUTE; + } + return a->QueryIntValue( value ); + } + + /// See QueryIntAttribute() + XMLError QueryUnsignedAttribute( const char* name, unsigned int* value ) const { + const XMLAttribute* a = FindAttribute( name ); + if ( !a ) { + return XML_NO_ATTRIBUTE; + } + return a->QueryUnsignedValue( value ); + } + + /// See QueryIntAttribute() + XMLError QueryInt64Attribute(const char* name, int64_t* value) const { + const XMLAttribute* a = FindAttribute(name); + if (!a) { + return XML_NO_ATTRIBUTE; + } + return a->QueryInt64Value(value); + } + + /// See QueryIntAttribute() + XMLError QueryUnsigned64Attribute(const char* name, uint64_t* value) const { + const XMLAttribute* a = FindAttribute(name); + if(!a) { + return XML_NO_ATTRIBUTE; + } + return a->QueryUnsigned64Value(value); + } + + /// See QueryIntAttribute() + XMLError QueryBoolAttribute( const char* name, bool* value ) const { + const XMLAttribute* a = FindAttribute( name ); + if ( !a ) { + return XML_NO_ATTRIBUTE; + } + return a->QueryBoolValue( value ); + } + /// See QueryIntAttribute() + XMLError QueryDoubleAttribute( const char* name, double* value ) const { + const XMLAttribute* a = FindAttribute( name ); + if ( !a ) { + return XML_NO_ATTRIBUTE; + } + return a->QueryDoubleValue( value ); + } + /// See QueryIntAttribute() + XMLError QueryFloatAttribute( const char* name, float* value ) const { + const XMLAttribute* a = FindAttribute( name ); + if ( !a ) { + return XML_NO_ATTRIBUTE; + } + return a->QueryFloatValue( value ); + } + + /// See QueryIntAttribute() + XMLError QueryStringAttribute(const char* name, const char** value) const { + const XMLAttribute* a = FindAttribute(name); + if (!a) { + return XML_NO_ATTRIBUTE; + } + *value = a->Value(); + return XML_SUCCESS; + } + + + + /** Given an attribute name, QueryAttribute() returns + XML_SUCCESS, XML_WRONG_ATTRIBUTE_TYPE if the conversion + can't be performed, or XML_NO_ATTRIBUTE if the attribute + doesn't exist. It is overloaded for the primitive types, + and is a generally more convenient replacement of + QueryIntAttribute() and related functions. + + If successful, the result of the conversion + will be written to 'value'. If not successful, nothing will + be written to 'value'. This allows you to provide default + value: + + @verbatim + int value = 10; + QueryAttribute( "foo", &value ); // if "foo" isn't found, value will still be 10 + @endverbatim + */ + XMLError QueryAttribute( const char* name, int* value ) const { + return QueryIntAttribute( name, value ); + } + + XMLError QueryAttribute( const char* name, unsigned int* value ) const { + return QueryUnsignedAttribute( name, value ); + } + + XMLError QueryAttribute(const char* name, int64_t* value) const { + return QueryInt64Attribute(name, value); + } + + XMLError QueryAttribute(const char* name, uint64_t* value) const { + return QueryUnsigned64Attribute(name, value); + } + + XMLError QueryAttribute( const char* name, bool* value ) const { + return QueryBoolAttribute( name, value ); + } + + XMLError QueryAttribute( const char* name, double* value ) const { + return QueryDoubleAttribute( name, value ); + } + + XMLError QueryAttribute( const char* name, float* value ) const { + return QueryFloatAttribute( name, value ); + } + + XMLError QueryAttribute(const char* name, const char** value) const { + return QueryStringAttribute(name, value); + } + + /// Sets the named attribute to value. + void SetAttribute( const char* name, const char* value ) { + XMLAttribute* a = FindOrCreateAttribute( name ); + a->SetAttribute( value ); + } + /// Sets the named attribute to value. + void SetAttribute( const char* name, int value ) { + XMLAttribute* a = FindOrCreateAttribute( name ); + a->SetAttribute( value ); + } + /// Sets the named attribute to value. + void SetAttribute( const char* name, unsigned value ) { + XMLAttribute* a = FindOrCreateAttribute( name ); + a->SetAttribute( value ); + } + + /// Sets the named attribute to value. + void SetAttribute(const char* name, int64_t value) { + XMLAttribute* a = FindOrCreateAttribute(name); + a->SetAttribute(value); + } + + /// Sets the named attribute to value. + void SetAttribute(const char* name, uint64_t value) { + XMLAttribute* a = FindOrCreateAttribute(name); + a->SetAttribute(value); + } + + /// Sets the named attribute to value. + void SetAttribute( const char* name, bool value ) { + XMLAttribute* a = FindOrCreateAttribute( name ); + a->SetAttribute( value ); + } + /// Sets the named attribute to value. + void SetAttribute( const char* name, double value ) { + XMLAttribute* a = FindOrCreateAttribute( name ); + a->SetAttribute( value ); + } + /// Sets the named attribute to value. + void SetAttribute( const char* name, float value ) { + XMLAttribute* a = FindOrCreateAttribute( name ); + a->SetAttribute( value ); + } + + /** + Delete an attribute. + */ + void DeleteAttribute( const char* name ); + + /// Return the first attribute in the list. + const XMLAttribute* FirstAttribute() const { + return _rootAttribute; + } + /// Query a specific attribute in the list. + const XMLAttribute* FindAttribute( const char* name ) const; + + /** Convenience function for easy access to the text inside an element. Although easy + and concise, GetText() is limited compared to getting the XMLText child + and accessing it directly. + + If the first child of 'this' is a XMLText, the GetText() + returns the character string of the Text node, else null is returned. + + This is a convenient method for getting the text of simple contained text: + @verbatim + This is text + const char* str = fooElement->GetText(); + @endverbatim + + 'str' will be a pointer to "This is text". + + Note that this function can be misleading. If the element foo was created from + this XML: + @verbatim + This is text + @endverbatim + + then the value of str would be null. The first child node isn't a text node, it is + another element. From this XML: + @verbatim + This is text + @endverbatim + GetText() will return "This is ". + */ + const char* GetText() const; + + /** Convenience function for easy access to the text inside an element. Although easy + and concise, SetText() is limited compared to creating an XMLText child + and mutating it directly. + + If the first child of 'this' is a XMLText, SetText() sets its value to + the given string, otherwise it will create a first child that is an XMLText. + + This is a convenient method for setting the text of simple contained text: + @verbatim + This is text + fooElement->SetText( "Hullaballoo!" ); + Hullaballoo! + @endverbatim + + Note that this function can be misleading. If the element foo was created from + this XML: + @verbatim + This is text + @endverbatim + + then it will not change "This is text", but rather prefix it with a text element: + @verbatim + Hullaballoo!This is text + @endverbatim + + For this XML: + @verbatim + + @endverbatim + SetText() will generate + @verbatim + Hullaballoo! + @endverbatim + */ + void SetText( const char* inText ); + /// Convenience method for setting text inside an element. See SetText() for important limitations. + void SetText( int value ); + /// Convenience method for setting text inside an element. See SetText() for important limitations. + void SetText( unsigned value ); + /// Convenience method for setting text inside an element. See SetText() for important limitations. + void SetText(int64_t value); + /// Convenience method for setting text inside an element. See SetText() for important limitations. + void SetText(uint64_t value); + /// Convenience method for setting text inside an element. See SetText() for important limitations. + void SetText( bool value ); + /// Convenience method for setting text inside an element. See SetText() for important limitations. + void SetText( double value ); + /// Convenience method for setting text inside an element. See SetText() for important limitations. + void SetText( float value ); + + /** + Convenience method to query the value of a child text node. This is probably best + shown by example. Given you have a document is this form: + @verbatim + + 1 + 1.4 + + @endverbatim + + The QueryIntText() and similar functions provide a safe and easier way to get to the + "value" of x and y. + + @verbatim + int x = 0; + float y = 0; // types of x and y are contrived for example + const XMLElement* xElement = pointElement->FirstChildElement( "x" ); + const XMLElement* yElement = pointElement->FirstChildElement( "y" ); + xElement->QueryIntText( &x ); + yElement->QueryFloatText( &y ); + @endverbatim + + @returns XML_SUCCESS (0) on success, XML_CAN_NOT_CONVERT_TEXT if the text cannot be converted + to the requested type, and XML_NO_TEXT_NODE if there is no child text to query. + + */ + XMLError QueryIntText( int* ival ) const; + /// See QueryIntText() + XMLError QueryUnsignedText( unsigned* uval ) const; + /// See QueryIntText() + XMLError QueryInt64Text(int64_t* uval) const; + /// See QueryIntText() + XMLError QueryUnsigned64Text(uint64_t* uval) const; + /// See QueryIntText() + XMLError QueryBoolText( bool* bval ) const; + /// See QueryIntText() + XMLError QueryDoubleText( double* dval ) const; + /// See QueryIntText() + XMLError QueryFloatText( float* fval ) const; + + int IntText(int defaultValue = 0) const; + + /// See QueryIntText() + unsigned UnsignedText(unsigned defaultValue = 0) const; + /// See QueryIntText() + int64_t Int64Text(int64_t defaultValue = 0) const; + /// See QueryIntText() + uint64_t Unsigned64Text(uint64_t defaultValue = 0) const; + /// See QueryIntText() + bool BoolText(bool defaultValue = false) const; + /// See QueryIntText() + double DoubleText(double defaultValue = 0) const; + /// See QueryIntText() + float FloatText(float defaultValue = 0) const; + + /** + Convenience method to create a new XMLElement and add it as last (right) + child of this node. Returns the created and inserted element. + */ + XMLElement* InsertNewChildElement(const char* name); + /// See InsertNewChildElement() + XMLComment* InsertNewComment(const char* comment); + /// See InsertNewChildElement() + XMLText* InsertNewText(const char* text); + /// See InsertNewChildElement() + XMLDeclaration* InsertNewDeclaration(const char* text); + /// See InsertNewChildElement() + XMLUnknown* InsertNewUnknown(const char* text); + + + // internal: + enum ElementClosingType { + OPEN, // + CLOSED, // + CLOSING // + }; + ElementClosingType ClosingType() const { + return _closingType; + } + virtual XMLNode* ShallowClone( XMLDocument* document ) const override; + virtual bool ShallowEqual( const XMLNode* compare ) const override; + +protected: + char* ParseDeep( char* p, StrPair* parentEndTag, int* curLineNumPtr ) override; + +private: + XMLElement( XMLDocument* doc ); + virtual ~XMLElement(); + XMLElement( const XMLElement& ); // not supported + void operator=( const XMLElement& ); // not supported + + XMLAttribute* FindOrCreateAttribute( const char* name ); + char* ParseAttributes( char* p, int* curLineNumPtr ); + static void DeleteAttribute( XMLAttribute* attribute ); + XMLAttribute* CreateAttribute(); + + enum { BUF_SIZE = 200 }; + ElementClosingType _closingType; + // The attribute list is ordered; there is no 'lastAttribute' + // because the list needs to be scanned for dupes before adding + // a new attribute. + XMLAttribute* _rootAttribute; +}; + + +enum Whitespace { + PRESERVE_WHITESPACE, + COLLAPSE_WHITESPACE, + PEDANTIC_WHITESPACE +}; + + +/** A Document binds together all the functionality. + It can be saved, loaded, and printed to the screen. + All Nodes are connected and allocated to a Document. + If the Document is deleted, all its Nodes are also deleted. +*/ +class TINYXML2_LIB XMLDocument : public XMLNode +{ + friend class XMLElement; + // Gives access to SetError and Push/PopDepth, but over-access for everything else. + // Wishing C++ had "internal" scope. + friend class XMLNode; + friend class XMLText; + friend class XMLComment; + friend class XMLDeclaration; + friend class XMLUnknown; +public: + /// constructor + XMLDocument( bool processEntities = true, Whitespace whitespaceMode = PRESERVE_WHITESPACE ); + ~XMLDocument(); + + virtual XMLDocument* ToDocument() override { + TIXMLASSERT( this == _document ); + return this; + } + virtual const XMLDocument* ToDocument() const override { + TIXMLASSERT( this == _document ); + return this; + } + + /** + Parse an XML file from a character string. + Returns XML_SUCCESS (0) on success, or + an errorID. + + You may optionally pass in the 'nBytes', which is + the number of bytes which will be parsed. If not + specified, TinyXML-2 will assume 'xml' points to a + null terminated string. + */ + XMLError Parse( const char* xml, size_t nBytes=static_cast(-1) ); + + /** + Load an XML file from disk. + Returns XML_SUCCESS (0) on success, or + an errorID. + */ + XMLError LoadFile( const char* filename ); + + /** + Load an XML file from disk. You are responsible + for providing and closing the FILE*. + + NOTE: The file should be opened as binary ("rb") + not text in order for TinyXML-2 to correctly + do newline normalization. + + Returns XML_SUCCESS (0) on success, or + an errorID. + */ + XMLError LoadFile( FILE* ); + + /** + Save the XML file to disk. + Returns XML_SUCCESS (0) on success, or + an errorID. + */ + XMLError SaveFile( const char* filename, bool compact = false ); + + /** + Save the XML file to disk. You are responsible + for providing and closing the FILE*. + + Returns XML_SUCCESS (0) on success, or + an errorID. + */ + XMLError SaveFile( FILE* fp, bool compact = false ); + + bool ProcessEntities() const { + return _processEntities; + } + Whitespace WhitespaceMode() const { + return _whitespaceMode; + } + + /** + Returns true if this document has a leading Byte Order Mark of UTF8. + */ + bool HasBOM() const { + return _writeBOM; + } + /** Sets whether to write the BOM when writing the file. + */ + void SetBOM( bool useBOM ) { + _writeBOM = useBOM; + } + + /** Return the root element of DOM. Equivalent to FirstChildElement(). + To get the first node, use FirstChild(). + */ + XMLElement* RootElement() { + return FirstChildElement(); + } + const XMLElement* RootElement() const { + return FirstChildElement(); + } + + /** Print the Document. If the Printer is not provided, it will + print to stdout. If you provide Printer, this can print to a file: + @verbatim + XMLPrinter printer( fp ); + doc.Print( &printer ); + @endverbatim + + Or you can use a printer to print to memory: + @verbatim + XMLPrinter printer; + doc.Print( &printer ); + // printer.CStr() has a const char* to the XML + @endverbatim + */ + void Print( XMLPrinter* streamer=0 ) const; + virtual bool Accept( XMLVisitor* visitor ) const override; + + /** + Create a new Element associated with + this Document. The memory for the Element + is managed by the Document. + */ + XMLElement* NewElement( const char* name ); + /** + Create a new Comment associated with + this Document. The memory for the Comment + is managed by the Document. + */ + XMLComment* NewComment( const char* comment ); + /** + Create a new Text associated with + this Document. The memory for the Text + is managed by the Document. + */ + XMLText* NewText( const char* text ); + /** + Create a new Declaration associated with + this Document. The memory for the object + is managed by the Document. + + If the 'text' param is null, the standard + declaration is used.: + @verbatim + + @endverbatim + */ + XMLDeclaration* NewDeclaration( const char* text=0 ); + /** + Create a new Unknown associated with + this Document. The memory for the object + is managed by the Document. + */ + XMLUnknown* NewUnknown( const char* text ); + + /** + Delete a node associated with this document. + It will be unlinked from the DOM. + */ + void DeleteNode( XMLNode* node ); + + /// Clears the error flags. + void ClearError(); + + /// Return true if there was an error parsing the document. + bool Error() const { + return _errorID != XML_SUCCESS; + } + /// Return the errorID. + XMLError ErrorID() const { + return _errorID; + } + const char* ErrorName() const; + static const char* ErrorIDToName(XMLError errorID); + + /** Returns a "long form" error description. A hopefully helpful + diagnostic with location, line number, and/or additional info. + */ + const char* ErrorStr() const; + + /// A (trivial) utility function that prints the ErrorStr() to stdout. + void PrintError() const; + + /// Return the line where the error occurred, or zero if unknown. + int ErrorLineNum() const + { + return _errorLineNum; + } + + /// Clear the document, resetting it to the initial state. + void Clear(); + + /** + Copies this document to a target document. + The target will be completely cleared before the copy. + If you want to copy a sub-tree, see XMLNode::DeepClone(). + + NOTE: that the 'target' must be non-null. + */ + void DeepCopy(XMLDocument* target) const; + + // internal + char* Identify( char* p, XMLNode** node, bool first ); + + // internal + void MarkInUse(const XMLNode* const); + + virtual XMLNode* ShallowClone( XMLDocument* /*document*/ ) const override{ + return 0; + } + virtual bool ShallowEqual( const XMLNode* /*compare*/ ) const override{ + return false; + } + +private: + XMLDocument( const XMLDocument& ); // not supported + void operator=( const XMLDocument& ); // not supported + + bool _writeBOM; + bool _processEntities; + XMLError _errorID; + Whitespace _whitespaceMode; + mutable StrPair _errorStr; + int _errorLineNum; + char* _charBuffer; + int _parseCurLineNum; + int _parsingDepth; + // Memory tracking does add some overhead. + // However, the code assumes that you don't + // have a bunch of unlinked nodes around. + // Therefore it takes less memory to track + // in the document vs. a linked list in the XMLNode, + // and the performance is the same. + DynArray _unlinked; + + MemPoolT< sizeof(XMLElement) > _elementPool; + MemPoolT< sizeof(XMLAttribute) > _attributePool; + MemPoolT< sizeof(XMLText) > _textPool; + MemPoolT< sizeof(XMLComment) > _commentPool; + + static const char* _errorNames[XML_ERROR_COUNT]; + + void Parse(); + + void SetError( XMLError error, int lineNum, const char* format, ... ); + + // Something of an obvious security hole, once it was discovered. + // Either an ill-formed XML or an excessively deep one can overflow + // the stack. Track stack depth, and error out if needed. + class DepthTracker { + public: + explicit DepthTracker(XMLDocument * document) { + this->_document = document; + document->PushDepth(); + } + ~DepthTracker() { + _document->PopDepth(); + } + private: + XMLDocument * _document; + }; + void PushDepth(); + void PopDepth(); + + template + NodeType* CreateUnlinkedNode( MemPoolT& pool ); +}; + +template +inline NodeType* XMLDocument::CreateUnlinkedNode( MemPoolT& pool ) +{ + TIXMLASSERT( sizeof( NodeType ) == PoolElementSize ); + TIXMLASSERT( sizeof( NodeType ) == pool.ItemSize() ); + NodeType* returnNode = new (pool.Alloc()) NodeType( this ); + TIXMLASSERT( returnNode ); + returnNode->_memPool = &pool; + + _unlinked.Push(returnNode); + return returnNode; +} + +/** + A XMLHandle is a class that wraps a node pointer with null checks; this is + an incredibly useful thing. Note that XMLHandle is not part of the TinyXML-2 + DOM structure. It is a separate utility class. + + Take an example: + @verbatim + + + + + + + @endverbatim + + Assuming you want the value of "attributeB" in the 2nd "Child" element, it's very + easy to write a *lot* of code that looks like: + + @verbatim + XMLElement* root = document.FirstChildElement( "Document" ); + if ( root ) + { + XMLElement* element = root->FirstChildElement( "Element" ); + if ( element ) + { + XMLElement* child = element->FirstChildElement( "Child" ); + if ( child ) + { + XMLElement* child2 = child->NextSiblingElement( "Child" ); + if ( child2 ) + { + // Finally do something useful. + @endverbatim + + And that doesn't even cover "else" cases. XMLHandle addresses the verbosity + of such code. A XMLHandle checks for null pointers so it is perfectly safe + and correct to use: + + @verbatim + XMLHandle docHandle( &document ); + XMLElement* child2 = docHandle.FirstChildElement( "Document" ).FirstChildElement( "Element" ).FirstChildElement().NextSiblingElement(); + if ( child2 ) + { + // do something useful + @endverbatim + + Which is MUCH more concise and useful. + + It is also safe to copy handles - internally they are nothing more than node pointers. + @verbatim + XMLHandle handleCopy = handle; + @endverbatim + + See also XMLConstHandle, which is the same as XMLHandle, but operates on const objects. +*/ +class TINYXML2_LIB XMLHandle +{ +public: + /// Create a handle from any node (at any depth of the tree.) This can be a null pointer. + explicit XMLHandle( XMLNode* node ) : _node( node ) { + } + /// Create a handle from a node. + explicit XMLHandle( XMLNode& node ) : _node( &node ) { + } + /// Copy constructor + XMLHandle( const XMLHandle& ref ) : _node( ref._node ) { + } + /// Assignment + XMLHandle& operator=( const XMLHandle& ref ) { + _node = ref._node; + return *this; + } + + /// Get the first child of this handle. + XMLHandle FirstChild() { + return XMLHandle( _node ? _node->FirstChild() : 0 ); + } + /// Get the first child element of this handle. + XMLHandle FirstChildElement( const char* name = 0 ) { + return XMLHandle( _node ? _node->FirstChildElement( name ) : 0 ); + } + /// Get the last child of this handle. + XMLHandle LastChild() { + return XMLHandle( _node ? _node->LastChild() : 0 ); + } + /// Get the last child element of this handle. + XMLHandle LastChildElement( const char* name = 0 ) { + return XMLHandle( _node ? _node->LastChildElement( name ) : 0 ); + } + /// Get the previous sibling of this handle. + XMLHandle PreviousSibling() { + return XMLHandle( _node ? _node->PreviousSibling() : 0 ); + } + /// Get the previous sibling element of this handle. + XMLHandle PreviousSiblingElement( const char* name = 0 ) { + return XMLHandle( _node ? _node->PreviousSiblingElement( name ) : 0 ); + } + /// Get the next sibling of this handle. + XMLHandle NextSibling() { + return XMLHandle( _node ? _node->NextSibling() : 0 ); + } + /// Get the next sibling element of this handle. + XMLHandle NextSiblingElement( const char* name = 0 ) { + return XMLHandle( _node ? _node->NextSiblingElement( name ) : 0 ); + } + + /// Safe cast to XMLNode. This can return null. + XMLNode* ToNode() { + return _node; + } + /// Safe cast to XMLElement. This can return null. + XMLElement* ToElement() { + return ( _node ? _node->ToElement() : 0 ); + } + /// Safe cast to XMLText. This can return null. + XMLText* ToText() { + return ( _node ? _node->ToText() : 0 ); + } + /// Safe cast to XMLUnknown. This can return null. + XMLUnknown* ToUnknown() { + return ( _node ? _node->ToUnknown() : 0 ); + } + /// Safe cast to XMLDeclaration. This can return null. + XMLDeclaration* ToDeclaration() { + return ( _node ? _node->ToDeclaration() : 0 ); + } + +private: + XMLNode* _node; +}; + + +/** + A variant of the XMLHandle class for working with const XMLNodes and Documents. It is the + same in all regards, except for the 'const' qualifiers. See XMLHandle for API. +*/ +class TINYXML2_LIB XMLConstHandle +{ +public: + explicit XMLConstHandle( const XMLNode* node ) : _node( node ) { + } + explicit XMLConstHandle( const XMLNode& node ) : _node( &node ) { + } + XMLConstHandle( const XMLConstHandle& ref ) : _node( ref._node ) { + } + + XMLConstHandle& operator=( const XMLConstHandle& ref ) { + _node = ref._node; + return *this; + } + + const XMLConstHandle FirstChild() const { + return XMLConstHandle( _node ? _node->FirstChild() : 0 ); + } + const XMLConstHandle FirstChildElement( const char* name = 0 ) const { + return XMLConstHandle( _node ? _node->FirstChildElement( name ) : 0 ); + } + const XMLConstHandle LastChild() const { + return XMLConstHandle( _node ? _node->LastChild() : 0 ); + } + const XMLConstHandle LastChildElement( const char* name = 0 ) const { + return XMLConstHandle( _node ? _node->LastChildElement( name ) : 0 ); + } + const XMLConstHandle PreviousSibling() const { + return XMLConstHandle( _node ? _node->PreviousSibling() : 0 ); + } + const XMLConstHandle PreviousSiblingElement( const char* name = 0 ) const { + return XMLConstHandle( _node ? _node->PreviousSiblingElement( name ) : 0 ); + } + const XMLConstHandle NextSibling() const { + return XMLConstHandle( _node ? _node->NextSibling() : 0 ); + } + const XMLConstHandle NextSiblingElement( const char* name = 0 ) const { + return XMLConstHandle( _node ? _node->NextSiblingElement( name ) : 0 ); + } + + + const XMLNode* ToNode() const { + return _node; + } + const XMLElement* ToElement() const { + return ( _node ? _node->ToElement() : 0 ); + } + const XMLText* ToText() const { + return ( _node ? _node->ToText() : 0 ); + } + const XMLUnknown* ToUnknown() const { + return ( _node ? _node->ToUnknown() : 0 ); + } + const XMLDeclaration* ToDeclaration() const { + return ( _node ? _node->ToDeclaration() : 0 ); + } + +private: + const XMLNode* _node; +}; + + +/** + Printing functionality. The XMLPrinter gives you more + options than the XMLDocument::Print() method. + + It can: + -# Print to memory. + -# Print to a file you provide. + -# Print XML without a XMLDocument. + + Print to Memory + + @verbatim + XMLPrinter printer; + doc.Print( &printer ); + SomeFunction( printer.CStr() ); + @endverbatim + + Print to a File + + You provide the file pointer. + @verbatim + XMLPrinter printer( fp ); + doc.Print( &printer ); + @endverbatim + + Print without a XMLDocument + + When loading, an XML parser is very useful. However, sometimes + when saving, it just gets in the way. The code is often set up + for streaming, and constructing the DOM is just overhead. + + The Printer supports the streaming case. The following code + prints out a trivially simple XML file without ever creating + an XML document. + + @verbatim + XMLPrinter printer( fp ); + printer.OpenElement( "foo" ); + printer.PushAttribute( "foo", "bar" ); + printer.CloseElement(); + @endverbatim +*/ +class TINYXML2_LIB XMLPrinter : public XMLVisitor +{ +public: + /** Construct the printer. If the FILE* is specified, + this will print to the FILE. Else it will print + to memory, and the result is available in CStr(). + If 'compact' is set to true, then output is created + with only required whitespace and newlines. + */ + XMLPrinter( FILE* file=0, bool compact = false, int depth = 0 ); + virtual ~XMLPrinter() {} + + /** If streaming, write the BOM and declaration. */ + void PushHeader( bool writeBOM, bool writeDeclaration ); + /** If streaming, start writing an element. + The element must be closed with CloseElement() + */ + void OpenElement( const char* name, bool compactMode=false ); + /// If streaming, add an attribute to an open element. + void PushAttribute( const char* name, const char* value ); + void PushAttribute( const char* name, int value ); + void PushAttribute( const char* name, unsigned value ); + void PushAttribute( const char* name, int64_t value ); + void PushAttribute( const char* name, uint64_t value ); + void PushAttribute( const char* name, bool value ); + void PushAttribute( const char* name, double value ); + /// If streaming, close the Element. + virtual void CloseElement( bool compactMode=false ); + + /// Add a text node. + void PushText( const char* text, bool cdata=false ); + /// Add a text node from an integer. + void PushText( int value ); + /// Add a text node from an unsigned. + void PushText( unsigned value ); + /// Add a text node from a signed 64bit integer. + void PushText( int64_t value ); + /// Add a text node from an unsigned 64bit integer. + void PushText( uint64_t value ); + /// Add a text node from a bool. + void PushText( bool value ); + /// Add a text node from a float. + void PushText( float value ); + /// Add a text node from a double. + void PushText( double value ); + + /// Add a comment + void PushComment( const char* comment ); + + void PushDeclaration( const char* value ); + void PushUnknown( const char* value ); + + virtual bool VisitEnter( const XMLDocument& /*doc*/ ) override; + virtual bool VisitExit( const XMLDocument& /*doc*/ ) override { + return true; + } + + virtual bool VisitEnter( const XMLElement& element, const XMLAttribute* attribute ) override; + virtual bool VisitExit( const XMLElement& element ) override; + + virtual bool Visit( const XMLText& text ) override; + virtual bool Visit( const XMLComment& comment ) override; + virtual bool Visit( const XMLDeclaration& declaration ) override; + virtual bool Visit( const XMLUnknown& unknown ) override; + + /** + If in print to memory mode, return a pointer to + the XML file in memory. + */ + const char* CStr() const { + return _buffer.Mem(); + } + /** + If in print to memory mode, return the size + of the XML file in memory. (Note the size returned + includes the terminating null.) + */ + size_t CStrSize() const { + return _buffer.Size(); + } + /** + If in print to memory mode, reset the buffer to the + beginning. + */ + void ClearBuffer( bool resetToFirstElement = true ) { + _buffer.Clear(); + _buffer.Push(0); + _firstElement = resetToFirstElement; + } + +protected: + virtual bool CompactMode( const XMLElement& ) { return _compactMode; } + + /** Prints out the space before an element. You may override to change + the space and tabs used. A PrintSpace() override should call Print(). + */ + virtual void PrintSpace( int depth ); + virtual void Print( const char* format, ... ); + virtual void Write( const char* data, size_t size ); + virtual void Putc( char ch ); + + inline void Write(const char* data) { Write(data, strlen(data)); } + + void SealElementIfJustOpened(); + bool _elementJustOpened; + DynArray< const char*, 10 > _stack; + +private: + /** + Prepares to write a new node. This includes sealing an element that was + just opened, and writing any whitespace necessary if not in compact mode. + */ + void PrepareForNewNode( bool compactMode ); + void PrintString( const char*, bool restrictedEntitySet ); // prints out, after detecting entities. + + bool _firstElement; + FILE* _fp; + int _depth; + int _textDepth; + bool _processEntities; + bool _compactMode; + + enum { + ENTITY_RANGE = 64, + BUF_SIZE = 200 + }; + bool _entityFlag[ENTITY_RANGE]; + bool _restrictedEntityFlag[ENTITY_RANGE]; + + DynArray< char, 20 > _buffer; + + // Prohibit cloning, intentionally not implemented + XMLPrinter( const XMLPrinter& ); + XMLPrinter& operator=( const XMLPrinter& ); +}; + + +} // namespace tinyxml2 + +#if defined(_MSC_VER) +# pragma warning(pop) +#endif + +#endif // TINYXML2_INCLUDED From 865aa1d4f0884827b96c63384eff323c956688c7 Mon Sep 17 00:00:00 2001 From: El Date: Mon, 31 Mar 2025 04:38:17 +0500 Subject: [PATCH 044/150] KASM-6984 Refactor SelfBench --- common/rfb/SelfBench.cxx | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/common/rfb/SelfBench.cxx b/common/rfb/SelfBench.cxx index 550d6dd..ca8e3fb 100644 --- a/common/rfb/SelfBench.cxx +++ b/common/rfb/SelfBench.cxx @@ -41,12 +41,6 @@ static constexpr uint32_t RUNS = 64; static constexpr uint32_t WIDTH = 1600; static constexpr uint32_t HEIGHT = 1200; -template -constexpr bool has_no_args = std::is_invocable_v; - -template -constexpr bool has_one_arg = std::is_invocable_v; - void SelfBench() { tinyxml2::XMLDocument doc; @@ -98,11 +92,11 @@ void SelfBench() { } auto value = elapsedMs(now); - vlog.info("%s took %lu ms (%u runs)", name, value, RUNS); + vlog.info("%s took %lu ms (%u runs)", name, value, runs); auto *test_case = doc.NewElement("testcase"); test_case->SetAttribute("name", name); test_case->SetAttribute("time", value); - test_case->SetAttribute("runs", RUNS); + test_case->SetAttribute("runs", runs); test_suit->InsertEndChild(test_case); }; @@ -186,8 +180,7 @@ void SelfBench() { comparer->compare(false, cursorReg); }); - vlog.info("Before"); doc.SaveFile("SelfBench.xml"); - vlog.info("after"); + exit(0); } From 44ee8ee58a086cac3e247b1dd7beaa18f1ef6f8a Mon Sep 17 00:00:00 2001 From: El Date: Mon, 31 Mar 2025 04:38:55 +0500 Subject: [PATCH 045/150] KASM-6984 Refactor TinyXML2 integration and update build settings --- CMakeLists.txt | 2 +- common/rfb/CMakeLists.txt | 230 ++++++++++++++-------------- third_party/CMakeLists.txt | 1 + third_party/tinyxml2/CMakeLists.txt | 5 + 4 files changed, 125 insertions(+), 113 deletions(-) create mode 100644 third_party/CMakeLists.txt create mode 100644 third_party/tinyxml2/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 537063e..7a509b4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -74,7 +74,6 @@ set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} -UNDEBUG") # Make sure we get a sane C version set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99") -set(CMAKE_CXX_STANDARD 20) # Enable OpenMP set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fopenmp") @@ -227,6 +226,7 @@ include_directories(${CMAKE_BINARY_DIR}) include(cmake/StaticBuild.cmake) +add_subdirectory(third_party) add_subdirectory(common) if(WIN32) diff --git a/common/rfb/CMakeLists.txt b/common/rfb/CMakeLists.txt index 70217fe..56f4488 100644 --- a/common/rfb/CMakeLists.txt +++ b/common/rfb/CMakeLists.txt @@ -1,84 +1,82 @@ -include_directories(${CMAKE_SOURCE_DIR}/common ${JPEG_INCLUDE_DIR} ${PNG_INCLUDE_DIR} - ${CMAKE_SOURCE_DIR}/unix/kasmvncpasswd) - set(RFB_SOURCES - Blacklist.cxx - Congestion.cxx - CConnection.cxx - CMsgHandler.cxx - CMsgReader.cxx - CMsgWriter.cxx - CSecurityPlain.cxx - CSecurityStack.cxx - CSecurityVeNCrypt.cxx - CSecurityVncAuth.cxx - ComparingUpdateTracker.cxx - Configuration.cxx - ConnParams.cxx - CopyRectDecoder.cxx - Cursor.cxx - DecodeManager.cxx - Decoder.cxx - d3des.c - EncCache.cxx - EncodeManager.cxx - Encoder.cxx - HextileDecoder.cxx - HextileEncoder.cxx - JpegCompressor.cxx - JpegDecompressor.cxx - KeyRemapper.cxx - LogWriter.cxx - Logger.cxx - Logger_file.cxx - Logger_stdio.cxx - Password.cxx - PixelBuffer.cxx - PixelFormat.cxx - RREEncoder.cxx - RREDecoder.cxx - RawDecoder.cxx - RawEncoder.cxx - Region.cxx - SConnection.cxx - SMsgHandler.cxx - SMsgReader.cxx - SMsgWriter.cxx - ServerCore.cxx - Security.cxx - SecurityServer.cxx - SecurityClient.cxx - SelfBench.cxx - SSecurityPlain.cxx - SSecurityStack.cxx - SSecurityVncAuth.cxx - SSecurityVeNCrypt.cxx - ScaleFilters.cxx - Timer.cxx - TightDecoder.cxx - TightEncoder.cxx - TightJPEGEncoder.cxx - TightWEBPEncoder.cxx - TightQOIEncoder.cxx - UpdateTracker.cxx - VNCSConnectionST.cxx - VNCServerST.cxx - ZRLEEncoder.cxx - ZRLEDecoder.cxx - Watermark.cxx - cpuid.cxx - encodings.cxx - util.cxx - xxhash.c) + Blacklist.cxx + Congestion.cxx + CConnection.cxx + CMsgHandler.cxx + CMsgReader.cxx + CMsgWriter.cxx + CSecurityPlain.cxx + CSecurityStack.cxx + CSecurityVeNCrypt.cxx + CSecurityVncAuth.cxx + ComparingUpdateTracker.cxx + Configuration.cxx + ConnParams.cxx + CopyRectDecoder.cxx + Cursor.cxx + DecodeManager.cxx + Decoder.cxx + d3des.c + EncCache.cxx + EncodeManager.cxx + Encoder.cxx + HextileDecoder.cxx + HextileEncoder.cxx + JpegCompressor.cxx + JpegDecompressor.cxx + KeyRemapper.cxx + LogWriter.cxx + Logger.cxx + Logger_file.cxx + Logger_stdio.cxx + Password.cxx + PixelBuffer.cxx + PixelFormat.cxx + RREEncoder.cxx + RREDecoder.cxx + RawDecoder.cxx + RawEncoder.cxx + Region.cxx + SConnection.cxx + SMsgHandler.cxx + SMsgReader.cxx + SMsgWriter.cxx + ServerCore.cxx + Security.cxx + SecurityServer.cxx + SecurityClient.cxx + SelfBench.cxx + SSecurityPlain.cxx + SSecurityStack.cxx + SSecurityVncAuth.cxx + SSecurityVeNCrypt.cxx + ScaleFilters.cxx + Timer.cxx + TightDecoder.cxx + TightEncoder.cxx + TightJPEGEncoder.cxx + TightWEBPEncoder.cxx + TightQOIEncoder.cxx + UpdateTracker.cxx + VNCSConnectionST.cxx + VNCServerST.cxx + ZRLEEncoder.cxx + ZRLEDecoder.cxx + Watermark.cxx + cpuid.cxx + encodings.cxx + util.cxx + xxhash.c +) -if(UNIX) - set(RFB_SOURCES ${RFB_SOURCES} Logger_syslog.cxx) -endif() +if (UNIX) + set(RFB_SOURCES ${RFB_SOURCES} Logger_syslog.cxx) +endif () -if(WIN32) - include_directories(${CMAKE_SOURCE_DIR}/win) - set(RFB_SOURCES ${RFB_SOURCES} WinPasswdValidator.cxx) -endif(WIN32) +if (WIN32) + include_directories(${CMAKE_SOURCE_DIR}/win) + set(RFB_SOURCES ${RFB_SOURCES} WinPasswdValidator.cxx) +endif (WIN32) set(RFB_LIBRARIES ${JPEG_LIBRARIES} ${PNG_LIBRARIES} os rdr Xregion) @@ -88,49 +86,57 @@ if ((CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_ set(RFB_LIBRARIES ${RFB_LIBRARIES} tbb) endif () -if(HAVE_PAM) - set(RFB_SOURCES ${RFB_SOURCES} UnixPasswordValidator.cxx - UnixPasswordValidator.h pam.c pam.h) - set(RFB_LIBRARIES ${RFB_LIBRARIES} ${PAM_LIBS}) -endif() +if (HAVE_PAM) + set(RFB_SOURCES ${RFB_SOURCES} UnixPasswordValidator.cxx + UnixPasswordValidator.h pam.c pam.h) + set(RFB_LIBRARIES ${RFB_LIBRARIES} ${PAM_LIBS}) +endif () -if(GNUTLS_FOUND) - set(RFB_SOURCES - ${RFB_SOURCES} - CSecurityTLS.cxx - SSecurityTLS.cxx - ) - set(RFB_LIBRARIES - ${RFB_LIBRARIES} - ${GNUTLS_LIBRARIES} - ) -endif() +if (GNUTLS_FOUND) + set(RFB_SOURCES + ${RFB_SOURCES} + CSecurityTLS.cxx + SSecurityTLS.cxx + ) + set(RFB_LIBRARIES + ${RFB_LIBRARIES} + ${GNUTLS_LIBRARIES} + ) +endif () # SSE2 set(SSE2_SOURCES - scale_sse2.cxx) + scale_sse2.cxx) set(SCALE_DUMMY_SOURCES - scale_dummy.cxx) + scale_dummy.cxx) -if(COMPILER_SUPPORTS_SSE2) - set_source_files_properties(${SSE2_SOURCES} PROPERTIES COMPILE_FLAGS ${COMPILE_FLAGS} -msse2) - set(RFB_SOURCES - ${RFB_SOURCES} - ${SSE2_SOURCES} - ) -else() - set(RFB_SOURCES - ${RFB_SOURCES} - ${SCALE_DUMMY_SOURCES} - ) -endif() +if (COMPILER_SUPPORTS_SSE2) + set_source_files_properties(${SSE2_SOURCES} PROPERTIES COMPILE_FLAGS ${COMPILE_FLAGS} -msse2) + set(RFB_SOURCES + ${RFB_SOURCES} + ${SSE2_SOURCES} + ) +else () + set(RFB_SOURCES + ${RFB_SOURCES} + ${SCALE_DUMMY_SOURCES} + ) +endif () add_library(rfb STATIC ${RFB_SOURCES}) -target_link_libraries(rfb ${RFB_LIBRARIES}) +target_include_directories(rfb PRIVATE + ${CMAKE_SOURCE_DIR}/common + ${JPEG_INCLUDE_DIR} + ${PNG_INCLUDE_DIR} + ${CMAKE_SOURCE_DIR}/unix/kasmvncpasswd + ${CMAKE_SOURCE_DIR}/third_party/tinyxml2 +) -if(UNIX) - libtool_create_control_file(rfb) -endif() +target_link_libraries(rfb PRIVATE ${RFB_LIBRARIES} tinyxml2_objs) + +if (UNIX) + libtool_create_control_file(rfb) +endif () diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt new file mode 100644 index 0000000..8572f8d --- /dev/null +++ b/third_party/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(tinyxml2) \ No newline at end of file diff --git a/third_party/tinyxml2/CMakeLists.txt b/third_party/tinyxml2/CMakeLists.txt new file mode 100644 index 0000000..db809df --- /dev/null +++ b/third_party/tinyxml2/CMakeLists.txt @@ -0,0 +1,5 @@ +add_library(tinyxml2_objs OBJECT tinyxml2.cpp) +if (NOT WIN32) + set_target_properties(tinyxml2_objs PROPERTIES POSITION_INDEPENDENT_CODE ON) +endif () +target_include_directories(tinyxml2_objs PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) \ No newline at end of file From 75b1712f31e8cb6890098d98576e3cdb885c3fc8 Mon Sep 17 00:00:00 2001 From: El Date: Mon, 31 Mar 2025 07:46:07 +0500 Subject: [PATCH 046/150] KASM-6984 Refactor GitLab CI to utilize job extensions and reduce redundancy --- .gitlab-ci.yml | 869 +++++++++------------------- spec/helper/spec_helper.py | 13 + spec/vncserver_benchmarking_spec.py | 12 + 3 files changed, 287 insertions(+), 607 deletions(-) create mode 100644 spec/vncserver_benchmarking_spec.py diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e234c79..e104a69 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -66,18 +66,14 @@ build_www: paths: - output/ -build_ubuntu_focal: +.base_build: stage: build allow_failure: true - tags: - - oci-fixed-amd before_script: - *prepare_build - *prepare_www after_script: - *prepare_artfacts - script: - - bash builder/build-package ubuntu focal; only: variables: - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME @@ -85,444 +81,197 @@ build_ubuntu_focal: paths: - output/ +build_ubuntu_focal: + extends: + - .base_build + tags: + - oci-fixed-amd + script: + - bash builder/build-package ubuntu focal; + build_ubuntu_focal_arm: - stage: build - allow_failure: true + extends: + - .base_build tags: - oci-fixed-arm - before_script: - - *prepare_build - - *prepare_www - after_script: - - *prepare_artfacts script: - bash builder/build-package ubuntu focal; - only: - variables: - - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME - artifacts: - paths: - - output/ - -build_ubuntu_jammy: - stage: build - allow_failure: true - tags: - - oci-fixed-amd - before_script: - - *prepare_build - - *prepare_www - after_script: - - *prepare_artfacts - script: - - bash builder/build-package ubuntu jammy; - only: - variables: - - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME - artifacts: - paths: - - output/ - -build_ubuntu_jammy_arm: - stage: build - allow_failure: true - tags: - - oci-fixed-arm - before_script: - - *prepare_build - - *prepare_www - after_script: - - *prepare_artfacts - script: - - bash builder/build-package ubuntu jammy; - only: - variables: - - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME - artifacts: - paths: - - output/ - -build_ubuntu_noble: - stage: build - allow_failure: true - tags: - - oci-fixed-amd - before_script: - - *prepare_build - - *prepare_www - after_script: - - *prepare_artfacts - script: - - bash builder/build-package ubuntu noble; - only: - variables: - - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME - artifacts: - paths: - - output/ - -build_ubuntu_noble_arm: - stage: build - allow_failure: true - tags: - - oci-fixed-arm - before_script: - - *prepare_build - - *prepare_www - after_script: - - *prepare_artfacts - script: - - bash builder/build-package ubuntu noble; - only: - variables: - - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME - artifacts: - paths: - - output/ - -build_debian_bullseye: - stage: build - allow_failure: true - tags: - - oci-fixed-amd - before_script: - - *prepare_build - - *prepare_www - after_script: - - *prepare_artfacts - script: - - bash builder/build-package debian bullseye; - only: - variables: - - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME - artifacts: - paths: - - output/ - -build_debian_bullseye_arm: - stage: build - allow_failure: true - tags: - - oci-fixed-arm - before_script: - - *prepare_build - - *prepare_www - after_script: - - *prepare_artfacts - script: - - bash builder/build-package debian bullseye; - only: - variables: - - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME - artifacts: - paths: - - output/ - - -build_debian_bookworm: - stage: build - allow_failure: true - tags: - - oci-fixed-amd - before_script: - - *prepare_build - - *prepare_www - after_script: - - *prepare_artfacts - script: - - bash builder/build-package debian bookworm; - only: - variables: - - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME - artifacts: - paths: - - output/ - -build_debian_bookworm_arm: - stage: build - allow_failure: true - tags: - - oci-fixed-arm - before_script: - - *prepare_build - - *prepare_www - after_script: - - *prepare_artfacts - script: - - bash builder/build-package debian bookworm; - only: - variables: - - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME - artifacts: - paths: - - output/ - -build_kali_rolling: - stage: build - allow_failure: true - tags: - - oci-fixed-amd - before_script: - - *prepare_build - - *prepare_www - after_script: - - *prepare_artfacts - script: - - bash builder/build-package kali kali-rolling; - only: - variables: - - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME - artifacts: - paths: - - output/ - -build_kali_rolling_arm: - stage: build - allow_failure: true - tags: - - oci-fixed-arm - before_script: - - *prepare_build - - *prepare_www - after_script: - - *prepare_artfacts - script: - - bash builder/build-package kali kali-rolling; - only: - variables: - - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME - artifacts: - paths: - - output/ - -build_oracle_8: - stage: build - allow_failure: true - tags: - - oci-fixed-amd - before_script: - - *prepare_build - - *prepare_www - after_script: - - *prepare_artfacts - script: - - bash builder/build-package oracle 8; - only: - variables: - - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME - artifacts: - paths: - - output/ - -build_oracle_8_arm: - stage: build - allow_failure: true - tags: - - oci-fixed-arm - before_script: - - *prepare_build - - *prepare_www - after_script: - - *prepare_artfacts - script: - - bash builder/build-package oracle 8; - only: - variables: - - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME - artifacts: - paths: - - output/ - -build_oracle_9: - stage: build - allow_failure: true - tags: - - oci-fixed-amd - before_script: - - *prepare_build - - *prepare_www - after_script: - - *prepare_artfacts - script: - - bash builder/build-package oracle 9; - only: - variables: - - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME - artifacts: - paths: - - output/ - -build_oracle_9_arm: - stage: build - allow_failure: true - tags: - - oci-fixed-arm - before_script: - - *prepare_build - - *prepare_www - after_script: - - *prepare_artfacts - script: - - bash builder/build-package oracle 9; - only: - variables: - - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME - artifacts: - paths: - - output/ - -build_opensuse_15: - stage: build - allow_failure: true - tags: - - oci-fixed-amd - before_script: - - *prepare_build - - *prepare_www - after_script: - - *prepare_artfacts - script: - - bash builder/build-package opensuse 15; - only: - variables: - - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME - artifacts: - paths: - - output/ - -build_opensuse_15_arm: - stage: build - allow_failure: true - tags: - - oci-fixed-arm - before_script: - - *prepare_build - - *prepare_www - after_script: - - *prepare_artfacts - script: - - bash builder/build-package opensuse 15; - only: - variables: - - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME - artifacts: - paths: - - output/ - -build_fedora_thirtynine: - stage: build - allow_failure: true - tags: - - oci-fixed-amd - before_script: - - *prepare_build - - *prepare_www - after_script: - - *prepare_artfacts - script: - - bash builder/build-package fedora thirtynine; - only: - variables: - - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME - artifacts: - paths: - - output/ - -build_fedora_thirtynine_arm: - stage: build - allow_failure: true - tags: - - oci-fixed-arm - before_script: - - *prepare_build - - *prepare_www - after_script: - - *prepare_artfacts - script: - - bash builder/build-package fedora thirtynine; - only: - variables: - - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME - artifacts: - paths: - - output/ - -build_fedora_forty: - stage: build - allow_failure: true - tags: - - oci-fixed-amd - before_script: - - *prepare_build - - *prepare_www - after_script: - - *prepare_artfacts - script: - - bash builder/build-package fedora forty; - only: - variables: - - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME - artifacts: - paths: - - output/ - -build_fedora_forty_arm: - stage: build - allow_failure: true - tags: - - oci-fixed-arm - before_script: - - *prepare_build - - *prepare_www - after_script: - - *prepare_artfacts - script: - - bash builder/build-package fedora forty; - only: - variables: - - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME - artifacts: - paths: - - output/ - -build_fedora_fortyone: - stage: build - allow_failure: true - tags: - - oci-fixed-amd - before_script: - - *prepare_build - - *prepare_www - after_script: - - *prepare_artfacts - script: - - bash builder/build-package fedora fortyone; - only: - variables: - - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME - artifacts: - paths: - - output/ - -build_fedora_fortyone_arm: - stage: build - allow_failure: true - tags: - - oci-fixed-arm - before_script: - - *prepare_build - - *prepare_www - after_script: - - *prepare_artfacts - script: - - bash builder/build-package fedora fortyone; - only: - variables: - - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME - artifacts: - paths: - - output/ - +# +#build_ubuntu_jammy: +# extends: +# - .base_build +# tags: +# - oci-fixed-amd +# script: +# - bash builder/build-package ubuntu jammy; +# +#build_ubuntu_jammy_arm: +# extends: +# - .base_build +# tags: +# - oci-fixed-arm +# script: +# - bash builder/build-package ubuntu jammy; +# +#build_ubuntu_noble: +# extends: +# - .base_build +# tags: +# - oci-fixed-amd +# script: +# - bash builder/build-package ubuntu noble; +# +#build_ubuntu_noble_arm: +# extends: +# - .base_build +# tags: +# - oci-fixed-arm +# script: +# - bash builder/build-package ubuntu noble; +# +#build_debian_bullseye: +# extends: +# - .base_build +# tags: +# - oci-fixed-amd +# script: +# - bash builder/build-package debian bullseye; +# +#build_debian_bullseye_arm: +# extends: +# - .base_build +# tags: +# - oci-fixed-arm +# script: +# - bash builder/build-package debian bullseye; +# +#build_debian_bookworm: +# extends: +# - .base_build +# tags: +# - oci-fixed-amd +# script: +# - bash builder/build-package debian bookworm; +# +#build_debian_bookworm_arm: +# extends: +# - .base_build +# tags: +# - oci-fixed-arm +# script: +# - bash builder/build-package debian bookworm; +# +#build_kali_rolling: +# extends: +# - .base_build +# tags: +# - oci-fixed-amd +# script: +# - bash builder/build-package kali kali-rolling; +# +#build_kali_rolling_arm: +# extends: +# - .base_build +# tags: +# - oci-fixed-arm +# script: +# - bash builder/build-package kali kali-rolling; +# +#build_oracle_8: +# extends: +# - .base_build +# tags: +# - oci-fixed-amd +# script: +# - bash builder/build-package oracle 8; +# +#build_oracle_8_arm: +# extends: +# - .base_build +# tags: +# - oci-fixed-arm +# script: +# - bash builder/build-package oracle 8; +# +#build_oracle_9: +# extends: +# - .base_build +# tags: +# - oci-fixed-amd +# script: +# - bash builder/build-package oracle 9; +# +#build_oracle_9_arm: +# extends: +# - .base_build +# tags: +# - oci-fixed-arm +# script: +# - bash builder/build-package oracle 9; +# +#build_opensuse_15: +# extends: +# - .base_build +# tags: +# - oci-fixed-amd +# script: +# - bash builder/build-package opensuse 15; +# +#build_opensuse_15_arm: +# extends: +# - .base_build +# tags: +# - oci-fixed-arm +# script: +# - bash builder/build-package opensuse 15; +# +#build_fedora_thirtynine: +# extends: +# - .base_build +# tags: +# - oci-fixed-amd +# script: +# - bash builder/build-package fedora thirtynine; +# +#build_fedora_thirtynine_arm: +# extends: +# - .base_build +# tags: +# - oci-fixed-arm +# script: +# - bash builder/build-package fedora thirtynine; +# +#build_fedora_forty: +# extends: +# - .base_build +# tags: +# - oci-fixed-amd +# script: +# - bash builder/build-package fedora forty; +# +#build_fedora_forty_arm: +# extends: +# - .base_build +# tags: +# - oci-fixed-arm +# script: +# - bash builder/build-package fedora forty; +# +#build_fedora_fortyone: +# extends: +# - .base_build +# tags: +# - oci-fixed-amd +# script: +# - bash builder/build-package fedora fortyone; +# +#build_fedora_fortyone_arm: +# extends: +# - .base_build +# tags: +# - oci-fixed-arm +# script: +# - bash builder/build-package fedora fortyone; test: stage: test @@ -530,161 +279,67 @@ test: - oci-fixed-amd before_script: - *prepare_build + artifacts: + reports: + junit: SelfBench.xml script: - bash builder/test-vncserver - -build_alpine_318: - stage: build - allow_failure: true - tags: - - oci-fixed-amd - before_script: - - *prepare_build - - *prepare_www - after_script: - - *prepare_artfacts - script: - - bash builder/build-package alpine 318; - only: - variables: - - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME - artifacts: - paths: - - output/ - -build_alpine_318_arm: - stage: build - allow_failure: true - tags: - - oci-fixed-arm - before_script: - - *prepare_build - - *prepare_www - after_script: - - *prepare_artfacts - script: - - bash builder/build-package alpine 318; - only: - variables: - - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME - artifacts: - paths: - - output/ - -build_alpine_319: - stage: build - allow_failure: true - tags: - - oci-fixed-amd - before_script: - - *prepare_build - - *prepare_www - after_script: - - *prepare_artfacts - script: - - bash builder/build-package alpine 319; - only: - variables: - - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME - artifacts: - paths: - - output/ - -build_alpine_319_arm: - stage: build - allow_failure: true - tags: - - oci-fixed-arm - before_script: - - *prepare_build - - *prepare_www - after_script: - - *prepare_artfacts - script: - - bash builder/build-package alpine 319; - only: - variables: - - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME - artifacts: - paths: - - output/ - -build_alpine_320: - stage: build - allow_failure: true - tags: - - oci-fixed-amd - before_script: - - *prepare_build - - *prepare_www - after_script: - - *prepare_artfacts - script: - - bash builder/build-package alpine 320; - only: - variables: - - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME - artifacts: - paths: - - output/ - -build_alpine_320_arm: - stage: build - allow_failure: true - tags: - - oci-fixed-arm - before_script: - - *prepare_build - - *prepare_www - after_script: - - *prepare_artfacts - script: - - bash builder/build-package alpine 320; - only: - variables: - - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME - artifacts: - paths: - - output/ - -build_alpine_321: - stage: build - allow_failure: true - tags: - - oci-fixed-amd - before_script: - - *prepare_build - - *prepare_www - after_script: - - *prepare_artfacts - script: - - bash builder/build-package alpine 321; - only: - variables: - - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME - artifacts: - paths: - - output/ - -build_alpine_321_arm: - stage: build - allow_failure: true - tags: - - oci-fixed-arm - before_script: - - *prepare_build - - *prepare_www - after_script: - - *prepare_artfacts - script: - - bash builder/build-package alpine 321; - only: - variables: - - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME - artifacts: - paths: - - output/ +#build_alpine_318: +# extends: .base_build +# tags: +# - oci-fixed-amd +# script: +# - bash builder/build-package alpine 318; +# +#build_alpine_318_arm: +# extends: .base_build +# tags: +# - oci-fixed-arm +# script: +# - bash builder/build-package alpine 318; +# +#build_alpine_319: +# extends: .base_build +# tags: +# - oci-fixed-amd +# script: +# - bash builder/build-package alpine 319; +# +#build_alpine_319_arm: +# extends: .base_build +# tags: +# - oci-fixed-arm +# script: +# - bash builder/build-package alpine 319; +# +#build_alpine_320: +# extends: .base_build +# tags: +# - oci-fixed-amd +# script: +# - bash builder/build-package alpine 320; +# +#build_alpine_320_arm: +# extends: .base_build +# tags: +# - oci-fixed-arm +# script: +# - bash builder/build-package alpine 320; +# +#build_alpine_321: +# extends: .base_build +# tags: +# - oci-fixed-amd +# script: +# - bash builder/build-package alpine 321; +# +#build_alpine_321_arm: +# extends: .base_build +# tags: +# - oci-fixed-arm +# script: +# - bash builder/build-package alpine 321; upload: stage: upload @@ -700,33 +355,33 @@ upload: - prepare_to_run_scripts_and_s3_uploads - S3_CRASHPAD_BUILD_DIRECTORY="kasmvnc/crashpad/${CI_COMMIT_SHA}" - for dbgsym_package in `find output/ -type f -name '*dbgsym*deb'`; do - deb_package=$(find_deb_package "$dbgsym_package"); - xvnc_md5sum=$(fetch_xvnc_md5sum "$deb_package"); - upload_filename="${S3_CRASHPAD_BUILD_DIRECTORY}/${xvnc_md5sum}/kasmvncserver-dbgsym.deb"; - echo; - echo "File to upload $upload_filename"; - upload_to_s3 "$dbgsym_package" "$upload_filename" "$S3_BUCKET"; - rm "$dbgsym_package"; + deb_package=$(find_deb_package "$dbgsym_package"); + xvnc_md5sum=$(fetch_xvnc_md5sum "$deb_package"); + upload_filename="${S3_CRASHPAD_BUILD_DIRECTORY}/${xvnc_md5sum}/kasmvncserver-dbgsym.deb"; + echo; + echo "File to upload $upload_filename"; + upload_to_s3 "$dbgsym_package" "$upload_filename" "$S3_BUCKET"; + rm "$dbgsym_package"; done - export S3_BUILD_DIRECTORY="kasmvnc/${CI_COMMIT_SHA}" - export RELEASE_VERSION=$(.ci/next_release_version "$CI_COMMIT_REF_NAME") - uploaded_files=() - for package in `find output/ -type f -name '*.deb' -or -name '*.rpm' -or -name '*.apk'`; do - prepare_upload_filename "$package"; - upload_filename="${S3_BUILD_DIRECTORY}/$upload_filename"; - echo; - echo "File to upload $upload_filename"; - upload_to_s3 "$package" "$upload_filename" "$S3_BUCKET"; - UPLOAD_NAME=$(basename $upload_filename | sed 's#kasmvncserver_##' | sed -r 's#_([0-9]{1,3}\.){2}[0-9]{1,2}_\S+?([a-f0-9]{6})##' | sed -r 's#\.(deb|rpm|tgz)##'); - curl --request POST --header "PRIVATE-TOKEN:${GITLAB_API_TOKEN}" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/statuses/${CI_COMMIT_SHA}?state=success&name=${UPLOAD_NAME}&target_url=${S3_URL}"; - uploaded_files+=("$upload_filename"); + prepare_upload_filename "$package"; + upload_filename="${S3_BUILD_DIRECTORY}/$upload_filename"; + echo; + echo "File to upload $upload_filename"; + upload_to_s3 "$package" "$upload_filename" "$S3_BUCKET"; + UPLOAD_NAME=$(basename $upload_filename | sed 's#kasmvncserver_##' | sed -r 's#_([0-9]{1,3}\.){2}[0-9]{1,2}_\S+?([a-f0-9]{6})##' | sed -r 's#\.(deb|rpm|tgz)##'); + curl --request POST --header "PRIVATE-TOKEN:${GITLAB_API_TOKEN}" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/statuses/${CI_COMMIT_SHA}?state=success&name=${UPLOAD_NAME}&target_url=${S3_URL}"; + uploaded_files+=("$upload_filename"); done - make_index_html "${uploaded_files[@]}" > output/index.html; upload_build_preview: stage: upload - needs: ["upload"] - dependencies: ["upload"] + needs: [ "upload" ] + dependencies: [ "upload" ] image: ubuntu:focal tags: - oci-fixed-amd diff --git a/spec/helper/spec_helper.py b/spec/helper/spec_helper.py index cb12c9f..3079296 100644 --- a/spec/helper/spec_helper.py +++ b/spec/helper/spec_helper.py @@ -23,6 +23,18 @@ def write_config(config_text): f.write(config_text) +def clean_locks(): + tmp = '/tmp' + temporary_lock_file = os.path.join(tmp, '.X1-lock') + if (os.path.exists(temporary_lock_file)): + os.remove(temporary_lock_file) + + temporary_lock_file = os.path.join(tmp, '.X11-unix') + temporary_lock_file = os.path.join(temporary_lock_file, 'X1') + if (os.path.exists(temporary_lock_file)): + os.remove(temporary_lock_file) + + def clean_env(): clean_kasm_users() @@ -30,6 +42,7 @@ def clean_env(): vnc_dir = os.path.join(home_dir, ".vnc") Path(vnc_dir).rmtree(ignore_errors=True) + clean_locks() def clean_kasm_users(): home_dir = os.environ['HOME'] diff --git a/spec/vncserver_benchmarking_spec.py b/spec/vncserver_benchmarking_spec.py new file mode 100644 index 0000000..1cb59b1 --- /dev/null +++ b/spec/vncserver_benchmarking_spec.py @@ -0,0 +1,12 @@ +from mamba import description, context, it, fit, before, after +from expects import expect, equal, contain, match +from helper.spec_helper import run_cmd, clean_env, kill_xvnc + +with description("Benchmarking"): + with before.each: + clean_env() + with after.each: + kill_xvnc() + with it("runs benchmarks"): + completed_process = run_cmd("Xvnc -interface 0.0.0.0 :1 -selfBench") + expect(completed_process.returncode).to(equal(0)) From b5f3f44c5753e2a4dc06ffa1b385ee77a23d7f51 Mon Sep 17 00:00:00 2001 From: El Date: Mon, 7 Apr 2025 17:14:07 +0500 Subject: [PATCH 047/150] KASM-6984 Refactor SelfBench XML generation and enhance benchmarking. Simplified XML structure by removing unnecessary elements and attributes. Added new fields to aggregate test case count, total time, and class name in the generated "SelfBench.xml" file. Ensures clearer benchmarking output and streamlined code. KASM-6984 Refactor SelfBench XML generation and enhance benchmarking. Simplified XML structure by removing unnecessary elements and attributes. Added new fields to aggregate test case count, total time, and class name in the generated --- common/rfb/SelfBench.cxx | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/common/rfb/SelfBench.cxx b/common/rfb/SelfBench.cxx index ca8e3fb..62c0cac 100644 --- a/common/rfb/SelfBench.cxx +++ b/common/rfb/SelfBench.cxx @@ -44,14 +44,10 @@ static constexpr uint32_t HEIGHT = 1200; void SelfBench() { tinyxml2::XMLDocument doc; - auto *root = doc.NewElement("testsuites"); - root->SetAttribute("name", "Benchmarking"); - - auto *test_suits = doc.InsertFirstChild(root); - - auto *test_suit = doc.NewElement("testsuit"); + auto *test_suit = doc.NewElement("testsuite"); test_suit->SetAttribute("name", "SelfBench"); - test_suits->InsertEndChild(test_suit); + + doc.InsertFirstChild(test_suit); ManagedPixelBuffer f1(pfRGBX, WIDTH, HEIGHT); ManagedPixelBuffer f2(pfRGBX, WIDTH, HEIGHT); @@ -85,18 +81,26 @@ void SelfBench() { TightJPEGEncoder jpeg(nullptr); - auto benchmark = [&doc, &test_suit](const char *name, uint32_t runs, auto func) { + uint32_t test_cases {}; + uint64_t total_time {}; + + auto benchmark = [&doc, &test_suit, &test_cases, &total_time](const char *name, uint32_t runs, auto func) { auto now = std::chrono::high_resolution_clock::now(); for (uint32_t i = 0; i < runs; i++) { func(i); } + ++test_cases; auto value = elapsedMs(now); + double junit_value = value / 1000.; + total_time += value; + vlog.info("%s took %lu ms (%u runs)", name, value, runs); auto *test_case = doc.NewElement("testcase"); test_case->SetAttribute("name", name); - test_case->SetAttribute("time", value); + test_case->SetAttribute("time", junit_value); test_case->SetAttribute("runs", runs); + test_case->SetAttribute("classname", "KasmVNC"); test_suit->InsertEndChild(test_case); }; @@ -180,6 +184,10 @@ void SelfBench() { comparer->compare(false, cursorReg); }); + test_suit->SetAttribute("tests", test_cases); + test_suit->SetAttribute("failures", 0); + test_suit->SetAttribute("time", total_time); + doc.SaveFile("SelfBench.xml"); exit(0); From 969996a6470b52ad5149d66fc4b3128fbb844cdd Mon Sep 17 00:00:00 2001 From: El Date: Mon, 7 Apr 2025 18:56:24 +0500 Subject: [PATCH 048/150] KASM-6984 Add extende benchmark parameter to Server class Introduce a new "benchmark" boolean parameter in the Server class to enable extended benchmarking functionality. This complements the existing self-benchmark feature, providing more comprehensive performance testing options. --- common/rfb/ServerCore.cxx | 4 ++ common/rfb/ServerCore.h | 133 +++++++++++++++++++------------------- 2 files changed, 69 insertions(+), 68 deletions(-) diff --git a/common/rfb/ServerCore.cxx b/common/rfb/ServerCore.cxx index 3881693..97aa875 100644 --- a/common/rfb/ServerCore.cxx +++ b/common/rfb/ServerCore.cxx @@ -117,6 +117,10 @@ rfb::BoolParameter rfb::Server::selfBench ("SelfBench", "Run self-benchmarks and exit.", false); +rfb::BoolParameter rfb::Server::benchmark ( + "Benchmark", + "Run extended benchmarks and exit.", + false); rfb::IntParameter rfb::Server::dynamicQualityMin ("DynamicQualityMin", "The minimum dynamic JPEG quality, 0 = low, 9 = high", diff --git a/common/rfb/ServerCore.h b/common/rfb/ServerCore.h index c3a53e5..aeae07f 100644 --- a/common/rfb/ServerCore.h +++ b/common/rfb/ServerCore.h @@ -28,73 +28,70 @@ #include namespace rfb { - - class Server { - public: - - static IntParameter idleTimeout; - static IntParameter maxDisconnectionTime; - static IntParameter maxConnectionTime; - static IntParameter maxIdleTime; - static IntParameter clientWaitTimeMillis; - static IntParameter compareFB; - static IntParameter frameRate; - static IntParameter dynamicQualityMin; - static IntParameter dynamicQualityMax; - static IntParameter treatLossless; - static IntParameter scrollDetectLimit; - static IntParameter rectThreads; - static IntParameter DLP_ClipSendMax; - static IntParameter DLP_ClipAcceptMax; - static IntParameter DLP_ClipDelay; - static IntParameter DLP_KeyRateLimit; - static IntParameter DLP_WatermarkRepeatSpace; - static IntParameter DLP_WatermarkFontSize; - static IntParameter DLP_WatermarkTimeOffset; - static IntParameter DLP_WatermarkTimeOffsetMinutes; - static IntParameter DLP_WatermarkTextAngle; - static StringParameter DLP_ClipLog; - static StringParameter DLP_Region; - static StringParameter DLP_Clip_Types; - static StringParameter DLP_WatermarkImage; - static StringParameter DLP_WatermarkLocation; - static StringParameter DLP_WatermarkTint; - static StringParameter DLP_WatermarkText; - static StringParameter DLP_WatermarkFont; - static BoolParameter DLP_RegionAllowClick; - static BoolParameter DLP_RegionAllowRelease; - static IntParameter jpegVideoQuality; - static IntParameter webpVideoQuality; - static StringParameter maxVideoResolution; - static IntParameter videoTime; - static IntParameter videoOutTime; - static IntParameter videoArea; - static IntParameter videoScaling; - static IntParameter udpFullFrameFrequency; - static IntParameter udpPort; - static StringParameter kasmPasswordFile; - static StringParameter publicIP; - static StringParameter stunServer; - static BoolParameter printVideoArea; - static BoolParameter protocol3_3; - static BoolParameter alwaysShared; - static BoolParameter neverShared; - static BoolParameter disconnectClients; - static BoolParameter acceptKeyEvents; - static BoolParameter acceptPointerEvents; - static BoolParameter acceptCutText; - static BoolParameter sendCutText; - static BoolParameter acceptSetDesktopSize; - static BoolParameter queryConnect; - static BoolParameter detectScrolling; - static BoolParameter detectHorizontal; - static BoolParameter ignoreClientSettingsKasm; - static BoolParameter selfBench; - static PresetParameter preferBandwidth; - static IntParameter webpEncodingTime; - }; - + class Server { + public: + static IntParameter idleTimeout; + static IntParameter maxDisconnectionTime; + static IntParameter maxConnectionTime; + static IntParameter maxIdleTime; + static IntParameter clientWaitTimeMillis; + static IntParameter compareFB; + static IntParameter frameRate; + static IntParameter dynamicQualityMin; + static IntParameter dynamicQualityMax; + static IntParameter treatLossless; + static IntParameter scrollDetectLimit; + static IntParameter rectThreads; + static IntParameter DLP_ClipSendMax; + static IntParameter DLP_ClipAcceptMax; + static IntParameter DLP_ClipDelay; + static IntParameter DLP_KeyRateLimit; + static IntParameter DLP_WatermarkRepeatSpace; + static IntParameter DLP_WatermarkFontSize; + static IntParameter DLP_WatermarkTimeOffset; + static IntParameter DLP_WatermarkTimeOffsetMinutes; + static IntParameter DLP_WatermarkTextAngle; + static StringParameter DLP_ClipLog; + static StringParameter DLP_Region; + static StringParameter DLP_Clip_Types; + static StringParameter DLP_WatermarkImage; + static StringParameter DLP_WatermarkLocation; + static StringParameter DLP_WatermarkTint; + static StringParameter DLP_WatermarkText; + static StringParameter DLP_WatermarkFont; + static BoolParameter DLP_RegionAllowClick; + static BoolParameter DLP_RegionAllowRelease; + static IntParameter jpegVideoQuality; + static IntParameter webpVideoQuality; + static StringParameter maxVideoResolution; + static IntParameter videoTime; + static IntParameter videoOutTime; + static IntParameter videoArea; + static IntParameter videoScaling; + static IntParameter udpFullFrameFrequency; + static IntParameter udpPort; + static StringParameter kasmPasswordFile; + static StringParameter publicIP; + static StringParameter stunServer; + static BoolParameter printVideoArea; + static BoolParameter protocol3_3; + static BoolParameter alwaysShared; + static BoolParameter neverShared; + static BoolParameter disconnectClients; + static BoolParameter acceptKeyEvents; + static BoolParameter acceptPointerEvents; + static BoolParameter acceptCutText; + static BoolParameter sendCutText; + static BoolParameter acceptSetDesktopSize; + static BoolParameter queryConnect; + static BoolParameter detectScrolling; + static BoolParameter detectHorizontal; + static BoolParameter ignoreClientSettingsKasm; + static BoolParameter selfBench; + static BoolParameter benchmark; + static PresetParameter preferBandwidth; + static IntParameter webpEncodingTime; + }; }; -#endif // __RFB_SERVER_CORE_H__ - +#endif // __RFB_SERVER_CORE_H__ \ No newline at end of file From 4983bb8be559d32a0a3b1dba055a314fc4db2520 Mon Sep 17 00:00:00 2001 From: El Date: Tue, 8 Apr 2025 04:44:57 +0500 Subject: [PATCH 049/150] KASM-6984 Add benchmark utility with FFmpeg integration for video handling --- common/CMakeLists.txt | 8 +-- common/rfb/CMakeLists.txt | 12 +++- common/rfb/VNCServerST.cxx | 20 +++++-- common/rfb/benchmark.cxx | 115 +++++++++++++++++++++++++++++++++++++ common/rfb/benchmark.h | 102 ++++++++++++++++++++++++++++++++ 5 files changed, 246 insertions(+), 11 deletions(-) create mode 100644 common/rfb/benchmark.cxx create mode 100644 common/rfb/benchmark.h diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index e4489f6..1fbdc22 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -9,7 +9,7 @@ add_subdirectory(rfb) # because PIC code does not exist on that platform and MinGW complains if -fPIC # is passed (additionally, libvnc is not used on Windows.) -if(NOT WIN32) - set_target_properties(os rdr network Xregion rfb - PROPERTIES COMPILE_FLAGS -fPIC) -endif() +if (NOT WIN32) + set_target_properties(os rdr network Xregion rfb + PROPERTIES COMPILE_FLAGS -fPIC) +endif () diff --git a/common/rfb/CMakeLists.txt b/common/rfb/CMakeLists.txt index 56f4488..a99e548 100644 --- a/common/rfb/CMakeLists.txt +++ b/common/rfb/CMakeLists.txt @@ -1,4 +1,5 @@ set(RFB_SOURCES + benchmark.cxx Blacklist.cxx Congestion.cxx CConnection.cxx @@ -87,7 +88,9 @@ if ((CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_ endif () if (HAVE_PAM) - set(RFB_SOURCES ${RFB_SOURCES} UnixPasswordValidator.cxx + set(RFB_SOURCES + ${RFB_SOURCES} + UnixPasswordValidator.cxx UnixPasswordValidator.h pam.c pam.h) set(RFB_LIBRARIES ${RFB_LIBRARIES} ${PAM_LIBS}) endif () @@ -122,9 +125,14 @@ else () set(RFB_SOURCES ${RFB_SOURCES} ${SCALE_DUMMY_SOURCES} + benchmark.h ) endif () +find_package(PkgConfig REQUIRED) + +pkg_check_modules(FFMPEG REQUIRED libavcodec libavformat libavutil libswscale) + add_library(rfb STATIC ${RFB_SOURCES}) target_include_directories(rfb PRIVATE @@ -135,7 +143,7 @@ target_include_directories(rfb PRIVATE ${CMAKE_SOURCE_DIR}/third_party/tinyxml2 ) -target_link_libraries(rfb PRIVATE ${RFB_LIBRARIES} tinyxml2_objs) +target_link_libraries(rfb PRIVATE ${RFB_LIBRARIES} tinyxml2_objs ${FFMPEG_LIBRARIES}) if (UNIX) libtool_create_control_file(rfb) diff --git a/common/rfb/VNCServerST.cxx b/common/rfb/VNCServerST.cxx index a84ebc9..35d5e5c 100644 --- a/common/rfb/VNCServerST.cxx +++ b/common/rfb/VNCServerST.cxx @@ -73,6 +73,7 @@ #include #include #include +#include using namespace rfb; @@ -82,6 +83,8 @@ EncCache VNCServerST::encCache; void SelfBench(); +void benchmark(const std::string&); + // // -=- VNCServerST Implementation // @@ -126,7 +129,7 @@ static void parseRegionPart(const bool percents, rdr::U16 &pcdest, int &dest, *inptr = ptr; } -VNCServerST::VNCServerST(const char* name_, SDesktop* desktop_) +VNCServerST::VNCServerST(const char* name_, SDesktop* desktop_, bool a) : blHosts(&blacklist), desktop(desktop_), desktopStarted(false), blockCounter(0), pb(0), blackedpb(0), ledState(ledUnknown), name(strDup(name_)), pointerClient(0), clipboardClient(0), @@ -223,11 +226,18 @@ VNCServerST::VNCServerST(const char* name_, SDesktop* desktop_) trackingClient[0] = 0; - if (watermarkData) - sendWatermark = true; + if (watermarkData) + sendWatermark = true; - if (Server::selfBench) - SelfBench(); + if (Server::selfBench) + SelfBench(); + + if (Server::benchmark) { + auto *file_name = Server::benchmark.getValueStr(); + if (std::filesystem::exists(file_name)) + throw Exception("Benchmarking video file does not exist"); + benchmark(file_name); + } } VNCServerST::~VNCServerST() diff --git a/common/rfb/benchmark.cxx b/common/rfb/benchmark.cxx new file mode 100644 index 0000000..ce0019a --- /dev/null +++ b/common/rfb/benchmark.cxx @@ -0,0 +1,115 @@ +/* Copyright (C) 2025 Kasm Web +* + * This is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This software 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, + * USA. + */ + +#include "benchmark.h" +#include +#include +#include +#include "VNCServer.h" + +static rfb::LogWriter vlog("Benchmarking"); + +void benchmark(const std::string &path) { + AVFormatContext *format_ctx = nullptr; + if (avformat_open_input(&format_ctx, path.c_str(), nullptr, nullptr) < 0) + throw std::runtime_error("Could not open video file"); + + FormatCtxGuard format_ctx_guard{format_ctx}; + + // Find stream info + if (avformat_find_stream_info(format_ctx, nullptr) < 0) + throw std::runtime_error("Could not find stream info"); + + // Find video stream + int video_stream_idx = -1; + for (uint32_t i = 0; i < format_ctx->nb_streams; ++i) { + if (format_ctx->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) { + video_stream_idx = static_cast(i); + break; + } + } + + if (video_stream_idx == -1) + throw std::runtime_error("No video stream found"); + + // Get codec parameters and decoder + const auto *codec_parameters = format_ctx->streams[video_stream_idx]->codecpar; + const auto *codec = avcodec_find_decoder(codec_parameters->codec_id); + if (!codec) + throw std::runtime_error("Codec not found"); + + CodecCtxGuard codex_ctx_guard{avcodec_alloc_context3(codec)}; + auto *codec_ctx = codex_ctx_guard.get(); + + if (!codec_ctx || avcodec_parameters_to_context(codec_ctx, codec_parameters) < 0) + throw std::runtime_error("Failed to set up codec context"); + + if (avcodec_open2(codec_ctx, codec, nullptr) < 0) + throw std::runtime_error("Could not open codec"); + + // Allocate frame and packet + FrameGuard frame_guard{av_frame_alloc()}; + auto *frame = frame_guard.get(); + + PacketGuard packet_guard{av_packet_alloc()}; + auto *packet = packet_guard.get(); + + if (!frame || !packet) + throw std::runtime_error("Could not allocate frame or packet"); + + // Scaling context to convert to RGB24 + SwsContext *sws_ctx = sws_getContext( + codec_ctx->width, codec_ctx->height, codec_ctx->pix_fmt, + codec_ctx->width, codec_ctx->height, AV_PIX_FMT_RGB24, + SWS_BILINEAR, nullptr, nullptr, nullptr + ); + + if (!sws_ctx) + throw std::runtime_error("Could not create scaling context"); + + SwsContextGuard sws_ctx_guard{sws_ctx}; + + FrameGuard rgb_frame_guard{av_frame_alloc()}; + auto *rgb_frame = rgb_frame_guard.get(); + + if (!rgb_frame) + throw std::runtime_error("Could not allocate frame"); + + rgb_frame->format = AV_PIX_FMT_RGB24; + rgb_frame->width = codec_ctx->width; + rgb_frame->height = codec_ctx->height; + + if (av_frame_get_buffer(rgb_frame, 0) != 0) + throw std::runtime_error("Could not allocate frame data"); + + while (av_read_frame(format_ctx, packet) == 0) { + if (packet->stream_index == video_stream_idx) { + if (avcodec_send_packet(codec_ctx, packet) == 0) { + while (avcodec_receive_frame(codec_ctx, frame) == 0) { + // Convert to RGB + sws_scale(sws_ctx, frame->data, frame->linesize, 0, frame->height, + rgb_frame->data, rgb_frame->linesize); + + // Save as BMP + // saveFrameAsBMP(rgb_frame, ++frameNumber); + } + } + } + av_packet_unref(packet); + } +} diff --git a/common/rfb/benchmark.h b/common/rfb/benchmark.h new file mode 100644 index 0000000..61edae5 --- /dev/null +++ b/common/rfb/benchmark.h @@ -0,0 +1,102 @@ +/* Copyright (C) 2025 Kasm Web +* + * This is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This software 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, + * USA. + */ + +#pragma once + +#include "Timer.h" +#include +#include + +extern "C" { +#include +#include +#include +} + +struct AVFormatContextDeleter { + void operator()(AVFormatContext *ctx) const { + avformat_close_input(&ctx); + } +}; + +struct AVCodecContextDeleter { + void operator()(AVCodecContext *ctx) const { + avcodec_free_context(&ctx); + } +}; + +struct AVFrameDeleter { + void operator()(AVFrame *frame) const { + av_frame_free(&frame); + } +}; + +struct SwsContextDeleter { + void operator()(SwsContext *ctx) const { + sws_freeContext(ctx); + } +}; + +struct PacketDeleter { + void operator()(AVPacket *packet) const { + av_packet_free(&packet); + } +}; + +using FormatCtxGuard = std::unique_ptr; +using CodecCtxGuard = std::unique_ptr; +using FrameGuard = std::unique_ptr; +using SwsContextGuard = std::unique_ptr; +using PacketGuard = std::unique_ptr; + +namespace rfb { + class BenchmarkServer : public VNCServer, public Timer::Callback { + public: + bool handleTimeout(Timer *t) override; + + void add_changed(const Region ®ion) override; + + void add_copied(const Region &dest, const Point &delta) override; + + void blockUpdates() override; + + void unblockUpdates() override; + + void setPixelBuffer(PixelBuffer *pb, const ScreenSet &layout) override; + + void setPixelBuffer(PixelBuffer *pb) override; + + void setScreenLayout(const ScreenSet &layout) override; + + [[nodiscard]] PixelBuffer *getPixelBuffer() const override; + + void announceClipboard(bool available) override; + + void bell() override; + + void closeClients(const char *reason) override; + + void setCursor(int width, int height, const Point &hotspot, const rdr::U8 *cursorData, bool resizing) override; + + void setCursorPos(const Point &p, bool warped) override; + + void setName(const char *name) override; + + void setLEDState(unsigned state) override; + }; +} From 9464071aa00bf3dffb75fc7f9ce3463401865d2e Mon Sep 17 00:00:00 2001 From: El Date: Wed, 9 Apr 2025 13:30:42 +0500 Subject: [PATCH 050/150] KASM-6984 Wrap tests in conditionals --- CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7a509b4..8ba357c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -239,12 +239,12 @@ else() endif() if(ENABLE_NLS) - add_subdirectory(po) + add_subdirectory(po) endif() if (TESTS) - add_subdirectory(tests) -endif () + add_subdirectory(tests) +endif() include(cmake/BuildPackages.cmake) From 7db59bdec9d5ca276fd07aef1d7608b1927442f6 Mon Sep 17 00:00:00 2001 From: El Date: Thu, 10 Apr 2025 14:08:54 +0500 Subject: [PATCH 051/150] KASM-6984 Update Dockerfile to include FFmpeg libraries --- builder/dockerfile.ubuntu_jammy.dev | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/builder/dockerfile.ubuntu_jammy.dev b/builder/dockerfile.ubuntu_jammy.dev index 7201cf2..255e3c7 100644 --- a/builder/dockerfile.ubuntu_jammy.dev +++ b/builder/dockerfile.ubuntu_jammy.dev @@ -32,7 +32,9 @@ RUN sed -i 's$# deb-src$deb-src$' /etc/apt/sources.list && \ libpng-dev \ libtiff-dev \ libgif-dev \ + libavformat-dev \ libavcodec-dev \ + libswscale-dev \ libssl-dev \ libxrandr-dev \ libxcursor-dev \ @@ -61,7 +63,7 @@ COPY builder/common.sh /tmp RUN chmod +x /tmp/build-webp && /tmp/build-webp RUN chmod +x /tmp/build-libjpeg-turbo && /tmp/build-libjpeg-turbo - + USER 1000 WORKDIR /src From 04e60f167174b6f75793bc5b5ea6174ce08033ec Mon Sep 17 00:00:00 2001 From: El Date: Thu, 10 Apr 2025 14:10:53 +0500 Subject: [PATCH 052/150] KASM-6984 Use modern C++ idioms and fix member initialization --- common/rfb/VNCSConnectionST.cxx | 2 +- common/rfb/VNCServerST.cxx | 4 ++-- common/rfb/VNCServerST.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/common/rfb/VNCSConnectionST.cxx b/common/rfb/VNCSConnectionST.cxx index c470de7..ed36bdc 100644 --- a/common/rfb/VNCSConnectionST.cxx +++ b/common/rfb/VNCSConnectionST.cxx @@ -62,7 +62,7 @@ VNCSConnectionST::VNCSConnectionST(VNCServerST* server_, network::Socket *s, losslessTimer(this), kbdLogTimer(this), binclipTimer(this), server(server_), updates(false), updateRenderedCursor(false), removeRenderedCursor(false), - continuousUpdates(false), encodeManager(this, &server_->encCache), + continuousUpdates(false), encodeManager(this, &VNCServerST::encCache), needsPermCheck(false), pointerEventTime(0), clientHasCursor(false), accessRights(AccessDefault), startTime(time(0)), frameTracking(false), diff --git a/common/rfb/VNCServerST.cxx b/common/rfb/VNCServerST.cxx index 35d5e5c..4106125 100644 --- a/common/rfb/VNCServerST.cxx +++ b/common/rfb/VNCServerST.cxx @@ -129,7 +129,7 @@ static void parseRegionPart(const bool percents, rdr::U16 &pcdest, int &dest, *inptr = ptr; } -VNCServerST::VNCServerST(const char* name_, SDesktop* desktop_, bool a) +VNCServerST::VNCServerST(const char* name_, SDesktop* desktop_) : blHosts(&blacklist), desktop(desktop_), desktopStarted(false), blockCounter(0), pb(0), blackedpb(0), ledState(ledUnknown), name(strDup(name_)), pointerClient(0), clipboardClient(0), @@ -201,7 +201,7 @@ VNCServerST::VNCServerST(const char* name_, SDesktop* desktop_, bool a) } } - DLPRegion.enabled = 1; + DLPRegion.enabled = true; } kasmpasswdpath[0] = '\0'; diff --git a/common/rfb/VNCServerST.h b/common/rfb/VNCServerST.h index 721e028..fee2517 100644 --- a/common/rfb/VNCServerST.h +++ b/common/rfb/VNCServerST.h @@ -148,7 +148,7 @@ namespace rfb { // the connection. enum queryResult { ACCEPT, REJECT, PENDING }; struct QueryConnectionHandler { - virtual ~QueryConnectionHandler() {} + virtual ~QueryConnectionHandler() = default; virtual queryResult queryConnection(network::Socket* sock, const char* userName, char** reason) = 0; From 4315f7d4467e40a68cce8513e1bc25c2ddb89a54 Mon Sep 17 00:00:00 2001 From: El Date: Thu, 10 Apr 2025 14:13:51 +0500 Subject: [PATCH 053/150] KASM-6984 Update test job tags in .gitlab-ci.yml --- .gitlab-ci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e104a69..7804399 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -276,13 +276,15 @@ build_ubuntu_focal_arm: test: stage: test tags: - - oci-fixed-amd + - kasmvnc-x86 before_script: - *prepare_build artifacts: reports: junit: SelfBench.xml script: + - bash wget https://kasmweb-build-artifacts.s3.us-east-1.amazonaws.com/kasmvnc/static/127072-737747495_small.mp4 + - bash ls -l - bash builder/test-vncserver #build_alpine_318: From 1495f7151bd74b98c02d3a0d5f317a105c0e14a9 Mon Sep 17 00:00:00 2001 From: El Date: Thu, 10 Apr 2025 15:06:30 +0500 Subject: [PATCH 054/150] KASM-6984 Added new dependencies: libavformat-dev and libswscale-dev --- builder/dockerfile.ubuntu_focal.build | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/builder/dockerfile.ubuntu_focal.build b/builder/dockerfile.ubuntu_focal.build index 03f5253..57c7373 100644 --- a/builder/dockerfile.ubuntu_focal.build +++ b/builder/dockerfile.ubuntu_focal.build @@ -13,7 +13,8 @@ RUN apt-get update && \ RUN apt-get update && apt-get install -y --no-install-recommends tzdata RUN apt-get update && apt-get -y build-dep xorg-server libxfont-dev RUN apt-get update && apt-get -y install ninja-build nasm git vim wget curl -RUN apt-get update && apt-get -y install libtbb-dev libpng-dev libtiff-dev libgif-dev libavcodec-dev libssl-dev libxrandr-dev libxcursor-dev +RUN apt-get update && apt-get -y install libtbb-dev libpng-dev libtiff-dev libgif-dev libavcodec-dev libssl-dev libxrandr-dev \ + libxcursor-dev libavformat-dev libswscale-dev ENV SCRIPTS_DIR=/tmp/scripts COPY builder/scripts $SCRIPTS_DIR From 5287c44e54816bdbaf36bc44c06b5289a139836a Mon Sep 17 00:00:00 2001 From: El Date: Mon, 31 Mar 2025 07:46:07 +0500 Subject: [PATCH 055/150] KASM-6984 Refactor GitLab CI to utilize job extensions and reduce redundancy --- .gitlab-ci.yml | 872 ++++++++++++++++++++++++++++++++++--------------- 1 file changed, 610 insertions(+), 262 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7804399..4017934 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -66,14 +66,18 @@ build_www: paths: - output/ -.base_build: +build_ubuntu_focal: stage: build allow_failure: true + tags: + - oci-fixed-amd before_script: - *prepare_build - *prepare_www after_script: - *prepare_artfacts + script: + - bash builder/build-package ubuntu focal; only: variables: - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME @@ -81,197 +85,444 @@ build_www: paths: - output/ -build_ubuntu_focal: - extends: - - .base_build - tags: - - oci-fixed-amd - script: - - bash builder/build-package ubuntu focal; - build_ubuntu_focal_arm: - extends: - - .base_build + stage: build + allow_failure: true tags: - oci-fixed-arm + before_script: + - *prepare_build + - *prepare_www + after_script: + - *prepare_artfacts script: - bash builder/build-package ubuntu focal; -# -#build_ubuntu_jammy: -# extends: -# - .base_build -# tags: -# - oci-fixed-amd -# script: -# - bash builder/build-package ubuntu jammy; -# -#build_ubuntu_jammy_arm: -# extends: -# - .base_build -# tags: -# - oci-fixed-arm -# script: -# - bash builder/build-package ubuntu jammy; -# -#build_ubuntu_noble: -# extends: -# - .base_build -# tags: -# - oci-fixed-amd -# script: -# - bash builder/build-package ubuntu noble; -# -#build_ubuntu_noble_arm: -# extends: -# - .base_build -# tags: -# - oci-fixed-arm -# script: -# - bash builder/build-package ubuntu noble; -# -#build_debian_bullseye: -# extends: -# - .base_build -# tags: -# - oci-fixed-amd -# script: -# - bash builder/build-package debian bullseye; -# -#build_debian_bullseye_arm: -# extends: -# - .base_build -# tags: -# - oci-fixed-arm -# script: -# - bash builder/build-package debian bullseye; -# -#build_debian_bookworm: -# extends: -# - .base_build -# tags: -# - oci-fixed-amd -# script: -# - bash builder/build-package debian bookworm; -# -#build_debian_bookworm_arm: -# extends: -# - .base_build -# tags: -# - oci-fixed-arm -# script: -# - bash builder/build-package debian bookworm; -# -#build_kali_rolling: -# extends: -# - .base_build -# tags: -# - oci-fixed-amd -# script: -# - bash builder/build-package kali kali-rolling; -# -#build_kali_rolling_arm: -# extends: -# - .base_build -# tags: -# - oci-fixed-arm -# script: -# - bash builder/build-package kali kali-rolling; -# -#build_oracle_8: -# extends: -# - .base_build -# tags: -# - oci-fixed-amd -# script: -# - bash builder/build-package oracle 8; -# -#build_oracle_8_arm: -# extends: -# - .base_build -# tags: -# - oci-fixed-arm -# script: -# - bash builder/build-package oracle 8; -# -#build_oracle_9: -# extends: -# - .base_build -# tags: -# - oci-fixed-amd -# script: -# - bash builder/build-package oracle 9; -# -#build_oracle_9_arm: -# extends: -# - .base_build -# tags: -# - oci-fixed-arm -# script: -# - bash builder/build-package oracle 9; -# -#build_opensuse_15: -# extends: -# - .base_build -# tags: -# - oci-fixed-amd -# script: -# - bash builder/build-package opensuse 15; -# -#build_opensuse_15_arm: -# extends: -# - .base_build -# tags: -# - oci-fixed-arm -# script: -# - bash builder/build-package opensuse 15; -# -#build_fedora_thirtynine: -# extends: -# - .base_build -# tags: -# - oci-fixed-amd -# script: -# - bash builder/build-package fedora thirtynine; -# -#build_fedora_thirtynine_arm: -# extends: -# - .base_build -# tags: -# - oci-fixed-arm -# script: -# - bash builder/build-package fedora thirtynine; -# -#build_fedora_forty: -# extends: -# - .base_build -# tags: -# - oci-fixed-amd -# script: -# - bash builder/build-package fedora forty; -# -#build_fedora_forty_arm: -# extends: -# - .base_build -# tags: -# - oci-fixed-arm -# script: -# - bash builder/build-package fedora forty; -# -#build_fedora_fortyone: -# extends: -# - .base_build -# tags: -# - oci-fixed-amd -# script: -# - bash builder/build-package fedora fortyone; -# -#build_fedora_fortyone_arm: -# extends: -# - .base_build -# tags: -# - oci-fixed-arm -# script: -# - bash builder/build-package fedora fortyone; + only: + variables: + - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME + artifacts: + paths: + - output/ + +build_ubuntu_jammy: + stage: build + allow_failure: true + tags: + - oci-fixed-amd + before_script: + - *prepare_build + - *prepare_www + after_script: + - *prepare_artfacts + script: + - bash builder/build-package ubuntu jammy; + only: + variables: + - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME + artifacts: + paths: + - output/ + +build_ubuntu_jammy_arm: + stage: build + allow_failure: true + tags: + - oci-fixed-arm + before_script: + - *prepare_build + - *prepare_www + after_script: + - *prepare_artfacts + script: + - bash builder/build-package ubuntu jammy; + only: + variables: + - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME + artifacts: + paths: + - output/ + +build_ubuntu_noble: + stage: build + allow_failure: true + tags: + - oci-fixed-amd + before_script: + - *prepare_build + - *prepare_www + after_script: + - *prepare_artfacts + script: + - bash builder/build-package ubuntu noble; + only: + variables: + - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME + artifacts: + paths: + - output/ + +build_ubuntu_noble_arm: + stage: build + allow_failure: true + tags: + - oci-fixed-arm + before_script: + - *prepare_build + - *prepare_www + after_script: + - *prepare_artfacts + script: + - bash builder/build-package ubuntu noble; + only: + variables: + - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME + artifacts: + paths: + - output/ + +build_debian_bullseye: + stage: build + allow_failure: true + tags: + - oci-fixed-amd + before_script: + - *prepare_build + - *prepare_www + after_script: + - *prepare_artfacts + script: + - bash builder/build-package debian bullseye; + only: + variables: + - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME + artifacts: + paths: + - output/ + +build_debian_bullseye_arm: + stage: build + allow_failure: true + tags: + - oci-fixed-arm + before_script: + - *prepare_build + - *prepare_www + after_script: + - *prepare_artfacts + script: + - bash builder/build-package debian bullseye; + only: + variables: + - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME + artifacts: + paths: + - output/ + + +build_debian_bookworm: + stage: build + allow_failure: true + tags: + - oci-fixed-amd + before_script: + - *prepare_build + - *prepare_www + after_script: + - *prepare_artfacts + script: + - bash builder/build-package debian bookworm; + only: + variables: + - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME + artifacts: + paths: + - output/ + +build_debian_bookworm_arm: + stage: build + allow_failure: true + tags: + - oci-fixed-arm + before_script: + - *prepare_build + - *prepare_www + after_script: + - *prepare_artfacts + script: + - bash builder/build-package debian bookworm; + only: + variables: + - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME + artifacts: + paths: + - output/ + +build_kali_rolling: + stage: build + allow_failure: true + tags: + - oci-fixed-amd + before_script: + - *prepare_build + - *prepare_www + after_script: + - *prepare_artfacts + script: + - bash builder/build-package kali kali-rolling; + only: + variables: + - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME + artifacts: + paths: + - output/ + +build_kali_rolling_arm: + stage: build + allow_failure: true + tags: + - oci-fixed-arm + before_script: + - *prepare_build + - *prepare_www + after_script: + - *prepare_artfacts + script: + - bash builder/build-package kali kali-rolling; + only: + variables: + - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME + artifacts: + paths: + - output/ + +build_oracle_8: + stage: build + allow_failure: true + tags: + - oci-fixed-amd + before_script: + - *prepare_build + - *prepare_www + after_script: + - *prepare_artfacts + script: + - bash builder/build-package oracle 8; + only: + variables: + - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME + artifacts: + paths: + - output/ + +build_oracle_8_arm: + stage: build + allow_failure: true + tags: + - oci-fixed-arm + before_script: + - *prepare_build + - *prepare_www + after_script: + - *prepare_artfacts + script: + - bash builder/build-package oracle 8; + only: + variables: + - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME + artifacts: + paths: + - output/ + +build_oracle_9: + stage: build + allow_failure: true + tags: + - oci-fixed-amd + before_script: + - *prepare_build + - *prepare_www + after_script: + - *prepare_artfacts + script: + - bash builder/build-package oracle 9; + only: + variables: + - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME + artifacts: + paths: + - output/ + +build_oracle_9_arm: + stage: build + allow_failure: true + tags: + - oci-fixed-arm + before_script: + - *prepare_build + - *prepare_www + after_script: + - *prepare_artfacts + script: + - bash builder/build-package oracle 9; + only: + variables: + - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME + artifacts: + paths: + - output/ + +build_opensuse_15: + stage: build + allow_failure: true + tags: + - oci-fixed-amd + before_script: + - *prepare_build + - *prepare_www + after_script: + - *prepare_artfacts + script: + - bash builder/build-package opensuse 15; + only: + variables: + - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME + artifacts: + paths: + - output/ + +build_opensuse_15_arm: + stage: build + allow_failure: true + tags: + - oci-fixed-arm + before_script: + - *prepare_build + - *prepare_www + after_script: + - *prepare_artfacts + script: + - bash builder/build-package opensuse 15; + only: + variables: + - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME + artifacts: + paths: + - output/ + +build_fedora_thirtynine: + stage: build + allow_failure: true + tags: + - oci-fixed-amd + before_script: + - *prepare_build + - *prepare_www + after_script: + - *prepare_artfacts + script: + - bash builder/build-package fedora thirtynine; + only: + variables: + - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME + artifacts: + paths: + - output/ + +build_fedora_thirtynine_arm: + stage: build + allow_failure: true + tags: + - oci-fixed-arm + before_script: + - *prepare_build + - *prepare_www + after_script: + - *prepare_artfacts + script: + - bash builder/build-package fedora thirtynine; + only: + variables: + - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME + artifacts: + paths: + - output/ + +build_fedora_forty: + stage: build + allow_failure: true + tags: + - oci-fixed-amd + before_script: + - *prepare_build + - *prepare_www + after_script: + - *prepare_artfacts + script: + - bash builder/build-package fedora forty; + only: + variables: + - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME + artifacts: + paths: + - output/ + +build_fedora_forty_arm: + stage: build + allow_failure: true + tags: + - oci-fixed-arm + before_script: + - *prepare_build + - *prepare_www + after_script: + - *prepare_artfacts + script: + - bash builder/build-package fedora forty; + only: + variables: + - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME + artifacts: + paths: + - output/ + +build_fedora_fortyone: + stage: build + allow_failure: true + tags: + - oci-fixed-amd + before_script: + - *prepare_build + - *prepare_www + after_script: + - *prepare_artfacts + script: + - bash builder/build-package fedora fortyone; + only: + variables: + - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME + artifacts: + paths: + - output/ + +build_fedora_fortyone_arm: + stage: build + allow_failure: true + tags: + - oci-fixed-arm + before_script: + - *prepare_build + - *prepare_www + after_script: + - *prepare_artfacts + script: + - bash builder/build-package fedora fortyone; + only: + variables: + - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME + artifacts: + paths: + - output/ + test: stage: test @@ -281,67 +532,164 @@ test: - *prepare_build artifacts: reports: - junit: SelfBench.xml + junit: + - SelfBench.xml + - Benchmark.xml script: - - bash wget https://kasmweb-build-artifacts.s3.us-east-1.amazonaws.com/kasmvnc/static/127072-737747495_small.mp4 - - bash ls -l - bash builder/test-vncserver -#build_alpine_318: -# extends: .base_build -# tags: -# - oci-fixed-amd -# script: -# - bash builder/build-package alpine 318; -# -#build_alpine_318_arm: -# extends: .base_build -# tags: -# - oci-fixed-arm -# script: -# - bash builder/build-package alpine 318; -# -#build_alpine_319: -# extends: .base_build -# tags: -# - oci-fixed-amd -# script: -# - bash builder/build-package alpine 319; -# -#build_alpine_319_arm: -# extends: .base_build -# tags: -# - oci-fixed-arm -# script: -# - bash builder/build-package alpine 319; -# -#build_alpine_320: -# extends: .base_build -# tags: -# - oci-fixed-amd -# script: -# - bash builder/build-package alpine 320; -# -#build_alpine_320_arm: -# extends: .base_build -# tags: -# - oci-fixed-arm -# script: -# - bash builder/build-package alpine 320; -# -#build_alpine_321: -# extends: .base_build -# tags: -# - oci-fixed-amd -# script: -# - bash builder/build-package alpine 321; -# -#build_alpine_321_arm: -# extends: .base_build -# tags: -# - oci-fixed-arm -# script: -# - bash builder/build-package alpine 321; + +build_alpine_318: + stage: build + allow_failure: true + tags: + - oci-fixed-amd + before_script: + - *prepare_build + - *prepare_www + after_script: + - *prepare_artfacts + script: + - bash builder/build-package alpine 318; + only: + variables: + - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME + artifacts: + paths: + - output/ + +build_alpine_318_arm: + stage: build + allow_failure: true + tags: + - oci-fixed-arm + before_script: + - *prepare_build + - *prepare_www + after_script: + - *prepare_artfacts + script: + - bash builder/build-package alpine 318; + only: + variables: + - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME + artifacts: + paths: + - output/ + +build_alpine_319: + stage: build + allow_failure: true + tags: + - oci-fixed-amd + before_script: + - *prepare_build + - *prepare_www + after_script: + - *prepare_artfacts + script: + - bash builder/build-package alpine 319; + only: + variables: + - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME + artifacts: + paths: + - output/ + +build_alpine_319_arm: + stage: build + allow_failure: true + tags: + - oci-fixed-arm + before_script: + - *prepare_build + - *prepare_www + after_script: + - *prepare_artfacts + script: + - bash builder/build-package alpine 319; + only: + variables: + - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME + artifacts: + paths: + - output/ + +build_alpine_320: + stage: build + allow_failure: true + tags: + - oci-fixed-amd + before_script: + - *prepare_build + - *prepare_www + after_script: + - *prepare_artfacts + script: + - bash builder/build-package alpine 320; + only: + variables: + - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME + artifacts: + paths: + - output/ + +build_alpine_320_arm: + stage: build + allow_failure: true + tags: + - oci-fixed-arm + before_script: + - *prepare_build + - *prepare_www + after_script: + - *prepare_artfacts + script: + - bash builder/build-package alpine 320; + only: + variables: + - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME + artifacts: + paths: + - output/ + +build_alpine_321: + stage: build + allow_failure: true + tags: + - oci-fixed-amd + before_script: + - *prepare_build + - *prepare_www + after_script: + - *prepare_artfacts + script: + - bash builder/build-package alpine 321; + only: + variables: + - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME + artifacts: + paths: + - output/ + +build_alpine_321_arm: + stage: build + allow_failure: true + tags: + - oci-fixed-arm + before_script: + - *prepare_build + - *prepare_www + after_script: + - *prepare_artfacts + script: + - bash builder/build-package alpine 321; + only: + variables: + - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME + artifacts: + paths: + - output/ upload: stage: upload @@ -357,33 +705,33 @@ upload: - prepare_to_run_scripts_and_s3_uploads - S3_CRASHPAD_BUILD_DIRECTORY="kasmvnc/crashpad/${CI_COMMIT_SHA}" - for dbgsym_package in `find output/ -type f -name '*dbgsym*deb'`; do - deb_package=$(find_deb_package "$dbgsym_package"); - xvnc_md5sum=$(fetch_xvnc_md5sum "$deb_package"); - upload_filename="${S3_CRASHPAD_BUILD_DIRECTORY}/${xvnc_md5sum}/kasmvncserver-dbgsym.deb"; - echo; - echo "File to upload $upload_filename"; - upload_to_s3 "$dbgsym_package" "$upload_filename" "$S3_BUCKET"; - rm "$dbgsym_package"; + deb_package=$(find_deb_package "$dbgsym_package"); + xvnc_md5sum=$(fetch_xvnc_md5sum "$deb_package"); + upload_filename="${S3_CRASHPAD_BUILD_DIRECTORY}/${xvnc_md5sum}/kasmvncserver-dbgsym.deb"; + echo; + echo "File to upload $upload_filename"; + upload_to_s3 "$dbgsym_package" "$upload_filename" "$S3_BUCKET"; + rm "$dbgsym_package"; done - export S3_BUILD_DIRECTORY="kasmvnc/${CI_COMMIT_SHA}" - export RELEASE_VERSION=$(.ci/next_release_version "$CI_COMMIT_REF_NAME") - uploaded_files=() - for package in `find output/ -type f -name '*.deb' -or -name '*.rpm' -or -name '*.apk'`; do - prepare_upload_filename "$package"; - upload_filename="${S3_BUILD_DIRECTORY}/$upload_filename"; - echo; - echo "File to upload $upload_filename"; - upload_to_s3 "$package" "$upload_filename" "$S3_BUCKET"; - UPLOAD_NAME=$(basename $upload_filename | sed 's#kasmvncserver_##' | sed -r 's#_([0-9]{1,3}\.){2}[0-9]{1,2}_\S+?([a-f0-9]{6})##' | sed -r 's#\.(deb|rpm|tgz)##'); - curl --request POST --header "PRIVATE-TOKEN:${GITLAB_API_TOKEN}" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/statuses/${CI_COMMIT_SHA}?state=success&name=${UPLOAD_NAME}&target_url=${S3_URL}"; - uploaded_files+=("$upload_filename"); + prepare_upload_filename "$package"; + upload_filename="${S3_BUILD_DIRECTORY}/$upload_filename"; + echo; + echo "File to upload $upload_filename"; + upload_to_s3 "$package" "$upload_filename" "$S3_BUCKET"; + UPLOAD_NAME=$(basename $upload_filename | sed 's#kasmvncserver_##' | sed -r 's#_([0-9]{1,3}\.){2}[0-9]{1,2}_\S+?([a-f0-9]{6})##' | sed -r 's#\.(deb|rpm|tgz)##'); + curl --request POST --header "PRIVATE-TOKEN:${GITLAB_API_TOKEN}" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/statuses/${CI_COMMIT_SHA}?state=success&name=${UPLOAD_NAME}&target_url=${S3_URL}"; + uploaded_files+=("$upload_filename"); done - make_index_html "${uploaded_files[@]}" > output/index.html; upload_build_preview: stage: upload - needs: [ "upload" ] - dependencies: [ "upload" ] + needs: ["upload"] + dependencies: ["upload"] image: ubuntu:focal tags: - oci-fixed-amd From 624cb28b5233bac832c29e9538aac47993d8b264 Mon Sep 17 00:00:00 2001 From: El Date: Mon, 7 Apr 2025 18:56:24 +0500 Subject: [PATCH 056/150] KASM-6984 Add extended benchmark parameter to Server class Introduce a new "benchmark" boolean parameter in the Server class to enable extended benchmarking functionality. This complements the existing self-benchmark feature, providing more comprehensive performance testing options. --- common/rfb/ServerCore.cxx | 4 ++-- common/rfb/ServerCore.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/common/rfb/ServerCore.cxx b/common/rfb/ServerCore.cxx index 97aa875..0921665 100644 --- a/common/rfb/ServerCore.cxx +++ b/common/rfb/ServerCore.cxx @@ -117,10 +117,10 @@ rfb::BoolParameter rfb::Server::selfBench ("SelfBench", "Run self-benchmarks and exit.", false); -rfb::BoolParameter rfb::Server::benchmark ( +rfb::StringParameter rfb::Server::benchmark ( "Benchmark", "Run extended benchmarks and exit.", - false); + "video.mp4"); rfb::IntParameter rfb::Server::dynamicQualityMin ("DynamicQualityMin", "The minimum dynamic JPEG quality, 0 = low, 9 = high", diff --git a/common/rfb/ServerCore.h b/common/rfb/ServerCore.h index aeae07f..a64fc21 100644 --- a/common/rfb/ServerCore.h +++ b/common/rfb/ServerCore.h @@ -88,7 +88,7 @@ namespace rfb { static BoolParameter detectHorizontal; static BoolParameter ignoreClientSettingsKasm; static BoolParameter selfBench; - static BoolParameter benchmark; + static StringParameter benchmark; static PresetParameter preferBandwidth; static IntParameter webpEncodingTime; }; From f90db82efea55d53d5ceadf863d037cafbd6ac26 Mon Sep 17 00:00:00 2001 From: El Date: Tue, 8 Apr 2025 04:44:57 +0500 Subject: [PATCH 057/150] KASM-6984 Add benchmark utility with FFmpeg integration for video handling --- common/rfb/VNCServerST.cxx | 12 ++++++------ common/rfb/benchmark.cxx | 11 +++++++++-- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/common/rfb/VNCServerST.cxx b/common/rfb/VNCServerST.cxx index 4106125..b1ef22f 100644 --- a/common/rfb/VNCServerST.cxx +++ b/common/rfb/VNCServerST.cxx @@ -129,15 +129,15 @@ static void parseRegionPart(const bool percents, rdr::U16 &pcdest, int &dest, *inptr = ptr; } -VNCServerST::VNCServerST(const char* name_, SDesktop* desktop_) +VNCServerST::VNCServerST(const char* name_, SDesktop* desktop_, bool a) : blHosts(&blacklist), desktop(desktop_), desktopStarted(false), - blockCounter(0), pb(0), blackedpb(0), ledState(ledUnknown), - name(strDup(name_)), pointerClient(0), clipboardClient(0), - comparer(0), cursor(new Cursor(0, 0, Point(), NULL)), + blockCounter(0), pb(nullptr), blackedpb(nullptr), ledState(ledUnknown), + name(strDup(name_)), pointerClient(nullptr), clipboardClient(nullptr), + comparer(nullptr), cursor(new Cursor(0, 0, Point(), nullptr)), renderedCursorInvalid(false), - queryConnectionHandler(0), keyRemapper(&KeyRemapper::defInstance), + queryConnectionHandler(nullptr), keyRemapper(&KeyRemapper::defInstance), lastConnectionTime(0), disableclients(false), - frameTimer(this), apimessager(NULL), trackingFrameStats(0), + frameTimer(this), apimessager(nullptr), trackingFrameStats(0), clipboardId(0), sendWatermark(false) { lastUserInputTime = lastDisconnectTime = time(0); diff --git a/common/rfb/benchmark.cxx b/common/rfb/benchmark.cxx index ce0019a..d80c2ed 100644 --- a/common/rfb/benchmark.cxx +++ b/common/rfb/benchmark.cxx @@ -94,6 +94,13 @@ void benchmark(const std::string &path) { rgb_frame->width = codec_ctx->width; rgb_frame->height = codec_ctx->height; + static const rfb::PixelFormat pf{32, 24, false, true, 0xFF, 0xFF, 0xFF, 0, 8, 16}; + const rfb::Rect rect{0, 0, rgb_frame->width, rgb_frame->height}; + + rfb::ManagedPixelBuffer pb{pf, rect.width(), rect.height()}; + + server->setPixelBuffer(&pb); + if (av_frame_get_buffer(rgb_frame, 0) != 0) throw std::runtime_error("Could not allocate frame data"); @@ -105,8 +112,8 @@ void benchmark(const std::string &path) { sws_scale(sws_ctx, frame->data, frame->linesize, 0, frame->height, rgb_frame->data, rgb_frame->linesize); - // Save as BMP - // saveFrameAsBMP(rgb_frame, ++frameNumber); + + pb.imageRect(rect, rgb_frame->data[0], rect.width()); } } } From 092d1cbdf5a523dde16afe793dacd16135a6bce5 Mon Sep 17 00:00:00 2001 From: El Date: Thu, 10 Apr 2025 14:10:53 +0500 Subject: [PATCH 058/150] KASM-6984 Enhance benchmarking with detailed stats and desktop updates Use modern C++ idioms and fix member initialization --- common/rfb/ServerCore.cxx | 18 +-- common/rfb/VNCServerST.cxx | 6 +- common/rfb/benchmark.cxx | 123 ++++++++++++++-- common/rfb/benchmark.h | 289 ++++++++++++++++++++++++++++++++++--- 4 files changed, 394 insertions(+), 42 deletions(-) diff --git a/common/rfb/ServerCore.cxx b/common/rfb/ServerCore.cxx index 0921665..bc5a4bd 100644 --- a/common/rfb/ServerCore.cxx +++ b/common/rfb/ServerCore.cxx @@ -32,15 +32,15 @@ rfb::IntParameter rfb::Server::idleTimeout 0, 0); rfb::IntParameter rfb::Server::maxDisconnectionTime ("MaxDisconnectionTime", - "Terminate when no client has been connected for s seconds", + "Terminate when no client has been connected for s seconds", 0, 0); rfb::IntParameter rfb::Server::maxConnectionTime ("MaxConnectionTime", - "Terminate when a client has been connected for s seconds", + "Terminate when a client has been connected for s seconds", 0, 0); rfb::IntParameter rfb::Server::maxIdleTime ("MaxIdleTime", - "Terminate after s seconds of user inactivity", + "Terminate after s seconds of user inactivity", 0, 0); rfb::IntParameter rfb::Server::clientWaitTimeMillis ("ClientWaitTimeMillis", @@ -117,10 +117,10 @@ rfb::BoolParameter rfb::Server::selfBench ("SelfBench", "Run self-benchmarks and exit.", false); -rfb::StringParameter rfb::Server::benchmark ( +rfb::StringParameter rfb::Server::benchmark( "Benchmark", "Run extended benchmarks and exit.", - "video.mp4"); + ""); rfb::IntParameter rfb::Server::dynamicQualityMin ("DynamicQualityMin", "The minimum dynamic JPEG quality, 0 = low, 9 = high", @@ -275,16 +275,16 @@ rfb::IntParameter rfb::Server::udpFullFrameFrequency ("udpFullFrameFrequency", "Send a full frame every N frames for clients using UDP. 0 to disable", 0, 0, 1000); - + rfb::IntParameter rfb::Server::udpPort ("udpPort", "Which port to use for UDP. Default same as websocket", 0, 0, 65535); static void bandwidthPreset() { - rfb::Server::dynamicQualityMin.setParam(2); - rfb::Server::dynamicQualityMax.setParam(9); - rfb::Server::treatLossless.setParam(8); + rfb::Server::dynamicQualityMin.setParam(2); + rfb::Server::dynamicQualityMax.setParam(9); + rfb::Server::treatLossless.setParam(8); } rfb::PresetParameter rfb::Server::preferBandwidth diff --git a/common/rfb/VNCServerST.cxx b/common/rfb/VNCServerST.cxx index b1ef22f..ab6619c 100644 --- a/common/rfb/VNCServerST.cxx +++ b/common/rfb/VNCServerST.cxx @@ -129,7 +129,7 @@ static void parseRegionPart(const bool percents, rdr::U16 &pcdest, int &dest, *inptr = ptr; } -VNCServerST::VNCServerST(const char* name_, SDesktop* desktop_, bool a) +VNCServerST::VNCServerST(const char* name_, SDesktop* desktop_) : blHosts(&blacklist), desktop(desktop_), desktopStarted(false), blockCounter(0), pb(nullptr), blackedpb(nullptr), ledState(ledUnknown), name(strDup(name_)), pointerClient(nullptr), clipboardClient(nullptr), @@ -232,9 +232,9 @@ VNCServerST::VNCServerST(const char* name_, SDesktop* desktop_, bool a) if (Server::selfBench) SelfBench(); - if (Server::benchmark) { + if (Server::benchmark[0]) { auto *file_name = Server::benchmark.getValueStr(); - if (std::filesystem::exists(file_name)) + if (!std::filesystem::exists(file_name)) throw Exception("Benchmarking video file does not exist"); benchmark(file_name); } diff --git a/common/rfb/benchmark.cxx b/common/rfb/benchmark.cxx index d80c2ed..a7e0cbf 100644 --- a/common/rfb/benchmark.cxx +++ b/common/rfb/benchmark.cxx @@ -20,12 +20,14 @@ #include #include #include -#include "VNCServer.h" - -static rfb::LogWriter vlog("Benchmarking"); +#include +#include void benchmark(const std::string &path) { AVFormatContext *format_ctx = nullptr; + + vlog.info("Benchmarking with video file %s", path.c_str()); + if (avformat_open_input(&format_ctx, path.c_str(), nullptr, nullptr) < 0) throw std::runtime_error("Could not open video file"); @@ -53,7 +55,7 @@ void benchmark(const std::string &path) { if (!codec) throw std::runtime_error("Codec not found"); - CodecCtxGuard codex_ctx_guard{avcodec_alloc_context3(codec)}; + const CodecCtxGuard codex_ctx_guard{avcodec_alloc_context3(codec)}; auto *codec_ctx = codex_ctx_guard.get(); if (!codec_ctx || avcodec_parameters_to_context(codec_ctx, codec_parameters) < 0) @@ -63,10 +65,10 @@ void benchmark(const std::string &path) { throw std::runtime_error("Could not open codec"); // Allocate frame and packet - FrameGuard frame_guard{av_frame_alloc()}; + const FrameGuard frame_guard{av_frame_alloc()}; auto *frame = frame_guard.get(); - PacketGuard packet_guard{av_packet_alloc()}; + const PacketGuard packet_guard{av_packet_alloc()}; auto *packet = packet_guard.get(); if (!frame || !packet) @@ -84,7 +86,7 @@ void benchmark(const std::string &path) { SwsContextGuard sws_ctx_guard{sws_ctx}; - FrameGuard rgb_frame_guard{av_frame_alloc()}; + const FrameGuard rgb_frame_guard{av_frame_alloc()}; auto *rgb_frame = rgb_frame_guard.get(); if (!rgb_frame) @@ -95,15 +97,19 @@ void benchmark(const std::string &path) { rgb_frame->height = codec_ctx->height; static const rfb::PixelFormat pf{32, 24, false, true, 0xFF, 0xFF, 0xFF, 0, 8, 16}; - const rfb::Rect rect{0, 0, rgb_frame->width, rgb_frame->height}; - rfb::ManagedPixelBuffer pb{pf, rect.width(), rect.height()}; - - server->setPixelBuffer(&pb); + auto *pb = new rfb::ManagedPixelBuffer{pf, rgb_frame->width, rgb_frame->height}; + rfb::MockCConnection connection{pb}; if (av_frame_get_buffer(rgb_frame, 0) != 0) throw std::runtime_error("Could not allocate frame data"); + uint64_t frames{}; + const size_t total_frame_count = format_ctx->streams[video_stream_idx]->nb_frames; + + std::vector timings(total_frame_count > 0 ? total_frame_count : 2048, 0); + + vlog.info("Reading frames..."); while (av_read_frame(format_ctx, packet) == 0) { if (packet->stream_index == video_stream_idx) { if (avcodec_send_packet(codec_ctx, packet) == 0) { @@ -112,11 +118,104 @@ void benchmark(const std::string &path) { sws_scale(sws_ctx, frame->data, frame->linesize, 0, frame->height, rgb_frame->data, rgb_frame->linesize); + vlog.info("Updating with frame %lu", frames); + connection.framebufferUpdateStart(); + vlog.info("Setting frame"); + connection.setNewFrame(rgb_frame); + using namespace std::chrono; - pb.imageRect(rect, rgb_frame->data[0], rect.width()); + auto now = high_resolution_clock::now(); + vlog.info("Updating frame..."); + connection.framebufferUpdateEnd(); + const auto duration = duration_cast(high_resolution_clock::now() - now).count(); + + vlog.info("Frame took %lu ns", duration); + + auto [jpeg_stats, webp_stats, bytes, udp_bytes] = connection.getStats(); + vlog.info("JPEG stats: %d ms", jpeg_stats.ms); + vlog.info("JPEG stats: %d rects", jpeg_stats.rects); + + vlog.info("WebP stats: %d ms", webp_stats.ms); + vlog.info("WebP stats: %d rects", webp_stats.rects); + + + timings[frames++] = duration; } } } av_packet_unref(packet); } + vlog.info("Done reading frames..."); + + if (frames > 0) { + timings.reserve(frames + 1); + + const auto sum = std::accumulate(timings.begin(), timings.end(), 0.); + const auto size = timings.size(); + const auto average = sum / static_cast(size); + + double median{}; + + std::sort(timings.begin(), timings.end()); + if (size % 2 == 0) + median = static_cast(timings[size / 2]); + else + median = static_cast(timings[size / 2 - 1] + timings[size / 2]) / 2.; + + auto [jpeg_stats, webp_stats, bytes, udp_bytes] = connection.getStats(); + + vlog.info("Average time encoding frame: %f ns", average); + vlog.info("Median time encoding frame: %f ns", median); + vlog.info("Total time: %f ns", sum); + + tinyxml2::XMLDocument doc; + + auto *test_suit = doc.NewElement("testsuite"); + test_suit->SetAttribute("name", "Benchmark"); + + doc.InsertFirstChild(test_suit); + + auto *test_case = doc.NewElement("testcase"); + test_case->SetAttribute("name", "Average time encoding frame, ms"); + test_case->SetAttribute("time", average / 1000); + test_case->SetAttribute("runs", 1); + test_case->SetAttribute("classname", "KasmVNC"); + test_suit->InsertEndChild(test_case); + + test_case = doc.NewElement("testcase"); + test_case->SetAttribute("name", "Median time encoding frame, ms"); + test_case->SetAttribute("time", average / 1000); + test_case->SetAttribute("runs", 1); + test_case->SetAttribute("classname", "KasmVNC"); + test_suit->InsertEndChild(test_case); + + test_case = doc.NewElement("testcase"); + test_case->SetAttribute("name", "Total time encoding, ms"); + test_case->SetAttribute("time", sum); + test_case->SetAttribute("runs", 1); + test_case->SetAttribute("classname", "KasmVNC"); + test_suit->InsertEndChild(test_case); + + test_case = doc.NewElement("testcase"); + test_case->SetAttribute("name", "KBytes sent"); + test_case->SetAttribute("time", bytes / 1024); + test_case->SetAttribute("runs", 1); + test_case->SetAttribute("classname", "KasmVNC"); + test_suit->InsertEndChild(test_case); + + test_case = doc.NewElement("testcase"); + test_case->SetAttribute("name", "KBytes sent (UDP)"); + test_case->SetAttribute("time", udp_bytes / 1024); + test_case->SetAttribute("runs", 1); + test_case->SetAttribute("classname", "KasmVNC"); + test_suit->InsertEndChild(test_case); + + test_suit->SetAttribute("tests", 5); + test_suit->SetAttribute("failures", 0); + //test_suit->SetAttribute("time", total_time); + + doc.SaveFile("Benchmark.xml"); + } + + exit(0); } diff --git a/common/rfb/benchmark.h b/common/rfb/benchmark.h index 61edae5..375fd8c 100644 --- a/common/rfb/benchmark.h +++ b/common/rfb/benchmark.h @@ -18,16 +18,29 @@ #pragma once -#include "Timer.h" #include +#include #include +#include "CConnection.h" +#include "CMsgReader.h" +#include "EncCache.h" +#include "EncodeManager.h" +#include "LogWriter.h" +#include "SMsgWriter.h" + +namespace rdr { + class FileInStream; +} + extern "C" { #include #include #include } +static rfb::LogWriter vlog("Benchmarking"); + struct AVFormatContextDeleter { void operator()(AVFormatContext *ctx) const { avformat_close_input(&ctx); @@ -64,39 +77,279 @@ using FrameGuard = std::unique_ptr; using SwsContextGuard = std::unique_ptr; using PacketGuard = std::unique_ptr; + namespace rfb { - class BenchmarkServer : public VNCServer, public Timer::Callback { + class MockBufferStream : public rdr::BufferedInStream { + bool fillBuffer(size_t maxSize, bool wait) override { + return true; + } + }; + + class MockStream final : public rdr::OutStream { public: - bool handleTimeout(Timer *t) override; + MockStream() { + offset = 0; + ptr = buf; + end = buf + sizeof(buf); + } - void add_changed(const Region ®ion) override; + private: + void overrun(size_t needed) override { + flush(); - void add_copied(const Region &dest, const Point &delta) override; + /*if (itemSize * nItems > end - ptr) + nItems = (end - ptr) / itemSize; + return nItems;*/ + } - void blockUpdates() override; + public: + size_t length() override { + flush(); + return offset; + } - void unblockUpdates() override; + void flush() override { + offset += ptr - buf; + ptr = buf; + } - void setPixelBuffer(PixelBuffer *pb, const ScreenSet &layout) override; + private: + ptrdiff_t offset; + rdr::U8 buf[131072]{}; + }; - void setPixelBuffer(PixelBuffer *pb) override; + class MockSConnection : public SConnection { + public: + MockSConnection() { + setStreams(nullptr, &out); - void setScreenLayout(const ScreenSet &layout) override; + setWriter(new SMsgWriter(&cp, &out, &udps)); + } - [[nodiscard]] PixelBuffer *getPixelBuffer() const override; + ~MockSConnection() override = default; - void announceClipboard(bool available) override; + void writeUpdate(const UpdateInfo &ui, const rfb::PixelBuffer *pb) { + vlog.info("Writing update"); + // Drop any lossy tracking that is now outside the framebuffer + //manager.pruneLosslessRefresh(Region(pb->getRect())); - void bell() override; + bytes += out.length(); + udp_bytes += udps.length(); - void closeClients(const char *reason) override; + vlog.info("bytes written: %lu", bytes); + vlog.info("udp bytes written: %lu", udp_bytes); - void setCursor(int width, int height, const Point &hotspot, const rdr::U8 *cursorData, bool resizing) override; + cache.clear(); + manager.writeUpdate(ui, pb, nullptr); + } - void setCursorPos(const Point &p, bool warped) override; + virtual void setAccessRights(AccessRights ar) { + } - void setName(const char *name) override; + void setDesktopSize(int fb_width, int fb_height, + const rfb::ScreenSet &layout) override { + cp.width = fb_width; + cp.height = fb_height; + cp.screenLayout = layout; - void setLEDState(unsigned state) override; + writer()->writeExtendedDesktopSize(); + writer()->writeSetDesktopSize(); + } + + void sendStats(const bool toClient) override { + } + + [[nodiscard]] bool canChangeKasmSettings() const override { + return false; + } + + void udpUpgrade(const char *resp) override { + } + + void udpDowngrade(const bool) override { + } + + void subscribeUnixRelay(const char *name) override { + } + + void unixRelay(const char *name, const rdr::U8 *buf, const unsigned len) override { + } + + void handleFrameStats(rdr::U32 all, rdr::U32 render) override { + } + + [[nodiscard]] auto getJpegStats() const { + return manager.jpegstats; + } + + [[nodiscard]] auto getWebPStats() const { + return manager.webpstats; + } + + uint64_t bytes; + uint64_t udp_bytes; + + protected: + MockStream out{}; + MockStream udps{}; + + EncCache cache{}; + EncodeManager manager{this, &cache}; + }; + + static constexpr rdr::S32 encodings[] = { + pseudoEncodingWEBP, + pseudoEncodingJpegVideoQualityLevel0, + pseudoEncodingJpegVideoQualityLevel9, + pseudoEncodingWebpVideoQualityLevel0, + pseudoEncodingWebpVideoQualityLevel9, + pseudoEncodingTreatLosslessLevel0, + pseudoEncodingTreatLosslessLevel10, + pseudoEncodingPreferBandwidth, + pseudoEncodingDynamicQualityMinLevel0, + pseudoEncodingDynamicQualityMinLevel9, + pseudoEncodingDynamicQualityMaxLevel0, + pseudoEncodingDynamicQualityMaxLevel9, + pseudoEncodingVideoAreaLevel1, + pseudoEncodingVideoAreaLevel100, + pseudoEncodingVideoTimeLevel0, + pseudoEncodingVideoTimeLevel100, + + pseudoEncodingFrameRateLevel10, + pseudoEncodingFrameRateLevel60, + pseudoEncodingMaxVideoResolution, + pseudoEncodingVideoScalingLevel0, + pseudoEncodingVideoScalingLevel9, + pseudoEncodingVideoOutTimeLevel1, + pseudoEncodingVideoOutTimeLevel100, + pseudoEncodingQOI + }; + + class MockCConnection final : public CConnection { + public: + explicit MockCConnection(ManagedPixelBuffer *pb) { + setStreams(&in, nullptr); + + // Need to skip the initial handshake and ServerInit + setState(RFBSTATE_NORMAL); + // That also means that the reader and writer weren't setup + setReader(new rfb::CMsgReader(this, &in)); + auto &pf = pb->getPF(); + CMsgHandler::setPixelFormat(pf); + + MockCConnection::setDesktopSize(pb->width(), pb->height()); + setFramebuffer(pb); + + cp.setPF(pf); + + sc.cp.setPF(pf); + sc.setEncodings(std::size(encodings), encodings); + } + + void setCursor(int width, int height, const Point &hotspot, const rdr::U8 *data, const bool resizing) override { + } + + ~MockCConnection() override = default; + + + struct stats_t { + EncodeManager::codecstats_t jpeg_stats; + EncodeManager::codecstats_t webp_stats; + uint64_t bytes; + uint64_t udp_bytes; + }; + + [[nodiscard]] stats_t getStats() const { + return { + sc.getJpegStats(), + sc.getWebPStats(), + sc.bytes, + sc.udp_bytes + }; + } + + void setDesktopSize(int w, int h) override { + CConnection::setDesktopSize(w, h); + + if (screen_layout.num_screens()) + screen_layout.remove_screen(0); + + screen_layout.add_screen(Screen(0, 0, 0, w, h, 0)); + //cp.screenLayout = screen_layout; + //sc.setDesktopSize(w, h, screen_layout); + vlog.info("setDesktopSize"); + } + + void setNewFrame(const AVFrame *frame) { + auto *pb = getFramebuffer(); + const int width = pb->width(); + const int height = pb->height(); + const rfb::Rect rect(0, 0, width, height); + + int dstStride; + auto *buffer = pb->getBufferRW(rect, &dstStride); + + const PixelFormat &pf = pb->getPF(); + + // Source data and stride from FFmpeg + const auto *srcData = frame->data[0]; + const int srcStride = frame->linesize[0] / 3; // Convert bytes to pixels + + vlog.info("Frame stride %d", srcStride); + + // Convert from RGB format to the PixelBuffer's format + pf.bufferFromRGB(buffer, srcData, width, srcStride, height); + + // Commit changes + pb->commitBufferRW(rect); + } + + void framebufferUpdateStart() override { + CConnection::framebufferUpdateStart(); + + updates.clear(); + } + + void framebufferUpdateEnd() override { + const PixelBuffer *pb = getFramebuffer(); + + UpdateInfo ui; + + const Region clip(pb->getRect()); + + CConnection::framebufferUpdateEnd(); + + //updates.add_changed(pb->getRect()); + updates.getUpdateInfo(&ui, clip); + vlog.info("%d", ui.changed.numRects()); + vlog.info("%d", ui.copied.numRects()); + vlog.info("%lu", ui.copypassed.size()); + sc.writeUpdate(ui, pb); + } + + void dataRect(const Rect &r, int encoding) override { + CConnection::dataRect(r, encoding); + + if (encoding != encodingCopyRect) // FIXME + updates.add_changed(Region(r)); + } + + void setColourMapEntries(int, int, rdr::U16 *) override { + } + + void bell() override { + } + + void serverCutText(const char *, rdr::U32) override { + } + + void serverCutText(const char *str) override { + } + + protected: + MockBufferStream in; + ScreenSet screen_layout; + SimpleUpdateTracker updates; + MockSConnection sc; }; } From ba218f1a26074941d2418f16fc1ce76961ed7bdb Mon Sep 17 00:00:00 2001 From: El Date: Thu, 10 Apr 2025 14:13:51 +0500 Subject: [PATCH 059/150] KASM-6984 Update test job tags in .gitlab-ci.yml --- .gitlab-ci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4017934..2a99d59 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -108,7 +108,7 @@ build_ubuntu_jammy: stage: build allow_failure: true tags: - - oci-fixed-amd + - kasmvnc-x86 before_script: - *prepare_build - *prepare_www @@ -536,6 +536,8 @@ test: - SelfBench.xml - Benchmark.xml script: + - bash wget https://kasmweb-build-artifacts.s3.us-east-1.amazonaws.com/kasmvnc/static/127072-737747495_small.mp4 + - bash ls -l - bash builder/test-vncserver From 666ffc210219a717db2c023c1d20ed50e1d7e81a Mon Sep 17 00:00:00 2001 From: El Date: Thu, 10 Apr 2025 15:06:30 +0500 Subject: [PATCH 060/150] KASM-6984 Add FFmpeg libraries to Ubuntu focal build dependencies. Added new dependencies: libavformat-dev and libswscale-dev --- builder/dockerfile.ubuntu_focal.deb.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builder/dockerfile.ubuntu_focal.deb.build b/builder/dockerfile.ubuntu_focal.deb.build index ffe6402..5528d2c 100644 --- a/builder/dockerfile.ubuntu_focal.deb.build +++ b/builder/dockerfile.ubuntu_focal.deb.build @@ -3,7 +3,7 @@ FROM ubuntu:focal ENV DEBIAN_FRONTEND noninteractive RUN apt-get update && \ - apt-get -y install vim build-essential devscripts equivs libtbb-dev + apt-get -y install vim build-essential devscripts equivs libtbb-dev libavformat-dev libswscale-dev # Install build-deps for the package. COPY ./debian/control /tmp From 360b75e8e65ee758e7d613510d1d763dd36ea7a9 Mon Sep 17 00:00:00 2001 From: El Date: Mon, 14 Apr 2025 14:53:05 +0500 Subject: [PATCH 061/150] KASM-6984 Update file download path. Update CI --- .gitlab-ci.yml | 2 -- builder/dockerfile.ubuntu_focal.specs.test | 2 +- spec/vncserver_adv_benchmarking_spec.py | 14 ++++++++++++++ 3 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 spec/vncserver_adv_benchmarking_spec.py diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2a99d59..8e7bb40 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -536,8 +536,6 @@ test: - SelfBench.xml - Benchmark.xml script: - - bash wget https://kasmweb-build-artifacts.s3.us-east-1.amazonaws.com/kasmvnc/static/127072-737747495_small.mp4 - - bash ls -l - bash builder/test-vncserver diff --git a/builder/dockerfile.ubuntu_focal.specs.test b/builder/dockerfile.ubuntu_focal.specs.test index 663fe3d..414aebc 100644 --- a/builder/dockerfile.ubuntu_focal.specs.test +++ b/builder/dockerfile.ubuntu_focal.specs.test @@ -6,7 +6,7 @@ RUN apt-get update && apt-get install -y vim less RUN apt-get update && apt-get install -y python3-pip RUN apt-get update && apt-get install -y strace silversearcher-ag xfonts-base RUN apt-get update && apt-get install -y cinnamon -RUN apt-get update && apt-get install -y mate +RUN apt-get update && apt-get install -y mate wget RUN useradd -m docker diff --git a/spec/vncserver_adv_benchmarking_spec.py b/spec/vncserver_adv_benchmarking_spec.py new file mode 100644 index 0000000..a67ae55 --- /dev/null +++ b/spec/vncserver_adv_benchmarking_spec.py @@ -0,0 +1,14 @@ +from mamba import description, context, it, fit, before, after +from expects import expect, equal, contain, match +from helper.spec_helper import run_cmd, clean_env, kill_xvnc, clean_locks + +with description("Benchmarking"): + with before.each: + clean_env() + with after.each: + kill_xvnc() + with it("runs benchmarks"): + run_cmd("wget --no-check-certificate https://kasmweb-build-artifacts.s3.us-east-1.amazonaws.com/kasmvnc/static/127072-737747495_small.mp4 -o /tmp/video.mp4") + completed_process = run_cmd("Xvnc -interface 0.0.0.0 :1 -Benchmark /tmp/video.mp4") + clean_locks() + expect(completed_process.returncode).to(equal(0)) From 15de8da56be55b981257ec403ca0988b74d1febf Mon Sep 17 00:00:00 2001 From: El Date: Thu, 17 Apr 2025 14:36:46 +0500 Subject: [PATCH 062/150] KASM-6984 Add additional tools and scripts to Dockerfile for dev setup --- spec/helper/spec_helper.py | 1 + spec/vncserver_benchmarking_spec.py | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/spec/helper/spec_helper.py b/spec/helper/spec_helper.py index 3079296..c31692e 100644 --- a/spec/helper/spec_helper.py +++ b/spec/helper/spec_helper.py @@ -104,3 +104,4 @@ def kill_xvnc(): run_cmd('vncserver -kill :1', print_stderr=False) running_xvnc = False + clean_locks() diff --git a/spec/vncserver_benchmarking_spec.py b/spec/vncserver_benchmarking_spec.py index 1cb59b1..a6bb26a 100644 --- a/spec/vncserver_benchmarking_spec.py +++ b/spec/vncserver_benchmarking_spec.py @@ -1,6 +1,6 @@ from mamba import description, context, it, fit, before, after from expects import expect, equal, contain, match -from helper.spec_helper import run_cmd, clean_env, kill_xvnc +from helper.spec_helper import run_cmd, clean_env, kill_xvnc, clean_locks with description("Benchmarking"): with before.each: @@ -9,4 +9,5 @@ with description("Benchmarking"): kill_xvnc() with it("runs benchmarks"): completed_process = run_cmd("Xvnc -interface 0.0.0.0 :1 -selfBench") - expect(completed_process.returncode).to(equal(0)) + clean_locks() + expect(completed_process.returncode).to(equal(0)) \ No newline at end of file From 96f1cfb79a766e190ff968345ab39ca1dade2df0 Mon Sep 17 00:00:00 2001 From: El Date: Thu, 17 Apr 2025 21:06:09 +0500 Subject: [PATCH 063/150] KASM-6984 script debugging --- spec/vncserver_adv_benchmarking_spec.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/vncserver_adv_benchmarking_spec.py b/spec/vncserver_adv_benchmarking_spec.py index a67ae55..9f2bb6b 100644 --- a/spec/vncserver_adv_benchmarking_spec.py +++ b/spec/vncserver_adv_benchmarking_spec.py @@ -8,7 +8,7 @@ with description("Benchmarking"): with after.each: kill_xvnc() with it("runs benchmarks"): - run_cmd("wget --no-check-certificate https://kasmweb-build-artifacts.s3.us-east-1.amazonaws.com/kasmvnc/static/127072-737747495_small.mp4 -o /tmp/video.mp4") + run_cmd("wget --no-check-certificate https://kasmweb-build-artifacts.s3.us-east-1.amazonaws.com/kasmvnc/static/127072-737747495_small.mp4 -O /tmp/video.mp4") completed_process = run_cmd("Xvnc -interface 0.0.0.0 :1 -Benchmark /tmp/video.mp4") clean_locks() expect(completed_process.returncode).to(equal(0)) From de506f00c39310a2a372f8c1bbd1c3542b3194cf Mon Sep 17 00:00:00 2001 From: El Date: Thu, 17 Apr 2025 21:42:12 +0500 Subject: [PATCH 064/150] KASM-6984 Remove redundant clean_locks calls from benchmarking tests --- spec/vncserver_adv_benchmarking_spec.py | 1 - spec/vncserver_benchmarking_spec.py | 1 - 2 files changed, 2 deletions(-) diff --git a/spec/vncserver_adv_benchmarking_spec.py b/spec/vncserver_adv_benchmarking_spec.py index 9f2bb6b..053eeb2 100644 --- a/spec/vncserver_adv_benchmarking_spec.py +++ b/spec/vncserver_adv_benchmarking_spec.py @@ -10,5 +10,4 @@ with description("Benchmarking"): with it("runs benchmarks"): run_cmd("wget --no-check-certificate https://kasmweb-build-artifacts.s3.us-east-1.amazonaws.com/kasmvnc/static/127072-737747495_small.mp4 -O /tmp/video.mp4") completed_process = run_cmd("Xvnc -interface 0.0.0.0 :1 -Benchmark /tmp/video.mp4") - clean_locks() expect(completed_process.returncode).to(equal(0)) diff --git a/spec/vncserver_benchmarking_spec.py b/spec/vncserver_benchmarking_spec.py index a6bb26a..a78d1e1 100644 --- a/spec/vncserver_benchmarking_spec.py +++ b/spec/vncserver_benchmarking_spec.py @@ -9,5 +9,4 @@ with description("Benchmarking"): kill_xvnc() with it("runs benchmarks"): completed_process = run_cmd("Xvnc -interface 0.0.0.0 :1 -selfBench") - clean_locks() expect(completed_process.returncode).to(equal(0)) \ No newline at end of file From ebce680e79de13c8aa7b5a4c1dc5c7458654b470 Mon Sep 17 00:00:00 2001 From: El Date: Fri, 18 Apr 2025 16:48:47 +0500 Subject: [PATCH 065/150] KASM-6984 Refactor benchmark test case generation logic --- common/rfb/benchmark.cxx | 63 ++++++++++++++++------------------------ 1 file changed, 25 insertions(+), 38 deletions(-) diff --git a/common/rfb/benchmark.cxx b/common/rfb/benchmark.cxx index a7e0cbf..c5d6f20 100644 --- a/common/rfb/benchmark.cxx +++ b/common/rfb/benchmark.cxx @@ -22,6 +22,7 @@ #include #include #include +#include void benchmark(const std::string &path) { AVFormatContext *format_ctx = nullptr; @@ -132,12 +133,11 @@ void benchmark(const std::string &path) { vlog.info("Frame took %lu ns", duration); auto [jpeg_stats, webp_stats, bytes, udp_bytes] = connection.getStats(); - vlog.info("JPEG stats: %d ms", jpeg_stats.ms); - vlog.info("JPEG stats: %d rects", jpeg_stats.rects); - - vlog.info("WebP stats: %d ms", webp_stats.ms); - vlog.info("WebP stats: %d rects", webp_stats.rects); + //vlog.info("JPEG stats: %d ms", jpeg_stats.ms); + //vlog.info("JPEG stats: %d rects", jpeg_stats.rects); + //vlog.info("WebP stats: %d ms", webp_stats.ms); + // vlog.info("WebP stats: %d rects", webp_stats.rects); timings[frames++] = duration; } @@ -175,44 +175,31 @@ void benchmark(const std::string &path) { doc.InsertFirstChild(test_suit); - auto *test_case = doc.NewElement("testcase"); - test_case->SetAttribute("name", "Average time encoding frame, ms"); - test_case->SetAttribute("time", average / 1000); - test_case->SetAttribute("runs", 1); - test_case->SetAttribute("classname", "KasmVNC"); - test_suit->InsertEndChild(test_case); + constexpr auto div = 1. / (1000 * 1000); + auto total_tests{0}; - test_case = doc.NewElement("testcase"); - test_case->SetAttribute("name", "Median time encoding frame, ms"); - test_case->SetAttribute("time", average / 1000); - test_case->SetAttribute("runs", 1); - test_case->SetAttribute("classname", "KasmVNC"); - test_suit->InsertEndChild(test_case); + auto add_benchmark_item = [&doc, &test_suit, &total_tests](const char *name, auto value) { + auto *test_case = doc.NewElement("testcase"); + test_case->SetAttribute("name", name); + test_case->SetAttribute("time", value); + test_case->SetAttribute("runs", 1); + test_case->SetAttribute("classname", "KasmVNC"); + test_suit->InsertEndChild(test_case); - test_case = doc.NewElement("testcase"); - test_case->SetAttribute("name", "Total time encoding, ms"); - test_case->SetAttribute("time", sum); - test_case->SetAttribute("runs", 1); - test_case->SetAttribute("classname", "KasmVNC"); - test_suit->InsertEndChild(test_case); + ++total_tests; + }; - test_case = doc.NewElement("testcase"); - test_case->SetAttribute("name", "KBytes sent"); - test_case->SetAttribute("time", bytes / 1024); - test_case->SetAttribute("runs", 1); - test_case->SetAttribute("classname", "KasmVNC"); - test_suit->InsertEndChild(test_case); + add_benchmark_item("Average time encoding frame, ms", average * div); + add_benchmark_item("Median time encoding frame, ms", median * div); + add_benchmark_item("Total time encoding, ms", sum * div); - test_case = doc.NewElement("testcase"); - test_case->SetAttribute("name", "KBytes sent (UDP)"); - test_case->SetAttribute("time", udp_bytes / 1024); - test_case->SetAttribute("runs", 1); - test_case->SetAttribute("classname", "KasmVNC"); - test_suit->InsertEndChild(test_case); + std::stringstream ss; + ss << "KBytes sent: " << bytes / 1024; + add_benchmark_item(ss.str().c_str(), 0); - test_suit->SetAttribute("tests", 5); - test_suit->SetAttribute("failures", 0); - //test_suit->SetAttribute("time", total_time); + //ss.flush(); + //ss << "KBytes sent (UDP): " << udp_bytes / 1024; + //add_benchmark_item(ss.str().c_str(), 0); doc.SaveFile("Benchmark.xml"); } From 1a2fb0341de3928e37594649755f280a2830a1e8 Mon Sep 17 00:00:00 2001 From: El Date: Sat, 19 Apr 2025 01:30:59 +0500 Subject: [PATCH 066/150] KASM-6984 Add FFmpeg support and update dependencies for benchmarking on oracle 9 --- builder/dockerfile.oracle_9.build | 1 + common/rfb/CMakeLists.txt | 1 + common/rfb/benchmark.cxx | 1 + 3 files changed, 3 insertions(+) diff --git a/builder/dockerfile.oracle_9.build b/builder/dockerfile.oracle_9.build index aaa9184..674e2f0 100644 --- a/builder/dockerfile.oracle_9.build +++ b/builder/dockerfile.oracle_9.build @@ -43,6 +43,7 @@ RUN dnf install -y --nogpgcheck https://mirrors.rpmfusion.org/free/el/rpmfusion- # Install from new repos RUN dnf install -y \ giflib-devel \ + ffmpeg-devel \ lbzip2 \ libXfont2-devel \ libxkbfile-devel \ diff --git a/common/rfb/CMakeLists.txt b/common/rfb/CMakeLists.txt index a99e548..1094ece 100644 --- a/common/rfb/CMakeLists.txt +++ b/common/rfb/CMakeLists.txt @@ -141,6 +141,7 @@ target_include_directories(rfb PRIVATE ${PNG_INCLUDE_DIR} ${CMAKE_SOURCE_DIR}/unix/kasmvncpasswd ${CMAKE_SOURCE_DIR}/third_party/tinyxml2 + ${FFMPEG_INCLUDE_DIRS} ) target_link_libraries(rfb PRIVATE ${RFB_LIBRARIES} tinyxml2_objs ${FFMPEG_LIBRARIES}) diff --git a/common/rfb/benchmark.cxx b/common/rfb/benchmark.cxx index c5d6f20..907a740 100644 --- a/common/rfb/benchmark.cxx +++ b/common/rfb/benchmark.cxx @@ -22,6 +22,7 @@ #include #include #include +#include #include void benchmark(const std::string &path) { From 241592b19073798331bef5fd5f2e6c4c5c497445 Mon Sep 17 00:00:00 2001 From: El Date: Sat, 19 Apr 2025 02:55:36 +0500 Subject: [PATCH 067/150] KASM-6984 Add ffmpeg-dev to Alpine build Dockerfiles --- builder/dockerfile.alpine_318.build | 3 ++- builder/dockerfile.alpine_319.build | 3 ++- builder/dockerfile.alpine_320.build | 3 ++- builder/dockerfile.alpine_321.build | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/builder/dockerfile.alpine_318.build b/builder/dockerfile.alpine_318.build index b163664..f8620ba 100644 --- a/builder/dockerfile.alpine_318.build +++ b/builder/dockerfile.alpine_318.build @@ -67,7 +67,8 @@ RUN \ xorgproto \ xorg-server-common \ xorg-server-dev \ - xtrans + xtrans \ + ffmpeg-dev ENV SCRIPTS_DIR=/tmp/scripts diff --git a/builder/dockerfile.alpine_319.build b/builder/dockerfile.alpine_319.build index c0b18b7..d003855 100644 --- a/builder/dockerfile.alpine_319.build +++ b/builder/dockerfile.alpine_319.build @@ -67,7 +67,8 @@ RUN \ xorgproto \ xorg-server-common \ xorg-server-dev \ - xtrans + xtrans \ + ffmpeg-dev ENV SCRIPTS_DIR=/tmp/scripts diff --git a/builder/dockerfile.alpine_320.build b/builder/dockerfile.alpine_320.build index 8212b60..b282e6d 100644 --- a/builder/dockerfile.alpine_320.build +++ b/builder/dockerfile.alpine_320.build @@ -67,7 +67,8 @@ RUN \ xorgproto \ xorg-server-common \ xorg-server-dev \ - xtrans + xtrans \ + ffmpeg-dev ENV SCRIPTS_DIR=/tmp/scripts diff --git a/builder/dockerfile.alpine_321.build b/builder/dockerfile.alpine_321.build index 5ccb9ac..47a2cc7 100644 --- a/builder/dockerfile.alpine_321.build +++ b/builder/dockerfile.alpine_321.build @@ -67,7 +67,8 @@ RUN \ xorgproto \ xorg-server-common \ xorg-server-dev \ - xtrans + xtrans \ + ffmpeg-dev ENV SCRIPTS_DIR=/tmp/scripts From b1e5f709f721324d2a46581c5d289879c1a46e40 Mon Sep 17 00:00:00 2001 From: El Date: Sun, 20 Apr 2025 03:03:58 +0500 Subject: [PATCH 068/150] KASM-6984 Update dependencies in Dockerfile for Debian --- builder/dockerfile.debian_bookworm.build | 3 ++- builder/dockerfile.debian_bullseye.build | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/builder/dockerfile.debian_bookworm.build b/builder/dockerfile.debian_bookworm.build index c0c9212..98034c6 100644 --- a/builder/dockerfile.debian_bookworm.build +++ b/builder/dockerfile.debian_bookworm.build @@ -23,7 +23,8 @@ RUN apt-get update && \ RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends tzdata RUN apt-get update && apt-get -y build-dep xorg-server libxfont-dev RUN apt-get update && apt-get -y install ninja-build cmake nasm git libgnutls28-dev vim wget tightvncserver curl -RUN apt-get update && apt-get -y install libpng-dev libtiff-dev libgif-dev libavcodec-dev libssl-dev libxrandr-dev libxcursor-dev +RUN apt-get update && apt-get -y install libpng-dev libtiff-dev libgif-dev libavcodec-dev libssl-dev libxrandr-dev \ + libxcursor-dev libavformat-dev libswscale-dev ENV SCRIPTS_DIR=/tmp/scripts COPY builder/scripts $SCRIPTS_DIR diff --git a/builder/dockerfile.debian_bullseye.build b/builder/dockerfile.debian_bullseye.build index 528b179..d9ce288 100644 --- a/builder/dockerfile.debian_bullseye.build +++ b/builder/dockerfile.debian_bullseye.build @@ -13,7 +13,8 @@ RUN apt-get update && \ RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends tzdata RUN apt-get update && apt-get -y build-dep xorg-server libxfont-dev RUN apt-get update && apt-get -y install ninja-build nasm git libgnutls28-dev vim wget tightvncserver curl -RUN apt-get update && apt-get -y install libpng-dev libtiff-dev libgif-dev libavcodec-dev libssl-dev libxrandr-dev libxcursor-dev +RUN apt-get update && apt-get -y install libpng-dev libtiff-dev libgif-dev libavcodec-dev libssl-dev libxrandr-dev \ + libxcursor-dev libavformat-dev libswscale-dev RUN CMAKE_URL="https://cmake.org/files/v3.22/cmake-3.22.0" && \ ARCH=$(arch) && \ From 7b0baed7d17e7fd332d5bc06a3de6ad1952d347d Mon Sep 17 00:00:00 2001 From: El Date: Sun, 20 Apr 2025 13:24:32 +0500 Subject: [PATCH 069/150] KASM-6984 Add libavformat-free-devel and libswscale-free-devel dependencies --- builder/dockerfile.fedora_forty.build | 4 +++- builder/dockerfile.fedora_fortyone.build | 4 +++- builder/dockerfile.fedora_thirtynine.build | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/builder/dockerfile.fedora_forty.build b/builder/dockerfile.fedora_forty.build index 686feb6..983a88f 100644 --- a/builder/dockerfile.fedora_forty.build +++ b/builder/dockerfile.fedora_forty.build @@ -72,7 +72,9 @@ RUN \ xorg-x11-server-common \ xorg-x11-server-devel \ xorg-x11-xtrans-devel \ - xsltproc + xsltproc \ + libavformat-free-devel \ + libswscale-free-devel ENV SCRIPTS_DIR=/tmp/scripts COPY builder/scripts $SCRIPTS_DIR diff --git a/builder/dockerfile.fedora_fortyone.build b/builder/dockerfile.fedora_fortyone.build index 81c44b4..336b064 100644 --- a/builder/dockerfile.fedora_fortyone.build +++ b/builder/dockerfile.fedora_fortyone.build @@ -73,7 +73,9 @@ RUN \ xorg-x11-server-common \ xorg-x11-server-devel \ xorg-x11-xtrans-devel \ - xsltproc + xsltproc \ + libavformat-free-devel \ + libswscale-free-devel ENV SCRIPTS_DIR=/tmp/scripts COPY builder/scripts $SCRIPTS_DIR diff --git a/builder/dockerfile.fedora_thirtynine.build b/builder/dockerfile.fedora_thirtynine.build index aa10cf4..d1985de 100644 --- a/builder/dockerfile.fedora_thirtynine.build +++ b/builder/dockerfile.fedora_thirtynine.build @@ -72,7 +72,9 @@ RUN \ xorg-x11-server-common \ xorg-x11-server-devel \ xorg-x11-xtrans-devel \ - xsltproc + xsltproc \ + libavformat-free-devel \ + libswscale-free-devel ENV SCRIPTS_DIR=/tmp/scripts COPY builder/scripts $SCRIPTS_DIR From fd96e8ab9ce386a04e14691fe5fa4c993ee2be2b Mon Sep 17 00:00:00 2001 From: El Date: Sun, 20 Apr 2025 14:17:27 +0500 Subject: [PATCH 070/150] KASM-6984 Add depedencies to docker images --- builder/dockerfile.debian_bookworm.deb.build | 2 +- builder/dockerfile.debian_bullseye.deb.build | 2 +- builder/dockerfile.kali_kali-rolling.build | 3 ++- builder/dockerfile.opensuse_15.build | 4 +++- builder/dockerfile.ubuntu_focal.build | 4 ++-- builder/dockerfile.ubuntu_jammy.build | 3 ++- builder/dockerfile.ubuntu_jammy.deb.build | 2 +- builder/dockerfile.ubuntu_noble.build | 3 ++- builder/dockerfile.ubuntu_noble.deb.build | 2 +- 9 files changed, 15 insertions(+), 10 deletions(-) diff --git a/builder/dockerfile.debian_bookworm.deb.build b/builder/dockerfile.debian_bookworm.deb.build index 2e61fbb..7e38d57 100644 --- a/builder/dockerfile.debian_bookworm.deb.build +++ b/builder/dockerfile.debian_bookworm.deb.build @@ -3,7 +3,7 @@ FROM debian:bookworm ENV DEBIAN_FRONTEND noninteractive RUN apt-get update && \ - apt-get -y install vim build-essential devscripts equivs + apt-get -y install vim build-essential devscripts equivs libavformat-dev libswscale-dev # Install build-deps for the package. COPY ./debian/control /tmp diff --git a/builder/dockerfile.debian_bullseye.deb.build b/builder/dockerfile.debian_bullseye.deb.build index 51bde4f..e8c0ae1 100644 --- a/builder/dockerfile.debian_bullseye.deb.build +++ b/builder/dockerfile.debian_bullseye.deb.build @@ -3,7 +3,7 @@ FROM debian:bullseye ENV DEBIAN_FRONTEND noninteractive RUN apt-get update && \ - apt-get -y install vim build-essential devscripts equivs + apt-get -y install vim build-essential devscripts equivs libavformat-dev libswscale-dev # Install build-deps for the package. COPY ./debian/control /tmp diff --git a/builder/dockerfile.kali_kali-rolling.build b/builder/dockerfile.kali_kali-rolling.build index 43a1e3a..717e8f9 100644 --- a/builder/dockerfile.kali_kali-rolling.build +++ b/builder/dockerfile.kali_kali-rolling.build @@ -14,7 +14,8 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends tz RUN apt-get update && apt-get -y build-dep xorg-server libxfont-dev RUN apt-get update && apt-get -y install gcc g++ curl RUN apt-get update && apt-get -y install ninja-build cmake nasm git libgnutls28-dev vim wget tightvncserver -RUN apt-get update && apt-get -y install libpng-dev libtiff-dev libgif-dev libavcodec-dev libssl-dev libxrandr-dev libxcursor-dev +RUN apt-get update && apt-get -y install libpng-dev libtiff-dev libgif-dev libavcodec-dev libssl-dev libxrandr-dev \ + libxcursor-dev libavformat-dev libswscale-dev ENV SCRIPTS_DIR=/tmp/scripts COPY builder/scripts $SCRIPTS_DIR diff --git a/builder/dockerfile.opensuse_15.build b/builder/dockerfile.opensuse_15.build index 6c2cd1b..a385424 100644 --- a/builder/dockerfile.opensuse_15.build +++ b/builder/dockerfile.opensuse_15.build @@ -13,6 +13,8 @@ RUN zypper install -ny \ nasm \ curl \ ffmpeg-4-libavcodec-devel \ + ffmpeg-4-libswscale-devel \ + ffmpeg-4-libavformat-devel \ fonttosfnt \ font-util \ gcc14 \ @@ -46,12 +48,12 @@ RUN zypper install -ny \ xorg-x11-server-sdk \ xorg-x11-util-devel \ zlib-devel +#RUN zypper install -ny libavformat-devel libswscale-devel RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 140 \ --slave /usr/bin/g++ g++ /usr/bin/g++-14 \ --slave /usr/bin/gcov gcov /usr/bin/gcov-14 - RUN useradd -u 1000 docker && \ groupadd -g 1000 docker && \ usermod -a -G docker docker diff --git a/builder/dockerfile.ubuntu_focal.build b/builder/dockerfile.ubuntu_focal.build index 57c7373..a70c56a 100644 --- a/builder/dockerfile.ubuntu_focal.build +++ b/builder/dockerfile.ubuntu_focal.build @@ -39,5 +39,5 @@ RUN $SCRIPTS_DIR/build-libjpeg-turbo COPY --chown=docker:docker . /src/ -USER docker -ENTRYPOINT ["/src/builder/build.sh"] +#USER docker +#ENTRYPOINT ["/src/builder/build.sh"] diff --git a/builder/dockerfile.ubuntu_jammy.build b/builder/dockerfile.ubuntu_jammy.build index cc6c4ff..11eafc7 100644 --- a/builder/dockerfile.ubuntu_jammy.build +++ b/builder/dockerfile.ubuntu_jammy.build @@ -13,7 +13,8 @@ RUN apt-get update && \ RUN apt-get update && apt-get install -y --no-install-recommends tzdata RUN apt-get update && apt-get -y build-dep xorg-server libxfont-dev RUN apt-get update && apt-get -y install ninja-build cmake nasm git libgnutls28-dev vim wget tightvncserver curl -RUN apt-get update && apt-get -y install libpng-dev libtiff-dev libgif-dev libavcodec-dev libssl-dev libxrandr-dev libxcursor-dev +RUN apt-get update && apt-get -y install libpng-dev libtiff-dev libgif-dev libavcodec-dev libssl-dev libxrandr-dev \ + libxcursor-dev libavformat-dev libswscale-dev ENV SCRIPTS_DIR=/tmp/scripts COPY builder/scripts $SCRIPTS_DIR diff --git a/builder/dockerfile.ubuntu_jammy.deb.build b/builder/dockerfile.ubuntu_jammy.deb.build index 31dee99..ce9d84c 100644 --- a/builder/dockerfile.ubuntu_jammy.deb.build +++ b/builder/dockerfile.ubuntu_jammy.deb.build @@ -3,7 +3,7 @@ FROM ubuntu:jammy ENV DEBIAN_FRONTEND noninteractive RUN apt-get update && \ - apt-get -y install vim build-essential devscripts equivs + apt-get -y install vim build-essential devscripts equivs libavformat-dev libswscale-dev # Install build-deps for the package. COPY ./debian/control /tmp diff --git a/builder/dockerfile.ubuntu_noble.build b/builder/dockerfile.ubuntu_noble.build index a4c3a6f..dfb796c 100644 --- a/builder/dockerfile.ubuntu_noble.build +++ b/builder/dockerfile.ubuntu_noble.build @@ -13,7 +13,8 @@ RUN apt-get update && \ RUN apt-get update && apt-get install -y --no-install-recommends tzdata RUN apt-get update && apt-get -y build-dep xorg-server libxfont-dev RUN apt-get update && apt-get -y install ninja-build cmake nasm git libgnutls28-dev vim wget curl -RUN apt-get update && apt-get -y install libpng-dev libtiff-dev libgif-dev libavcodec-dev libssl-dev libxrandr-dev libxcursor-dev +RUN apt-get update && apt-get -y install libpng-dev libtiff-dev libgif-dev libavcodec-dev libssl-dev libxrandr-dev \ + libxcursor-dev libavformat-dev libswscale-dev ENV SCRIPTS_DIR=/tmp/scripts COPY builder/scripts $SCRIPTS_DIR diff --git a/builder/dockerfile.ubuntu_noble.deb.build b/builder/dockerfile.ubuntu_noble.deb.build index 6a56b24..982de54 100644 --- a/builder/dockerfile.ubuntu_noble.deb.build +++ b/builder/dockerfile.ubuntu_noble.deb.build @@ -3,7 +3,7 @@ FROM ubuntu:noble ENV DEBIAN_FRONTEND noninteractive RUN apt-get update && \ - apt-get -y install vim build-essential devscripts equivs + apt-get -y install vim build-essential devscripts equivs libavformat-dev libswscale-dev # Install build-deps for the package. COPY ./debian/control /tmp From f95c46f02de1bdd2e9412b520898f22f2f868554 Mon Sep 17 00:00:00 2001 From: El Date: Sun, 20 Apr 2025 14:33:31 +0500 Subject: [PATCH 071/150] KASM-6984 Set C++ standard to C++20 in CMake configuration --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8ba357c..0ef404d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -74,6 +74,7 @@ set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} -UNDEBUG") # Make sure we get a sane C version set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99") +set(CMAKE_CXX_STANDARD 20) # Enable OpenMP set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fopenmp") From 2859e86a7094b7c88517b44d115d8ec6aa65f35a Mon Sep 17 00:00:00 2001 From: El Date: Mon, 21 Apr 2025 14:47:46 +0500 Subject: [PATCH 072/150] KASM-6984 Added dependencies --- .gitlab-ci.yml | 2 +- builder/dockerfile.kali_kali-rolling.deb.build | 2 +- builder/dockerfile.ubuntu_focal.build | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8e7bb40..4017934 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -108,7 +108,7 @@ build_ubuntu_jammy: stage: build allow_failure: true tags: - - kasmvnc-x86 + - oci-fixed-amd before_script: - *prepare_build - *prepare_www diff --git a/builder/dockerfile.kali_kali-rolling.deb.build b/builder/dockerfile.kali_kali-rolling.deb.build index 6d0ed1b..3683530 100644 --- a/builder/dockerfile.kali_kali-rolling.deb.build +++ b/builder/dockerfile.kali_kali-rolling.deb.build @@ -3,7 +3,7 @@ FROM kalilinux/kali-rolling:latest ENV DEBIAN_FRONTEND noninteractive RUN apt-get update && \ - apt-get -y install vim build-essential devscripts equivs + apt-get -y install vim build-essential devscripts equivs libavformat-dev libswscale-dev # Install build-deps for the package. COPY ./debian/control /tmp diff --git a/builder/dockerfile.ubuntu_focal.build b/builder/dockerfile.ubuntu_focal.build index a70c56a..57c7373 100644 --- a/builder/dockerfile.ubuntu_focal.build +++ b/builder/dockerfile.ubuntu_focal.build @@ -39,5 +39,5 @@ RUN $SCRIPTS_DIR/build-libjpeg-turbo COPY --chown=docker:docker . /src/ -#USER docker -#ENTRYPOINT ["/src/builder/build.sh"] +USER docker +ENTRYPOINT ["/src/builder/build.sh"] From 20d70675393ba6211c9864b656860fbda430e4f7 Mon Sep 17 00:00:00 2001 From: El Date: Mon, 21 Apr 2025 15:21:49 +0500 Subject: [PATCH 073/150] KASM-6984 Added dependencies --- builder/dockerfile.alpine_321.apk.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builder/dockerfile.alpine_321.apk.build b/builder/dockerfile.alpine_321.apk.build index 2bc1af0..6f41bde 100644 --- a/builder/dockerfile.alpine_321.apk.build +++ b/builder/dockerfile.alpine_321.apk.build @@ -1,7 +1,7 @@ FROM alpine:3.21 RUN apk add shadow bash -RUN apk add abuild sudo less +RUN apk add abuild sudo less ffmpeg-dev ENV HOME /src/alpine WORKDIR $HOME/kasmvncserver From 544295505ef6e099d3d71b7136ab0b0bc72fa5e2 Mon Sep 17 00:00:00 2001 From: El Date: Mon, 21 Apr 2025 16:40:48 +0500 Subject: [PATCH 074/150] KASM-6984 Refactor benchmark code to simplify and modernize usage --- common/rfb/benchmark.cxx | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/common/rfb/benchmark.cxx b/common/rfb/benchmark.cxx index 907a740..a7f8c99 100644 --- a/common/rfb/benchmark.cxx +++ b/common/rfb/benchmark.cxx @@ -23,7 +23,6 @@ #include #include #include -#include void benchmark(const std::string &path) { AVFormatContext *format_ctx = nullptr; @@ -133,7 +132,7 @@ void benchmark(const std::string &path) { vlog.info("Frame took %lu ns", duration); - auto [jpeg_stats, webp_stats, bytes, udp_bytes] = connection.getStats(); + // auto [jpeg_stats, webp_stats, bytes, udp_bytes] = connection.getStats(); //vlog.info("JPEG stats: %d ms", jpeg_stats.ms); //vlog.info("JPEG stats: %d rects", jpeg_stats.rects); @@ -157,7 +156,7 @@ void benchmark(const std::string &path) { double median{}; - std::sort(timings.begin(), timings.end()); + std::ranges::sort(timings); if (size % 2 == 0) median = static_cast(timings[size / 2]); else @@ -176,13 +175,13 @@ void benchmark(const std::string &path) { doc.InsertFirstChild(test_suit); - constexpr auto div = 1. / (1000 * 1000); + constexpr auto div = 1. / (1000); auto total_tests{0}; auto add_benchmark_item = [&doc, &test_suit, &total_tests](const char *name, auto value) { auto *test_case = doc.NewElement("testcase"); test_case->SetAttribute("name", name); - test_case->SetAttribute("time", value); + test_case->SetAttribute("filename", value); test_case->SetAttribute("runs", 1); test_case->SetAttribute("classname", "KasmVNC"); test_suit->InsertEndChild(test_case); @@ -194,9 +193,7 @@ void benchmark(const std::string &path) { add_benchmark_item("Median time encoding frame, ms", median * div); add_benchmark_item("Total time encoding, ms", sum * div); - std::stringstream ss; - ss << "KBytes sent: " << bytes / 1024; - add_benchmark_item(ss.str().c_str(), 0); + add_benchmark_item("Data sent, KBs", bytes / 1024); //ss.flush(); //ss << "KBytes sent (UDP): " << udp_bytes / 1024; From b325028d923305eaaa600a11c3122754cdc16dc3 Mon Sep 17 00:00:00 2001 From: El Date: Mon, 21 Apr 2025 16:49:10 +0500 Subject: [PATCH 075/150] KASM-6984 Refactor benchmark code to simplify and modernize usage --- common/rfb/benchmark.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/rfb/benchmark.cxx b/common/rfb/benchmark.cxx index a7f8c99..2117918 100644 --- a/common/rfb/benchmark.cxx +++ b/common/rfb/benchmark.cxx @@ -156,7 +156,7 @@ void benchmark(const std::string &path) { double median{}; - std::ranges::sort(timings); + std::sort(timings.begin(), timings.end()); if (size % 2 == 0) median = static_cast(timings[size / 2]); else From 9e79d8ae56b039ca098125448b19f383ba96af9c Mon Sep 17 00:00:00 2001 From: El Date: Mon, 21 Apr 2025 17:17:06 +0500 Subject: [PATCH 076/150] KASM-6984 Update copyright information in benchmark files --- common/rfb/benchmark.cxx | 4 ++-- common/rfb/benchmark.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/common/rfb/benchmark.cxx b/common/rfb/benchmark.cxx index 2117918..8f8946e 100644 --- a/common/rfb/benchmark.cxx +++ b/common/rfb/benchmark.cxx @@ -1,5 +1,5 @@ -/* Copyright (C) 2025 Kasm Web -* +/* Copyright (C) 2025 Kasm Technologies Corp + * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or diff --git a/common/rfb/benchmark.h b/common/rfb/benchmark.h index 375fd8c..2cc21ce 100644 --- a/common/rfb/benchmark.h +++ b/common/rfb/benchmark.h @@ -1,5 +1,5 @@ -/* Copyright (C) 2025 Kasm Web -* +/* Copyright (C) 2025 Kasm Technologies Corp + * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or From fdc2f29ce2116c25bc6fa654c627fb985318342d Mon Sep 17 00:00:00 2001 From: El Date: Mon, 21 Apr 2025 22:14:42 +0500 Subject: [PATCH 077/150] KASM-6984 Update benchmarking --- common/rfb/benchmark.cxx | 14 +++++++++++++- spec/vncserver_adv_benchmarking_spec.py | 4 +++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/common/rfb/benchmark.cxx b/common/rfb/benchmark.cxx index 8f8946e..f4ec3dd 100644 --- a/common/rfb/benchmark.cxx +++ b/common/rfb/benchmark.cxx @@ -181,9 +181,21 @@ void benchmark(const std::string &path) { auto add_benchmark_item = [&doc, &test_suit, &total_tests](const char *name, auto value) { auto *test_case = doc.NewElement("testcase"); test_case->SetAttribute("name", name); - test_case->SetAttribute("filename", value); + test_case->SetAttribute("file", value); test_case->SetAttribute("runs", 1); test_case->SetAttribute("classname", "KasmVNC"); + + auto *props = doc.NewElement("properties"); + + auto *prop = doc.NewElement("property"); + prop->SetAttribute("name", name); + props->InsertEndChild(prop); + + prop = doc.NewElement("property"); + prop->SetAttribute("value", value); + props->InsertEndChild(prop); + + test_case->InsertEndChild(props); test_suit->InsertEndChild(test_case); ++total_tests; diff --git a/spec/vncserver_adv_benchmarking_spec.py b/spec/vncserver_adv_benchmarking_spec.py index 053eeb2..2b805ca 100644 --- a/spec/vncserver_adv_benchmarking_spec.py +++ b/spec/vncserver_adv_benchmarking_spec.py @@ -1,6 +1,6 @@ from mamba import description, context, it, fit, before, after from expects import expect, equal, contain, match -from helper.spec_helper import run_cmd, clean_env, kill_xvnc, clean_locks +from helper.spec_helper import run_cmd, clean_env, kill_xvnc with description("Benchmarking"): with before.each: @@ -10,4 +10,6 @@ with description("Benchmarking"): with it("runs benchmarks"): run_cmd("wget --no-check-certificate https://kasmweb-build-artifacts.s3.us-east-1.amazonaws.com/kasmvnc/static/127072-737747495_small.mp4 -O /tmp/video.mp4") completed_process = run_cmd("Xvnc -interface 0.0.0.0 :1 -Benchmark /tmp/video.mp4") + command = '''sed -i "s/KasmVNC/$(grep -E '^ID=' /etc/os-release | cut -d= -f2 | tr -d '"') $(grep -E '^VERSION_CODENAME=' /etc/os-release | cut -d= -f2 | tr -d '"')/g" Benchmark.xml''' + run_cmd(command) expect(completed_process.returncode).to(equal(0)) From 4e3b8ac6c0a66080c9c1031f08c365042a9fc9bb Mon Sep 17 00:00:00 2001 From: El Date: Wed, 23 Apr 2025 00:28:14 +0500 Subject: [PATCH 078/150] KASM-6984 Add Docker Hub login step to CI pipeline --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4017934..ad6e84f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -29,6 +29,7 @@ stages: - pwd - apk add bash - mkdir -p "$GITLAB_SHARED_DIND_DIR" && chmod 777 "$GITLAB_SHARED_DIND_DIR" + - docker login --username $DOCKER_HUB_USERNAME --password $DOCKER_HUB_PASSWORD .prepare_www: &prepare_www - tar -zxf output/www/kasm_www.tar.gz -C builder/ From eff36f0a9571613eee1094a92ff4ebda622b9cc8 Mon Sep 17 00:00:00 2001 From: El Date: Thu, 24 Apr 2025 06:27:02 +0500 Subject: [PATCH 079/150] KASM-6984 Remove unnecessary benchmark.h from RFB_SOURCES list --- common/rfb/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/common/rfb/CMakeLists.txt b/common/rfb/CMakeLists.txt index 1094ece..317fe2b 100644 --- a/common/rfb/CMakeLists.txt +++ b/common/rfb/CMakeLists.txt @@ -125,7 +125,6 @@ else () set(RFB_SOURCES ${RFB_SOURCES} ${SCALE_DUMMY_SOURCES} - benchmark.h ) endif () From 75dc2de7f8d633814c933dba0e11c20ceeb2b7f7 Mon Sep 17 00:00:00 2001 From: El Date: Thu, 24 Apr 2025 06:33:28 +0500 Subject: [PATCH 080/150] KASM-6984 Refactor SConnection::setEncodings for readability and consistency --- common/rfb/SConnection.cxx | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/common/rfb/SConnection.cxx b/common/rfb/SConnection.cxx index f0e6be5..4546742 100644 --- a/common/rfb/SConnection.cxx +++ b/common/rfb/SConnection.cxx @@ -20,8 +20,6 @@ #include #include #include -#include -#include #include #include #include @@ -274,19 +272,16 @@ void SConnection::writeConnFailedFromScratch(const char* msg, os->flush(); } -void SConnection::setEncodings(int nEncodings, const rdr::S32* encodings) -{ - int i; - - preferredEncoding = encodingRaw; - for (i = 0;i < nEncodings;i++) { - if (EncodeManager::supported(encodings[i])) { - preferredEncoding = encodings[i]; - break; +void SConnection::setEncodings(int nEncodings, const rdr::S32 *encodings) { + preferredEncoding = encodingRaw; + for (int i = 0; i < nEncodings; i++) { + if (EncodeManager::supported(encodings[i])) { + preferredEncoding = encodings[i]; + break; + } } - } - SMsgHandler::setEncodings(nEncodings, encodings); + SMsgHandler::setEncodings(nEncodings, encodings); } void SConnection::clearBinaryClipboard() From 8180eb8b8758f742abcd71b355ded84f000af201 Mon Sep 17 00:00:00 2001 From: El Date: Thu, 24 Apr 2025 07:12:28 +0500 Subject: [PATCH 081/150] KASM-6984 Refactor benchmarking --- common/rfb/benchmark.cxx | 14 ++-- common/rfb/benchmark.h | 134 ++++++++++++++++++++++----------------- 2 files changed, 83 insertions(+), 65 deletions(-) diff --git a/common/rfb/benchmark.cxx b/common/rfb/benchmark.cxx index f4ec3dd..1e7c9ae 100644 --- a/common/rfb/benchmark.cxx +++ b/common/rfb/benchmark.cxx @@ -119,18 +119,15 @@ void benchmark(const std::string &path) { sws_scale(sws_ctx, frame->data, frame->linesize, 0, frame->height, rgb_frame->data, rgb_frame->linesize); - vlog.info("Updating with frame %lu", frames); connection.framebufferUpdateStart(); - vlog.info("Setting frame"); connection.setNewFrame(rgb_frame); using namespace std::chrono; auto now = high_resolution_clock::now(); - vlog.info("Updating frame..."); connection.framebufferUpdateEnd(); - const auto duration = duration_cast(high_resolution_clock::now() - now).count(); + const auto duration = duration_cast(high_resolution_clock::now() - now).count(); - vlog.info("Frame took %lu ns", duration); + vlog.info("Frame took %lu ms", duration); // auto [jpeg_stats, webp_stats, bytes, udp_bytes] = connection.getStats(); //vlog.info("JPEG stats: %d ms", jpeg_stats.ms); @@ -166,7 +163,12 @@ void benchmark(const std::string &path) { vlog.info("Average time encoding frame: %f ns", average); vlog.info("Median time encoding frame: %f ns", median); - vlog.info("Total time: %f ns", sum); + vlog.info("Total time: %f ms", sum); + vlog.info("JPEG stats: %d ms", jpeg_stats.ms); + vlog.info("JPEG stats: %d rects", jpeg_stats.rects); + vlog.info("WebP stats: %d ms", webp_stats.ms); + vlog.info("WebP stats: %d rects", webp_stats.rects); + vlog.info("Total bytes sent: %lu bytes", bytes); tinyxml2::XMLDocument doc; diff --git a/common/rfb/benchmark.h b/common/rfb/benchmark.h index 2cc21ce..72a3914 100644 --- a/common/rfb/benchmark.h +++ b/common/rfb/benchmark.h @@ -18,6 +18,7 @@ #pragma once +#include #include #include #include @@ -27,6 +28,7 @@ #include "EncCache.h" #include "EncodeManager.h" #include "LogWriter.h" +#include "screenTypes.h" #include "SMsgWriter.h" namespace rdr { @@ -95,11 +97,9 @@ namespace rfb { private: void overrun(size_t needed) override { - flush(); - - /*if (itemSize * nItems > end - ptr) - nItems = (end - ptr) / itemSize; - return nItems;*/ + assert(end >= ptr); + if (needed > static_cast(end - ptr)) + flush(); } public: @@ -115,10 +115,10 @@ namespace rfb { private: ptrdiff_t offset; - rdr::U8 buf[131072]{}; + rdr::U8 buf[8192]{}; }; - class MockSConnection : public SConnection { + class MockSConnection final : public SConnection { public: MockSConnection() { setStreams(nullptr, &out); @@ -128,32 +128,70 @@ namespace rfb { ~MockSConnection() override = default; - void writeUpdate(const UpdateInfo &ui, const rfb::PixelBuffer *pb) { - vlog.info("Writing update"); - // Drop any lossy tracking that is now outside the framebuffer + void writeUpdate(const UpdateInfo &ui, const PixelBuffer *pb) { //manager.pruneLosslessRefresh(Region(pb->getRect())); bytes += out.length(); udp_bytes += udps.length(); - vlog.info("bytes written: %lu", bytes); - vlog.info("udp bytes written: %lu", udp_bytes); - cache.clear(); - manager.writeUpdate(ui, pb, nullptr); + + manager.clearEncodingTime(); + if (!ui.is_empty()) { + manager.writeUpdate(ui, pb, nullptr); + } else { + Region region{pb->getRect()}; + manager.writeLosslessRefresh(region, pb, nullptr, 2000); + } } - virtual void setAccessRights(AccessRights ar) { + void writeNoDataUpdate() { + if (!writer()->needNoDataUpdate()) + return; + + writer()->writeNoDataUpdate(); + } + + void WriteDataUpdate() { + Region req, pending; + + if (req.is_empty()) + return; + + if (!pending.is_empty()) { + UpdateInfo ui; + // However, we might still be able to send a lossless refresh + req.assign_subtract(pending); + req.assign_subtract(ui.changed); + req.assign_subtract(ui.copied); + + ui.changed.clear(); + ui.copied.clear(); + } + } + + void writeFramebufferUpdate() { + manager.clearEncodingTime(); + + if (state() != RFBSTATE_NORMAL) + return; + + // First, take care of any updates that cannot contain framebuffer data + // changes. + writeNoDataUpdate(); + + // Then real data (if possible) + WriteDataUpdate(); } void setDesktopSize(int fb_width, int fb_height, - const rfb::ScreenSet &layout) override { + const ScreenSet &layout) override { cp.width = fb_width; cp.height = fb_height; cp.screenLayout = layout; - writer()->writeExtendedDesktopSize(); - writer()->writeSetDesktopSize(); + writer()->writeExtendedDesktopSize(reasonServer, 0, cp.width, cp.height, + cp.screenLayout); } void sendStats(const bool toClient) override { @@ -186,8 +224,8 @@ namespace rfb { return manager.webpstats; } - uint64_t bytes; - uint64_t udp_bytes; + uint64_t bytes{}; + uint64_t udp_bytes{}; protected: MockStream out{}; @@ -198,31 +236,17 @@ namespace rfb { }; static constexpr rdr::S32 encodings[] = { - pseudoEncodingWEBP, - pseudoEncodingJpegVideoQualityLevel0, - pseudoEncodingJpegVideoQualityLevel9, - pseudoEncodingWebpVideoQualityLevel0, - pseudoEncodingWebpVideoQualityLevel9, - pseudoEncodingTreatLosslessLevel0, - pseudoEncodingTreatLosslessLevel10, - pseudoEncodingPreferBandwidth, - pseudoEncodingDynamicQualityMinLevel0, - pseudoEncodingDynamicQualityMinLevel9, - pseudoEncodingDynamicQualityMaxLevel0, - pseudoEncodingDynamicQualityMaxLevel9, - pseudoEncodingVideoAreaLevel1, - pseudoEncodingVideoAreaLevel100, - pseudoEncodingVideoTimeLevel0, - pseudoEncodingVideoTimeLevel100, - - pseudoEncodingFrameRateLevel10, - pseudoEncodingFrameRateLevel60, - pseudoEncodingMaxVideoResolution, - pseudoEncodingVideoScalingLevel0, - pseudoEncodingVideoScalingLevel9, - pseudoEncodingVideoOutTimeLevel1, - pseudoEncodingVideoOutTimeLevel100, - pseudoEncodingQOI + encodingTight, + encodingZRLE, + encodingHextile, + encodingRRE, + encodingRaw, + pseudoEncodingCompressLevel9, + pseudoEncodingQualityLevel9, + pseudoEncodingFineQualityLevel100, + pseudoEncodingSubsamp16X + //pseudoEncodingWEBP + //pseudoEncodingQOI }; class MockCConnection final : public CConnection { @@ -232,18 +256,19 @@ namespace rfb { // Need to skip the initial handshake and ServerInit setState(RFBSTATE_NORMAL); - // That also means that the reader and writer weren't setup + // That also means that the reader and writer weren't set up setReader(new rfb::CMsgReader(this, &in)); auto &pf = pb->getPF(); CMsgHandler::setPixelFormat(pf); MockCConnection::setDesktopSize(pb->width(), pb->height()); - setFramebuffer(pb); cp.setPF(pf); sc.cp.setPF(pf); sc.setEncodings(std::size(encodings), encodings); + + setFramebuffer(pb); } void setCursor(int width, int height, const Point &hotspot, const rdr::U8 *data, const bool resizing) override { @@ -275,9 +300,6 @@ namespace rfb { screen_layout.remove_screen(0); screen_layout.add_screen(Screen(0, 0, 0, w, h, 0)); - //cp.screenLayout = screen_layout; - //sc.setDesktopSize(w, h, screen_layout); - vlog.info("setDesktopSize"); } void setNewFrame(const AVFrame *frame) { @@ -286,7 +308,7 @@ namespace rfb { const int height = pb->height(); const rfb::Rect rect(0, 0, width, height); - int dstStride; + int dstStride{}; auto *buffer = pb->getBufferRW(rect, &dstStride); const PixelFormat &pf = pb->getPF(); @@ -295,9 +317,7 @@ namespace rfb { const auto *srcData = frame->data[0]; const int srcStride = frame->linesize[0] / 3; // Convert bytes to pixels - vlog.info("Frame stride %d", srcStride); - - // Convert from RGB format to the PixelBuffer's format + // Convert from the RGB format to the PixelBuffer's format pf.bufferFromRGB(buffer, srcData, width, srcStride, height); // Commit changes @@ -317,13 +337,9 @@ namespace rfb { const Region clip(pb->getRect()); - CConnection::framebufferUpdateEnd(); + updates.add_changed(pb->getRect()); - //updates.add_changed(pb->getRect()); updates.getUpdateInfo(&ui, clip); - vlog.info("%d", ui.changed.numRects()); - vlog.info("%d", ui.copied.numRects()); - vlog.info("%lu", ui.copypassed.size()); sc.writeUpdate(ui, pb); } From 07d72ebfbc5a12b12c3bc3d838864805b9e50691 Mon Sep 17 00:00:00 2001 From: El Date: Thu, 24 Apr 2025 13:54:01 +0500 Subject: [PATCH 082/150] KASM-6984 Refactor benchmarking --- common/rfb/ServerCore.cxx | 6 + common/rfb/ServerCore.h | 1 + common/rfb/TightJPEGEncoder.cxx | 6 + common/rfb/VNCServerST.cxx | 4 +- common/rfb/benchmark.cxx | 241 ++++++++++++++---------- common/rfb/benchmark.h | 133 +++---------- common/rfb/ffmpeg.h | 63 +++++++ spec/vncserver_adv_benchmarking_spec.py | 2 +- 8 files changed, 245 insertions(+), 211 deletions(-) create mode 100644 common/rfb/ffmpeg.h diff --git a/common/rfb/ServerCore.cxx b/common/rfb/ServerCore.cxx index bc5a4bd..22f872c 100644 --- a/common/rfb/ServerCore.cxx +++ b/common/rfb/ServerCore.cxx @@ -121,6 +121,12 @@ rfb::StringParameter rfb::Server::benchmark( "Benchmark", "Run extended benchmarks and exit.", ""); + +rfb::StringParameter rfb::Server::benchmarkResults( + "BenchmarkResults", + "The file to save becnhmark results to.", + "Benchmark.xml"); + rfb::IntParameter rfb::Server::dynamicQualityMin ("DynamicQualityMin", "The minimum dynamic JPEG quality, 0 = low, 9 = high", diff --git a/common/rfb/ServerCore.h b/common/rfb/ServerCore.h index a64fc21..82a06b5 100644 --- a/common/rfb/ServerCore.h +++ b/common/rfb/ServerCore.h @@ -89,6 +89,7 @@ namespace rfb { static BoolParameter ignoreClientSettingsKasm; static BoolParameter selfBench; static StringParameter benchmark; + static StringParameter benchmarkResults; static PresetParameter preferBandwidth; static IntParameter webpEncodingTime; }; diff --git a/common/rfb/TightJPEGEncoder.cxx b/common/rfb/TightJPEGEncoder.cxx index 8041b76..8311725 100644 --- a/common/rfb/TightJPEGEncoder.cxx +++ b/common/rfb/TightJPEGEncoder.cxx @@ -25,6 +25,12 @@ #include #include +#include +#include +#include +#include + + using namespace rfb; struct TightJPEGConfiguration { diff --git a/common/rfb/VNCServerST.cxx b/common/rfb/VNCServerST.cxx index ab6619c..befb1bb 100644 --- a/common/rfb/VNCServerST.cxx +++ b/common/rfb/VNCServerST.cxx @@ -83,7 +83,7 @@ EncCache VNCServerST::encCache; void SelfBench(); -void benchmark(const std::string&); +void benchmark(const std::string&, const std::string&); // // -=- VNCServerST Implementation @@ -236,7 +236,7 @@ VNCServerST::VNCServerST(const char* name_, SDesktop* desktop_) auto *file_name = Server::benchmark.getValueStr(); if (!std::filesystem::exists(file_name)) throw Exception("Benchmarking video file does not exist"); - benchmark(file_name); + benchmark(file_name, Server::benchmarkResults.getValueStr()); } } diff --git a/common/rfb/benchmark.cxx b/common/rfb/benchmark.cxx index 1e7c9ae..4708ee7 100644 --- a/common/rfb/benchmark.cxx +++ b/common/rfb/benchmark.cxx @@ -23,8 +23,105 @@ #include #include #include +#include "ServerCore.h" -void benchmark(const std::string &path) { +void report(std::vector &totals, std::vector &timings, + std::vector &stats, const std::string &results_file) { + auto totals_sum = std::accumulate(totals.begin(), totals.end(), 0.); + auto totals_avg = totals_sum / static_cast(totals.size()); + + auto variance = 0.; + for (auto t: totals) + variance += (static_cast(t) - totals_avg) * (static_cast(t) - totals_avg); + + variance /= static_cast(totals.size()); + auto stddev = std::sqrt(variance); + + const auto sum = std::accumulate(timings.begin(), timings.end(), 0.); + const auto size = timings.size(); + const auto average = sum / static_cast(size); + + double median{}; + + std::sort(timings.begin(), timings.end()); + if (size % 2 == 0) + median = static_cast(timings[size / 2]); + else + median = static_cast(timings[size / 2 - 1] + timings[size / 2]) / 2.; + + vlog.info("Mean time encoding frame: %f ms", average); + vlog.info("Median time encoding frame: %f ms", median); + vlog.info("Total time (mean): %f ms", totals_avg); + vlog.info("Total time (stddev): %f ms", stddev); + + uint32_t jpeg_sum{}, jpeg_rects{}, webp_sum{}, webp_rects{}; + uint64_t bytes{}; + + for (const auto &item: stats) { + jpeg_sum += item.jpeg_stats.ms; + jpeg_rects += item.jpeg_stats.rects; + webp_sum += item.webp_stats.ms; + webp_rects += item.webp_stats.rects; + bytes += item.bytes; + } + + auto jpeg_ms = jpeg_sum / static_cast(stats.size()); + vlog.info("JPEG stats: %f ms", jpeg_ms); + jpeg_rects /= stats.size(); + vlog.info("JPEG stats: %u rects", jpeg_rects); + auto webp_ms = webp_sum / static_cast(stats.size()); + webp_rects /= stats.size(); + bytes /= stats.size(); + vlog.info("WebP stats: %f ms", webp_ms); + vlog.info("WebP stats: %u rects", webp_rects); + vlog.info("Total bytes sent: %lu bytes", bytes); + + tinyxml2::XMLDocument doc; + + auto *test_suit = doc.NewElement("testsuite"); + test_suit->SetAttribute("name", "Benchmark"); + + doc.InsertFirstChild(test_suit); + auto total_tests{0}; + + auto add_benchmark_item = [&doc, &test_suit, &total_tests](const char *name, auto value) { + auto *test_case = doc.NewElement("testcase"); + test_case->SetAttribute("name", name); + test_case->SetAttribute("file", value); + test_case->SetAttribute("runs", 1); + test_case->SetAttribute("classname", "KasmVNC"); + + auto *props = doc.NewElement("properties"); + + auto *prop = doc.NewElement("property"); + prop->SetAttribute("name", name); + props->InsertEndChild(prop); + + prop = doc.NewElement("property"); + prop->SetAttribute("value", value); + props->InsertEndChild(prop); + + test_case->InsertEndChild(props); + test_suit->InsertEndChild(test_case); + + ++total_tests; + }; + + add_benchmark_item("Average time encoding frame, ms", average); + add_benchmark_item("Median time encoding frame, ms", median); + add_benchmark_item("Total time encoding, ms", totals_avg); + add_benchmark_item("Total time encoding, stddev", stddev); + add_benchmark_item("Mean JPEG stats, ms", jpeg_ms); + add_benchmark_item("Mean JPEG stats, rects", jpeg_rects); + add_benchmark_item("Mean WebP stats, ms", webp_ms); + add_benchmark_item("Mean WebP stats, rects", webp_rects); + + add_benchmark_item("Data sent, KBs", bytes / 1024); + + doc.SaveFile(results_file.c_str()); +} + +void benchmark(const std::string &path, const std::string &results_file) { AVFormatContext *format_ctx = nullptr; vlog.info("Benchmarking with video file %s", path.c_str()); @@ -98,123 +195,69 @@ void benchmark(const std::string &path) { rgb_frame->height = codec_ctx->height; static const rfb::PixelFormat pf{32, 24, false, true, 0xFF, 0xFF, 0xFF, 0, 8, 16}; + std::vector encodings{std::begin(rfb::default_encodings), std::end(rfb::default_encodings)}; - auto *pb = new rfb::ManagedPixelBuffer{pf, rgb_frame->width, rgb_frame->height}; - rfb::MockCConnection connection{pb}; + // if (rfb::Server::WebPEnabled) + // encodings.push_back(rfb::pseudoEncodingWEBP); if (av_frame_get_buffer(rgb_frame, 0) != 0) throw std::runtime_error("Could not allocate frame data"); - uint64_t frames{}; + constexpr auto runs = 20; + std::vector totals(runs, 0); + std::vector stats(runs); const size_t total_frame_count = format_ctx->streams[video_stream_idx]->nb_frames; + std::vector timings(total_frame_count > 0 ? total_frame_count * runs : 2048, 0); + uint64_t frames{}; - std::vector timings(total_frame_count > 0 ? total_frame_count : 2048, 0); + for (int run = 0; run < runs; ++run) { + auto *pb = new rfb::ManagedPixelBuffer{pf, rgb_frame->width, rgb_frame->height}; + rfb::MockCConnection connection{encodings, pb}; - vlog.info("Reading frames..."); - while (av_read_frame(format_ctx, packet) == 0) { - if (packet->stream_index == video_stream_idx) { - if (avcodec_send_packet(codec_ctx, packet) == 0) { - while (avcodec_receive_frame(codec_ctx, frame) == 0) { - // Convert to RGB - sws_scale(sws_ctx, frame->data, frame->linesize, 0, frame->height, - rgb_frame->data, rgb_frame->linesize); + uint64_t total{}; - connection.framebufferUpdateStart(); - connection.setNewFrame(rgb_frame); - using namespace std::chrono; + vlog.info("RUN %d. Reading frames...", run); + while (av_read_frame(format_ctx, packet) == 0) { + if (packet->stream_index == video_stream_idx) { + if (avcodec_send_packet(codec_ctx, packet) == 0) { + while (avcodec_receive_frame(codec_ctx, frame) == 0) { + // Convert to RGB + sws_scale(sws_ctx, frame->data, frame->linesize, 0, frame->height, + rgb_frame->data, rgb_frame->linesize); - auto now = high_resolution_clock::now(); - connection.framebufferUpdateEnd(); - const auto duration = duration_cast(high_resolution_clock::now() - now).count(); + connection.framebufferUpdateStart(); + connection.setNewFrame(rgb_frame); + using namespace std::chrono; - vlog.info("Frame took %lu ms", duration); + auto now = high_resolution_clock::now(); + connection.framebufferUpdateEnd(); + const auto duration = duration_cast(high_resolution_clock::now() - now).count(); - // auto [jpeg_stats, webp_stats, bytes, udp_bytes] = connection.getStats(); - //vlog.info("JPEG stats: %d ms", jpeg_stats.ms); - //vlog.info("JPEG stats: %d rects", jpeg_stats.rects); + //vlog.info("Frame took %lu ms", duration); - //vlog.info("WebP stats: %d ms", webp_stats.ms); - // vlog.info("WebP stats: %d rects", webp_stats.rects); - - timings[frames++] = duration; + timings[frames++] = duration; + total += duration; + } } } + av_packet_unref(packet); } - av_packet_unref(packet); + vlog.info("RUN %d. Done reading frames...", run); + + if (av_seek_frame(format_ctx, video_stream_idx, 0, AVSEEK_FLAG_BACKWARD) < 0) + throw std::runtime_error("Could not seek to start of video"); + + avcodec_flush_buffers(codec_ctx); + + totals[run] = total; + stats[run] = connection.getStats(); + vlog.info("RUN %d. Bytes sent %lu..", run, stats[run].bytes); } - vlog.info("Done reading frames..."); - if (frames > 0) { - timings.reserve(frames + 1); + if (frames > 0) + report(totals, timings, stats, results_file); - const auto sum = std::accumulate(timings.begin(), timings.end(), 0.); - const auto size = timings.size(); - const auto average = sum / static_cast(size); - - double median{}; - - std::sort(timings.begin(), timings.end()); - if (size % 2 == 0) - median = static_cast(timings[size / 2]); - else - median = static_cast(timings[size / 2 - 1] + timings[size / 2]) / 2.; - - auto [jpeg_stats, webp_stats, bytes, udp_bytes] = connection.getStats(); - - vlog.info("Average time encoding frame: %f ns", average); - vlog.info("Median time encoding frame: %f ns", median); - vlog.info("Total time: %f ms", sum); - vlog.info("JPEG stats: %d ms", jpeg_stats.ms); - vlog.info("JPEG stats: %d rects", jpeg_stats.rects); - vlog.info("WebP stats: %d ms", webp_stats.ms); - vlog.info("WebP stats: %d rects", webp_stats.rects); - vlog.info("Total bytes sent: %lu bytes", bytes); - - tinyxml2::XMLDocument doc; - - auto *test_suit = doc.NewElement("testsuite"); - test_suit->SetAttribute("name", "Benchmark"); - - doc.InsertFirstChild(test_suit); - - constexpr auto div = 1. / (1000); - auto total_tests{0}; - - auto add_benchmark_item = [&doc, &test_suit, &total_tests](const char *name, auto value) { - auto *test_case = doc.NewElement("testcase"); - test_case->SetAttribute("name", name); - test_case->SetAttribute("file", value); - test_case->SetAttribute("runs", 1); - test_case->SetAttribute("classname", "KasmVNC"); - - auto *props = doc.NewElement("properties"); - - auto *prop = doc.NewElement("property"); - prop->SetAttribute("name", name); - props->InsertEndChild(prop); - - prop = doc.NewElement("property"); - prop->SetAttribute("value", value); - props->InsertEndChild(prop); - - test_case->InsertEndChild(props); - test_suit->InsertEndChild(test_case); - - ++total_tests; - }; - - add_benchmark_item("Average time encoding frame, ms", average * div); - add_benchmark_item("Median time encoding frame, ms", median * div); - add_benchmark_item("Total time encoding, ms", sum * div); - - add_benchmark_item("Data sent, KBs", bytes / 1024); - - //ss.flush(); - //ss << "KBytes sent (UDP): " << udp_bytes / 1024; - //add_benchmark_item(ss.str().c_str(), 0); - - doc.SaveFile("Benchmark.xml"); - } + avcodec_close(codec_ctx); exit(0); } diff --git a/common/rfb/benchmark.h b/common/rfb/benchmark.h index 72a3914..0cb1558 100644 --- a/common/rfb/benchmark.h +++ b/common/rfb/benchmark.h @@ -18,8 +18,7 @@ #pragma once -#include -#include +#include #include #include @@ -30,58 +29,30 @@ #include "LogWriter.h" #include "screenTypes.h" #include "SMsgWriter.h" +#include "ffmpeg.h" namespace rdr { class FileInStream; } -extern "C" { -#include -#include -#include -} - static rfb::LogWriter vlog("Benchmarking"); -struct AVFormatContextDeleter { - void operator()(AVFormatContext *ctx) const { - avformat_close_input(&ctx); - } -}; - -struct AVCodecContextDeleter { - void operator()(AVCodecContext *ctx) const { - avcodec_free_context(&ctx); - } -}; - -struct AVFrameDeleter { - void operator()(AVFrame *frame) const { - av_frame_free(&frame); - } -}; - -struct SwsContextDeleter { - void operator()(SwsContext *ctx) const { - sws_freeContext(ctx); - } -}; - -struct PacketDeleter { - void operator()(AVPacket *packet) const { - av_packet_free(&packet); - } -}; - -using FormatCtxGuard = std::unique_ptr; -using CodecCtxGuard = std::unique_ptr; -using FrameGuard = std::unique_ptr; -using SwsContextGuard = std::unique_ptr; -using PacketGuard = std::unique_ptr; - - namespace rfb { - class MockBufferStream : public rdr::BufferedInStream { + static constexpr rdr::S32 default_encodings[] = { + encodingTight, + encodingZRLE, + encodingHextile, + encodingRRE, + encodingRaw, + pseudoEncodingCompressLevel9, + pseudoEncodingQualityLevel9, + pseudoEncodingFineQualityLevel100, + pseudoEncodingSubsamp16X + //pseudoEncodingWEBP + //pseudoEncodingQOI + }; + + class MockBufferStream final : public rdr::BufferedInStream { bool fillBuffer(size_t maxSize, bool wait) override { return true; } @@ -131,9 +102,6 @@ namespace rfb { void writeUpdate(const UpdateInfo &ui, const PixelBuffer *pb) { //manager.pruneLosslessRefresh(Region(pb->getRect())); - bytes += out.length(); - udp_bytes += udps.length(); - cache.clear(); manager.clearEncodingTime(); @@ -145,45 +113,6 @@ namespace rfb { } } - void writeNoDataUpdate() { - if (!writer()->needNoDataUpdate()) - return; - - writer()->writeNoDataUpdate(); - } - - void WriteDataUpdate() { - Region req, pending; - - if (req.is_empty()) - return; - - if (!pending.is_empty()) { - UpdateInfo ui; - // However, we might still be able to send a lossless refresh - req.assign_subtract(pending); - req.assign_subtract(ui.changed); - req.assign_subtract(ui.copied); - - ui.changed.clear(); - ui.copied.clear(); - } - } - - void writeFramebufferUpdate() { - manager.clearEncodingTime(); - - if (state() != RFBSTATE_NORMAL) - return; - - // First, take care of any updates that cannot contain framebuffer data - // changes. - writeNoDataUpdate(); - - // Then real data (if possible) - WriteDataUpdate(); - } - void setDesktopSize(int fb_width, int fb_height, const ScreenSet &layout) override { cp.width = fb_width; @@ -224,8 +153,8 @@ namespace rfb { return manager.webpstats; } - uint64_t bytes{}; - uint64_t udp_bytes{}; + [[nodiscard]] auto bytes() { return out.length(); } + [[nodiscard]] auto udp_bytes() { return udps.length(); } protected: MockStream out{}; @@ -235,23 +164,9 @@ namespace rfb { EncodeManager manager{this, &cache}; }; - static constexpr rdr::S32 encodings[] = { - encodingTight, - encodingZRLE, - encodingHextile, - encodingRRE, - encodingRaw, - pseudoEncodingCompressLevel9, - pseudoEncodingQualityLevel9, - pseudoEncodingFineQualityLevel100, - pseudoEncodingSubsamp16X - //pseudoEncodingWEBP - //pseudoEncodingQOI - }; - class MockCConnection final : public CConnection { public: - explicit MockCConnection(ManagedPixelBuffer *pb) { + explicit MockCConnection(const std::vector& encodings, ManagedPixelBuffer *pb) { setStreams(&in, nullptr); // Need to skip the initial handshake and ServerInit @@ -266,7 +181,7 @@ namespace rfb { cp.setPF(pf); sc.cp.setPF(pf); - sc.setEncodings(std::size(encodings), encodings); + sc.setEncodings(std::size(encodings), encodings.data()); setFramebuffer(pb); } @@ -284,12 +199,12 @@ namespace rfb { uint64_t udp_bytes; }; - [[nodiscard]] stats_t getStats() const { + [[nodiscard]] stats_t getStats() { return { sc.getJpegStats(), sc.getWebPStats(), - sc.bytes, - sc.udp_bytes + sc.bytes(), + sc.udp_bytes() }; } diff --git a/common/rfb/ffmpeg.h b/common/rfb/ffmpeg.h new file mode 100644 index 0000000..fa3539c --- /dev/null +++ b/common/rfb/ffmpeg.h @@ -0,0 +1,63 @@ +/* Copyright (C) 2025 Kasm Technologies Corp +* + * This is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This software 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, + * USA. + */ + +#pragma once + +#include + +extern "C" { +#include +#include +#include +} + +struct AVFormatContextDeleter { + void operator()(AVFormatContext *ctx) const { + avformat_close_input(&ctx); + } +}; + +struct AVCodecContextDeleter { + void operator()(AVCodecContext *ctx) const { + avcodec_free_context(&ctx); + } +}; + +struct AVFrameDeleter { + void operator()(AVFrame *frame) const { + av_frame_free(&frame); + } +}; + +struct SwsContextDeleter { + void operator()(SwsContext *ctx) const { + sws_freeContext(ctx); + } +}; + +struct PacketDeleter { + void operator()(AVPacket *packet) const { + av_packet_free(&packet); + } +}; + +using FormatCtxGuard = std::unique_ptr; +using CodecCtxGuard = std::unique_ptr; +using FrameGuard = std::unique_ptr; +using SwsContextGuard = std::unique_ptr; +using PacketGuard = std::unique_ptr; diff --git a/spec/vncserver_adv_benchmarking_spec.py b/spec/vncserver_adv_benchmarking_spec.py index 2b805ca..8e4b10f 100644 --- a/spec/vncserver_adv_benchmarking_spec.py +++ b/spec/vncserver_adv_benchmarking_spec.py @@ -9,7 +9,7 @@ with description("Benchmarking"): kill_xvnc() with it("runs benchmarks"): run_cmd("wget --no-check-certificate https://kasmweb-build-artifacts.s3.us-east-1.amazonaws.com/kasmvnc/static/127072-737747495_small.mp4 -O /tmp/video.mp4") - completed_process = run_cmd("Xvnc -interface 0.0.0.0 :1 -Benchmark /tmp/video.mp4") + completed_process = run_cmd("Xvnc -interface 0.0.0.0 :1 -Benchmark /tmp/video.mp4 -VideoArea 100") command = '''sed -i "s/KasmVNC/$(grep -E '^ID=' /etc/os-release | cut -d= -f2 | tr -d '"') $(grep -E '^VERSION_CODENAME=' /etc/os-release | cut -d= -f2 | tr -d '"')/g" Benchmark.xml''' run_cmd(command) expect(completed_process.returncode).to(equal(0)) From 2237c97a5e6251e9baa6e0901f3ad31417a7a3ea Mon Sep 17 00:00:00 2001 From: El Date: Thu, 24 Apr 2025 18:23:56 +0500 Subject: [PATCH 083/150] KASM-6984 Refactor benchmarking --- common/rfb/benchmark.cxx | 35 +++++++++++++---------------------- 1 file changed, 13 insertions(+), 22 deletions(-) diff --git a/common/rfb/benchmark.cxx b/common/rfb/benchmark.cxx index 4708ee7..32aa659 100644 --- a/common/rfb/benchmark.cxx +++ b/common/rfb/benchmark.cxx @@ -84,39 +84,30 @@ void report(std::vector &totals, std::vector &timings, doc.InsertFirstChild(test_suit); auto total_tests{0}; - auto add_benchmark_item = [&doc, &test_suit, &total_tests](const char *name, auto value) { + auto add_benchmark_item = [&doc, &test_suit, &total_tests](const char *name, auto time_value, auto other_value) { auto *test_case = doc.NewElement("testcase"); test_case->SetAttribute("name", name); - test_case->SetAttribute("file", value); + test_case->SetAttribute("file", other_value); + test_case->SetAttribute("time", time_value); test_case->SetAttribute("runs", 1); test_case->SetAttribute("classname", "KasmVNC"); - auto *props = doc.NewElement("properties"); - - auto *prop = doc.NewElement("property"); - prop->SetAttribute("name", name); - props->InsertEndChild(prop); - - prop = doc.NewElement("property"); - prop->SetAttribute("value", value); - props->InsertEndChild(prop); - - test_case->InsertEndChild(props); test_suit->InsertEndChild(test_case); ++total_tests; }; - add_benchmark_item("Average time encoding frame, ms", average); - add_benchmark_item("Median time encoding frame, ms", median); - add_benchmark_item("Total time encoding, ms", totals_avg); - add_benchmark_item("Total time encoding, stddev", stddev); - add_benchmark_item("Mean JPEG stats, ms", jpeg_ms); - add_benchmark_item("Mean JPEG stats, rects", jpeg_rects); - add_benchmark_item("Mean WebP stats, ms", webp_ms); - add_benchmark_item("Mean WebP stats, rects", webp_rects); + constexpr auto mult = 1 / 1000.; + add_benchmark_item("Average time encoding frame, ms", average * mult, ""); + add_benchmark_item("Median time encoding frame, ms", median * mult, ""); + add_benchmark_item("Total time encoding, ms", 0, totals_avg); + add_benchmark_item("Total time encoding, stddev", 0, stddev); + add_benchmark_item("Mean JPEG stats, ms", jpeg_ms, ""); + add_benchmark_item("Mean JPEG stats, rects", 0., jpeg_rects); + add_benchmark_item("Mean WebP stats, ms", webp_ms, ""); + add_benchmark_item("Mean WebP stats, rects", 0, webp_rects); - add_benchmark_item("Data sent, KBs", bytes / 1024); + add_benchmark_item("Data sent, KBs", 0, bytes / 1024); doc.SaveFile(results_file.c_str()); } From f037c3bae1671b07f06347bff66d8d4a0c2860e6 Mon Sep 17 00:00:00 2001 From: El Date: Mon, 28 Apr 2025 23:18:46 +0500 Subject: [PATCH 084/150] KASM-6984 Updated copyright information and performed minor code cleanup to remove unused code and improve readability. --- common/rfb/benchmark.cxx | 2 ++ common/rfb/benchmark.h | 20 ++++---------------- 2 files changed, 6 insertions(+), 16 deletions(-) diff --git a/common/rfb/benchmark.cxx b/common/rfb/benchmark.cxx index 32aa659..eb5c780 100644 --- a/common/rfb/benchmark.cxx +++ b/common/rfb/benchmark.cxx @@ -242,6 +242,8 @@ void benchmark(const std::string &path, const std::string &results_file) { totals[run] = total; stats[run] = connection.getStats(); + vlog.info("JPEG stats: %u ms", stats[run].jpeg_stats.ms); + vlog.info("WebP stats: %u ms", stats[run].webp_stats.ms); vlog.info("RUN %d. Bytes sent %lu..", run, stats[run].bytes); } diff --git a/common/rfb/benchmark.h b/common/rfb/benchmark.h index 0cb1558..c834dfd 100644 --- a/common/rfb/benchmark.h +++ b/common/rfb/benchmark.h @@ -1,4 +1,6 @@ -/* Copyright (C) 2025 Kasm Technologies Corp +/* Copyright 2015 Pierre Ossman for Cendio AB + * Copyright (C) 2015 D. R. Commander. All Rights Reserved. + * Copyright (C) 2025 Kasm Technologies Corp * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -31,10 +33,6 @@ #include "SMsgWriter.h" #include "ffmpeg.h" -namespace rdr { - class FileInStream; -} - static rfb::LogWriter vlog("Benchmarking"); namespace rfb { @@ -100,9 +98,7 @@ namespace rfb { ~MockSConnection() override = default; void writeUpdate(const UpdateInfo &ui, const PixelBuffer *pb) { - //manager.pruneLosslessRefresh(Region(pb->getRect())); - - cache.clear(); + cache.clear(); manager.clearEncodingTime(); if (!ui.is_empty()) { @@ -191,7 +187,6 @@ namespace rfb { ~MockCConnection() override = default; - struct stats_t { EncodeManager::codecstats_t jpeg_stats; EncodeManager::codecstats_t webp_stats; @@ -240,8 +235,6 @@ namespace rfb { } void framebufferUpdateStart() override { - CConnection::framebufferUpdateStart(); - updates.clear(); } @@ -249,7 +242,6 @@ namespace rfb { const PixelBuffer *pb = getFramebuffer(); UpdateInfo ui; - const Region clip(pb->getRect()); updates.add_changed(pb->getRect()); @@ -259,10 +251,6 @@ namespace rfb { } void dataRect(const Rect &r, int encoding) override { - CConnection::dataRect(r, encoding); - - if (encoding != encodingCopyRect) // FIXME - updates.add_changed(Region(r)); } void setColourMapEntries(int, int, rdr::U16 *) override { From 148f22f05f848643af5f3a9af89646d3255f1c44 Mon Sep 17 00:00:00 2001 From: El Date: Mon, 28 Apr 2025 23:40:57 +0500 Subject: [PATCH 085/150] KASM-6984 Update man pages --- unix/xserver/hw/vnc/Xvnc.man | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/unix/xserver/hw/vnc/Xvnc.man b/unix/xserver/hw/vnc/Xvnc.man index c23bccd..206784c 100644 --- a/unix/xserver/hw/vnc/Xvnc.man +++ b/unix/xserver/hw/vnc/Xvnc.man @@ -574,6 +574,16 @@ When \fBNoClipboard\fP parameter is set, allowing override of \fBSendCutText\fP and \fBAcceptCutText\fP has no effect. Default is \fBdesktop,AcceptPointerEvents,SendCutText,AcceptCutText,SendPrimary,SetPrimary\fP. +. +TP +.B -Benchmark +Run the built-in benchmarking routines on the specified video file and exit. +When this option is used, benchmarking results can be saved to a file specified by the \fB-BenchmarkResults\fP option; otherwise, the results are saved to \fBBenchmark.xml\fP by default. +. +.TP +.B -BenchmarkResults +Save the benchmarking results to the specified file. +Use this option together with \fB-Benchmark\fP to output the report to a custom file. .SH USAGE WITH INETD By configuring the \fBinetd\fP(1) service appropriately, Xvnc can be launched From f64dc1a25780894dff0aaa281a3820e62119b731 Mon Sep 17 00:00:00 2001 From: El Date: Tue, 29 Apr 2025 15:29:38 +0500 Subject: [PATCH 086/150] KASM-6984 Add ffmpeg-libs to required packages --- oracle/kasmvncserver.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oracle/kasmvncserver.spec b/oracle/kasmvncserver.spec index 85751bd..e08897a 100644 --- a/oracle/kasmvncserver.spec +++ b/oracle/kasmvncserver.spec @@ -7,7 +7,7 @@ License: GPLv2+ URL: https://github.com/kasmtech/KasmVNC BuildRequires: rsync -Requires: xorg-x11-xauth, xorg-x11-xkb-utils, xkeyboard-config, xorg-x11-server-utils, openssl, perl, perl-Switch, perl-YAML-Tiny, perl-Hash-Merge-Simple, perl-Scalar-List-Utils, perl-List-MoreUtils, perl-Try-Tiny, perl-DateTime-TimeZone, hostname, mesa-libgbm, libxshmfence +Requires: xorg-x11-xauth, xorg-x11-xkb-utils, xkeyboard-config, xorg-x11-server-utils, openssl, perl, perl-Switch, perl-YAML-Tiny, perl-Hash-Merge-Simple, perl-Scalar-List-Utils, perl-List-MoreUtils, perl-Try-Tiny, perl-DateTime-TimeZone, hostname, mesa-libgbm, libxshmfence, ffmpeg-libs Conflicts: tigervnc-server, tigervnc-server-minimal %description From 415607ea42894e92a15bf03f03516d9c1f8fde04 Mon Sep 17 00:00:00 2001 From: El Date: Thu, 1 May 2025 04:07:47 +0500 Subject: [PATCH 087/150] KASM-6984 Moved to a dynamic library load --- common/rfb/CMakeLists.txt | 3 +- common/rfb/VNCServerST.cxx | 7 +- common/rfb/benchmark.cxx | 421 ++++++++++++++++++++---------- common/rfb/benchmark.h | 250 +----------------- common/rfb/ffmpeg.cxx | 210 +++++++++++++++ common/rfb/ffmpeg.h | 165 +++++++++--- unix/xserver/hw/vnc/vncExtInit.cc | 2 +- 7 files changed, 648 insertions(+), 410 deletions(-) create mode 100644 common/rfb/ffmpeg.cxx diff --git a/common/rfb/CMakeLists.txt b/common/rfb/CMakeLists.txt index 317fe2b..a55ea60 100644 --- a/common/rfb/CMakeLists.txt +++ b/common/rfb/CMakeLists.txt @@ -68,6 +68,7 @@ set(RFB_SOURCES encodings.cxx util.cxx xxhash.c + ffmpeg.cxx ) if (UNIX) @@ -143,7 +144,7 @@ target_include_directories(rfb PRIVATE ${FFMPEG_INCLUDE_DIRS} ) -target_link_libraries(rfb PRIVATE ${RFB_LIBRARIES} tinyxml2_objs ${FFMPEG_LIBRARIES}) +target_link_libraries(rfb PRIVATE ${RFB_LIBRARIES} tinyxml2_objs) if (UNIX) libtool_create_control_file(rfb) diff --git a/common/rfb/VNCServerST.cxx b/common/rfb/VNCServerST.cxx index befb1bb..94979a9 100644 --- a/common/rfb/VNCServerST.cxx +++ b/common/rfb/VNCServerST.cxx @@ -48,8 +48,8 @@ // otherwise blacklisted connections might be "forgotten". -#include -#include +#include +#include #include #include @@ -74,6 +74,7 @@ #include #include #include +#include using namespace rfb; @@ -83,7 +84,7 @@ EncCache VNCServerST::encCache; void SelfBench(); -void benchmark(const std::string&, const std::string&); +void benchmark(std::string_view, std::string_view); // // -=- VNCServerST Implementation diff --git a/common/rfb/benchmark.cxx b/common/rfb/benchmark.cxx index eb5c780..4218d91 100644 --- a/common/rfb/benchmark.cxx +++ b/common/rfb/benchmark.cxx @@ -1,4 +1,6 @@ -/* Copyright (C) 2025 Kasm Technologies Corp +/* Copyright 2015 Pierre Ossman for Cendio AB + * Copyright (C) 2015 D. R. Commander. All Rights Reserved. + * Copyright (C) 2025 Kasm Technologies Corp * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,16 +19,253 @@ */ #include "benchmark.h" -#include -#include +#include #include #include #include #include +#include + #include "ServerCore.h" +#include + +#include "EncCache.h" +#include "EncodeManager.h" +#include "SConnection.h" +#include "screenTypes.h" +#include "SMsgWriter.h" +#include "UpdateTracker.h" +#include "rdr/BufferedInStream.h" +#include "rdr/OutStream.h" +#include "ffmpeg.h" + +namespace benchmarking { + class MockBufferStream final : public rdr::BufferedInStream { + bool fillBuffer(size_t maxSize, bool wait) override { + return true; + } + }; + + class MockStream final : public rdr::OutStream { + public: + MockStream() { + offset = 0; + ptr = buf; + end = buf + sizeof(buf); + } + + private: + void overrun(size_t needed) override { + assert(end >= ptr); + if (needed > static_cast(end - ptr)) + flush(); + } + + public: + size_t length() override { + flush(); + return offset; + } + + void flush() override { + offset += ptr - buf; + ptr = buf; + } + + private: + ptrdiff_t offset; + rdr::U8 buf[8192]{}; + }; + + class MockSConnection final : public rfb::SConnection { + public: + MockSConnection() { + setStreams(nullptr, &out); + + setWriter(new rfb::SMsgWriter(&cp, &out, &udps)); + } + + ~MockSConnection() override = default; + + void writeUpdate(const rfb::UpdateInfo &ui, const rfb::PixelBuffer *pb) { + cache.clear(); + + manager.clearEncodingTime(); + if (!ui.is_empty()) { + manager.writeUpdate(ui, pb, nullptr); + } else { + rfb::Region region{pb->getRect()}; + manager.writeLosslessRefresh(region, pb, nullptr, 2000); + } + } + + void setDesktopSize(int fb_width, int fb_height, + const rfb::ScreenSet &layout) override { + cp.width = fb_width; + cp.height = fb_height; + cp.screenLayout = layout; + + writer()->writeExtendedDesktopSize(rfb::reasonServer, 0, cp.width, cp.height, + cp.screenLayout); + } + + void sendStats(const bool toClient) override { + } + + [[nodiscard]] bool canChangeKasmSettings() const override { + return false; + } + + void udpUpgrade(const char *resp) override { + } + + void udpDowngrade(const bool) override { + } + + void subscribeUnixRelay(const char *name) override { + } + + void unixRelay(const char *name, const rdr::U8 *buf, const unsigned len) override { + } + + void handleFrameStats(rdr::U32 all, rdr::U32 render) override { + } + + [[nodiscard]] auto getJpegStats() const { + return manager.jpegstats; + } + + [[nodiscard]] auto getWebPStats() const { + return manager.webpstats; + } + + [[nodiscard]] auto bytes() { return out.length(); } + [[nodiscard]] auto udp_bytes() { return udps.length(); } + + protected: + MockStream out{}; + MockStream udps{}; + + EncCache cache{}; + EncodeManager manager{this, &cache}; + }; + + class MockCConnection final : public MockTestConnection { + public: + explicit MockCConnection(const std::vector &encodings, rfb::ManagedPixelBuffer *pb) { + setStreams(&in, nullptr); + + // Need to skip the initial handshake and ServerInit + setState(RFBSTATE_NORMAL); + // That also means that the reader and writer weren't set up + setReader(new rfb::CMsgReader(this, &in)); + auto &pf = pb->getPF(); + CMsgHandler::setPixelFormat(pf); + + MockCConnection::setDesktopSize(pb->width(), pb->height()); + + cp.setPF(pf); + + sc.cp.setPF(pf); + sc.setEncodings(std::size(encodings), encodings.data()); + + setFramebuffer(pb); + } + + void setCursor(int width, int height, const rfb::Point &hotspot, const rdr::U8 *data, + const bool resizing) override { + } + + ~MockCConnection() override = default; + + struct stats_t { + EncodeManager::codecstats_t jpeg_stats; + EncodeManager::codecstats_t webp_stats; + uint64_t bytes; + uint64_t udp_bytes; + }; + + [[nodiscard]] stats_t getStats() { + return { + sc.getJpegStats(), + sc.getWebPStats(), + sc.bytes(), + sc.udp_bytes() + }; + } + + void setDesktopSize(int w, int h) override { + CConnection::setDesktopSize(w, h); + + if (screen_layout.num_screens()) + screen_layout.remove_screen(0); + + screen_layout.add_screen(rfb::Screen(0, 0, 0, w, h, 0)); + } + + void setNewFrame(const AVFrame *frame) override { + auto *pb = getFramebuffer(); + const int width = pb->width(); + const int height = pb->height(); + const rfb::Rect rect(0, 0, width, height); + + int dstStride{}; + auto *buffer = pb->getBufferRW(rect, &dstStride); + + const rfb::PixelFormat &pf = pb->getPF(); + + // Source data and stride from FFmpeg + const auto *srcData = frame->data[0]; + const int srcStride = frame->linesize[0] / 3; // Convert bytes to pixels + + // Convert from the RGB format to the PixelBuffer's format + pf.bufferFromRGB(buffer, srcData, width, srcStride, height); + + // Commit changes + pb->commitBufferRW(rect); + } + + void framebufferUpdateStart() override { + updates.clear(); + } + + void framebufferUpdateEnd() override { + const rfb::PixelBuffer *pb = getFramebuffer(); + + rfb::UpdateInfo ui; + const rfb::Region clip(pb->getRect()); + + updates.add_changed(pb->getRect()); + + updates.getUpdateInfo(&ui, clip); + sc.writeUpdate(ui, pb); + } + + void dataRect(const rfb::Rect &r, int encoding) override { + } + + void setColourMapEntries(int, int, rdr::U16 *) override { + } + + void bell() override { + } + + void serverCutText(const char *, rdr::U32) override { + } + + void serverCutText(const char *str) override { + } + + protected: + MockBufferStream in; + rfb::ScreenSet screen_layout; + rfb::SimpleUpdateTracker updates; + MockSConnection sc; + }; +} void report(std::vector &totals, std::vector &timings, - std::vector &stats, const std::string &results_file) { + std::vector &stats, const std::string_view results_file) { auto totals_sum = std::accumulate(totals.begin(), totals.end(), 0.); auto totals_avg = totals_sum / static_cast(totals.size()); @@ -109,148 +348,52 @@ void report(std::vector &totals, std::vector &timings, add_benchmark_item("Data sent, KBs", 0, bytes / 1024); - doc.SaveFile(results_file.c_str()); + doc.SaveFile(results_file.data()); } -void benchmark(const std::string &path, const std::string &results_file) { - AVFormatContext *format_ctx = nullptr; +void benchmark(std::string_view path, const std::string_view results_file) { + try { + vlog.info("Benchmarking with video file %s", path.data()); + FFmpegFrameFeeder frame_feeder{}; + frame_feeder.open(path); - vlog.info("Benchmarking with video file %s", path.c_str()); + static const rfb::PixelFormat pf{32, 24, false, true, 0xFF, 0xFF, 0xFF, 0, 8, 16}; + const std::vector encodings{ + std::begin(benchmarking::default_encodings), std::end(benchmarking::default_encodings) + }; - if (avformat_open_input(&format_ctx, path.c_str(), nullptr, nullptr) < 0) - throw std::runtime_error("Could not open video file"); + // if (rfb::Server::WebPEnabled) + // encodings.push_back(rfb::pseudoEncodingWEBP); - FormatCtxGuard format_ctx_guard{format_ctx}; + constexpr auto runs = 20; + std::vector totals(runs, 0); + std::vector stats(runs); + std::vector timings{}; + auto [width, height] = frame_feeder.get_frame_dimensions(); - // Find stream info - if (avformat_find_stream_info(format_ctx, nullptr) < 0) - throw std::runtime_error("Could not find stream info"); + for (int run = 0; run < runs; ++run) { + auto *pb = new rfb::ManagedPixelBuffer{pf, width, height}; + benchmarking::MockCConnection connection{encodings, pb}; - // Find video stream - int video_stream_idx = -1; - for (uint32_t i = 0; i < format_ctx->nb_streams; ++i) { - if (format_ctx->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) { - video_stream_idx = static_cast(i); - break; + vlog.info("RUN %d. Reading frames...", run); + auto play_stats = frame_feeder.play(&connection); + vlog.info("RUN %d. Done reading frames...", run); + + timings.insert(timings.end(), play_stats.timings.begin(), play_stats.timings.end()); + + totals[run] = play_stats.total; + stats[run] = connection.getStats(); + vlog.info("JPEG stats: %u ms", stats[run].jpeg_stats.ms); + vlog.info("WebP stats: %u ms", stats[run].webp_stats.ms); + vlog.info("RUN %d. Bytes sent %lu..", run, stats[run].bytes); } + + if (!timings.empty()) + report(totals, timings, stats, results_file); + + exit(0); + } catch (std::exception &e) { + vlog.error("Benchmarking failed: %s", e.what()); + exit(1); } - - if (video_stream_idx == -1) - throw std::runtime_error("No video stream found"); - - // Get codec parameters and decoder - const auto *codec_parameters = format_ctx->streams[video_stream_idx]->codecpar; - const auto *codec = avcodec_find_decoder(codec_parameters->codec_id); - if (!codec) - throw std::runtime_error("Codec not found"); - - const CodecCtxGuard codex_ctx_guard{avcodec_alloc_context3(codec)}; - auto *codec_ctx = codex_ctx_guard.get(); - - if (!codec_ctx || avcodec_parameters_to_context(codec_ctx, codec_parameters) < 0) - throw std::runtime_error("Failed to set up codec context"); - - if (avcodec_open2(codec_ctx, codec, nullptr) < 0) - throw std::runtime_error("Could not open codec"); - - // Allocate frame and packet - const FrameGuard frame_guard{av_frame_alloc()}; - auto *frame = frame_guard.get(); - - const PacketGuard packet_guard{av_packet_alloc()}; - auto *packet = packet_guard.get(); - - if (!frame || !packet) - throw std::runtime_error("Could not allocate frame or packet"); - - // Scaling context to convert to RGB24 - SwsContext *sws_ctx = sws_getContext( - codec_ctx->width, codec_ctx->height, codec_ctx->pix_fmt, - codec_ctx->width, codec_ctx->height, AV_PIX_FMT_RGB24, - SWS_BILINEAR, nullptr, nullptr, nullptr - ); - - if (!sws_ctx) - throw std::runtime_error("Could not create scaling context"); - - SwsContextGuard sws_ctx_guard{sws_ctx}; - - const FrameGuard rgb_frame_guard{av_frame_alloc()}; - auto *rgb_frame = rgb_frame_guard.get(); - - if (!rgb_frame) - throw std::runtime_error("Could not allocate frame"); - - rgb_frame->format = AV_PIX_FMT_RGB24; - rgb_frame->width = codec_ctx->width; - rgb_frame->height = codec_ctx->height; - - static const rfb::PixelFormat pf{32, 24, false, true, 0xFF, 0xFF, 0xFF, 0, 8, 16}; - std::vector encodings{std::begin(rfb::default_encodings), std::end(rfb::default_encodings)}; - - // if (rfb::Server::WebPEnabled) - // encodings.push_back(rfb::pseudoEncodingWEBP); - - if (av_frame_get_buffer(rgb_frame, 0) != 0) - throw std::runtime_error("Could not allocate frame data"); - - constexpr auto runs = 20; - std::vector totals(runs, 0); - std::vector stats(runs); - const size_t total_frame_count = format_ctx->streams[video_stream_idx]->nb_frames; - std::vector timings(total_frame_count > 0 ? total_frame_count * runs : 2048, 0); - uint64_t frames{}; - - for (int run = 0; run < runs; ++run) { - auto *pb = new rfb::ManagedPixelBuffer{pf, rgb_frame->width, rgb_frame->height}; - rfb::MockCConnection connection{encodings, pb}; - - uint64_t total{}; - - vlog.info("RUN %d. Reading frames...", run); - while (av_read_frame(format_ctx, packet) == 0) { - if (packet->stream_index == video_stream_idx) { - if (avcodec_send_packet(codec_ctx, packet) == 0) { - while (avcodec_receive_frame(codec_ctx, frame) == 0) { - // Convert to RGB - sws_scale(sws_ctx, frame->data, frame->linesize, 0, frame->height, - rgb_frame->data, rgb_frame->linesize); - - connection.framebufferUpdateStart(); - connection.setNewFrame(rgb_frame); - using namespace std::chrono; - - auto now = high_resolution_clock::now(); - connection.framebufferUpdateEnd(); - const auto duration = duration_cast(high_resolution_clock::now() - now).count(); - - //vlog.info("Frame took %lu ms", duration); - - timings[frames++] = duration; - total += duration; - } - } - } - av_packet_unref(packet); - } - vlog.info("RUN %d. Done reading frames...", run); - - if (av_seek_frame(format_ctx, video_stream_idx, 0, AVSEEK_FLAG_BACKWARD) < 0) - throw std::runtime_error("Could not seek to start of video"); - - avcodec_flush_buffers(codec_ctx); - - totals[run] = total; - stats[run] = connection.getStats(); - vlog.info("JPEG stats: %u ms", stats[run].jpeg_stats.ms); - vlog.info("WebP stats: %u ms", stats[run].webp_stats.ms); - vlog.info("RUN %d. Bytes sent %lu..", run, stats[run].bytes); - } - - if (frames > 0) - report(totals, timings, stats, results_file); - - avcodec_close(codec_ctx); - - exit(0); } diff --git a/common/rfb/benchmark.h b/common/rfb/benchmark.h index c834dfd..b6fa324 100644 --- a/common/rfb/benchmark.h +++ b/common/rfb/benchmark.h @@ -1,7 +1,5 @@ -/* Copyright 2015 Pierre Ossman for Cendio AB - * Copyright (C) 2015 D. R. Commander. All Rights Reserved. - * Copyright (C) 2025 Kasm Technologies Corp - * +/* Copyright (C) 2025 Kasm Technologies Corp +* * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or @@ -20,22 +18,24 @@ #pragma once -#include -#include -#include - #include "CConnection.h" #include "CMsgReader.h" -#include "EncCache.h" -#include "EncodeManager.h" #include "LogWriter.h" -#include "screenTypes.h" -#include "SMsgWriter.h" -#include "ffmpeg.h" + +extern "C" { +#include +} static rfb::LogWriter vlog("Benchmarking"); -namespace rfb { +namespace benchmarking { + using namespace rfb; + + class MockTestConnection : public CConnection { + public: + virtual void setNewFrame(const AVFrame *frame) = 0; + }; + static constexpr rdr::S32 default_encodings[] = { encodingTight, encodingZRLE, @@ -49,226 +49,4 @@ namespace rfb { //pseudoEncodingWEBP //pseudoEncodingQOI }; - - class MockBufferStream final : public rdr::BufferedInStream { - bool fillBuffer(size_t maxSize, bool wait) override { - return true; - } - }; - - class MockStream final : public rdr::OutStream { - public: - MockStream() { - offset = 0; - ptr = buf; - end = buf + sizeof(buf); - } - - private: - void overrun(size_t needed) override { - assert(end >= ptr); - if (needed > static_cast(end - ptr)) - flush(); - } - - public: - size_t length() override { - flush(); - return offset; - } - - void flush() override { - offset += ptr - buf; - ptr = buf; - } - - private: - ptrdiff_t offset; - rdr::U8 buf[8192]{}; - }; - - class MockSConnection final : public SConnection { - public: - MockSConnection() { - setStreams(nullptr, &out); - - setWriter(new SMsgWriter(&cp, &out, &udps)); - } - - ~MockSConnection() override = default; - - void writeUpdate(const UpdateInfo &ui, const PixelBuffer *pb) { - cache.clear(); - - manager.clearEncodingTime(); - if (!ui.is_empty()) { - manager.writeUpdate(ui, pb, nullptr); - } else { - Region region{pb->getRect()}; - manager.writeLosslessRefresh(region, pb, nullptr, 2000); - } - } - - void setDesktopSize(int fb_width, int fb_height, - const ScreenSet &layout) override { - cp.width = fb_width; - cp.height = fb_height; - cp.screenLayout = layout; - - writer()->writeExtendedDesktopSize(reasonServer, 0, cp.width, cp.height, - cp.screenLayout); - } - - void sendStats(const bool toClient) override { - } - - [[nodiscard]] bool canChangeKasmSettings() const override { - return false; - } - - void udpUpgrade(const char *resp) override { - } - - void udpDowngrade(const bool) override { - } - - void subscribeUnixRelay(const char *name) override { - } - - void unixRelay(const char *name, const rdr::U8 *buf, const unsigned len) override { - } - - void handleFrameStats(rdr::U32 all, rdr::U32 render) override { - } - - [[nodiscard]] auto getJpegStats() const { - return manager.jpegstats; - } - - [[nodiscard]] auto getWebPStats() const { - return manager.webpstats; - } - - [[nodiscard]] auto bytes() { return out.length(); } - [[nodiscard]] auto udp_bytes() { return udps.length(); } - - protected: - MockStream out{}; - MockStream udps{}; - - EncCache cache{}; - EncodeManager manager{this, &cache}; - }; - - class MockCConnection final : public CConnection { - public: - explicit MockCConnection(const std::vector& encodings, ManagedPixelBuffer *pb) { - setStreams(&in, nullptr); - - // Need to skip the initial handshake and ServerInit - setState(RFBSTATE_NORMAL); - // That also means that the reader and writer weren't set up - setReader(new rfb::CMsgReader(this, &in)); - auto &pf = pb->getPF(); - CMsgHandler::setPixelFormat(pf); - - MockCConnection::setDesktopSize(pb->width(), pb->height()); - - cp.setPF(pf); - - sc.cp.setPF(pf); - sc.setEncodings(std::size(encodings), encodings.data()); - - setFramebuffer(pb); - } - - void setCursor(int width, int height, const Point &hotspot, const rdr::U8 *data, const bool resizing) override { - } - - ~MockCConnection() override = default; - - struct stats_t { - EncodeManager::codecstats_t jpeg_stats; - EncodeManager::codecstats_t webp_stats; - uint64_t bytes; - uint64_t udp_bytes; - }; - - [[nodiscard]] stats_t getStats() { - return { - sc.getJpegStats(), - sc.getWebPStats(), - sc.bytes(), - sc.udp_bytes() - }; - } - - void setDesktopSize(int w, int h) override { - CConnection::setDesktopSize(w, h); - - if (screen_layout.num_screens()) - screen_layout.remove_screen(0); - - screen_layout.add_screen(Screen(0, 0, 0, w, h, 0)); - } - - void setNewFrame(const AVFrame *frame) { - auto *pb = getFramebuffer(); - const int width = pb->width(); - const int height = pb->height(); - const rfb::Rect rect(0, 0, width, height); - - int dstStride{}; - auto *buffer = pb->getBufferRW(rect, &dstStride); - - const PixelFormat &pf = pb->getPF(); - - // Source data and stride from FFmpeg - const auto *srcData = frame->data[0]; - const int srcStride = frame->linesize[0] / 3; // Convert bytes to pixels - - // Convert from the RGB format to the PixelBuffer's format - pf.bufferFromRGB(buffer, srcData, width, srcStride, height); - - // Commit changes - pb->commitBufferRW(rect); - } - - void framebufferUpdateStart() override { - updates.clear(); - } - - void framebufferUpdateEnd() override { - const PixelBuffer *pb = getFramebuffer(); - - UpdateInfo ui; - const Region clip(pb->getRect()); - - updates.add_changed(pb->getRect()); - - updates.getUpdateInfo(&ui, clip); - sc.writeUpdate(ui, pb); - } - - void dataRect(const Rect &r, int encoding) override { - } - - void setColourMapEntries(int, int, rdr::U16 *) override { - } - - void bell() override { - } - - void serverCutText(const char *, rdr::U32) override { - } - - void serverCutText(const char *str) override { - } - - protected: - MockBufferStream in; - ScreenSet screen_layout; - SimpleUpdateTracker updates; - MockSConnection sc; - }; } diff --git a/common/rfb/ffmpeg.cxx b/common/rfb/ffmpeg.cxx new file mode 100644 index 0000000..2c803d0 --- /dev/null +++ b/common/rfb/ffmpeg.cxx @@ -0,0 +1,210 @@ +/* Copyright (C) 2025 Kasm Technologies Corp +* + * This is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This software 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, + * USA. + */ + +#include "ffmpeg.h" +#include +#include +#include + +FFmpegFrameFeeder::FFmpegFrameFeeder() { + static constexpr std::array paths = { + "/usr/lib/", + "/usr/lib64" + }; + + namespace fs = std::filesystem; + using namespace std::string_literals; + + auto load_lib = [](auto *lib) { + void *handle{}; + for (const auto &dir: paths) { + if (!fs::exists(dir) || !fs::is_directory(dir)) + continue; + + for (const auto &entry: fs::recursive_directory_iterator(dir)) { + if (!entry.is_regular_file()) + continue; + + const std::string filename = entry.path().filename().string(); + if (filename.find(lib) != std::string::npos) { + handle = dlopen(filename.c_str(), RTLD_LAZY); + + break; + } + } + } + + if (!handle) + throw std::runtime_error("Could not open "s + lib); + + return DlHandlerGuard{handle}; + }; + + // libavformat + libavformat = load_lib("libavformat.so"); + auto handle = libavformat.get(); + + avformat_open_input_f = D_LOOKUP_SYM(handle, avformat_open_input); + avformat_find_stream_info_f = D_LOOKUP_SYM(handle, avformat_find_stream_info); + avcodec_find_decoder_f = D_LOOKUP_SYM(handle, avcodec_find_decoder); + avcodec_parameters_to_context_f = D_LOOKUP_SYM(handle, avcodec_parameters_to_context); + av_read_frame_f = D_LOOKUP_SYM(handle, av_read_frame); + av_seek_frame_f = D_LOOKUP_SYM(handle, av_seek_frame); + avformat_close_input_f = D_LOOKUP_SYM(handle, avformat_close_input); + + vlog.info("libavformat.so loaded"); + + // libavutil + libavutil = load_lib("libavutil.so"); + handle = libavutil.get(); + + av_frame_free_f = D_LOOKUP_SYM(handle, av_frame_free); + av_frame_alloc_f = D_LOOKUP_SYM(handle, av_frame_alloc); + av_frame_get_buffer_f = D_LOOKUP_SYM(handle, av_frame_get_buffer); + + vlog.info("libavutil.so loaded"); + + // libswscale + libswscale = load_lib("libswscale.so"); + handle = libswscale.get(); + + sws_freeContext_f = D_LOOKUP_SYM(handle, sws_freeContext); + sws_getContext_f = D_LOOKUP_SYM(handle, sws_getContext); + sws_scale_f = D_LOOKUP_SYM(handle, sws_scale); + + // libavcodec + libavcodec = load_lib("libavcodec.so"); + handle = libavcodec.get(); + + avcodec_open2_f = D_LOOKUP_SYM(handle, avcodec_open2); + avcodec_alloc_context3_f = D_LOOKUP_SYM(handle, avcodec_alloc_context3); + avcodec_send_packet_f = D_LOOKUP_SYM(handle, avcodec_send_packet); + avcodec_receive_frame_f = D_LOOKUP_SYM(handle, avcodec_receive_frame); + av_packet_unref_f = D_LOOKUP_SYM(handle, av_packet_unref); + avcodec_flush_buffers_f = D_LOOKUP_SYM(handle, avcodec_flush_buffers); + avcodec_close_f = D_LOOKUP_SYM(handle, avcodec_close); + av_packet_alloc_f = D_LOOKUP_SYM(handle, av_packet_alloc); + av_packet_free_f = D_LOOKUP_SYM(handle, av_packet_free); +} + +FFmpegFrameFeeder::~FFmpegFrameFeeder() { + avformat_close_input_f(&format_ctx); + avcodec_close_f(codec_ctx); + avcodec_free_context_f(&codec_ctx); +} + +void FFmpegFrameFeeder::open(const std::string_view path) { + if (avformat_open_input_f(&format_ctx, path.data(), nullptr, nullptr) < 0) + throw std::runtime_error("Could not open video file"); + + // Find stream info + if (avformat_find_stream_info_f(format_ctx, nullptr) < 0) + throw std::runtime_error("Could not find stream info"); + + // Find video stream + for (uint32_t i = 0; i < format_ctx->nb_streams; ++i) { + if (format_ctx->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) { + video_stream_idx = static_cast(i); + break; + } + } + + if (video_stream_idx == -1) + throw std::runtime_error("No video stream found"); + + // Get codec parameters and decoder + const auto *codec_parameters = format_ctx->streams[video_stream_idx]->codecpar; + const auto *codec = avcodec_find_decoder_f(codec_parameters->codec_id); + if (!codec) + throw std::runtime_error("Codec not found"); + + codec_ctx = avcodec_alloc_context3_f(codec); + if (!codec_ctx || avcodec_parameters_to_context_f(codec_ctx, codec_parameters) < 0) + throw std::runtime_error("Failed to set up codec context"); + + if (avcodec_open2_f(codec_ctx, codec, nullptr) < 0) + throw std::runtime_error("Could not open codec"); +} + +FFmpegFrameFeeder::play_stats_t FFmpegFrameFeeder::play(benchmarking::MockTestConnection *connection) const { + // Allocate frame and packet + const FrameGuard frame{av_frame_alloc_f()}; + const PacketGuard packet{av_packet_alloc_f()}; + + if (!frame || !packet) + throw std::runtime_error("Could not allocate frame or packet"); + + // Scaling context to convert to RGB24 + SwsContext *sws_ctx = sws_getContext_f( + codec_ctx->width, codec_ctx->height, codec_ctx->pix_fmt, + codec_ctx->width, codec_ctx->height, AV_PIX_FMT_RGB24, + SWS_BILINEAR, nullptr, nullptr, nullptr + ); + if (!sws_ctx) + throw std::runtime_error("Could not create scaling context"); + + const std::unique_ptr sws_ctx_guard{sws_ctx, sws_freeContext_f}; + + const FrameGuard rgb_frame{av_frame_alloc_f()}; + if (!rgb_frame) + throw std::runtime_error("Could not allocate frame"); + + rgb_frame->format = AV_PIX_FMT_RGB24; + rgb_frame->width = codec_ctx->width; + rgb_frame->height = codec_ctx->height; + + if (av_frame_get_buffer_f(rgb_frame.get(), 0) != 0) + throw std::runtime_error("Could not allocate frame data"); + + play_stats_t stats{}; + const auto total_frame_count = get_total_frame_count(); + stats.timings.reserve(total_frame_count > 0 ? total_frame_count : 2048); + + while (av_read_frame_f(format_ctx, packet.get()) == 0) { + if (packet->stream_index == video_stream_idx) { + if (avcodec_send_packet_f(codec_ctx, packet.get()) == 0) { + while (avcodec_receive_frame_f(codec_ctx, frame.get()) == 0) { + // Convert to RGB + sws_scale_f(sws_ctx_guard.get(), frame->data, frame->linesize, 0, + frame->height, + rgb_frame->data, rgb_frame->linesize); + + connection->framebufferUpdateStart(); + connection->setNewFrame(rgb_frame.get()); + using namespace std::chrono; + + auto now = high_resolution_clock::now(); + connection->framebufferUpdateEnd(); + const auto duration = duration_cast(high_resolution_clock::now() - now).count(); + + //vlog.info("Frame took %lu ms", duration); + stats.total += duration; + stats.timings.push_back(duration); + } + } + } + av_packet_unref_f(packet.get()); + } + + if (av_seek_frame_f(format_ctx, video_stream_idx, 0, AVSEEK_FLAG_BACKWARD) < 0) + throw std::runtime_error("Could not seek to start of video"); + + avcodec_flush_buffers_f(codec_ctx); + + return stats; +} diff --git a/common/rfb/ffmpeg.h b/common/rfb/ffmpeg.h index fa3539c..61edbf2 100644 --- a/common/rfb/ffmpeg.h +++ b/common/rfb/ffmpeg.h @@ -18,7 +18,10 @@ #pragma once +#include #include +#include +#include "LogWriter.h" extern "C" { #include @@ -26,38 +29,140 @@ extern "C" { #include } -struct AVFormatContextDeleter { - void operator()(AVFormatContext *ctx) const { - avformat_close_input(&ctx); - } -}; +#include "benchmark.h" -struct AVCodecContextDeleter { - void operator()(AVCodecContext *ctx) const { - avcodec_free_context(&ctx); - } -}; +#define STR_HELPER(x) #x +#define STR(x) STR_HELPER(x) +#define CONCAT_STR(a, b) a b -struct AVFrameDeleter { - void operator()(AVFrame *frame) const { - av_frame_free(&frame); - } -}; +#define D_LOOKUP_SYM(handle, name) \ + [](auto handle, auto *sym_name) -> auto { \ + auto *sym = reinterpret_cast(dlsym(handle, sym_name)); \ + if (!sym) \ + throw std::runtime_error("Failed to load symbol "s + sym_name); \ + return sym; \ + }(handle, STR(name)) -struct SwsContextDeleter { - void operator()(SwsContext *ctx) const { - sws_freeContext(ctx); - } -}; +#define DEFINE_GUARD(name, type, deleter) \ + using name##Guard = std::unique_ptr; -struct PacketDeleter { - void operator()(AVPacket *packet) const { - av_packet_free(&packet); - } -}; +//using SwsContextGuard = std::unique_ptr; -using FormatCtxGuard = std::unique_ptr; -using CodecCtxGuard = std::unique_ptr; -using FrameGuard = std::unique_ptr; -using SwsContextGuard = std::unique_ptr; -using PacketGuard = std::unique_ptr; +class FFmpegFrameFeeder final { + // libavformat + using avformat_close_input_func = void(*)(AVFormatContext **); + using avformat_open_input_func = int(*)(AVFormatContext **ps, const char *url, const AVInputFormat *fmt, + AVDictionary **options); + using avformat_find_stream_info_func = int (*)(AVFormatContext *ic, AVDictionary **options); + using av_read_frame_func = int (*)(AVFormatContext *s, AVPacket *pkt); + using av_seek_frame_func = int (*)(AVFormatContext *s, int stream_index, int64_t timestamp, int flags); + + // libavutil + using av_frame_free_func = void (*)(AVFrame **); + using av_frame_alloc_func = AVFrame *(*)(); + using av_frame_get_buffer_func = int (*)(AVFrame *frame, int align); + + // libswscale + using sws_freeContext_func = void (*)(SwsContext *); + using sws_getContext_func = SwsContext * (*)(int srcW, int srcH, AVPixelFormat srcFormat, int dstW, int dstH, + AVPixelFormat dstFormat, int flags, SwsFilter *srcFilter, + SwsFilter *dstFilter, const double *param); + + using sws_scale_func = int(*)(SwsContext *c, const uint8_t *const srcSlice[], const int srcStride[], int srcSliceY, + int srcSliceH, uint8_t *const dst[], const int dstStride[]); + + // libavcodec + using avcodec_free_context_func = void (*)(AVCodecContext **); + using av_packet_free_func = void (*)(AVPacket **); + using avcodec_find_decoder_func = const AVCodec * (*)(AVCodecID id); + using avcodec_alloc_context3_func = AVCodecContext* (*)(const AVCodec *codec); + using avcodec_parameters_to_context_func = int (*)(AVCodecContext *codec, const AVCodecParameters *par); + using avcodec_open2_func = int (*)(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options); + using av_packet_alloc_func = AVPacket *(*)(); + using avcodec_send_packet_func = int(*)(AVCodecContext *avctx, const AVPacket *avpkt); + using avcodec_receive_frame_func = int(*)(AVCodecContext *avctx, AVFrame *frame); + using av_packet_unref_func = void (*)(AVPacket *pkt); + using avcodec_flush_buffers_func = void (*)(AVCodecContext *avctx); + using avcodec_close_func = int (*)(AVCodecContext *avctx); + + struct DlHandler { + void operator()(void *handle) const { + dlclose(handle); + } + }; + + using DlHandlerGuard = std::unique_ptr; + + // libavformat + avformat_close_input_func avformat_close_input_f{}; + avformat_open_input_func avformat_open_input_f{}; + avformat_find_stream_info_func avformat_find_stream_info_f{}; + av_read_frame_func av_read_frame_f{}; + av_seek_frame_func av_seek_frame_f{}; + + // libavutil + static inline av_frame_free_func av_frame_free_f{}; + av_frame_alloc_func av_frame_alloc_f{}; + av_frame_get_buffer_func av_frame_get_buffer_f{}; + + // libswscale + sws_freeContext_func sws_freeContext_f{}; + sws_getContext_func sws_getContext_f{}; + sws_scale_func sws_scale_f{}; + + // libavcodec + avcodec_free_context_func avcodec_free_context_f{}; + static inline av_packet_free_func av_packet_free_f{}; + avcodec_find_decoder_func avcodec_find_decoder_f{}; + avcodec_alloc_context3_func avcodec_alloc_context3_f{}; + avcodec_parameters_to_context_func avcodec_parameters_to_context_f{}; + avcodec_open2_func avcodec_open2_f{}; + av_packet_alloc_func av_packet_alloc_f{}; + avcodec_send_packet_func avcodec_send_packet_f{}; + avcodec_receive_frame_func avcodec_receive_frame_f{}; + av_packet_unref_func av_packet_unref_f{}; + avcodec_flush_buffers_func avcodec_flush_buffers_f{}; + avcodec_close_func avcodec_close_f{}; + + rfb::LogWriter vlog{"FFmpeg"}; + + DEFINE_GUARD(Frame, AVFrame, av_frame_free) + DEFINE_GUARD(Packet, AVPacket, av_packet_free) + + AVFormatContext *format_ctx{}; + AVCodecContext *codec_ctx{}; + int video_stream_idx{-1}; + + DlHandlerGuard libavformat{}; + DlHandlerGuard libavutil{}; + DlHandlerGuard libswscale{}; + DlHandlerGuard libavcodec{}; + +public: + FFmpegFrameFeeder(); + + ~FFmpegFrameFeeder(); + + void open(std::string_view path); + + [[nodiscard]] int64_t get_total_frame_count() const { + return format_ctx->streams[video_stream_idx]->nb_frames; + } + + struct frame_dimensions_t { + int width{}; + int height{}; + }; + + [[nodiscard]] frame_dimensions_t get_frame_dimensions() const { + return {codec_ctx->width, codec_ctx->height}; + } + + struct play_stats_t { + uint64_t frames{}; + uint64_t total{}; + std::vector timings; + }; + + play_stats_t play(benchmarking::MockTestConnection *connection) const; +}; diff --git a/unix/xserver/hw/vnc/vncExtInit.cc b/unix/xserver/hw/vnc/vncExtInit.cc index c8ea188..8c74aa8 100644 --- a/unix/xserver/hw/vnc/vncExtInit.cc +++ b/unix/xserver/hw/vnc/vncExtInit.cc @@ -184,7 +184,7 @@ static void parseClipTypes() vlog.debug("Adding DLP binary mime type %s", m.mime); } - vlog.debug("Total %u binary mime types", dlp_mimetypes.size()); + vlog.debug("Total %lu binary mime types", dlp_mimetypes.size()); free(origstr); } From df650b7d0c216cc78199743bcd334775eacc337d Mon Sep 17 00:00:00 2001 From: El Date: Thu, 1 May 2025 16:56:57 +0500 Subject: [PATCH 088/150] KASM-6984 Add WebP for benchmarking when value is not default --- common/rfb/benchmark.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/common/rfb/benchmark.cxx b/common/rfb/benchmark.cxx index 4218d91..0812f7e 100644 --- a/common/rfb/benchmark.cxx +++ b/common/rfb/benchmark.cxx @@ -358,12 +358,12 @@ void benchmark(std::string_view path, const std::string_view results_file) { frame_feeder.open(path); static const rfb::PixelFormat pf{32, 24, false, true, 0xFF, 0xFF, 0xFF, 0, 8, 16}; - const std::vector encodings{ + std::vector encodings{ std::begin(benchmarking::default_encodings), std::end(benchmarking::default_encodings) }; - // if (rfb::Server::WebPEnabled) - // encodings.push_back(rfb::pseudoEncodingWEBP); + if (rfb::Server::webpEncodingTime != 30) + encodings.push_back(rfb::pseudoEncodingWEBP); constexpr auto runs = 20; std::vector totals(runs, 0); From dd12dcd2b74ccd881759708905ade028c51797dd Mon Sep 17 00:00:00 2001 From: El Date: Thu, 1 May 2025 17:27:37 +0500 Subject: [PATCH 089/150] KASM-6984 Reverted changes --- builder/dockerfile.debian_bookworm.deb.build | 2 +- builder/dockerfile.debian_bullseye.deb.build | 2 +- builder/dockerfile.kali_kali-rolling.deb.build | 2 +- builder/dockerfile.ubuntu_focal.deb.build | 2 +- builder/dockerfile.ubuntu_jammy.deb.build | 2 +- builder/dockerfile.ubuntu_noble.deb.build | 2 +- oracle/kasmvncserver.spec | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/builder/dockerfile.debian_bookworm.deb.build b/builder/dockerfile.debian_bookworm.deb.build index 7e38d57..2e61fbb 100644 --- a/builder/dockerfile.debian_bookworm.deb.build +++ b/builder/dockerfile.debian_bookworm.deb.build @@ -3,7 +3,7 @@ FROM debian:bookworm ENV DEBIAN_FRONTEND noninteractive RUN apt-get update && \ - apt-get -y install vim build-essential devscripts equivs libavformat-dev libswscale-dev + apt-get -y install vim build-essential devscripts equivs # Install build-deps for the package. COPY ./debian/control /tmp diff --git a/builder/dockerfile.debian_bullseye.deb.build b/builder/dockerfile.debian_bullseye.deb.build index e8c0ae1..51bde4f 100644 --- a/builder/dockerfile.debian_bullseye.deb.build +++ b/builder/dockerfile.debian_bullseye.deb.build @@ -3,7 +3,7 @@ FROM debian:bullseye ENV DEBIAN_FRONTEND noninteractive RUN apt-get update && \ - apt-get -y install vim build-essential devscripts equivs libavformat-dev libswscale-dev + apt-get -y install vim build-essential devscripts equivs # Install build-deps for the package. COPY ./debian/control /tmp diff --git a/builder/dockerfile.kali_kali-rolling.deb.build b/builder/dockerfile.kali_kali-rolling.deb.build index 3683530..6d0ed1b 100644 --- a/builder/dockerfile.kali_kali-rolling.deb.build +++ b/builder/dockerfile.kali_kali-rolling.deb.build @@ -3,7 +3,7 @@ FROM kalilinux/kali-rolling:latest ENV DEBIAN_FRONTEND noninteractive RUN apt-get update && \ - apt-get -y install vim build-essential devscripts equivs libavformat-dev libswscale-dev + apt-get -y install vim build-essential devscripts equivs # Install build-deps for the package. COPY ./debian/control /tmp diff --git a/builder/dockerfile.ubuntu_focal.deb.build b/builder/dockerfile.ubuntu_focal.deb.build index 5528d2c..ffe6402 100644 --- a/builder/dockerfile.ubuntu_focal.deb.build +++ b/builder/dockerfile.ubuntu_focal.deb.build @@ -3,7 +3,7 @@ FROM ubuntu:focal ENV DEBIAN_FRONTEND noninteractive RUN apt-get update && \ - apt-get -y install vim build-essential devscripts equivs libtbb-dev libavformat-dev libswscale-dev + apt-get -y install vim build-essential devscripts equivs libtbb-dev # Install build-deps for the package. COPY ./debian/control /tmp diff --git a/builder/dockerfile.ubuntu_jammy.deb.build b/builder/dockerfile.ubuntu_jammy.deb.build index ce9d84c..31dee99 100644 --- a/builder/dockerfile.ubuntu_jammy.deb.build +++ b/builder/dockerfile.ubuntu_jammy.deb.build @@ -3,7 +3,7 @@ FROM ubuntu:jammy ENV DEBIAN_FRONTEND noninteractive RUN apt-get update && \ - apt-get -y install vim build-essential devscripts equivs libavformat-dev libswscale-dev + apt-get -y install vim build-essential devscripts equivs # Install build-deps for the package. COPY ./debian/control /tmp diff --git a/builder/dockerfile.ubuntu_noble.deb.build b/builder/dockerfile.ubuntu_noble.deb.build index 982de54..6a56b24 100644 --- a/builder/dockerfile.ubuntu_noble.deb.build +++ b/builder/dockerfile.ubuntu_noble.deb.build @@ -3,7 +3,7 @@ FROM ubuntu:noble ENV DEBIAN_FRONTEND noninteractive RUN apt-get update && \ - apt-get -y install vim build-essential devscripts equivs libavformat-dev libswscale-dev + apt-get -y install vim build-essential devscripts equivs # Install build-deps for the package. COPY ./debian/control /tmp diff --git a/oracle/kasmvncserver.spec b/oracle/kasmvncserver.spec index e08897a..85751bd 100644 --- a/oracle/kasmvncserver.spec +++ b/oracle/kasmvncserver.spec @@ -7,7 +7,7 @@ License: GPLv2+ URL: https://github.com/kasmtech/KasmVNC BuildRequires: rsync -Requires: xorg-x11-xauth, xorg-x11-xkb-utils, xkeyboard-config, xorg-x11-server-utils, openssl, perl, perl-Switch, perl-YAML-Tiny, perl-Hash-Merge-Simple, perl-Scalar-List-Utils, perl-List-MoreUtils, perl-Try-Tiny, perl-DateTime-TimeZone, hostname, mesa-libgbm, libxshmfence, ffmpeg-libs +Requires: xorg-x11-xauth, xorg-x11-xkb-utils, xkeyboard-config, xorg-x11-server-utils, openssl, perl, perl-Switch, perl-YAML-Tiny, perl-Hash-Merge-Simple, perl-Scalar-List-Utils, perl-List-MoreUtils, perl-Try-Tiny, perl-DateTime-TimeZone, hostname, mesa-libgbm, libxshmfence Conflicts: tigervnc-server, tigervnc-server-minimal %description From af1a615dd15d58df1de326fc0444da5c1bf193ec Mon Sep 17 00:00:00 2001 From: El Date: Thu, 1 May 2025 17:45:14 +0500 Subject: [PATCH 090/150] KASM-6984 Reverted added line --- builder/dockerfile.opensuse_15.build | 1 - 1 file changed, 1 deletion(-) diff --git a/builder/dockerfile.opensuse_15.build b/builder/dockerfile.opensuse_15.build index a385424..63d9358 100644 --- a/builder/dockerfile.opensuse_15.build +++ b/builder/dockerfile.opensuse_15.build @@ -48,7 +48,6 @@ RUN zypper install -ny \ xorg-x11-server-sdk \ xorg-x11-util-devel \ zlib-devel -#RUN zypper install -ny libavformat-devel libswscale-devel RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 140 \ --slave /usr/bin/g++ g++ /usr/bin/g++-14 \ From ee43b75f387200b80249d0823659327cea03fe0f Mon Sep 17 00:00:00 2001 From: El Date: Fri, 2 May 2025 16:09:37 +0500 Subject: [PATCH 091/150] KASM-6984 Update benchmark specs and CI to include JPEG and WebP results --- .gitlab-ci.yml | 3 ++- spec/vncserver_adv_benchmarking_spec.py | 13 ++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ad6e84f..678b7fc 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -535,7 +535,8 @@ test: reports: junit: - SelfBench.xml - - Benchmark.xml + - JpegBenchmark.xml + - WebPBenchmark.xml script: - bash builder/test-vncserver diff --git a/spec/vncserver_adv_benchmarking_spec.py b/spec/vncserver_adv_benchmarking_spec.py index 8e4b10f..3ddc0c0 100644 --- a/spec/vncserver_adv_benchmarking_spec.py +++ b/spec/vncserver_adv_benchmarking_spec.py @@ -9,7 +9,14 @@ with description("Benchmarking"): kill_xvnc() with it("runs benchmarks"): run_cmd("wget --no-check-certificate https://kasmweb-build-artifacts.s3.us-east-1.amazonaws.com/kasmvnc/static/127072-737747495_small.mp4 -O /tmp/video.mp4") - completed_process = run_cmd("Xvnc -interface 0.0.0.0 :1 -Benchmark /tmp/video.mp4 -VideoArea 100") - command = '''sed -i "s/KasmVNC/$(grep -E '^ID=' /etc/os-release | cut -d= -f2 | tr -d '"') $(grep -E '^VERSION_CODENAME=' /etc/os-release | cut -d= -f2 | tr -d '"')/g" Benchmark.xml''' - run_cmd(command) + completed_process = run_cmd("Xvnc -interface 0.0.0.0 :1 -Benchmark /tmp/video.mp4 -VideoArea 100 -BenchmarkResults JpegBenchmark.xml") expect(completed_process.returncode).to(equal(0)) + + run_cmd('''sed -i "s/KasmVNC/$(grep -E '^ID=' /etc/os-release | cut -d= -f2 | tr -d '"') $(grep -E '^VERSION_CODENAME=' /etc/os-release | cut -d= -f2 | tr -d '"')/g" JpegBenchmark.xml''') + run_cmd("sed -i 's/testcase name=\"/testcase name=\"JPEG: /g' JpegBenchmark.xml") + + completed_process = run_cmd("Xvnc -interface 0.0.0.0 :1 -Benchmark /tmp/video.mp4 -VideoArea 100 -BenchmarkResults WebPBenchmark.xml") + expect(completed_process.returncode).to(equal(0)) + + run_cmd('''sed -i "s/KasmVNC/$(grep -E '^ID=' /etc/os-release | cut -d= -f2 | tr -d '"') $(grep -E '^VERSION_CODENAME=' /etc/os-release | cut -d= -f2 | tr -d '"')/g" WebPBenchmark.xml''') + run_cmd("sed -i 's/testcase name=\"/testcase name=\"WebP: /g' WebPBenchmark.xml") From 7c4250666a535f74d2922b9d63427a1af5806bfa Mon Sep 17 00:00:00 2001 From: El Date: Fri, 2 May 2025 20:10:42 +0500 Subject: [PATCH 092/150] KASM-6984 Revert changes --- .gitlab-ci.yml | 3 +-- common/rfb/benchmark.cxx | 3 --- common/rfb/benchmark.h | 3 +-- spec/vncserver_adv_benchmarking_spec.py | 13 +++---------- 4 files changed, 5 insertions(+), 17 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 678b7fc..ad6e84f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -535,8 +535,7 @@ test: reports: junit: - SelfBench.xml - - JpegBenchmark.xml - - WebPBenchmark.xml + - Benchmark.xml script: - bash builder/test-vncserver diff --git a/common/rfb/benchmark.cxx b/common/rfb/benchmark.cxx index 0812f7e..21b1bd2 100644 --- a/common/rfb/benchmark.cxx +++ b/common/rfb/benchmark.cxx @@ -362,9 +362,6 @@ void benchmark(std::string_view path, const std::string_view results_file) { std::begin(benchmarking::default_encodings), std::end(benchmarking::default_encodings) }; - if (rfb::Server::webpEncodingTime != 30) - encodings.push_back(rfb::pseudoEncodingWEBP); - constexpr auto runs = 20; std::vector totals(runs, 0); std::vector stats(runs); diff --git a/common/rfb/benchmark.h b/common/rfb/benchmark.h index b6fa324..18659f6 100644 --- a/common/rfb/benchmark.h +++ b/common/rfb/benchmark.h @@ -37,6 +37,7 @@ namespace benchmarking { }; static constexpr rdr::S32 default_encodings[] = { + pseudoEncodingWEBP, encodingTight, encodingZRLE, encodingHextile, @@ -46,7 +47,5 @@ namespace benchmarking { pseudoEncodingQualityLevel9, pseudoEncodingFineQualityLevel100, pseudoEncodingSubsamp16X - //pseudoEncodingWEBP - //pseudoEncodingQOI }; } diff --git a/spec/vncserver_adv_benchmarking_spec.py b/spec/vncserver_adv_benchmarking_spec.py index 3ddc0c0..8e4b10f 100644 --- a/spec/vncserver_adv_benchmarking_spec.py +++ b/spec/vncserver_adv_benchmarking_spec.py @@ -9,14 +9,7 @@ with description("Benchmarking"): kill_xvnc() with it("runs benchmarks"): run_cmd("wget --no-check-certificate https://kasmweb-build-artifacts.s3.us-east-1.amazonaws.com/kasmvnc/static/127072-737747495_small.mp4 -O /tmp/video.mp4") - completed_process = run_cmd("Xvnc -interface 0.0.0.0 :1 -Benchmark /tmp/video.mp4 -VideoArea 100 -BenchmarkResults JpegBenchmark.xml") + completed_process = run_cmd("Xvnc -interface 0.0.0.0 :1 -Benchmark /tmp/video.mp4 -VideoArea 100") + command = '''sed -i "s/KasmVNC/$(grep -E '^ID=' /etc/os-release | cut -d= -f2 | tr -d '"') $(grep -E '^VERSION_CODENAME=' /etc/os-release | cut -d= -f2 | tr -d '"')/g" Benchmark.xml''' + run_cmd(command) expect(completed_process.returncode).to(equal(0)) - - run_cmd('''sed -i "s/KasmVNC/$(grep -E '^ID=' /etc/os-release | cut -d= -f2 | tr -d '"') $(grep -E '^VERSION_CODENAME=' /etc/os-release | cut -d= -f2 | tr -d '"')/g" JpegBenchmark.xml''') - run_cmd("sed -i 's/testcase name=\"/testcase name=\"JPEG: /g' JpegBenchmark.xml") - - completed_process = run_cmd("Xvnc -interface 0.0.0.0 :1 -Benchmark /tmp/video.mp4 -VideoArea 100 -BenchmarkResults WebPBenchmark.xml") - expect(completed_process.returncode).to(equal(0)) - - run_cmd('''sed -i "s/KasmVNC/$(grep -E '^ID=' /etc/os-release | cut -d= -f2 | tr -d '"') $(grep -E '^VERSION_CODENAME=' /etc/os-release | cut -d= -f2 | tr -d '"')/g" WebPBenchmark.xml''') - run_cmd("sed -i 's/testcase name=\"/testcase name=\"WebP: /g' WebPBenchmark.xml") From 5fba51986b0432d7e565e372a0dbcc541500d8a9 Mon Sep 17 00:00:00 2001 From: matt Date: Fri, 2 May 2025 17:52:20 +0000 Subject: [PATCH 093/150] Use pseudoEncodings that match client default settings --- common/rfb/benchmark.cxx | 2 +- common/rfb/benchmark.h | 28 ++++++++++++++++++++++------ 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/common/rfb/benchmark.cxx b/common/rfb/benchmark.cxx index 21b1bd2..c837c0f 100644 --- a/common/rfb/benchmark.cxx +++ b/common/rfb/benchmark.cxx @@ -113,7 +113,7 @@ namespace benchmarking { } [[nodiscard]] bool canChangeKasmSettings() const override { - return false; + return true; } void udpUpgrade(const char *resp) override { diff --git a/common/rfb/benchmark.h b/common/rfb/benchmark.h index 18659f6..1feaa3e 100644 --- a/common/rfb/benchmark.h +++ b/common/rfb/benchmark.h @@ -37,15 +37,31 @@ namespace benchmarking { }; static constexpr rdr::S32 default_encodings[] = { - pseudoEncodingWEBP, + encodingTight, - encodingZRLE, encodingHextile, encodingRRE, encodingRaw, - pseudoEncodingCompressLevel9, - pseudoEncodingQualityLevel9, - pseudoEncodingFineQualityLevel100, - pseudoEncodingSubsamp16X + pseudoEncodingQualityLevel0 + 6, + pseudoEncodingCompressLevel0 + 2, + pseudoEncodingDesktopSize, + pseudoEncodingLastRect, + pseudoEncodingQEMUKeyEvent, + pseudoEncodingExtendedDesktopSize, + pseudoEncodingFence, + pseudoEncodingContinuousUpdates, + pseudoEncodingDesktopName, + pseudoEncodingExtendedClipboard, + pseudoEncodingWEBP, + pseudoEncodingJpegVideoQualityLevel0 + 7, + pseudoEncodingWebpVideoQualityLevel0 + 7, + pseudoEncodingTreatLosslessLevel0 + 7, + pseudoEncodingDynamicQualityMinLevel0 + 4, + pseudoEncodingDynamicQualityMaxLevel0 + 9, + pseudoEncodingVideoAreaLevel1 - 1 + 65, + pseudoEncodingVideoTimeLevel0 + 5, + pseudoEncodingVideoOutTimeLevel1 - 1 + 3, + pseudoEncodingFrameRateLevel10 - 10 + 60, + pseudoEncodingMaxVideoResolution }; } From f13a4c198c263e1cd53e685e50f774d1977ebea3 Mon Sep 17 00:00:00 2001 From: matt Date: Sat, 3 May 2025 10:44:36 +0000 Subject: [PATCH 094/150] clarify readme --- BUILDING.txt | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/BUILDING.txt b/BUILDING.txt index 34c6cdf..4cd1a8e 100644 --- a/BUILDING.txt +++ b/BUILDING.txt @@ -78,7 +78,7 @@ Building the KasmVNC Server using Docker git submodule init git submodule update --remote --merge sudo docker build -t kasmvnc:dev -f builder/dockerfile.ubuntu_jammy.dev . -sudo docker run -it -v ./:/src -p 6901:6901 kasmvnc:dev +sudo docker run -it --rm -v ./:/src -p 6901:6901 -p 8443:8443 --name kasmvnc_dev kasmvnc:dev ``` Now from inside the container. @@ -89,9 +89,9 @@ cd kasmweb npm install npm run build # <-- only run this on subsequent changes to front-end code cd .. -# build dependencies -sudo builder/scripts/build-webp -sudo builder/scripts/build-libjpeg-turbo +# build dependencies, this is optional as they are pre-built in the docker image. Only rebuild if you made version changes and need to test. +# sudo builder/scripts/build-webp +# sudo builder/scripts/build-libjpeg-turbo # Build KasmVNC builder/build.sh ``` @@ -108,12 +108,7 @@ Now open a browser and navigate to your dev VM on port 6901. Running noVNC from source ------------------------- If you need to debug or make changes to the UI code, use the following procedures to use npm to serve the web code. The code will automatically rebuild when changes are made and the code will not be packaged. -These steps assume you have already built the docker image covered in the previous section named `kasmvnc:dev`. - -```bash -# run an instance of the dev container, expose an additional port -sudo docker run -it -v ./:/src -p 6901:6901 -p 8443:8443 --name kasmvnc_dev kasmvnc:dev -``` +These steps assume you are inside the kasmvnc:dev container started in the above steps. Now from inside the container. **This assumes KasmVNC is already built, follow steps above if you need to build KasmVNC** @@ -124,7 +119,7 @@ Now from inside the container. **This assumes KasmVNC is already built, follow s sudo nginx cd kasmweb -npm install +npm install # only needs done first time npm run serve # <-- Needs to run in foreground ``` From 0244c47d7a462c713ebdf35d40b303a828735676 Mon Sep 17 00:00:00 2001 From: Dmitry Maksyoma Date: Sat, 10 May 2025 09:52:34 +0000 Subject: [PATCH 095/150] KASM-7052 Add test-barebones --- .ci/upload.sh | 76 ++- .gitignore | 3 + .gitlab-ci.yml | 618 ++---------------- builder/build-package | 9 +- builder/common.sh | 23 + builder/dockerfile.alpine.barebones.apk.test | 24 + .../dockerfile.alpine_318.barebones.apk.test | 1 + .../dockerfile.alpine_319.barebones.apk.test | 1 + .../dockerfile.alpine_320.barebones.apk.test | 1 + .../dockerfile.alpine_321.barebones.apk.test | 1 + builder/dockerfile.debian.barebones.deb.test | 22 + ...kerfile.debian_bookworm.barebones.deb.test | 1 + ...kerfile.debian_bullseye.barebones.deb.test | 1 + ...dockerfile.fedora_forty.barebones.rpm.test | 25 + ...kerfile.fedora_fortyone.barebones.rpm.test | 25 + ...rfile.kali_kali-rolling.barebones.deb.test | 1 + .../dockerfile.opensuse_15.barebones.rpm.test | 5 +- .../dockerfile.oracle_8.barebones.rpm.test | 12 +- .../dockerfile.oracle_9.barebones.rpm.test | 4 +- ...dockerfile.ubuntu_focal.barebones.deb.test | 21 +- ...dockerfile.ubuntu_jammy.barebones.deb.test | 1 + ...dockerfile.ubuntu_noble.barebones.deb.test | 1 + builder/process_test_options.sh | 6 +- builder/scripts/install_kasmvncserver_package | 28 +- builder/startup/vnc_startup_barebones.sh | 5 + builder/test-apk-barebones | 30 + builder/test-barebones | 42 ++ builder/test-deb-barebones | 19 +- builder/test-rpm-barebones | 17 +- 29 files changed, 404 insertions(+), 619 deletions(-) create mode 100644 builder/dockerfile.alpine.barebones.apk.test create mode 120000 builder/dockerfile.alpine_318.barebones.apk.test create mode 120000 builder/dockerfile.alpine_319.barebones.apk.test create mode 120000 builder/dockerfile.alpine_320.barebones.apk.test create mode 120000 builder/dockerfile.alpine_321.barebones.apk.test create mode 100644 builder/dockerfile.debian.barebones.deb.test create mode 120000 builder/dockerfile.debian_bookworm.barebones.deb.test create mode 120000 builder/dockerfile.debian_bullseye.barebones.deb.test create mode 100644 builder/dockerfile.fedora_forty.barebones.rpm.test create mode 100644 builder/dockerfile.fedora_fortyone.barebones.rpm.test create mode 120000 builder/dockerfile.kali_kali-rolling.barebones.deb.test mode change 100644 => 120000 builder/dockerfile.ubuntu_focal.barebones.deb.test create mode 120000 builder/dockerfile.ubuntu_jammy.barebones.deb.test create mode 120000 builder/dockerfile.ubuntu_noble.barebones.deb.test create mode 100755 builder/test-apk-barebones create mode 100755 builder/test-barebones diff --git a/.ci/upload.sh b/.ci/upload.sh index cc51e50..7541b84 100644 --- a/.ci/upload.sh +++ b/.ci/upload.sh @@ -61,24 +61,80 @@ function prepare_upload_filename() { fi }; +list_files_in_directory() { + local dir="$1" + find "$1" -mindepth 1 +} + +upload_directory_to_s3() { + local dir_to_upload="$1" + local s3_directory="$2"; + local s3_bucket="$3"; + + for file_to_upload in $(list_files_in_directory "$dir_to_upload"); do + upload_to_s3 "$file_to_upload" "$s3_directory/$file_to_upload" "$s3_bucket" + done +} + +prepare_functional_tests_source_and_cd_into_it() { + git clone https://gitlab-ci-token:$CI_JOB_TOKEN@gitlab.com/kasm-technologies/internal/kasmvnc-functional-tests.git + cd kasmvnc-functional-tests + mkdir output && chown 1000:1000 output + mkdir report && chown 1000:1000 report +} + +upload_report_to_s3() { + s3_tests_directory="kasmvnc/${CI_COMMIT_SHA}/tests" + upload_directory_to_s3 report "$s3_tests_directory" "$S3_BUCKET" + aws s3 cp report/index.html "s3://${S3_BUCKET}/${s3_tests_directory}/report/index.html" --metadata-directive REPLACE --content-type "text/html" +} + +put_report_into_ci_pipeline() { + report_name="Functional%20test%20report" + report_url="https://${S3_BUCKET}.s3.amazonaws.com/${s3_tests_directory}/report/index.html" + curl --request POST --header "PRIVATE-TOKEN:${GITLAB_API_TOKEN}" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/statuses/${CI_COMMIT_SHA}?state=success&name=${report_name}&target_url=${report_url}" +} + +prepare_kasmvnc_built_packages_to_replace_workspaces_image_packages() { + cp -r ../output/jammy output/ +} + +prepare_to_run_functional_tests() { + install_packages_needed_for_functional_tests + prepare_functional_tests_source_and_cd_into_it + prepare_s3_uploader + prepare_kasmvnc_built_packages_to_replace_workspaces_image_packages +} + +install_packages_needed_for_functional_tests() { + export DEBIAN_FRONTEND=noninteractive + apt-get update && apt-get install -y git tree curl docker.io awscli + apt-get install -y ruby3.1 wget + apt-get install -y python3 python3-pip python3-boto3 curl pkg-config libxmlsec1-dev +} + function upload_to_s3() { - local package="$1"; - local upload_filename="$2"; + local file_to_upload="$1"; + local s3_url_for_file="$2"; local s3_bucket="$3"; # Transfer to S3 - python3 amazon-s3-bitbucket-pipelines-python/s3_upload.py "${s3_bucket}" "$package" "${upload_filename}"; + python3 amazon-s3-bitbucket-pipelines-python/s3_upload.py "$s3_bucket" "$file_to_upload" "$s3_url_for_file"; # Use the Gitlab API to tell Gitlab where the artifact was stored - export S3_URL="https://${s3_bucket}.s3.amazonaws.com/${upload_filename}"; + export S3_URL="https://${s3_bucket}.s3.amazonaws.com/${s3_url_for_file}"; }; +function prepare_s3_uploader() { + git clone https://bitbucket.org/awslabs/amazon-s3-bitbucket-pipelines-python.git +} + function prepare_to_run_scripts_and_s3_uploads() { - export DEBIAN_FRONTEND=noninteractive; - apt-get update; - apt-get install -y ruby2.7 git wget; - apt-get install -y python3 python3-pip python3-boto3 curl pkg-config libxmlsec1-dev; - git clone https://bitbucket.org/awslabs/amazon-s3-bitbucket-pipelines-python.git; -}; + export DEBIAN_FRONTEND=noninteractive + apt-get update + apt-get install -y ruby2.7 git wget + apt-get install -y python3 python3-pip python3-boto3 curl pkg-config libxmlsec1-dev + prepare_s3_uploader +} detect_release_branch() { if echo $CI_COMMIT_REF_NAME | grep -Pq '^release/([\d.]+)$'; then diff --git a/.gitignore b/.gitignore index 35ea059..3f92e8f 100644 --- a/.gitignore +++ b/.gitignore @@ -29,6 +29,9 @@ debian/kasmvncserver/ .pc .vscode/ +# --run-test artifacts +run_test/ + alpine/.abuild/kasmvnc_signing_key.rsa alpine/.abuild/kasmvnc_signing_key.rsa.pub alpine/packages/ diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ad6e84f..ebf0947 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -22,6 +22,8 @@ workflow: stages: - www - build + - functional_test + - run_test - test - upload @@ -42,6 +44,24 @@ default: tags: - oci-fixed-amd +functional_test: + stage: functional_test + image: debian:bookworm + tags: + - oci-fixed-amd + before_script: + - . .ci/upload.sh + script: + - prepare_to_run_functional_tests + - ./functional-test + - upload_report_to_s3 + - put_report_into_ci_pipeline + dependencies: + - build_amd64 + artifacts: + paths: + - kasmvnc-functional-tests/output/ + build_www: stage: www allow_failure: false @@ -67,7 +87,7 @@ build_www: paths: - output/ -build_ubuntu_focal: +build_amd64: stage: build allow_failure: true tags: @@ -78,15 +98,18 @@ build_ubuntu_focal: after_script: - *prepare_artfacts script: - - bash builder/build-package ubuntu focal; + - bash builder/build-package $DISTRO; only: variables: - - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME + - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ "$DISTRO" artifacts: paths: - output/ + parallel: + matrix: + - DISTRO: [ 'ubuntu focal', 'ubuntu jammy', 'ubuntu noble', 'debian bullseye', 'debian bookworm', 'kali kali-rolling', 'oracle 8', 'oracle 9', 'opensuse 15', 'fedora forty', 'fedora fortyone', 'alpine 318', 'alpine 319', 'alpine 320', 'alpine 321' ] -build_ubuntu_focal_arm: +build_arm64: stage: build allow_failure: true tags: @@ -97,435 +120,60 @@ build_ubuntu_focal_arm: after_script: - *prepare_artfacts script: - - bash builder/build-package ubuntu focal; + - bash builder/build-package $DISTRO; only: variables: - - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME + - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ "$DISTRO" artifacts: paths: - output/ + parallel: + matrix: + - DISTRO: [ 'ubuntu focal', 'ubuntu jammy', 'ubuntu noble', 'debian bullseye', 'debian bookworm', 'kali kali-rolling', 'oracle 8', 'oracle 9', 'opensuse 15', 'fedora forty', 'fedora fortyone', 'alpine 318', 'alpine 319', 'alpine 320', 'alpine 321' ] -build_ubuntu_jammy: - stage: build - allow_failure: true +run_test_amd64: + stage: run_test tags: - oci-fixed-amd before_script: - *prepare_build - - *prepare_www - after_script: - - *prepare_artfacts script: - - bash builder/build-package ubuntu jammy; + - bash builder/test-barebones --run-test $DISTRO only: variables: - - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME + - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ "$DISTRO" + dependencies: + - build_amd64 artifacts: - paths: - - output/ + reports: + junit: + - run_test/*.xml + parallel: + matrix: + - DISTRO: [ 'ubuntu focal', 'ubuntu jammy', 'ubuntu noble', 'debian bullseye', 'debian bookworm', 'kali kali-rolling', 'oracle 8', 'oracle 9', 'opensuse 15', 'fedora forty', 'fedora fortyone', 'alpine 318', 'alpine 319', 'alpine 320', 'alpine 321' ] -build_ubuntu_jammy_arm: - stage: build - allow_failure: true +run_test_arm64: + stage: run_test tags: - oci-fixed-arm before_script: - *prepare_build - - *prepare_www - after_script: - - *prepare_artfacts script: - - bash builder/build-package ubuntu jammy; + - bash builder/test-barebones --run-test $DISTRO only: variables: - - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME + - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ "$DISTRO" + dependencies: + - build_arm64 artifacts: - paths: - - output/ + reports: + junit: + - run_test/*.xml + parallel: + matrix: + - DISTRO: [ 'ubuntu focal', 'ubuntu jammy', 'ubuntu noble', 'debian bullseye', 'debian bookworm', 'kali kali-rolling', 'oracle 8', 'oracle 9', 'opensuse 15', 'fedora forty', 'fedora fortyone', 'alpine 318', 'alpine 319', 'alpine 320', 'alpine 321' ] -build_ubuntu_noble: - stage: build - allow_failure: true - tags: - - oci-fixed-amd - before_script: - - *prepare_build - - *prepare_www - after_script: - - *prepare_artfacts - script: - - bash builder/build-package ubuntu noble; - only: - variables: - - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME - artifacts: - paths: - - output/ - -build_ubuntu_noble_arm: - stage: build - allow_failure: true - tags: - - oci-fixed-arm - before_script: - - *prepare_build - - *prepare_www - after_script: - - *prepare_artfacts - script: - - bash builder/build-package ubuntu noble; - only: - variables: - - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME - artifacts: - paths: - - output/ - -build_debian_bullseye: - stage: build - allow_failure: true - tags: - - oci-fixed-amd - before_script: - - *prepare_build - - *prepare_www - after_script: - - *prepare_artfacts - script: - - bash builder/build-package debian bullseye; - only: - variables: - - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME - artifacts: - paths: - - output/ - -build_debian_bullseye_arm: - stage: build - allow_failure: true - tags: - - oci-fixed-arm - before_script: - - *prepare_build - - *prepare_www - after_script: - - *prepare_artfacts - script: - - bash builder/build-package debian bullseye; - only: - variables: - - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME - artifacts: - paths: - - output/ - - -build_debian_bookworm: - stage: build - allow_failure: true - tags: - - oci-fixed-amd - before_script: - - *prepare_build - - *prepare_www - after_script: - - *prepare_artfacts - script: - - bash builder/build-package debian bookworm; - only: - variables: - - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME - artifacts: - paths: - - output/ - -build_debian_bookworm_arm: - stage: build - allow_failure: true - tags: - - oci-fixed-arm - before_script: - - *prepare_build - - *prepare_www - after_script: - - *prepare_artfacts - script: - - bash builder/build-package debian bookworm; - only: - variables: - - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME - artifacts: - paths: - - output/ - -build_kali_rolling: - stage: build - allow_failure: true - tags: - - oci-fixed-amd - before_script: - - *prepare_build - - *prepare_www - after_script: - - *prepare_artfacts - script: - - bash builder/build-package kali kali-rolling; - only: - variables: - - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME - artifacts: - paths: - - output/ - -build_kali_rolling_arm: - stage: build - allow_failure: true - tags: - - oci-fixed-arm - before_script: - - *prepare_build - - *prepare_www - after_script: - - *prepare_artfacts - script: - - bash builder/build-package kali kali-rolling; - only: - variables: - - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME - artifacts: - paths: - - output/ - -build_oracle_8: - stage: build - allow_failure: true - tags: - - oci-fixed-amd - before_script: - - *prepare_build - - *prepare_www - after_script: - - *prepare_artfacts - script: - - bash builder/build-package oracle 8; - only: - variables: - - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME - artifacts: - paths: - - output/ - -build_oracle_8_arm: - stage: build - allow_failure: true - tags: - - oci-fixed-arm - before_script: - - *prepare_build - - *prepare_www - after_script: - - *prepare_artfacts - script: - - bash builder/build-package oracle 8; - only: - variables: - - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME - artifacts: - paths: - - output/ - -build_oracle_9: - stage: build - allow_failure: true - tags: - - oci-fixed-amd - before_script: - - *prepare_build - - *prepare_www - after_script: - - *prepare_artfacts - script: - - bash builder/build-package oracle 9; - only: - variables: - - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME - artifacts: - paths: - - output/ - -build_oracle_9_arm: - stage: build - allow_failure: true - tags: - - oci-fixed-arm - before_script: - - *prepare_build - - *prepare_www - after_script: - - *prepare_artfacts - script: - - bash builder/build-package oracle 9; - only: - variables: - - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME - artifacts: - paths: - - output/ - -build_opensuse_15: - stage: build - allow_failure: true - tags: - - oci-fixed-amd - before_script: - - *prepare_build - - *prepare_www - after_script: - - *prepare_artfacts - script: - - bash builder/build-package opensuse 15; - only: - variables: - - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME - artifacts: - paths: - - output/ - -build_opensuse_15_arm: - stage: build - allow_failure: true - tags: - - oci-fixed-arm - before_script: - - *prepare_build - - *prepare_www - after_script: - - *prepare_artfacts - script: - - bash builder/build-package opensuse 15; - only: - variables: - - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME - artifacts: - paths: - - output/ - -build_fedora_thirtynine: - stage: build - allow_failure: true - tags: - - oci-fixed-amd - before_script: - - *prepare_build - - *prepare_www - after_script: - - *prepare_artfacts - script: - - bash builder/build-package fedora thirtynine; - only: - variables: - - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME - artifacts: - paths: - - output/ - -build_fedora_thirtynine_arm: - stage: build - allow_failure: true - tags: - - oci-fixed-arm - before_script: - - *prepare_build - - *prepare_www - after_script: - - *prepare_artfacts - script: - - bash builder/build-package fedora thirtynine; - only: - variables: - - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME - artifacts: - paths: - - output/ - -build_fedora_forty: - stage: build - allow_failure: true - tags: - - oci-fixed-amd - before_script: - - *prepare_build - - *prepare_www - after_script: - - *prepare_artfacts - script: - - bash builder/build-package fedora forty; - only: - variables: - - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME - artifacts: - paths: - - output/ - -build_fedora_forty_arm: - stage: build - allow_failure: true - tags: - - oci-fixed-arm - before_script: - - *prepare_build - - *prepare_www - after_script: - - *prepare_artfacts - script: - - bash builder/build-package fedora forty; - only: - variables: - - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME - artifacts: - paths: - - output/ - -build_fedora_fortyone: - stage: build - allow_failure: true - tags: - - oci-fixed-amd - before_script: - - *prepare_build - - *prepare_www - after_script: - - *prepare_artfacts - script: - - bash builder/build-package fedora fortyone; - only: - variables: - - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME - artifacts: - paths: - - output/ - -build_fedora_fortyone_arm: - stage: build - allow_failure: true - tags: - - oci-fixed-arm - before_script: - - *prepare_build - - *prepare_www - after_script: - - *prepare_artfacts - script: - - bash builder/build-package fedora fortyone; - only: - variables: - - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME - artifacts: - paths: - - output/ - - -test: +spec_test: stage: test tags: - kasmvnc-x86 @@ -540,158 +188,6 @@ test: - bash builder/test-vncserver -build_alpine_318: - stage: build - allow_failure: true - tags: - - oci-fixed-amd - before_script: - - *prepare_build - - *prepare_www - after_script: - - *prepare_artfacts - script: - - bash builder/build-package alpine 318; - only: - variables: - - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME - artifacts: - paths: - - output/ - -build_alpine_318_arm: - stage: build - allow_failure: true - tags: - - oci-fixed-arm - before_script: - - *prepare_build - - *prepare_www - after_script: - - *prepare_artfacts - script: - - bash builder/build-package alpine 318; - only: - variables: - - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME - artifacts: - paths: - - output/ - -build_alpine_319: - stage: build - allow_failure: true - tags: - - oci-fixed-amd - before_script: - - *prepare_build - - *prepare_www - after_script: - - *prepare_artfacts - script: - - bash builder/build-package alpine 319; - only: - variables: - - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME - artifacts: - paths: - - output/ - -build_alpine_319_arm: - stage: build - allow_failure: true - tags: - - oci-fixed-arm - before_script: - - *prepare_build - - *prepare_www - after_script: - - *prepare_artfacts - script: - - bash builder/build-package alpine 319; - only: - variables: - - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME - artifacts: - paths: - - output/ - -build_alpine_320: - stage: build - allow_failure: true - tags: - - oci-fixed-amd - before_script: - - *prepare_build - - *prepare_www - after_script: - - *prepare_artfacts - script: - - bash builder/build-package alpine 320; - only: - variables: - - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME - artifacts: - paths: - - output/ - -build_alpine_320_arm: - stage: build - allow_failure: true - tags: - - oci-fixed-arm - before_script: - - *prepare_build - - *prepare_www - after_script: - - *prepare_artfacts - script: - - bash builder/build-package alpine 320; - only: - variables: - - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME - artifacts: - paths: - - output/ - -build_alpine_321: - stage: build - allow_failure: true - tags: - - oci-fixed-amd - before_script: - - *prepare_build - - *prepare_www - after_script: - - *prepare_artfacts - script: - - bash builder/build-package alpine 321; - only: - variables: - - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME - artifacts: - paths: - - output/ - -build_alpine_321_arm: - stage: build - allow_failure: true - tags: - - oci-fixed-arm - before_script: - - *prepare_build - - *prepare_www - after_script: - - *prepare_artfacts - script: - - bash builder/build-package alpine 321; - only: - variables: - - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME - artifacts: - paths: - - output/ - upload: stage: upload image: ubuntu:focal diff --git a/builder/build-package b/builder/build-package index 598230d..5f142f9 100755 --- a/builder/build-package +++ b/builder/build-package @@ -6,14 +6,7 @@ os="$1" codename="$2" build_tag="$3" -detect_package_format() { - package_format=rpm - if ls builder/dockerfile*"$os"* | grep -q .deb.build; then - package_format=deb - elif ls builder/dockerfile*"$os"* | grep -q .apk.build; then - package_format=apk - fi -} +. ./builder/common.sh warn_build_tag_not_supported_for_rpm_and_exit() { if [[ "$build_tag" && "$package_format" = "rpm" ]]; then diff --git a/builder/common.sh b/builder/common.sh index 50f2c06..83003dc 100644 --- a/builder/common.sh +++ b/builder/common.sh @@ -1 +1,24 @@ VNC_PORT=8443 + +detect_build_dir() { + if [ -n "$CI" ]; then + build_dir=output + else + build_dir=builder/build + fi +} + +detect_interactive() { + if [ -z "$run_test" ]; then + interactive=-it + fi +} + +detect_package_format() { + package_format=rpm + if ls builder/dockerfile*"$os"* | grep -q .deb.build; then + package_format=deb + elif ls builder/dockerfile*"$os"* | grep -q .apk.build; then + package_format=apk + fi +} diff --git a/builder/dockerfile.alpine.barebones.apk.test b/builder/dockerfile.alpine.barebones.apk.test new file mode 100644 index 0000000..061a54f --- /dev/null +++ b/builder/dockerfile.alpine.barebones.apk.test @@ -0,0 +1,24 @@ +ARG BASE_IMAGE +FROM $BASE_IMAGE + +RUN apk add bash + +ENV STARTUPDIR=/dockerstartup + +COPY ./builder/scripts/ /tmp/scripts/ +COPY alpine/kasmvncserver/APKBUILD /tmp + +ARG KASMVNC_PACKAGE_DIR +COPY $KASMVNC_PACKAGE_DIR/kasmvncserver-*.apk /tmp/ +RUN /tmp/scripts/install_kasmvncserver_package + +ARG RUN_TEST +RUN [ "$RUN_TEST" = 1 ] || apk add xterm + +RUN mkdir -p $STARTUPDIR +COPY builder/startup/vnc_startup_barebones.sh $STARTUPDIR + +RUN adduser -D -s/bin/bash foo && addgroup foo kasmvnc-cert +USER foo + +ENTRYPOINT "/$STARTUPDIR/vnc_startup_barebones.sh" diff --git a/builder/dockerfile.alpine_318.barebones.apk.test b/builder/dockerfile.alpine_318.barebones.apk.test new file mode 120000 index 0000000..388647d --- /dev/null +++ b/builder/dockerfile.alpine_318.barebones.apk.test @@ -0,0 +1 @@ +dockerfile.alpine.barebones.apk.test \ No newline at end of file diff --git a/builder/dockerfile.alpine_319.barebones.apk.test b/builder/dockerfile.alpine_319.barebones.apk.test new file mode 120000 index 0000000..388647d --- /dev/null +++ b/builder/dockerfile.alpine_319.barebones.apk.test @@ -0,0 +1 @@ +dockerfile.alpine.barebones.apk.test \ No newline at end of file diff --git a/builder/dockerfile.alpine_320.barebones.apk.test b/builder/dockerfile.alpine_320.barebones.apk.test new file mode 120000 index 0000000..388647d --- /dev/null +++ b/builder/dockerfile.alpine_320.barebones.apk.test @@ -0,0 +1 @@ +dockerfile.alpine.barebones.apk.test \ No newline at end of file diff --git a/builder/dockerfile.alpine_321.barebones.apk.test b/builder/dockerfile.alpine_321.barebones.apk.test new file mode 120000 index 0000000..388647d --- /dev/null +++ b/builder/dockerfile.alpine_321.barebones.apk.test @@ -0,0 +1 @@ +dockerfile.alpine.barebones.apk.test \ No newline at end of file diff --git a/builder/dockerfile.debian.barebones.deb.test b/builder/dockerfile.debian.barebones.deb.test new file mode 100644 index 0000000..927f52d --- /dev/null +++ b/builder/dockerfile.debian.barebones.deb.test @@ -0,0 +1,22 @@ +ARG BASE_IMAGE +FROM $BASE_IMAGE + +ENV STARTUPDIR=/dockerstartup + +COPY ./builder/scripts/ /tmp/scripts/ +COPY ./debian/changelog /tmp + +ARG KASMVNC_PACKAGE_DIR +COPY $KASMVNC_PACKAGE_DIR/kasmvncserver_*.deb /tmp/ +RUN /tmp/scripts/install_kasmvncserver_package + +ARG RUN_TEST +RUN if [ "$RUN_TEST" != 1 ]; then apt-get update && apt-get -y install xterm lsb-release; fi + +RUN mkdir -p $STARTUPDIR +COPY builder/startup/vnc_startup_barebones.sh $STARTUPDIR + +RUN useradd -m foo && adduser foo ssl-cert +USER foo + +ENTRYPOINT "/$STARTUPDIR/vnc_startup_barebones.sh" diff --git a/builder/dockerfile.debian_bookworm.barebones.deb.test b/builder/dockerfile.debian_bookworm.barebones.deb.test new file mode 120000 index 0000000..9ec488c --- /dev/null +++ b/builder/dockerfile.debian_bookworm.barebones.deb.test @@ -0,0 +1 @@ +dockerfile.debian.barebones.deb.test \ No newline at end of file diff --git a/builder/dockerfile.debian_bullseye.barebones.deb.test b/builder/dockerfile.debian_bullseye.barebones.deb.test new file mode 120000 index 0000000..9ec488c --- /dev/null +++ b/builder/dockerfile.debian_bullseye.barebones.deb.test @@ -0,0 +1 @@ +dockerfile.debian.barebones.deb.test \ No newline at end of file diff --git a/builder/dockerfile.fedora_forty.barebones.rpm.test b/builder/dockerfile.fedora_forty.barebones.rpm.test new file mode 100644 index 0000000..de0c4ec --- /dev/null +++ b/builder/dockerfile.fedora_forty.barebones.rpm.test @@ -0,0 +1,25 @@ +FROM fedora:40 + +ENV STARTUPDIR=/dockerstartup + +ARG RUN_TEST +RUN [ "$RUN_TEST" = 1 ] || dnf install -y \ + less \ + redhat-lsb-core \ + vim \ + xterm + +COPY ./builder/scripts/ /tmp/scripts/ + +ARG KASMVNC_PACKAGE_DIR +COPY $KASMVNC_PACKAGE_DIR/kasmvncserver-*.rpm /tmp/ +COPY fedora/kasmvncserver.spec /tmp/ +RUN /tmp/scripts/install_kasmvncserver_package + +RUN mkdir -p $STARTUPDIR +COPY builder/startup/vnc_startup_barebones.sh $STARTUPDIR + +RUN useradd -m foo +USER foo:kasmvnc-cert + +ENTRYPOINT "/$STARTUPDIR/vnc_startup_barebones.sh" diff --git a/builder/dockerfile.fedora_fortyone.barebones.rpm.test b/builder/dockerfile.fedora_fortyone.barebones.rpm.test new file mode 100644 index 0000000..a2b94d1 --- /dev/null +++ b/builder/dockerfile.fedora_fortyone.barebones.rpm.test @@ -0,0 +1,25 @@ +FROM fedora:41 + +ENV STARTUPDIR=/dockerstartup + +ARG RUN_TEST +RUN [ "$RUN_TEST" = 1 ] || dnf install -y \ + less \ + redhat-lsb-core \ + vim \ + xterm + +COPY ./builder/scripts/ /tmp/scripts/ + +ARG KASMVNC_PACKAGE_DIR +COPY $KASMVNC_PACKAGE_DIR/kasmvncserver-*.rpm /tmp/ +COPY fedora/kasmvncserver.spec /tmp/ +RUN /tmp/scripts/install_kasmvncserver_package + +RUN mkdir -p $STARTUPDIR +COPY builder/startup/vnc_startup_barebones.sh $STARTUPDIR + +RUN useradd -m foo +USER foo:kasmvnc-cert + +ENTRYPOINT "/$STARTUPDIR/vnc_startup_barebones.sh" diff --git a/builder/dockerfile.kali_kali-rolling.barebones.deb.test b/builder/dockerfile.kali_kali-rolling.barebones.deb.test new file mode 120000 index 0000000..9ec488c --- /dev/null +++ b/builder/dockerfile.kali_kali-rolling.barebones.deb.test @@ -0,0 +1 @@ +dockerfile.debian.barebones.deb.test \ No newline at end of file diff --git a/builder/dockerfile.opensuse_15.barebones.rpm.test b/builder/dockerfile.opensuse_15.barebones.rpm.test index 3501b64..fa4f435 100644 --- a/builder/dockerfile.opensuse_15.barebones.rpm.test +++ b/builder/dockerfile.opensuse_15.barebones.rpm.test @@ -3,7 +3,8 @@ FROM opensuse/leap:15.5 ENV STARTUPDIR=/dockerstartup # base tools -RUN zypper -n install -y \ +ARG RUN_TEST +RUN [ "$RUN_TEST" = 1 ] || zypper -n install -y \ less \ vim \ xterm @@ -15,7 +16,7 @@ COPY $KASMVNC_PACKAGE_DIR/*.rpm /tmp RUN zypper install -y --allow-unsigned-rpm /tmp/*.rpm RUN mkdir -p $STARTUPDIR -COPY startup/vnc_startup_barebones.sh $STARTUPDIR +COPY builder/startup/vnc_startup_barebones.sh $STARTUPDIR RUN useradd -m foo USER foo:kasmvnc-cert diff --git a/builder/dockerfile.oracle_8.barebones.rpm.test b/builder/dockerfile.oracle_8.barebones.rpm.test index d4cc293..3904e2c 100644 --- a/builder/dockerfile.oracle_8.barebones.rpm.test +++ b/builder/dockerfile.oracle_8.barebones.rpm.test @@ -2,7 +2,8 @@ FROM oraclelinux:8 ENV STARTUPDIR=/dockerstartup -RUN dnf install -y \ +ARG RUN_TEST +RUN [ "$RUN_TEST" = 1 ] || dnf install -y \ less \ redhat-lsb-core \ vim \ @@ -10,12 +11,15 @@ RUN dnf install -y \ RUN dnf config-manager --set-enabled ol8_codeready_builder RUN dnf install -y oracle-epel-release-el8 +COPY ./builder/scripts/ /tmp/scripts/ + ARG KASMVNC_PACKAGE_DIR -COPY $KASMVNC_PACKAGE_DIR/*.rpm /tmp -RUN dnf localinstall -y /tmp/*.rpm +COPY $KASMVNC_PACKAGE_DIR/kasmvncserver-*.rpm /tmp/ +COPY fedora/kasmvncserver.spec /tmp/ +RUN /tmp/scripts/install_kasmvncserver_package RUN mkdir -p $STARTUPDIR -COPY startup/vnc_startup_barebones.sh $STARTUPDIR +COPY builder/startup/vnc_startup_barebones.sh $STARTUPDIR RUN useradd -m foo USER foo:kasmvnc-cert diff --git a/builder/dockerfile.oracle_9.barebones.rpm.test b/builder/dockerfile.oracle_9.barebones.rpm.test index 2e8f3b5..e4fa885 100644 --- a/builder/dockerfile.oracle_9.barebones.rpm.test +++ b/builder/dockerfile.oracle_9.barebones.rpm.test @@ -2,7 +2,7 @@ FROM oraclelinux:9 ENV STARTUPDIR=/dockerstartup -RUN dnf install -y \ +RUN [ "$RUN_TEST" = 1 ] || dnf install -y \ less \ vim \ xterm @@ -17,7 +17,7 @@ RUN dnf install -y crypto-policies-scripts RUN update-crypto-policies --set FIPS:SHA1 RUN mkdir -p $STARTUPDIR -COPY startup/vnc_startup_barebones.sh $STARTUPDIR +COPY builder/startup/vnc_startup_barebones.sh $STARTUPDIR RUN useradd -m foo USER foo:kasmvnc-cert diff --git a/builder/dockerfile.ubuntu_focal.barebones.deb.test b/builder/dockerfile.ubuntu_focal.barebones.deb.test deleted file mode 100644 index d9effe0..0000000 --- a/builder/dockerfile.ubuntu_focal.barebones.deb.test +++ /dev/null @@ -1,20 +0,0 @@ -FROM ubuntu:focal - -ENV STARTUPDIR=/dockerstartup - -COPY ./builder/scripts/ /tmp/scripts/ -COPY ./debian/changelog /tmp - -ARG KASMVNC_PACKAGE_DIR -COPY $KASMVNC_PACKAGE_DIR/kasmvncserver_*.deb /tmp/ -RUN /tmp/scripts/install_kasmvncserver_package - -RUN apt-get update && apt-get -y install xterm lsb-release - -RUN mkdir -p $STARTUPDIR -COPY builder/startup/vnc_startup_barebones.sh $STARTUPDIR - -RUN useradd -m foo && addgroup foo ssl-cert -USER foo - -ENTRYPOINT "/$STARTUPDIR/vnc_startup_barebones.sh" diff --git a/builder/dockerfile.ubuntu_focal.barebones.deb.test b/builder/dockerfile.ubuntu_focal.barebones.deb.test new file mode 120000 index 0000000..9ec488c --- /dev/null +++ b/builder/dockerfile.ubuntu_focal.barebones.deb.test @@ -0,0 +1 @@ +dockerfile.debian.barebones.deb.test \ No newline at end of file diff --git a/builder/dockerfile.ubuntu_jammy.barebones.deb.test b/builder/dockerfile.ubuntu_jammy.barebones.deb.test new file mode 120000 index 0000000..9ec488c --- /dev/null +++ b/builder/dockerfile.ubuntu_jammy.barebones.deb.test @@ -0,0 +1 @@ +dockerfile.debian.barebones.deb.test \ No newline at end of file diff --git a/builder/dockerfile.ubuntu_noble.barebones.deb.test b/builder/dockerfile.ubuntu_noble.barebones.deb.test new file mode 120000 index 0000000..9ec488c --- /dev/null +++ b/builder/dockerfile.ubuntu_noble.barebones.deb.test @@ -0,0 +1 @@ +dockerfile.debian.barebones.deb.test \ No newline at end of file diff --git a/builder/process_test_options.sh b/builder/process_test_options.sh index da8b55c..7f7d659 100644 --- a/builder/process_test_options.sh +++ b/builder/process_test_options.sh @@ -6,7 +6,7 @@ usage() { } process_options() { - local sorted_options=$(getopt -o psh --long perf-test --long shell --long help -- "$@") + local sorted_options=$(getopt -o prsh --long perf-test --long run-test --long shell --long help -- "$@") eval set -- $sorted_options while : ; do @@ -16,6 +16,10 @@ process_options() { entrypoint_executable="--entrypoint=/usr/bin/Xvnc" shift ;; + -r|--run-test) + run_test=1 + shift + ;; -s|--shell) entrypoint_executable="--entrypoint=bash" shift diff --git a/builder/scripts/install_kasmvncserver_package b/builder/scripts/install_kasmvncserver_package index 7537d57..dcdf79c 100755 --- a/builder/scripts/install_kasmvncserver_package +++ b/builder/scripts/install_kasmvncserver_package @@ -10,6 +10,10 @@ is_debian() { [[ -f /etc/debian_version ]] } +is_alpine() { + [[ -f /etc/alpine-release ]] +} + check_package_version_exists() { if ! stat /tmp/kasmvncserver_"$package_version"*.deb; then >&2 echo "No package found for version $package_version" @@ -42,7 +46,16 @@ install_package_built_for_current_branch_package_version_deb() { --file /tmp/changelog) check_package_version_exists - apt-get install -y /tmp/kasmvncserver_"$package_version"*"$tag"*.deb + dpkg_arch=$(dpkg-architecture -q DEB_BUILD_ARCH) + apt-get install -y /tmp/kasmvncserver_"$package_version"*"$tag"*_${dpkg_arch}.deb +} + +detect_dnf_command() { + if command -v dnf5 >/dev/null; then + echo dnf install -y --allowerasing + else + echo dnf localinstall -y --allowerasing + fi } install_package_built_for_current_branch_package_version_rpm() { @@ -50,15 +63,24 @@ install_package_built_for_current_branch_package_version_rpm() { $rpm_package_manager install -y rpmdevtools package_version=$(rpmspec -q --qf '%{version}\n' /tmp/kasmvncserver.spec 2>/dev/null) + package_name=/tmp/kasmvncserver-"$package_version"*.$(arch).rpm if [[ $rpm_package_manager = "dnf" ]]; then - dnf localinstall -y --allowerasing /tmp/kasmvncserver-"$package_version"*.rpm + local dnf_cmd=$(detect_dnf_command) + $dnf_cmd $package_name else - yum install -y /tmp/kasmvncserver-"$package_version"*.rpm + yum install -y $package_name fi } +install_package_built_for_current_branch_package_version_apk() { + package_version=$(sed -n 's/pkgver=\(.\+\)/\1/p' /tmp/APKBUILD ) + apk add /tmp/kasmvncserver-"$package_version"*.apk /tmp/kasmvncserver-doc-"$package_version"*.apk --allow-untrusted +} + if is_debian ; then install_package_built_for_current_branch_package_version_deb +elif is_alpine; then + install_package_built_for_current_branch_package_version_apk else install_package_built_for_current_branch_package_version_rpm fi diff --git a/builder/startup/vnc_startup_barebones.sh b/builder/startup/vnc_startup_barebones.sh index 2fea7f8..8306941 100755 --- a/builder/startup/vnc_startup_barebones.sh +++ b/builder/startup/vnc_startup_barebones.sh @@ -19,4 +19,9 @@ set_xterm_to_run create_kasm_user vncserver -select-de manual -websocketPort "$VNC_PORT" +vncserver_exit_code=$? +if [ "$RUN_TEST" = 1 ]; then + exit "$vncserver_exit_code" +fi + tail -f "$config_dir"/*.log diff --git a/builder/test-apk-barebones b/builder/test-apk-barebones new file mode 100755 index 0000000..945412c --- /dev/null +++ b/builder/test-apk-barebones @@ -0,0 +1,30 @@ +#!/bin/bash + +set -e + +detect_base_image() { + BASE_IMAGE=$(echo "${os}:${os_codename}" | sed 's/\([0-9]\{2\}\)$/.\1/') +} + +cd "$(dirname "$0")/.." +. ./builder/process_test_options.sh +. ./builder/common.sh +os="${1:-alpine}" +os_codename="${2:-321}" + +detect_build_dir +detect_base_image +docker build --build-arg KASMVNC_PACKAGE_DIR="${build_dir}/${os}_${os_codename}" \ + --build-arg RUN_TEST="$run_test" \ + --build-arg BASE_IMAGE="$BASE_IMAGE" \ + -t kasmvnctester_barebones_${os}:$os_codename \ + -f builder/dockerfile.${os}_${os_codename}.barebones.apk.test . +echo + +detect_interactive +docker run $interactive -p "443:$VNC_PORT" --rm -e "VNC_USER=foo" -e "VNC_PW=foobar" \ + -e "VNC_PORT=$VNC_PORT" \ + -e RUN_TEST="$run_test" \ + $entrypoint_executable \ + kasmvnctester_barebones_${os}:$os_codename \ + $entrypoint_args diff --git a/builder/test-barebones b/builder/test-barebones new file mode 100755 index 0000000..aee9055 --- /dev/null +++ b/builder/test-barebones @@ -0,0 +1,42 @@ +#!/bin/bash + +set -eo pipefail + +create_gitlab_report() { + local error="$1" +failure_report=$(cat < + + + ${error} + + +EOF +) +} + +write_gitlab_report() { + echo "$failure_report" > run_test/"${os}_${os_codename}.xml" +} + +saved_options=("$@") +. ./builder/process_test_options.sh +. ./builder/common.sh + +os="$1" +os_codename="$2" +os_fullname="${os}_${os_codename}" + +detect_package_format +if [ "$run_test" != 1 ]; then + builder/test-${package_format}-barebones "${saved_options[@]}" + exit $? +fi + +mkdir -p run_test +if ! builder/test-${package_format}-barebones "${saved_options[@]}" 2>&1 | \ + tee run_test/"${os_fullname}.log"; then + create_gitlab_report "$(tail -1 run_test/${os_fullname}.log)" + write_gitlab_report + exit 1 +fi diff --git a/builder/test-deb-barebones b/builder/test-deb-barebones index 9ffdb5d..593ce5c 100755 --- a/builder/test-deb-barebones +++ b/builder/test-deb-barebones @@ -2,18 +2,33 @@ set -e +detect_base_image() { + if [ "$os" = kali ]; then + BASE_IMAGE=kalilinux/kali-rolling:latest + return + fi + BASE_IMAGE="${os}:${os_codename}" +} + cd "$(dirname "$0")/.." . ./builder/process_test_options.sh . ./builder/common.sh os="${1:-debian}" os_codename="${2:-buster}" -docker build --build-arg KASMVNC_PACKAGE_DIR="builder/build/${os_codename}" \ +detect_build_dir +detect_base_image +docker build --build-arg KASMVNC_PACKAGE_DIR="${build_dir}/${os_codename}" \ + --build-arg RUN_TEST="$run_test" \ + --build-arg BASE_IMAGE="$BASE_IMAGE" \ -t kasmvnctester_barebones_${os}:$os_codename \ -f builder/dockerfile.${os}_${os_codename}.barebones.deb.test . echo -docker run -it -p "443:$VNC_PORT" --rm -e "VNC_USER=foo" -e "VNC_PW=foobar" \ + +detect_interactive +docker run $interactive -p "443:$VNC_PORT" --rm -e "VNC_USER=foo" -e "VNC_PW=foobar" \ -e "VNC_PORT=$VNC_PORT" \ + -e RUN_TEST="$run_test" \ $entrypoint_executable \ kasmvnctester_barebones_${os}:$os_codename \ $entrypoint_args diff --git a/builder/test-rpm-barebones b/builder/test-rpm-barebones index ea4cae6..1151222 100755 --- a/builder/test-rpm-barebones +++ b/builder/test-rpm-barebones @@ -2,17 +2,22 @@ set -e -cd "$(dirname "$0")" -. ./process_test_options.sh -. ./common.sh +cd "$(dirname "$0")/.." +. ./builder/process_test_options.sh +. ./builder/common.sh os="${1:-oracle}" os_codename="${2:-8}" -docker build --build-arg KASMVNC_PACKAGE_DIR="build/${os}_${os_codename}" \ +detect_build_dir +docker build --build-arg KASMVNC_PACKAGE_DIR="${build_dir}/${os}_${os_codename}" \ + --build-arg RUN_TEST="$run_test" \ -t kasmvnctester_barebones_${os}:$os_codename \ - -f dockerfile.${os}_${os_codename}.barebones.rpm.test . -docker run -it -p "443:$VNC_PORT" --rm -e "VNC_USER=foo" -e "VNC_PW=foobar" \ + -f builder/dockerfile.${os}_${os_codename}.barebones.rpm.test . + +detect_interactive +docker run $interactive -p "443:$VNC_PORT" --rm -e "VNC_USER=foo" -e "VNC_PW=foobar" \ -e "VNC_PORT=$VNC_PORT" \ + -e RUN_TEST="$run_test" \ $entrypoint_executable \ kasmvnctester_barebones_${os}:$os_codename \ $entrypoint_args From eb2b33a31e183fd3b4ead16ba0bd43609c0144ed Mon Sep 17 00:00:00 2001 From: Dmitry Maksyoma Date: Sat, 10 May 2025 22:06:35 +1200 Subject: [PATCH 096/150] VNC-144 Use release/1.0.0 branch in functional tests --- .ci/upload.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/.ci/upload.sh b/.ci/upload.sh index 7541b84..8cc26e6 100644 --- a/.ci/upload.sh +++ b/.ci/upload.sh @@ -79,6 +79,7 @@ upload_directory_to_s3() { prepare_functional_tests_source_and_cd_into_it() { git clone https://gitlab-ci-token:$CI_JOB_TOKEN@gitlab.com/kasm-technologies/internal/kasmvnc-functional-tests.git cd kasmvnc-functional-tests + git checkout release/1.0.0 mkdir output && chown 1000:1000 output mkdir report && chown 1000:1000 report } From 2fac45b5605f3c89caccf72057034574e74e80d6 Mon Sep 17 00:00:00 2001 From: Dmitry Maksyoma Date: Mon, 12 May 2025 22:11:05 +1200 Subject: [PATCH 097/150] VNC-141 Rename upload.sh -> helpers.sh --- .ci/{upload.sh => helpers.sh} | 0 .gitlab-ci.yml | 6 +++--- builder/README.md | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) rename .ci/{upload.sh => helpers.sh} (100%) diff --git a/.ci/upload.sh b/.ci/helpers.sh similarity index 100% rename from .ci/upload.sh rename to .ci/helpers.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ebf0947..65b2f88 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -50,7 +50,7 @@ functional_test: tags: - oci-fixed-amd before_script: - - . .ci/upload.sh + - . .ci/helpers.sh script: - prepare_to_run_functional_tests - ./functional-test @@ -197,7 +197,7 @@ upload: paths: - output/ before_script: - - . .ci/upload.sh + - . .ci/helpers.sh script: - prepare_to_run_scripts_and_s3_uploads - S3_CRASHPAD_BUILD_DIRECTORY="kasmvnc/crashpad/${CI_COMMIT_SHA}" @@ -233,7 +233,7 @@ upload_build_preview: tags: - oci-fixed-amd before_script: - - . .ci/upload.sh + - . .ci/helpers.sh resource_group: upload_build_preview only: variables: diff --git a/builder/README.md b/builder/README.md index 64b8513..0daf66f 100644 --- a/builder/README.md +++ b/builder/README.md @@ -115,7 +115,7 @@ locally by doing stuff like this: ``` bash -c ' -. .ci/upload.sh; +. .ci/helpers.sh; prepare_upload_filename "focal/kasmvncserver_0.9.1~beta-1+libjpeg-turbo-latest_amd64.deb"; echo $upload_filename;' ``` From b51a09c477e86fdbdca8eb6ef91697cef21b6560 Mon Sep 17 00:00:00 2001 From: El Date: Thu, 8 May 2025 16:59:22 +0500 Subject: [PATCH 098/150] VNC-127 Introduce TBB task arena for optimized parallel execution --- common/rfb/EncodeManager.cxx | 13 +++++++++---- common/rfb/EncodeManager.h | 2 ++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/common/rfb/EncodeManager.cxx b/common/rfb/EncodeManager.cxx index 5dbf1dc..7182afc 100644 --- a/common/rfb/EncodeManager.cxx +++ b/common/rfb/EncodeManager.cxx @@ -44,6 +44,7 @@ #include #include #include +#include using namespace rfb; @@ -210,6 +211,9 @@ EncodeManager::EncodeManager(SConnection* conn_, EncCache *encCache_) : conn(con dynamicQualityMin = Server::dynamicQualityMin; dynamicQualityOff = Server::dynamicQualityMax - Server::dynamicQualityMin; } + + const auto num_cores = tbb::this_task_arena::max_concurrency() / 2; + arena.initialize(num_cores); } EncodeManager::~EncodeManager() @@ -1237,12 +1241,13 @@ void EncodeManager::writeRects(const Region& changed, const PixelBuffer* pb, } scalingTime = msSince(&scalestart); - std::for_each(std::execution::par_unseq, std::begin(indices), std::end(indices), [&](size_t i) - { - encoderTypes[i] = getEncoderType(subrects[i], pb, &palettes[i], compresseds[i], + arena.execute([&] { + tbb::parallel_for(static_cast(0), subrects_size, [&](size_t i) { + encoderTypes[i] = getEncoderType(subrects[i], pb, &palettes[i], compresseds[i], &isWebp[i], &fromCache[i], scaledpb, scaledrects[i], ms[i]); - checkWebpFallback(start); + checkWebpFallback(start); + }); }); for (uint32_t i = 0; i < subrects_size; ++i) { diff --git a/common/rfb/EncodeManager.h b/common/rfb/EncodeManager.h index 7844faa..7d6774f 100644 --- a/common/rfb/EncodeManager.h +++ b/common/rfb/EncodeManager.h @@ -32,6 +32,7 @@ #include #include +#include #include namespace rfb { @@ -167,6 +168,7 @@ namespace rfb { protected: SConnection *conn; + tbb::task_arena arena; std::vector encoders; std::vector activeEncoders; From 61f48bc7d1e0ec4425541f6a4fe9132a85661511 Mon Sep 17 00:00:00 2001 From: El Date: Thu, 8 May 2025 18:50:12 +0500 Subject: [PATCH 099/150] VNC-127 Add TBB dependency to rfb build configuration --- common/rfb/CMakeLists.txt | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/common/rfb/CMakeLists.txt b/common/rfb/CMakeLists.txt index a55ea60..a5ffffc 100644 --- a/common/rfb/CMakeLists.txt +++ b/common/rfb/CMakeLists.txt @@ -85,7 +85,7 @@ set(RFB_LIBRARIES ${JPEG_LIBRARIES} ${PNG_LIBRARIES} os rdr Xregion) cmake_host_system_information(RESULT DISTRO QUERY DISTRIB_INFO) if ((CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 10) OR (DISTRO_PLATFORM_ID MATCHES "platform:el8")) - set(RFB_LIBRARIES ${RFB_LIBRARIES} tbb) + set(RFB_LIBRARIES ${RFB_LIBRARIES} tbb) endif () if (HAVE_PAM) @@ -132,7 +132,15 @@ endif () find_package(PkgConfig REQUIRED) pkg_check_modules(FFMPEG REQUIRED libavcodec libavformat libavutil libswscale) +find_package(TBB) +if (TBB_FOUND) + set(RFB_LIBRARIES ${RFB_LIBRARIES} tbb) +else () + pkg_check_modules(TBB tbb) + set(RFB_LIBRARIES ${RFB_LIBRARIES} ${TBB_LIBRARIES}) +endif () +message(STATUS ${RFB_LIBRARIES}) add_library(rfb STATIC ${RFB_SOURCES}) target_include_directories(rfb PRIVATE @@ -142,9 +150,10 @@ target_include_directories(rfb PRIVATE ${CMAKE_SOURCE_DIR}/unix/kasmvncpasswd ${CMAKE_SOURCE_DIR}/third_party/tinyxml2 ${FFMPEG_INCLUDE_DIRS} + ${TBB_INCLUDE_DIRS} ) -target_link_libraries(rfb PRIVATE ${RFB_LIBRARIES} tinyxml2_objs) +target_link_libraries(rfb PUBLIC ${RFB_LIBRARIES} tinyxml2_objs) if (UNIX) libtool_create_control_file(rfb) From 9cdf96c48664509c3a4608a5952b18e6c8f3971f Mon Sep 17 00:00:00 2001 From: El Date: Thu, 8 May 2025 19:49:23 +0500 Subject: [PATCH 100/150] VNC-127 Add script to build and test Docker containers --- builder/test_build_containers | 50 +++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100755 builder/test_build_containers diff --git a/builder/test_build_containers b/builder/test_build_containers new file mode 100755 index 0000000..8d68072 --- /dev/null +++ b/builder/test_build_containers @@ -0,0 +1,50 @@ +#!/bin/bash + +#set -xe + +script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +current_dir="$(pwd)" + +images_list=() + +for file in "$script_dir"/dockerfile.*.build; do + if [[ "$file" == *deb* ]] || [[ "$file" == *apk* ]] || [[ "$file" == *rpm* ]] || [[ "$file" == *www* ]]; then + continue + fi + + [ -e "$file" ] || continue + + filename="$(basename "$file")" + image_name=$(echo "$filename" | sed -E 's/^(dockerfile\.|Dockerfile\.)(.*)\.build$/\2/') + + echo "Building docker image: $image_name using file: $file" + + docker build -f "$file" -t "$image_name" "$current_dir" + exit_code=$? + if [ $exit_code -ne 0 ]; then + echo "Build failed for $filename" + break + fi + + rm -rf .cmake CMakeFiles build.ninja cmake_install.cmake cmake_uninstall.cmake CMakeCache.txt config.h + + echo "Running container from image '$image_name'" + # Run the container and capture the exit code + docker run --rm -it -v "$current_dir":/src "$image_name" + exit_code=$? + + if [ $exit_code -ne 0 ]; then + echo "Container for image '$image_name' exited with error (exit code $exit_code)." + break + else + echo "Container for image '$image_name' finished successfully." + docker rmi "$image_name" + fi +done + +echo "Removing all built docker images..." +for img in "${images_list[@]}"; do + echo "Removing docker image: $img" + docker rmi "$img" +done From 79e0d6cad1140156c3bba5c408328c53fb585348 Mon Sep 17 00:00:00 2001 From: El Date: Fri, 9 May 2025 00:10:35 +0500 Subject: [PATCH 101/150] VNC-127 Prevent rebuilding existing KasmVNC images in build script. Enable error checking and update container execution logic --- builder/test_build_containers | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/builder/test_build_containers b/builder/test_build_containers index 8d68072..426770c 100755 --- a/builder/test_build_containers +++ b/builder/test_build_containers @@ -1,9 +1,8 @@ #!/bin/bash -#set -xe +#set -e script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" - current_dir="$(pwd)" images_list=() @@ -18,6 +17,10 @@ for file in "$script_dir"/dockerfile.*.build; do filename="$(basename "$file")" image_name=$(echo "$filename" | sed -E 's/^(dockerfile\.|Dockerfile\.)(.*)\.build$/\2/') + if [ -e builder/build/kasmvnc."$image_name".tar.gz ]; then + continue + fi + echo "Building docker image: $image_name using file: $file" docker build -f "$file" -t "$image_name" "$current_dir" @@ -31,20 +34,21 @@ for file in "$script_dir"/dockerfile.*.build; do echo "Running container from image '$image_name'" # Run the container and capture the exit code - docker run --rm -it -v "$current_dir":/src "$image_name" + docker run -it -v "$current_dir":/src -v "$current_dir/builder/build":/build "$image_name" exit_code=$? + echo "Container for image '$image_name' " if [ $exit_code -ne 0 ]; then - echo "Container for image '$image_name' exited with error (exit code $exit_code)." + echo "exited with error (exit code $exit_code)." break else - echo "Container for image '$image_name' finished successfully." - docker rmi "$image_name" + echo "finished successfully." + images_list+=("$image_name") fi done echo "Removing all built docker images..." for img in "${images_list[@]}"; do echo "Removing docker image: $img" - docker rmi "$img" + docker rmi -f "$img" done From 0bc0875a955d77f20e9c159d2b0e1436a08f41e6 Mon Sep 17 00:00:00 2001 From: El Date: Fri, 9 May 2025 00:11:07 +0500 Subject: [PATCH 102/150] VNC-127 Add dependencies across builds --- builder/dockerfile.alpine_318.build | 1 + builder/dockerfile.alpine_319.build | 1 + builder/dockerfile.alpine_320.build | 1 + builder/dockerfile.alpine_321.build | 1 + builder/dockerfile.debian_bookworm.build | 2 +- builder/dockerfile.debian_bullseye.build | 2 +- builder/dockerfile.debian_buster.build | 2 +- builder/dockerfile.fedora_forty.build | 3 ++- builder/dockerfile.fedora_fortyone.build | 3 ++- builder/dockerfile.fedora_thirtynine.build | 3 ++- builder/dockerfile.kali_kali-rolling.build | 2 +- builder/dockerfile.opensuse_15.build | 3 ++- builder/dockerfile.oracle_8.build | 3 ++- builder/dockerfile.oracle_9.build | 3 ++- builder/dockerfile.ubuntu_jammy.build | 2 +- builder/dockerfile.ubuntu_noble.build | 2 +- 16 files changed, 22 insertions(+), 12 deletions(-) diff --git a/builder/dockerfile.alpine_318.build b/builder/dockerfile.alpine_318.build index f8620ba..b455545 100644 --- a/builder/dockerfile.alpine_318.build +++ b/builder/dockerfile.alpine_318.build @@ -43,6 +43,7 @@ RUN \ libxrandr-dev \ libxshmfence-dev \ libxtst-dev \ + libtbb-dev \ mesa-dev \ mesa-dri-gallium \ meson \ diff --git a/builder/dockerfile.alpine_319.build b/builder/dockerfile.alpine_319.build index d003855..6d963a3 100644 --- a/builder/dockerfile.alpine_319.build +++ b/builder/dockerfile.alpine_319.build @@ -43,6 +43,7 @@ RUN \ libxrandr-dev \ libxshmfence-dev \ libxtst-dev \ + libtbb-dev \ mesa-dev \ mesa-dri-gallium \ meson \ diff --git a/builder/dockerfile.alpine_320.build b/builder/dockerfile.alpine_320.build index b282e6d..74da382 100644 --- a/builder/dockerfile.alpine_320.build +++ b/builder/dockerfile.alpine_320.build @@ -43,6 +43,7 @@ RUN \ libxrandr-dev \ libxshmfence-dev \ libxtst-dev \ + libtbb-dev \ mesa-dev \ mesa-dri-gallium \ meson \ diff --git a/builder/dockerfile.alpine_321.build b/builder/dockerfile.alpine_321.build index 47a2cc7..0c983c5 100644 --- a/builder/dockerfile.alpine_321.build +++ b/builder/dockerfile.alpine_321.build @@ -43,6 +43,7 @@ RUN \ libxrandr-dev \ libxshmfence-dev \ libxtst-dev \ + libtbb-dev \ mesa-dev \ mesa-dri-gallium \ meson \ diff --git a/builder/dockerfile.debian_bookworm.build b/builder/dockerfile.debian_bookworm.build index 98034c6..5dbce8a 100644 --- a/builder/dockerfile.debian_bookworm.build +++ b/builder/dockerfile.debian_bookworm.build @@ -24,7 +24,7 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends tz RUN apt-get update && apt-get -y build-dep xorg-server libxfont-dev RUN apt-get update && apt-get -y install ninja-build cmake nasm git libgnutls28-dev vim wget tightvncserver curl RUN apt-get update && apt-get -y install libpng-dev libtiff-dev libgif-dev libavcodec-dev libssl-dev libxrandr-dev \ - libxcursor-dev libavformat-dev libswscale-dev + libxcursor-dev libavformat-dev libswscale-dev libtbb-dev ENV SCRIPTS_DIR=/tmp/scripts COPY builder/scripts $SCRIPTS_DIR diff --git a/builder/dockerfile.debian_bullseye.build b/builder/dockerfile.debian_bullseye.build index d9ce288..0aedd3c 100644 --- a/builder/dockerfile.debian_bullseye.build +++ b/builder/dockerfile.debian_bullseye.build @@ -14,7 +14,7 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends tz RUN apt-get update && apt-get -y build-dep xorg-server libxfont-dev RUN apt-get update && apt-get -y install ninja-build nasm git libgnutls28-dev vim wget tightvncserver curl RUN apt-get update && apt-get -y install libpng-dev libtiff-dev libgif-dev libavcodec-dev libssl-dev libxrandr-dev \ - libxcursor-dev libavformat-dev libswscale-dev + libxcursor-dev libavformat-dev libswscale-dev libtbb-dev RUN CMAKE_URL="https://cmake.org/files/v3.22/cmake-3.22.0" && \ ARCH=$(arch) && \ diff --git a/builder/dockerfile.debian_buster.build b/builder/dockerfile.debian_buster.build index a1e2afd..63a6c27 100644 --- a/builder/dockerfile.debian_buster.build +++ b/builder/dockerfile.debian_buster.build @@ -13,7 +13,7 @@ RUN apt-get update && \ RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends tzdata RUN apt-get update && apt-get -y build-dep xorg-server libxfont-dev RUN apt-get update && apt-get -y install ninja-build cmake nasm git libgnutls28-dev vim wget tightvncserver curl -RUN apt-get update && apt-get -y install libpng-dev libtiff-dev libgif-dev libavcodec-dev libssl-dev libxrandr-dev libxcursor-dev +RUN apt-get update && apt-get -y install libpng-dev libtiff-dev libgif-dev libavcodec-dev libssl-dev libxrandr-dev libxcursor-dev libtbb-dev ENV SCRIPTS_DIR=/tmp/scripts COPY builder/scripts $SCRIPTS_DIR diff --git a/builder/dockerfile.fedora_forty.build b/builder/dockerfile.fedora_forty.build index 983a88f..a3e91f4 100644 --- a/builder/dockerfile.fedora_forty.build +++ b/builder/dockerfile.fedora_forty.build @@ -74,7 +74,8 @@ RUN \ xorg-x11-xtrans-devel \ xsltproc \ libavformat-free-devel \ - libswscale-free-devel + libswscale-free-devel \ + tbb-devel ENV SCRIPTS_DIR=/tmp/scripts COPY builder/scripts $SCRIPTS_DIR diff --git a/builder/dockerfile.fedora_fortyone.build b/builder/dockerfile.fedora_fortyone.build index 336b064..f98b621 100644 --- a/builder/dockerfile.fedora_fortyone.build +++ b/builder/dockerfile.fedora_fortyone.build @@ -75,7 +75,8 @@ RUN \ xorg-x11-xtrans-devel \ xsltproc \ libavformat-free-devel \ - libswscale-free-devel + libswscale-free-devel \ + tbb-devel ENV SCRIPTS_DIR=/tmp/scripts COPY builder/scripts $SCRIPTS_DIR diff --git a/builder/dockerfile.fedora_thirtynine.build b/builder/dockerfile.fedora_thirtynine.build index d1985de..f4200d7 100644 --- a/builder/dockerfile.fedora_thirtynine.build +++ b/builder/dockerfile.fedora_thirtynine.build @@ -74,7 +74,8 @@ RUN \ xorg-x11-xtrans-devel \ xsltproc \ libavformat-free-devel \ - libswscale-free-devel + libswscale-free-devel \ + tbb-devel ENV SCRIPTS_DIR=/tmp/scripts COPY builder/scripts $SCRIPTS_DIR diff --git a/builder/dockerfile.kali_kali-rolling.build b/builder/dockerfile.kali_kali-rolling.build index 717e8f9..e3c6f99 100644 --- a/builder/dockerfile.kali_kali-rolling.build +++ b/builder/dockerfile.kali_kali-rolling.build @@ -15,7 +15,7 @@ RUN apt-get update && apt-get -y build-dep xorg-server libxfont-dev RUN apt-get update && apt-get -y install gcc g++ curl RUN apt-get update && apt-get -y install ninja-build cmake nasm git libgnutls28-dev vim wget tightvncserver RUN apt-get update && apt-get -y install libpng-dev libtiff-dev libgif-dev libavcodec-dev libssl-dev libxrandr-dev \ - libxcursor-dev libavformat-dev libswscale-dev + libxcursor-dev libavformat-dev libswscale-dev libtbb-dev ENV SCRIPTS_DIR=/tmp/scripts COPY builder/scripts $SCRIPTS_DIR diff --git a/builder/dockerfile.opensuse_15.build b/builder/dockerfile.opensuse_15.build index 63d9358..50596f2 100644 --- a/builder/dockerfile.opensuse_15.build +++ b/builder/dockerfile.opensuse_15.build @@ -47,7 +47,8 @@ RUN zypper install -ny \ xorg-x11-devel \ xorg-x11-server-sdk \ xorg-x11-util-devel \ - zlib-devel + zlib-devel \ + tbb-devel RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 140 \ --slave /usr/bin/g++ g++ /usr/bin/g++-14 \ diff --git a/builder/dockerfile.oracle_8.build b/builder/dockerfile.oracle_8.build index 0a9ecfe..4cdef63 100644 --- a/builder/dockerfile.oracle_8.build +++ b/builder/dockerfile.oracle_8.build @@ -32,7 +32,8 @@ RUN \ tigervnc-server \ wget \ xorg-x11-font-utils \ - zlib-devel + zlib-devel \ + tbb-devel # Enable additional repos (epel, powertools, and fusion) RUN dnf config-manager --set-enabled ol8_codeready_builder diff --git a/builder/dockerfile.oracle_9.build b/builder/dockerfile.oracle_9.build index 674e2f0..2e17589 100644 --- a/builder/dockerfile.oracle_9.build +++ b/builder/dockerfile.oracle_9.build @@ -34,7 +34,8 @@ RUN \ tigervnc-server \ wget \ xorg-x11-font-utils \ - zlib-devel + zlib-devel \ + tbb-devel # Enable additional repos (epel, powertools, and fusion) RUN dnf install -y oracle-epel-release-el9 diff --git a/builder/dockerfile.ubuntu_jammy.build b/builder/dockerfile.ubuntu_jammy.build index 11eafc7..3532bcf 100644 --- a/builder/dockerfile.ubuntu_jammy.build +++ b/builder/dockerfile.ubuntu_jammy.build @@ -14,7 +14,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends tzdata RUN apt-get update && apt-get -y build-dep xorg-server libxfont-dev RUN apt-get update && apt-get -y install ninja-build cmake nasm git libgnutls28-dev vim wget tightvncserver curl RUN apt-get update && apt-get -y install libpng-dev libtiff-dev libgif-dev libavcodec-dev libssl-dev libxrandr-dev \ - libxcursor-dev libavformat-dev libswscale-dev + libxcursor-dev libavformat-dev libswscale-dev libtbb-dev ENV SCRIPTS_DIR=/tmp/scripts COPY builder/scripts $SCRIPTS_DIR diff --git a/builder/dockerfile.ubuntu_noble.build b/builder/dockerfile.ubuntu_noble.build index dfb796c..fde4e56 100644 --- a/builder/dockerfile.ubuntu_noble.build +++ b/builder/dockerfile.ubuntu_noble.build @@ -14,7 +14,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends tzdata RUN apt-get update && apt-get -y build-dep xorg-server libxfont-dev RUN apt-get update && apt-get -y install ninja-build cmake nasm git libgnutls28-dev vim wget curl RUN apt-get update && apt-get -y install libpng-dev libtiff-dev libgif-dev libavcodec-dev libssl-dev libxrandr-dev \ - libxcursor-dev libavformat-dev libswscale-dev + libxcursor-dev libavformat-dev libswscale-dev libtbb-dev ENV SCRIPTS_DIR=/tmp/scripts COPY builder/scripts $SCRIPTS_DIR From ca6884109a465eae024ca1cc792baae241918c7e Mon Sep 17 00:00:00 2001 From: El Date: Fri, 9 May 2025 19:19:50 +0500 Subject: [PATCH 103/150] VNC-127 Set GCC 14 explicitly and adjust build script order --- builder/dockerfile.opensuse_15.build | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/builder/dockerfile.opensuse_15.build b/builder/dockerfile.opensuse_15.build index 50596f2..5a2c6fc 100644 --- a/builder/dockerfile.opensuse_15.build +++ b/builder/dockerfile.opensuse_15.build @@ -50,10 +50,6 @@ RUN zypper install -ny \ zlib-devel \ tbb-devel -RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 140 \ - --slave /usr/bin/g++ g++ /usr/bin/g++-14 \ - --slave /usr/bin/gcov gcov /usr/bin/gcov-14 - RUN useradd -u 1000 docker && \ groupadd -g 1000 docker && \ usermod -a -G docker docker @@ -72,8 +68,11 @@ RUN ARCH=$(arch) && \ rm cmake.sh ENV SCRIPTS_DIR=/tmp/scripts +ENV CC=/usr/bin/gcc-14 +ENV CXX=/usr/bin/g++-14 + COPY builder/scripts $SCRIPTS_DIR -RUN $SCRIPTS_DIR/build-webp && $SCRIPTS_DIR/build-libjpeg-turbo +RUN $SCRIPTS_DIR/build-libjpeg-turbo && $SCRIPTS_DIR/build-webp COPY --chown=docker:docker . /src/ From b691b34da26b74103bc57cde40be4a624eb1b31d Mon Sep 17 00:00:00 2001 From: El Date: Fri, 9 May 2025 19:20:31 +0500 Subject: [PATCH 104/150] VNC-127 Add libtbb-dev to build dependencies in Dockerfiles --- builder/dockerfile.debian_bookworm.deb.build | 2 +- builder/dockerfile.debian_bullseye.deb.build | 2 +- builder/dockerfile.kali_kali-rolling.deb.build | 2 +- builder/dockerfile.opensuse_15.build | 1 - builder/dockerfile.ubuntu_jammy.deb.build | 2 +- builder/dockerfile.ubuntu_noble.deb.build | 2 +- 6 files changed, 5 insertions(+), 6 deletions(-) diff --git a/builder/dockerfile.debian_bookworm.deb.build b/builder/dockerfile.debian_bookworm.deb.build index 2e61fbb..e585412 100644 --- a/builder/dockerfile.debian_bookworm.deb.build +++ b/builder/dockerfile.debian_bookworm.deb.build @@ -3,7 +3,7 @@ FROM debian:bookworm ENV DEBIAN_FRONTEND noninteractive RUN apt-get update && \ - apt-get -y install vim build-essential devscripts equivs + apt-get -y install vim build-essential devscripts equivs libtbb-dev # Install build-deps for the package. COPY ./debian/control /tmp diff --git a/builder/dockerfile.debian_bullseye.deb.build b/builder/dockerfile.debian_bullseye.deb.build index 51bde4f..f5bcc13 100644 --- a/builder/dockerfile.debian_bullseye.deb.build +++ b/builder/dockerfile.debian_bullseye.deb.build @@ -3,7 +3,7 @@ FROM debian:bullseye ENV DEBIAN_FRONTEND noninteractive RUN apt-get update && \ - apt-get -y install vim build-essential devscripts equivs + apt-get -y install vim build-essential devscripts equivs libtbb-dev # Install build-deps for the package. COPY ./debian/control /tmp diff --git a/builder/dockerfile.kali_kali-rolling.deb.build b/builder/dockerfile.kali_kali-rolling.deb.build index 6d0ed1b..6f9bd9a 100644 --- a/builder/dockerfile.kali_kali-rolling.deb.build +++ b/builder/dockerfile.kali_kali-rolling.deb.build @@ -3,7 +3,7 @@ FROM kalilinux/kali-rolling:latest ENV DEBIAN_FRONTEND noninteractive RUN apt-get update && \ - apt-get -y install vim build-essential devscripts equivs + apt-get -y install vim build-essential devscripts equivs libtbb-dev # Install build-deps for the package. COPY ./debian/control /tmp diff --git a/builder/dockerfile.opensuse_15.build b/builder/dockerfile.opensuse_15.build index 5a2c6fc..5b3b0ee 100644 --- a/builder/dockerfile.opensuse_15.build +++ b/builder/dockerfile.opensuse_15.build @@ -9,7 +9,6 @@ RUN zypper install -ny \ bdftopcf \ bigreqsproto-devel \ ninja \ - cmake \ nasm \ curl \ ffmpeg-4-libavcodec-devel \ diff --git a/builder/dockerfile.ubuntu_jammy.deb.build b/builder/dockerfile.ubuntu_jammy.deb.build index 31dee99..e4e6fdd 100644 --- a/builder/dockerfile.ubuntu_jammy.deb.build +++ b/builder/dockerfile.ubuntu_jammy.deb.build @@ -3,7 +3,7 @@ FROM ubuntu:jammy ENV DEBIAN_FRONTEND noninteractive RUN apt-get update && \ - apt-get -y install vim build-essential devscripts equivs + apt-get -y install vim build-essential devscripts equivs libtbb-dev # Install build-deps for the package. COPY ./debian/control /tmp diff --git a/builder/dockerfile.ubuntu_noble.deb.build b/builder/dockerfile.ubuntu_noble.deb.build index 6a56b24..d2f2987 100644 --- a/builder/dockerfile.ubuntu_noble.deb.build +++ b/builder/dockerfile.ubuntu_noble.deb.build @@ -3,7 +3,7 @@ FROM ubuntu:noble ENV DEBIAN_FRONTEND noninteractive RUN apt-get update && \ - apt-get -y install vim build-essential devscripts equivs + apt-get -y install vim build-essential devscripts equivs libtbb-dev # Install build-deps for the package. COPY ./debian/control /tmp From d144f5a5e06ae24aff735514948fd56a752d9759 Mon Sep 17 00:00:00 2001 From: El Date: Sat, 10 May 2025 04:57:38 +0500 Subject: [PATCH 105/150] VNC-127 Replace individual script runs with unified build-deps.sh --- builder/dockerfile.alpine_318.build | 4 +-- builder/dockerfile.alpine_319.build | 4 +-- builder/dockerfile.alpine_320.build | 4 +-- builder/dockerfile.alpine_321.build | 4 +-- builder/dockerfile.debian_bookworm.build | 5 ++-- builder/dockerfile.debian_bookworm.deb.build | 2 +- builder/dockerfile.debian_bullseye.build | 5 ++-- builder/dockerfile.debian_bullseye.deb.build | 2 +- builder/dockerfile.debian_buster.build | 5 ++-- builder/dockerfile.fedora_forty.build | 6 ++--- builder/dockerfile.fedora_fortyone.build | 6 ++--- builder/dockerfile.fedora_thirtynine.build | 6 ++--- builder/dockerfile.kali_kali-rolling.build | 5 ++-- .../dockerfile.kali_kali-rolling.deb.build | 2 +- builder/dockerfile.opensuse_15.build | 5 ++-- builder/dockerfile.oracle_8.build | 8 +++--- builder/dockerfile.oracle_9.build | 5 ++-- builder/dockerfile.ubuntu_focal.build | 5 ++-- builder/dockerfile.ubuntu_focal.deb.build | 2 +- builder/dockerfile.ubuntu_jammy.build | 5 ++-- builder/dockerfile.ubuntu_jammy.deb.build | 2 +- builder/dockerfile.ubuntu_jammy.dev | 10 +++----- builder/dockerfile.ubuntu_noble.build | 5 ++-- builder/dockerfile.ubuntu_noble.deb.build | 2 +- builder/scripts/build-deps.sh | 8 ++++++ builder/scripts/build-tbb | 25 +++++++++++++++++++ 26 files changed, 74 insertions(+), 68 deletions(-) create mode 100755 builder/scripts/build-deps.sh create mode 100755 builder/scripts/build-tbb diff --git a/builder/dockerfile.alpine_318.build b/builder/dockerfile.alpine_318.build index b455545..f4d3bdf 100644 --- a/builder/dockerfile.alpine_318.build +++ b/builder/dockerfile.alpine_318.build @@ -43,7 +43,6 @@ RUN \ libxrandr-dev \ libxshmfence-dev \ libxtst-dev \ - libtbb-dev \ mesa-dev \ mesa-dri-gallium \ meson \ @@ -74,8 +73,7 @@ RUN \ ENV SCRIPTS_DIR=/tmp/scripts COPY builder/scripts $SCRIPTS_DIR -RUN $SCRIPTS_DIR/build-webp -RUN $SCRIPTS_DIR/build-libjpeg-turbo +RUN $SCRIPTS_DIR/build-deps.sh RUN useradd -m docker && echo "docker:docker" | chpasswd diff --git a/builder/dockerfile.alpine_319.build b/builder/dockerfile.alpine_319.build index 6d963a3..67a8951 100644 --- a/builder/dockerfile.alpine_319.build +++ b/builder/dockerfile.alpine_319.build @@ -43,7 +43,6 @@ RUN \ libxrandr-dev \ libxshmfence-dev \ libxtst-dev \ - libtbb-dev \ mesa-dev \ mesa-dri-gallium \ meson \ @@ -74,8 +73,7 @@ RUN \ ENV SCRIPTS_DIR=/tmp/scripts COPY builder/scripts $SCRIPTS_DIR -RUN $SCRIPTS_DIR/build-webp -RUN $SCRIPTS_DIR/build-libjpeg-turbo +RUN $SCRIPTS_DIR/build-deps.sh RUN useradd -m docker && echo "docker:docker" | chpasswd diff --git a/builder/dockerfile.alpine_320.build b/builder/dockerfile.alpine_320.build index 74da382..cf4e697 100644 --- a/builder/dockerfile.alpine_320.build +++ b/builder/dockerfile.alpine_320.build @@ -43,7 +43,6 @@ RUN \ libxrandr-dev \ libxshmfence-dev \ libxtst-dev \ - libtbb-dev \ mesa-dev \ mesa-dri-gallium \ meson \ @@ -74,8 +73,7 @@ RUN \ ENV SCRIPTS_DIR=/tmp/scripts COPY builder/scripts $SCRIPTS_DIR -RUN $SCRIPTS_DIR/build-webp -RUN $SCRIPTS_DIR/build-libjpeg-turbo +RUN $SCRIPTS_DIR/build-deps.sh RUN useradd -m docker && echo "docker:docker" | chpasswd diff --git a/builder/dockerfile.alpine_321.build b/builder/dockerfile.alpine_321.build index 0c983c5..80972ad 100644 --- a/builder/dockerfile.alpine_321.build +++ b/builder/dockerfile.alpine_321.build @@ -43,7 +43,6 @@ RUN \ libxrandr-dev \ libxshmfence-dev \ libxtst-dev \ - libtbb-dev \ mesa-dev \ mesa-dri-gallium \ meson \ @@ -74,8 +73,7 @@ RUN \ ENV SCRIPTS_DIR=/tmp/scripts COPY builder/scripts $SCRIPTS_DIR -RUN $SCRIPTS_DIR/build-webp -RUN $SCRIPTS_DIR/build-libjpeg-turbo +RUN $SCRIPTS_DIR/build-deps.sh RUN useradd -m docker && echo "docker:docker" | chpasswd diff --git a/builder/dockerfile.debian_bookworm.build b/builder/dockerfile.debian_bookworm.build index 5dbce8a..bda5926 100644 --- a/builder/dockerfile.debian_bookworm.build +++ b/builder/dockerfile.debian_bookworm.build @@ -24,12 +24,11 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends tz RUN apt-get update && apt-get -y build-dep xorg-server libxfont-dev RUN apt-get update && apt-get -y install ninja-build cmake nasm git libgnutls28-dev vim wget tightvncserver curl RUN apt-get update && apt-get -y install libpng-dev libtiff-dev libgif-dev libavcodec-dev libssl-dev libxrandr-dev \ - libxcursor-dev libavformat-dev libswscale-dev libtbb-dev + libxcursor-dev libavformat-dev libswscale-dev ENV SCRIPTS_DIR=/tmp/scripts COPY builder/scripts $SCRIPTS_DIR -RUN $SCRIPTS_DIR/build-webp -RUN $SCRIPTS_DIR/build-libjpeg-turbo +RUN $SCRIPTS_DIR/build-deps.sh RUN useradd -m docker && echo "docker:docker" | chpasswd && adduser docker sudo diff --git a/builder/dockerfile.debian_bookworm.deb.build b/builder/dockerfile.debian_bookworm.deb.build index e585412..2e61fbb 100644 --- a/builder/dockerfile.debian_bookworm.deb.build +++ b/builder/dockerfile.debian_bookworm.deb.build @@ -3,7 +3,7 @@ FROM debian:bookworm ENV DEBIAN_FRONTEND noninteractive RUN apt-get update && \ - apt-get -y install vim build-essential devscripts equivs libtbb-dev + apt-get -y install vim build-essential devscripts equivs # Install build-deps for the package. COPY ./debian/control /tmp diff --git a/builder/dockerfile.debian_bullseye.build b/builder/dockerfile.debian_bullseye.build index 0aedd3c..bd950e7 100644 --- a/builder/dockerfile.debian_bullseye.build +++ b/builder/dockerfile.debian_bullseye.build @@ -14,7 +14,7 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends tz RUN apt-get update && apt-get -y build-dep xorg-server libxfont-dev RUN apt-get update && apt-get -y install ninja-build nasm git libgnutls28-dev vim wget tightvncserver curl RUN apt-get update && apt-get -y install libpng-dev libtiff-dev libgif-dev libavcodec-dev libssl-dev libxrandr-dev \ - libxcursor-dev libavformat-dev libswscale-dev libtbb-dev + libxcursor-dev libavformat-dev libswscale-dev RUN CMAKE_URL="https://cmake.org/files/v3.22/cmake-3.22.0" && \ ARCH=$(arch) && \ @@ -31,8 +31,7 @@ RUN CMAKE_URL="https://cmake.org/files/v3.22/cmake-3.22.0" && \ ENV SCRIPTS_DIR=/tmp/scripts COPY builder/scripts $SCRIPTS_DIR -RUN $SCRIPTS_DIR/build-webp -RUN $SCRIPTS_DIR/build-libjpeg-turbo +RUN $SCRIPTS_DIR/build-deps.sh RUN useradd -m docker && echo "docker:docker" | chpasswd && adduser docker sudo diff --git a/builder/dockerfile.debian_bullseye.deb.build b/builder/dockerfile.debian_bullseye.deb.build index f5bcc13..51bde4f 100644 --- a/builder/dockerfile.debian_bullseye.deb.build +++ b/builder/dockerfile.debian_bullseye.deb.build @@ -3,7 +3,7 @@ FROM debian:bullseye ENV DEBIAN_FRONTEND noninteractive RUN apt-get update && \ - apt-get -y install vim build-essential devscripts equivs libtbb-dev + apt-get -y install vim build-essential devscripts equivs # Install build-deps for the package. COPY ./debian/control /tmp diff --git a/builder/dockerfile.debian_buster.build b/builder/dockerfile.debian_buster.build index 63a6c27..9b0bed5 100644 --- a/builder/dockerfile.debian_buster.build +++ b/builder/dockerfile.debian_buster.build @@ -13,12 +13,11 @@ RUN apt-get update && \ RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends tzdata RUN apt-get update && apt-get -y build-dep xorg-server libxfont-dev RUN apt-get update && apt-get -y install ninja-build cmake nasm git libgnutls28-dev vim wget tightvncserver curl -RUN apt-get update && apt-get -y install libpng-dev libtiff-dev libgif-dev libavcodec-dev libssl-dev libxrandr-dev libxcursor-dev libtbb-dev +RUN apt-get update && apt-get -y install libpng-dev libtiff-dev libgif-dev libavcodec-dev libssl-dev libxrandr-dev libxcursor-dev ENV SCRIPTS_DIR=/tmp/scripts COPY builder/scripts $SCRIPTS_DIR -RUN $SCRIPTS_DIR/build-webp -RUN $SCRIPTS_DIR/build-libjpeg-turbo +RUN $SCRIPTS_DIR/build-deps.sh RUN useradd -m docker && echo "docker:docker" | chpasswd && adduser docker sudo diff --git a/builder/dockerfile.fedora_forty.build b/builder/dockerfile.fedora_forty.build index a3e91f4..7859248 100644 --- a/builder/dockerfile.fedora_forty.build +++ b/builder/dockerfile.fedora_forty.build @@ -74,13 +74,11 @@ RUN \ xorg-x11-xtrans-devel \ xsltproc \ libavformat-free-devel \ - libswscale-free-devel \ - tbb-devel + libswscale-free-devel ENV SCRIPTS_DIR=/tmp/scripts COPY builder/scripts $SCRIPTS_DIR -RUN $SCRIPTS_DIR/build-webp -RUN $SCRIPTS_DIR/build-libjpeg-turbo +RUN $SCRIPTS_DIR/build-deps.sh RUN useradd -m docker && echo "docker:docker" | chpasswd diff --git a/builder/dockerfile.fedora_fortyone.build b/builder/dockerfile.fedora_fortyone.build index f98b621..ef00860 100644 --- a/builder/dockerfile.fedora_fortyone.build +++ b/builder/dockerfile.fedora_fortyone.build @@ -75,13 +75,11 @@ RUN \ xorg-x11-xtrans-devel \ xsltproc \ libavformat-free-devel \ - libswscale-free-devel \ - tbb-devel + libswscale-free-devel ENV SCRIPTS_DIR=/tmp/scripts COPY builder/scripts $SCRIPTS_DIR -RUN $SCRIPTS_DIR/build-webp -RUN $SCRIPTS_DIR/build-libjpeg-turbo +RUN $SCRIPTS_DIR/build-deps.sh RUN useradd -m docker && echo "docker:docker" | chpasswd diff --git a/builder/dockerfile.fedora_thirtynine.build b/builder/dockerfile.fedora_thirtynine.build index f4200d7..aeaaf88 100644 --- a/builder/dockerfile.fedora_thirtynine.build +++ b/builder/dockerfile.fedora_thirtynine.build @@ -74,13 +74,11 @@ RUN \ xorg-x11-xtrans-devel \ xsltproc \ libavformat-free-devel \ - libswscale-free-devel \ - tbb-devel + libswscale-free-devel ENV SCRIPTS_DIR=/tmp/scripts COPY builder/scripts $SCRIPTS_DIR -RUN $SCRIPTS_DIR/build-webp -RUN $SCRIPTS_DIR/build-libjpeg-turbo +RUN $SCRIPTS_DIR/build-deps.sh RUN useradd -m docker && echo "docker:docker" | chpasswd diff --git a/builder/dockerfile.kali_kali-rolling.build b/builder/dockerfile.kali_kali-rolling.build index e3c6f99..cf97c83 100644 --- a/builder/dockerfile.kali_kali-rolling.build +++ b/builder/dockerfile.kali_kali-rolling.build @@ -15,12 +15,11 @@ RUN apt-get update && apt-get -y build-dep xorg-server libxfont-dev RUN apt-get update && apt-get -y install gcc g++ curl RUN apt-get update && apt-get -y install ninja-build cmake nasm git libgnutls28-dev vim wget tightvncserver RUN apt-get update && apt-get -y install libpng-dev libtiff-dev libgif-dev libavcodec-dev libssl-dev libxrandr-dev \ - libxcursor-dev libavformat-dev libswscale-dev libtbb-dev + libxcursor-dev libavformat-dev libswscale-dev ENV SCRIPTS_DIR=/tmp/scripts COPY builder/scripts $SCRIPTS_DIR -RUN $SCRIPTS_DIR/build-webp -RUN $SCRIPTS_DIR/build-libjpeg-turbo +RUN $SCRIPTS_DIR/build-deps.sh RUN useradd -m docker && echo "docker:docker" | chpasswd && adduser docker sudo diff --git a/builder/dockerfile.kali_kali-rolling.deb.build b/builder/dockerfile.kali_kali-rolling.deb.build index 6f9bd9a..6d0ed1b 100644 --- a/builder/dockerfile.kali_kali-rolling.deb.build +++ b/builder/dockerfile.kali_kali-rolling.deb.build @@ -3,7 +3,7 @@ FROM kalilinux/kali-rolling:latest ENV DEBIAN_FRONTEND noninteractive RUN apt-get update && \ - apt-get -y install vim build-essential devscripts equivs libtbb-dev + apt-get -y install vim build-essential devscripts equivs # Install build-deps for the package. COPY ./debian/control /tmp diff --git a/builder/dockerfile.opensuse_15.build b/builder/dockerfile.opensuse_15.build index 5b3b0ee..57f81e1 100644 --- a/builder/dockerfile.opensuse_15.build +++ b/builder/dockerfile.opensuse_15.build @@ -46,8 +46,7 @@ RUN zypper install -ny \ xorg-x11-devel \ xorg-x11-server-sdk \ xorg-x11-util-devel \ - zlib-devel \ - tbb-devel + zlib-devel RUN useradd -u 1000 docker && \ groupadd -g 1000 docker && \ @@ -71,7 +70,7 @@ ENV CC=/usr/bin/gcc-14 ENV CXX=/usr/bin/g++-14 COPY builder/scripts $SCRIPTS_DIR -RUN $SCRIPTS_DIR/build-libjpeg-turbo && $SCRIPTS_DIR/build-webp +RUN $SCRIPTS_DIR/build-deps.sh COPY --chown=docker:docker . /src/ diff --git a/builder/dockerfile.oracle_8.build b/builder/dockerfile.oracle_8.build index 4cdef63..9fc54da 100644 --- a/builder/dockerfile.oracle_8.build +++ b/builder/dockerfile.oracle_8.build @@ -32,8 +32,7 @@ RUN \ tigervnc-server \ wget \ xorg-x11-font-utils \ - zlib-devel \ - tbb-devel + zlib-devel # Enable additional repos (epel, powertools, and fusion) RUN dnf config-manager --set-enabled ol8_codeready_builder @@ -42,7 +41,6 @@ RUN dnf install -y --nogpgcheck https://mirrors.rpmfusion.org/free/el/rpmfusion- # Install from new repos RUN dnf install -y \ - tbb-devel \ ffmpeg-devel \ giflib-devel \ lbzip2 \ @@ -59,8 +57,8 @@ RUN dnf install -y \ ENV SCRIPTS_DIR=/tmp/scripts COPY builder/scripts $SCRIPTS_DIR RUN echo "source /opt/rh/gcc-toolset-14/enable" > /etc/profile.d/gcc-toolset.sh && \ - $SCRIPTS_DIR/build-webp && $SCRIPTS_DIR/build-libjpeg-turbo && \ - useradd -m docker && echo "docker:docker" | chpasswd + $SCRIPTS_DIR/build-deps.sh && \ + useradd -m docker && echo "docker:docker" | chpasswd COPY --chown=docker:docker . /src/ diff --git a/builder/dockerfile.oracle_9.build b/builder/dockerfile.oracle_9.build index 2e17589..8053bd5 100644 --- a/builder/dockerfile.oracle_9.build +++ b/builder/dockerfile.oracle_9.build @@ -34,8 +34,7 @@ RUN \ tigervnc-server \ wget \ xorg-x11-font-utils \ - zlib-devel \ - tbb-devel + zlib-devel # Enable additional repos (epel, powertools, and fusion) RUN dnf install -y oracle-epel-release-el9 @@ -58,7 +57,7 @@ RUN dnf install -y \ ENV SCRIPTS_DIR=/tmp/scripts COPY builder/scripts $SCRIPTS_DIR RUN echo "source /opt/rh/gcc-toolset-14/enable" > /etc/profile.d/gcc-toolset.sh && \ - $SCRIPTS_DIR/build-webp && $SCRIPTS_DIR/build-libjpeg-turbo && \ + $SCRIPTS_DIR/build-deps.sh && \ useradd -m docker && echo "docker:docker" | chpasswd COPY --chown=docker:docker . /src/ diff --git a/builder/dockerfile.ubuntu_focal.build b/builder/dockerfile.ubuntu_focal.build index 57c7373..0ecb1ee 100644 --- a/builder/dockerfile.ubuntu_focal.build +++ b/builder/dockerfile.ubuntu_focal.build @@ -13,7 +13,7 @@ RUN apt-get update && \ RUN apt-get update && apt-get install -y --no-install-recommends tzdata RUN apt-get update && apt-get -y build-dep xorg-server libxfont-dev RUN apt-get update && apt-get -y install ninja-build nasm git vim wget curl -RUN apt-get update && apt-get -y install libtbb-dev libpng-dev libtiff-dev libgif-dev libavcodec-dev libssl-dev libxrandr-dev \ +RUN apt-get update && apt-get -y install libpng-dev libtiff-dev libgif-dev libavcodec-dev libssl-dev libxrandr-dev \ libxcursor-dev libavformat-dev libswscale-dev ENV SCRIPTS_DIR=/tmp/scripts @@ -34,8 +34,7 @@ RUN ARCH=$(arch) && \ (echo y; echo n) | bash cmake.sh --prefix=/usr/local --skip-license && \ rm cmake.sh -RUN $SCRIPTS_DIR/build-webp -RUN $SCRIPTS_DIR/build-libjpeg-turbo +RUN $SCRIPTS_DIR/build-deps.sh COPY --chown=docker:docker . /src/ diff --git a/builder/dockerfile.ubuntu_focal.deb.build b/builder/dockerfile.ubuntu_focal.deb.build index ffe6402..8a4db12 100644 --- a/builder/dockerfile.ubuntu_focal.deb.build +++ b/builder/dockerfile.ubuntu_focal.deb.build @@ -3,7 +3,7 @@ FROM ubuntu:focal ENV DEBIAN_FRONTEND noninteractive RUN apt-get update && \ - apt-get -y install vim build-essential devscripts equivs libtbb-dev + apt-get -y install vim build-essential devscripts equivs # Install build-deps for the package. COPY ./debian/control /tmp diff --git a/builder/dockerfile.ubuntu_jammy.build b/builder/dockerfile.ubuntu_jammy.build index 3532bcf..3cbfe75 100644 --- a/builder/dockerfile.ubuntu_jammy.build +++ b/builder/dockerfile.ubuntu_jammy.build @@ -14,12 +14,11 @@ RUN apt-get update && apt-get install -y --no-install-recommends tzdata RUN apt-get update && apt-get -y build-dep xorg-server libxfont-dev RUN apt-get update && apt-get -y install ninja-build cmake nasm git libgnutls28-dev vim wget tightvncserver curl RUN apt-get update && apt-get -y install libpng-dev libtiff-dev libgif-dev libavcodec-dev libssl-dev libxrandr-dev \ - libxcursor-dev libavformat-dev libswscale-dev libtbb-dev + libxcursor-dev libavformat-dev libswscale-dev ENV SCRIPTS_DIR=/tmp/scripts COPY builder/scripts $SCRIPTS_DIR -RUN $SCRIPTS_DIR/build-webp -RUN $SCRIPTS_DIR/build-libjpeg-turbo +RUN $SCRIPTS_DIR/build-deps.sh RUN useradd -m docker && echo "docker:docker" | chpasswd && adduser docker sudo diff --git a/builder/dockerfile.ubuntu_jammy.deb.build b/builder/dockerfile.ubuntu_jammy.deb.build index e4e6fdd..31dee99 100644 --- a/builder/dockerfile.ubuntu_jammy.deb.build +++ b/builder/dockerfile.ubuntu_jammy.deb.build @@ -3,7 +3,7 @@ FROM ubuntu:jammy ENV DEBIAN_FRONTEND noninteractive RUN apt-get update && \ - apt-get -y install vim build-essential devscripts equivs libtbb-dev + apt-get -y install vim build-essential devscripts equivs # Install build-deps for the package. COPY ./debian/control /tmp diff --git a/builder/dockerfile.ubuntu_jammy.dev b/builder/dockerfile.ubuntu_jammy.dev index 08ae041..552b588 100644 --- a/builder/dockerfile.ubuntu_jammy.dev +++ b/builder/dockerfile.ubuntu_jammy.dev @@ -53,18 +53,16 @@ RUN sed -i 's$# deb-src$deb-src$' /etc/apt/sources.list && \ libxkbfile-dev \ x11proto-dev \ libgbm-dev \ + htop \ inotify-tools && \ echo "kasm-user ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers RUN curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash - RUN apt install -y nodejs nginx -COPY builder/scripts/build-webp /tmp -COPY builder/scripts/build-libjpeg-turbo /tmp -COPY builder/common.sh /tmp - -RUN chmod +x /tmp/build-webp && /tmp/build-webp -RUN chmod +x /tmp/build-libjpeg-turbo && /tmp/build-libjpeg-turbo +ENV SCRIPTS_DIR=/tmp/scripts +COPY builder/scripts $SCRIPTS_DIR +RUN $SCRIPTS_DIR/build-deps.sh USER 1000 diff --git a/builder/dockerfile.ubuntu_noble.build b/builder/dockerfile.ubuntu_noble.build index fde4e56..4301f3a 100644 --- a/builder/dockerfile.ubuntu_noble.build +++ b/builder/dockerfile.ubuntu_noble.build @@ -14,12 +14,11 @@ RUN apt-get update && apt-get install -y --no-install-recommends tzdata RUN apt-get update && apt-get -y build-dep xorg-server libxfont-dev RUN apt-get update && apt-get -y install ninja-build cmake nasm git libgnutls28-dev vim wget curl RUN apt-get update && apt-get -y install libpng-dev libtiff-dev libgif-dev libavcodec-dev libssl-dev libxrandr-dev \ - libxcursor-dev libavformat-dev libswscale-dev libtbb-dev + libxcursor-dev libavformat-dev libswscale-dev ENV SCRIPTS_DIR=/tmp/scripts COPY builder/scripts $SCRIPTS_DIR -RUN $SCRIPTS_DIR/build-webp -RUN $SCRIPTS_DIR/build-libjpeg-turbo +RUN $SCRIPTS_DIR/build-deps.sh RUN useradd -m docker && echo "docker:docker" | chpasswd && adduser docker sudo diff --git a/builder/dockerfile.ubuntu_noble.deb.build b/builder/dockerfile.ubuntu_noble.deb.build index d2f2987..6a56b24 100644 --- a/builder/dockerfile.ubuntu_noble.deb.build +++ b/builder/dockerfile.ubuntu_noble.deb.build @@ -3,7 +3,7 @@ FROM ubuntu:noble ENV DEBIAN_FRONTEND noninteractive RUN apt-get update && \ - apt-get -y install vim build-essential devscripts equivs libtbb-dev + apt-get -y install vim build-essential devscripts equivs # Install build-deps for the package. COPY ./debian/control /tmp diff --git a/builder/scripts/build-deps.sh b/builder/scripts/build-deps.sh new file mode 100755 index 0000000..9c1f205 --- /dev/null +++ b/builder/scripts/build-deps.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +set -e + +source_dir=$(dirname "$0") +"${source_dir}"/build-libjpeg-turbo +"${source_dir}"/build-webp +"${source_dir}"/build-tbb \ No newline at end of file diff --git a/builder/scripts/build-tbb b/builder/scripts/build-tbb new file mode 100755 index 0000000..9a91058 --- /dev/null +++ b/builder/scripts/build-tbb @@ -0,0 +1,25 @@ +#!/usr/bin/env bash + +set -euo pipefail + +build_and_install() { + cmake -B build -DCMAKE_INSTALL_PREFIX=/usr/local \ + -DTBB_TEST=OFF -GNinja . + ninja -C build install +} + +prepare_source() { + DIR=tbb + cd /tmp + TBB_RELEASE=$(curl -sL "https://api.github.com/repos/uxlfoundation/oneTBB/releases/latest" \ + | grep '"tag_name":' | sed -E 's/.*"tag_name": "([^"]+)".*/\1/') + + [ -d ./${DIR} ] && rm -rf ./${DIR} + mkdir ${DIR} + curl -Ls "https://github.com/uxlfoundation/oneTBB/archive/${TBB_RELEASE}.tar.gz" | \ + tar xzvf - -C ${DIR}/ --strip-components=1 + cd ${DIR} +} + +prepare_source +build_and_install From ad95259fda64623ed6c02ae9fc7daa89265b8602 Mon Sep 17 00:00:00 2001 From: El Date: Sat, 10 May 2025 15:24:01 +0500 Subject: [PATCH 106/150] VNC-127 Disable shared library builds for TBB --- builder/scripts/build-tbb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builder/scripts/build-tbb b/builder/scripts/build-tbb index 9a91058..054e2a3 100755 --- a/builder/scripts/build-tbb +++ b/builder/scripts/build-tbb @@ -4,7 +4,7 @@ set -euo pipefail build_and_install() { cmake -B build -DCMAKE_INSTALL_PREFIX=/usr/local \ - -DTBB_TEST=OFF -GNinja . + -DTBB_TEST=OFF -DBUILD_SHARED_LIBS=OFF -GNinja . ninja -C build install } From 58fccb771a3da749c17a6406dfc7af7bd07e9e3e Mon Sep 17 00:00:00 2001 From: El Date: Sun, 11 May 2025 07:55:45 +0500 Subject: [PATCH 107/150] VNC-127 Improve TBB build script --- builder/scripts/build-tbb | 62 +++++++++++++++++++++++++++++++-------- common/rfb/CMakeLists.txt | 1 - 2 files changed, 50 insertions(+), 13 deletions(-) diff --git a/builder/scripts/build-tbb b/builder/scripts/build-tbb index 054e2a3..03593f2 100755 --- a/builder/scripts/build-tbb +++ b/builder/scripts/build-tbb @@ -3,23 +3,61 @@ set -euo pipefail build_and_install() { - cmake -B build -DCMAKE_INSTALL_PREFIX=/usr/local \ - -DTBB_TEST=OFF -DBUILD_SHARED_LIBS=OFF -GNinja . - ninja -C build install + if [ $older_release -eq 1 ]; then + make extra_inc=big_iron.inc work_dir="$PWD"/ tbb_root="$PWD" + + if [ -d /usr/lib/x86_64-linux-gnu ]; then + LIBS=lib/x86_64-linux-gnu + elif [ -d /usr/lib/aarch64-linux-gnu ]; then + LIBS=lib/aarch64-linux-gnu + elif [ -d /usr/lib/arm-linux-gnueabihf ]; then + LIBS=lib/arm-linux-gnu + fi + + PC_FILE=/usr/${LIBS}/pkgconfig/tbb.pc + echo "prefix=/usr" > "${PC_FILE}" + echo "exec_prefix=\${prefix}" >> "${PC_FILE}" + echo "libdir=\${exec_prefix}/lib/${LIBS}" >> "${PC_FILE}" + echo "includedir=\${prefix}/include" >> "${PC_FILE}" + echo "Name: Threading Building Blocks" >> "${PC_FILE}" + echo "Description: Intel's parallelism library for C++" >> "${PC_FILE}" + echo "URL: http://www.threadingbuildingblocks.org/" >> "${PC_FILE}" + echo "Version: v2020.3.3" >> "${PC_FILE}" + echo "Libs: -ltbb -latomic" >> "${PC_FILE}" + echo "Cflags: -I\${includedir}" >> "${PC_FILE}" + + cp _release/*.a /usr/"${LIBS}"/ + cp -r include/* /usr/include/ + else + cmake -B build -DCMAKE_INSTALL_PREFIX=/usr/local \ + -DTBB_TEST=OFF -DBUILD_SHARED_LIBS=OFF -GNinja . + ninja -C build install + fi } prepare_source() { - DIR=tbb - cd /tmp - TBB_RELEASE=$(curl -sL "https://api.github.com/repos/uxlfoundation/oneTBB/releases/latest" \ - | grep '"tag_name":' | sed -E 's/.*"tag_name": "([^"]+)".*/\1/') + DIR=tbb + cd /tmp + [ -d ./${DIR} ] && rm -rf ./${DIR} + mkdir ${DIR} - [ -d ./${DIR} ] && rm -rf ./${DIR} - mkdir ${DIR} - curl -Ls "https://github.com/uxlfoundation/oneTBB/archive/${TBB_RELEASE}.tar.gz" | \ - tar xzvf - -C ${DIR}/ --strip-components=1 - cd ${DIR} + if [ $older_release -eq 1 ]; then + TBB_RELEASE="v2020.3.3" + else + TBB_RELEASE=$(curl -sL "https://api.github.com/repos/uxlfoundation/oneTBB/releases/latest" \ + | grep '"tag_name":' | sed -E 's/.*"tag_name": "([^"]+)".*/\1/') + fi + + curl -Ls "https://github.com/uxlfoundation/oneTBB/archive/${TBB_RELEASE}.tar.gz" | \ + + tar xzvf - -C ${DIR}/ --strip-components=1 + cd ${DIR} } +older_release=0 +if grep -q 'Ubuntu 20.04\|Debian GNU/Linux 11' /etc/os-release 2>/dev/null; then + older_release=1 +fi + prepare_source build_and_install diff --git a/common/rfb/CMakeLists.txt b/common/rfb/CMakeLists.txt index a5ffffc..434470b 100644 --- a/common/rfb/CMakeLists.txt +++ b/common/rfb/CMakeLists.txt @@ -140,7 +140,6 @@ else () set(RFB_LIBRARIES ${RFB_LIBRARIES} ${TBB_LIBRARIES}) endif () -message(STATUS ${RFB_LIBRARIES}) add_library(rfb STATIC ${RFB_SOURCES}) target_include_directories(rfb PRIVATE From 634731748a90d8392f42115c354780413199652b Mon Sep 17 00:00:00 2001 From: Dmitry Maksyoma Date: Wed, 14 May 2025 20:21:10 +1200 Subject: [PATCH 108/150] VNC-155 Refactor --- unix/vncserver | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/unix/vncserver b/unix/vncserver index 1ac99c8..32b32ba 100755 --- a/unix/vncserver +++ b/unix/vncserver @@ -1246,6 +1246,10 @@ sub DefineConfigToCLIConversion { pattern => qr/^(never|\d+)$/, errorMessage => "must be a number or 'never'" }); + my $percentValidator = KasmVNC::PatternValidator->new({ + pattern => qr/^(\d+%)$/, + errorMessage => "must be a number, followed by %" + }); my $allConfigKeysValidatorSub = sub { my @allConfigKeys = map { $_->configKeyNames() } @xvncOptions; @@ -1999,10 +2003,7 @@ sub DefineConfigToCLIConversion { configKeys => [ KasmVNC::ConfigKey->new({ name => "encoding.video_encoding_mode.enter_video_encoding_mode.area_threshold", - validator => KasmVNC::PatternValidator->new({ - pattern => qr/^(\d+%)$/, - errorMessage => "must be a number, followed by %" - }), + validator => $percentValidator }) ], deriveValueSub => sub { From f12264c5ad4574cf925e7cb342fe89db17bfd5a5 Mon Sep 17 00:00:00 2001 From: Dmitry Maksyoma Date: Wed, 14 May 2025 21:10:45 +1200 Subject: [PATCH 109/150] VNC-155 Refactor --- unix/vncserver | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/unix/vncserver b/unix/vncserver index 32b32ba..ee2fb33 100755 --- a/unix/vncserver +++ b/unix/vncserver @@ -1257,6 +1257,14 @@ sub DefineConfigToCLIConversion { allowedValues => [flatten(@allConfigKeys)] }) }; + my $deriveValueStripPercentSub = sub { + $self = shift; + + my $value = $self->configValue(); + $value =~ s/%$//; + + $value; + }; KasmVNC::CliOption::beforeIsActive(\&limitVncModeOptions); my $ipv4_regexp = '((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\.|$)){4}'; my $ipv6_regexp = '(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))'; @@ -2006,14 +2014,7 @@ sub DefineConfigToCLIConversion { validator => $percentValidator }) ], - deriveValueSub => sub { - $self = shift; - - my $value = $self->configValue(); - $value =~ s/%$//; - - $value; - } + deriveValueSub => $deriveValueStripPercentSub }), KasmVNC::CliOption->new({ name => 'VideoOutTime', From 0924817a7694544b1bfae3cd682703bc021bb9fb Mon Sep 17 00:00:00 2001 From: Dmitry Maksyoma Date: Wed, 14 May 2025 21:30:58 +1200 Subject: [PATCH 110/150] VNC-155 ConfigKey can have both type and validator Type can check whether value is boolean or int, and validator can check whether another configuration key is defined, for example. --- unix/KasmVNC/ConfigKey.pm | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/unix/KasmVNC/ConfigKey.pm b/unix/KasmVNC/ConfigKey.pm index f60fd63..b8ff425 100644 --- a/unix/KasmVNC/ConfigKey.pm +++ b/unix/KasmVNC/ConfigKey.pm @@ -32,13 +32,6 @@ sub validate { return if $self->isValueBlank(); - if ($self->{validator}) { - $self->resolveValidatorFromFunction() if (ref $self->{validator} eq "CODE"); - - $self->{validator}->validate($self); - return; - } - switch($self->{type}) { case INT { $self->validateInt(); @@ -47,6 +40,13 @@ sub validate { $self->validateBoolean(); } } + + if ($self->{validator}) { + $self->resolveValidatorFromFunction() if (ref $self->{validator} eq "CODE"); + + $self->{validator}->validate($self); + return; + } } sub resolveValidatorFromFunction { From 14ef7178b22984633226670216d562e5d99b624e Mon Sep 17 00:00:00 2001 From: Dmitry Maksyoma Date: Wed, 14 May 2025 21:44:08 +1200 Subject: [PATCH 111/150] VNC-155 Add scrolling configuration keys encoding.scrolling.detect_vertical_scrolling encoding.scrolling.detect_horizontal_scrolling encoding.scrolling.scroll_detect_threshold --- unix/kasmvnc_defaults.yaml | 4 +++ unix/vncserver | 50 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) diff --git a/unix/kasmvnc_defaults.yaml b/unix/kasmvnc_defaults.yaml index afad666..0ed63ce 100644 --- a/unix/kasmvnc_defaults.yaml +++ b/unix/kasmvnc_defaults.yaml @@ -134,6 +134,10 @@ encoding: compare_framebuffer: auto zrle_zlib_level: auto hextile_improved_compression: true + scrolling: + detect_vertical_scrolling: false + detect_horizontal_scrolling: false + scroll_detect_threshold: 25% server: http: diff --git a/unix/vncserver b/unix/vncserver index ee2fb33..7a9588f 100755 --- a/unix/vncserver +++ b/unix/vncserver @@ -2464,6 +2464,56 @@ sub DefineConfigToCLIConversion { }) ] }), + KasmVNC::CliOption->new({ + name => 'DetectScrolling', + configKeys => [ + KasmVNC::ConfigKey->new({ + name => "encoding.scrolling.detect_vertical_scrolling", + type => KasmVNC::ConfigKey::BOOLEAN + }) + ], + isActiveSub => sub { + $self = shift; + + my $value = $self->configValue(); + isPresent($value) && $value eq 'true'; + } + }), + KasmVNC::CliOption->new({ + name => 'DetectHorizontal', + configKeys => [ + KasmVNC::ConfigKey->new({ + name => "encoding.scrolling.detect_horizontal_scrolling", + type => KasmVNC::ConfigKey::BOOLEAN, + validator => KasmVNC::CallbackValidator->new({ + isValidCallback => sub { + my $value = shift; + + return 1 if $value eq "false"; + + ConfigValue("encoding.scrolling.detect_vertical_scrolling") eq "true"; + }, + errorMessage => "Detection of horizontal scrolling requires detection of vertical scrolling enabled" + }), + }) + ], + isActiveSub => sub { + $self = shift; + + my $value = $self->configValue(); + isPresent($value) && $value eq 'true'; + } + }), + KasmVNC::CliOption->new({ + name => 'ScrollDetectLimit', + configKeys => [ + KasmVNC::ConfigKey->new({ + name => "encoding.scrolling.scroll_detect_threshold", + validator => $percentValidator + }) + ], + deriveValueSub => $deriveValueStripPercentSub + }), ); %cliArgMap = map { ("-" . $_->{name}) => $_ } @xvncOptions; From e1a4f9db65624a9dccb905cc9927e960164ce42e Mon Sep 17 00:00:00 2001 From: Dmitry Maksyoma Date: Wed, 14 May 2025 23:25:26 +1200 Subject: [PATCH 112/150] VNC-155 Add scrolling CLI options to Xvnc man page --- unix/xserver/hw/vnc/Xvnc.man | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/unix/xserver/hw/vnc/Xvnc.man b/unix/xserver/hw/vnc/Xvnc.man index 206784c..2afd1fa 100644 --- a/unix/xserver/hw/vnc/Xvnc.man +++ b/unix/xserver/hw/vnc/Xvnc.man @@ -584,6 +584,23 @@ When this option is used, benchmarking results can be saved to a file specified .B -BenchmarkResults Save the benchmarking results to the specified file. Use this option together with \fB-Benchmark\fP to output the report to a custom file. +. +.TP +.B \-DetectScrolling +Try to detect scrolled sections in a changed area. + +Detect vertical scrolling on the screen and then use copyRects instead of +sending jpeg. A copy rect tells the client to copy a section of the screen and +paste it somewhere else. This significantly reduces bandwidth usage when someone +is scrolling down a page. +. +.TP +.B \-DetectHorizontal +With \fB-DetectScrolling\fP enabled, try to detect horizontal scrolls too, not just vertical. +. +.TP +.B \-ScrollDetectLimit +At least this % of the screen must change for scroll detection to happen, default 25. .SH USAGE WITH INETD By configuring the \fBinetd\fP(1) service appropriately, Xvnc can be launched From 6e96e98ea4e4907ccdeb9b11369a34209f39c424 Mon Sep 17 00:00:00 2001 From: El Date: Fri, 16 May 2025 11:36:56 +0500 Subject: [PATCH 113/150] Set sendWatermark flag during connection initialization --- common/rfb/VNCSConnectionST.cxx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/common/rfb/VNCSConnectionST.cxx b/common/rfb/VNCSConnectionST.cxx index ed36bdc..96b0077 100644 --- a/common/rfb/VNCSConnectionST.cxx +++ b/common/rfb/VNCSConnectionST.cxx @@ -997,6 +997,8 @@ void VNCSConnectionST::setDesktopSize(int fb_width, int fb_height, { unsigned int result; + server->sendWatermark = true; + if (!(accessRights & AccessSetDesktopSize)) goto justnotify; if (!rfb::Server::acceptSetDesktopSize) goto justnotify; From 1948030a4877d4bc0e7bf3c25289d4b0993ac64d Mon Sep 17 00:00:00 2001 From: Dmitry Maksyoma Date: Sun, 25 May 2025 10:33:04 +0000 Subject: [PATCH 114/150] Use Debian Bookworm slim in CI, restore ability to limit built distros, a flag to allow run_test distros to fail --- .ci/helpers.sh | 7 +- .gitlab-ci.yml | 66 ++-- BUILDING.txt => BUILDING.md | 354 +++++++++--------- Pipfile | 2 +- Pipfile.lock | 143 +++---- builder/devenv-vncserver | 2 +- ...est => dockerfile.ubuntu_jammy.specs.test} | 2 +- ...erfile.ubuntu_jammy.vncserver_devenv.test} | 2 +- builder/test-vncserver | 2 +- 9 files changed, 311 insertions(+), 269 deletions(-) rename BUILDING.txt => BUILDING.md (67%) rename builder/{dockerfile.ubuntu_focal.specs.test => dockerfile.ubuntu_jammy.specs.test} (97%) rename builder/{dockerfile.ubuntu_focal.vncserver_devenv.test => dockerfile.ubuntu_jammy.vncserver_devenv.test} (99%) diff --git a/.ci/helpers.sh b/.ci/helpers.sh index 8cc26e6..0279d67 100644 --- a/.ci/helpers.sh +++ b/.ci/helpers.sh @@ -114,6 +114,11 @@ install_packages_needed_for_functional_tests() { apt-get install -y python3 python3-pip python3-boto3 curl pkg-config libxmlsec1-dev } +is_build_this_distro() { + local distro="$1" + [[ "$BUILD_DISTROS_REGEX" = 'all' ]] || [[ "$distro" =~ $BUILD_DISTROS_REGEX ]] +} + function upload_to_s3() { local file_to_upload="$1"; local s3_url_for_file="$2"; @@ -132,7 +137,7 @@ function prepare_s3_uploader() { function prepare_to_run_scripts_and_s3_uploads() { export DEBIAN_FRONTEND=noninteractive apt-get update - apt-get install -y ruby2.7 git wget + apt-get install -y ruby3.1 git wget apt-get install -y python3 python3-pip python3-boto3 curl pkg-config libxmlsec1-dev prepare_s3_uploader } diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 65b2f88..a839c2c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -7,10 +7,15 @@ variables: GITLAB_SHARED_DIND_DIR: /builds/$CI_PROJECT_PATH/shared GIT_SUBMODULE_STRATEGY: normal GIT_FETCH_EXTRA_FLAGS: --tags --force - # E.g. BUILD_JOBS: build_debian_buster,build_ubuntu_focal. This will include - # arm builds, because build_debian_buster_arm matches build_debian_buster. - # "BUILD_JOBS: none" won't build any build jobs, nor www. - BUILD_JOBS: all + # For example, BUILD_DISTROS_REGEX: "jammy|focal". + # "BUILD_DISTROS_REGEX: none" won't build any distros, nor www. + # "BUILD_DISTROS_REGEX: all" would build all distros. + # Make sure you quote any whitespace characters you use. + # E.g. BUILD_DISTROS_REGEX: "jammy|\ focal". + BUILD_DISTROS_REGEX: all + # To debug upload stage, you can limit BUILD_DISTROS_REGEX to jammy and allow + # run_test distros to fail, by setting ALLOW_RUN_TESTS_TO_FAIL to true. + ALLOW_RUN_TESTS_TO_FAIL: false DOCKER_HOST: tcp://docker:2375 DOCKER_TLS_CERTDIR: "" @@ -29,8 +34,8 @@ stages: .prepare_build: &prepare_build - pwd - - apk add bash - mkdir -p "$GITLAB_SHARED_DIND_DIR" && chmod 777 "$GITLAB_SHARED_DIND_DIR" + - apt-get update && apt-get install -y docker.io - docker login --username $DOCKER_HUB_USERNAME --password $DOCKER_HUB_PASSWORD .prepare_www: &prepare_www @@ -46,7 +51,7 @@ default: functional_test: stage: functional_test - image: debian:bookworm + image: debian:bookworm-slim tags: - oci-fixed-amd before_script: @@ -82,7 +87,7 @@ build_www: - tar -zcvf ../output/www/kasm_www.tar.gz www only: variables: - - $BUILD_JOBS !~ /^none$/ + - $BUILD_DISTROS_REGEX !~ /^none$/ artifacts: paths: - output/ @@ -90,18 +95,18 @@ build_www: build_amd64: stage: build allow_failure: true + image: debian:bookworm-slim tags: - oci-fixed-amd before_script: - *prepare_build - *prepare_www + - . .ci/helpers.sh after_script: - *prepare_artfacts script: - - bash builder/build-package $DISTRO; - only: - variables: - - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ "$DISTRO" + - set -e + - is_build_this_distro "$DISTRO" && builder/build-package $DISTRO artifacts: paths: - output/ @@ -112,18 +117,18 @@ build_amd64: build_arm64: stage: build allow_failure: true + image: debian:bookworm-slim tags: - oci-fixed-arm before_script: - *prepare_build - *prepare_www + - . .ci/helpers.sh after_script: - *prepare_artfacts script: - - bash builder/build-package $DISTRO; - only: - variables: - - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ "$DISTRO" + - set -e + - is_build_this_distro "$DISTRO" && builder/build-package $DISTRO artifacts: paths: - output/ @@ -133,15 +138,19 @@ build_arm64: run_test_amd64: stage: run_test + image: debian:bookworm-slim tags: - oci-fixed-amd before_script: - *prepare_build + - . .ci/helpers.sh script: - - bash builder/test-barebones --run-test $DISTRO - only: - variables: - - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ "$DISTRO" + - set -e + - is_build_this_distro "$DISTRO" && builder/test-barebones --run-test $DISTRO + rules: + - if: $ALLOW_RUN_TESTS_TO_FAIL == "false" + - if: $ALLOW_RUN_TESTS_TO_FAIL == "true" + allow_failure: true dependencies: - build_amd64 artifacts: @@ -154,15 +163,19 @@ run_test_amd64: run_test_arm64: stage: run_test + image: debian:bookworm-slim tags: - oci-fixed-arm before_script: - *prepare_build + - . .ci/helpers.sh script: - - bash builder/test-barebones --run-test $DISTRO - only: - variables: - - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ "$DISTRO" + - set -e + - is_build_this_distro "$DISTRO" && builder/test-barebones --run-test $DISTRO + rules: + - if: $ALLOW_RUN_TESTS_TO_FAIL == "false" + - if: $ALLOW_RUN_TESTS_TO_FAIL == "true" + allow_failure: true dependencies: - build_arm64 artifacts: @@ -175,6 +188,7 @@ run_test_arm64: spec_test: stage: test + image: debian:bookworm-slim tags: - kasmvnc-x86 before_script: @@ -185,12 +199,12 @@ spec_test: - SelfBench.xml - Benchmark.xml script: - - bash builder/test-vncserver + - builder/test-vncserver upload: stage: upload - image: ubuntu:focal + image: debian:bookworm-slim tags: - oci-fixed-amd artifacts: @@ -229,7 +243,7 @@ upload_build_preview: stage: upload needs: ["upload"] dependencies: ["upload"] - image: ubuntu:focal + image: debian:bookworm-slim tags: - oci-fixed-amd before_script: diff --git a/BUILDING.txt b/BUILDING.md similarity index 67% rename from BUILDING.txt rename to BUILDING.md index 4cd1a8e..668e488 100644 --- a/BUILDING.txt +++ b/BUILDING.md @@ -1,78 +1,6 @@ -******************************************************************************* -** Building KasmVNC -******************************************************************************* +# Building KasmVNC - -================================ -Build Requirements (All Systems) -================================ - --- CMake (http://www.cmake.org) v2.8 or later - --- zlib - --- If building TLS support: - * GnuTLS 3.x - * See "Building TLS Support" below. - --- If building native language support (NLS): - * Gnu gettext 0.14.4 or later - * See "Building Native Language Support" below. - --- libjpeg-turbo - * "Normal" libjpegv6 is also supported, although it is not - recommended as it is much slower. - --- libwebp - - -========================= -Build Requirements (Unix) -========================= - --- Non-Mac platforms: - * X11 development kit - --- If building Xvnc/libvnc.so: - * Xorg server source code, 1.7 or never - * All build requirements Xorg imposes (see its documentation) - -============================ -Build Requirements (Windows) -============================ - --- MinGW or MinGW-w64 - --- Inno Setup (needed to build the KasmVNC installer) - Inno Setup can be downloaded from http://www.jrsoftware.org/isinfo.php. - You also need the Inno Setup Preprocessor, which is available in the - Inno Setup QuickStart Pack. - - Add the directory containing iscc.exe (for instance, - C:\Program Files\Inno Setup 5) to the system or user PATH environment - variable prior to building KasmVNC. - - -================== -Out-of-Tree Builds -================== - -Binary objects, libraries, and executables are generated in the same directory -from which cmake was executed (the "binary directory"), and this directory need -not necessarily be the same as the KasmVNC source directory. You can create -multiple independent binary directories, in which different versions of -KasmVNC can be built from the same source tree using different compilers or -settings. In the sections below, {build_directory} refers to the binary -directory, whereas {source_directory} refers to the KasmVNC source directory. -For in-tree builds, these directories are the same. - - -================= -Building KasmVNC -================= - -Building the KasmVNC Server using Docker ----------------------------------------- +## Building the KasmVNC Server using Docker ```bash git submodule init @@ -81,6 +9,9 @@ sudo docker build -t kasmvnc:dev -f builder/dockerfile.ubuntu_jammy.dev . sudo docker run -it --rm -v ./:/src -p 6901:6901 -p 8443:8443 --name kasmvnc_dev kasmvnc:dev ``` +**The above assumes you are UID 1000 on the host as the container UID is 1000.** +Ensure you switch to the user associated to UID 1000 on the host. + Now from inside the container. ```bash @@ -99,14 +30,13 @@ builder/build.sh Now run Xvnc and Xfce4 from inside the container ```bash -/src/xorg.build/bin/Xvnc -interface 0.0.0.0 -PublicIP 127.0.0.1 -disableBasicAuth -RectThreads 0 -Log *:stdout:100 -httpd /src/kasmweb/dist -sslOnly 0 -SecurityTypes None -websocketPort 6901 :1 & +/src/xorg.build/bin/Xvnc -interface 0.0.0.0 -PublicIP 127.0.0.1 -disableBasicAuth -RectThreads 0 -Log *:stdout:100 -httpd /src/kasmweb/dist -sslOnly 0 -SecurityTypes None -websocketPort 6901 -FreeKeyMappings :1 & /usr/bin/xfce4-session --display :1 ``` Now open a browser and navigate to your dev VM on port 6901. -Running noVNC from source -------------------------- +## Running noVNC from source If you need to debug or make changes to the UI code, use the following procedures to use npm to serve the web code. The code will automatically rebuild when changes are made and the code will not be packaged. These steps assume you are inside the kasmvnc:dev container started in the above steps. @@ -114,7 +44,7 @@ Now from inside the container. **This assumes KasmVNC is already built, follow s ```bash # Run KasmVNC -/src/xorg.build/bin/Xvnc -interface 0.0.0.0 -PublicIP 127.0.0.1 -disableBasicAuth -RectThreads 0 -Log *:stdout:100 -httpd /src/kasmweb/dist -sslOnly 0 -SecurityTypes None -websocketPort 6901 :1 & +/src/xorg.build/bin/Xvnc -interface 0.0.0.0 -PublicIP 127.0.0.1 -disableBasicAuth -RectThreads 0 -Log *:stdout:100 -httpd /src/kasmweb/dist -sslOnly 0 -SecurityTypes None -websocketPort 6901 -FreeKeyMappings :1 & /usr/bin/xfce4-session --display :1 & sudo nginx @@ -133,8 +63,60 @@ Since `npm run serve` needs to run in the foreground, you may need to exec into sudo docker exec -it kasmvnc_dev /bin/bash ``` -Building the KasmVNC Server on Modern Unix/Linux Systems ---------------------------------------------------------- +## Building in CI + +### Achieve a faster feedback loop in CI + +To achieve a faster feedback loop in CI, you can limit built distros to a few +distros you're interested in. + +#### Best way to debug CI in a fast feedback loop + +Specify `BUILD_DISTROS_REGEX: "jammy"`, and build only Ubuntu Jammy. That's +only 2 distro package build jobs, one for amd64 and one for arm64. + +Specify `ALLOW_RUN_TESTS_TO_FAIL: true` to ignore `run_test` job failures and +debug the upload stage. + +#### Build only a few distros + +To build only distros you want, specify a regex in `$BUILD_DISTROS_REGEX` +variable. For example, build Ubuntu Jammy and Focal with `BUILD_DISTROS_REGEX: +"jammy|focal"`. Or simply a single distro Ubuntu Jammy with +`BUILD_DISTROS_REGEX: "jammy"`.
+To build all distros, specify `BUILD_DISTROS_REGEX: all`.
+To build no distros, and no www, specify `BUILD_DISTROS_REGEX: none`. + +##### Required distros to build + +Functional tests and spec tests use Ubuntu Jammy. If Jammy is not built, those +stages fail. If you want to debug pipeline stages after `functional_test`, +building Ubuntu Jammy is required. + +Specify `BUILD_DISTROS_REGEX: "jammy|"`. + +##### Heed, when writing regex + +Regex placed in `$BUILD_DISTROS_REGEX` are [Bash +regex](https://tldp.org/LDP/Bash-Beginners-Guide/html/sect_04_01.html) and are +processed by Bash. + +Any whitespace in `$BUILD_DISTROS_REGEX` must be escaped. For example, +`BUILD_DISTROS_REGEX: "\ jammy"`. + +#### Debug upload stage, while building only a few distros + +`run_test` jobs fail the pipeline, whenever packages for a distro weren't +built. When building only a few distros, packages for the rest of distros aren't +built. Not finding the package to test, a `run_test` job fails, pipeline fails, +and the upload stage doesn't get executed. + +To still execute and debug upload stage in a faster feedback loop (building only +a few distros), specify `ALLOW_RUN_TESTS_TO_FAIL: true`. Gitlab CI's +`allow_failure: true` is used to allow the pipeline to ignore failed `run_test` +jobs and continue to the upload stage. + +## Building the KasmVNC Server on Modern Unix/Linux Systems Building the KasmVNC Server (Xvnc) is a bit trickier. On newer systems containing Xorg 7.4 or later (such as Fedora), Xvnc is typically built to use @@ -142,48 +124,49 @@ the X11 shared libraries provided with the system. The procedure for this is system-specific, since it requires specifying such things as font directories, but the general outline is as follows. - > cd {build_directory} +```bash + cd {build_directory} - If performing an out-of-tree build: - > mkdir unix - > cp -R {source_directory}/unix/xserver unix/ + # If performing an out-of-tree build: + mkdir unix + cp -R {source_directory}/unix/xserver unix/ - > cp -R {xorg_source}/* unix/xserver/ - (NOTE: {xorg_source} is the directory containing the Xorg source for the - machine on which you are building KasmVNC. The most recent versions of - Red Hat/Fedora, for instance, provide an RPM called - "xorg-x11-server-source", which installs the Xorg source under - /usr/share/xorg-x11-server-source.) + cp -R {xorg_source}/* unix/xserver/ + # (NOTE: {xorg_source} is the directory containing the Xorg source for the + # machine on which you are building KasmVNC. The most recent versions of + # Red Hat/Fedora, for instance, provide an RPM called + # "xorg-x11-server-source", which installs the Xorg source under + # /usr/share/xorg-x11-server-source.) - > cd unix/xserver/ - > patch -p1 < {source_directory}/unix/xserver{version}.patch - (where {version} matches the X server version you are building, such as - "17" for version 1.7.x.) - > autoreconf -fiv + cd unix/xserver/ + patch -p1 < {source_directory}/unix/xserver{version}.patch + (where {version} matches the X server version you are building, such as + "17" for version 1.7.x.) + autoreconf -fiv - > ./configure --with-pic --without-dtrace --disable-static --disable-dri \ - --disable-xinerama --disable-xvfb --disable-xnest --disable-xorg \ - --disable-dmx --disable-xwin --disable-xephyr --disable-kdrive \ - --disable-config-dbus --disable-config-hal --disable-config-udev \ - --disable-dri2 --enable-install-libxf86config --enable-glx \ - --with-default-font-path="catalogue:/etc/X11/fontpath.d,built-ins" \ - --with-fontdir=/usr/share/X11/fonts \ - --with-xkb-path=/usr/share/X11/xkb \ - --with-xkb-output=/var/lib/xkb \ - --with-xkb-bin-directory=/usr/bin \ - --with-serverconfig-path=/usr/lib[64]/xorg \ - --with-dri-driver-path=/usr/lib[64]/dri \ - {additional configure options} - (NOTE: This is merely an example that works with Red Hat Enterprise - and recent Fedora releases. You should customize it for your particular - system. In particular, it will be necessary to customize the font, XKB, - and DRI directories.) + ./configure --with-pic --without-dtrace --disable-static --disable-dri \ + --disable-xinerama --disable-xvfb --disable-xnest --disable-xorg \ + --disable-dmx --disable-xwin --disable-xephyr --disable-kdrive \ + --disable-config-dbus --disable-config-hal --disable-config-udev \ + --disable-dri2 --enable-install-libxf86config --enable-glx \ + --with-default-font-path="catalogue:/etc/X11/fontpath.d,built-ins" \ + --with-fontdir=/usr/share/X11/fonts \ + --with-xkb-path=/usr/share/X11/xkb \ + --with-xkb-output=/var/lib/xkb \ + --with-xkb-bin-directory=/usr/bin \ + --with-serverconfig-path=/usr/lib[64]/xorg \ + --with-dri-driver-path=/usr/lib[64]/dri \ + {additional configure options} + # (NOTE: This is merely an example that works with Red Hat Enterprise + # and recent Fedora releases. You should customize it for your particular + # system. In particular, it will be necessary to customize the font, XKB, + # and DRI directories.) - > make KASMVNC_SRCDIR={source_directory} + make KASMVNC_SRCDIR={source_directory} +``` -Building the KasmVNC Server on Legacy Unix/Linux Systems ---------------------------------------------------------- +## Building the KasmVNC Server on Legacy Unix/Linux Systems Those using systems with older versions of Xorg must build a "legacy-friendly" version of the KasmVNC Server. This is accomplished by downloading and @@ -195,9 +178,11 @@ source distribution (located under contrib/xorg/) automates this process. The following procedure will build a "legacy-friendly" version of the KasmVNC Server: +```bash cd {build_directory} sh {source_directory}/contrib/xorg/build-xorg init sh {source_directory}/contrib/xorg/build-xorg build [additional CMake flags] +``` build-xorg generates a version of Xvnc that has no external dependencies on the X11 shared libraries or any other distribution-specific shared libraries. This @@ -211,30 +196,32 @@ once the X11 modules and other dependencies have been built for the first time. This is convenient for testing changes that just apply to the KasmVNC source code. To accomplish this, run: +```sh sh {source_directory}/contrib/xorg/build-xorg rebuild [additional make flags] +``` For instance, +```sh sh {source_directory}/contrib/xorg/build-xorg rebuild clean +``` will clean the Xvnc build without destroying any of the build configuration or module dependencies. -Debug Build ------------ +## Debug Build -Add "-DCMAKE_BUILD_TYPE=Debug" to the CMake command line. +Add `-DCMAKE_BUILD_TYPE=Debug` to the CMake command line. -Portable (semi-static) Build ----------------------------- +## Portable (semi-static) Build KasmVNC can under favourble circumstances be built in a way that allows the resulting binaries to run on any system without having to also install all the dynamic libraries it depends on. Enable this mode by adding: - -DBUILD_STATIC=1 + `-DBUILD_STATIC=1` to the CMake command line. @@ -242,30 +229,53 @@ Note that the method used to achieve this is very fragile and it may be necessary to tweak cmake/StaticBuild.cmake to make things work on your specific system. +# Build Requirements (Windows) -====================================== -Building TLS Support -====================================== +-- MinGW or MinGW-w64 + +-- Inno Setup (needed to build the KasmVNC installer) + Inno Setup can be downloaded from http://www.jrsoftware.org/isinfo.php. + You also need the Inno Setup Preprocessor, which is available in the + Inno Setup QuickStart Pack. + + Add the directory containing iscc.exe (for instance, + C:\Program Files\Inno Setup 5) to the system or user PATH environment + variable prior to building KasmVNC. + + +# Out-of-Tree Builds + +Binary objects, libraries, and executables are generated in the same directory +from which cmake was executed (the "binary directory"), and this directory need +not necessarily be the same as the KasmVNC source directory. You can create +multiple independent binary directories, in which different versions of +KasmVNC can be built from the same source tree using different compilers or +settings. In the sections below, {build_directory} refers to the binary +directory, whereas {source_directory} refers to the KasmVNC source directory. +For in-tree builds, these directories are the same. + + +# Building TLS Support TLS requires GnuTLS, which is supplied with most Linux distributions and with MinGW for Windows and can be built from source on OS X and other Unix variants. However, GnuTLS versions > 2.12.x && < 3.3.x should be avoided because of potential incompatibilities during initial handshaking. -You can override the GNUTLS_LIBRARY and GNUTLS_INCLUDE_DIR CMake variables +You can override the `GNUTLS_LIBRARY` and `GNUTLS_INCLUDE_DIR` CMake variables to specify the locations of libgnutls and any dependencies. For instance, adding +```bash -DGNUTLS_INCLUDE_DIR=/usr/local/include \ -DGNUTLS_LIBRARY=/usr/local/lib/libgnutls.a +``` to the CMake command line would link KasmVNC against a static version of libgnutls located under /usr/local. -====================================== -Building Native Language Support (NLS) -====================================== +# Building Native Language Support (NLS) NLS requires gettext, which is supplied with most Linux distributions and with MinGW for Windows and which can easily be built from source on OS X and @@ -275,60 +285,57 @@ You can override the ICONV_LIBRARIES and LIBINTL_LIBRARY CMake variables to specify the locations of libiconv and libintl, respectively. For instance, adding - -DLIBINTL_LIBRARY=/opt/gettext/lib/libintl.a + `-DLIBINTL_LIBRARY=/opt/gettext/lib/libintl.a` to the CMake command line would link KasmVNC against a static version of libintl located under /opt/gettext. Adding +```bash -DICONV_INCLUDE_DIR=/mingw/include \ -DICONV_LIBRARIES=/mingw/lib/libiconv.a \ -DGETTEXT_INCLUDE_DIR=/mingw/include \ -DLIBINTL_LIBRARY=/mingw/lib/libintl.a +``` to the CMake command line would link KasmVNC against the static versions of libiconv and libintl included in the MinGW Developer Toolkit. -=================== -Installing KasmVNC -=================== +# Installing KasmVNC You can use the build system to install KasmVNC into a directory of your choosing. To do this, add: - -DCMAKE_INSTALL_PREFIX={install_directory} + `-DCMAKE_INSTALL_PREFIX={install_directory}` to the CMake command line. Then, you can run 'make install' to build and install it. -If you don't specify CMAKE_INSTALL_PREFIX, then the default is -c:\Program Files\KasmVNC on Windows and /usr/local on Unix. +If you don't specify `CMAKE_INSTALL_PREFIX`, then the default is +`c:\Program Files\KasmVNC` on Windows and `/usr/local` on Unix. -========================= -Creating Release Packages -========================= +# Creating Release Packages The following commands can be used to create various types of release packages: -Unix ----- +## Unix -make tarball +`make tarball` Create a binary tarball containing the utils -make servertarball +`make servertarball` Create a binary tarball containing both the KasmVNC Server and utils -make dmg +`make dmg` Create Macintosh disk image file that contains an application bundle of the utils -make udmg +`make udmg` On 64-bit OS X systems, this creates a version of the Macintosh package and disk image which contains universal i386/x86-64 binaries. You should first @@ -341,67 +348,69 @@ make udmg using the instructions in the "Build Recipes" section. -Windows -------- +## Windows -make installer +`make installer` Create a Windows installer using Inno Setup. The installer package (KasmVNC[64].exe) will be located under {build_directory}. -============= -Build Recipes -============= +# Build Recipes -32-bit Build on 64-bit Linux/Unix (including OS X) --------------------------------------------------- +## 32-bit Build on 64-bit Linux/Unix (including OS X) Set the following environment variables before building KasmVNC. +```bash CFLAGS='-O3 -m32' CXXFLAGS='-O3 -m32' LDFLAGS=-m32 +``` If you are building the KasmVNC Server on a modern Unix/Linux system, then you will also need to pass the appropriate --host argument when configuring the X server source (for instance, --host=i686-pc-linux-gnu). -64-bit Backward-Compatible Build on 64-bit OS X ------------------------------------------------ +## 64-bit Backward-Compatible Build on 64-bit OS X Add +```bash -DCMAKE_OSX_SYSROOT=/Developer/SDKs/MacOSX10.5.sdk \ -DCMAKE_OSX_DEPLOYMENT_TARGET=10.5 +``` to the CMake command line. The OS X 10.5 SDK must be installed. -32-bit Backward-Compatible Build on 64-bit OS X ------------------------------------------------ +## 32-bit Backward-Compatible Build on 64-bit OS X Set the following environment variables: +```bash CC=gcc-4.0 CXX=g++-4.0 CFLAGS='-O3 -m32' CXXFLAGS='-O3 -m32' LDFLAGS=-m32 +``` and add +```bash -DCMAKE_OSX_SYSROOT=/Developer/SDKs/MacOSX10.4u.sdk \ -DCMAKE_OSX_DEPLOYMENT_TARGET=10.4 +``` to the CMake command line. The OS X 10.4 SDK must be installed. -64-bit MinGW Build on Cygwin ----------------------------- +## 64-bit MinGW Build on Cygwin +```bash cd {build_directory} CC=/usr/bin/x86_64-w64-mingw32-gcc CXX=/usr/bin/x86_64-w64-mingw32-g++ \ RC=/usr/bin/x86_64-w64-mingw32-windres \ @@ -409,15 +418,16 @@ to the CMake command line. The OS X 10.4 SDK must be installed. -DCMAKE_AR=/usr/bin/x86_64-w64-mingw32-ar \ -DCMAKE_RANLIB=/usr/bin/x86_64-w64-mingw32-ranlib {source_directory} make +``` This produces a 64-bit build of KasmVNC that does not depend on cygwin1.dll or other Cygwin DLL's. The mingw64-x86_64-gcc-core and mingw64-x86_64-gcc-g++ packages (and their dependencies) must be installed. -32-bit MinGW Build on Cygwin ----------------------------- +## 32-bit MinGW Build on Cygwin +```bash cd {build_directory} CC=/usr/bin/i686-w64-mingw32-gcc CXX=/usr/bin/i686-w64-mingw32-g++ \ RC=/usr/bin/i686-w64-mingw32-windres \ @@ -425,18 +435,19 @@ packages (and their dependencies) must be installed. -DDCMAKE_AR=/usr/bin/i686-w64-mingw32-ar \ -DCMAKE_RANLIB=/usr/bin/i686-w64-mingw32-ranlib {source_directory} make +``` This produces a 32-bit build of KasmVNC that does not depend on cygwin1.dll or other Cygwin DLL's. The mingw64-i686-gcc-core and mingw64-i686-gcc-g++ packages (and their dependencies) must be installed. -MinGW-w64 Build on Windows --------------------------- +## MinGW-w64 Build on Windows This produces a 64-bit build of KasmVNC using the "native" MinGW-w64 toolchain (which is faster than the Cygwin version): +```bash cd {build_directory} CC={mingw-w64_binary_path}/x86_64-w64-mingw32-gcc \ CXX={mingw-w64_binary_path}/x86_64-w64-mingw32-g++ \ @@ -446,11 +457,12 @@ This produces a 64-bit build of KasmVNC using the "native" MinGW-w64 toolchain -DCMAKE_RANLIB={mingw-w64_binary_path}/x86_64-w64-mingw32-ranlib \ {source_directory} make +``` -MinGW Build on Linux --------------------- +## MinGW Build on Linux +```bash cd {build_directory} CC={mingw_binary_path}/i386-mingw32-gcc \ CXX={mingw_binary_path}/i386-mingw32-g++ \ @@ -460,15 +472,13 @@ MinGW Build on Linux -DCMAKE_RANLIB={mingw_binary_path}/i386-mingw32-ranlib \ {source_directory} make +``` -=============================== -Distribution-Specific Packaging -=============================== +# Distribution-Specific Packaging -RPM Packages for RHEL ------------------------------- +## RPM Packages for RHEL The RPM spec files and patches used to create the nightly builds and releases can be found in the "contrib/rpm/el{5,6}" directories @@ -477,6 +487,7 @@ must be fetched manually and placed into the 'SOURCES' directory under the rpmbuild root. Additionally, the following macros need to be defined: +``` EL6: %debug_package %{nil} @@ -485,10 +496,11 @@ to be defined: %_smp_mflags -j3 %debug_package %{nil} %__arch_install_post /usr/lib/rpm/check-rpaths /usr/lib/rpm/check-buildroot +``` -Debian packages for Ubuntu 12.04LTS ------------------------------------ +## Debian packages for Ubuntu 12.04LTS + The debian folder used to create the nightly builds and releases can be found in the "contrib/deb/ubuntu-precise" directory of the KasmVNC subversion trunk. diff --git a/Pipfile b/Pipfile index aa90173..42edbba 100644 --- a/Pipfile +++ b/Pipfile @@ -12,4 +12,4 @@ pexpect = "*" [dev-packages] [requires] -python_version = "3.8" +python_version = "3.10" diff --git a/Pipfile.lock b/Pipfile.lock index 1006c73..68f1a32 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,11 +1,11 @@ { "_meta": { "hash": { - "sha256": "6745d5e5d90e44a18d73a0e23bc3d3e68acb950af0b87df50b45272d25b9e615" + "sha256": "f6a1fc809d6e02cd4f1ed8e45d4fc135a7c757cabe8eeb887a29e3664b796221" }, "pipfile-spec": 6, "requires": { - "python_version": "3.8" + "python_version": "3.10" }, "sources": [ { @@ -30,61 +30,72 @@ }, "coverage": { "hashes": [ - "sha256:004d1880bed2d97151facef49f08e255a20ceb6f9432df75f4eef018fdd5a78c", - "sha256:01d84219b5cdbfc8122223b39a954820929497a1cb1422824bb86b07b74594b6", - "sha256:040af6c32813fa3eae5305d53f18875bedd079960822ef8ec067a66dd8afcd45", - "sha256:06191eb60f8d8a5bc046f3799f8a07a2d7aefb9504b0209aff0b47298333302a", - "sha256:13034c4409db851670bc9acd836243aeee299949bd5673e11844befcb0149f03", - "sha256:13c4ee887eca0f4c5a247b75398d4114c37882658300e153113dafb1d76de529", - "sha256:184a47bbe0aa6400ed2d41d8e9ed868b8205046518c52464fde713ea06e3a74a", - "sha256:18ba8bbede96a2c3dde7b868de9dcbd55670690af0988713f0603f037848418a", - "sha256:1aa846f56c3d49205c952d8318e76ccc2ae23303351d9270ab220004c580cfe2", - "sha256:217658ec7187497e3f3ebd901afdca1af062b42cfe3e0dafea4cced3983739f6", - "sha256:24d4a7de75446be83244eabbff746d66b9240ae020ced65d060815fac3423759", - "sha256:2910f4d36a6a9b4214bb7038d537f015346f413a975d57ca6b43bf23d6563b53", - "sha256:2949cad1c5208b8298d5686d5a85b66aae46d73eec2c3e08c817dd3513e5848a", - "sha256:2a3859cb82dcbda1cfd3e6f71c27081d18aa251d20a17d87d26d4cd216fb0af4", - "sha256:2cafbbb3af0733db200c9b5f798d18953b1a304d3f86a938367de1567f4b5bff", - "sha256:2e0d881ad471768bf6e6c2bf905d183543f10098e3b3640fc029509530091502", - "sha256:30c77c1dc9f253283e34c27935fded5015f7d1abe83bc7821680ac444eaf7793", - "sha256:3487286bc29a5aa4b93a072e9592f22254291ce96a9fbc5251f566b6b7343cdb", - "sha256:372da284cfd642d8e08ef606917846fa2ee350f64994bebfbd3afb0040436905", - "sha256:41179b8a845742d1eb60449bdb2992196e211341818565abded11cfa90efb821", - "sha256:44d654437b8ddd9eee7d1eaee28b7219bec228520ff809af170488fd2fed3e2b", - "sha256:4a7697d8cb0f27399b0e393c0b90f0f1e40c82023ea4d45d22bce7032a5d7b81", - "sha256:51cb9476a3987c8967ebab3f0fe144819781fca264f57f89760037a2ea191cb0", - "sha256:52596d3d0e8bdf3af43db3e9ba8dcdaac724ba7b5ca3f6358529d56f7a166f8b", - "sha256:53194af30d5bad77fcba80e23a1441c71abfb3e01192034f8246e0d8f99528f3", - "sha256:5fec2d43a2cc6965edc0bb9e83e1e4b557f76f843a77a2496cbe719583ce8184", - "sha256:6c90e11318f0d3c436a42409f2749ee1a115cd8b067d7f14c148f1ce5574d701", - "sha256:74d881fc777ebb11c63736622b60cb9e4aee5cace591ce274fb69e582a12a61a", - "sha256:7501140f755b725495941b43347ba8a2777407fc7f250d4f5a7d2a1050ba8e82", - "sha256:796c9c3c79747146ebd278dbe1e5c5c05dd6b10cc3bcb8389dfdf844f3ead638", - "sha256:869a64f53488f40fa5b5b9dcb9e9b2962a66a87dab37790f3fcfb5144b996ef5", - "sha256:8963a499849a1fc54b35b1c9f162f4108017b2e6db2c46c1bed93a72262ed083", - "sha256:8d0a0725ad7c1a0bcd8d1b437e191107d457e2ec1084b9f190630a4fb1af78e6", - "sha256:900fbf7759501bc7807fd6638c947d7a831fc9fdf742dc10f02956ff7220fa90", - "sha256:92b017ce34b68a7d67bd6d117e6d443a9bf63a2ecf8567bb3d8c6c7bc5014465", - "sha256:970284a88b99673ccb2e4e334cfb38a10aab7cd44f7457564d11898a74b62d0a", - "sha256:972c85d205b51e30e59525694670de6a8a89691186012535f9d7dbaa230e42c3", - "sha256:9a1ef3b66e38ef8618ce5fdc7bea3d9f45f3624e2a66295eea5e57966c85909e", - "sha256:af0e781009aaf59e25c5a678122391cb0f345ac0ec272c7961dc5455e1c40066", - "sha256:b6d534e4b2ab35c9f93f46229363e17f63c53ad01330df9f2d6bd1187e5eaacf", - "sha256:b7895207b4c843c76a25ab8c1e866261bcfe27bfaa20c192de5190121770672b", - "sha256:c0891a6a97b09c1f3e073a890514d5012eb256845c451bd48f7968ef939bf4ae", - "sha256:c2723d347ab06e7ddad1a58b2a821218239249a9e4365eaff6649d31180c1669", - "sha256:d1f8bf7b90ba55699b3a5e44930e93ff0189aa27186e96071fac7dd0d06a1873", - "sha256:d1f9ce122f83b2305592c11d64f181b87153fc2c2bbd3bb4a3dde8303cfb1a6b", - "sha256:d314ed732c25d29775e84a960c3c60808b682c08d86602ec2c3008e1202e3bb6", - "sha256:d636598c8305e1f90b439dbf4f66437de4a5e3c31fdf47ad29542478c8508bbb", - "sha256:deee1077aae10d8fa88cb02c845cfba9b62c55e1183f52f6ae6a2df6a2187160", - "sha256:ebe78fe9a0e874362175b02371bdfbee64d8edc42a044253ddf4ee7d3c15212c", - "sha256:f030f8873312a16414c0d8e1a1ddff2d3235655a2174e3648b4fa66b3f2f1079", - "sha256:f0b278ce10936db1a37e6954e15a3730bea96a0997c26d7fee88e6c396c2086d", - "sha256:f11642dddbb0253cc8853254301b51390ba0081750a8ac03f20ea8103f0c56b6" + "sha256:042e7841a26498fff7a37d6fda770d17519982f5b7d8bf5278d140b67b61095f", + "sha256:04bfec25a8ef1c5f41f5e7e5c842f6b615599ca8ba8391ec33a9290d9d2db3a3", + "sha256:0915742f4c82208ebf47a2b154a5334155ed9ef9fe6190674b8a46c2fb89cb05", + "sha256:18c5ae6d061ad5b3e7eef4363fb27a0576012a7447af48be6c75b88494c6cf25", + "sha256:2931f66991175369859b5fd58529cd4b73582461877ecfd859b6549869287ffe", + "sha256:2e4b6b87bb0c846a9315e3ab4be2d52fac905100565f4b92f02c445c8799e257", + "sha256:3043ba1c88b2139126fc72cb48574b90e2e0546d4c78b5299317f61b7f718b78", + "sha256:379fe315e206b14e21db5240f89dc0774bdd3e25c3c58c2c733c99eca96f1ada", + "sha256:42421e04069fb2cbcbca5a696c4050b84a43b05392679d4068acbe65449b5c64", + "sha256:4dfd9a93db9e78666d178d4f08a5408aa3f2474ad4d0e0378ed5f2ef71640cb6", + "sha256:52a523153c568d2c0ef8826f6cc23031dc86cffb8c6aeab92c4ff776e7951b28", + "sha256:554fec1199d93ab30adaa751db68acec2b41c5602ac944bb19187cb9a41a8067", + "sha256:581a40c7b94921fffd6457ffe532259813fc68eb2bdda60fa8cc343414ce3733", + "sha256:5a26c0c795c3e0b63ec7da6efded5f0bc856d7c0b24b2ac84b4d1d7bc578d676", + "sha256:5a570cd9bd20b85d1a0d7b009aaf6c110b52b5755c17be6962f8ccd65d1dbd23", + "sha256:5aaeb00761f985007b38cf463b1d160a14a22c34eb3f6a39d9ad6fc27cb73008", + "sha256:5ac46d0c2dd5820ce93943a501ac5f6548ea81594777ca585bf002aa8854cacd", + "sha256:5c8a5c139aae4c35cbd7cadca1df02ea8cf28a911534fc1b0456acb0b14234f3", + "sha256:6b8af63b9afa1031c0ef05b217faa598f3069148eeee6bb24b79da9012423b82", + "sha256:769773614e676f9d8e8a0980dd7740f09a6ea386d0f383db6821df07d0f08545", + "sha256:771eb7587a0563ca5bb6f622b9ed7f9d07bd08900f7589b4febff05f469bea00", + "sha256:77af0f6447a582fdc7de5e06fa3757a3ef87769fbb0fdbdeba78c23049140a47", + "sha256:7a3d62b3b03b4b6fd41a085f3574874cf946cb4604d2b4d3e8dca8cd570ca501", + "sha256:821f7bcbaa84318287115d54becb1915eece6918136c6f91045bb84e2f88739d", + "sha256:89b1f4af0d4afe495cd4787a68e00f30f1d15939f550e869de90a86efa7e0814", + "sha256:8a1d96e780bdb2d0cbb297325711701f7c0b6f89199a57f2049e90064c29f6bd", + "sha256:8a40fcf208e021eb14b0fac6bdb045c0e0cab53105f93ba0d03fd934c956143a", + "sha256:8f99eb72bf27cbb167b636eb1726f590c00e1ad375002230607a844d9e9a2318", + "sha256:90e7fbc6216ecaffa5a880cdc9c77b7418c1dcb166166b78dbc630d07f278cc3", + "sha256:94ec0be97723ae72d63d3aa41961a0b9a6f5a53ff599813c324548d18e3b9e8c", + "sha256:95aa6ae391a22bbbce1b77ddac846c98c5473de0372ba5c463480043a07bff42", + "sha256:96121edfa4c2dfdda409877ea8608dd01de816a4dc4a0523356067b305e4e17a", + "sha256:a1f406a8e0995d654b2ad87c62caf6befa767885301f3b8f6f73e6f3c31ec3a6", + "sha256:a321c61477ff8ee705b8a5fed370b5710c56b3a52d17b983d9215861e37b642a", + "sha256:a5761c70c017c1b0d21b0815a920ffb94a670c8d5d409d9b38857874c21f70d7", + "sha256:a9abbccd778d98e9c7e85038e35e91e67f5b520776781d9a1e2ee9d400869487", + "sha256:ad80e6b4a0c3cb6f10f29ae4c60e991f424e6b14219d46f1e7d442b938ee68a4", + "sha256:b44674870709017e4b4036e3d0d6c17f06a0e6d4436422e0ad29b882c40697d2", + "sha256:b571bf5341ba8c6bc02e0baeaf3b061ab993bf372d982ae509807e7f112554e9", + "sha256:b8194fb8e50d556d5849753de991d390c5a1edeeba50f68e3a9253fbd8bf8ccd", + "sha256:b87eb6fc9e1bb8f98892a2458781348fa37e6925f35bb6ceb9d4afd54ba36c73", + "sha256:bbb5cc845a0292e0c520656d19d7ce40e18d0e19b22cb3e0409135a575bf79fc", + "sha256:be945402e03de47ba1872cd5236395e0f4ad635526185a930735f66710e1bd3f", + "sha256:bf13d564d310c156d1c8e53877baf2993fb3073b2fc9f69790ca6a732eb4bfea", + "sha256:cf60dd2696b457b710dd40bf17ad269d5f5457b96442f7f85722bdb16fa6c899", + "sha256:d1ba00ae33be84066cfbe7361d4e04dec78445b2b88bdb734d0d1cbab916025a", + "sha256:d39fc4817fd67b3915256af5dda75fd4ee10621a3d484524487e33416c6f3543", + "sha256:d766a4f0e5aa1ba056ec3496243150698dc0481902e2b8559314368717be82b1", + "sha256:dbf364b4c5e7bae9250528167dfe40219b62e2d573c854d74be213e1e52069f7", + "sha256:dd19608788b50eed889e13a5d71d832edc34fc9dfce606f66e8f9f917eef910d", + "sha256:e013b07ba1c748dacc2a80e69a46286ff145935f260eb8c72df7185bf048f502", + "sha256:e5d2b9be5b0693cf21eb4ce0ec8d211efb43966f6657807f6859aab3814f946b", + "sha256:e5ff52d790c7e1628241ffbcaeb33e07d14b007b6eb00a19320c7b8a7024c040", + "sha256:e75a2ad7b647fd8046d58c3132d7eaf31b12d8a53c0e4b21fa9c4d23d6ee6d3c", + "sha256:e7ac22a0bb2c7c49f441f7a6d46c9c80d96e56f5a8bc6972529ed43c8b694e27", + "sha256:ed2144b8a78f9d94d9515963ed273d620e07846acd5d4b0a642d4849e8d91a0c", + "sha256:f017a61399f13aa6d1039f75cd467be388d157cd81f1a119b9d9a68ba6f2830d", + "sha256:f1d8a2a57b47142b10374902777e798784abf400a004b14f1b0b9eaf1e528ba4", + "sha256:f2d32f95922927186c6dbc8bc60df0d186b6edb828d299ab10898ef3f40052fe", + "sha256:f319bae0321bc838e205bf9e5bc28f0a3165f30c203b610f17ab5552cff90323", + "sha256:f3c38e4e5ccbdc9198aecc766cedbb134b2d89bf64533973678dfcf07effd883", + "sha256:f9983d01d7705b2d1f7a95e10bbe4091fabc03a46881a256c2787637b087003f", + "sha256:fa260de59dfb143af06dcf30c2be0b200bed2a73737a8a59248fcb9fa601ef0f" ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4' and python_version < '4'", - "version": "==5.5" + "markers": "python_version >= '3.9'", + "version": "==7.8.0" }, "expects": { "hashes": [ @@ -95,34 +106,34 @@ }, "mamba": { "hashes": [ - "sha256:75cfc6dfd287dcccaf86dd753cf48e0a7337487c7c3fafda05a6a67ded6da496" + "sha256:4dcf69e9a53e78d4aa5ec3dee0bb2c65f02ea68a6b62c4275653d7170b8f5fe2" ], "index": "pypi", - "version": "==0.11.2" + "version": "==0.11.3" }, "path": { "hashes": [ - "sha256:2de925e8d421f93bcea80d511b81accfb6a7e6b249afa4a5559557b0cf817097", - "sha256:340054c5bb459fc9fd40e7eb6768c5989f3e599d18224238465b5333bc8faa7d" + "sha256:688e7ec254f07a1c25f5474662d4480c663a2c8c4eb15c0ba056d8ab81608d22", + "sha256:d41e05ed4fa1d4f6d702df3c1e0a1a255d7b544287432456455dc7c51e5f98e9" ], - "markers": "python_version >= '3.6'", - "version": "==16.2.0" + "markers": "python_version >= '3.9'", + "version": "==17.1.0" }, "path.py": { "hashes": [ "sha256:8d885e8b2497aed005703d94e0fd97943401f035e42a136810308bff034529a8", "sha256:a43e82eb2c344c3fd0b9d6352f6b856f40b8b7d3d65cc05978b42c3715668496" ], - "index": "pypi", + "markers": "python_version >= '3.5'", "version": "==12.5.0" }, "pexpect": { "hashes": [ - "sha256:0b48a55dcb3c05f3329815901ea4fc1537514d6ba867a152b581d69ae3710937", - "sha256:fc65a43959d153d0114afe13997d439c22823a27cefceb5ff35c2178c6784c0c" + "sha256:7236d1e080e4936be2dc3e326cec0af72acf9212a7e1d060210e70a47e253523", + "sha256:ee7d41123f3c9911050ea2c2dac107568dc43b2d3b0c7557a33212c398ead30f" ], "index": "pypi", - "version": "==4.8.0" + "version": "==4.9.0" }, "ptyprocess": { "hashes": [ diff --git a/builder/devenv-vncserver b/builder/devenv-vncserver index 1ec401f..34b446b 100755 --- a/builder/devenv-vncserver +++ b/builder/devenv-vncserver @@ -3,7 +3,7 @@ set -e default_os=ubuntu -default_os_codename=focal +default_os_codename=jammy cd "$(dirname "$0")/.." . ./builder/os_ver_cli.sh diff --git a/builder/dockerfile.ubuntu_focal.specs.test b/builder/dockerfile.ubuntu_jammy.specs.test similarity index 97% rename from builder/dockerfile.ubuntu_focal.specs.test rename to builder/dockerfile.ubuntu_jammy.specs.test index 414aebc..ed59899 100644 --- a/builder/dockerfile.ubuntu_focal.specs.test +++ b/builder/dockerfile.ubuntu_jammy.specs.test @@ -1,4 +1,4 @@ -FROM ubuntu:focal +FROM ubuntu:jammy ENV DEBIAN_FRONTEND=noninteractive diff --git a/builder/dockerfile.ubuntu_focal.vncserver_devenv.test b/builder/dockerfile.ubuntu_jammy.vncserver_devenv.test similarity index 99% rename from builder/dockerfile.ubuntu_focal.vncserver_devenv.test rename to builder/dockerfile.ubuntu_jammy.vncserver_devenv.test index 103a6f2..975a97c 100644 --- a/builder/dockerfile.ubuntu_focal.vncserver_devenv.test +++ b/builder/dockerfile.ubuntu_jammy.vncserver_devenv.test @@ -1,4 +1,4 @@ -FROM ubuntu:focal +FROM ubuntu:jammy ENV DEBIAN_FRONTEND=noninteractive ENV VNC_PORT 8443 diff --git a/builder/test-vncserver b/builder/test-vncserver index 3263943..14b4fc0 100755 --- a/builder/test-vncserver +++ b/builder/test-vncserver @@ -3,7 +3,7 @@ set -e default_os=ubuntu -default_os_codename=focal +default_os_codename=jammy . ./builder/os_ver_cli.sh From 209702638bed8cc2d90c73a65104facf451ea780 Mon Sep 17 00:00:00 2001 From: El Date: Sun, 25 May 2025 01:37:59 +0500 Subject: [PATCH 115/150] VNC-156 Add build script for libcpuid --- builder/scripts/build-cpuid | 26 ++++++++++++++++++++++++++ builder/scripts/build-deps.sh | 3 ++- 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100755 builder/scripts/build-cpuid diff --git a/builder/scripts/build-cpuid b/builder/scripts/build-cpuid new file mode 100755 index 0000000..cca8af3 --- /dev/null +++ b/builder/scripts/build-cpuid @@ -0,0 +1,26 @@ +#!/usr/bin/env bash + +set -euo pipefail + +build_and_install() { + cmake -S . -B build -DLIBCPUID_ENABLE_TESTS=OFF -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release -GNinja + ninja -C build install +} + +prepare_source() { + DIR=tbb + cd /tmp + [ -d ./${DIR} ] && rm -rf ./${DIR} + mkdir ${DIR} + + LIBCPUID_RELEASE=$(curl -sL "https://api.github.com/repos/anrieff/libcpuid/releases/latest" \ + | grep '"tag_name":' | sed -E 's/.*"tag_name": "([^"]+)".*/\1/') + + curl -Ls "https://github.com/anrieff/libcpuid/archive/${LIBCPUID_RELEASE}.tar.gz" | \ + + tar xzvf - -C ${DIR}/ --strip-components=1 + cd ${DIR} +} + +prepare_source +build_and_install diff --git a/builder/scripts/build-deps.sh b/builder/scripts/build-deps.sh index 9c1f205..5257861 100755 --- a/builder/scripts/build-deps.sh +++ b/builder/scripts/build-deps.sh @@ -5,4 +5,5 @@ set -e source_dir=$(dirname "$0") "${source_dir}"/build-libjpeg-turbo "${source_dir}"/build-webp -"${source_dir}"/build-tbb \ No newline at end of file +"${source_dir}"/build-tbb +"${source_dir}"/build-cpuid \ No newline at end of file From 0104fef44eb4535350b7e2c37a7c077a705a67c3 Mon Sep 17 00:00:00 2001 From: El Date: Sun, 25 May 2025 01:43:30 +0500 Subject: [PATCH 116/150] VNC-156 Integrate libcpuid for enhanced CPU feature detection --- common/rfb/CMakeLists.txt | 5 +++- common/rfb/cpuid.cxx | 33 +++++++++++++++++++-- common/rfb/cpuid.h | 62 ++++++++++++++++++++++++++++++++++++--- 3 files changed, 92 insertions(+), 8 deletions(-) diff --git a/common/rfb/CMakeLists.txt b/common/rfb/CMakeLists.txt index 434470b..27f123f 100644 --- a/common/rfb/CMakeLists.txt +++ b/common/rfb/CMakeLists.txt @@ -132,6 +132,8 @@ endif () find_package(PkgConfig REQUIRED) pkg_check_modules(FFMPEG REQUIRED libavcodec libavformat libavutil libswscale) +pkg_check_modules(CPUID REQUIRED libcpuid) + find_package(TBB) if (TBB_FOUND) set(RFB_LIBRARIES ${RFB_LIBRARIES} tbb) @@ -150,9 +152,10 @@ target_include_directories(rfb PRIVATE ${CMAKE_SOURCE_DIR}/third_party/tinyxml2 ${FFMPEG_INCLUDE_DIRS} ${TBB_INCLUDE_DIRS} + ${CPUID_INCLUDE_DIRS} ) -target_link_libraries(rfb PUBLIC ${RFB_LIBRARIES} tinyxml2_objs) +target_link_libraries(rfb PUBLIC ${RFB_LIBRARIES} tinyxml2_objs ${TBB_LIBRARIES} ${CPUID_LIBRARIES}) if (UNIX) libtool_create_control_file(rfb) diff --git a/common/rfb/cpuid.cxx b/common/rfb/cpuid.cxx index c89f950..7976589 100644 --- a/common/rfb/cpuid.cxx +++ b/common/rfb/cpuid.cxx @@ -16,10 +16,12 @@ * USA. */ -#include +#include "cpuid.h" +#include +#include "LogWriter.h" -static uint32_t cpuid[4] = { 0 }; -static uint32_t extcpuid[4] = { 0 }; +static uint32_t cpuid[4] = {}; +static uint32_t extcpuid[4] = {}; static void getcpuid() { if (cpuid[0]) @@ -68,3 +70,28 @@ bool supportsAVX512f() { } }; // namespace rfb + +namespace cpu_info { + static rfb::LogWriter log("CpuFeatures"); + inline CpuFeatures::CpuFeatures() + { + if (!cpuid_present()) + { + log.error("CPU does not support CPUID."); + return; + } + + cpu_raw_data_t raw{}; + + if (cpuid_get_raw_data(&raw) < 0) + { + log.error("Cannot get CPUID raw data."); + return; + } + + if (cpu_identify(&raw, &data) < 0) + { + log.error("Cannot identify CPU."); + } + } +} // namespace cpu_info diff --git a/common/rfb/cpuid.h b/common/rfb/cpuid.h index c84b4a2..3b31d5b 100644 --- a/common/rfb/cpuid.h +++ b/common/rfb/cpuid.h @@ -19,10 +19,64 @@ #ifndef __RFB_CPUID_H__ #define __RFB_CPUID_H__ -namespace rfb { +#include +#include - bool supportsSSE2(); - bool supportsAVX512f(); -}; +namespace cpu_info { + //using namespace cpu_features; + //static const X86Info info = GetX86Info(); + // static const X86Microarchitecture uarch = GetX86Microarchitecture(&info); + //static const bool has_fast_avx = info.features.avx && uarch != INTEL_SNB; + + bool supportsSSE2(); + bool supportsAVX512f(); + + class CpuFeatures { + cpu_id_t data{}; + CpuFeatures(); + + public: + CpuFeatures(const CpuFeatures &) = delete; + CpuFeatures &operator=(const CpuFeatures &) = delete; + CpuFeatures(CpuFeatures &&) = delete; + CpuFeatures &operator=(CpuFeatures &&) = delete; + + static CpuFeatures &get() + { + static CpuFeatures instance{}; + return instance; + } + + [[nodiscard]] bool has_sse2() const { return data.flags[CPU_FEATURE_SSE2]; } + + [[nodiscard]] bool has_sse4_1() const { return data.flags[CPU_FEATURE_SSE4_1]; } + + [[nodiscard]] bool has_sse4_2() const { return data.flags[CPU_FEATURE_SSE4_2]; } + + [[nodiscard]] bool has_sse4a() const { return data.flags[CPU_FEATURE_SSE4A]; } + + [[nodiscard]] bool has_avx() const { return data.flags[CPU_FEATURE_AVX]; } + + [[nodiscard]] bool has_avx2() const { return data.flags[CPU_FEATURE_AVX2]; } + + [[nodiscard]] bool has_avx512f() const { return data.flags[CPU_FEATURE_AVX512F]; } + + [[nodiscard]] bool has_smt() const { return get_total_cpu_count() > get_cores_count(); } + + [[nodiscard]] uint16_t get_total_cpu_count() const { return std::max(1, data.total_logical_cpus); } + + [[nodiscard]] uint16_t get_cores_count() const { return std::max(1, data.num_cores); } + }; + + inline static const bool has_sse2 = CpuFeatures::get().has_sse2(); + inline static const bool has_sse4_1 = CpuFeatures::get().has_sse4_1(); + inline static const bool has_sse4_2 = CpuFeatures::get().has_sse4_2(); + inline static const bool has_sse4a = CpuFeatures::get().has_sse4a(); + inline static const bool has_avx = CpuFeatures::get().has_avx(); + inline static const bool has_avx2 = CpuFeatures::get().has_avx2(); + inline static const bool has_avx512f = CpuFeatures::get().has_avx512f(); + inline static const uint16_t cores_count = CpuFeatures::get().get_cores_count(); + inline static const uint16_t total_cpu_count = CpuFeatures::get().get_total_cpu_count(); +}; // namespace cpu_info #endif From 7bf7998026f0ea9dd76980a82119c4a1184cb9f5 Mon Sep 17 00:00:00 2001 From: El Date: Sun, 25 May 2025 01:44:07 +0500 Subject: [PATCH 117/150] VNC-156 Refactor CPU capability logging and improve SSE detection --- common/rfb/VNCServerST.cxx | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/common/rfb/VNCServerST.cxx b/common/rfb/VNCServerST.cxx index 94979a9..b29997d 100644 --- a/common/rfb/VNCServerST.cxx +++ b/common/rfb/VNCServerST.cxx @@ -141,11 +141,17 @@ VNCServerST::VNCServerST(const char* name_, SDesktop* desktop_) frameTimer(this), apimessager(nullptr), trackingFrameStats(0), clipboardId(0), sendWatermark(false) { - lastUserInputTime = lastDisconnectTime = time(0); - slog.debug("creating single-threaded server %s", name.buf); - slog.info("CPU capability: SSE2 %s, AVX512f %s", - supportsSSE2() ? "yes" : "no", - supportsAVX512f() ? "yes" : "no"); + auto to_string = [](const bool value) { + return value ? "yes" : "no"; + }; + + lastUserInputTime = lastDisconnectTime = time(nullptr); + slog.debug("creating single-threaded server %s", name.buf); + slog.info("CPU capability: SSE2 %s, SSE4.1 %s, SSE4.2 %s, AVX512f %s", + to_string(cpu_info::has_sse2), + to_string(cpu_info::has_sse4_1), + to_string(cpu_info::has_sse4_2), + to_string(cpu_info::has_avx512f)); DLPRegion.enabled = DLPRegion.percents = false; From cfb4774ade9a953a3bd836179aff7c67b44f36db Mon Sep 17 00:00:00 2001 From: El Date: Sun, 25 May 2025 01:46:24 +0500 Subject: [PATCH 118/150] VNC-156 Fix cpu core count detection for better cpu utilization --- common/rfb/EncodeManager.cxx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/common/rfb/EncodeManager.cxx b/common/rfb/EncodeManager.cxx index 7182afc..87c53f5 100644 --- a/common/rfb/EncodeManager.cxx +++ b/common/rfb/EncodeManager.cxx @@ -20,7 +20,6 @@ */ #include - #include #include #include @@ -212,7 +211,7 @@ EncodeManager::EncodeManager(SConnection* conn_, EncCache *encCache_) : conn(con dynamicQualityOff = Server::dynamicQualityMax - Server::dynamicQualityMin; } - const auto num_cores = tbb::this_task_arena::max_concurrency() / 2; + const auto num_cores = cpu_info::cores_count; arena.initialize(num_cores); } From 9126507d991ca3f629cd45dcfdeea8332f7d33e9 Mon Sep 17 00:00:00 2001 From: El Date: Sun, 25 May 2025 01:47:58 +0500 Subject: [PATCH 119/150] VNC-156 Make use of cached cpu features detection for performance improvement --- common/rfb/EncodeManager.cxx | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/common/rfb/EncodeManager.cxx b/common/rfb/EncodeManager.cxx index 87c53f5..2bb21f6 100644 --- a/common/rfb/EncodeManager.cxx +++ b/common/rfb/EncodeManager.cxx @@ -1016,7 +1016,7 @@ PixelBuffer *rfb::progressiveBilinearScale(const PixelBuffer *pb, const uint16_t tgtw, const uint16_t tgth, const float tgtdiff) { - if (supportsSSE2()) { + if (cpu_info::has_sse2) { if (tgtdiff >= 0.5f) { ManagedPixelBuffer *newpb = new ManagedPixelBuffer(pb->getPF(), tgtw, tgth); @@ -1174,9 +1174,6 @@ void EncodeManager::writeRects(const Region& changed, const PixelBuffer* pb, const size_t subrects_size = subrects.size(); - std::vector indices(subrects_size); - std::iota(std::begin(indices), std::end(indices), 0); - encoderTypes.resize(subrects_size); isWebp.resize(subrects_size); fromCache.resize(subrects_size); From fd7d0d4b4ce82a7071eee3667a21f1e7795b55f6 Mon Sep 17 00:00:00 2001 From: El Date: Sun, 25 May 2025 15:48:59 +0500 Subject: [PATCH 120/150] VNC-156 Enable position-independent code in build script --- builder/scripts/build-cpuid | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builder/scripts/build-cpuid b/builder/scripts/build-cpuid index cca8af3..0996cb5 100755 --- a/builder/scripts/build-cpuid +++ b/builder/scripts/build-cpuid @@ -3,7 +3,7 @@ set -euo pipefail build_and_install() { - cmake -S . -B build -DLIBCPUID_ENABLE_TESTS=OFF -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release -GNinja + cmake -S . -B build -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DLIBCPUID_ENABLE_TESTS=OFF -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release -GNinja ninja -C build install } From 441824a704c2ae4f41c6a2a716d5b63494b7dc8a Mon Sep 17 00:00:00 2001 From: El Date: Sun, 25 May 2025 18:02:41 +0500 Subject: [PATCH 121/150] VNC-156 Set PKG_CONFIG_PATH to ensure proper discovery of pkg-config files during builds --- builder/dockerfile.oracle_8.build | 2 ++ 1 file changed, 2 insertions(+) diff --git a/builder/dockerfile.oracle_8.build b/builder/dockerfile.oracle_8.build index 9fc54da..4a2a13a 100644 --- a/builder/dockerfile.oracle_8.build +++ b/builder/dockerfile.oracle_8.build @@ -55,6 +55,8 @@ RUN dnf install -y \ libSM-devel ENV SCRIPTS_DIR=/tmp/scripts +ENV PKG_CONFIG_PATH=/usr/local/lib64/pkgconfig:${PKG_CONFIG_PATH:-/opt/rh/gcc-toolset-14/root/usr/lib64/pkgconfig} + COPY builder/scripts $SCRIPTS_DIR RUN echo "source /opt/rh/gcc-toolset-14/enable" > /etc/profile.d/gcc-toolset.sh && \ $SCRIPTS_DIR/build-deps.sh && \ From b56fa5adbfed579fa143c8b589b25e38ab81bc61 Mon Sep 17 00:00:00 2001 From: Dmitry Maksyoma Date: Sat, 31 May 2025 16:29:06 +1200 Subject: [PATCH 122/150] VNC-178 Add kasmvnc-functional-tests as a submodule Branch release/1.0.0 --- .ci/helpers.sh | 2 -- .gitlab-ci.yml | 3 ++- .gitmodules | 3 +++ kasmvnc-functional-tests | 1 + 4 files changed, 6 insertions(+), 3 deletions(-) create mode 160000 kasmvnc-functional-tests diff --git a/.ci/helpers.sh b/.ci/helpers.sh index 0279d67..c00484f 100644 --- a/.ci/helpers.sh +++ b/.ci/helpers.sh @@ -77,9 +77,7 @@ upload_directory_to_s3() { } prepare_functional_tests_source_and_cd_into_it() { - git clone https://gitlab-ci-token:$CI_JOB_TOKEN@gitlab.com/kasm-technologies/internal/kasmvnc-functional-tests.git cd kasmvnc-functional-tests - git checkout release/1.0.0 mkdir output && chown 1000:1000 output mkdir report && chown 1000:1000 report } diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a839c2c..dd01984 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,7 +5,8 @@ services: variables: KASMVNC_COMMIT_ID: $CI_COMMIT_SHA GITLAB_SHARED_DIND_DIR: /builds/$CI_PROJECT_PATH/shared - GIT_SUBMODULE_STRATEGY: normal + GIT_SUBMODULE_STRATEGY: recursive + GIT_SUBMODULE_FORCE_HTTPS: "true" GIT_FETCH_EXTRA_FLAGS: --tags --force # For example, BUILD_DISTROS_REGEX: "jammy|focal". # "BUILD_DISTROS_REGEX: none" won't build any distros, nor www. diff --git a/.gitmodules b/.gitmodules index 74a470e..cad5101 100644 --- a/.gitmodules +++ b/.gitmodules @@ -2,3 +2,6 @@ path = kasmweb url = https://github.com/kasmtech/noVNC.git branch = release/1.2.3 +[submodule "kasmvnc-functional-tests"] + path = kasmvnc-functional-tests + url = git@gitlab.com:kasm-technologies/internal/kasmvnc-functional-tests.git diff --git a/kasmvnc-functional-tests b/kasmvnc-functional-tests new file mode 160000 index 0000000..0e736d8 --- /dev/null +++ b/kasmvnc-functional-tests @@ -0,0 +1 @@ +Subproject commit 0e736d83c94305c0eb85733031d12286246da138 From f4fc04f196fe4f476d1922b8e1238825efde0c44 Mon Sep 17 00:00:00 2001 From: Dmitry Maksyoma Date: Tue, 3 Jun 2025 15:52:51 +1200 Subject: [PATCH 123/150] VNC-179 Build packages for Debian Trixie --- .gitlab-ci.yml | 8 +-- ...ockerfile.debian_trixie.barebones.deb.test | 1 + builder/dockerfile.debian_trixie.build | 38 +++++++++++++ builder/dockerfile.debian_trixie.deb.build | 19 +++++++ builder/dockerfile.debian_trixie.deb.test | 57 +++++++++++++++++++ 5 files changed, 119 insertions(+), 4 deletions(-) create mode 120000 builder/dockerfile.debian_trixie.barebones.deb.test create mode 100644 builder/dockerfile.debian_trixie.build create mode 100644 builder/dockerfile.debian_trixie.deb.build create mode 100644 builder/dockerfile.debian_trixie.deb.test diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index dd01984..7c1b49c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -113,7 +113,7 @@ build_amd64: - output/ parallel: matrix: - - DISTRO: [ 'ubuntu focal', 'ubuntu jammy', 'ubuntu noble', 'debian bullseye', 'debian bookworm', 'kali kali-rolling', 'oracle 8', 'oracle 9', 'opensuse 15', 'fedora forty', 'fedora fortyone', 'alpine 318', 'alpine 319', 'alpine 320', 'alpine 321' ] + - DISTRO: [ 'ubuntu focal', 'ubuntu jammy', 'ubuntu noble', 'debian bullseye', 'debian bookworm', 'debian trixie', 'kali kali-rolling', 'oracle 8', 'oracle 9', 'opensuse 15', 'fedora forty', 'fedora fortyone', 'alpine 318', 'alpine 319', 'alpine 320', 'alpine 321' ] build_arm64: stage: build @@ -135,7 +135,7 @@ build_arm64: - output/ parallel: matrix: - - DISTRO: [ 'ubuntu focal', 'ubuntu jammy', 'ubuntu noble', 'debian bullseye', 'debian bookworm', 'kali kali-rolling', 'oracle 8', 'oracle 9', 'opensuse 15', 'fedora forty', 'fedora fortyone', 'alpine 318', 'alpine 319', 'alpine 320', 'alpine 321' ] + - DISTRO: [ 'ubuntu focal', 'ubuntu jammy', 'ubuntu noble', 'debian bullseye', 'debian bookworm', 'debian trixie', 'kali kali-rolling', 'oracle 8', 'oracle 9', 'opensuse 15', 'fedora forty', 'fedora fortyone', 'alpine 318', 'alpine 319', 'alpine 320', 'alpine 321' ] run_test_amd64: stage: run_test @@ -160,7 +160,7 @@ run_test_amd64: - run_test/*.xml parallel: matrix: - - DISTRO: [ 'ubuntu focal', 'ubuntu jammy', 'ubuntu noble', 'debian bullseye', 'debian bookworm', 'kali kali-rolling', 'oracle 8', 'oracle 9', 'opensuse 15', 'fedora forty', 'fedora fortyone', 'alpine 318', 'alpine 319', 'alpine 320', 'alpine 321' ] + - DISTRO: [ 'ubuntu focal', 'ubuntu jammy', 'ubuntu noble', 'debian bullseye', 'debian bookworm', 'debian trixie', 'kali kali-rolling', 'oracle 8', 'oracle 9', 'opensuse 15', 'fedora forty', 'fedora fortyone', 'alpine 318', 'alpine 319', 'alpine 320', 'alpine 321' ] run_test_arm64: stage: run_test @@ -185,7 +185,7 @@ run_test_arm64: - run_test/*.xml parallel: matrix: - - DISTRO: [ 'ubuntu focal', 'ubuntu jammy', 'ubuntu noble', 'debian bullseye', 'debian bookworm', 'kali kali-rolling', 'oracle 8', 'oracle 9', 'opensuse 15', 'fedora forty', 'fedora fortyone', 'alpine 318', 'alpine 319', 'alpine 320', 'alpine 321' ] + - DISTRO: [ 'ubuntu focal', 'ubuntu jammy', 'ubuntu noble', 'debian bullseye', 'debian bookworm', 'debian trixie', 'kali kali-rolling', 'oracle 8', 'oracle 9', 'opensuse 15', 'fedora forty', 'fedora fortyone', 'alpine 318', 'alpine 319', 'alpine 320', 'alpine 321' ] spec_test: stage: test diff --git a/builder/dockerfile.debian_trixie.barebones.deb.test b/builder/dockerfile.debian_trixie.barebones.deb.test new file mode 120000 index 0000000..9ec488c --- /dev/null +++ b/builder/dockerfile.debian_trixie.barebones.deb.test @@ -0,0 +1 @@ +dockerfile.debian.barebones.deb.test \ No newline at end of file diff --git a/builder/dockerfile.debian_trixie.build b/builder/dockerfile.debian_trixie.build new file mode 100644 index 0000000..0236c10 --- /dev/null +++ b/builder/dockerfile.debian_trixie.build @@ -0,0 +1,38 @@ +FROM debian:trixie-slim + +ENV KASMVNC_BUILD_OS debian +ENV KASMVNC_BUILD_OS_CODENAME trixie +ENV XORG_VER 21.1.7 +ENV DEBIAN_FRONTEND noninteractive + +RUN \ + echo "**** add all sources ****" && \ + echo "deb http://deb.debian.org/debian trixie main contrib non-free non-free-firmware" > /etc/apt/sources.list && \ + echo "deb-src http://deb.debian.org/debian trixie main contrib non-free non-free-firmware" >> /etc/apt/sources.list && \ + echo "deb http://deb.debian.org/debian trixie-updates main contrib non-free non-free-firmware" >> /etc/apt/sources.list && \ + echo "deb-src http://deb.debian.org/debian trixie-updates main contrib non-free non-free-firmware" >> /etc/apt/sources.list && \ + echo "deb http://deb.debian.org/debian trixie-backports main contrib non-free non-free-firmware" >> /etc/apt/sources.list && \ + echo "deb-src http://deb.debian.org/debian trixie-backports main contrib non-free non-free-firmware" >> /etc/apt/sources.list && \ + echo "deb http://security.debian.org/debian-security/ trixie-security main contrib non-free non-free-firmware" >> /etc/apt/sources.list && \ + echo "deb-src http://security.debian.org/debian-security/ trixie-security main contrib non-free non-free-firmware" >> /etc/apt/sources.list && \ + rm -f /etc/apt/sources.list.d/debian.sources + +RUN apt-get update && \ + apt-get -y install sudo + +RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends tzdata +RUN apt-get update && apt-get -y build-dep xorg-server libxfont-dev +RUN apt-get update && apt-get -y install ninja-build cmake nasm git libgnutls28-dev vim wget tightvncserver curl +RUN apt-get update && apt-get -y install libpng-dev libtiff-dev libgif-dev libavcodec-dev libssl-dev libxrandr-dev \ + libxcursor-dev libavformat-dev libswscale-dev + +ENV SCRIPTS_DIR=/tmp/scripts +COPY builder/scripts $SCRIPTS_DIR +RUN $SCRIPTS_DIR/build-deps.sh + +RUN useradd -m docker && echo "docker:docker" | chpasswd && adduser docker sudo + +COPY --chown=docker:docker . /src/ + +USER docker +ENTRYPOINT ["/src/builder/build.sh"] diff --git a/builder/dockerfile.debian_trixie.deb.build b/builder/dockerfile.debian_trixie.deb.build new file mode 100644 index 0000000..913614e --- /dev/null +++ b/builder/dockerfile.debian_trixie.deb.build @@ -0,0 +1,19 @@ +FROM debian:trixie-slim + +ENV DEBIAN_FRONTEND noninteractive + +RUN apt-get update && \ + apt-get -y install vim build-essential devscripts equivs + +# Install build-deps for the package. +COPY ./debian/control /tmp +RUN apt-get update && echo YYY | mk-build-deps --install --remove /tmp/control + +ARG L_UID +RUN if [ "$L_UID" -eq 0 ]; then \ + useradd -m docker; \ + else \ + useradd -m docker -u $L_UID;\ + fi + +USER docker diff --git a/builder/dockerfile.debian_trixie.deb.test b/builder/dockerfile.debian_trixie.deb.test new file mode 100644 index 0000000..76b05cf --- /dev/null +++ b/builder/dockerfile.debian_trixie.deb.test @@ -0,0 +1,57 @@ +FROM debian:trixie-slim + +ENV DISPLAY=:1 \ + VNC_PORT=8443 \ + VNC_RESOLUTION=1280x720 \ + MAX_FRAME_RATE=24 \ + VNCOPTIONS="-PreferBandwidth -DynamicQualityMin=4 -DynamicQualityMax=7" \ + HOME=/home/user \ + TERM=xterm \ + STARTUPDIR=/dockerstartup \ + INST_SCRIPTS=/dockerstartup/install \ + KASM_RX_HOME=/dockerstartup/kasmrx \ + DEBIAN_FRONTEND=noninteractive \ + VNC_COL_DEPTH=24 \ + VNC_RESOLUTION=1280x1024 \ + VNC_PW=vncpassword \ + VNC_USER=user \ + VNC_VIEW_ONLY_PW=vncviewonlypassword \ + LD_LIBRARY_PATH=/usr/local/lib/ \ + OMP_WAIT_POLICY=PASSIVE \ + SHELL=/bin/bash \ + SINGLE_APPLICATION=0 \ + KASMVNC_BUILD_OS=debian \ + KASMVNC_BUILD_OS_CODENAME=buster + +EXPOSE $VNC_PORT + +WORKDIR $HOME + +### REQUIRED STUFF ### + +RUN apt-get update && apt-get install -y supervisor xfce4 xfce4-terminal dbus-x11 xterm libnss-wrapper gettext wget +RUN apt-get purge -y pm-utils xscreensaver* +RUN apt-get update && apt-get install -y vim less +RUN apt-get update && apt-get -y install lsb-release + +RUN echo 'source $STARTUPDIR/generate_container_user' >> $HOME/.bashrc + +RUN mkdir -p $STARTUPDIR +COPY builder/startup/ $STARTUPDIR + +### START CUSTOM STUFF #### + +COPY ./builder/scripts/ /tmp/scripts/ +COPY ./debian/changelog /tmp + +ARG KASMVNC_PACKAGE_DIR +COPY $KASMVNC_PACKAGE_DIR/kasmvncserver_*.deb /tmp/ +RUN /tmp/scripts/install_kasmvncserver_package + +### END CUSTOM STUFF ### + +RUN chown -R 1000:0 $HOME +USER 1000:ssl-cert +WORKDIR $HOME + +ENTRYPOINT [ "/dockerstartup/vnc_startup.sh" ] From efea85ffcf4606d57faa4f2c88c1f4be2f901306 Mon Sep 17 00:00:00 2001 From: Dmitry Maksyoma Date: Sun, 8 Jun 2025 09:01:51 +0000 Subject: [PATCH 124/150] Resolve VNC-146 "Feature/ use core image for testing" --- kasmvnc-functional-tests | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kasmvnc-functional-tests b/kasmvnc-functional-tests index 0e736d8..180c7d3 160000 --- a/kasmvnc-functional-tests +++ b/kasmvnc-functional-tests @@ -1 +1 @@ -Subproject commit 0e736d83c94305c0eb85733031d12286246da138 +Subproject commit 180c7d39baeac0860c2f8faa7a579a7ec38e62df From 475dd878cd0e42fc888134d1b0075072273fb393 Mon Sep 17 00:00:00 2001 From: Dmitry Maksyoma Date: Wed, 18 Jun 2025 15:17:59 +0000 Subject: [PATCH 125/150] VNC-143 Bump functional tests to include presets test --- kasmvnc-functional-tests | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kasmvnc-functional-tests b/kasmvnc-functional-tests index 180c7d3..82de5e6 160000 --- a/kasmvnc-functional-tests +++ b/kasmvnc-functional-tests @@ -1 +1 @@ -Subproject commit 180c7d39baeac0860c2f8faa7a579a7ec38e62df +Subproject commit 82de5e65c53f098ce411f6f5eda7dd0ebbcb10cb From 0a27403c18ead2da4552e9bf4e8b6fb0e9ac9daa Mon Sep 17 00:00:00 2001 From: matt Date: Sat, 19 Jul 2025 09:47:10 +0000 Subject: [PATCH 126/150] update novnc to tip of master --- kasmvnc-functional-tests | 2 +- kasmweb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/kasmvnc-functional-tests b/kasmvnc-functional-tests index 82de5e6..428abb3 160000 --- a/kasmvnc-functional-tests +++ b/kasmvnc-functional-tests @@ -1 +1 @@ -Subproject commit 82de5e65c53f098ce411f6f5eda7dd0ebbcb10cb +Subproject commit 428abb33ddda09efe17dcc33e2b3e9136205a4fe diff --git a/kasmweb b/kasmweb index 0d8a3c5..5c46b2e 160000 --- a/kasmweb +++ b/kasmweb @@ -1 +1 @@ -Subproject commit 0d8a3c5f07defffe340dd67a1485be5214bec4ee +Subproject commit 5c46b2e13ab1dd7232b28f017fd7e49ca740f5a4 From 709b560f1ab611157d1ac938e49c58af8fe60fd0 Mon Sep 17 00:00:00 2001 From: Dmitry Maksyoma Date: Thu, 24 Jul 2025 07:50:41 +0000 Subject: [PATCH 127/150] VNC-222 Presets test failing without showing report in CI --- .ci/helpers.sh | 11 ++++++++--- .gitlab-ci.yml | 5 +++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/.ci/helpers.sh b/.ci/helpers.sh index c00484f..f63d01c 100644 --- a/.ci/helpers.sh +++ b/.ci/helpers.sh @@ -89,9 +89,14 @@ upload_report_to_s3() { } put_report_into_ci_pipeline() { - report_name="Functional%20test%20report" - report_url="https://${S3_BUCKET}.s3.amazonaws.com/${s3_tests_directory}/report/index.html" - curl --request POST --header "PRIVATE-TOKEN:${GITLAB_API_TOKEN}" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/statuses/${CI_COMMIT_SHA}?state=success&name=${report_name}&target_url=${report_url}" + local functional_tests_exit_code="$1" + local report_name="Functional%20test%20report" + local report_url="https://${S3_BUCKET}.s3.amazonaws.com/${s3_tests_directory}/report/index.html" + local state="success" + if [ "$functional_tests_exit_code" -ne 0 ]; then + state="failed" + fi + curl --request POST --header "PRIVATE-TOKEN:${GITLAB_API_TOKEN}" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/statuses/${CI_COMMIT_SHA}?state=${state}&name=${report_name}&target_url=${report_url}" } prepare_kasmvnc_built_packages_to_replace_workspaces_image_packages() { diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7c1b49c..0482d62 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -59,9 +59,10 @@ functional_test: - . .ci/helpers.sh script: - prepare_to_run_functional_tests - - ./functional-test + - set +e; ./functional-test; exit_code=$?; set -e - upload_report_to_s3 - - put_report_into_ci_pipeline + - put_report_into_ci_pipeline "$exit_code" + - exit "$exit_code" dependencies: - build_amd64 artifacts: From 8f9d2ae623a69ae15084154e0fb2ed90608ff74a Mon Sep 17 00:00:00 2001 From: Rodwin Spruel Date: Wed, 30 Jul 2025 18:24:52 +0000 Subject: [PATCH 128/150] Resolve VNC-196 "Feature/shared session connect msg" --- .gitmodules | 2 +- common/network/GetAPI.h | 7 +++ common/network/GetAPIMessager.cxx | 21 ++++++++- common/network/TcpSocket.cxx | 13 ++++++ common/network/websocket.c | 23 +++++++++- common/network/websocket.h | 2 + common/rfb/SMsgWriter.cxx | 15 +++++++ common/rfb/SMsgWriter.h | 4 ++ common/rfb/VNCSConnectionST.cxx | 55 +++++++++++++++++++++--- common/rfb/VNCSConnectionST.h | 15 +++++++ common/rfb/VNCServerST.cxx | 71 +++++++++++++++++++++++++++++-- common/rfb/VNCServerST.h | 8 ++++ common/rfb/msgTypes.h | 3 ++ common/rfb/util.cxx | 53 +++++++++++++++++++++++ common/rfb/util.h | 17 ++++++++ kasmweb | 2 +- 16 files changed, 297 insertions(+), 14 deletions(-) diff --git a/.gitmodules b/.gitmodules index cad5101..d350a11 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,7 +1,7 @@ [submodule "kasmweb"] path = kasmweb url = https://github.com/kasmtech/noVNC.git - branch = release/1.2.3 + branch = feature/VNC-196-shared-session-connect-msg [submodule "kasmvnc-functional-tests"] path = kasmvnc-functional-tests url = git@gitlab.com:kasm-technologies/internal/kasmvnc-functional-tests.git diff --git a/common/network/GetAPI.h b/common/network/GetAPI.h index 5b6c7ed..5a6a335 100644 --- a/common/network/GetAPI.h +++ b/common/network/GetAPI.h @@ -28,6 +28,7 @@ #include #include #include +#include namespace network { @@ -49,6 +50,8 @@ namespace network { uint32_t ping); void mainUpdateUserInfo(const uint8_t ownerConn, const uint8_t numUsers); + void mainUpdateSessionsInfo(std::string newSessionsInfo); + // from network threads uint8_t *netGetScreenshot(uint16_t w, uint16_t h, const uint8_t q, const bool dedup, @@ -61,6 +64,8 @@ namespace network { const bool read, const bool write, const bool owner); uint8_t netAddOrUpdateUser(const struct kasmpasswd_entry_t *entry); void netGetUsers(const char **ptr); + + const std::string_view netGetSessions(); void netGetBottleneckStats(char *buf, uint32_t len); void netGetFrameStats(char *buf, uint32_t len); void netResetFrameStatsCall(); @@ -142,6 +147,8 @@ namespace network { uint8_t ownerConnected; uint8_t activeUsers; pthread_mutex_t userInfoMutex; + std::mutex sessionInfoMutex; + std::string sessionsInfo; }; } diff --git a/common/network/GetAPIMessager.cxx b/common/network/GetAPIMessager.cxx index dfc739e..b11c878 100644 --- a/common/network/GetAPIMessager.cxx +++ b/common/network/GetAPIMessager.cxx @@ -28,6 +28,8 @@ #include #include #include +#include +#include using namespace network; using namespace rfb; @@ -55,7 +57,8 @@ static const struct TightJPEGConfiguration conf[10] = { GetAPIMessager::GetAPIMessager(const char *passwdfile_): passwdfile(passwdfile_), screenW(0), screenH(0), screenHash(0), cachedW(0), cachedH(0), cachedQ(0), - ownerConnected(0), activeUsers(0) { + ownerConnected(0), activeUsers(0), + sessionsInfo( "{\"users\":[]}"){ pthread_mutex_init(&screenMutex, NULL); pthread_mutex_init(&userMutex, NULL); @@ -171,6 +174,15 @@ void GetAPIMessager::mainUpdateUserInfo(const uint8_t ownerConn, const uint8_t n pthread_mutex_unlock(&userInfoMutex); } +void GetAPIMessager::mainUpdateSessionsInfo(std::string newSessionsInfo) +{ + std::unique_lock lock (sessionInfoMutex,std::defer_lock); + if (!lock.try_lock()) + return; + sessionsInfo = std::move(newSessionsInfo); + lock.unlock(); +} + // from network threads uint8_t *GetAPIMessager::netGetScreenshot(uint16_t w, uint16_t h, const uint8_t q, const bool dedup, @@ -514,6 +526,12 @@ void GetAPIMessager::netGetUsers(const char **outptr) { *outptr = buf; } + +const std::string_view GetAPIMessager::netGetSessions() +{ + return sessionsInfo; +} + void GetAPIMessager::netGetBottleneckStats(char *buf, uint32_t len) { /* { @@ -819,3 +837,4 @@ void GetAPIMessager::netClearClipboard() { pthread_mutex_unlock(&userMutex); } + diff --git a/common/network/TcpSocket.cxx b/common/network/TcpSocket.cxx index db13ec7..9663724 100644 --- a/common/network/TcpSocket.cxx +++ b/common/network/TcpSocket.cxx @@ -551,6 +551,18 @@ static void clearClipboardCb(void *messager) msgr->netClearClipboard(); } +static void getSessionsCb(void *messager, char **ptr) +{ + GetAPIMessager *msgr = (GetAPIMessager *) messager; + std::string_view sessionInfoView = msgr->netGetSessions(); + //Since this data is being returned to a c function using char array + //memmoery needs to be freeded by calling function + char *sessionInfo = (char *) calloc(sessionInfoView.size() + 1, sizeof(char)); + memcpy(sessionInfo, sessionInfoView.data(), sessionInfoView.size()); + sessionInfo[sessionInfoView.size()] = '\0'; + *ptr = sessionInfo; +} + #if OPENSSL_VERSION_NUMBER < 0x1010000f static pthread_mutex_t *sslmutex; @@ -700,6 +712,7 @@ WebsocketListener::WebsocketListener(const struct sockaddr *listenaddr, settings.serverFrameStatsReadyCb = serverFrameStatsReadyCb; settings.clearClipboardCb = clearClipboardCb; + settings.getSessionsCb = getSessionsCb; openssl_threads(); diff --git a/common/network/websocket.c b/common/network/websocket.c index fe3eb84..9140671 100644 --- a/common/network/websocket.c +++ b/common/network/websocket.c @@ -1511,7 +1511,8 @@ static uint8_t ownerapi(ws_ctx_t *ws_ctx, const char *in, const char * const use handler_msg("Sent bottleneck stats to API caller\n"); ret = 1; - } else entry("/api/get_users") { + } else entry("/api/get_users") + { const char *ptr; settings.getUsersCb(settings.messager, &ptr); @@ -1530,6 +1531,26 @@ static uint8_t ownerapi(ws_ctx_t *ws_ctx, const char *in, const char * const use handler_msg("Sent user list to API caller\n"); ret = 1; + } else entry("/api/get_sessions") { + + char *sessionData; + settings.getSessionsCb(settings.messager, &sessionData); + + sprintf(buf, "HTTP/1.1 200 OK\r\n" + "Server: KasmVNC/4.0\r\n" + "Connection: close\r\n" + "Content-type: text/plain\r\n" + "Content-length: %lu\r\n" + "%s" + "\r\n", strlen(sessionData), extra_headers ? extra_headers : ""); + ws_send(ws_ctx, buf, strlen(buf)); + ws_send(ws_ctx, sessionData, strlen(sessionData)); + weblog(200, wsthread_handler_id, 0, origip, ip, user, 1, origpath, strlen(buf) + strlen(sessionData)); + + free((char *) sessionData); + + handler_msg("Sent session list to API caller\n"); + ret = 1; } else entry("/api/get_frame_stats") { char statbuf[4096], decname[1024]; unsigned waitfor; diff --git a/common/network/websocket.h b/common/network/websocket.h index e9e8153..b193a17 100644 --- a/common/network/websocket.h +++ b/common/network/websocket.h @@ -108,6 +108,8 @@ typedef struct { uint8_t (*serverFrameStatsReadyCb)(void *messager); void (*clearClipboardCb)(void *messager); + + void (*getSessionsCb)(void *messager, char **buf); } settings_t; #ifdef __cplusplus diff --git a/common/rfb/SMsgWriter.cxx b/common/rfb/SMsgWriter.cxx index 11c59c7..eebb394 100644 --- a/common/rfb/SMsgWriter.cxx +++ b/common/rfb/SMsgWriter.cxx @@ -18,6 +18,7 @@ * USA. */ #include +#include #include #include #include @@ -776,3 +777,17 @@ void SMsgWriter::writeUnixRelay(const char *name, const rdr::U8 *buf, const unsi endMsg(); } + +void SMsgWriter::writeUserJoinedSession(const std::string& username) +{ + startMsg(msgTypeUserAddedToSession); + os->writeString(username.c_str()); + endMsg(); +} + +void SMsgWriter::writeUserLeftSession(const std::string& username) +{ + startMsg(msgTypeUserRemovedFromSession); + os->writeString(username.c_str()); + endMsg(); +} diff --git a/common/rfb/SMsgWriter.h b/common/rfb/SMsgWriter.h index ba07c62..3a424bf 100644 --- a/common/rfb/SMsgWriter.h +++ b/common/rfb/SMsgWriter.h @@ -23,6 +23,7 @@ #ifndef __RFB_SMSGWRITER_H__ #define __RFB_SMSGWRITER_H__ +#include #include #include #include @@ -132,6 +133,9 @@ namespace rfb { void writeSubscribeUnixRelay(const bool success, const char *msg); void writeUnixRelay(const char *name, const rdr::U8 *buf, const unsigned len); + void writeUserJoinedSession(const std::string& username); + void writeUserLeftSession(const std::string& username); + protected: void startMsg(int type); void endMsg(); diff --git a/common/rfb/VNCSConnectionST.cxx b/common/rfb/VNCSConnectionST.cxx index 96b0077..cf3af0b 100644 --- a/common/rfb/VNCSConnectionST.cxx +++ b/common/rfb/VNCSConnectionST.cxx @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. */ - + #include #include @@ -66,7 +66,7 @@ VNCSConnectionST::VNCSConnectionST(VNCServerST* server_, network::Socket *s, needsPermCheck(false), pointerEventTime(0), clientHasCursor(false), accessRights(AccessDefault), startTime(time(0)), frameTracking(false), - udpFramesSinceFull(0), complainedAboutNoViewRights(false) + udpFramesSinceFull(0), complainedAboutNoViewRights(false), clientUsername("username_unavailable") { setStreams(&sock->inStream(), &sock->outStream()); peerEndpoint.buf = sock->getPeerEndpoint(); @@ -177,6 +177,19 @@ void VNCSConnectionST::close(const char* reason) if (authenticated()) { server->lastDisconnectTime = time(0); + + // First update the client state to CLOSING to ensure it's not included in user lists + setState(RFBSTATE_CLOSING); + + // Notify other clients about the user leaving + server->notifyUserAction(this, clientUsername, VNCServerST::Leave); + vlog.info("Notifying other clients that user '%s' left: %s", + clientUsername.c_str(), reason ? reason : "connection closed"); + + if (server->apimessager) + { + server->updateSessionUsersList(); + } } try { @@ -190,11 +203,12 @@ void VNCSConnectionST::close(const char* reason) vlog.error("Failed to flush remaining socket data on close: %s", e.str()); } - // Just shutdown the socket and mark our state as closing. Eventually the - // calling code will call VNCServerST's removeSocket() method causing us to - // be deleted. + // Just shutdown the socket and mark our state as closing if not already done. + // Eventually the calling code will call VNCServerST's removeSocket() method + // causing us to be deleted. sock->shutdown(); - setState(RFBSTATE_CLOSING); + if (state() != RFBSTATE_CLOSING) + setState(RFBSTATE_CLOSING); } @@ -631,6 +645,8 @@ void VNCSConnectionST::approveConnectionOrClose(bool accept, void VNCSConnectionST::authSuccess() { lastEventTime = time(0); + connectionTime = time(0); // Record when the user connected + vlog.info("User %s connected at %ld", clientUsername.c_str(), connectionTime); server->startDesktop(); @@ -649,11 +665,27 @@ void VNCSConnectionST::authSuccess() // - Mark the entire display as "dirty" updates.add_changed(server->pb->getRect()); - startTime = time(0); + startTime = time(nullptr); + + if (clientUsername.empty()) + { + setUsername(get_default_name(sock->getPeerAddress())); + } + vlog.info("Authentication successful for user: %s", clientUsername.c_str()); } void VNCSConnectionST::queryConnection(const char* userName) { + if (userName && strlen(userName) > 0) { + setUsername(userName); + vlog.info("Setting username for connection: %s", userName); + } else { + // Generate a default username based on connection info + setUsername(get_default_name(sock->getPeerAddress())); + + vlog.info("Generated username: %s", clientUsername.c_str()); + } + // - Authentication succeeded - clear from blacklist CharArray name; name.buf = sock->getPeerAddress(); server->blHosts->clearBlackmark(name.buf); @@ -708,6 +740,15 @@ void VNCSConnectionST::clientInit(bool shared) } } SConnection::clientInit(shared); + if (shared && authenticated()) { + server->notifyUserAction(this, clientUsername, VNCServerST::Join); + vlog.info("Notifying other clients that user '%s' joined the shared session", + clientUsername.c_str()); + } + + if (server->apimessager && authenticated()) { + server->updateSessionUsersList(); + } } void VNCSConnectionST::setPixelFormat(const PixelFormat& pf) diff --git a/common/rfb/VNCSConnectionST.h b/common/rfb/VNCSConnectionST.h index 9416b2d..6d8068c 100644 --- a/common/rfb/VNCSConnectionST.h +++ b/common/rfb/VNCSConnectionST.h @@ -219,6 +219,16 @@ namespace rfb { return server->sendWatermark; } + const std::string& getUsername() const { return clientUsername; } + void setUsername(const std::string& username) { + clientUsername = username.empty() ? "" : username; + } + + // Returns connection time + time_t getConnectionTime() const { return connectionTime; } + + // Returns access rights + AccessRights getAccessRights() const { return accessRights; } private: // SConnection callbacks @@ -226,6 +236,10 @@ namespace rfb { // none of these methods should call any of the above methods which may // delete the SConnectionST object. + // Connection timestamp when user was authenticated + time_t connectionTime; + + virtual void authSuccess(); virtual void queryConnection(const char* userName); virtual void clientInit(bool shared); @@ -348,6 +362,7 @@ namespace rfb { char unixRelaySubscriptions[MAX_UNIX_RELAYS][MAX_UNIX_RELAY_NAME_LEN]; bool complainedAboutNoViewRights; + std::string clientUsername; }; } #endif diff --git a/common/rfb/VNCServerST.cxx b/common/rfb/VNCServerST.cxx index b29997d..8ea70d7 100644 --- a/common/rfb/VNCServerST.cxx +++ b/common/rfb/VNCServerST.cxx @@ -65,6 +65,7 @@ #include #include #include +#include #include @@ -773,6 +774,27 @@ void VNCServerST::stopDesktop() } } +std::vector VNCServerST::getSessionUsers() { + std::vector users; + + for ( auto client : clients) { + if (!client->authenticated()) { + continue; + } + users.push_back(SessionInfo(client->getUsername(),client->getConnectionTime())); + } + return users; +} + +void VNCServerST::updateSessionUsersList() +{ + auto sessionUsers = getSessionUsers(); + if (!sessionUsers.empty()) { + std::string sessionUsersJson = formatUsersToJson(sessionUsers); + apimessager->mainUpdateSessionsInfo(sessionUsersJson); + } +} + int VNCServerST::authClientCount() { int count = 0; std::list::iterator ci; @@ -1158,9 +1180,6 @@ void VNCServerST::writeUpdate() } } -// checkUpdate() is called by clients to see if it is safe to read from -// the framebuffer at this time. - Region VNCServerST::getPendingRegion() { UpdateInfo ui; @@ -1232,6 +1251,15 @@ void VNCServerST::notifyScreenLayoutChange(VNCSConnectionST* requester) } } +bool VNCServerST::checkClientOwnerships() { + std::list::iterator i; + for (i = clients.begin(); i != clients.end(); i++) { + if ((*i)->is_owner()) + return true; + } + return false; +} + bool VNCServerST::getComparerState() { if (rfb::Server::compareFB == 0) @@ -1290,3 +1318,40 @@ void VNCServerST::sendUnixRelayData(const char name[], } } } + +void VNCServerST::notifyUserAction(const VNCSConnectionST* newConnection, std::string& username, const UserActionType actionType) +{ + if (username.empty()) { + username = "username_unavailable"; + } + + std::string actionTypeStr = actionType == Join ? "joined" : "left"; + int notificationsSent = 0; + + std::string msgNotification = "Sent user " + actionTypeStr + " notification to client"; + std::string errNotification = "Failed to send user " + actionTypeStr + " notification to client: "; + std::string logNotification = "User " + username + " " + actionTypeStr + " - sent notifications to "; + + for (auto client : clients ) { + // Don't notify the connection that just joined, and only notify authenticated connections + if (client != newConnection && client->authenticated() && + client->state() == SConnection::RFBSTATE_NORMAL) { + try { + if (actionType == Join) { + client->writer()->writeUserJoinedSession(username); + } + else { + client->writer()->writeUserLeftSession(username); + } + notificationsSent++; + + slog.debug(msgNotification.c_str()); + } catch (rdr::Exception& e) { + errNotification.append( e.str()); + slog.error(errNotification.c_str()); + } + } + } + logNotification.append( std::to_string(notificationsSent) + " clients"); + slog.info(logNotification.c_str()); +} diff --git a/common/rfb/VNCServerST.h b/common/rfb/VNCServerST.h index fee2517..2df210b 100644 --- a/common/rfb/VNCServerST.h +++ b/common/rfb/VNCServerST.h @@ -35,6 +35,7 @@ #include #include #include +#include namespace rfb { @@ -200,6 +201,9 @@ namespace rfb { void refreshClients(); void sendUnixRelayData(const char name[], const unsigned char *buf, const unsigned len); + enum UserActionType {Join, Leave}; + void notifyUserAction(const VNCSConnectionST* newConnection, std::string& user_name, const UserActionType action_type); + protected: friend class VNCSConnectionST; @@ -253,9 +257,13 @@ namespace rfb { Region getPendingRegion(); const RenderedCursor* getRenderedCursor(); + std::vector getSessionUsers(); + void updateSessionUsersList(); + void notifyScreenLayoutChange(VNCSConnectionST *requester); bool getComparerState(); + bool checkClientOwnerships(); void updateWatermark(); diff --git a/common/rfb/msgTypes.h b/common/rfb/msgTypes.h index 836e4d8..9098b33 100644 --- a/common/rfb/msgTypes.h +++ b/common/rfb/msgTypes.h @@ -37,6 +37,9 @@ namespace rfb { const int msgTypeUnixRelay = 183; const int msgTypeServerFence = 248; + const int msgTypeUserAddedToSession = 253; + const int msgTypeUserRemovedFromSession = 254; + // client to server diff --git a/common/rfb/util.cxx b/common/rfb/util.cxx index a0f5cac..5a21962 100644 --- a/common/rfb/util.cxx +++ b/common/rfb/util.cxx @@ -630,4 +630,57 @@ namespace rfb { sizeof(iecPrefixes)/sizeof(*iecPrefixes), precision); } + + std::string get_default_name(const std::string& str) { + std::string default_name =str; + //Remove IP and other network info since only username needed + auto atPos = default_name.find('@'); + if (atPos != std::string::npos) { + default_name.erase(atPos); + } + + if (default_name.empty()) { + default_name = "username_unavailable"; + } + else { + // Replace special characters + for (size_t i = 0; i < default_name.length(); i++) { + if (default_name[i] == '.' || default_name[i] == ':') { + default_name[i] = '_'; + } + } + } + + return default_name; + + } + std::string formatUsersToJson(const std::vector & users) + { + std::string usersList = "["; + bool firstUser = true; + for (const auto&[userName, connectionTime] : users) + { + std::string username =userName; + time_t connTime = connectionTime; + char timeStr[32]; + strftime(timeStr, sizeof(timeStr), "%Y-%m-%d %H:%M:%S", gmtime(&connTime)); + + if (!firstUser) { + usersList.append( ","); + } + firstUser = false; + + std::string userEntry = "{\"username\":\""; + userEntry.append(username); + userEntry.append( "\", \"connected_since\":\""); + userEntry.append(timeStr); + userEntry.append("\"}"); + + usersList.append(userEntry); + } + usersList += "]"; + usersList = "{\"users\": " + usersList + "} "; + return usersList; + } }; + diff --git a/common/rfb/util.h b/common/rfb/util.h index 18d38ac..9687da9 100644 --- a/common/rfb/util.h +++ b/common/rfb/util.h @@ -31,6 +31,8 @@ #include #include #include +#include +#include struct timeval; @@ -67,6 +69,17 @@ namespace rfb { CharArray& operator=(const CharArray&); }; + struct SessionInfo { + std::string userName; + time_t connectionTime; + SessionInfo(const std::string& name, const time_t& time) + { + userName = name; + connectionTime = time; + } + + }; + char* strDup(const char* s); void strFree(char* s); void strFree(wchar_t* s); @@ -145,6 +158,10 @@ namespace rfb { char *buffer, size_t maxlen, int precision=6); size_t iecPrefix(long long value, const char *unit, char *buffer, size_t maxlen, int precision=6); + + std::string get_default_name(const std::string& str); + std::string formatUsersToJson(const std::vector & users); + } // Some platforms (e.g. Windows) include max() and min() macros in their diff --git a/kasmweb b/kasmweb index 5c46b2e..df061dc 160000 --- a/kasmweb +++ b/kasmweb @@ -1 +1 @@ -Subproject commit 5c46b2e13ab1dd7232b28f017fd7e49ca740f5a4 +Subproject commit df061dc3d5c1f492108822cf569e7b42f087850a From 4d7d590cd678faaa42931709034ec58b1c7679f8 Mon Sep 17 00:00:00 2001 From: Rodwin Spruel Date: Thu, 31 Jul 2025 17:32:18 +0000 Subject: [PATCH 129/150] Resolve VNC-221 "Bug/ crash during screenshot" --- common/rfb/scale_sse2.cxx | 69 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 67 insertions(+), 2 deletions(-) diff --git a/common/rfb/scale_sse2.cxx b/common/rfb/scale_sse2.cxx index d4110a6..4118d43 100644 --- a/common/rfb/scale_sse2.cxx +++ b/common/rfb/scale_sse2.cxx @@ -125,10 +125,44 @@ void SSE2_scale(const uint8_t *oldpx, const __m128i high = _mm_set_epi32(0xffffffff, 0xffffffff, 0, 0); const float invdiff = 1 / tgtdiff; + // Calculate source dimensions from target dimensions and scaling factor + const uint16_t srcw = (uint16_t)(tgtw * invdiff); + const uint16_t srch = (uint16_t)(tgth * invdiff); + for (y = 0; y < tgth; y++) { const float ny = y * invdiff; const uint16_t lowy = ny; const uint16_t highy = lowy + 1; + + // Handle Y-coordinate boundary case with safe fallback + if (highy >= srch) { + // Safe fallback: Use only the last valid row (lowy) for interpolation + const uint16_t safe_lowy = (lowy < srch) ? lowy : srch - 1; + const uint32_t * const row0 = (uint32_t *) (oldpx + oldstride * safe_lowy * 4); + const uint8_t * const brow0 = (uint8_t *) row0; + + uint8_t * const dst = newpx + newstride * y * 4; + + // Process entire row with C fallback (no vertical interpolation needed) + for (x = 0; x < tgtw; x++) { + const float nx = x * invdiff; + const uint16_t lowx = nx; + const uint16_t highx = (lowx + 1 < srcw) ? lowx + 1 : lowx; + const uint16_t right = (nx - lowx) * 256; + const uint16_t left = 256 - right; + + uint8_t i; + for (i = 0; i < 4; i++) { + // Only horizontal interpolation since we're at bottom edge + uint32_t val = brow0[lowx * 4 + i] * left; + val += brow0[highx * 4 + i] * right; + dst[x * 4 + i] = val >> 8; + } + } + continue; // Skip to next row + } + + // Normal case: both lowy and highy are valid const uint16_t bot = (ny - lowy) * 256; const uint16_t top = 256 - bot; const uint32_t * const row0 = (uint32_t *) (oldpx + oldstride * lowy * 4); @@ -154,6 +188,35 @@ void SSE2_scale(const uint8_t *oldpx, (uint16_t) (lowx[0] + 1), (uint16_t) (lowx[1] + 1), }; + + // Critical bounds check for X coordinates + if (highx[0] >= srcw || highx[1] >= srcw) { + // Fall back to C implementation for boundary pixels + for (int i = 0; i < 2 && (x + i) < tgtw; i++) { + const float nx_safe = (x + i) * invdiff; + const uint16_t lowx_safe = nx_safe; + const uint16_t highx_safe = (lowx_safe + 1 < srcw) ? lowx_safe + 1 : lowx_safe; + const uint16_t right_safe = (nx_safe - lowx_safe) * 256; + const uint16_t left_safe = 256 - right_safe; + + uint8_t j; + uint32_t val, val2; + for (j = 0; j < 4; j++) { + val = brow0[lowx_safe * 4 + j] * left_safe; + val += brow0[highx_safe * 4 + j] * right_safe; + val >>= 8; + + val2 = brow1[lowx_safe * 4 + j] * left_safe; + val2 += brow1[highx_safe * 4 + j] * right_safe; + val2 >>= 8; + + dst[(x + i) * 4 + j] = (val * top + val2 * bot) >> 8; + } + } + x++; // Skip the second pixel since we processed both + continue; + } + const uint16_t right[2] = { (uint16_t) ((nx[0] - lowx[0]) * 256), (uint16_t) ((nx[1] - lowx[1]) * 256), @@ -185,6 +248,8 @@ void SSE2_scale(const uint8_t *oldpx, ); __m128i lo, hi, a, b, c, d; + + // Now safe to access these indices - bounds already checked lo = _mm_setr_epi32(row0[lowx[0]], row0[highx[0]], row0[lowx[1]], @@ -229,10 +294,10 @@ void SSE2_scale(const uint8_t *oldpx, } for (; x < tgtw; x++) { - // Remainder in C + // Remainder in C with bounds checking const float nx = x * invdiff; const uint16_t lowx = nx; - const uint16_t highx = lowx + 1; + const uint16_t highx = (lowx + 1 < srcw) ? lowx + 1 : lowx; const uint16_t right = (nx - lowx) * 256; const uint16_t left = 256 - right; From dcfdee6d0dc52bbf63c94c4e4fabc39d95df8523 Mon Sep 17 00:00:00 2001 From: matt Date: Thu, 31 Jul 2025 17:35:50 +0000 Subject: [PATCH 130/150] update novnc and function testing refs --- .gitmodules | 2 +- kasmvnc-functional-tests | 2 +- kasmweb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitmodules b/.gitmodules index d350a11..8232a78 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,7 +1,7 @@ [submodule "kasmweb"] path = kasmweb url = https://github.com/kasmtech/noVNC.git - branch = feature/VNC-196-shared-session-connect-msg + branch = master [submodule "kasmvnc-functional-tests"] path = kasmvnc-functional-tests url = git@gitlab.com:kasm-technologies/internal/kasmvnc-functional-tests.git diff --git a/kasmvnc-functional-tests b/kasmvnc-functional-tests index 428abb3..5bf0276 160000 --- a/kasmvnc-functional-tests +++ b/kasmvnc-functional-tests @@ -1 +1 @@ -Subproject commit 428abb33ddda09efe17dcc33e2b3e9136205a4fe +Subproject commit 5bf02768d56f7823b5d801beca67c6def2174ed8 diff --git a/kasmweb b/kasmweb index df061dc..699daf8 160000 --- a/kasmweb +++ b/kasmweb @@ -1 +1 @@ -Subproject commit df061dc3d5c1f492108822cf569e7b42f087850a +Subproject commit 699daf8a81d10b9acb6816626333e90277e3ab95 From 41966561801fbbe67751b235df06a016b287cced Mon Sep 17 00:00:00 2001 From: Dmitry Maksyoma Date: Sat, 2 Aug 2025 20:52:40 +1200 Subject: [PATCH 131/150] Bump functional tests to release/1.0.4 --- kasmvnc-functional-tests | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kasmvnc-functional-tests b/kasmvnc-functional-tests index 5bf0276..d7242d7 160000 --- a/kasmvnc-functional-tests +++ b/kasmvnc-functional-tests @@ -1 +1 @@ -Subproject commit 5bf02768d56f7823b5d801beca67c6def2174ed8 +Subproject commit d7242d738eab59865d4fdab7231f7a3c9c6de640 From 2312da3e7b7263a09baca56acdbde0270442ca17 Mon Sep 17 00:00:00 2001 From: Dmitry Maksyoma Date: Mon, 4 Aug 2025 09:38:39 +0000 Subject: [PATCH 132/150] Resolve VNC-226 Introduce $DEBUG variable in CI --- .ci/helpers.sh | 11 +++++++++++ .gitlab-ci.yml | 1 + 2 files changed, 12 insertions(+) diff --git a/.ci/helpers.sh b/.ci/helpers.sh index f63d01c..3d22720 100644 --- a/.ci/helpers.sh +++ b/.ci/helpers.sh @@ -108,6 +108,17 @@ prepare_to_run_functional_tests() { prepare_functional_tests_source_and_cd_into_it prepare_s3_uploader prepare_kasmvnc_built_packages_to_replace_workspaces_image_packages + heed_debug_variable_and_toggle_debug_in_functional_tests +} + +heed_debug_variable_and_toggle_debug_in_functional_tests() { + if [ -z "$CI" ]; then + return + fi + + if [ "$DEBUG" = "true" ]; then + export KASMVNC_FUNC_TESTS_DEBUG=1 + fi } install_packages_needed_for_functional_tests() { diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0482d62..37394df 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,6 +3,7 @@ services: - docker:dind variables: + DEBUG: true KASMVNC_COMMIT_ID: $CI_COMMIT_SHA GITLAB_SHARED_DIND_DIR: /builds/$CI_PROJECT_PATH/shared GIT_SUBMODULE_STRATEGY: recursive From c58e5ca504c2c5addcfcaf8234f55bbc7cf58bdf Mon Sep 17 00:00:00 2001 From: Dmitry Maksyoma Date: Mon, 4 Aug 2025 10:55:15 +0000 Subject: [PATCH 133/150] VNC-213 Add core dumps for Xvnc as CI artifacts --- .gitlab-ci.yml | 12 ++++++ builder/common.sh | 3 ++ builder/startup/vnc_startup_barebones.sh | 48 ++++++++++++++++++++++++ builder/test-apk-barebones | 11 +++++- builder/test-barebones | 9 ++++- builder/test-deb-barebones | 9 ++++- builder/test-rpm-barebones | 11 +++++- 7 files changed, 97 insertions(+), 6 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0482d62..b7e4c1a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -46,6 +46,9 @@ stages: - cp -r builder/build/* output/ - rm output/*.tar.gz +.enable_core_dumps: &enable_core_dumps + - echo core > /proc/sys/kernel/core_pattern + default: tags: - oci-fixed-amd @@ -145,6 +148,7 @@ run_test_amd64: - oci-fixed-amd before_script: - *prepare_build + - *enable_core_dumps - . .ci/helpers.sh script: - set -e @@ -156,6 +160,9 @@ run_test_amd64: dependencies: - build_amd64 artifacts: + when: always + paths: + - run_test/core_dumps/*/core reports: junit: - run_test/*.xml @@ -170,6 +177,7 @@ run_test_arm64: - oci-fixed-arm before_script: - *prepare_build + - *enable_core_dumps - . .ci/helpers.sh script: - set -e @@ -181,6 +189,10 @@ run_test_arm64: dependencies: - build_arm64 artifacts: + artifacts: + when: always + paths: + - run_test/core_dumps/*/core reports: junit: - run_test/*.xml diff --git a/builder/common.sh b/builder/common.sh index 83003dc..ae73b43 100644 --- a/builder/common.sh +++ b/builder/common.sh @@ -1,4 +1,7 @@ VNC_PORT=8443 +core_dumps_dir_inside_container="/core_dumps" +core_dumps_dir_on_host="run_test/core_dumps" +core_dumps_dir_volume_option="-v ${PWD}/${core_dumps_dir_on_host}:/${core_dumps_dir_inside_container}" detect_build_dir() { if [ -n "$CI" ]; then diff --git a/builder/startup/vnc_startup_barebones.sh b/builder/startup/vnc_startup_barebones.sh index 8306941..f49250a 100755 --- a/builder/startup/vnc_startup_barebones.sh +++ b/builder/startup/vnc_startup_barebones.sh @@ -12,14 +12,62 @@ create_kasm_user() { echo -e "$VNC_PW\n$VNC_PW\n" | kasmvncpasswd -w -u "$VNC_USER" } +wait_for_core_to_be_dumped() { + if [ "$vncserver_exit_code" -eq 0 ]; then + return + fi + + local timeout=2 + local elapsed=0 + local interval=1 + while [[ ! -f core && "$elapsed" -lt "$timeout" ]]; do + sleep $interval + elapsed=$(($elapsed + $interval)) + done +} + +copy_core_to_host() { + mkdir -p "$CORE_DUMP_DIR_INSIDE_CONTAINER" + cp core "$CORE_DUMP_DIR_INSIDE_CONTAINER" +} + +allow_core_to_be_dumped() { + ulimit -c unlimited + cd "$HOME" +} + +clean_up_old_core_dir() { + if [ -d "$CORE_DUMP_DIR_INSIDE_CONTAINER" ]; then + rm -r "$CORE_DUMP_DIR_INSIDE_CONTAINER" + fi +} + +core_was_dumped() { + [ -f core ] +} + +say_where_to_find_core_on_host() { + echo "Core dumped to $CORE_DUMP_DIR_ON_HOST" +} + config_dir="$HOME/.vnc" xstartup="$config_dir/xstartup" set_xterm_to_run create_kasm_user +allow_core_to_be_dumped +clean_up_old_core_dir +set +e vncserver -select-de manual -websocketPort "$VNC_PORT" vncserver_exit_code=$? +set -e + +wait_for_core_to_be_dumped +if core_was_dumped; then + copy_core_to_host + say_where_to_find_core_on_host +fi if [ "$RUN_TEST" = 1 ]; then exit "$vncserver_exit_code" fi diff --git a/builder/test-apk-barebones b/builder/test-apk-barebones index 945412c..0fe7093 100755 --- a/builder/test-apk-barebones +++ b/builder/test-apk-barebones @@ -11,20 +11,27 @@ cd "$(dirname "$0")/.." . ./builder/common.sh os="${1:-alpine}" os_codename="${2:-321}" +distro="${os}_${os_codename}" detect_build_dir detect_base_image -docker build --build-arg KASMVNC_PACKAGE_DIR="${build_dir}/${os}_${os_codename}" \ +docker build --build-arg KASMVNC_PACKAGE_DIR="${build_dir}/${distro}" \ --build-arg RUN_TEST="$run_test" \ --build-arg BASE_IMAGE="$BASE_IMAGE" \ -t kasmvnctester_barebones_${os}:$os_codename \ - -f builder/dockerfile.${os}_${os_codename}.barebones.apk.test . + -f builder/dockerfile.${distro}.barebones.apk.test . echo detect_interactive docker run $interactive -p "443:$VNC_PORT" --rm -e "VNC_USER=foo" -e "VNC_PW=foobar" \ + $core_dumps_dir_volume_option \ -e "VNC_PORT=$VNC_PORT" \ -e RUN_TEST="$run_test" \ + -e CORE_DUMP_DIR_ON_HOST="$core_dumps_dir_on_host/${distro}" \ + -e CORE_DUMP_DIR_INSIDE_CONTAINER="${core_dumps_dir_inside_container}/${distro}" \ + --cap-add=SYS_PTRACE \ + --cap-add=SYS_RESOURCE \ + --ulimit core=-1 \ $entrypoint_executable \ kasmvnctester_barebones_${os}:$os_codename \ $entrypoint_args diff --git a/builder/test-barebones b/builder/test-barebones index aee9055..35467f4 100755 --- a/builder/test-barebones +++ b/builder/test-barebones @@ -19,6 +19,13 @@ write_gitlab_report() { echo "$failure_report" > run_test/"${os}_${os_codename}.xml" } +create_core_dumps_dir_writeable_by_container() { + mkdir -p "$core_dumps_dir_on_host" + if [[ -n "$CI" && $(id -u) = 0 ]]; then + chown 1000:1000 "$core_dumps_dir_on_host" + fi +} + saved_options=("$@") . ./builder/process_test_options.sh . ./builder/common.sh @@ -33,7 +40,7 @@ if [ "$run_test" != 1 ]; then exit $? fi -mkdir -p run_test +create_core_dumps_dir_writeable_by_container if ! builder/test-${package_format}-barebones "${saved_options[@]}" 2>&1 | \ tee run_test/"${os_fullname}.log"; then create_gitlab_report "$(tail -1 run_test/${os_fullname}.log)" diff --git a/builder/test-deb-barebones b/builder/test-deb-barebones index 593ce5c..e40e3c0 100755 --- a/builder/test-deb-barebones +++ b/builder/test-deb-barebones @@ -15,6 +15,7 @@ cd "$(dirname "$0")/.." . ./builder/common.sh os="${1:-debian}" os_codename="${2:-buster}" +distro="${os}_${os_codename}" detect_build_dir detect_base_image @@ -22,13 +23,19 @@ docker build --build-arg KASMVNC_PACKAGE_DIR="${build_dir}/${os_codename}" \ --build-arg RUN_TEST="$run_test" \ --build-arg BASE_IMAGE="$BASE_IMAGE" \ -t kasmvnctester_barebones_${os}:$os_codename \ - -f builder/dockerfile.${os}_${os_codename}.barebones.deb.test . + -f builder/dockerfile.${distro}.barebones.deb.test . echo detect_interactive docker run $interactive -p "443:$VNC_PORT" --rm -e "VNC_USER=foo" -e "VNC_PW=foobar" \ + $core_dumps_dir_volume_option \ -e "VNC_PORT=$VNC_PORT" \ -e RUN_TEST="$run_test" \ + -e CORE_DUMP_DIR_ON_HOST="$core_dumps_dir_on_host/${distro}" \ + -e CORE_DUMP_DIR_INSIDE_CONTAINER="${core_dumps_dir_inside_container}/${distro}" \ + --cap-add=SYS_PTRACE \ + --cap-add=SYS_RESOURCE \ + --ulimit core=-1 \ $entrypoint_executable \ kasmvnctester_barebones_${os}:$os_codename \ $entrypoint_args diff --git a/builder/test-rpm-barebones b/builder/test-rpm-barebones index 1151222..56dbb36 100755 --- a/builder/test-rpm-barebones +++ b/builder/test-rpm-barebones @@ -7,17 +7,24 @@ cd "$(dirname "$0")/.." . ./builder/common.sh os="${1:-oracle}" os_codename="${2:-8}" +distro="${os}_${os_codename}" detect_build_dir -docker build --build-arg KASMVNC_PACKAGE_DIR="${build_dir}/${os}_${os_codename}" \ +docker build --build-arg KASMVNC_PACKAGE_DIR="${build_dir}/${distro}" \ --build-arg RUN_TEST="$run_test" \ -t kasmvnctester_barebones_${os}:$os_codename \ - -f builder/dockerfile.${os}_${os_codename}.barebones.rpm.test . + -f builder/dockerfile.${distro}.barebones.rpm.test . detect_interactive docker run $interactive -p "443:$VNC_PORT" --rm -e "VNC_USER=foo" -e "VNC_PW=foobar" \ + $core_dumps_dir_volume_option \ -e "VNC_PORT=$VNC_PORT" \ -e RUN_TEST="$run_test" \ + -e CORE_DUMP_DIR_ON_HOST="$core_dumps_dir_on_host/${distro}" \ + -e CORE_DUMP_DIR_INSIDE_CONTAINER="${core_dumps_dir_inside_container}/${distro}" \ + --cap-add=SYS_PTRACE \ + --cap-add=SYS_RESOURCE \ + --ulimit core=-1 \ $entrypoint_executable \ kasmvnctester_barebones_${os}:$os_codename \ $entrypoint_args From 8e912d531e581a155083500b685a6e6fc85c1cd1 Mon Sep 17 00:00:00 2001 From: Dmitry Maksyoma Date: Tue, 5 Aug 2025 14:39:32 +1200 Subject: [PATCH 134/150] VNC-239 Remove unused files in contrib/packages --- .../deb/ubuntu-precise/debian/changelog | 31 - .../packages/deb/ubuntu-precise/debian/compat | 1 - .../deb/ubuntu-precise/debian/control | 70 - .../deb/ubuntu-precise/debian/copyright | 116 - .../ubuntu-precise/debian/get-orig-source.sh | 38 - .../debian/local/vncserver.service | 94 - .../debian/local/vncserver.sysconfig | 19 - .../deb/ubuntu-precise/debian/patch_fltk.sh | 52 - .../debian/patches/100_rethrow_signals.patch | 26 - .../patches/516_tigervnc-xorg-manpages.patch | 10 - .../debian/patches/debian_libtool.patch | 52 - .../deb/ubuntu-precise/debian/patches/series | 8 - .../packages/deb/ubuntu-precise/debian/rules | 277 -- .../deb/ubuntu-precise/debian/source/format | 1 - .../debian/tigervncserver.postinst | 30 - .../debian/tigervncserver.prerm | 19 - .../debian/xtigervncviewer.menu | 5 - .../debian/xtigervncviewer.postinst | 18 - .../debian/xtigervncviewer.prerm | 11 - .../deb/ubuntu-trusty/debian/changelog | 31 - .../packages/deb/ubuntu-trusty/debian/compat | 1 - .../packages/deb/ubuntu-trusty/debian/control | 70 - .../deb/ubuntu-trusty/debian/copyright | 116 - .../ubuntu-trusty/debian/get-orig-source.sh | 38 - .../debian/local/vncserver.service | 94 - .../debian/local/vncserver.sysconfig | 19 - .../deb/ubuntu-trusty/debian/patch_fltk.sh | 52 - .../debian/patches/100_rethrow_signals.patch | 26 - .../patches/516_tigervnc-xorg-manpages.patch | 10 - .../debian/patches/debian_libtool.patch | 52 - .../deb/ubuntu-trusty/debian/patches/series | 8 - .../packages/deb/ubuntu-trusty/debian/rules | 284 -- .../deb/ubuntu-trusty/debian/source/format | 1 - .../debian/tigervncserver.postinst | 32 - .../ubuntu-trusty/debian/tigervncserver.prerm | 21 - .../ubuntu-trusty/debian/xtigervncviewer.menu | 5 - .../debian/xtigervncviewer.postinst | 18 - .../debian/xtigervncviewer.prerm | 11 - .../deb/ubuntu-xenial/debian/changelog | 38 - .../packages/deb/ubuntu-xenial/debian/compat | 1 - .../packages/deb/ubuntu-xenial/debian/control | 70 - .../deb/ubuntu-xenial/debian/copyright | 116 - .../debian/local/vncserver.service | 94 - .../debian/local/vncserver.sysconfig | 19 - .../packages/deb/ubuntu-xenial/debian/rules | 286 -- .../deb/ubuntu-xenial/debian/source/format | 1 - .../debian/tigervncserver.postinst | 32 - .../ubuntu-xenial/debian/tigervncserver.prerm | 21 - .../100_rethrow_signals.patch | 26 - .../516_tigervnc-xorg-manpages.patch | 10 - .../xorg-source-patches/debian_libtool.patch | 87 - .../xserver118-patch.patch | 22 - .../ubuntu-xenial/debian/xtigervncviewer.menu | 5 - .../debian/xtigervncviewer.postinst | 18 - .../debian/xtigervncviewer.prerm | 11 - .../rpm/el5/SOURCES/16_CVE-2014-mult.diff | 3387 ----------------- .../rpm/el5/SOURCES/17_CVE-regressions.diff | 26 - .../rpm/el5/SOURCES/CVE-2013-7439.diff | 80 - .../rpm/el5/SOURCES/CVE-2015-0255.diff | 240 -- .../rpm/el5/SOURCES/CVE-2015-1802.diff | 30 - .../rpm/el5/SOURCES/CVE-2015-1803.diff | 33 - .../rpm/el5/SOURCES/CVE-2015-1804.diff | 73 - .../packages/rpm/el5/SOURCES/FindX11.cmake | 511 --- .../el5/SOURCES/fltk-1.3.3-static-libs.patch | 29 - .../freetype-2.1.10-enable-ft2-bci.patch | 11 - .../SOURCES/freetype-2.2.1-enable-valid.patch | 20 - .../SOURCES/freetype-2.3.0-enable-spr.patch | 11 - .../freetype-2.3.11-CVE-2010-1797.patch | 101 - .../freetype-2.3.11-CVE-2010-2498.patch | 35 - .../freetype-2.3.11-CVE-2010-2499.patch | 39 - .../freetype-2.3.11-CVE-2010-2500.patch | 31 - .../freetype-2.3.11-CVE-2010-2519.patch | 23 - .../freetype-2.3.11-CVE-2010-2520.patch | 13 - .../freetype-2.3.11-CVE-2010-2527.patch | 154 - .../freetype-2.3.11-CVE-2010-2805.patch | 11 - .../freetype-2.3.11-CVE-2010-2806.patch | 41 - .../freetype-2.3.11-CVE-2010-2808.patch | 21 - .../freetype-2.3.11-CVE-2010-3311.patch | 37 - .../freetype-2.3.11-CVE-2010-3855.patch | 20 - .../freetype-2.3.11-CVE-2011-0226.patch | 108 - .../freetype-2.3.11-CVE-2011-3256.patch | 92 - .../freetype-2.3.11-CVE-2011-3439.patch | 76 - .../freetype-2.3.11-CVE-2012-1126.patch | 20 - .../freetype-2.3.11-CVE-2012-1127.patch | 43 - .../freetype-2.3.11-CVE-2012-1130.patch | 21 - .../freetype-2.3.11-CVE-2012-1131.patch | 40 - .../freetype-2.3.11-CVE-2012-1132.patch | 130 - .../freetype-2.3.11-CVE-2012-1134.patch | 26 - .../freetype-2.3.11-CVE-2012-1136.patch | 49 - .../freetype-2.3.11-CVE-2012-1137.patch | 11 - .../freetype-2.3.11-CVE-2012-1139.patch | 33 - .../freetype-2.3.11-CVE-2012-1140.patch | 53 - .../freetype-2.3.11-CVE-2012-1141.patch | 17 - .../freetype-2.3.11-CVE-2012-1142.patch | 27 - .../freetype-2.3.11-CVE-2012-1143.patch | 67 - .../freetype-2.3.11-CVE-2012-1144.patch | 22 - .../freetype-2.3.11-CVE-2012-5669.patch | 17 - ...freetype-2.3.11-array-initialization.patch | 12 - .../freetype-2.3.11-axis-name-overflow.patch | 20 - .../freetype-2.3.11-bdf-overflow.patch | 11 - .../SOURCES/freetype-2.3.11-more-demos.patch | 18 - .../rpm/el5/SOURCES/freetype-multilib.patch | 18 - .../rpm/el5/SOURCES/pthread-stubs.pc.in | 8 - .../rpm/el5/SOURCES/tigervnc-2b76d02.patch | 23 - .../SOURCES/tigervnc14-Add-dridir-param.patch | 103 - .../tigervnc14-Add-xkbcompdir-param.patch | 46 - .../tigervnc14-static-build-fixes.patch | 35 - .../rpm/el5/SOURCES/vncserver.service | 91 - .../rpm/el5/SOURCES/vncserver.sysconfig | 19 - contrib/packages/rpm/el5/SPECS/tigervnc.spec | 1427 ------- .../packages/rpm/el6/SOURCES/fetch_sources.sh | 9 - .../el6/SOURCES/fltk-1.3.x-clipboard.patch | 106 - .../el6/SOURCES/fltk-1.3.x-screen_num.patch | 131 - .../rpm/el6/SOURCES/fltk-1_v2.3.0-modal.patch | 75 - .../SOURCES/fltk-1_v2.3.x-clipboard-osx.patch | 44 - .../fltk-1_v2.3.x-clipboard-win32.patch | 99 - .../rpm/el6/SOURCES/fltk-1_v3.3.0-icons.patch | 645 ---- .../fltk-1_v3.3.x-clipboard-win32-fix.patch | 135 - .../el6/SOURCES/fltk-1_v3.3.x-multihead.patch | 468 --- .../fltk-1_v4.3.x-keyboard-win32.patch | 256 -- .../SOURCES/fltk-1_v4.3.x-keyboard-x11.patch | 286 -- .../SOURCES/fltk-1_v5.3.x-clipboard-x11.patch | 350 -- .../el6/SOURCES/fltk-1_v5.3.x-cursor.patch | 1623 -------- .../SOURCES/fltk-1_v6.3.x-clipboard-x11.patch | 355 -- .../SOURCES/fltk-1_v6.3.x-keyboard-osx.patch | 375 -- .../el6/SOURCES/nettle-2.7.1-ecc-cve.patch | 275 -- .../packages/rpm/el6/SOURCES/pixmap_v2.patch | 554 --- .../el6/SOURCES/tigervnc-xorg-manpages.patch | 10 - .../rpm/el6/SOURCES/vncserver.service | 154 - .../rpm/el6/SOURCES/vncserver.sysconfig | 19 - contrib/packages/rpm/el6/SPECS/tigervnc.spec | 844 ---- .../packages/rpm/el7/SOURCES/10-libvnc.conf | 19 - .../rpm/el7/SOURCES/tigervnc-shebang.patch | 9 - .../rpm/el7/SOURCES/vncserver.service | 45 - .../rpm/el7/SOURCES/vncserver.sysconfig | 1 - contrib/packages/rpm/el7/SPECS/tigervnc.spec | 830 ---- 136 files changed, 18001 deletions(-) delete mode 100644 contrib/packages/deb/ubuntu-precise/debian/changelog delete mode 100644 contrib/packages/deb/ubuntu-precise/debian/compat delete mode 100644 contrib/packages/deb/ubuntu-precise/debian/control delete mode 100644 contrib/packages/deb/ubuntu-precise/debian/copyright delete mode 100755 contrib/packages/deb/ubuntu-precise/debian/get-orig-source.sh delete mode 100644 contrib/packages/deb/ubuntu-precise/debian/local/vncserver.service delete mode 100644 contrib/packages/deb/ubuntu-precise/debian/local/vncserver.sysconfig delete mode 100755 contrib/packages/deb/ubuntu-precise/debian/patch_fltk.sh delete mode 100644 contrib/packages/deb/ubuntu-precise/debian/patches/100_rethrow_signals.patch delete mode 100644 contrib/packages/deb/ubuntu-precise/debian/patches/516_tigervnc-xorg-manpages.patch delete mode 100644 contrib/packages/deb/ubuntu-precise/debian/patches/debian_libtool.patch delete mode 100644 contrib/packages/deb/ubuntu-precise/debian/patches/series delete mode 100755 contrib/packages/deb/ubuntu-precise/debian/rules delete mode 100644 contrib/packages/deb/ubuntu-precise/debian/source/format delete mode 100644 contrib/packages/deb/ubuntu-precise/debian/tigervncserver.postinst delete mode 100644 contrib/packages/deb/ubuntu-precise/debian/tigervncserver.prerm delete mode 100644 contrib/packages/deb/ubuntu-precise/debian/xtigervncviewer.menu delete mode 100644 contrib/packages/deb/ubuntu-precise/debian/xtigervncviewer.postinst delete mode 100644 contrib/packages/deb/ubuntu-precise/debian/xtigervncviewer.prerm delete mode 100644 contrib/packages/deb/ubuntu-trusty/debian/changelog delete mode 100644 contrib/packages/deb/ubuntu-trusty/debian/compat delete mode 100644 contrib/packages/deb/ubuntu-trusty/debian/control delete mode 100644 contrib/packages/deb/ubuntu-trusty/debian/copyright delete mode 100755 contrib/packages/deb/ubuntu-trusty/debian/get-orig-source.sh delete mode 100644 contrib/packages/deb/ubuntu-trusty/debian/local/vncserver.service delete mode 100644 contrib/packages/deb/ubuntu-trusty/debian/local/vncserver.sysconfig delete mode 100755 contrib/packages/deb/ubuntu-trusty/debian/patch_fltk.sh delete mode 100644 contrib/packages/deb/ubuntu-trusty/debian/patches/100_rethrow_signals.patch delete mode 100644 contrib/packages/deb/ubuntu-trusty/debian/patches/516_tigervnc-xorg-manpages.patch delete mode 100644 contrib/packages/deb/ubuntu-trusty/debian/patches/debian_libtool.patch delete mode 100644 contrib/packages/deb/ubuntu-trusty/debian/patches/series delete mode 100755 contrib/packages/deb/ubuntu-trusty/debian/rules delete mode 100644 contrib/packages/deb/ubuntu-trusty/debian/source/format delete mode 100644 contrib/packages/deb/ubuntu-trusty/debian/tigervncserver.postinst delete mode 100644 contrib/packages/deb/ubuntu-trusty/debian/tigervncserver.prerm delete mode 100644 contrib/packages/deb/ubuntu-trusty/debian/xtigervncviewer.menu delete mode 100644 contrib/packages/deb/ubuntu-trusty/debian/xtigervncviewer.postinst delete mode 100644 contrib/packages/deb/ubuntu-trusty/debian/xtigervncviewer.prerm delete mode 100644 contrib/packages/deb/ubuntu-xenial/debian/changelog delete mode 100644 contrib/packages/deb/ubuntu-xenial/debian/compat delete mode 100644 contrib/packages/deb/ubuntu-xenial/debian/control delete mode 100644 contrib/packages/deb/ubuntu-xenial/debian/copyright delete mode 100644 contrib/packages/deb/ubuntu-xenial/debian/local/vncserver.service delete mode 100644 contrib/packages/deb/ubuntu-xenial/debian/local/vncserver.sysconfig delete mode 100644 contrib/packages/deb/ubuntu-xenial/debian/rules delete mode 100644 contrib/packages/deb/ubuntu-xenial/debian/source/format delete mode 100644 contrib/packages/deb/ubuntu-xenial/debian/tigervncserver.postinst delete mode 100644 contrib/packages/deb/ubuntu-xenial/debian/tigervncserver.prerm delete mode 100644 contrib/packages/deb/ubuntu-xenial/debian/xorg-source-patches/100_rethrow_signals.patch delete mode 100644 contrib/packages/deb/ubuntu-xenial/debian/xorg-source-patches/516_tigervnc-xorg-manpages.patch delete mode 100644 contrib/packages/deb/ubuntu-xenial/debian/xorg-source-patches/debian_libtool.patch delete mode 100644 contrib/packages/deb/ubuntu-xenial/debian/xorg-source-patches/xserver118-patch.patch delete mode 100644 contrib/packages/deb/ubuntu-xenial/debian/xtigervncviewer.menu delete mode 100644 contrib/packages/deb/ubuntu-xenial/debian/xtigervncviewer.postinst delete mode 100644 contrib/packages/deb/ubuntu-xenial/debian/xtigervncviewer.prerm delete mode 100644 contrib/packages/rpm/el5/SOURCES/16_CVE-2014-mult.diff delete mode 100644 contrib/packages/rpm/el5/SOURCES/17_CVE-regressions.diff delete mode 100644 contrib/packages/rpm/el5/SOURCES/CVE-2013-7439.diff delete mode 100644 contrib/packages/rpm/el5/SOURCES/CVE-2015-0255.diff delete mode 100644 contrib/packages/rpm/el5/SOURCES/CVE-2015-1802.diff delete mode 100644 contrib/packages/rpm/el5/SOURCES/CVE-2015-1803.diff delete mode 100644 contrib/packages/rpm/el5/SOURCES/CVE-2015-1804.diff delete mode 100644 contrib/packages/rpm/el5/SOURCES/FindX11.cmake delete mode 100644 contrib/packages/rpm/el5/SOURCES/fltk-1.3.3-static-libs.patch delete mode 100644 contrib/packages/rpm/el5/SOURCES/freetype-2.1.10-enable-ft2-bci.patch delete mode 100644 contrib/packages/rpm/el5/SOURCES/freetype-2.2.1-enable-valid.patch delete mode 100644 contrib/packages/rpm/el5/SOURCES/freetype-2.3.0-enable-spr.patch delete mode 100644 contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-1797.patch delete mode 100644 contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-2498.patch delete mode 100644 contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-2499.patch delete mode 100644 contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-2500.patch delete mode 100644 contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-2519.patch delete mode 100644 contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-2520.patch delete mode 100644 contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-2527.patch delete mode 100644 contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-2805.patch delete mode 100644 contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-2806.patch delete mode 100644 contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-2808.patch delete mode 100644 contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-3311.patch delete mode 100644 contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-3855.patch delete mode 100644 contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2011-0226.patch delete mode 100644 contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2011-3256.patch delete mode 100644 contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2011-3439.patch delete mode 100644 contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1126.patch delete mode 100644 contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1127.patch delete mode 100644 contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1130.patch delete mode 100644 contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1131.patch delete mode 100644 contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1132.patch delete mode 100644 contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1134.patch delete mode 100644 contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1136.patch delete mode 100644 contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1137.patch delete mode 100644 contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1139.patch delete mode 100644 contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1140.patch delete mode 100644 contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1141.patch delete mode 100644 contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1142.patch delete mode 100644 contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1143.patch delete mode 100644 contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1144.patch delete mode 100644 contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-5669.patch delete mode 100644 contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-array-initialization.patch delete mode 100644 contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-axis-name-overflow.patch delete mode 100644 contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-bdf-overflow.patch delete mode 100644 contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-more-demos.patch delete mode 100644 contrib/packages/rpm/el5/SOURCES/freetype-multilib.patch delete mode 100644 contrib/packages/rpm/el5/SOURCES/pthread-stubs.pc.in delete mode 100644 contrib/packages/rpm/el5/SOURCES/tigervnc-2b76d02.patch delete mode 100644 contrib/packages/rpm/el5/SOURCES/tigervnc14-Add-dridir-param.patch delete mode 100644 contrib/packages/rpm/el5/SOURCES/tigervnc14-Add-xkbcompdir-param.patch delete mode 100644 contrib/packages/rpm/el5/SOURCES/tigervnc14-static-build-fixes.patch delete mode 100644 contrib/packages/rpm/el5/SOURCES/vncserver.service delete mode 100644 contrib/packages/rpm/el5/SOURCES/vncserver.sysconfig delete mode 100644 contrib/packages/rpm/el5/SPECS/tigervnc.spec delete mode 100644 contrib/packages/rpm/el6/SOURCES/fetch_sources.sh delete mode 100644 contrib/packages/rpm/el6/SOURCES/fltk-1.3.x-clipboard.patch delete mode 100644 contrib/packages/rpm/el6/SOURCES/fltk-1.3.x-screen_num.patch delete mode 100644 contrib/packages/rpm/el6/SOURCES/fltk-1_v2.3.0-modal.patch delete mode 100644 contrib/packages/rpm/el6/SOURCES/fltk-1_v2.3.x-clipboard-osx.patch delete mode 100644 contrib/packages/rpm/el6/SOURCES/fltk-1_v2.3.x-clipboard-win32.patch delete mode 100644 contrib/packages/rpm/el6/SOURCES/fltk-1_v3.3.0-icons.patch delete mode 100644 contrib/packages/rpm/el6/SOURCES/fltk-1_v3.3.x-clipboard-win32-fix.patch delete mode 100644 contrib/packages/rpm/el6/SOURCES/fltk-1_v3.3.x-multihead.patch delete mode 100644 contrib/packages/rpm/el6/SOURCES/fltk-1_v4.3.x-keyboard-win32.patch delete mode 100644 contrib/packages/rpm/el6/SOURCES/fltk-1_v4.3.x-keyboard-x11.patch delete mode 100644 contrib/packages/rpm/el6/SOURCES/fltk-1_v5.3.x-clipboard-x11.patch delete mode 100644 contrib/packages/rpm/el6/SOURCES/fltk-1_v5.3.x-cursor.patch delete mode 100644 contrib/packages/rpm/el6/SOURCES/fltk-1_v6.3.x-clipboard-x11.patch delete mode 100644 contrib/packages/rpm/el6/SOURCES/fltk-1_v6.3.x-keyboard-osx.patch delete mode 100644 contrib/packages/rpm/el6/SOURCES/nettle-2.7.1-ecc-cve.patch delete mode 100644 contrib/packages/rpm/el6/SOURCES/pixmap_v2.patch delete mode 100644 contrib/packages/rpm/el6/SOURCES/tigervnc-xorg-manpages.patch delete mode 100644 contrib/packages/rpm/el6/SOURCES/vncserver.service delete mode 100644 contrib/packages/rpm/el6/SOURCES/vncserver.sysconfig delete mode 100644 contrib/packages/rpm/el6/SPECS/tigervnc.spec delete mode 100644 contrib/packages/rpm/el7/SOURCES/10-libvnc.conf delete mode 100644 contrib/packages/rpm/el7/SOURCES/tigervnc-shebang.patch delete mode 100644 contrib/packages/rpm/el7/SOURCES/vncserver.service delete mode 100644 contrib/packages/rpm/el7/SOURCES/vncserver.sysconfig delete mode 100644 contrib/packages/rpm/el7/SPECS/tigervnc.spec diff --git a/contrib/packages/deb/ubuntu-precise/debian/changelog b/contrib/packages/deb/ubuntu-precise/debian/changelog deleted file mode 100644 index 28fc3c9..0000000 --- a/contrib/packages/deb/ubuntu-precise/debian/changelog +++ /dev/null @@ -1,31 +0,0 @@ -tigervnc (1.3.0-3ubuntu1) precise; urgency=low - - * Build Xvnc against native upstream xorg sources, using native config - options. Use distro-specific fltk1.3 sources. - - -- Brian P. Hinz Sun, 14 Jul 2013 15:22:28 -0400 - -tigervnc (1.3.0-3) precise; urgency=low - - * Additional dependencies (derived from ldd | dpkg -S). - - -- Brian P. Hinz Sun, 07 Jul 2013 11:01:33 -0400 - -tigervnc (1.3.0-2) precise; urgency=low - - * Added build dependencies to improve font support in viewer. - - -- Brian P. Hinz Sun, 07 Jul 2013 10:44:05 -0400 - -tigervnc (1.3.0-1) precise; urgency=low - - * Removed java viewer from server package. Fixed typo in server - dependencies. - - -- Brian P. Hinz Sun, 07 Jul 2013 09:55:44 -0400 - -tigervnc (1.3.0) precise; urgency=low - - * Initial release. - - -- Brian P. Hinz Fri, 05 Jul 2013 00:47:02 -0400 diff --git a/contrib/packages/deb/ubuntu-precise/debian/compat b/contrib/packages/deb/ubuntu-precise/debian/compat deleted file mode 100644 index ec63514..0000000 --- a/contrib/packages/deb/ubuntu-precise/debian/compat +++ /dev/null @@ -1 +0,0 @@ -9 diff --git a/contrib/packages/deb/ubuntu-precise/debian/control b/contrib/packages/deb/ubuntu-precise/debian/control deleted file mode 100644 index b29222e..0000000 --- a/contrib/packages/deb/ubuntu-precise/debian/control +++ /dev/null @@ -1,70 +0,0 @@ -Source: tigervnc -Section: x11 -Priority: optional -Maintainer: Brian P. Hinz -Standards-Version: 3.8.4 -Build-Depends: debhelper (>> 7.1), zlib1g-dev, libjpeg-turbo8-dev, libxaw7-dev (>> 4.1.0), perl-modules, xfonts-base, xutils-dev, libx11-dev, libxau-dev, libxext-dev, libxi-dev, libxkbfile-dev, libxmu-dev, libxt-dev, x11proto-core-dev, cmake (>> 2.8), libgnutls28-dev, libpam0g-dev, libpng-dev, automake, autoconf, libtool, pkg-config, libpixman-1-dev, x11proto-bigreqs-dev, x11proto-composite-dev, x11proto-damage-dev, x11proto-dri2-dev, x11proto-fixes-dev, x11proto-fonts-dev, x11proto-gl-dev, x11proto-input-dev, x11proto-kb-dev, x11proto-randr-dev, x11proto-render-dev, x11proto-resource-dev, x11proto-scrnsaver-dev, x11proto-video-dev, x11proto-xcmisc-dev, x11proto-xext-dev, x11proto-xf86bigfont-dev, x11proto-xf86dga-dev, x11proto-xf86dri-dev, x11proto-xf86misc-dev, x11proto-xf86vidmode-dev, x11proto-xinerama-dev, libosmesa6-dev, libgl1-mesa-dev, libgl1-mesa-dri, libgl1-mesa-glx, libxfont-dev, x11proto-record-dev, default-jdk, libxtst-dev, libxft-dev, libexpat1-dev, libfontconfig1-dev, libxrender-dev, libt1-dev, libpciaccess-dev, curl, bzip2, quilt, libglu1-mesa-dev, libxcursor-dev, libxinerama-dev, libxfixes-dev, libxdamage-dev, libgcrypt11-dev -Homepage: http://www.tigervnc.com - -Package: tigervncserver -Architecture: any -Provides: xserver, vnc-server -Depends: x11-common | xserver-common, x11-utils, xauth, libbz2-1.0, libc6, libfontenc1, libfreetype6, libgcc1, libgl1-mesa-dri, libgnutls28, libjpeg-turbo8, libp11-kit0, libpam0g, libpixman-1-0, libstdc++6, libtasn1-3, libx11-6, libxau6, libxcb1, libxdmcp6, libxext6, libxfont1, libxtst6, zlib1g, libglu1-mesa, libxcursor1, libxinerama1, libxfixes3, x11-xkb-utils, libgcrypt11 -Recommends: xfonts-base, x11-xserver-utils -Suggests: xtigervncviewer, tigervnc-java -Description: virtual network computing server software - Virtual Network Computing (VNC) is a remote display system which allows you to - view and interact with a virtual desktop environment that is running on another - computer on the network. Using VNC, you can run graphical applications on a - remote machine and send only the display from these applications to your local - machine. VNC is platform-independent and supports a wide variety of operating - systems and architectures as both servers and clients. - . - TigerVNC is a high-speed version of VNC based on the RealVNC 4 and X.org code - bases. TigerVNC started as a next-generation development effort for TightVNC - on Unix and Linux platforms, but it split from its parent project in early 2009 - so that TightVNC could focus on Windows platforms. TigerVNC supports a variant - of Tight encoding that is greatly accelerated by the use of the libjpeg-turbo - JPEG codec. - -Package: xtigervncviewer -Architecture: any -Provides: vncviewer, vnc-viewer -Depends: libc6, libexpat1, libfontconfig1, libfreetype6, libgcc1, libgnutls28, libjpeg-turbo8, libp11-kit0, libpng12-0, libstdc++6, libtasn1-3, libx11-6, libxau6, libxcb1, libxdmcp6, libxext6, libxft2, libxrender1, zlib1g, libglu1-mesa -Recommends: xfonts-base -Suggests: tigervncserver, ssh -Description: virtual network computing client software for X - Virtual Network Computing (VNC) is a remote display system which allows you to - view and interact with a virtual desktop environment that is running on another - computer on the network. Using VNC, you can run graphical applications on a - remote machine and send only the display from these applications to your local - machine. VNC is platform-independent and supports a wide variety of operating - systems and architectures as both servers and clients. - . - TigerVNC is a high-speed version of VNC based on the RealVNC 4 and X.org code - bases. TigerVNC started as a next-generation development effort for TightVNC - on Unix and Linux platforms, but it split from its parent project in early 2009 - so that TightVNC could focus on Windows platforms. TigerVNC supports a variant - of Tight encoding that is greatly accelerated by the use of the libjpeg-turbo - JPEG codec. - -Package: tigervnc-java -Architecture: any -Suggests: tigervncserver -Provides: vncviewer, vnc-viewer -Depends: default-jre -Description: TigerVNC java applet - Virtual Network Computing (VNC) is a remote display system which allows you to - view and interact with a virtual desktop environment that is running on another - computer on the network. Using VNC, you can run graphical applications on a - remote machine and send only the display from these applications to your local - machine. VNC is platform-independent and supports a wide variety of operating - systems and architectures as both servers and clients. - . - TigerVNC is a high-speed version of VNC based on the RealVNC 4 and X.org code - bases. TigerVNC started as a next-generation development effort for TightVNC - on Unix and Linux platforms, but it split from its parent project in early 2009 - so that TightVNC could focus on Windows platforms. TigerVNC supports a variant - of Tight encoding that is greatly accelerated by the use of the libjpeg-turbo - JPEG codec. - diff --git a/contrib/packages/deb/ubuntu-precise/debian/copyright b/contrib/packages/deb/ubuntu-precise/debian/copyright deleted file mode 100644 index 912e5c3..0000000 --- a/contrib/packages/deb/ubuntu-precise/debian/copyright +++ /dev/null @@ -1,116 +0,0 @@ -This package was packaged for Debian by Brian P. Hinz -on Tue, 02 Jul 2013 21:33:24 +0500 using the tightvnc package as a base. - -It was downloaded from: - http://www.tigervnc.org/ - -COPYRIGHT: -========== - -TigerVNC is - - Copyright (C) 1999 AT&T Laboratories Cambridge - Copyright (C) 2002-2005 RealVNC Ltd. - Copyright (C) 2000-2006 TightVNC Group - Copyright (C) 2005-2006 Martin Koegler - Copyright (C) 2005-2006 Sun Microsystems, Inc. - Copyright (C) 2006 OCCAM Financial Technology - Copyright (C) 2000-2008 Constantin Kaplinsky - Copyright (C) 2004-2009 Peter Astrand for Cendio AB - Copyright (C) 2010 Antoine Martin - Copyright (C) 2010 m-privacy GmbH - Copyright (C) 2009-2011 D. R. Commander - Copyright (C) 2009-2011 Pierre Ossman for Cendio AB - Copyright (C) 2004, 2009-2011 Red Hat, Inc. - Copyright (C) 2009-2011 TigerVNC Team - All Rights Reserved. - -This software is distributed under the GNU General Public Licence as published -by the Free Software Foundation. See the file LICENSE.TXT for the conditions -under which this software is made available. TigerVNC also contains code from -other sources. See the Acknowledgements section below, and the individual -source files, for details of the conditions under which they are made -available. - -ACKNOWLEDGEMENTS -================ - -This distribution contains zlib compression software. This is: - - Copyright (C) 1995-2002 Jean-loup Gailly and Mark Adler - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. - - Jean-loup Gailly Mark Adler - jloup@gzip.org madler@alumni.caltech.edu - - The data format used by the zlib library is described by RFCs (Request for - Comments) 1950 to 1952 in the files ftp://ds.internic.net/rfc/rfc1950.txt - (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format). - - -This distribution contains public domain DES software by Richard Outerbridge. -This is: - - Copyright (c) 1988,1989,1990,1991,1992 by Richard Outerbridge. - (GEnie : OUTER; CIS : [71755,204]) Graven Imagery, 1992. - - -This distribution contains software from the X Window System. This is: - - Copyright 1987, 1988, 1998 The Open Group - - Permission to use, copy, modify, distribute, and sell this software and its - documentation for any purpose is hereby granted without fee, provided that - the above copyright notice appear in all copies and that both that - copyright notice and this permission notice appear in supporting - documentation. - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - Except as contained in this notice, the name of The Open Group shall not be - used in advertising or otherwise to promote the sale, use or other dealings - in this Software without prior written authorization from The Open Group. - - - Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - - Permission to use, copy, modify, and distribute this software and its - documentation for any purpose and without fee is hereby granted, - provided that the above copyright notice appear in all copies and that - both that copyright notice and this permission notice appear in - supporting documentation, and that the name of Digital not be - used in advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL - DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR - ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, - ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - SOFTWARE. diff --git a/contrib/packages/deb/ubuntu-precise/debian/get-orig-source.sh b/contrib/packages/deb/ubuntu-precise/debian/get-orig-source.sh deleted file mode 100755 index 64b2615..0000000 --- a/contrib/packages/deb/ubuntu-precise/debian/get-orig-source.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash - -#curl -L -o tigervnc-1.3.0.tar.bz2 "http://downloads.sourceforge.net/project/tigervnc/tigervnc/1.3.0/tigervnc-1.3.0.tar.bz2" -#tar xjf tigervnc-*.tar.bz2 -#rm tigervnc-*.tar.bz2 -curl -OL http://sourceforge.net/code-snapshots/svn/t/ti/tigervnc/code/tigervnc-code-5136-trunk.zip -unzip tigervnc-code-*-trunk.zip -mv tigervnc-code-*-trunk tigervnc-1.3.80 -rm tigervnc-code-*-trunk.zip -pushd tigervnc-* -curl -L -o fltk-1.3.2-source.tar.gz 'http://anonscm.debian.org/gitweb/?p=users/ucko/fltk1.3.git;a=snapshot;h=HEAD;sf=tgz' -tar xzf fltk-*-source.tar.gz -rm fltk-*-source.tar.gz -mv fltk1.3-* fltk-1.3.2 -pushd fltk-* -sh ../../debian/patch_fltk.sh -find . -name "*.orig" -exec rm {} \; -popd -curl -L -o xorg-server-1.11.4-0ubuntu10.3.tar.gz 'http://anonscm.debian.org/gitweb/?p=pkg-xorg/xserver/xorg-server.git;a=snapshot;h=cbf435a091906484112f5c4cf35b17738e779ce9;sf=tgz' -tar xzf xorg-server-*.tar.gz -rm xorg-server-*.tar.gz -pushd xorg-server-* -QUILT_PATCHES=debian/patches quilt push -a -popd -cp -r xorg-server-*/* unix/xserver -rm -rf xorg-server-* -pushd unix/xserver -for all in `find . -type f -perm -001`; do - chmod -x "$all" -done -patch -p1 -b --suffix .vnc < ../xserver111.patch -popd -popd -if [ -e tigervnc_1.3.80.orig.tar.gz ] ; then - rm tigervnc_1.3.80.orig.tar.gz -fi -tar czf tigervnc_1.3.80.orig.tar.gz tigervnc-1.3.80 -rm -rf tigervnc-1.3.80 diff --git a/contrib/packages/deb/ubuntu-precise/debian/local/vncserver.service b/contrib/packages/deb/ubuntu-precise/debian/local/vncserver.service deleted file mode 100644 index 86a8a91..0000000 --- a/contrib/packages/deb/ubuntu-precise/debian/local/vncserver.service +++ /dev/null @@ -1,94 +0,0 @@ -#!/bin/bash -# -# Init file for TigerVNC Server -# -# chkconfig: - 91 35 -# description: TigerVNC remote X administration daemon. -# -# processname: Xvnc - -### BEGIN INIT INFO -# Provides: vncservers -# Required-Start: networking -# Required-Stop: networking -# Default-Start: -# Default-Stop: 0 1 2 3 4 5 6 -# Short-Description: Starts and stops vncserver -# Description: Used to provide remote X administration services. -### END INIT INFO - -# Source function library. -. /lib/lsb/init-functions - -### Default variables -SYSCONFIG="/etc/default/vncservers" -VNCSERVERS="" - -### Read configuration -[ -r "$SYSCONFIG" ] && . "$SYSCONFIG" - -RETVAL=0 -prog=$"VNC server" - -start() { - echo -n $"Starting $prog: " - ulimit -S -c 0 >/dev/null 2>&1 - for display in ${VNCSERVERS}; do - echo -n "${display} " - if [ -r $(eval echo ~${display##*:})/.vnc/passwd ]; then - unset BASH_ENV ENV - log_begin_msg "Starting VNC Server for user ${display##*:}:" - su ${display##*:} -c "cd ~${display##*:} && [ -f .vnc/passwd ] && vncserver :${display%%:*} ${VNCSERVERARGS[${display%:*}]}" - RETVAL="$?" - if [ "$RETVAL" -ne 0 ]; then - log_end_msg 1 - break - else - log_end_msg 0 - fi - else - log_begin_msg "Not starting VNC Server for user ${display##*:}.\n File \"~${display##*:}/.vnc/passwd\" not found.\n Create a password file for the VNC server with vncpasswd" - log_end_msg 1 - fi - done - echo - [ "$RETVAL" -eq 0 ] && touch "/var/lock/vncserver" - return $RETVAL -} - -stop() { - echo -n $"Shutting down $desc: " - for display in ${VNCSERVERS}; do - echo -n "${display} " - unset BASH_ENV ENV - log_begin_msg "Shutting down VNC Server for user ${display##*:}: " - su ${display##*:} -c "vncserver -kill :${display%%:*}" >/dev/null 2>&1 - RETVAL="$?" - [ "$RETVAL" -eq 0 ] && log_end_msg 0 || log_end_msg 1 - done - echo - [ "$RETVAL" -eq 0 ] && rm -f "/var/lock/vncserver" - return $RETVAL -} - -restart() { - stop - start -} - -case "$1" in - start) - start - ;; - stop) - stop - ;; - restart|reload) - restart - ;; - *) - echo $"Usage: $0 {start|stop|restart}" - RETVAL=1 -esac - -exit $RETVAL diff --git a/contrib/packages/deb/ubuntu-precise/debian/local/vncserver.sysconfig b/contrib/packages/deb/ubuntu-precise/debian/local/vncserver.sysconfig deleted file mode 100644 index 5940a1e..0000000 --- a/contrib/packages/deb/ubuntu-precise/debian/local/vncserver.sysconfig +++ /dev/null @@ -1,19 +0,0 @@ -# The VNCSERVERS variable is a list of display:user pairs. -# -# Uncomment the lines below to start a VNC server on display :2 -# as my 'myusername' (adjust this to your own). You will also -# need to set a VNC password; run 'man vncpasswd' to see how -# to do that. -# -# DO NOT RUN THIS SERVICE if your local area network is -# untrusted! For a secure way of using VNC, see this URL: -# http://kbase.redhat.com/faq/docs/DOC-7028 - -# Use "-nolisten tcp" to prevent X connections to your VNC server via TCP. - -# Use "-localhost" to prevent remote VNC clients connecting except when -# doing so through a secure tunnel. See the "-via" option in the -# `man vncviewer' manual page. - -# VNCSERVERS="2:myusername" -# VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -localhost" diff --git a/contrib/packages/deb/ubuntu-precise/debian/patch_fltk.sh b/contrib/packages/deb/ubuntu-precise/debian/patch_fltk.sh deleted file mode 100755 index a2dc0f0..0000000 --- a/contrib/packages/deb/ubuntu-precise/debian/patch_fltk.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/bash -set -e -apply_patch() -{ - rm -f $2 - curl -OL http://www.fltk.org/strfiles/$1/$2 - patch -p1 < $2 -} - -# Export dead key information from FLTK to the apps -# http://www.fltk.org/str.php?L2599 -apply_patch 2599 fltk-1_v4.3.x-keyboard-x11.patch -apply_patch 2599 fltk-1_v4.3.x-keyboard-win32.patch -apply_patch 2599 fltk-1_v6.3.x-keyboard-osx.patch - -# Notify applications of changes to the clipboard -# http://www.fltk.org/str.php?L2636 -apply_patch 2636 fltk-1.3.x-clipboard.patch -apply_patch 2636 fltk-1_v6.3.x-clipboard-x11.patch -apply_patch 2636 fltk-1_v3.3.x-clipboard-win32-fix.patch -apply_patch 2636 fltk-1_v2.3.x-clipboard-win32.patch -apply_patch 2636 fltk-1_v2.3.x-clipboard-osx.patch - -# Ability to convert a Fl_Pixmap to a Fl_RGB_Image -# http://www.fltk.org/str.php?L2659 -apply_patch 2659 pixmap_v2.patch - -# Support for custom cursors -# http://www.fltk.org/str.php?L2660 -apply_patch 2660 fltk-1_v5.3.x-cursor.patch - -# Improve modality interaction with WM -# http://www.fltk.org/str.php?L2802 -apply_patch 2802 fltk-1_v2.3.0-modal.patch - -# Window icons -# http://www.fltk.org/str.php?L2816 -apply_patch 2816 fltk-1_v3.3.0-icons.patch - -# Multihead -# http://fltk.org/str.php?L2860 -apply_patch 2860 fltk-1.3.x-screen_num.patch -apply_patch 2860 fltk-1_v3.3.x-multihead.patch - -# Apply DRC's patches to FLTK -curl -L 'https://sourceforge.net/mailarchive/attachment.php?list_name=tigervnc-devel&message_id=512DD1FE.7090609%40users.sourceforge.net&counter=1' -o 0001-Add-BUILD_STATIC-feature-from-TigerVNC-to-optionally.patch -curl -L 'https://sourceforge.net/mailarchive/attachment.php?list_name=tigervnc-devel&message_id=512DD1FE.7090609%40users.sourceforge.net&counter=2' -o 0002-Fl_cocoa.mm-depends-on-some-Carbon-functions-so-we-n.patch -curl -L 'https://sourceforge.net/mailarchive/attachment.php?list_name=tigervnc-devel&message_id=512DD1FE.7090609%40users.sourceforge.net&counter=3' -o 0003-We-need-to-unset-CMAKE_REQUIRED_LIBRARIES-after-chec.patch - -patch -p1 -i 0001-Add-BUILD_STATIC-feature-from-TigerVNC-to-optionally.patch -patch -p1 -i 0002-Fl_cocoa.mm-depends-on-some-Carbon-functions-so-we-n.patch -patch -p1 -i 0003-We-need-to-unset-CMAKE_REQUIRED_LIBRARIES-after-chec.patch diff --git a/contrib/packages/deb/ubuntu-precise/debian/patches/100_rethrow_signals.patch b/contrib/packages/deb/ubuntu-precise/debian/patches/100_rethrow_signals.patch deleted file mode 100644 index b40b148..0000000 --- a/contrib/packages/deb/ubuntu-precise/debian/patches/100_rethrow_signals.patch +++ /dev/null @@ -1,26 +0,0 @@ ---- a/unix/xserver/hw/vnc/xvnc.c 2013-07-14 14:05:29.963390223 -0400 -+++ b/unix/xserver/hw/vnc/xvnc.c 2013-07-14 14:04:12.840357191 -0400 -@@ -250,7 +250,7 @@ - #if XORG < 111 - AbortDDX() - #else --AbortDDX(enum ExitCode error) -+SigAbortDDX(int signo, enum ExitCode error) - #endif - { - #if XORG < 111 -@@ -260,6 +260,14 @@ - #endif - } - -+#if XORG >= 111 -+void -+AbortDDX(enum ExitCode error) -+{ -+ SigAbortDDX(0, error); -+} -+#endif -+ - #ifdef __DARWIN__ - void - DarwinHandleGUI(int argc, char *argv[]) diff --git a/contrib/packages/deb/ubuntu-precise/debian/patches/516_tigervnc-xorg-manpages.patch b/contrib/packages/deb/ubuntu-precise/debian/patches/516_tigervnc-xorg-manpages.patch deleted file mode 100644 index 4575f6a..0000000 --- a/contrib/packages/deb/ubuntu-precise/debian/patches/516_tigervnc-xorg-manpages.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/unix/xserver/man/Makefile.am 2013-03-30 17:51:01.707258746 -0400 -+++ b/unix/xserver/man/Makefile.am 2013-03-30 17:51:47.606569692 -0400 -@@ -2,5 +2,7 @@ - # (i.e. those handled in the os/utils.c options processing instead of in - # the DDX-level options processing) - -+if ENABLE_DOCS - include $(top_srcdir)/manpages.am - appman_PRE = Xserver.man -+endif ENABLE_DOCS diff --git a/contrib/packages/deb/ubuntu-precise/debian/patches/debian_libtool.patch b/contrib/packages/deb/ubuntu-precise/debian/patches/debian_libtool.patch deleted file mode 100644 index 7be0ba2..0000000 --- a/contrib/packages/deb/ubuntu-precise/debian/patches/debian_libtool.patch +++ /dev/null @@ -1,52 +0,0 @@ ---- a/ltmain.sh 2016-05-11 23:23:25.796742323 -0400 -+++ b/ltmain.sh 2016-05-11 23:24:47.173010324 -0400 -@@ -6447,6 +6447,9 @@ - # It is a libtool convenience library, so add in its objects. - func_append convenience " $ladir/$objdir/$old_library" - func_append old_convenience " $ladir/$objdir/$old_library" -+ elif test "$linkmode" != prog && test "$linkmode" != lib; then -+ func_fatal_error "\`$lib' is not a convenience library" -+ fi - tmp_libs= - for deplib in $dependency_libs; do - deplibs="$deplib $deplibs" -@@ -6457,9 +6460,6 @@ - fi - func_append tmp_libs " $deplib" - done -- elif test "$linkmode" != prog && test "$linkmode" != lib; then -- func_fatal_error "\`$lib' is not a convenience library" -- fi - continue - fi # $pass = conv - ---- a/m4/libtool.m4 2016-05-11 23:26:23.801328557 -0400 -+++ b/m4/libtool.m4 2016-05-11 23:27:12.701489603 -0400 -@@ -4589,9 +4589,6 @@ - ;; - esac - ;; -- linux* | k*bsd*-gnu | gnu*) -- _LT_TAGVAR(link_all_deplibs, $1)=no -- ;; - *) - _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - ;; -@@ -4654,9 +4651,6 @@ - openbsd*) - with_gnu_ld=no - ;; -- linux* | k*bsd*-gnu | gnu*) -- _LT_TAGVAR(link_all_deplibs, $1)=no -- ;; - esac - - _LT_TAGVAR(ld_shlibs, $1)=yes -@@ -5055,7 +5049,6 @@ - if test "$aix_use_runtimelinking" = yes; then - shared_flag="$shared_flag "'${wl}-G' - fi -- _LT_TAGVAR(link_all_deplibs, $1)=no - else - # not using gcc - if test "$host_cpu" = ia64; then diff --git a/contrib/packages/deb/ubuntu-precise/debian/patches/series b/contrib/packages/deb/ubuntu-precise/debian/patches/series deleted file mode 100644 index b57b12a..0000000 --- a/contrib/packages/deb/ubuntu-precise/debian/patches/series +++ /dev/null @@ -1,8 +0,0 @@ -## Patches with a number < 100 are applied in debian. -## Ubuntu patches start with 100. - -# Ubuntu patches -100_rethrow_signals.patch - -# Upstream patches -516_tigervnc-xorg-manpages.patch diff --git a/contrib/packages/deb/ubuntu-precise/debian/rules b/contrib/packages/deb/ubuntu-precise/debian/rules deleted file mode 100755 index 7d5f4ac..0000000 --- a/contrib/packages/deb/ubuntu-precise/debian/rules +++ /dev/null @@ -1,277 +0,0 @@ -#!/usr/bin/make -f -# Sample debian/rules that uses debhelper. -# GNU copyright 1997 by Joey Hess. - -# Uncomment this to turn on verbose mode. -#export DH_VERBOSE=1 - -# These are used for cross-compiling and for saving the configure script -# from having to guess our platform (since we know it already) -#DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) -#DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) -DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) -DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH) -DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) -DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) -DEB_HOST_ARCH_OS ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_OS) -ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE)) - confflags += --build=$(DEB_HOST_GNU_TYPE) -else - confflags += --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE) -endif -SOURCE_NAME := tigervnc -SOURCE_VERSION := $(shell dpkg-parsechangelog | awk -F': ' '/^Version: / {print $$2}') -BUILDER=For technical support please see http://sourceforge.net/projects/tigervnc/support - - -ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS))) - CFLAGS += -g -O2 -fPIC -endif -ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) - INSTALL_PROGRAM += -s -endif - -export CC = gcc - -get-orig-source: $(SOURCE_NAME)_$(SOURCE_VERSION).orig.tar.gz - @ - -$(SOURCE_NAME)_$(SOURCE_VERSION).orig.tar.gz: - $(CURDIR)/get-orig-source.sh - -configure: config-stamp -config-stamp: - dh_testdir - # Add here commands to configure the package. - (cd fltk-*;cmake -G"Unix Makefiles" \ - -DCMAKE_INSTALL_PREFIX=/usr \ - -DCMAKE_BUILD_TYPE=Release \ - -DOPTION_PREFIX_LIB=/usr/lib \ - -DOPTION_PREFIX_CONFIG=/usr/lib \ - -DOPTION_BUILD_EXAMPLES=off \ - -DOPTION_USE_SYSTEM_LIBPNG=on;make) - cmake -G"Unix Makefiles" \ - -DBUILD_STATIC=off \ - -DCMAKE_INSTALL_PREFIX=/usr \ - -DFLTK_LIBRARIES="$(CURDIR)/fltk-1.3.3/lib/libfltk.a;$(CURDIR)/fltk-1.3.3/lib/libfltk_images.a;-lpng" \ - -DFLTK_INCLUDE_DIR=$(CURDIR)/fltk-1.3.3 - (cd unix/xserver; \ - export PIXMANINCDIR=/usr/include/pixman-1; \ - autoreconf -fiv; \ - patch -p1 -i ../../debian/patches/debian_libtool.patch; \ - ./configure --prefix=/usr \ - --disable-silent-rules \ - --disable-static \ - --without-dtrace \ - --disable-strict-compilation \ - --disable-debug \ - --disable-unit-tests \ - --with-int10=x86emu \ - --with-extra-module-dir="/usr/lib/${DEB_HOST_MULTIARCH}/xorg/extra-modules,/usr/lib/xorg/extra-modules" \ - --with-os-vendor="$(VENDOR)" \ - --with-builderstring="$(SOURCE_NAME) $(SOURCE_VERSION) ($(BUILDER))" \ - --with-xkb-path=/usr/share/X11/xkb \ - --with-xkb-output=/var/lib/xkb \ - --with-default-xkb-rules=evdev \ - --disable-devel-docs \ - --disable-install-libxf86config \ - --enable-mitshm \ - --enable-xres \ - --disable-xcsecurity \ - --disable-xcalibrate \ - --disable-tslib \ - --enable-dbe \ - --disable-xf86bigfont \ - --disable-dpms \ - --disable-config-dbus \ - --disable-config-hal \ - --disable-config-udev \ - --disable-xorg \ - --disable-xquartz \ - --disable-xwin \ - --disable-xfake \ - --disable-install-setuid \ - --enable-gestures \ - --with-default-font-path="/usr/share/fonts/X11/misc,/usr/share/fonts/X11/cyrillic,/usr/share/fonts/X11/100dpi/:unscaled,/usr/share/fonts/X11/75dpi/:unscaled,/usr/share/fonts/X11/Type1,/usr/share/fonts/X11/100dpi,/usr/share/fonts/X11/75dpi,/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType,built-ins" \ - --enable-aiglx \ - --enable-glx-tls \ - --enable-registry \ - --enable-composite \ - --enable-record \ - --enable-xv \ - --enable-xvmc \ - --enable-dga \ - --enable-screensaver \ - --enable-xdmcp \ - --enable-xdm-auth-1 \ - --enable-glx \ - --disable-dri --enable-dri2 \ - --enable-xinerama \ - --enable-xf86vidmode \ - --enable-xace \ - --disable-selinux \ - --enable-xfree86-utils \ - --disable-dmx \ - --disable-xvfb \ - --disable-xnest \ - --disable-kdrive \ - --disable-xephyr \ - --enable-xfbdev \ - --with-sha1=libgcrypt \ - --enable-xcsecurity \ - --disable-docs \ - --disable-selective-werror) - touch config-stamp - -build-arch: config-stamp build-arch-stamp -build-arch-stamp: - dh_testdir - - # Add here command to compile/build the package. - # Build first things. - # Build Xvnc - make LDFLAGS="-lpng" - (cd unix/xserver;make) - - touch build-arch-stamp - -build-indep: config-stamp build-indep-stamp -build-indep-stamp: - dh_testdir - - # Add here command to compile/build the arch indep package. - # It's ok not to do anything here, if you don't need to build - # anything for this package. - #/usr/bin/docbook-to-man debian/vnc.sgml > vnc.1 - (cd media;make) - (cd java;cmake -G"Unix Makefiles";make) - - touch build-indep-stamp - -build: build-arch build-indep - -clean: - dh_testdir - dh_testroot - rm -f build-arch-stamp build-indep-stamp config-stamp - - # Add here commands to clean up after the build process. - dh_clean - -install: DH_OPTIONS= -install: build - dh_testdir - dh_testroot - dh_clean -k - dh_prep - dh_installdirs - # Add here commands to install the package into debian/vnc. - # tigervncserver - make install DESTDIR=$(CURDIR)/debian/tigervncserver - (cd unix/xserver/hw/vnc; make install DESTDIR=$(CURDIR)/debian/tigervncserver) - mv $(CURDIR)/debian/tigervncserver/usr/bin/Xvnc \ - $(CURDIR)/debian/tigervncserver/usr/bin/Xtigervnc - mv $(CURDIR)/debian/tigervncserver/usr/bin/vncconfig \ - $(CURDIR)/debian/tigervncserver/usr/bin/tigervncconfig - mv $(CURDIR)/debian/tigervncserver/usr/bin/vncpasswd \ - $(CURDIR)/debian/tigervncserver/usr/bin/tigervncpasswd - mv $(CURDIR)/debian/tigervncserver/usr/bin/vncserver \ - $(CURDIR)/debian/tigervncserver/usr/bin/tigervncserver - mv $(CURDIR)/debian/tigervncserver/usr/bin/x0vncserver \ - $(CURDIR)/debian/tigervncserver/usr/bin/x0tigervncserver - mv $(CURDIR)/debian/tigervncserver/usr/share/man/man1/vncconfig.1 \ - $(CURDIR)/debian/tigervncserver/usr/share/man/man1/tigervncconfig.1 - mv $(CURDIR)/debian/tigervncserver/usr/share/man/man1/vncpasswd.1 \ - $(CURDIR)/debian/tigervncserver/usr/share/man/man1/tigervncpasswd.1 - mv $(CURDIR)/debian/tigervncserver/usr/share/man/man1/vncserver.1 \ - $(CURDIR)/debian/tigervncserver/usr/share/man/man1/tigervncserver.1 - mv $(CURDIR)/debian/tigervncserver/usr/share/man/man1/x0vncserver.1 \ - $(CURDIR)/debian/tigervncserver/usr/share/man/man1/x0tigervncserver.1 - mv $(CURDIR)/debian/tigervncserver/usr/share/man/man1/Xvnc.1 \ - $(CURDIR)/debian/tigervncserver/usr/share/man/man1/Xtigervnc.1 - mv $(CURDIR)/debian/tigervncserver/usr/share/doc/tigervnc-* \ - $(CURDIR)/debian/tigervncserver/usr/share/doc/tigervncserver - rm $(CURDIR)/debian/tigervncserver/usr/lib/xorg/modules/extensions/libvnc.la - rm $(CURDIR)/debian/tigervncserver/usr/bin/vncviewer - rm $(CURDIR)/debian/tigervncserver/usr/share/man/man1/vncviewer.1 - install -o root -g root -m 755 -D $(CURDIR)/debian/local/vncserver.service \ - $(CURDIR)/debian/tigervncserver/etc/init.d/vncserver - install -o root -g root -m 644 -D $(CURDIR)/debian/local/vncserver.sysconfig \ - $(CURDIR)/debian/tigervncserver/etc/default/vncservers - # xtigervncviewer - (cd vncviewer; make install DESTDIR=$(CURDIR)/debian/xtigervncviewer) - # Install desktop stuff - mv $(CURDIR)/debian/xtigervncviewer/usr/bin/vncviewer \ - $(CURDIR)/debian/xtigervncviewer/usr/bin/xtigervncviewer - mv $(CURDIR)/debian/xtigervncviewer/usr/share/man/man1/vncviewer.1 \ - $(CURDIR)/debian/xtigervncviewer/usr/share/man/man1/xtigervncviewer.1 - # tigervnc-java - mkdir -p $(CURDIR)/debian/tigervnc-java/usr/share - (cd java; make install DESTDIR=$(CURDIR)/debian/tigervnc-java/usr/share) - #dh_movefiles - -# Build architecture-independent files here. -# Pass -i to all debhelper commands in this target to reduce clutter. -binary-indep: build install - -binary-indep-keep: - dh_testdir -i - dh_testroot -i -# dh_installdebconf -i - dh_install - dh_installdocs -i - dh_installexamples -i - dh_installmenu -i -# dh_installlogrotate -i -# dh_installemacsen -i -# dh_installpam -i -# dh_installmime -i -# dh_installinit -i - dh_installcron -i - dh_installman -i - dh_installinfo -i -# dh_undocumented -i - dh_installchangelogs -i - dh_link -i - dh_compress -i - dh_fixperms -i - dh_installdeb -i - dh_perl -i - dh_gencontrol -i - dh_md5sums -i - dh_builddeb -i - -# Build architecture-dependent files here. -binary-arch: build install - dh_testdir -a - dh_testroot -a -# dh_installdebconf -a - dh_installdocs -a -# dh_installexamples -a - dh_installmenu -a -# dh_installlogrotate -a -# dh_installemacsen -a -# dh_installpam -a -# dh_installmime -a - dh_install - dh_installinit -a -# dh_installcron -a - dh_installman -a - dh_installinfo -a -# dh_undocumented -a - dh_installchangelogs -a - # Remove empty directories - dh_strip -a - dh_link -a - dh_compress -a - dh_fixperms -a - dh_makeshlibs -a - dh_installdeb -a - dh_perl -a - dh_shlibdeps -a - dh_gencontrol -a - dh_md5sums -a - dh_builddeb -a - -binary: binary-indep binary-arch -.PHONY: build clean binary-indep binary-arch binary install get-orig-source diff --git a/contrib/packages/deb/ubuntu-precise/debian/source/format b/contrib/packages/deb/ubuntu-precise/debian/source/format deleted file mode 100644 index 163aaf8..0000000 --- a/contrib/packages/deb/ubuntu-precise/debian/source/format +++ /dev/null @@ -1 +0,0 @@ -3.0 (quilt) diff --git a/contrib/packages/deb/ubuntu-precise/debian/tigervncserver.postinst b/contrib/packages/deb/ubuntu-precise/debian/tigervncserver.postinst deleted file mode 100644 index aaed2f6..0000000 --- a/contrib/packages/deb/ubuntu-precise/debian/tigervncserver.postinst +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/sh -e - -if [ "$1" = "configure" ]; then - MAN=/usr/share/man/man1 - BIN=/usr/bin - update-alternatives --install \ - $BIN/vncserver vncserver $BIN/tigervncserver 64 \ - --slave \ - $MAN/vncserver.1.gz vncserver.1.gz $MAN/tigervncserver.1.gz - update-alternatives --install \ - $BIN/Xvnc Xvnc $BIN/Xtigervnc 74 \ - --slave \ - $MAN/Xvnc.1.gz Xvnc.1.gz $MAN/Xtigervnc.1.gz - update-alternatives --install \ - $BIN/x0vncserver x0vncserver $BIN/x0tigervncserver 74 \ - --slave \ - $MAN/x0vncserver.1.gz x0vncserver.1.gz $MAN/x0tigervncserver.1.gz - update-alternatives --install \ - $BIN/vncpasswd vncpasswd $BIN/tigervncpasswd 74 \ - --slave \ - $MAN/vncpasswd.1.gz vncpasswd.1.gz $MAN/tigervncpasswd.1.gz - update-alternatives --install \ - $BIN/vncconfig vncconfig $BIN/tigervncconfig 64 \ - --slave \ - $MAN/vncconfig.1.gz vncconfig.1.gz $MAN/tigervncconfig.1.gz -fi - -#DEBHELPER# - -exit 0 diff --git a/contrib/packages/deb/ubuntu-precise/debian/tigervncserver.prerm b/contrib/packages/deb/ubuntu-precise/debian/tigervncserver.prerm deleted file mode 100644 index 108b177..0000000 --- a/contrib/packages/deb/ubuntu-precise/debian/tigervncserver.prerm +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh -e - -if [ "$1" = "remove" ] ; then - BIN=/usr/bin - update-alternatives --remove \ - vncserver $BIN/tigervncserver - update-alternatives --remove \ - Xvnc $BIN/Xtigervnc - update-alternatives --remove \ - x0vncserver $BIN/x0tigervncserver - update-alternatives --remove \ - vncpasswd $BIN/tigervncpasswd - update-alternatives --remove \ - tigervncconfig $BIN/tigervncconfig -fi - -#DEBHELPER# - -exit 0 diff --git a/contrib/packages/deb/ubuntu-precise/debian/xtigervncviewer.menu b/contrib/packages/deb/ubuntu-precise/debian/xtigervncviewer.menu deleted file mode 100644 index aac942c..0000000 --- a/contrib/packages/deb/ubuntu-precise/debian/xtigervncviewer.menu +++ /dev/null @@ -1,5 +0,0 @@ -?package(xtigervncviewer):needs="x11" \ - section="Applications/Network/Communication" \ - hints="VNC,remote-control"\ - title="xtigervncviewer" \ - command="/usr/bin/xtigervncviewer" diff --git a/contrib/packages/deb/ubuntu-precise/debian/xtigervncviewer.postinst b/contrib/packages/deb/ubuntu-precise/debian/xtigervncviewer.postinst deleted file mode 100644 index 4df0c65..0000000 --- a/contrib/packages/deb/ubuntu-precise/debian/xtigervncviewer.postinst +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh -e - -if [ "$1" = "configure" ]; then - MAN=/usr/share/man/man1 - BIN=/usr/bin - update-alternatives --install \ - $BIN/vncviewer vncviewer $BIN/xtigervncviewer 74 \ - --slave \ - $MAN/vncviewer.1.gz vncviewer.1.gz $MAN/xtigervncviewer.1.gz \ - --slave \ - $MAN/xvncviewer.1.gz xvncviewer.1.gz $MAN/xtigervncviewer.1.gz \ - --slave \ - $BIN/xvncviewer xvncviewer $BIN/xtigervncviewer -fi - -#DEBHELPER# - -exit 0 diff --git a/contrib/packages/deb/ubuntu-precise/debian/xtigervncviewer.prerm b/contrib/packages/deb/ubuntu-precise/debian/xtigervncviewer.prerm deleted file mode 100644 index 7a51fd2..0000000 --- a/contrib/packages/deb/ubuntu-precise/debian/xtigervncviewer.prerm +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh -e - -if [ "$1" = "remove" ] ; then - BIN=/usr/bin - update-alternatives --remove \ - vncviewer $BIN/xtigervncviewer -fi - -#DEBHELPER# - -exit 0 diff --git a/contrib/packages/deb/ubuntu-trusty/debian/changelog b/contrib/packages/deb/ubuntu-trusty/debian/changelog deleted file mode 100644 index 28fc3c9..0000000 --- a/contrib/packages/deb/ubuntu-trusty/debian/changelog +++ /dev/null @@ -1,31 +0,0 @@ -tigervnc (1.3.0-3ubuntu1) precise; urgency=low - - * Build Xvnc against native upstream xorg sources, using native config - options. Use distro-specific fltk1.3 sources. - - -- Brian P. Hinz Sun, 14 Jul 2013 15:22:28 -0400 - -tigervnc (1.3.0-3) precise; urgency=low - - * Additional dependencies (derived from ldd | dpkg -S). - - -- Brian P. Hinz Sun, 07 Jul 2013 11:01:33 -0400 - -tigervnc (1.3.0-2) precise; urgency=low - - * Added build dependencies to improve font support in viewer. - - -- Brian P. Hinz Sun, 07 Jul 2013 10:44:05 -0400 - -tigervnc (1.3.0-1) precise; urgency=low - - * Removed java viewer from server package. Fixed typo in server - dependencies. - - -- Brian P. Hinz Sun, 07 Jul 2013 09:55:44 -0400 - -tigervnc (1.3.0) precise; urgency=low - - * Initial release. - - -- Brian P. Hinz Fri, 05 Jul 2013 00:47:02 -0400 diff --git a/contrib/packages/deb/ubuntu-trusty/debian/compat b/contrib/packages/deb/ubuntu-trusty/debian/compat deleted file mode 100644 index ec63514..0000000 --- a/contrib/packages/deb/ubuntu-trusty/debian/compat +++ /dev/null @@ -1 +0,0 @@ -9 diff --git a/contrib/packages/deb/ubuntu-trusty/debian/control b/contrib/packages/deb/ubuntu-trusty/debian/control deleted file mode 100644 index f1cf906..0000000 --- a/contrib/packages/deb/ubuntu-trusty/debian/control +++ /dev/null @@ -1,70 +0,0 @@ -Source: tigervnc -Section: x11 -Priority: optional -Maintainer: Brian P. Hinz -Standards-Version: 3.8.4 -Build-Depends: debhelper (>> 7.1), zlib1g-dev, libjpeg-turbo8-dev, libxaw7-dev (>> 4.1.0), perl-modules, xfonts-base, xutils-dev, libx11-dev, libxau-dev, libxext-dev, libxi-dev, libxkbfile-dev, libxmu-dev, libxt-dev, x11proto-core-dev, cmake (>> 2.8), libgnutls28-dev, libpam0g-dev, libpng-dev, automake, autoconf, libtool, pkg-config, libpixman-1-dev, x11proto-bigreqs-dev, x11proto-composite-dev, x11proto-damage-dev, x11proto-dri2-dev, x11proto-fixes-dev, x11proto-fonts-dev, x11proto-gl-dev, x11proto-input-dev, x11proto-kb-dev, x11proto-randr-dev, x11proto-render-dev, x11proto-resource-dev, x11proto-scrnsaver-dev, x11proto-video-dev, x11proto-xext-dev, x11proto-xf86bigfont-dev, x11proto-xf86dga-dev, x11proto-xf86dri-dev, x11proto-xf86vidmode-dev, x11proto-xinerama-dev, libosmesa6-dev, libgl1-mesa-dev, libgl1-mesa-dri, libgl1-mesa-glx, libxfont-dev, x11proto-record-dev, default-jdk, libxtst-dev, libxft-dev, libexpat1-dev, libfontconfig1-dev, libxrender-dev, libt1-dev, libpciaccess-dev, curl, bzip2, quilt, libglu1-mesa-dev, libxcursor-dev, libxinerama-dev, libxfixes-dev, libcairo2-dev, x11proto-dri3-dev, libgcrypt20-dev, x11proto-xcmisc-dev, x11proto-present-dev, libtasn1-dev -Homepage: http://www.tigervnc.com - -Package: tigervncserver -Architecture: any -Provides: xserver, vnc-server -Depends: x11-common | xserver-common, x11-utils, xauth, libbz2-1.0, libc6, libfontenc1, libfreetype6, libgcc1, libgl1-mesa-dri, libgnutls28, libjpeg-turbo8, libp11-kit0, libpam0g, libpixman-1-0, libstdc++6, libtasn1-bin, libx11-6, libxau6, libxcb1, libxdmcp6, libxext6, libxfont1, libxtst6, zlib1g, libglu1-mesa, libxcursor1, libxinerama1, libxfixes3, x11-xkb-utils, libgcrypt20 -Recommends: xfonts-base, x11-xserver-utils -Suggests: xtigervncviewer, tigervnc-java -Description: virtual network computing server software - Virtual Network Computing (VNC) is a remote display system which allows you to - view and interact with a virtual desktop environment that is running on another - computer on the network. Using VNC, you can run graphical applications on a - remote machine and send only the display from these applications to your local - machine. VNC is platform-independent and supports a wide variety of operating - systems and architectures as both servers and clients. - . - TigerVNC is a high-speed version of VNC based on the RealVNC 4 and X.org code - bases. TigerVNC started as a next-generation development effort for TightVNC - on Unix and Linux platforms, but it split from its parent project in early 2009 - so that TightVNC could focus on Windows platforms. TigerVNC supports a variant - of Tight encoding that is greatly accelerated by the use of the libjpeg-turbo - JPEG codec. - -Package: xtigervncviewer -Architecture: any -Provides: vncviewer, vnc-viewer -Depends: libc6, libexpat1, libfontconfig1, libfreetype6, libgcc1, libgnutls28, libjpeg-turbo8, libp11-kit0, libpng12-0, libstdc++6, libtasn1-bin, libx11-6, libxau6, libxcb1, libxdmcp6, libxext6, libxft2, libxrender1, zlib1g, libglu1-mesa, libxcursor1, libxinerama1, libxfixes3 -Recommends: xfonts-base -Suggests: tigervncserver, ssh -Description: virtual network computing client software for X - Virtual Network Computing (VNC) is a remote display system which allows you to - view and interact with a virtual desktop environment that is running on another - computer on the network. Using VNC, you can run graphical applications on a - remote machine and send only the display from these applications to your local - machine. VNC is platform-independent and supports a wide variety of operating - systems and architectures as both servers and clients. - . - TigerVNC is a high-speed version of VNC based on the RealVNC 4 and X.org code - bases. TigerVNC started as a next-generation development effort for TightVNC - on Unix and Linux platforms, but it split from its parent project in early 2009 - so that TightVNC could focus on Windows platforms. TigerVNC supports a variant - of Tight encoding that is greatly accelerated by the use of the libjpeg-turbo - JPEG codec. - -Package: tigervnc-java -Architecture: any -Suggests: tigervncserver -Provides: vncviewer, vnc-viewer -Depends: default-jre -Description: TigerVNC java applet - Virtual Network Computing (VNC) is a remote display system which allows you to - view and interact with a virtual desktop environment that is running on another - computer on the network. Using VNC, you can run graphical applications on a - remote machine and send only the display from these applications to your local - machine. VNC is platform-independent and supports a wide variety of operating - systems and architectures as both servers and clients. - . - TigerVNC is a high-speed version of VNC based on the RealVNC 4 and X.org code - bases. TigerVNC started as a next-generation development effort for TightVNC - on Unix and Linux platforms, but it split from its parent project in early 2009 - so that TightVNC could focus on Windows platforms. TigerVNC supports a variant - of Tight encoding that is greatly accelerated by the use of the libjpeg-turbo - JPEG codec. - diff --git a/contrib/packages/deb/ubuntu-trusty/debian/copyright b/contrib/packages/deb/ubuntu-trusty/debian/copyright deleted file mode 100644 index 912e5c3..0000000 --- a/contrib/packages/deb/ubuntu-trusty/debian/copyright +++ /dev/null @@ -1,116 +0,0 @@ -This package was packaged for Debian by Brian P. Hinz -on Tue, 02 Jul 2013 21:33:24 +0500 using the tightvnc package as a base. - -It was downloaded from: - http://www.tigervnc.org/ - -COPYRIGHT: -========== - -TigerVNC is - - Copyright (C) 1999 AT&T Laboratories Cambridge - Copyright (C) 2002-2005 RealVNC Ltd. - Copyright (C) 2000-2006 TightVNC Group - Copyright (C) 2005-2006 Martin Koegler - Copyright (C) 2005-2006 Sun Microsystems, Inc. - Copyright (C) 2006 OCCAM Financial Technology - Copyright (C) 2000-2008 Constantin Kaplinsky - Copyright (C) 2004-2009 Peter Astrand for Cendio AB - Copyright (C) 2010 Antoine Martin - Copyright (C) 2010 m-privacy GmbH - Copyright (C) 2009-2011 D. R. Commander - Copyright (C) 2009-2011 Pierre Ossman for Cendio AB - Copyright (C) 2004, 2009-2011 Red Hat, Inc. - Copyright (C) 2009-2011 TigerVNC Team - All Rights Reserved. - -This software is distributed under the GNU General Public Licence as published -by the Free Software Foundation. See the file LICENSE.TXT for the conditions -under which this software is made available. TigerVNC also contains code from -other sources. See the Acknowledgements section below, and the individual -source files, for details of the conditions under which they are made -available. - -ACKNOWLEDGEMENTS -================ - -This distribution contains zlib compression software. This is: - - Copyright (C) 1995-2002 Jean-loup Gailly and Mark Adler - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. - - Jean-loup Gailly Mark Adler - jloup@gzip.org madler@alumni.caltech.edu - - The data format used by the zlib library is described by RFCs (Request for - Comments) 1950 to 1952 in the files ftp://ds.internic.net/rfc/rfc1950.txt - (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format). - - -This distribution contains public domain DES software by Richard Outerbridge. -This is: - - Copyright (c) 1988,1989,1990,1991,1992 by Richard Outerbridge. - (GEnie : OUTER; CIS : [71755,204]) Graven Imagery, 1992. - - -This distribution contains software from the X Window System. This is: - - Copyright 1987, 1988, 1998 The Open Group - - Permission to use, copy, modify, distribute, and sell this software and its - documentation for any purpose is hereby granted without fee, provided that - the above copyright notice appear in all copies and that both that - copyright notice and this permission notice appear in supporting - documentation. - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - Except as contained in this notice, the name of The Open Group shall not be - used in advertising or otherwise to promote the sale, use or other dealings - in this Software without prior written authorization from The Open Group. - - - Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - - Permission to use, copy, modify, and distribute this software and its - documentation for any purpose and without fee is hereby granted, - provided that the above copyright notice appear in all copies and that - both that copyright notice and this permission notice appear in - supporting documentation, and that the name of Digital not be - used in advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL - DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR - ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, - ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - SOFTWARE. diff --git a/contrib/packages/deb/ubuntu-trusty/debian/get-orig-source.sh b/contrib/packages/deb/ubuntu-trusty/debian/get-orig-source.sh deleted file mode 100755 index 64b2615..0000000 --- a/contrib/packages/deb/ubuntu-trusty/debian/get-orig-source.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash - -#curl -L -o tigervnc-1.3.0.tar.bz2 "http://downloads.sourceforge.net/project/tigervnc/tigervnc/1.3.0/tigervnc-1.3.0.tar.bz2" -#tar xjf tigervnc-*.tar.bz2 -#rm tigervnc-*.tar.bz2 -curl -OL http://sourceforge.net/code-snapshots/svn/t/ti/tigervnc/code/tigervnc-code-5136-trunk.zip -unzip tigervnc-code-*-trunk.zip -mv tigervnc-code-*-trunk tigervnc-1.3.80 -rm tigervnc-code-*-trunk.zip -pushd tigervnc-* -curl -L -o fltk-1.3.2-source.tar.gz 'http://anonscm.debian.org/gitweb/?p=users/ucko/fltk1.3.git;a=snapshot;h=HEAD;sf=tgz' -tar xzf fltk-*-source.tar.gz -rm fltk-*-source.tar.gz -mv fltk1.3-* fltk-1.3.2 -pushd fltk-* -sh ../../debian/patch_fltk.sh -find . -name "*.orig" -exec rm {} \; -popd -curl -L -o xorg-server-1.11.4-0ubuntu10.3.tar.gz 'http://anonscm.debian.org/gitweb/?p=pkg-xorg/xserver/xorg-server.git;a=snapshot;h=cbf435a091906484112f5c4cf35b17738e779ce9;sf=tgz' -tar xzf xorg-server-*.tar.gz -rm xorg-server-*.tar.gz -pushd xorg-server-* -QUILT_PATCHES=debian/patches quilt push -a -popd -cp -r xorg-server-*/* unix/xserver -rm -rf xorg-server-* -pushd unix/xserver -for all in `find . -type f -perm -001`; do - chmod -x "$all" -done -patch -p1 -b --suffix .vnc < ../xserver111.patch -popd -popd -if [ -e tigervnc_1.3.80.orig.tar.gz ] ; then - rm tigervnc_1.3.80.orig.tar.gz -fi -tar czf tigervnc_1.3.80.orig.tar.gz tigervnc-1.3.80 -rm -rf tigervnc-1.3.80 diff --git a/contrib/packages/deb/ubuntu-trusty/debian/local/vncserver.service b/contrib/packages/deb/ubuntu-trusty/debian/local/vncserver.service deleted file mode 100644 index 86a8a91..0000000 --- a/contrib/packages/deb/ubuntu-trusty/debian/local/vncserver.service +++ /dev/null @@ -1,94 +0,0 @@ -#!/bin/bash -# -# Init file for TigerVNC Server -# -# chkconfig: - 91 35 -# description: TigerVNC remote X administration daemon. -# -# processname: Xvnc - -### BEGIN INIT INFO -# Provides: vncservers -# Required-Start: networking -# Required-Stop: networking -# Default-Start: -# Default-Stop: 0 1 2 3 4 5 6 -# Short-Description: Starts and stops vncserver -# Description: Used to provide remote X administration services. -### END INIT INFO - -# Source function library. -. /lib/lsb/init-functions - -### Default variables -SYSCONFIG="/etc/default/vncservers" -VNCSERVERS="" - -### Read configuration -[ -r "$SYSCONFIG" ] && . "$SYSCONFIG" - -RETVAL=0 -prog=$"VNC server" - -start() { - echo -n $"Starting $prog: " - ulimit -S -c 0 >/dev/null 2>&1 - for display in ${VNCSERVERS}; do - echo -n "${display} " - if [ -r $(eval echo ~${display##*:})/.vnc/passwd ]; then - unset BASH_ENV ENV - log_begin_msg "Starting VNC Server for user ${display##*:}:" - su ${display##*:} -c "cd ~${display##*:} && [ -f .vnc/passwd ] && vncserver :${display%%:*} ${VNCSERVERARGS[${display%:*}]}" - RETVAL="$?" - if [ "$RETVAL" -ne 0 ]; then - log_end_msg 1 - break - else - log_end_msg 0 - fi - else - log_begin_msg "Not starting VNC Server for user ${display##*:}.\n File \"~${display##*:}/.vnc/passwd\" not found.\n Create a password file for the VNC server with vncpasswd" - log_end_msg 1 - fi - done - echo - [ "$RETVAL" -eq 0 ] && touch "/var/lock/vncserver" - return $RETVAL -} - -stop() { - echo -n $"Shutting down $desc: " - for display in ${VNCSERVERS}; do - echo -n "${display} " - unset BASH_ENV ENV - log_begin_msg "Shutting down VNC Server for user ${display##*:}: " - su ${display##*:} -c "vncserver -kill :${display%%:*}" >/dev/null 2>&1 - RETVAL="$?" - [ "$RETVAL" -eq 0 ] && log_end_msg 0 || log_end_msg 1 - done - echo - [ "$RETVAL" -eq 0 ] && rm -f "/var/lock/vncserver" - return $RETVAL -} - -restart() { - stop - start -} - -case "$1" in - start) - start - ;; - stop) - stop - ;; - restart|reload) - restart - ;; - *) - echo $"Usage: $0 {start|stop|restart}" - RETVAL=1 -esac - -exit $RETVAL diff --git a/contrib/packages/deb/ubuntu-trusty/debian/local/vncserver.sysconfig b/contrib/packages/deb/ubuntu-trusty/debian/local/vncserver.sysconfig deleted file mode 100644 index 5940a1e..0000000 --- a/contrib/packages/deb/ubuntu-trusty/debian/local/vncserver.sysconfig +++ /dev/null @@ -1,19 +0,0 @@ -# The VNCSERVERS variable is a list of display:user pairs. -# -# Uncomment the lines below to start a VNC server on display :2 -# as my 'myusername' (adjust this to your own). You will also -# need to set a VNC password; run 'man vncpasswd' to see how -# to do that. -# -# DO NOT RUN THIS SERVICE if your local area network is -# untrusted! For a secure way of using VNC, see this URL: -# http://kbase.redhat.com/faq/docs/DOC-7028 - -# Use "-nolisten tcp" to prevent X connections to your VNC server via TCP. - -# Use "-localhost" to prevent remote VNC clients connecting except when -# doing so through a secure tunnel. See the "-via" option in the -# `man vncviewer' manual page. - -# VNCSERVERS="2:myusername" -# VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -localhost" diff --git a/contrib/packages/deb/ubuntu-trusty/debian/patch_fltk.sh b/contrib/packages/deb/ubuntu-trusty/debian/patch_fltk.sh deleted file mode 100755 index a2dc0f0..0000000 --- a/contrib/packages/deb/ubuntu-trusty/debian/patch_fltk.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/bash -set -e -apply_patch() -{ - rm -f $2 - curl -OL http://www.fltk.org/strfiles/$1/$2 - patch -p1 < $2 -} - -# Export dead key information from FLTK to the apps -# http://www.fltk.org/str.php?L2599 -apply_patch 2599 fltk-1_v4.3.x-keyboard-x11.patch -apply_patch 2599 fltk-1_v4.3.x-keyboard-win32.patch -apply_patch 2599 fltk-1_v6.3.x-keyboard-osx.patch - -# Notify applications of changes to the clipboard -# http://www.fltk.org/str.php?L2636 -apply_patch 2636 fltk-1.3.x-clipboard.patch -apply_patch 2636 fltk-1_v6.3.x-clipboard-x11.patch -apply_patch 2636 fltk-1_v3.3.x-clipboard-win32-fix.patch -apply_patch 2636 fltk-1_v2.3.x-clipboard-win32.patch -apply_patch 2636 fltk-1_v2.3.x-clipboard-osx.patch - -# Ability to convert a Fl_Pixmap to a Fl_RGB_Image -# http://www.fltk.org/str.php?L2659 -apply_patch 2659 pixmap_v2.patch - -# Support for custom cursors -# http://www.fltk.org/str.php?L2660 -apply_patch 2660 fltk-1_v5.3.x-cursor.patch - -# Improve modality interaction with WM -# http://www.fltk.org/str.php?L2802 -apply_patch 2802 fltk-1_v2.3.0-modal.patch - -# Window icons -# http://www.fltk.org/str.php?L2816 -apply_patch 2816 fltk-1_v3.3.0-icons.patch - -# Multihead -# http://fltk.org/str.php?L2860 -apply_patch 2860 fltk-1.3.x-screen_num.patch -apply_patch 2860 fltk-1_v3.3.x-multihead.patch - -# Apply DRC's patches to FLTK -curl -L 'https://sourceforge.net/mailarchive/attachment.php?list_name=tigervnc-devel&message_id=512DD1FE.7090609%40users.sourceforge.net&counter=1' -o 0001-Add-BUILD_STATIC-feature-from-TigerVNC-to-optionally.patch -curl -L 'https://sourceforge.net/mailarchive/attachment.php?list_name=tigervnc-devel&message_id=512DD1FE.7090609%40users.sourceforge.net&counter=2' -o 0002-Fl_cocoa.mm-depends-on-some-Carbon-functions-so-we-n.patch -curl -L 'https://sourceforge.net/mailarchive/attachment.php?list_name=tigervnc-devel&message_id=512DD1FE.7090609%40users.sourceforge.net&counter=3' -o 0003-We-need-to-unset-CMAKE_REQUIRED_LIBRARIES-after-chec.patch - -patch -p1 -i 0001-Add-BUILD_STATIC-feature-from-TigerVNC-to-optionally.patch -patch -p1 -i 0002-Fl_cocoa.mm-depends-on-some-Carbon-functions-so-we-n.patch -patch -p1 -i 0003-We-need-to-unset-CMAKE_REQUIRED_LIBRARIES-after-chec.patch diff --git a/contrib/packages/deb/ubuntu-trusty/debian/patches/100_rethrow_signals.patch b/contrib/packages/deb/ubuntu-trusty/debian/patches/100_rethrow_signals.patch deleted file mode 100644 index b40b148..0000000 --- a/contrib/packages/deb/ubuntu-trusty/debian/patches/100_rethrow_signals.patch +++ /dev/null @@ -1,26 +0,0 @@ ---- a/unix/xserver/hw/vnc/xvnc.c 2013-07-14 14:05:29.963390223 -0400 -+++ b/unix/xserver/hw/vnc/xvnc.c 2013-07-14 14:04:12.840357191 -0400 -@@ -250,7 +250,7 @@ - #if XORG < 111 - AbortDDX() - #else --AbortDDX(enum ExitCode error) -+SigAbortDDX(int signo, enum ExitCode error) - #endif - { - #if XORG < 111 -@@ -260,6 +260,14 @@ - #endif - } - -+#if XORG >= 111 -+void -+AbortDDX(enum ExitCode error) -+{ -+ SigAbortDDX(0, error); -+} -+#endif -+ - #ifdef __DARWIN__ - void - DarwinHandleGUI(int argc, char *argv[]) diff --git a/contrib/packages/deb/ubuntu-trusty/debian/patches/516_tigervnc-xorg-manpages.patch b/contrib/packages/deb/ubuntu-trusty/debian/patches/516_tigervnc-xorg-manpages.patch deleted file mode 100644 index 4575f6a..0000000 --- a/contrib/packages/deb/ubuntu-trusty/debian/patches/516_tigervnc-xorg-manpages.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/unix/xserver/man/Makefile.am 2013-03-30 17:51:01.707258746 -0400 -+++ b/unix/xserver/man/Makefile.am 2013-03-30 17:51:47.606569692 -0400 -@@ -2,5 +2,7 @@ - # (i.e. those handled in the os/utils.c options processing instead of in - # the DDX-level options processing) - -+if ENABLE_DOCS - include $(top_srcdir)/manpages.am - appman_PRE = Xserver.man -+endif ENABLE_DOCS diff --git a/contrib/packages/deb/ubuntu-trusty/debian/patches/debian_libtool.patch b/contrib/packages/deb/ubuntu-trusty/debian/patches/debian_libtool.patch deleted file mode 100644 index 7be0ba2..0000000 --- a/contrib/packages/deb/ubuntu-trusty/debian/patches/debian_libtool.patch +++ /dev/null @@ -1,52 +0,0 @@ ---- a/ltmain.sh 2016-05-11 23:23:25.796742323 -0400 -+++ b/ltmain.sh 2016-05-11 23:24:47.173010324 -0400 -@@ -6447,6 +6447,9 @@ - # It is a libtool convenience library, so add in its objects. - func_append convenience " $ladir/$objdir/$old_library" - func_append old_convenience " $ladir/$objdir/$old_library" -+ elif test "$linkmode" != prog && test "$linkmode" != lib; then -+ func_fatal_error "\`$lib' is not a convenience library" -+ fi - tmp_libs= - for deplib in $dependency_libs; do - deplibs="$deplib $deplibs" -@@ -6457,9 +6460,6 @@ - fi - func_append tmp_libs " $deplib" - done -- elif test "$linkmode" != prog && test "$linkmode" != lib; then -- func_fatal_error "\`$lib' is not a convenience library" -- fi - continue - fi # $pass = conv - ---- a/m4/libtool.m4 2016-05-11 23:26:23.801328557 -0400 -+++ b/m4/libtool.m4 2016-05-11 23:27:12.701489603 -0400 -@@ -4589,9 +4589,6 @@ - ;; - esac - ;; -- linux* | k*bsd*-gnu | gnu*) -- _LT_TAGVAR(link_all_deplibs, $1)=no -- ;; - *) - _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - ;; -@@ -4654,9 +4651,6 @@ - openbsd*) - with_gnu_ld=no - ;; -- linux* | k*bsd*-gnu | gnu*) -- _LT_TAGVAR(link_all_deplibs, $1)=no -- ;; - esac - - _LT_TAGVAR(ld_shlibs, $1)=yes -@@ -5055,7 +5049,6 @@ - if test "$aix_use_runtimelinking" = yes; then - shared_flag="$shared_flag "'${wl}-G' - fi -- _LT_TAGVAR(link_all_deplibs, $1)=no - else - # not using gcc - if test "$host_cpu" = ia64; then diff --git a/contrib/packages/deb/ubuntu-trusty/debian/patches/series b/contrib/packages/deb/ubuntu-trusty/debian/patches/series deleted file mode 100644 index b57b12a..0000000 --- a/contrib/packages/deb/ubuntu-trusty/debian/patches/series +++ /dev/null @@ -1,8 +0,0 @@ -## Patches with a number < 100 are applied in debian. -## Ubuntu patches start with 100. - -# Ubuntu patches -100_rethrow_signals.patch - -# Upstream patches -516_tigervnc-xorg-manpages.patch diff --git a/contrib/packages/deb/ubuntu-trusty/debian/rules b/contrib/packages/deb/ubuntu-trusty/debian/rules deleted file mode 100755 index 08e974c..0000000 --- a/contrib/packages/deb/ubuntu-trusty/debian/rules +++ /dev/null @@ -1,284 +0,0 @@ -#!/usr/bin/make -f -# Sample debian/rules that uses debhelper. -# GNU copyright 1997 by Joey Hess. -export DEB_BUILD_MAINT_OPTIONS=hardening=+all - -CFLAGS := $(shell dpkg-buildflags --get CFLAGS) -CPPFLAGS := $(shell dpkg-buildflags --get CPPFLAGS) -CXXFLAGS := $(shell dpkg-buildflags --get CXXFLAGS) -LDFLAGS := $(shell dpkg-buildflags --get LDFLAGS) - -export CFLAGS CPPFLAGS CXXFLAGS LDFLAGS - -# Uncomment this to turn on verbose mode. -#export DH_VERBOSE=1 - -# These are used for cross-compiling and for saving the configure script -# from having to guess our platform (since we know it already) -#DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) -#DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) -DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) -DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH) -DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) -DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) -DEB_HOST_ARCH_OS ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_OS) -ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE)) - confflags += --build=$(DEB_HOST_GNU_TYPE) -else - confflags += --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE) -endif -SOURCE_NAME := tigervnc -SOURCE_VERSION := $(shell dpkg-parsechangelog | awk -F': ' '/^Version: / {print $$2}') -BUILDER=For technical support please see http://sourceforge.net/projects/tigervnc/support -libdir = /usr/lib/$(DEB_HOST_MULTIARCH) - - -ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS))) - CFLAGS += -g -O2 -fPIC -endif -ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) - INSTALL_PROGRAM += -s -endif - -export CC = gcc - -XCFLAGS = -Wall -Wunused -Wno-format-y2k -fPIE -fno-strict-aliasing - -get-orig-source: $(SOURCE_NAME)_$(SOURCE_VERSION).orig.tar.gz - @ - -$(SOURCE_NAME)_$(SOURCE_VERSION).orig.tar.gz: - $(CURDIR)/get-orig-source.sh - -configure: config-stamp -config-stamp: - dh_testdir - # Add here commands to configure the package. - (cd fltk-*;DSOFLAGS="$(filter-out -fPIE -pie,$(LDFLAGS))" \ - ./configure --enable-shared=no --enable-cairo --enable-cp936 \ - --with-optim="$(CFLAGS) $(XCFLAGS)" --libdir=$(libdir);make) - cmake -G"Unix Makefiles" \ - -DBUILD_STATIC=off \ - -DCMAKE_INSTALL_PREFIX=/usr \ - -DFLTK_LIBRARIES="$(CURDIR)/fltk-1.3.3/lib/libfltk.a;$(CURDIR)/fltk-1.3.3/lib/libfltk_images.a;-lpng" \ - -DFLTK_INCLUDE_DIR=$(CURDIR)/fltk-1.3.3 - (cd unix/xserver; \ - export PIXMANINCDIR=/usr/include/pixman-1; \ - autoreconf -fiv; \ - patch -p1 -i ../../debian/patches/debian_libtool.patch; \ - ./configure --prefix=/usr \ - --disable-silent-rules \ - --disable-static \ - --without-dtrace \ - --disable-strict-compilation \ - --disable-debug \ - --disable-unit-tests \ - --with-int10=x86emu \ - --with-extra-module-dir="/usr/lib/${DEB_HOST_MULTIARCH}/xorg/extra-modules,/usr/lib/xorg/extra-modules" \ - --with-os-vendor="$(VENDOR)" \ - --with-builderstring="$(SOURCE_NAME) $(SOURCE_VERSION) ($(BUILDER))" \ - --with-xkb-path=/usr/share/X11/xkb \ - --with-xkb-output=/var/lib/xkb \ - --with-default-xkb-rules=evdev \ - --disable-devel-docs \ - --disable-install-libxf86config \ - --enable-mitshm \ - --enable-xres \ - --disable-xcsecurity \ - --disable-xcalibrate \ - --disable-tslib \ - --enable-dbe \ - --disable-xf86bigfont \ - --disable-dpms \ - --disable-config-dbus \ - --disable-config-hal \ - --disable-config-udev \ - --disable-xorg \ - --disable-xquartz \ - --disable-xwin \ - --disable-xfake \ - --disable-install-setuid \ - --enable-gestures \ - --with-default-font-path="/usr/share/fonts/X11/misc,/usr/share/fonts/X11/cyrillic,/usr/share/fonts/X11/100dpi/:unscaled,/usr/share/fonts/X11/75dpi/:unscaled,/usr/share/fonts/X11/Type1,/usr/share/fonts/X11/100dpi,/usr/share/fonts/X11/75dpi,/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType,built-ins" \ - --enable-aiglx \ - --enable-glx-tls \ - --enable-registry \ - --enable-composite \ - --enable-record \ - --enable-xv \ - --enable-xvmc \ - --enable-dga \ - --enable-screensaver \ - --enable-xdmcp \ - --enable-xdm-auth-1 \ - --enable-glx \ - --disable-dri --enable-dri2 --enable-dri3 \ - --enable-xinerama \ - --enable-xf86vidmode \ - --enable-xace \ - --disable-selinux \ - --enable-xfree86-utils \ - --disable-dmx \ - --disable-xvfb \ - --disable-xnest \ - --disable-kdrive \ - --disable-xephyr \ - --enable-xfbdev \ - --with-sha1=libgcrypt \ - --enable-xcsecurity \ - --disable-docs \ - --disable-selective-werror) - touch config-stamp - -build-arch: config-stamp build-arch-stamp -build-arch-stamp: - dh_testdir - - # Add here command to compile/build the package. - # Build first things. - # Build Xvnc - make LDFLAGS="-lpng" - (cd unix/xserver;make) - - touch build-arch-stamp - -build-indep: config-stamp build-indep-stamp -build-indep-stamp: - dh_testdir - - # Add here command to compile/build the arch indep package. - # It's ok not to do anything here, if you don't need to build - # anything for this package. - #/usr/bin/docbook-to-man debian/vnc.sgml > vnc.1 - (cd media;make) - (cd java;cmake -G"Unix Makefiles";make) - - touch build-indep-stamp - -build: build-arch build-indep - -clean: - dh_testdir - dh_testroot - rm -f build-arch-stamp build-indep-stamp config-stamp - - # Add here commands to clean up after the build process. - dh_clean - -install: DH_OPTIONS= -install: build - dh_testdir - dh_testroot - dh_clean -k - dh_prep - dh_installdirs - # Add here commands to install the package into debian/vnc. - # tigervncserver - make install DESTDIR=$(CURDIR)/debian/tigervncserver - (cd unix/xserver/hw/vnc; make install DESTDIR=$(CURDIR)/debian/tigervncserver) - mv $(CURDIR)/debian/tigervncserver/usr/bin/Xvnc \ - $(CURDIR)/debian/tigervncserver/usr/bin/Xtigervnc - mv $(CURDIR)/debian/tigervncserver/usr/bin/vncconfig \ - $(CURDIR)/debian/tigervncserver/usr/bin/tigervncconfig - mv $(CURDIR)/debian/tigervncserver/usr/bin/vncpasswd \ - $(CURDIR)/debian/tigervncserver/usr/bin/tigervncpasswd - mv $(CURDIR)/debian/tigervncserver/usr/bin/vncserver \ - $(CURDIR)/debian/tigervncserver/usr/bin/tigervncserver - mv $(CURDIR)/debian/tigervncserver/usr/bin/x0vncserver \ - $(CURDIR)/debian/tigervncserver/usr/bin/x0tigervncserver - mv $(CURDIR)/debian/tigervncserver/usr/share/man/man1/vncconfig.1 \ - $(CURDIR)/debian/tigervncserver/usr/share/man/man1/tigervncconfig.1 - mv $(CURDIR)/debian/tigervncserver/usr/share/man/man1/vncpasswd.1 \ - $(CURDIR)/debian/tigervncserver/usr/share/man/man1/tigervncpasswd.1 - mv $(CURDIR)/debian/tigervncserver/usr/share/man/man1/vncserver.1 \ - $(CURDIR)/debian/tigervncserver/usr/share/man/man1/tigervncserver.1 - mv $(CURDIR)/debian/tigervncserver/usr/share/man/man1/x0vncserver.1 \ - $(CURDIR)/debian/tigervncserver/usr/share/man/man1/x0tigervncserver.1 - mv $(CURDIR)/debian/tigervncserver/usr/share/man/man1/Xvnc.1 \ - $(CURDIR)/debian/tigervncserver/usr/share/man/man1/Xtigervnc.1 - mv $(CURDIR)/debian/tigervncserver/usr/share/doc/tigervnc-* \ - $(CURDIR)/debian/tigervncserver/usr/share/doc/tigervncserver - rm $(CURDIR)/debian/tigervncserver/usr/lib/xorg/modules/extensions/libvnc.la - rm $(CURDIR)/debian/tigervncserver/usr/bin/vncviewer - rm $(CURDIR)/debian/tigervncserver/usr/share/man/man1/vncviewer.1 - install -o root -g root -m 755 -D $(CURDIR)/debian/local/vncserver.service \ - $(CURDIR)/debian/tigervncserver/etc/init.d/vncserver - install -o root -g root -m 644 -D $(CURDIR)/debian/local/vncserver.sysconfig \ - $(CURDIR)/debian/tigervncserver/etc/default/vncservers - # xtigervncviewer - (cd vncviewer; make install DESTDIR=$(CURDIR)/debian/xtigervncviewer) - # Install desktop stuff - mv $(CURDIR)/debian/xtigervncviewer/usr/bin/vncviewer \ - $(CURDIR)/debian/xtigervncviewer/usr/bin/xtigervncviewer - mv $(CURDIR)/debian/xtigervncviewer/usr/share/man/man1/vncviewer.1 \ - $(CURDIR)/debian/xtigervncviewer/usr/share/man/man1/xtigervncviewer.1 - # tigervnc-java - mkdir -p $(CURDIR)/debian/tigervnc-java/usr/share - (cd java; make install DESTDIR=$(CURDIR)/debian/tigervnc-java/usr/share) - #dh_movefiles - -# Build architecture-independent files here. -# Pass -i to all debhelper commands in this target to reduce clutter. -binary-indep: build install - -binary-indep-keep: - dh_testdir -i - dh_testroot -i -# dh_installdebconf -i - dh_install - dh_installdocs -i - dh_installexamples -i - dh_installmenu -i -# dh_installlogrotate -i -# dh_installemacsen -i -# dh_installpam -i -# dh_installmime -i -# dh_installinit -i - dh_installcron -i - dh_installman -i - dh_installinfo -i -# dh_undocumented -i - dh_installchangelogs -i - dh_link -i - dh_compress -i - dh_fixperms -i - dh_installdeb -i - dh_perl -i - dh_gencontrol -i - dh_md5sums -i - dh_builddeb -i - -# Build architecture-dependent files here. -binary-arch: build install - dh_testdir -a - dh_testroot -a -# dh_installdebconf -a - dh_installdocs -a -# dh_installexamples -a - dh_installmenu -a -# dh_installlogrotate -a -# dh_installemacsen -a -# dh_installpam -a -# dh_installmime -a - dh_install - dh_installinit -a -# dh_installcron -a - dh_installman -a - dh_installinfo -a -# dh_undocumented -a - dh_installchangelogs -a - # Remove empty directories - dh_strip -a - dh_link -a - dh_compress -a - dh_fixperms -a - dh_makeshlibs -a - dh_installdeb -a - dh_perl -a - dh_shlibdeps -a - dh_gencontrol -a - dh_md5sums -a - dh_builddeb -a - -binary: binary-indep binary-arch -.PHONY: build clean binary-indep binary-arch binary install get-orig-source diff --git a/contrib/packages/deb/ubuntu-trusty/debian/source/format b/contrib/packages/deb/ubuntu-trusty/debian/source/format deleted file mode 100644 index 163aaf8..0000000 --- a/contrib/packages/deb/ubuntu-trusty/debian/source/format +++ /dev/null @@ -1 +0,0 @@ -3.0 (quilt) diff --git a/contrib/packages/deb/ubuntu-trusty/debian/tigervncserver.postinst b/contrib/packages/deb/ubuntu-trusty/debian/tigervncserver.postinst deleted file mode 100644 index 32e7ea7..0000000 --- a/contrib/packages/deb/ubuntu-trusty/debian/tigervncserver.postinst +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/sh - -set -e - -if [ "$1" = "configure" ]; then - MAN=/usr/share/man/man1 - BIN=/usr/bin - update-alternatives --install \ - $BIN/vncserver vncserver $BIN/tigervncserver 64 \ - --slave \ - $MAN/vncserver.1.gz vncserver.1.gz $MAN/tigervncserver.1.gz - update-alternatives --install \ - $BIN/Xvnc Xvnc $BIN/Xtigervnc 74 \ - --slave \ - $MAN/Xvnc.1.gz Xvnc.1.gz $MAN/Xtigervnc.1.gz - update-alternatives --install \ - $BIN/x0vncserver x0vncserver $BIN/x0tigervncserver 74 \ - --slave \ - $MAN/x0vncserver.1.gz x0vncserver.1.gz $MAN/x0tigervncserver.1.gz - update-alternatives --install \ - $BIN/vncpasswd vncpasswd $BIN/tigervncpasswd 74 \ - --slave \ - $MAN/vncpasswd.1.gz vncpasswd.1.gz $MAN/tigervncpasswd.1.gz - update-alternatives --install \ - $BIN/vncconfig vncconfig $BIN/tigervncconfig 64 \ - --slave \ - $MAN/vncconfig.1.gz vncconfig.1.gz $MAN/tigervncconfig.1.gz -fi - -#DEBHELPER# - -exit 0 diff --git a/contrib/packages/deb/ubuntu-trusty/debian/tigervncserver.prerm b/contrib/packages/deb/ubuntu-trusty/debian/tigervncserver.prerm deleted file mode 100644 index 26608e3..0000000 --- a/contrib/packages/deb/ubuntu-trusty/debian/tigervncserver.prerm +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh - -set -e - -if [ "$1" = "remove" ] ; then - BIN=/usr/bin - update-alternatives --remove \ - vncserver $BIN/tigervncserver - update-alternatives --remove \ - Xvnc $BIN/Xtigervnc - update-alternatives --remove \ - x0vncserver $BIN/x0tigervncserver - update-alternatives --remove \ - vncpasswd $BIN/tigervncpasswd - update-alternatives --remove \ - tigervncconfig $BIN/tigervncconfig -fi - -#DEBHELPER# - -exit 0 diff --git a/contrib/packages/deb/ubuntu-trusty/debian/xtigervncviewer.menu b/contrib/packages/deb/ubuntu-trusty/debian/xtigervncviewer.menu deleted file mode 100644 index aac942c..0000000 --- a/contrib/packages/deb/ubuntu-trusty/debian/xtigervncviewer.menu +++ /dev/null @@ -1,5 +0,0 @@ -?package(xtigervncviewer):needs="x11" \ - section="Applications/Network/Communication" \ - hints="VNC,remote-control"\ - title="xtigervncviewer" \ - command="/usr/bin/xtigervncviewer" diff --git a/contrib/packages/deb/ubuntu-trusty/debian/xtigervncviewer.postinst b/contrib/packages/deb/ubuntu-trusty/debian/xtigervncviewer.postinst deleted file mode 100644 index 4df0c65..0000000 --- a/contrib/packages/deb/ubuntu-trusty/debian/xtigervncviewer.postinst +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh -e - -if [ "$1" = "configure" ]; then - MAN=/usr/share/man/man1 - BIN=/usr/bin - update-alternatives --install \ - $BIN/vncviewer vncviewer $BIN/xtigervncviewer 74 \ - --slave \ - $MAN/vncviewer.1.gz vncviewer.1.gz $MAN/xtigervncviewer.1.gz \ - --slave \ - $MAN/xvncviewer.1.gz xvncviewer.1.gz $MAN/xtigervncviewer.1.gz \ - --slave \ - $BIN/xvncviewer xvncviewer $BIN/xtigervncviewer -fi - -#DEBHELPER# - -exit 0 diff --git a/contrib/packages/deb/ubuntu-trusty/debian/xtigervncviewer.prerm b/contrib/packages/deb/ubuntu-trusty/debian/xtigervncviewer.prerm deleted file mode 100644 index 7a51fd2..0000000 --- a/contrib/packages/deb/ubuntu-trusty/debian/xtigervncviewer.prerm +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh -e - -if [ "$1" = "remove" ] ; then - BIN=/usr/bin - update-alternatives --remove \ - vncviewer $BIN/xtigervncviewer -fi - -#DEBHELPER# - -exit 0 diff --git a/contrib/packages/deb/ubuntu-xenial/debian/changelog b/contrib/packages/deb/ubuntu-xenial/debian/changelog deleted file mode 100644 index bb73e15..0000000 --- a/contrib/packages/deb/ubuntu-xenial/debian/changelog +++ /dev/null @@ -1,38 +0,0 @@ -tigervnc (1.6.80-4) xenial; urgency=low - - * Build using libfltk1.3-dev as provided by ubuntu. - * Build using xorg-server-source as provided by ubuntu. - - -- Dominik Muth Thu, 07 Apr 2016 22:17:09 +0200 - -tigervnc (1.3.0-3ubuntu1) precise; urgency=low - - * Build Xvnc against native upstream xorg sources, using native config - options. Use distro-specific fltk1.3 sources. - - -- Brian P. Hinz Sun, 14 Jul 2013 15:22:28 -0400 - -tigervnc (1.3.0-3) precise; urgency=low - - * Additional dependencies (derived from ldd | dpkg -S). - - -- Brian P. Hinz Sun, 07 Jul 2013 11:01:33 -0400 - -tigervnc (1.3.0-2) precise; urgency=low - - * Added build dependencies to improve font support in viewer. - - -- Brian P. Hinz Sun, 07 Jul 2013 10:44:05 -0400 - -tigervnc (1.3.0-1) precise; urgency=low - - * Removed java viewer from server package. Fixed typo in server - dependencies. - - -- Brian P. Hinz Sun, 07 Jul 2013 09:55:44 -0400 - -tigervnc (1.3.0) precise; urgency=low - - * Initial release. - - -- Brian P. Hinz Fri, 05 Jul 2013 00:47:02 -0400 diff --git a/contrib/packages/deb/ubuntu-xenial/debian/compat b/contrib/packages/deb/ubuntu-xenial/debian/compat deleted file mode 100644 index ec63514..0000000 --- a/contrib/packages/deb/ubuntu-xenial/debian/compat +++ /dev/null @@ -1 +0,0 @@ -9 diff --git a/contrib/packages/deb/ubuntu-xenial/debian/control b/contrib/packages/deb/ubuntu-xenial/debian/control deleted file mode 100644 index c947f45..0000000 --- a/contrib/packages/deb/ubuntu-xenial/debian/control +++ /dev/null @@ -1,70 +0,0 @@ -Source: tigervnc -Section: x11 -Priority: optional -Maintainer: Brian P. Hinz -Standards-Version: 3.8.4 -Build-Depends: debhelper (>> 7.1), zlib1g-dev, libjpeg-turbo8-dev, libxaw7-dev (>> 4.1.0), perl-modules, xfonts-base, xutils-dev, libx11-dev, libxau-dev, libxext-dev, libxi-dev, libxkbfile-dev, libxmu-dev, libxt-dev, x11proto-core-dev, cmake (>> 2.8), libgnutls-dev, libpam0g-dev, libpng12-dev, automake, autoconf, libtool, pkg-config, libpixman-1-dev, x11proto-bigreqs-dev, x11proto-composite-dev, x11proto-damage-dev, x11proto-dri2-dev, x11proto-fixes-dev, x11proto-fonts-dev, x11proto-gl-dev, x11proto-input-dev, x11proto-kb-dev, x11proto-randr-dev, x11proto-render-dev, x11proto-resource-dev, x11proto-scrnsaver-dev, x11proto-video-dev, x11proto-xext-dev, x11proto-xf86bigfont-dev, x11proto-xf86dga-dev, x11proto-xf86dri-dev, x11proto-xf86vidmode-dev, x11proto-xinerama-dev, libosmesa6-dev, libgl1-mesa-dev, libgl1-mesa-dri, libgl1-mesa-glx, libxfont-dev, x11proto-record-dev, default-jdk, libxtst-dev, libxft-dev, libexpat1-dev, libfontconfig1-dev, libxrender-dev, libpciaccess-dev, curl, bzip2, quilt, libglu1-mesa-dev, libxcursor-dev, libxinerama-dev, libxfixes-dev, libcairo2-dev, x11proto-dri3-dev, libgcrypt20-dev, x11proto-xcmisc-dev, x11proto-present-dev, xorg-server-source, libfltk1.3-dev, fluid -Homepage: http://www.tigervnc.com - -Package: tigervncserver -Architecture: any -Provides: xserver, vnc-server -Depends: x11-common | xserver-common, x11-utils, xauth, libbz2-1.0, libc6, libfontenc1, libfreetype6, libgcc1, libgl1-mesa-dri, libgnutls30, libjpeg-turbo8, libp11-kit0, libpam0g, libpixman-1-0, libstdc++6, libtasn1-3-bin, libx11-6, libxau6, libxcb1, libxdmcp6, libxext6, libxfont1, libxfont1-dev, libxtst6, zlib1g, libglu1-mesa, libxcursor1, libxinerama1, libxfixes3, x11-xkb-utils, libgcrypt20 -Recommends: xfonts-base, x11-xserver-utils -Suggests: xtigervncviewer, tigervnc-java -Description: virtual network computing server software - Virtual Network Computing (VNC) is a remote display system which allows you to - view and interact with a virtual desktop environment that is running on another - computer on the network. Using VNC, you can run graphical applications on a - remote machine and send only the display from these applications to your local - machine. VNC is platform-independent and supports a wide variety of operating - systems and architectures as both servers and clients. - . - TigerVNC is a high-speed version of VNC based on the RealVNC 4 and X.org code - bases. TigerVNC started as a next-generation development effort for TightVNC - on Unix and Linux platforms, but it split from its parent project in early 2009 - so that TightVNC could focus on Windows platforms. TigerVNC supports a variant - of Tight encoding that is greatly accelerated by the use of the libjpeg-turbo - JPEG codec. - -Package: xtigervncviewer -Architecture: any -Provides: vncviewer, vnc-viewer -Depends: libc6, libexpat1, libfontconfig1, libfreetype6, libgcc1, libgnutls30, libjpeg-turbo8, libp11-kit0, libpng12-0, libstdc++6, libtasn1-3-bin, libx11-6, libxau6, libxcb1, libxdmcp6, libxext6, libxft2, libxrender1, zlib1g, libglu1-mesa, libxcursor1, libxinerama1, libxfixes3, libfltk1.3, libfltk-images1.3 -Recommends: xfonts-base -Suggests: tigervncserver, ssh -Description: virtual network computing client software for X - Virtual Network Computing (VNC) is a remote display system which allows you to - view and interact with a virtual desktop environment that is running on another - computer on the network. Using VNC, you can run graphical applications on a - remote machine and send only the display from these applications to your local - machine. VNC is platform-independent and supports a wide variety of operating - systems and architectures as both servers and clients. - . - TigerVNC is a high-speed version of VNC based on the RealVNC 4 and X.org code - bases. TigerVNC started as a next-generation development effort for TightVNC - on Unix and Linux platforms, but it split from its parent project in early 2009 - so that TightVNC could focus on Windows platforms. TigerVNC supports a variant - of Tight encoding that is greatly accelerated by the use of the libjpeg-turbo - JPEG codec. - -Package: tigervnc-java -Architecture: any -Suggests: tigervncserver -Provides: vncviewer, vnc-viewer -Depends: default-jre -Description: TigerVNC java applet - Virtual Network Computing (VNC) is a remote display system which allows you to - view and interact with a virtual desktop environment that is running on another - computer on the network. Using VNC, you can run graphical applications on a - remote machine and send only the display from these applications to your local - machine. VNC is platform-independent and supports a wide variety of operating - systems and architectures as both servers and clients. - . - TigerVNC is a high-speed version of VNC based on the RealVNC 4 and X.org code - bases. TigerVNC started as a next-generation development effort for TightVNC - on Unix and Linux platforms, but it split from its parent project in early 2009 - so that TightVNC could focus on Windows platforms. TigerVNC supports a variant - of Tight encoding that is greatly accelerated by the use of the libjpeg-turbo - JPEG codec. - diff --git a/contrib/packages/deb/ubuntu-xenial/debian/copyright b/contrib/packages/deb/ubuntu-xenial/debian/copyright deleted file mode 100644 index 912e5c3..0000000 --- a/contrib/packages/deb/ubuntu-xenial/debian/copyright +++ /dev/null @@ -1,116 +0,0 @@ -This package was packaged for Debian by Brian P. Hinz -on Tue, 02 Jul 2013 21:33:24 +0500 using the tightvnc package as a base. - -It was downloaded from: - http://www.tigervnc.org/ - -COPYRIGHT: -========== - -TigerVNC is - - Copyright (C) 1999 AT&T Laboratories Cambridge - Copyright (C) 2002-2005 RealVNC Ltd. - Copyright (C) 2000-2006 TightVNC Group - Copyright (C) 2005-2006 Martin Koegler - Copyright (C) 2005-2006 Sun Microsystems, Inc. - Copyright (C) 2006 OCCAM Financial Technology - Copyright (C) 2000-2008 Constantin Kaplinsky - Copyright (C) 2004-2009 Peter Astrand for Cendio AB - Copyright (C) 2010 Antoine Martin - Copyright (C) 2010 m-privacy GmbH - Copyright (C) 2009-2011 D. R. Commander - Copyright (C) 2009-2011 Pierre Ossman for Cendio AB - Copyright (C) 2004, 2009-2011 Red Hat, Inc. - Copyright (C) 2009-2011 TigerVNC Team - All Rights Reserved. - -This software is distributed under the GNU General Public Licence as published -by the Free Software Foundation. See the file LICENSE.TXT for the conditions -under which this software is made available. TigerVNC also contains code from -other sources. See the Acknowledgements section below, and the individual -source files, for details of the conditions under which they are made -available. - -ACKNOWLEDGEMENTS -================ - -This distribution contains zlib compression software. This is: - - Copyright (C) 1995-2002 Jean-loup Gailly and Mark Adler - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. - - Jean-loup Gailly Mark Adler - jloup@gzip.org madler@alumni.caltech.edu - - The data format used by the zlib library is described by RFCs (Request for - Comments) 1950 to 1952 in the files ftp://ds.internic.net/rfc/rfc1950.txt - (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format). - - -This distribution contains public domain DES software by Richard Outerbridge. -This is: - - Copyright (c) 1988,1989,1990,1991,1992 by Richard Outerbridge. - (GEnie : OUTER; CIS : [71755,204]) Graven Imagery, 1992. - - -This distribution contains software from the X Window System. This is: - - Copyright 1987, 1988, 1998 The Open Group - - Permission to use, copy, modify, distribute, and sell this software and its - documentation for any purpose is hereby granted without fee, provided that - the above copyright notice appear in all copies and that both that - copyright notice and this permission notice appear in supporting - documentation. - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - Except as contained in this notice, the name of The Open Group shall not be - used in advertising or otherwise to promote the sale, use or other dealings - in this Software without prior written authorization from The Open Group. - - - Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - - Permission to use, copy, modify, and distribute this software and its - documentation for any purpose and without fee is hereby granted, - provided that the above copyright notice appear in all copies and that - both that copyright notice and this permission notice appear in - supporting documentation, and that the name of Digital not be - used in advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL - DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR - ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, - ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - SOFTWARE. diff --git a/contrib/packages/deb/ubuntu-xenial/debian/local/vncserver.service b/contrib/packages/deb/ubuntu-xenial/debian/local/vncserver.service deleted file mode 100644 index 86a8a91..0000000 --- a/contrib/packages/deb/ubuntu-xenial/debian/local/vncserver.service +++ /dev/null @@ -1,94 +0,0 @@ -#!/bin/bash -# -# Init file for TigerVNC Server -# -# chkconfig: - 91 35 -# description: TigerVNC remote X administration daemon. -# -# processname: Xvnc - -### BEGIN INIT INFO -# Provides: vncservers -# Required-Start: networking -# Required-Stop: networking -# Default-Start: -# Default-Stop: 0 1 2 3 4 5 6 -# Short-Description: Starts and stops vncserver -# Description: Used to provide remote X administration services. -### END INIT INFO - -# Source function library. -. /lib/lsb/init-functions - -### Default variables -SYSCONFIG="/etc/default/vncservers" -VNCSERVERS="" - -### Read configuration -[ -r "$SYSCONFIG" ] && . "$SYSCONFIG" - -RETVAL=0 -prog=$"VNC server" - -start() { - echo -n $"Starting $prog: " - ulimit -S -c 0 >/dev/null 2>&1 - for display in ${VNCSERVERS}; do - echo -n "${display} " - if [ -r $(eval echo ~${display##*:})/.vnc/passwd ]; then - unset BASH_ENV ENV - log_begin_msg "Starting VNC Server for user ${display##*:}:" - su ${display##*:} -c "cd ~${display##*:} && [ -f .vnc/passwd ] && vncserver :${display%%:*} ${VNCSERVERARGS[${display%:*}]}" - RETVAL="$?" - if [ "$RETVAL" -ne 0 ]; then - log_end_msg 1 - break - else - log_end_msg 0 - fi - else - log_begin_msg "Not starting VNC Server for user ${display##*:}.\n File \"~${display##*:}/.vnc/passwd\" not found.\n Create a password file for the VNC server with vncpasswd" - log_end_msg 1 - fi - done - echo - [ "$RETVAL" -eq 0 ] && touch "/var/lock/vncserver" - return $RETVAL -} - -stop() { - echo -n $"Shutting down $desc: " - for display in ${VNCSERVERS}; do - echo -n "${display} " - unset BASH_ENV ENV - log_begin_msg "Shutting down VNC Server for user ${display##*:}: " - su ${display##*:} -c "vncserver -kill :${display%%:*}" >/dev/null 2>&1 - RETVAL="$?" - [ "$RETVAL" -eq 0 ] && log_end_msg 0 || log_end_msg 1 - done - echo - [ "$RETVAL" -eq 0 ] && rm -f "/var/lock/vncserver" - return $RETVAL -} - -restart() { - stop - start -} - -case "$1" in - start) - start - ;; - stop) - stop - ;; - restart|reload) - restart - ;; - *) - echo $"Usage: $0 {start|stop|restart}" - RETVAL=1 -esac - -exit $RETVAL diff --git a/contrib/packages/deb/ubuntu-xenial/debian/local/vncserver.sysconfig b/contrib/packages/deb/ubuntu-xenial/debian/local/vncserver.sysconfig deleted file mode 100644 index d18d0f1..0000000 --- a/contrib/packages/deb/ubuntu-xenial/debian/local/vncserver.sysconfig +++ /dev/null @@ -1,19 +0,0 @@ -# The VNCSERVERS variable is a list of display:user pairs. -# -# Uncomment the lines below to start a VNC server on display :2 -# as my 'myusername' (adjust this to your own). You will also -# need to set a VNC password; run 'man vncpasswd' to see how -# to do that. -# -# DO NOT RUN THIS SERVICE if your local area network is -# untrusted! For a secure way of using VNC, see this URL: -# http://kbase.redhat.com/faq/docs/DOC-7028 - -# Use "-nolisten tcp" to prevent X connections to your VNC server via TCP. - -# Use "-localhost" to prevent remote VNC clients connecting except when -# doing so through a secure tunnel. See the "-via" option in the -# `man vncviewer' manual page. - -# VNCSERVERS="2:myusername" -# VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -localhost" diff --git a/contrib/packages/deb/ubuntu-xenial/debian/rules b/contrib/packages/deb/ubuntu-xenial/debian/rules deleted file mode 100644 index 531a1c4..0000000 --- a/contrib/packages/deb/ubuntu-xenial/debian/rules +++ /dev/null @@ -1,286 +0,0 @@ -#!/usr/bin/make -f -# Sample debian/rules that uses debhelper. -# GNU copyright 1997 by Joey Hess. -export DEB_BUILD_MAINT_OPTIONS=hardening=+all - -CFLAGS := $(shell dpkg-buildflags --get CFLAGS) -CPPFLAGS := $(shell dpkg-buildflags --get CPPFLAGS) -CXXFLAGS := $(shell dpkg-buildflags --get CXXFLAGS) -LDFLAGS := $(shell dpkg-buildflags --get LDFLAGS) - -export CFLAGS CPPFLAGS CXXFLAGS LDFLAGS - -# Uncomment this to turn on verbose mode. -#export DH_VERBOSE=1 - -DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) -DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH) -DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) -DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) -DEB_HOST_ARCH_OS ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_OS) -ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE)) - confflags += --build=$(DEB_HOST_GNU_TYPE) -else - confflags += --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE) -endif -SOURCE_NAME := tigervnc -SOURCE_VERSION := $(shell dpkg-parsechangelog | awk -F': ' '/^Version: / {print $$2}') -BUILDER=For technical support please see http://sourceforge.net/projects/tigervnc/support -libdir = /usr/lib/$(DEB_HOST_MULTIARCH) - - -ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS))) - CFLAGS += -g -O2 -fPIC -endif -ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) - INSTALL_PROGRAM += -s -endif - -export CC = gcc - -# use xorg sources as shipped in xorg-server-source package -XORG_SOURCE_ARCHIVE = /usr/src/xorg-server.tar.xz - -xorg-source-stamp: $(XORG_SOURCE_ARCHIVE) - tar -C unix/xserver -axf $(XORG_SOURCE_ARCHIVE) --strip-components=1 - patch -p1 < debian/xorg-source-patches/xserver118-patch.patch - cd unix/xserver && patch -p1 < ../xserver118.patch - patch -p1 < debian/xorg-source-patches/100_rethrow_signals.patch - patch -p1 < debian/xorg-source-patches/516_tigervnc-xorg-manpages.patch - touch xorg-source-stamp - -configure: config-stamp -config-stamp: xorg-source-stamp - dh_testdir - # Add here commands to configure the package. - cmake -G"Unix Makefiles" \ - -DBUILD_STATIC=off \ - -DCMAKE_INSTALL_PREFIX=/usr - (cd unix/xserver; \ - export PIXMANINCDIR=/usr/include/pixman-1; \ - autoreconf -fiv; \ - patch -p1 -i ../../debian/xorg-source-patches/debian_libtool.patch; \ - ./configure --prefix=/usr \ - --disable-silent-rules \ - --disable-static \ - --without-dtrace \ - --disable-strict-compilation \ - --disable-debug \ - --disable-unit-tests \ - --with-int10=x86emu \ - --with-extra-module-dir="/usr/lib/${DEB_HOST_MULTIARCH}/xorg/extra-modules,/usr/lib/xorg/extra-modules" \ - --with-os-vendor="$(VENDOR)" \ - --with-builderstring="$(SOURCE_NAME) $(SOURCE_VERSION) ($(BUILDER))" \ - --with-xkb-path=/usr/share/X11/xkb \ - --with-xkb-output=/var/lib/xkb \ - --with-default-xkb-rules=evdev \ - --disable-devel-docs \ - --enable-mitshm \ - --enable-xres \ - --disable-xcsecurity \ - --disable-tslib \ - --enable-dbe \ - --disable-xf86bigfont \ - --disable-dpms \ - --disable-config-hal \ - --disable-config-udev \ - --disable-xorg \ - --disable-xquartz \ - --disable-xwin \ - --disable-xfake \ - --disable-install-setuid \ - --with-default-font-path="/usr/share/fonts/X11/misc,/usr/share/fonts/X11/cyrillic,/usr/share/fonts/X11/100dpi/:unscaled,/usr/share/fonts/X11/75dpi/:unscaled,/usr/share/fonts/X11/Type1,/usr/share/fonts/X11/100dpi,/usr/share/fonts/X11/75dpi,/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType,built-ins" \ - --enable-aiglx \ - --enable-composite \ - --enable-record \ - --enable-xv \ - --enable-xvmc \ - --enable-dga \ - --enable-screensaver \ - --enable-xdmcp \ - --enable-xdm-auth-1 \ - --enable-glx \ - --disable-dri --enable-dri2 --enable-dri3 \ - --enable-xinerama \ - --enable-xf86vidmode \ - --enable-xace \ - --enable-xfree86-utils \ - --disable-dmx \ - --disable-xvfb \ - --disable-xnest \ - --disable-kdrive \ - --disable-xephyr \ - --enable-xfbdev \ - --with-sha1=libgcrypt \ - --enable-xcsecurity \ - --disable-docs \ - --disable-selective-werror) - touch config-stamp - -build-arch: config-stamp build-arch-stamp -build-arch-stamp: - dh_testdir - - # Add here command to compile/build the package. - # Build first things. - # Build Xvnc - make LDFLAGS="-lpng" - (cd unix/xserver;make) - - touch build-arch-stamp - -build-indep: config-stamp build-indep-stamp -build-indep-stamp: - dh_testdir - - # Add here command to compile/build the arch indep package. - # It's ok not to do anything here, if you don't need to build - # anything for this package. - #/usr/bin/docbook-to-man debian/vnc.sgml > vnc.1 - (cd media;make) - (cd java;cmake -G"Unix Makefiles";make) - - touch build-indep-stamp - -build: build-arch build-indep - -clean: - dh_testdir - dh_testroot - rm -f build-arch-stamp build-indep-stamp config-stamp - - # Add here commands to clean up after the build process. - dh_clean - -install: DH_OPTIONS= -install: build - dh_testdir - dh_testroot - dh_clean -k - dh_prep - dh_installdirs - # Add here commands to install the package into debian/vnc. - make install DESTDIR=$(CURDIR)/debian/tigervncserver - (cd unix/xserver/hw/vnc; make install DESTDIR=$(CURDIR)/debian/tigervncserver) - # rename server files to tigervnc specific names - mv $(CURDIR)/debian/tigervncserver/usr/bin/Xvnc \ - $(CURDIR)/debian/tigervncserver/usr/bin/Xtigervnc - mv $(CURDIR)/debian/tigervncserver/usr/bin/vncconfig \ - $(CURDIR)/debian/tigervncserver/usr/bin/tigervncconfig - mv $(CURDIR)/debian/tigervncserver/usr/bin/vncpasswd \ - $(CURDIR)/debian/tigervncserver/usr/bin/tigervncpasswd - mv $(CURDIR)/debian/tigervncserver/usr/bin/vncserver \ - $(CURDIR)/debian/tigervncserver/usr/bin/tigervncserver - mv $(CURDIR)/debian/tigervncserver/usr/bin/x0vncserver \ - $(CURDIR)/debian/tigervncserver/usr/bin/x0tigervncserver - mv $(CURDIR)/debian/tigervncserver/usr/share/man/man1/vncconfig.1 \ - $(CURDIR)/debian/tigervncserver/usr/share/man/man1/tigervncconfig.1 - mv $(CURDIR)/debian/tigervncserver/usr/share/man/man1/vncpasswd.1 \ - $(CURDIR)/debian/tigervncserver/usr/share/man/man1/tigervncpasswd.1 - mv $(CURDIR)/debian/tigervncserver/usr/share/man/man1/vncserver.1 \ - $(CURDIR)/debian/tigervncserver/usr/share/man/man1/tigervncserver.1 - mv $(CURDIR)/debian/tigervncserver/usr/share/man/man1/x0vncserver.1 \ - $(CURDIR)/debian/tigervncserver/usr/share/man/man1/x0tigervncserver.1 - mv $(CURDIR)/debian/tigervncserver/usr/share/man/man1/Xvnc.1 \ - $(CURDIR)/debian/tigervncserver/usr/share/man/man1/Xtigervnc.1 - # delete development files - rm -f $(CURDIR)/debian/tigervncserver/usr/lib/xorg/modules/extensions/libvnc.la - # install server service - install -o root -g root -m 755 -D $(CURDIR)/debian/local/vncserver.service \ - $(CURDIR)/debian/tigervncserver/etc/init.d/vncserver - install -o root -g root -m 644 -D $(CURDIR)/debian/local/vncserver.sysconfig \ - $(CURDIR)/debian/tigervncserver/etc/default/vncservers - # move viewer files to viewer package, rename on the fly - mkdir -p $(CURDIR)/debian/xtigervncviewer/usr/bin - mv $(CURDIR)/debian/tigervncserver/usr/bin/vncviewer \ - $(CURDIR)/debian/xtigervncviewer/usr/bin/xtigervncviewer - mkdir -p $(CURDIR)/debian/xtigervncviewer/usr/share/man/man1 - mv $(CURDIR)/debian/tigervncserver/usr/share/man/man1/vncviewer.1 \ - $(CURDIR)/debian/xtigervncviewer/usr/share/man/man1/xtigervncviewer.1 - mkdir -p $(CURDIR)/debian/xtigervncviewer/usr/share - mv $(CURDIR)/debian/tigervncserver/usr/share/applications \ - $(CURDIR)/debian/xtigervncviewer/usr/share/ - mkdir -p $(CURDIR)/debian/xtigervncviewer/usr/share - mv $(CURDIR)/debian/tigervncserver/usr/share/icons \ - $(CURDIR)/debian/xtigervncviewer/usr/share/ - # tigervnc-java - mkdir -p $(CURDIR)/debian/tigervnc-java/usr/share - (cd java; make install DESTDIR=$(CURDIR)/debian/tigervnc-java/usr/share) - # install additional license files - mkdir -p $(CURDIR)/debian/xtigervncviewer/usr/share/doc/xtigervncviewer - cp $(CURDIR)/debian/tigervncserver/usr/share/doc/tigervnc-*/* \ - $(CURDIR)/debian/xtigervncviewer/usr/share/doc/xtigervncviewer/ - mkdir -p $(CURDIR)/debian/tigervnc-java/usr/share/doc/tigervnc-java - cp $(CURDIR)/debian/tigervncserver/usr/share/doc/tigervnc-*/* \ - $(CURDIR)/debian/tigervnc-java/usr/share/doc/tigervnc-java/ - mkdir -p $(CURDIR)/debian/tigervncserver/usr/share/doc/tigervncserver - mv $(CURDIR)/debian/tigervncserver/usr/share/doc/tigervnc-*/* \ - $(CURDIR)/debian/tigervncserver/usr/share/doc/tigervncserver/ - rm -rf $(CURDIR)/debian/tigervncserver/usr/share/doc/tigervnc-*/ -# dh_movefiles - -# Build architecture-independent files here. -# Pass -i to all debhelper commands in this target to reduce clutter. -binary-indep: build install - -binary-indep-keep: - dh_testdir -i - dh_testroot -i -# dh_installdebconf -i - dh_install - dh_installdocs -i - dh_installexamples -i - dh_installmenu -i -# dh_installlogrotate -i -# dh_installemacsen -i -# dh_installpam -i -# dh_installmime -i -# dh_installinit -i - dh_installcron -i - dh_installman -i - dh_installinfo -i -# dh_undocumented -i - dh_installchangelogs -i - dh_link -i - dh_compress -i - dh_fixperms -i - dh_installdeb -i - dh_perl -i - dh_gencontrol -i - dh_md5sums -i - dh_builddeb -i - -# Build architecture-dependent files here. -binary-arch: build install - dh_testdir -a - dh_testroot -a -# dh_installdebconf -a - dh_installdocs -a -# dh_installexamples -a - dh_installmenu -a -# dh_installlogrotate -a -# dh_installemacsen -a -# dh_installpam -a -# dh_installmime -a - dh_install - dh_installinit -a -# dh_installcron -a - dh_installman -a - dh_installinfo -a -# dh_undocumented -a - dh_installchangelogs -a - # Remove empty directories - dh_strip -a - dh_link -a - dh_compress -a - dh_fixperms -a - dh_makeshlibs -a - dh_installdeb -a - dh_perl -a - dh_shlibdeps -a - dh_gencontrol -a - dh_md5sums -a - dh_builddeb -a - -binary: binary-indep binary-arch -.PHONY: build clean binary-indep binary-arch binary install diff --git a/contrib/packages/deb/ubuntu-xenial/debian/source/format b/contrib/packages/deb/ubuntu-xenial/debian/source/format deleted file mode 100644 index 163aaf8..0000000 --- a/contrib/packages/deb/ubuntu-xenial/debian/source/format +++ /dev/null @@ -1 +0,0 @@ -3.0 (quilt) diff --git a/contrib/packages/deb/ubuntu-xenial/debian/tigervncserver.postinst b/contrib/packages/deb/ubuntu-xenial/debian/tigervncserver.postinst deleted file mode 100644 index 32e7ea7..0000000 --- a/contrib/packages/deb/ubuntu-xenial/debian/tigervncserver.postinst +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/sh - -set -e - -if [ "$1" = "configure" ]; then - MAN=/usr/share/man/man1 - BIN=/usr/bin - update-alternatives --install \ - $BIN/vncserver vncserver $BIN/tigervncserver 64 \ - --slave \ - $MAN/vncserver.1.gz vncserver.1.gz $MAN/tigervncserver.1.gz - update-alternatives --install \ - $BIN/Xvnc Xvnc $BIN/Xtigervnc 74 \ - --slave \ - $MAN/Xvnc.1.gz Xvnc.1.gz $MAN/Xtigervnc.1.gz - update-alternatives --install \ - $BIN/x0vncserver x0vncserver $BIN/x0tigervncserver 74 \ - --slave \ - $MAN/x0vncserver.1.gz x0vncserver.1.gz $MAN/x0tigervncserver.1.gz - update-alternatives --install \ - $BIN/vncpasswd vncpasswd $BIN/tigervncpasswd 74 \ - --slave \ - $MAN/vncpasswd.1.gz vncpasswd.1.gz $MAN/tigervncpasswd.1.gz - update-alternatives --install \ - $BIN/vncconfig vncconfig $BIN/tigervncconfig 64 \ - --slave \ - $MAN/vncconfig.1.gz vncconfig.1.gz $MAN/tigervncconfig.1.gz -fi - -#DEBHELPER# - -exit 0 diff --git a/contrib/packages/deb/ubuntu-xenial/debian/tigervncserver.prerm b/contrib/packages/deb/ubuntu-xenial/debian/tigervncserver.prerm deleted file mode 100644 index 26608e3..0000000 --- a/contrib/packages/deb/ubuntu-xenial/debian/tigervncserver.prerm +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh - -set -e - -if [ "$1" = "remove" ] ; then - BIN=/usr/bin - update-alternatives --remove \ - vncserver $BIN/tigervncserver - update-alternatives --remove \ - Xvnc $BIN/Xtigervnc - update-alternatives --remove \ - x0vncserver $BIN/x0tigervncserver - update-alternatives --remove \ - vncpasswd $BIN/tigervncpasswd - update-alternatives --remove \ - tigervncconfig $BIN/tigervncconfig -fi - -#DEBHELPER# - -exit 0 diff --git a/contrib/packages/deb/ubuntu-xenial/debian/xorg-source-patches/100_rethrow_signals.patch b/contrib/packages/deb/ubuntu-xenial/debian/xorg-source-patches/100_rethrow_signals.patch deleted file mode 100644 index b40b148..0000000 --- a/contrib/packages/deb/ubuntu-xenial/debian/xorg-source-patches/100_rethrow_signals.patch +++ /dev/null @@ -1,26 +0,0 @@ ---- a/unix/xserver/hw/vnc/xvnc.c 2013-07-14 14:05:29.963390223 -0400 -+++ b/unix/xserver/hw/vnc/xvnc.c 2013-07-14 14:04:12.840357191 -0400 -@@ -250,7 +250,7 @@ - #if XORG < 111 - AbortDDX() - #else --AbortDDX(enum ExitCode error) -+SigAbortDDX(int signo, enum ExitCode error) - #endif - { - #if XORG < 111 -@@ -260,6 +260,14 @@ - #endif - } - -+#if XORG >= 111 -+void -+AbortDDX(enum ExitCode error) -+{ -+ SigAbortDDX(0, error); -+} -+#endif -+ - #ifdef __DARWIN__ - void - DarwinHandleGUI(int argc, char *argv[]) diff --git a/contrib/packages/deb/ubuntu-xenial/debian/xorg-source-patches/516_tigervnc-xorg-manpages.patch b/contrib/packages/deb/ubuntu-xenial/debian/xorg-source-patches/516_tigervnc-xorg-manpages.patch deleted file mode 100644 index 4575f6a..0000000 --- a/contrib/packages/deb/ubuntu-xenial/debian/xorg-source-patches/516_tigervnc-xorg-manpages.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/unix/xserver/man/Makefile.am 2013-03-30 17:51:01.707258746 -0400 -+++ b/unix/xserver/man/Makefile.am 2013-03-30 17:51:47.606569692 -0400 -@@ -2,5 +2,7 @@ - # (i.e. those handled in the os/utils.c options processing instead of in - # the DDX-level options processing) - -+if ENABLE_DOCS - include $(top_srcdir)/manpages.am - appman_PRE = Xserver.man -+endif ENABLE_DOCS diff --git a/contrib/packages/deb/ubuntu-xenial/debian/xorg-source-patches/debian_libtool.patch b/contrib/packages/deb/ubuntu-xenial/debian/xorg-source-patches/debian_libtool.patch deleted file mode 100644 index d24877d..0000000 --- a/contrib/packages/deb/ubuntu-xenial/debian/xorg-source-patches/debian_libtool.patch +++ /dev/null @@ -1,87 +0,0 @@ -Index: a/ltmain.sh -=================================================================== ---- a/ltmain.sh -+++ b/ltmain.sh -@@ -7890,19 +7890,19 @@ - # It is a libtool convenience library, so add in its objects. - func_append convenience " $ladir/$objdir/$old_library" - func_append old_convenience " $ladir/$objdir/$old_library" -- tmp_libs= -- for deplib in $dependency_libs; do -- deplibs="$deplib $deplibs" -- if $opt_preserve_dup_deps; then -- case "$tmp_libs " in -- *" $deplib "*) func_append specialdeplibs " $deplib" ;; -- esac -- fi -- func_append tmp_libs " $deplib" -- done - elif test prog != "$linkmode" && test lib != "$linkmode"; then - func_fatal_error "'$lib' is not a convenience library" - fi -+ tmp_libs= -+ for deplib in $dependency_libs; do -+ deplibs="$deplib $deplibs" -+ if $opt_preserve_dup_deps; then -+ case "$tmp_libs " in -+ *" $deplib "*) func_append specialdeplibs " $deplib" ;; -+ esac -+ fi -+ func_append tmp_libs " $deplib" -+ done - continue - fi # $pass = conv - -## Do not link against deplibs. This is not needed for shared libs -## on atleast ELF systems since those already know which libs they -## need themself. This seems to break a few things and will be fixed -## in a better way in a future upstream version. - -Index: a/ltmain.sh -=================================================================== ---- a/ltmain.sh -+++ b/ltmain.sh -@@ -7568,10 +7568,7 @@ - case $pass in - dlopen) libs=$dlfiles ;; - dlpreopen) libs=$dlprefiles ;; -- link) -- libs="$deplibs %DEPLIBS%" -- test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs" -- ;; -+ link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; - esac - fi - if test lib,dlpreopen = "$linkmode,$pass"; then -Index: a/m4/libtool.m4 -=================================================================== ---- a/m4/libtool.m4 -+++ b/m4/libtool.m4 -@@ -4936,9 +4936,6 @@ - ;; - esac - ;; -- linux* | k*bsd*-gnu | gnu*) -- _LT_TAGVAR(link_all_deplibs, $1)=no -- ;; - *) - _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - ;; -@@ -4998,9 +5001,6 @@ - openbsd* | bitrig*) - with_gnu_ld=no - ;; -- linux* | k*bsd*-gnu | gnu*) -- _LT_TAGVAR(link_all_deplibs, $1)=no -- ;; - esac - - _LT_TAGVAR(ld_shlibs, $1)=yes -@@ -5773,7 +5779,6 @@ - if test yes = "$lt_cv_irix_exported_symbol"; then - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations $wl-exports_file $wl$export_symbols -o $lib' - fi -- _LT_TAGVAR(link_all_deplibs, $1)=no - else - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -exports_file $export_symbols -o $lib' diff --git a/contrib/packages/deb/ubuntu-xenial/debian/xorg-source-patches/xserver118-patch.patch b/contrib/packages/deb/ubuntu-xenial/debian/xorg-source-patches/xserver118-patch.patch deleted file mode 100644 index cba45a3..0000000 --- a/contrib/packages/deb/ubuntu-xenial/debian/xorg-source-patches/xserver118-patch.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- a/unix/xserver118.patch 2016-05-07 15:32:50.000000000 -0400 -+++ b/unix/xserver118.patch 2016-04-28 07:11:31.000000000 -0400 -@@ -48,14 +48,15 @@ - diff -ur xorg-server.orig/hw/Makefile.am xorg-server/hw/Makefile.am - --- xorg-server.orig/hw/Makefile.am 2016-04-09 21:28:27.059999965 +0200 - +++ xorg-server/hw/Makefile.am 2016-04-09 21:28:57.587999860 +0200 --@@ -43,6 +43,7 @@ -+@@ -43,7 +43,8 @@ - $(KDRIVE_SUBDIRS) \ - $(XQUARTZ_SUBDIRS) \ --- $(XWAYLAND_SUBDIRS) --+ $(XWAYLAND_SUBDIRS) \ -+ $(XWAYLAND_SUBDIRS) \ -+- $(XMIR_SUBDIRS) -++ $(XMIR_SUBDIRS) \ - + vnc - -- DIST_SUBDIRS = dmx xfree86 vfb xnest xwin xquartz kdrive xwayland -+ DIST_SUBDIRS = dmx xfree86 vfb xnest xwin xquartz kdrive xwayland xmir - - diff -ur xorg-server.orig/mi/miinitext.c xorg-server/mi/miinitext.c - --- xorg-server.orig/mi/miinitext.c 2016-04-09 21:28:27.015999965 +0200 diff --git a/contrib/packages/deb/ubuntu-xenial/debian/xtigervncviewer.menu b/contrib/packages/deb/ubuntu-xenial/debian/xtigervncviewer.menu deleted file mode 100644 index aac942c..0000000 --- a/contrib/packages/deb/ubuntu-xenial/debian/xtigervncviewer.menu +++ /dev/null @@ -1,5 +0,0 @@ -?package(xtigervncviewer):needs="x11" \ - section="Applications/Network/Communication" \ - hints="VNC,remote-control"\ - title="xtigervncviewer" \ - command="/usr/bin/xtigervncviewer" diff --git a/contrib/packages/deb/ubuntu-xenial/debian/xtigervncviewer.postinst b/contrib/packages/deb/ubuntu-xenial/debian/xtigervncviewer.postinst deleted file mode 100644 index 4df0c65..0000000 --- a/contrib/packages/deb/ubuntu-xenial/debian/xtigervncviewer.postinst +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh -e - -if [ "$1" = "configure" ]; then - MAN=/usr/share/man/man1 - BIN=/usr/bin - update-alternatives --install \ - $BIN/vncviewer vncviewer $BIN/xtigervncviewer 74 \ - --slave \ - $MAN/vncviewer.1.gz vncviewer.1.gz $MAN/xtigervncviewer.1.gz \ - --slave \ - $MAN/xvncviewer.1.gz xvncviewer.1.gz $MAN/xtigervncviewer.1.gz \ - --slave \ - $BIN/xvncviewer xvncviewer $BIN/xtigervncviewer -fi - -#DEBHELPER# - -exit 0 diff --git a/contrib/packages/deb/ubuntu-xenial/debian/xtigervncviewer.prerm b/contrib/packages/deb/ubuntu-xenial/debian/xtigervncviewer.prerm deleted file mode 100644 index 7a51fd2..0000000 --- a/contrib/packages/deb/ubuntu-xenial/debian/xtigervncviewer.prerm +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh -e - -if [ "$1" = "remove" ] ; then - BIN=/usr/bin - update-alternatives --remove \ - vncviewer $BIN/xtigervncviewer -fi - -#DEBHELPER# - -exit 0 diff --git a/contrib/packages/rpm/el5/SOURCES/16_CVE-2014-mult.diff b/contrib/packages/rpm/el5/SOURCES/16_CVE-2014-mult.diff deleted file mode 100644 index 2a75420..0000000 --- a/contrib/packages/rpm/el5/SOURCES/16_CVE-2014-mult.diff +++ /dev/null @@ -1,3387 +0,0 @@ -diff -Naur xorg-server-1.12.4.orig/dbe/dbe.c xorg-server-1.12.4/dbe/dbe.c ---- xorg-server-1.12.4.orig/dbe/dbe.c 2012-05-17 19:09:01.000000000 +0200 -+++ xorg-server-1.12.4/dbe/dbe.c 2014-11-28 09:50:59.185807584 +0100 -@@ -453,18 +453,20 @@ - DbeSwapInfoPtr swapInfo; - xDbeSwapInfo *dbeSwapInfo; - int error; -- register int i, j; -- int nStuff; -+ unsigned int i, j; -+ unsigned int nStuff; - - REQUEST_AT_LEAST_SIZE(xDbeSwapBuffersReq); - nStuff = stuff->n; /* use local variable for performance. */ - - if (nStuff == 0) { -+ REQUEST_SIZE_MATCH(xDbeSwapBuffersReq); - return Success; - } - - if (nStuff > UINT32_MAX / sizeof(DbeSwapInfoRec)) - return BadAlloc; -+ REQUEST_FIXED_SIZE(xDbeSwapBuffersReq, nStuff * sizeof(xDbeSwapInfo)); - - /* Get to the swap info appended to the end of the request. */ - dbeSwapInfo = (xDbeSwapInfo *) &stuff[1]; -@@ -955,13 +957,16 @@ - SProcDbeSwapBuffers(ClientPtr client) - { - REQUEST(xDbeSwapBuffersReq); -- register int i; -+ unsigned int i; - xDbeSwapInfo *pSwapInfo; - - swaps(&stuff->length); - REQUEST_AT_LEAST_SIZE(xDbeSwapBuffersReq); - - swapl(&stuff->n); -+ if (stuff->n > UINT32_MAX / sizeof(DbeSwapInfoRec)) -+ return BadAlloc; -+ REQUEST_FIXED_SIZE(xDbeSwapBuffersReq, stuff->n * sizeof(xDbeSwapInfo)); - - if (stuff->n != 0) { - pSwapInfo = (xDbeSwapInfo *) stuff + 1; -diff -Naur xorg-server-1.12.4.orig/dix/dispatch.c xorg-server-1.12.4/dix/dispatch.c ---- xorg-server-1.12.4.orig/dix/dispatch.c 2012-05-17 19:09:01.000000000 +0200 -+++ xorg-server-1.12.4/dix/dispatch.c 2014-11-28 09:50:37.761568914 +0100 -@@ -1952,6 +1952,9 @@ - tmpImage = (char *) &stuff[1]; - lengthProto = length; - -+ if (lengthProto >= (INT32_MAX / stuff->height)) -+ return BadLength; -+ - if ((bytes_to_int32(lengthProto * stuff->height) + - bytes_to_int32(sizeof(xPutImageReq))) != client->req_len) - return BadLength; -diff -Naur xorg-server-1.12.4.orig/dix/region.c xorg-server-1.12.4/dix/region.c ---- xorg-server-1.12.4.orig/dix/region.c 2012-05-17 19:09:02.000000000 +0200 -+++ xorg-server-1.12.4/dix/region.c 2014-11-28 09:50:45.169651442 +0100 -@@ -169,7 +169,6 @@ - ((r1)->y1 <= (r2)->y1) && \ - ((r1)->y2 >= (r2)->y2) ) - --#define xallocData(n) malloc(RegionSizeof(n)) - #define xfreeData(reg) if ((reg)->data && (reg)->data->size) free((reg)->data) - - #define RECTALLOC_BAIL(pReg,n,bail) \ -@@ -205,8 +204,9 @@ - #define DOWNSIZE(reg,numRects) \ - if (((numRects) < ((reg)->data->size >> 1)) && ((reg)->data->size > 50)) \ - { \ -- RegDataPtr NewData; \ -- NewData = (RegDataPtr)realloc((reg)->data, RegionSizeof(numRects)); \ -+ size_t NewSize = RegionSizeof(numRects); \ -+ RegDataPtr NewData = \ -+ (NewSize > 0) ? realloc((reg)->data, NewSize) : NULL ; \ - if (NewData) \ - { \ - NewData->size = (numRects); \ -@@ -330,17 +330,20 @@ - RegionRectAlloc(RegionPtr pRgn, int n) - { - RegDataPtr data; -+ size_t rgnSize; - - if (!pRgn->data) { - n++; -- pRgn->data = xallocData(n); -+ rgnSize = RegionSizeof(n); -+ pRgn->data = (rgnSize > 0) ? malloc(rgnSize) : NULL; - if (!pRgn->data) - return RegionBreak(pRgn); - pRgn->data->numRects = 1; - *RegionBoxptr(pRgn) = pRgn->extents; - } - else if (!pRgn->data->size) { -- pRgn->data = xallocData(n); -+ rgnSize = RegionSizeof(n); -+ pRgn->data = (rgnSize > 0) ? malloc(rgnSize) : NULL; - if (!pRgn->data) - return RegionBreak(pRgn); - pRgn->data->numRects = 0; -@@ -352,7 +355,8 @@ - n = 250; - } - n += pRgn->data->numRects; -- data = (RegDataPtr) realloc(pRgn->data, RegionSizeof(n)); -+ rgnSize = RegionSizeof(n); -+ data = (rgnSize > 0) ? realloc(pRgn->data, rgnSize) : NULL; - if (!data) - return RegionBreak(pRgn); - pRgn->data = data; -@@ -1297,6 +1301,7 @@ - { - - RegionPtr pRgn; -+ size_t rgnSize; - RegDataPtr pData; - BoxPtr pBox; - int i; -@@ -1323,7 +1328,8 @@ - } - return pRgn; - } -- pData = xallocData(nrects); -+ rgnSize = RegionSizeof(nrects); -+ pData = (rgnSize > 0) ? malloc(rgnSize) : NULL; - if (!pData) { - RegionBreak(pRgn); - return pRgn; -diff -Naur xorg-server-1.12.4.orig/glx/glxcmds.c xorg-server-1.12.4/glx/glxcmds.c ---- xorg-server-1.12.4.orig/glx/glxcmds.c 2012-08-02 02:59:23.000000000 +0200 -+++ xorg-server-1.12.4/glx/glxcmds.c 2014-11-28 09:51:59.834483171 +0100 -@@ -1948,7 +1948,7 @@ - left = (req->length << 2) - sz_xGLXRenderReq; - while (left > 0) { - __GLXrenderSizeData entry; -- int extra; -+ int extra = 0; - __GLXdispatchRenderProcPtr proc; - int err; - -@@ -1967,6 +1967,9 @@ - cmdlen = hdr->length; - opcode = hdr->opcode; - -+ if (left < cmdlen) -+ return BadLength; -+ - /* - ** Check for core opcodes and grab entry data. - */ -@@ -1980,24 +1983,20 @@ - return __glXError(GLXBadRenderRequest); - } - -+ if (cmdlen < entry.bytes) { -+ return BadLength; -+ } -+ - if (entry.varsize) { - /* variable size command */ - extra = (*entry.varsize) (pc + __GLX_RENDER_HDR_SIZE, - client->swapped); - if (extra < 0) { -- extra = 0; -- } -- if (cmdlen != __GLX_PAD(entry.bytes + extra)) { -- return BadLength; -- } -- } -- else { -- /* constant size command */ -- if (cmdlen != __GLX_PAD(entry.bytes)) { - return BadLength; - } - } -- if (left < cmdlen) { -+ -+ if (cmdlen != safe_pad(safe_add(entry.bytes, extra))) { - return BadLength; - } - -@@ -2102,7 +2101,7 @@ - extra = (*entry.varsize) (pc + __GLX_RENDER_LARGE_HDR_SIZE, - client->swapped); - if (extra < 0) { -- extra = 0; -+ return BadLength; - } - /* large command's header is 4 bytes longer, so add 4 */ - if (cmdlen != __GLX_PAD(entry.bytes + 4 + extra)) { -diff -Naur xorg-server-1.12.4.orig/glx/glxcmdsswap.c xorg-server-1.12.4/glx/glxcmdsswap.c ---- xorg-server-1.12.4.orig/glx/glxcmdsswap.c 2012-05-17 19:09:02.000000000 +0200 -+++ xorg-server-1.12.4/glx/glxcmdsswap.c 2014-11-28 09:52:11.210609886 +0100 -@@ -962,11 +962,13 @@ - int - __glXDispSwap_VendorPrivate(__GLXclientState * cl, GLbyte * pc) - { -+ ClientPtr client = cl->client; - xGLXVendorPrivateReq *req; - GLint vendorcode; - __GLXdispatchVendorPrivProcPtr proc; - - __GLX_DECLARE_SWAP_VARIABLES; -+ REQUEST_AT_LEAST_SIZE(xGLXVendorPrivateReq); - - req = (xGLXVendorPrivateReq *) pc; - __GLX_SWAP_SHORT(&req->length); -@@ -989,11 +991,13 @@ - int - __glXDispSwap_VendorPrivateWithReply(__GLXclientState * cl, GLbyte * pc) - { -+ ClientPtr client = cl->client; - xGLXVendorPrivateWithReplyReq *req; - GLint vendorcode; - __GLXdispatchVendorPrivProcPtr proc; - - __GLX_DECLARE_SWAP_VARIABLES; -+ REQUEST_AT_LEAST_SIZE(xGLXVendorPrivateWithReplyReq); - - req = (xGLXVendorPrivateWithReplyReq *) pc; - __GLX_SWAP_SHORT(&req->length); -diff -Naur xorg-server-1.12.4.orig/glx/glxserver.h xorg-server-1.12.4/glx/glxserver.h ---- xorg-server-1.12.4.orig/glx/glxserver.h 2012-05-17 19:09:02.000000000 +0200 -+++ xorg-server-1.12.4/glx/glxserver.h 2014-11-28 09:51:56.474445744 +0100 -@@ -218,6 +218,47 @@ - * Routines for computing the size of variably-sized rendering commands. - */ - -+static _X_INLINE int -+safe_add(int a, int b) -+{ -+ if (a < 0 || b < 0) -+ return -1; -+ -+ if (INT_MAX - a < b) -+ return -1; -+ -+ return a + b; -+} -+ -+static _X_INLINE int -+safe_mul(int a, int b) -+{ -+ if (a < 0 || b < 0) -+ return -1; -+ -+ if (a == 0 || b == 0) -+ return 0; -+ -+ if (a > INT_MAX / b) -+ return -1; -+ -+ return a * b; -+} -+ -+static _X_INLINE int -+safe_pad(int a) -+{ -+ int ret; -+ -+ if (a < 0) -+ return -1; -+ -+ if ((ret = safe_add(a, 3)) < 0) -+ return -1; -+ -+ return ret & (GLuint)~3; -+} -+ - extern int __glXTypeSize(GLenum enm); - extern int __glXImageSize(GLenum format, GLenum type, - GLenum target, GLsizei w, GLsizei h, GLsizei d, -diff -Naur xorg-server-1.12.4.orig/glx/indirect_program.c xorg-server-1.12.4/glx/indirect_program.c ---- xorg-server-1.12.4.orig/glx/indirect_program.c 2012-05-17 19:09:02.000000000 +0200 -+++ xorg-server-1.12.4/glx/indirect_program.c 2014-11-28 09:52:15.138653638 +0100 -@@ -69,6 +69,8 @@ - __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error); - ClientPtr client = cl->client; - -+ REQUEST_FIXED_SIZE(xGLXVendorPrivateWithReplyReq, 8); -+ - pc += __GLX_VENDPRIV_HDR_SIZE; - if (cx != NULL) { - GLenum target; -diff -Naur xorg-server-1.12.4.orig/glx/indirect_util.c xorg-server-1.12.4/glx/indirect_util.c ---- xorg-server-1.12.4.orig/glx/indirect_util.c 2012-05-17 19:09:02.000000000 +0200 -+++ xorg-server-1.12.4/glx/indirect_util.c 2014-11-28 09:52:18.662692891 +0100 -@@ -78,12 +78,17 @@ - void *local_buffer, size_t local_size, unsigned alignment) - { - void *buffer = local_buffer; -- const unsigned mask = alignment - 1; -+ const intptr_t mask = alignment - 1; - - if (local_size < required_size) { -- const size_t worst_case_size = required_size + alignment; -+ size_t worst_case_size; - intptr_t temp_buf; - -+ if (required_size < SIZE_MAX - alignment) -+ worst_case_size = required_size + alignment; -+ else -+ return NULL; -+ - if (cl->returnBufSize < worst_case_size) { - void *temp = realloc(cl->returnBuf, worst_case_size); - -diff -Naur xorg-server-1.12.4.orig/glx/rensize.c xorg-server-1.12.4/glx/rensize.c ---- xorg-server-1.12.4.orig/glx/rensize.c 2012-05-17 19:09:02.000000000 +0200 -+++ xorg-server-1.12.4/glx/rensize.c 2014-11-28 09:52:04.398534008 +0100 -@@ -43,19 +43,11 @@ - (((a & 0xff000000U)>>24) | ((a & 0xff0000U)>>8) | \ - ((a & 0xff00U)<<8) | ((a & 0xffU)<<24)) - --static int --Map1Size(GLint k, GLint order) --{ -- if (order <= 0 || k < 0) -- return -1; -- return k * order; --} -- - int - __glXMap1dReqSize(const GLbyte * pc, Bool swap) - { - GLenum target; -- GLint order, k; -+ GLint order; - - target = *(GLenum *) (pc + 16); - order = *(GLint *) (pc + 20); -@@ -63,15 +55,16 @@ - target = SWAPL(target); - order = SWAPL(order); - } -- k = __glMap1d_size(target); -- return 8 * Map1Size(k, order); -+ if (order < 1) -+ return -1; -+ return safe_mul(8, safe_mul(__glMap1d_size(target), order)); - } - - int - __glXMap1fReqSize(const GLbyte * pc, Bool swap) - { - GLenum target; -- GLint order, k; -+ GLint order; - - target = *(GLenum *) (pc + 0); - order = *(GLint *) (pc + 12); -@@ -79,23 +72,24 @@ - target = SWAPL(target); - order = SWAPL(order); - } -- k = __glMap1f_size(target); -- return 4 * Map1Size(k, order); -+ if (order < 1) -+ return -1; -+ return safe_mul(4, safe_mul(__glMap1f_size(target), order)); - } - - static int - Map2Size(int k, int majorOrder, int minorOrder) - { -- if (majorOrder <= 0 || minorOrder <= 0 || k < 0) -+ if (majorOrder < 1 || minorOrder < 1) - return -1; -- return k * majorOrder * minorOrder; -+ return safe_mul(k, safe_mul(majorOrder, minorOrder)); - } - - int - __glXMap2dReqSize(const GLbyte * pc, Bool swap) - { - GLenum target; -- GLint uorder, vorder, k; -+ GLint uorder, vorder; - - target = *(GLenum *) (pc + 32); - uorder = *(GLint *) (pc + 36); -@@ -105,15 +99,14 @@ - uorder = SWAPL(uorder); - vorder = SWAPL(vorder); - } -- k = __glMap2d_size(target); -- return 8 * Map2Size(k, uorder, vorder); -+ return safe_mul(8, Map2Size(__glMap2d_size(target), uorder, vorder)); - } - - int - __glXMap2fReqSize(const GLbyte * pc, Bool swap) - { - GLenum target; -- GLint uorder, vorder, k; -+ GLint uorder, vorder; - - target = *(GLenum *) (pc + 0); - uorder = *(GLint *) (pc + 12); -@@ -123,8 +116,7 @@ - uorder = SWAPL(uorder); - vorder = SWAPL(vorder); - } -- k = __glMap2f_size(target); -- return 4 * Map2Size(k, uorder, vorder); -+ return safe_mul(4, Map2Size(__glMap2f_size(target), uorder, vorder)); - } - - /** -@@ -175,14 +167,16 @@ - GLint bytesPerElement, elementsPerGroup, groupsPerRow; - GLint groupSize, rowSize, padding, imageSize; - -+ if (w == 0 || h == 0 || d == 0) -+ return 0; -+ - if (w < 0 || h < 0 || d < 0 || - (type == GL_BITMAP && - (format != GL_COLOR_INDEX && format != GL_STENCIL_INDEX))) { - return -1; - } -- if (w == 0 || h == 0 || d == 0) -- return 0; - -+ /* proxy targets have no data */ - switch (target) { - case GL_PROXY_TEXTURE_1D: - case GL_PROXY_TEXTURE_2D: -@@ -199,6 +193,12 @@ - return 0; - } - -+ /* real data has to have real sizes */ -+ if (imageHeight < 0 || rowLength < 0 || skipImages < 0 || skipRows < 0) -+ return -1; -+ if (alignment != 1 && alignment != 2 && alignment != 4 && alignment != 8) -+ return -1; -+ - if (type == GL_BITMAP) { - if (rowLength > 0) { - groupsPerRow = rowLength; -@@ -207,11 +207,14 @@ - groupsPerRow = w; - } - rowSize = bits_to_bytes(groupsPerRow); -+ if (rowSize < 0) -+ return -1; - padding = (rowSize % alignment); - if (padding) { - rowSize += alignment - padding; - } -- return ((h + skipRows) * rowSize); -+ -+ return safe_mul(safe_add(h, skipRows), rowSize); - } - else { - switch (format) { -@@ -224,6 +227,11 @@ - case GL_ALPHA: - case GL_LUMINANCE: - case GL_INTENSITY: -+ case GL_RED_INTEGER_EXT: -+ case GL_GREEN_INTEGER_EXT: -+ case GL_BLUE_INTEGER_EXT: -+ case GL_ALPHA_INTEGER_EXT: -+ case GL_LUMINANCE_INTEGER_EXT: - elementsPerGroup = 1; - break; - case GL_422_EXT: -@@ -234,14 +242,19 @@ - case GL_DEPTH_STENCIL_MESA: - case GL_YCBCR_MESA: - case GL_LUMINANCE_ALPHA: -+ case GL_LUMINANCE_ALPHA_INTEGER_EXT: - elementsPerGroup = 2; - break; - case GL_RGB: - case GL_BGR: -+ case GL_RGB_INTEGER_EXT: -+ case GL_BGR_INTEGER_EXT: - elementsPerGroup = 3; - break; - case GL_RGBA: - case GL_BGRA: -+ case GL_RGBA_INTEGER_EXT: -+ case GL_BGRA_INTEGER_EXT: - case GL_ABGR_EXT: - elementsPerGroup = 4; - break; -@@ -293,6 +306,7 @@ - default: - return -1; - } -+ /* known safe by the switches above, not checked */ - groupSize = bytesPerElement * elementsPerGroup; - if (rowLength > 0) { - groupsPerRow = rowLength; -@@ -300,18 +314,21 @@ - else { - groupsPerRow = w; - } -- rowSize = groupsPerRow * groupSize; -+ -+ if ((rowSize = safe_mul(groupsPerRow, groupSize)) < 0) -+ return -1; - padding = (rowSize % alignment); - if (padding) { - rowSize += alignment - padding; - } -- if (imageHeight > 0) { -- imageSize = (imageHeight + skipRows) * rowSize; -- } -- else { -- imageSize = (h + skipRows) * rowSize; -- } -- return ((d + skipImages) * imageSize); -+ -+ if (imageHeight > 0) -+ h = imageHeight; -+ h = safe_add(h, skipRows); -+ -+ imageSize = safe_mul(h, rowSize); -+ -+ return safe_mul(safe_add(d, skipImages), imageSize); - } - } - -@@ -435,9 +452,7 @@ - /* XXX Should rowLength be used for either or both image? */ - image1size = __glXImageSize(format, type, 0, w, 1, 1, - 0, rowLength, 0, 0, alignment); -- image1size = __GLX_PAD(image1size); - image2size = __glXImageSize(format, type, 0, h, 1, 1, - 0, rowLength, 0, 0, alignment); -- return image1size + image2size; -- -+ return safe_add(safe_pad(image1size), image2size); - } -diff -Naur xorg-server-1.12.4.orig/glx/singlepix.c xorg-server-1.12.4/glx/singlepix.c ---- xorg-server-1.12.4.orig/glx/singlepix.c 2012-05-17 19:09:02.000000000 +0200 -+++ xorg-server-1.12.4/glx/singlepix.c 2014-11-28 09:51:46.254331903 +0100 -@@ -69,7 +69,7 @@ - lsbFirst = *(GLboolean *) (pc + 25); - compsize = __glReadPixels_size(format, type, width, height); - if (compsize < 0) -- compsize = 0; -+ return BadLength; - - CALL_PixelStorei(GET_DISPATCH(), (GL_PACK_SWAP_BYTES, swapBytes)); - CALL_PixelStorei(GET_DISPATCH(), (GL_PACK_LSB_FIRST, lsbFirst)); -@@ -134,7 +134,7 @@ - compsize = - __glGetTexImage_size(target, level, format, type, width, height, depth); - if (compsize < 0) -- compsize = 0; -+ return BadLength; - - CALL_PixelStorei(GET_DISPATCH(), (GL_PACK_SWAP_BYTES, swapBytes)); - __GLX_GET_ANSWER_BUFFER(answer, cl, compsize, 1); -@@ -232,9 +232,9 @@ - compsize2 = __glGetTexImage_size(target, 1, format, type, height, 1, 1); - - if (compsize < 0) -- compsize = 0; -+ return BadLength; - if (compsize2 < 0) -- compsize2 = 0; -+ return BadLength; - compsize = __GLX_PAD(compsize); - compsize2 = __GLX_PAD(compsize2); - -@@ -315,7 +315,7 @@ - */ - compsize = __glGetTexImage_size(target, 1, format, type, width, height, 1); - if (compsize < 0) -- compsize = 0; -+ return BadLength; - - CALL_PixelStorei(GET_DISPATCH(), (GL_PACK_SWAP_BYTES, swapBytes)); - __GLX_GET_ANSWER_BUFFER(answer, cl, compsize, 1); -@@ -386,7 +386,7 @@ - */ - compsize = __glGetTexImage_size(target, 1, format, type, width, 1, 1); - if (compsize < 0) -- compsize = 0; -+ return BadLength; - - CALL_PixelStorei(GET_DISPATCH(), (GL_PACK_SWAP_BYTES, swapBytes)); - __GLX_GET_ANSWER_BUFFER(answer, cl, compsize, 1); -@@ -447,7 +447,7 @@ - - compsize = __glGetTexImage_size(target, 1, format, type, 2, 1, 1); - if (compsize < 0) -- compsize = 0; -+ return BadLength; - - CALL_PixelStorei(GET_DISPATCH(), (GL_PACK_SWAP_BYTES, swapBytes)); - __GLX_GET_ANSWER_BUFFER(answer, cl, compsize, 1); -@@ -513,7 +513,7 @@ - */ - compsize = __glGetTexImage_size(target, 1, format, type, width, 1, 1); - if (compsize < 0) -- compsize = 0; -+ return BadLength; - - CALL_PixelStorei(GET_DISPATCH(), (GL_PACK_SWAP_BYTES, swapBytes)); - __GLX_GET_ANSWER_BUFFER(answer, cl, compsize, 1); -diff -Naur xorg-server-1.12.4.orig/glx/singlepixswap.c xorg-server-1.12.4/glx/singlepixswap.c ---- xorg-server-1.12.4.orig/glx/singlepixswap.c 2012-05-17 19:09:02.000000000 +0200 -+++ xorg-server-1.12.4/glx/singlepixswap.c 2014-11-28 09:51:46.254331903 +0100 -@@ -79,7 +79,7 @@ - lsbFirst = *(GLboolean *) (pc + 25); - compsize = __glReadPixels_size(format, type, width, height); - if (compsize < 0) -- compsize = 0; -+ return BadLength; - - CALL_PixelStorei(GET_DISPATCH(), (GL_PACK_SWAP_BYTES, !swapBytes)); - CALL_PixelStorei(GET_DISPATCH(), (GL_PACK_LSB_FIRST, lsbFirst)); -@@ -155,7 +155,7 @@ - compsize = - __glGetTexImage_size(target, level, format, type, width, height, depth); - if (compsize < 0) -- compsize = 0; -+ return BadLength; - - CALL_PixelStorei(GET_DISPATCH(), (GL_PACK_SWAP_BYTES, !swapBytes)); - __GLX_GET_ANSWER_BUFFER(answer, cl, compsize, 1); -@@ -267,9 +267,9 @@ - compsize2 = __glGetTexImage_size(target, 1, format, type, height, 1, 1); - - if (compsize < 0) -- compsize = 0; -+ return BadLength; - if (compsize2 < 0) -- compsize2 = 0; -+ return BadLength; - compsize = __GLX_PAD(compsize); - compsize2 = __GLX_PAD(compsize2); - -@@ -358,7 +358,7 @@ - */ - compsize = __glGetTexImage_size(target, 1, format, type, width, height, 1); - if (compsize < 0) -- compsize = 0; -+ return BadLength; - - CALL_PixelStorei(GET_DISPATCH(), (GL_PACK_SWAP_BYTES, !swapBytes)); - __GLX_GET_ANSWER_BUFFER(answer, cl, compsize, 1); -@@ -437,7 +437,7 @@ - */ - compsize = __glGetTexImage_size(target, 1, format, type, width, 1, 1); - if (compsize < 0) -- compsize = 0; -+ return BadLength; - - CALL_PixelStorei(GET_DISPATCH(), (GL_PACK_SWAP_BYTES, !swapBytes)); - __GLX_GET_ANSWER_BUFFER(answer, cl, compsize, 1); -@@ -505,7 +505,7 @@ - - compsize = __glGetTexImage_size(target, 1, format, type, 2, 1, 1); - if (compsize < 0) -- compsize = 0; -+ return BadLength; - - CALL_PixelStorei(GET_DISPATCH(), (GL_PACK_SWAP_BYTES, !swapBytes)); - __GLX_GET_ANSWER_BUFFER(answer, cl, compsize, 1); -@@ -577,7 +577,7 @@ - */ - compsize = __glGetTexImage_size(target, 1, format, type, width, 1, 1); - if (compsize < 0) -- compsize = 0; -+ return BadLength; - - CALL_PixelStorei(GET_DISPATCH(), (GL_PACK_SWAP_BYTES, !swapBytes)); - __GLX_GET_ANSWER_BUFFER(answer, cl, compsize, 1); -diff -Naur xorg-server-1.12.4.orig/glx/swap_interval.c xorg-server-1.12.4/glx/swap_interval.c ---- xorg-server-1.12.4.orig/glx/swap_interval.c 2012-05-17 19:09:02.000000000 +0200 -+++ xorg-server-1.12.4/glx/swap_interval.c 2014-11-28 09:52:15.138653638 +0100 -@@ -50,6 +50,8 @@ - __GLXcontext *cx; - GLint interval; - -+ REQUEST_FIXED_SIZE(xGLXVendorPrivateReq, 4); -+ - cx = __glXLookupContextByTag(cl, tag); - - if ((cx == NULL) || (cx->pGlxScreen == NULL)) { -diff -Naur xorg-server-1.12.4.orig/glx/unpack.h xorg-server-1.12.4/glx/unpack.h ---- xorg-server-1.12.4.orig/glx/unpack.h 2012-05-17 19:09:02.000000000 +0200 -+++ xorg-server-1.12.4/glx/unpack.h 2014-11-28 09:51:49.594369108 +0100 -@@ -83,7 +83,8 @@ - ** pointer. - */ - #define __GLX_GET_ANSWER_BUFFER(res,cl,size,align) \ -- if ((size) > sizeof(answerBuffer)) { \ -+ if (size < 0) return BadLength; \ -+ else if ((size) > sizeof(answerBuffer)) { \ - int bump; \ - if ((cl)->returnBufSize < (size)+(align)) { \ - (cl)->returnBuf = (GLbyte*)realloc((cl)->returnBuf, \ -diff -Naur xorg-server-1.12.4.orig/hw/xfree86/dri2/dri2ext.c xorg-server-1.12.4/hw/xfree86/dri2/dri2ext.c ---- xorg-server-1.12.4.orig/hw/xfree86/dri2/dri2ext.c 2012-05-17 19:09:03.000000000 +0200 -+++ xorg-server-1.12.4/hw/xfree86/dri2/dri2ext.c 2014-11-28 09:50:54.413754423 +0100 -@@ -263,6 +263,9 @@ - unsigned int *attachments; - - REQUEST_FIXED_SIZE(xDRI2GetBuffersReq, stuff->count * 4); -+ if (stuff->count > (INT_MAX / 4)) -+ return BadLength; -+ - if (!validDrawable(client, stuff->drawable, DixReadAccess | DixWriteAccess, - &pDrawable, &status)) - return status; -diff -Naur xorg-server-1.12.4.orig/include/dix.h xorg-server-1.12.4/include/dix.h ---- xorg-server-1.12.4.orig/include/dix.h 2012-05-17 19:09:04.000000000 +0200 -+++ xorg-server-1.12.4/include/dix.h 2014-11-28 09:50:49.805703089 +0100 -@@ -74,7 +74,8 @@ - - #define REQUEST_FIXED_SIZE(req, n)\ - if (((sizeof(req) >> 2) > client->req_len) || \ -- (((sizeof(req) + (n) + 3) >> 2) != client->req_len)) \ -+ ((n >> 2) >= client->req_len) || \ -+ ((((uint64_t) sizeof(req) + (n) + 3) >> 2) != (uint64_t) client->req_len)) \ - return(BadLength) - - #define LEGAL_NEW_RESOURCE(id,client)\ -diff -Naur xorg-server-1.12.4.orig/include/regionstr.h xorg-server-1.12.4/include/regionstr.h ---- xorg-server-1.12.4.orig/include/regionstr.h 2012-05-17 19:09:04.000000000 +0200 -+++ xorg-server-1.12.4/include/regionstr.h 2014-11-28 09:50:45.169651442 +0100 -@@ -127,7 +127,10 @@ - static inline size_t - RegionSizeof(int n) - { -- return (sizeof(RegDataRec) + ((n) * sizeof(BoxRec))); -+ if (n < ((INT_MAX - sizeof(RegDataRec)) / sizeof(BoxRec))) -+ return (sizeof(RegDataRec) + ((n) * sizeof(BoxRec))); -+ else -+ return 0; - } - - static inline void -@@ -138,9 +141,10 @@ - (_pReg)->data = (RegDataPtr) NULL; - } - else { -+ size_t rgnSize; - (_pReg)->extents = RegionEmptyBox; -- if (((_size) > 1) && ((_pReg)->data = -- (RegDataPtr) malloc(RegionSizeof(_size)))) { -+ if (((_size) > 1) && ((rgnSize = RegionSizeof(_size)) > 0) && -+ (((_pReg)->data = malloc(rgnSize)) != NULL)) { - (_pReg)->data->size = (_size); - (_pReg)->data->numRects = 0; - } -diff -Naur xorg-server-1.12.4.orig/os/access.c xorg-server-1.12.4/os/access.c ---- xorg-server-1.12.4.orig/os/access.c 2012-05-17 19:09:04.000000000 +0200 -+++ xorg-server-1.12.4/os/access.c 2014-11-28 09:50:41.409609554 +0100 -@@ -1331,6 +1331,10 @@ - for (host = validhosts; host; host = host->next) { - nHosts++; - n += pad_to_int32(host->len) + sizeof(xHostEntry); -+ /* Could check for INT_MAX, but in reality having more than 1mb of -+ hostnames in the access list is ridiculous */ -+ if (n >= 1048576) -+ break; - } - if (n) { - *data = ptr = malloc(n); -@@ -1339,6 +1343,8 @@ - } - for (host = validhosts; host; host = host->next) { - len = host->len; -+ if ((ptr + sizeof(xHostEntry) + len) > (data + n)) -+ break; - ((xHostEntry *) ptr)->family = host->family; - ((xHostEntry *) ptr)->length = len; - ptr += sizeof(xHostEntry); -diff -Naur xorg-server-1.12.4.orig/os/rpcauth.c xorg-server-1.12.4/os/rpcauth.c ---- xorg-server-1.12.4.orig/os/rpcauth.c 2012-05-17 19:09:04.000000000 +0200 -+++ xorg-server-1.12.4/os/rpcauth.c 2014-11-28 09:50:32.861514326 +0100 -@@ -66,6 +66,10 @@ - SVCXPRT xprt; - - temp_inmsg = malloc(len); -+ if (temp_inmsg == NULL) { -+ why = AUTH_FAILED; /* generic error, since there is no AUTH_BADALLOC */ -+ return NULL; -+ } - memmove(temp_inmsg, inmsg, len); - - memset((char *) &msg, 0, sizeof(msg)); -diff -Naur xorg-server-1.12.4.orig/randr/rrsdispatch.c xorg-server-1.12.4/randr/rrsdispatch.c ---- xorg-server-1.12.4.orig/randr/rrsdispatch.c 2012-05-17 19:09:05.000000000 +0200 -+++ xorg-server-1.12.4/randr/rrsdispatch.c 2014-11-28 09:51:10.885937921 +0100 -@@ -27,6 +27,7 @@ - { - REQUEST(xRRQueryVersionReq); - -+ REQUEST_SIZE_MATCH(xRRQueryVersionReq); - swaps(&stuff->length); - swapl(&stuff->majorVersion); - swapl(&stuff->minorVersion); -@@ -38,6 +39,7 @@ - { - REQUEST(xRRGetScreenInfoReq); - -+ REQUEST_SIZE_MATCH(xRRGetScreenInfoReq); - swaps(&stuff->length); - swapl(&stuff->window); - return (*ProcRandrVector[stuff->randrReqType]) (client); -@@ -69,6 +71,7 @@ - { - REQUEST(xRRSelectInputReq); - -+ REQUEST_SIZE_MATCH(xRRSelectInputReq); - swaps(&stuff->length); - swapl(&stuff->window); - swaps(&stuff->enable); -@@ -152,6 +155,7 @@ - { - REQUEST(xRRConfigureOutputPropertyReq); - -+ REQUEST_AT_LEAST_SIZE(xRRConfigureOutputPropertyReq); - swaps(&stuff->length); - swapl(&stuff->output); - swapl(&stuff->property); -diff -Naur xorg-server-1.12.4.orig/render/render.c xorg-server-1.12.4/render/render.c ---- xorg-server-1.12.4.orig/render/render.c 2012-08-02 02:59:23.000000000 +0200 -+++ xorg-server-1.12.4/render/render.c 2014-11-28 09:51:16.878004670 +0100 -@@ -1994,7 +1994,7 @@ - SProcRenderQueryVersion(ClientPtr client) - { - REQUEST(xRenderQueryVersionReq); -- -+ REQUEST_SIZE_MATCH(xRenderQueryVersionReq); - swaps(&stuff->length); - swapl(&stuff->majorVersion); - swapl(&stuff->minorVersion); -@@ -2005,6 +2005,7 @@ - SProcRenderQueryPictFormats(ClientPtr client) - { - REQUEST(xRenderQueryPictFormatsReq); -+ REQUEST_SIZE_MATCH(xRenderQueryPictFormatsReq); - swaps(&stuff->length); - return (*ProcRenderVector[stuff->renderReqType]) (client); - } -@@ -2013,6 +2014,7 @@ - SProcRenderQueryPictIndexValues(ClientPtr client) - { - REQUEST(xRenderQueryPictIndexValuesReq); -+ REQUEST_AT_LEAST_SIZE(xRenderQueryPictIndexValuesReq); - swaps(&stuff->length); - swapl(&stuff->format); - return (*ProcRenderVector[stuff->renderReqType]) (client); -@@ -2028,6 +2030,7 @@ - SProcRenderCreatePicture(ClientPtr client) - { - REQUEST(xRenderCreatePictureReq); -+ REQUEST_AT_LEAST_SIZE(xRenderCreatePictureReq); - swaps(&stuff->length); - swapl(&stuff->pid); - swapl(&stuff->drawable); -@@ -2041,6 +2044,7 @@ - SProcRenderChangePicture(ClientPtr client) - { - REQUEST(xRenderChangePictureReq); -+ REQUEST_AT_LEAST_SIZE(xRenderChangePictureReq); - swaps(&stuff->length); - swapl(&stuff->picture); - swapl(&stuff->mask); -@@ -2052,6 +2056,7 @@ - SProcRenderSetPictureClipRectangles(ClientPtr client) - { - REQUEST(xRenderSetPictureClipRectanglesReq); -+ REQUEST_AT_LEAST_SIZE(xRenderSetPictureClipRectanglesReq); - swaps(&stuff->length); - swapl(&stuff->picture); - swaps(&stuff->xOrigin); -@@ -2064,6 +2069,7 @@ - SProcRenderFreePicture(ClientPtr client) - { - REQUEST(xRenderFreePictureReq); -+ REQUEST_SIZE_MATCH(xRenderFreePictureReq); - swaps(&stuff->length); - swapl(&stuff->picture); - return (*ProcRenderVector[stuff->renderReqType]) (client); -@@ -2073,6 +2079,7 @@ - SProcRenderComposite(ClientPtr client) - { - REQUEST(xRenderCompositeReq); -+ REQUEST_SIZE_MATCH(xRenderCompositeReq); - swaps(&stuff->length); - swapl(&stuff->src); - swapl(&stuff->mask); -@@ -2092,6 +2099,7 @@ - SProcRenderScale(ClientPtr client) - { - REQUEST(xRenderScaleReq); -+ REQUEST_SIZE_MATCH(xRenderScaleReq); - swaps(&stuff->length); - swapl(&stuff->src); - swapl(&stuff->dst); -@@ -2192,6 +2200,7 @@ - SProcRenderCreateGlyphSet(ClientPtr client) - { - REQUEST(xRenderCreateGlyphSetReq); -+ REQUEST_SIZE_MATCH(xRenderCreateGlyphSetReq); - swaps(&stuff->length); - swapl(&stuff->gsid); - swapl(&stuff->format); -@@ -2202,6 +2211,7 @@ - SProcRenderReferenceGlyphSet(ClientPtr client) - { - REQUEST(xRenderReferenceGlyphSetReq); -+ REQUEST_SIZE_MATCH(xRenderReferenceGlyphSetReq); - swaps(&stuff->length); - swapl(&stuff->gsid); - swapl(&stuff->existing); -@@ -2212,6 +2222,7 @@ - SProcRenderFreeGlyphSet(ClientPtr client) - { - REQUEST(xRenderFreeGlyphSetReq); -+ REQUEST_SIZE_MATCH(xRenderFreeGlyphSetReq); - swaps(&stuff->length); - swapl(&stuff->glyphset); - return (*ProcRenderVector[stuff->renderReqType]) (client); -@@ -2226,6 +2237,7 @@ - xGlyphInfo *gi; - - REQUEST(xRenderAddGlyphsReq); -+ REQUEST_AT_LEAST_SIZE(xRenderAddGlyphsReq); - swaps(&stuff->length); - swapl(&stuff->glyphset); - swapl(&stuff->nglyphs); -@@ -2260,6 +2272,7 @@ - SProcRenderFreeGlyphs(ClientPtr client) - { - REQUEST(xRenderFreeGlyphsReq); -+ REQUEST_AT_LEAST_SIZE(xRenderFreeGlyphsReq); - swaps(&stuff->length); - swapl(&stuff->glyphset); - SwapRestL(stuff); -@@ -2277,6 +2290,7 @@ - int size; - - REQUEST(xRenderCompositeGlyphsReq); -+ REQUEST_AT_LEAST_SIZE(xRenderCompositeGlyphsReq); - - switch (stuff->renderReqType) { - default: -diff -Naur xorg-server-1.12.4.orig/test/misc.c xorg-server-1.12.4/test/misc.c ---- xorg-server-1.12.4.orig/test/misc.c 2012-05-17 19:09:05.000000000 +0200 -+++ xorg-server-1.12.4/test/misc.c 2014-11-28 09:51:33.354188205 +0100 -@@ -28,6 +28,8 @@ - #include - #include "misc.h" - #include "scrnintstr.h" -+#include "dix.h" -+#include "dixstruct.h" - - ScreenInfo screenInfo; - -@@ -155,11 +157,46 @@ - assert_dimensions(-w2, -h2, w2, h2); - } - -+static int -+dix_request_fixed_size_overflow(ClientRec *client) -+{ -+ xReq req = { 0 }; -+ -+ client->req_len = req.length = 1; -+ REQUEST_FIXED_SIZE(req, SIZE_MAX); -+ return Success; -+} -+ -+static int -+dix_request_fixed_size_match(ClientRec *client) -+{ -+ xReq req = { 0 }; -+ -+ client->req_len = req.length = 9; -+ REQUEST_FIXED_SIZE(req, 30); -+ return Success; -+} -+ -+static void -+dix_request_size_checks(void) -+{ -+ ClientRec client = { 0 }; -+ int rc; -+ -+ rc = dix_request_fixed_size_overflow(&client); -+ assert(rc == BadLength); -+ -+ rc = dix_request_fixed_size_match(&client); -+ assert(rc == Success); -+} -+ -+ - int - main(int argc, char **argv) - { - dix_version_compare(); - dix_update_desktop_dimensions(); -+ dix_request_size_checks(); - - return 0; - } -diff -Naur xorg-server-1.12.4.orig/test/xi2/protocol-xigetclientpointer.c xorg-server-1.12.4/test/xi2/protocol-xigetclientpointer.c ---- xorg-server-1.12.4.orig/test/xi2/protocol-xigetclientpointer.c 2012-05-17 19:09:05.000000000 +0200 -+++ xorg-server-1.12.4/test/xi2/protocol-xigetclientpointer.c 2014-11-28 09:51:28.970139371 +0100 -@@ -124,6 +124,11 @@ - request.win = INVALID_WINDOW_ID; - request_XIGetClientPointer(&client_request, &request, BadWindow); - -+ printf("Testing invalid length\n"); -+ client_request.req_len -= 4; -+ request_XIGetClientPointer(&client_request, &request, BadLength); -+ client_request.req_len += 4; -+ - test_data.cp_is_set = FALSE; - - printf("Testing window None, unset ClientPointer.\n"); -diff -Naur xorg-server-1.12.4.orig/test/xi2/protocol-xipassivegrabdevice.c xorg-server-1.12.4/test/xi2/protocol-xipassivegrabdevice.c ---- xorg-server-1.12.4.orig/test/xi2/protocol-xipassivegrabdevice.c 2012-05-17 19:09:05.000000000 +0200 -+++ xorg-server-1.12.4/test/xi2/protocol-xipassivegrabdevice.c 2014-11-28 09:51:28.970139371 +0100 -@@ -137,6 +137,7 @@ - int rc; - int modifiers; - -+ client_request.req_len = req->length; - rc = ProcXIPassiveGrabDevice(&client_request); - assert(rc == error); - -@@ -187,6 +188,13 @@ - request_XIPassiveGrabDevice(&client_request, request, BadDevice, - request->deviceid); - -+ printf("Testing invalid length\n"); -+ request->length -= 2; -+ request_XIPassiveGrabDevice(&client_request, request, BadLength, -+ client_request.errorValue); -+ /* re-init request since swapped length test leaves some values swapped */ -+ request_init(request, XIPassiveGrabDevice); -+ request->grab_window = CLIENT_WINDOW_ID; - request->deviceid = XIAllMasterDevices; - - printf("Testing invalid grab types\n"); -diff -Naur xorg-server-1.12.4.orig/test/xi2/protocol-xiquerypointer.c xorg-server-1.12.4/test/xi2/protocol-xiquerypointer.c ---- xorg-server-1.12.4.orig/test/xi2/protocol-xiquerypointer.c 2012-05-17 19:09:05.000000000 +0200 -+++ xorg-server-1.12.4/test/xi2/protocol-xiquerypointer.c 2014-11-28 09:51:28.970139371 +0100 -@@ -200,6 +200,10 @@ - test_data.dev = devices.mouse; - request.deviceid = devices.mouse->id; - request_XIQueryPointer(&client_request, &request, Success); -+ -+ /* test REQUEST_SIZE_MATCH */ -+ client_request.req_len -= 4; -+ request_XIQueryPointer(&client_request, &request, BadLength); - } - - int -diff -Naur xorg-server-1.12.4.orig/test/xi2/protocol-xiwarppointer.c xorg-server-1.12.4/test/xi2/protocol-xiwarppointer.c ---- xorg-server-1.12.4.orig/test/xi2/protocol-xiwarppointer.c 2012-05-17 19:09:05.000000000 +0200 -+++ xorg-server-1.12.4/test/xi2/protocol-xiwarppointer.c 2014-11-28 09:51:28.974139415 +0100 -@@ -197,6 +197,9 @@ - request_XIWarpPointer(&client_request, &request, Success); - - /* FIXME: src_x/y checks */ -+ -+ client_request.req_len -= 2; /* invalid length */ -+ request_XIWarpPointer(&client_request, &request, BadLength); - } - - int -diff -Naur xorg-server-1.12.4.orig/Xext/xcmisc.c xorg-server-1.12.4/Xext/xcmisc.c ---- xorg-server-1.12.4.orig/Xext/xcmisc.c 2012-05-17 19:09:01.000000000 +0200 -+++ xorg-server-1.12.4/Xext/xcmisc.c 2014-11-28 09:51:03.837859407 +0100 -@@ -161,6 +161,7 @@ - SProcXCMiscGetXIDList(ClientPtr client) - { - REQUEST(xXCMiscGetXIDListReq); -+ REQUEST_SIZE_MATCH(xXCMiscGetXIDListReq); - - swaps(&stuff->length); - swapl(&stuff->count); -diff -Naur xorg-server-1.12.4.orig/Xext/xvdisp.c xorg-server-1.12.4/Xext/xvdisp.c ---- xorg-server-1.12.4.orig/Xext/xvdisp.c 2012-05-17 19:09:01.000000000 +0200 -+++ xorg-server-1.12.4/Xext/xvdisp.c 2014-11-28 09:51:07.413899243 +0100 -@@ -1202,6 +1202,7 @@ - SProcXvQueryExtension(ClientPtr client) - { - REQUEST(xvQueryExtensionReq); -+ REQUEST_SIZE_MATCH(xvQueryExtensionReq); - swaps(&stuff->length); - return XvProcVector[xv_QueryExtension] (client); - } -@@ -1210,6 +1211,7 @@ - SProcXvQueryAdaptors(ClientPtr client) - { - REQUEST(xvQueryAdaptorsReq); -+ REQUEST_SIZE_MATCH(xvQueryAdaptorsReq); - swaps(&stuff->length); - swapl(&stuff->window); - return XvProcVector[xv_QueryAdaptors] (client); -@@ -1219,6 +1221,7 @@ - SProcXvQueryEncodings(ClientPtr client) - { - REQUEST(xvQueryEncodingsReq); -+ REQUEST_SIZE_MATCH(xvQueryEncodingsReq); - swaps(&stuff->length); - swapl(&stuff->port); - return XvProcVector[xv_QueryEncodings] (client); -@@ -1228,6 +1231,7 @@ - SProcXvGrabPort(ClientPtr client) - { - REQUEST(xvGrabPortReq); -+ REQUEST_SIZE_MATCH(xvGrabPortReq); - swaps(&stuff->length); - swapl(&stuff->port); - swapl(&stuff->time); -@@ -1238,6 +1242,7 @@ - SProcXvUngrabPort(ClientPtr client) - { - REQUEST(xvUngrabPortReq); -+ REQUEST_SIZE_MATCH(xvUngrabPortReq); - swaps(&stuff->length); - swapl(&stuff->port); - swapl(&stuff->time); -@@ -1248,6 +1253,7 @@ - SProcXvPutVideo(ClientPtr client) - { - REQUEST(xvPutVideoReq); -+ REQUEST_SIZE_MATCH(xvPutVideoReq); - swaps(&stuff->length); - swapl(&stuff->port); - swapl(&stuff->drawable); -@@ -1267,6 +1273,7 @@ - SProcXvPutStill(ClientPtr client) - { - REQUEST(xvPutStillReq); -+ REQUEST_SIZE_MATCH(xvPutStillReq); - swaps(&stuff->length); - swapl(&stuff->port); - swapl(&stuff->drawable); -@@ -1286,6 +1293,7 @@ - SProcXvGetVideo(ClientPtr client) - { - REQUEST(xvGetVideoReq); -+ REQUEST_SIZE_MATCH(xvGetVideoReq); - swaps(&stuff->length); - swapl(&stuff->port); - swapl(&stuff->drawable); -@@ -1305,6 +1313,7 @@ - SProcXvGetStill(ClientPtr client) - { - REQUEST(xvGetStillReq); -+ REQUEST_SIZE_MATCH(xvGetStillReq); - swaps(&stuff->length); - swapl(&stuff->port); - swapl(&stuff->drawable); -@@ -1324,6 +1333,7 @@ - SProcXvPutImage(ClientPtr client) - { - REQUEST(xvPutImageReq); -+ REQUEST_AT_LEAST_SIZE(xvPutImageReq); - swaps(&stuff->length); - swapl(&stuff->port); - swapl(&stuff->drawable); -@@ -1347,6 +1357,7 @@ - SProcXvShmPutImage(ClientPtr client) - { - REQUEST(xvShmPutImageReq); -+ REQUEST_SIZE_MATCH(xvShmPutImageReq); - swaps(&stuff->length); - swapl(&stuff->port); - swapl(&stuff->drawable); -@@ -1374,6 +1385,7 @@ - SProcXvSelectVideoNotify(ClientPtr client) - { - REQUEST(xvSelectVideoNotifyReq); -+ REQUEST_SIZE_MATCH(xvSelectVideoNotifyReq); - swaps(&stuff->length); - swapl(&stuff->drawable); - return XvProcVector[xv_SelectVideoNotify] (client); -@@ -1383,6 +1395,7 @@ - SProcXvSelectPortNotify(ClientPtr client) - { - REQUEST(xvSelectPortNotifyReq); -+ REQUEST_SIZE_MATCH(xvSelectPortNotifyReq); - swaps(&stuff->length); - swapl(&stuff->port); - return XvProcVector[xv_SelectPortNotify] (client); -@@ -1392,6 +1405,7 @@ - SProcXvStopVideo(ClientPtr client) - { - REQUEST(xvStopVideoReq); -+ REQUEST_SIZE_MATCH(xvStopVideoReq); - swaps(&stuff->length); - swapl(&stuff->port); - swapl(&stuff->drawable); -@@ -1402,6 +1416,7 @@ - SProcXvSetPortAttribute(ClientPtr client) - { - REQUEST(xvSetPortAttributeReq); -+ REQUEST_SIZE_MATCH(xvSetPortAttributeReq); - swaps(&stuff->length); - swapl(&stuff->port); - swapl(&stuff->attribute); -@@ -1413,6 +1428,7 @@ - SProcXvGetPortAttribute(ClientPtr client) - { - REQUEST(xvGetPortAttributeReq); -+ REQUEST_SIZE_MATCH(xvGetPortAttributeReq); - swaps(&stuff->length); - swapl(&stuff->port); - swapl(&stuff->attribute); -@@ -1423,6 +1439,7 @@ - SProcXvQueryBestSize(ClientPtr client) - { - REQUEST(xvQueryBestSizeReq); -+ REQUEST_SIZE_MATCH(xvQueryBestSizeReq); - swaps(&stuff->length); - swapl(&stuff->port); - swaps(&stuff->vid_w); -@@ -1436,6 +1453,7 @@ - SProcXvQueryPortAttributes(ClientPtr client) - { - REQUEST(xvQueryPortAttributesReq); -+ REQUEST_SIZE_MATCH(xvQueryPortAttributesReq); - swaps(&stuff->length); - swapl(&stuff->port); - return XvProcVector[xv_QueryPortAttributes] (client); -@@ -1445,6 +1463,7 @@ - SProcXvQueryImageAttributes(ClientPtr client) - { - REQUEST(xvQueryImageAttributesReq); -+ REQUEST_SIZE_MATCH(xvQueryImageAttributesReq); - swaps(&stuff->length); - swapl(&stuff->port); - swapl(&stuff->id); -@@ -1457,6 +1476,7 @@ - SProcXvListImageFormats(ClientPtr client) - { - REQUEST(xvListImageFormatsReq); -+ REQUEST_SIZE_MATCH(xvListImageFormatsReq); - swaps(&stuff->length); - swapl(&stuff->port); - return XvProcVector[xv_ListImageFormats] (client); -diff -Naur xorg-server-1.12.4.orig/xfixes/select.c xorg-server-1.12.4/xfixes/select.c ---- xorg-server-1.12.4.orig/xfixes/select.c 2012-05-17 19:09:05.000000000 +0200 -+++ xorg-server-1.12.4/xfixes/select.c 2014-11-28 09:51:22.470066963 +0100 -@@ -204,6 +204,7 @@ - { - REQUEST(xXFixesSelectSelectionInputReq); - -+ REQUEST_SIZE_MATCH(xXFixesSelectSelectionInputReq); - swaps(&stuff->length); - swapl(&stuff->window); - swapl(&stuff->selection); -diff -aur xorg-server-1.12.4.orig/render/render.c xorg-server-1.12.4/render/render.c ---- xorg-server-1.12.4.orig/render/render.c 2014-11-28 09:51:16.878004670 +0100 -+++ xorg-server-1.12.4/render/render.c 2014-11-28 10:00:10.899950898 +0100 -@@ -271,10 +271,11 @@ - - REQUEST(xRenderQueryVersionReq); - -+ REQUEST_SIZE_MATCH(xRenderQueryVersionReq); -+ - pRenderClient->major_version = stuff->majorVersion; - pRenderClient->minor_version = stuff->minorVersion; - -- REQUEST_SIZE_MATCH(xRenderQueryVersionReq); - memset(&rep, 0, sizeof(xRenderQueryVersionReply)); - rep.type = X_Reply; - rep.length = 0; -diff -Naur xorg-server-1.12.4.orig/glx/glxcmds.c xorg-server-1.12.4/glx/glxcmds.c ---- xorg-server-1.12.4.orig/glx/glxcmds.c 2014-11-28 10:01:44.068987817 +0100 -+++ xorg-server-1.12.4/glx/glxcmds.c 2014-11-28 10:05:07.515246883 +0100 -@@ -2032,6 +2032,8 @@ - - __GLX_DECLARE_SWAP_VARIABLES; - -+ REQUEST_AT_LEAST_SIZE(xGLXRenderLargeReq); -+ - req = (xGLXRenderLargeReq *) pc; - if (client->swapped) { - __GLX_SWAP_SHORT(&req->length); -@@ -2047,12 +2049,14 @@ - __glXResetLargeCommandStatus(cl); - return error; - } -+ if (safe_pad(req->dataBytes) < 0) -+ return BadLength; - dataBytes = req->dataBytes; - - /* - ** Check the request length. - */ -- if ((req->length << 2) != __GLX_PAD(dataBytes) + sz_xGLXRenderLargeReq) { -+ if ((req->length << 2) != safe_pad(dataBytes) + sz_xGLXRenderLargeReq) { - client->errorValue = req->length; - /* Reset in case this isn't 1st request. */ - __glXResetLargeCommandStatus(cl); -@@ -2062,7 +2066,7 @@ - - if (cl->largeCmdRequestsSoFar == 0) { - __GLXrenderSizeData entry; -- int extra; -+ int extra = 0; - size_t cmdlen; - int err; - -@@ -2075,13 +2079,17 @@ - return __glXError(GLXBadLargeRequest); - } - -+ if (dataBytes < __GLX_RENDER_LARGE_HDR_SIZE) -+ return BadLength; -+ - hdr = (__GLXrenderLargeHeader *) pc; - if (client->swapped) { - __GLX_SWAP_INT(&hdr->length); - __GLX_SWAP_INT(&hdr->opcode); - } -- cmdlen = hdr->length; - opcode = hdr->opcode; -+ if ((cmdlen = safe_pad(hdr->length)) < 0) -+ return BadLength; - - /* - ** Check for core opcodes and grab entry data. -@@ -2103,17 +2111,13 @@ - if (extra < 0) { - return BadLength; - } -- /* large command's header is 4 bytes longer, so add 4 */ -- if (cmdlen != __GLX_PAD(entry.bytes + 4 + extra)) { -- return BadLength; -- } - } -- else { -- /* constant size command */ -- if (cmdlen != __GLX_PAD(entry.bytes + 4)) { -- return BadLength; -- } -+ -+ /* the +4 is safe because we know entry.bytes is small */ -+ if (cmdlen != safe_pad(safe_add(entry.bytes + 4, extra))) { -+ return BadLength; - } -+ - /* - ** Make enough space in the buffer, then copy the entire request. - */ -@@ -2143,6 +2147,7 @@ - ** We are receiving subsequent (i.e. not the first) requests of a - ** multi request command. - */ -+ int bytesSoFar; /* including this packet */ - - /* - ** Check the request number and the total request count. -@@ -2161,11 +2166,18 @@ - /* - ** Check that we didn't get too much data. - */ -- if ((cl->largeCmdBytesSoFar + dataBytes) > cl->largeCmdBytesTotal) { -+ if ((bytesSoFar = safe_add(cl->largeCmdBytesSoFar, dataBytes)) < 0) { - client->errorValue = dataBytes; - __glXResetLargeCommandStatus(cl); - return __glXError(GLXBadLargeRequest); - } -+ -+ if (bytesSoFar > cl->largeCmdBytesTotal) { -+ client->errorValue = dataBytes; -+ __glXResetLargeCommandStatus(cl); -+ return __glXError(GLXBadLargeRequest); -+ } -+ - memcpy(cl->largeCmdBuf + cl->largeCmdBytesSoFar, pc, dataBytes); - cl->largeCmdBytesSoFar += dataBytes; - cl->largeCmdRequestsSoFar++; -@@ -2186,8 +2198,7 @@ - ** the padding done below fixes a bug that did not allow - ** large commands of odd sizes to be accepted by the server. - */ -- if (__GLX_PAD(cl->largeCmdBytesSoFar) != -- __GLX_PAD(cl->largeCmdBytesTotal)) { -+ if (safe_pad(cl->largeCmdBytesSoFar) != cl->largeCmdBytesTotal) { - client->errorValue = dataBytes; - __glXResetLargeCommandStatus(cl); - return __glXError(GLXBadLargeRequest); -diff -Naur xorg-server-1.12.4.orig/glx/indirect_texture_compression.c xorg-server-1.12.4/glx/indirect_texture_compression.c ---- xorg-server-1.12.4.orig/glx/indirect_texture_compression.c 2012-05-17 19:09:02.000000000 +0200 -+++ xorg-server-1.12.4/glx/indirect_texture_compression.c 2014-11-28 10:26:39.461548117 +0100 -@@ -47,6 +47,8 @@ - __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error); - ClientPtr client = cl->client; - -+ REQUEST_FIXED_SIZE(xGLXSingleReq, 8); -+ - pc += __GLX_SINGLE_HDR_SIZE; - if (cx != NULL) { - const GLenum target = *(GLenum *) (pc + 0); -@@ -93,6 +95,8 @@ - __glXForceCurrent(cl, bswap_32(req->contextTag), &error); - ClientPtr client = cl->client; - -+ REQUEST_FIXED_SIZE(xGLXSingleReq, 8); -+ - pc += __GLX_SINGLE_HDR_SIZE; - if (cx != NULL) { - const GLenum target = (GLenum) bswap_32(*(int *) (pc + 0)); -diff -Naur xorg-server-1.12.4.orig/glx/single2.c xorg-server-1.12.4/glx/single2.c ---- xorg-server-1.12.4.orig/glx/single2.c 2012-05-17 19:09:02.000000000 +0200 -+++ xorg-server-1.12.4/glx/single2.c 2014-11-28 10:26:39.461548117 +0100 -@@ -49,11 +49,14 @@ - int - __glXDisp_FeedbackBuffer(__GLXclientState * cl, GLbyte * pc) - { -+ ClientPtr client = cl->client; - GLsizei size; - GLenum type; - __GLXcontext *cx; - int error; - -+ REQUEST_FIXED_SIZE(xGLXSingleReq, 8); -+ - cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); - if (!cx) { - return error; -@@ -80,10 +83,13 @@ - int - __glXDisp_SelectBuffer(__GLXclientState * cl, GLbyte * pc) - { -+ ClientPtr client = cl->client; - __GLXcontext *cx; - GLsizei size; - int error; - -+ REQUEST_FIXED_SIZE(xGLXSingleReq, 4); -+ - cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); - if (!cx) { - return error; -@@ -108,7 +114,7 @@ - int - __glXDisp_RenderMode(__GLXclientState * cl, GLbyte * pc) - { -- ClientPtr client; -+ ClientPtr client = cl->client; - xGLXRenderModeReply reply; - __GLXcontext *cx; - GLint nitems = 0, retBytes = 0, retval, newModeCheck; -@@ -116,6 +122,8 @@ - GLenum newMode; - int error; - -+ REQUEST_FIXED_SIZE(xGLXSingleReq, 4); -+ - cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); - if (!cx) { - return error; -@@ -192,7 +200,6 @@ - ** selection array, as per the API for glRenderMode itself. - */ - noChangeAllowed:; -- client = cl->client; - reply.length = nitems; - reply.type = X_Reply; - reply.sequenceNumber = client->sequence; -@@ -209,9 +216,12 @@ - int - __glXDisp_Flush(__GLXclientState * cl, GLbyte * pc) - { -+ ClientPtr client = cl->client; - __GLXcontext *cx; - int error; - -+ REQUEST_SIZE_MATCH(xGLXSingleReq); -+ - cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); - if (!cx) { - return error; -@@ -225,10 +235,12 @@ - int - __glXDisp_Finish(__GLXclientState * cl, GLbyte * pc) - { -+ ClientPtr client = cl->client; - __GLXcontext *cx; -- ClientPtr client; - int error; - -+ REQUEST_SIZE_MATCH(xGLXSingleReq); -+ - cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); - if (!cx) { - return error; -@@ -319,7 +331,7 @@ - int - DoGetString(__GLXclientState * cl, GLbyte * pc, GLboolean need_swap) - { -- ClientPtr client; -+ ClientPtr client = cl->client; - __GLXcontext *cx; - GLenum name; - const char *string; -@@ -329,6 +341,8 @@ - char *buf = NULL, *buf1 = NULL; - GLint length = 0; - -+ REQUEST_FIXED_SIZE(xGLXSingleReq, 4); -+ - /* If the client has the opposite byte order, swap the contextTag and - * the name. - */ -@@ -345,7 +359,6 @@ - pc += __GLX_SINGLE_HDR_SIZE; - name = *(GLenum *) (pc + 0); - string = (const char *) CALL_GetString(GET_DISPATCH(), (name)); -- client = cl->client; - - if (string == NULL) - string = ""; -diff -Naur xorg-server-1.12.4.orig/glx/single2swap.c xorg-server-1.12.4/glx/single2swap.c ---- xorg-server-1.12.4.orig/glx/single2swap.c 2012-05-17 19:09:02.000000000 +0200 -+++ xorg-server-1.12.4/glx/single2swap.c 2014-11-28 10:26:39.465548161 +0100 -@@ -45,6 +45,7 @@ - int - __glXDispSwap_FeedbackBuffer(__GLXclientState * cl, GLbyte * pc) - { -+ ClientPtr client = cl->client; - GLsizei size; - GLenum type; - -@@ -52,6 +53,8 @@ - __GLXcontext *cx; - int error; - -+ REQUEST_FIXED_SIZE(xGLXSingleReq, 8); -+ - __GLX_SWAP_INT(&((xGLXSingleReq *) pc)->contextTag); - cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); - if (!cx) { -@@ -81,12 +84,15 @@ - int - __glXDispSwap_SelectBuffer(__GLXclientState * cl, GLbyte * pc) - { -+ ClientPtr client = cl->client; - __GLXcontext *cx; - GLsizei size; - - __GLX_DECLARE_SWAP_VARIABLES; - int error; - -+ REQUEST_FIXED_SIZE(xGLXSingleReq, 4); -+ - __GLX_SWAP_INT(&((xGLXSingleReq *) pc)->contextTag); - cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); - if (!cx) { -@@ -113,7 +119,7 @@ - int - __glXDispSwap_RenderMode(__GLXclientState * cl, GLbyte * pc) - { -- ClientPtr client; -+ ClientPtr client = cl->client; - __GLXcontext *cx; - xGLXRenderModeReply reply; - GLint nitems = 0, retBytes = 0, retval, newModeCheck; -@@ -124,6 +130,8 @@ - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - int error; - -+ REQUEST_FIXED_SIZE(xGLXSingleReq, 4); -+ - __GLX_SWAP_INT(&((xGLXSingleReq *) pc)->contextTag); - cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); - if (!cx) { -@@ -204,7 +212,6 @@ - ** selection array, as per the API for glRenderMode itself. - */ - noChangeAllowed:; -- client = cl->client; - reply.length = nitems; - reply.type = X_Reply; - reply.sequenceNumber = client->sequence; -@@ -226,11 +233,14 @@ - int - __glXDispSwap_Flush(__GLXclientState * cl, GLbyte * pc) - { -+ ClientPtr client = cl->client; - __GLXcontext *cx; - int error; - - __GLX_DECLARE_SWAP_VARIABLES; - -+ REQUEST_SIZE_MATCH(xGLXSingleReq); -+ - __GLX_SWAP_INT(&((xGLXSingleReq *) pc)->contextTag); - cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); - if (!cx) { -@@ -245,12 +255,14 @@ - int - __glXDispSwap_Finish(__GLXclientState * cl, GLbyte * pc) - { -+ ClientPtr client = cl->client; - __GLXcontext *cx; -- ClientPtr client; - int error; - - __GLX_DECLARE_SWAP_VARIABLES; - -+ REQUEST_SIZE_MATCH(xGLXSingleReq); -+ - __GLX_SWAP_INT(&((xGLXSingleReq *) pc)->contextTag); - cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); - if (!cx) { -@@ -262,7 +274,6 @@ - cx->hasUnflushedCommands = GL_FALSE; - - /* Send empty reply packet to indicate finish is finished */ -- client = cl->client; - __GLX_BEGIN_REPLY(0); - __GLX_PUT_RETVAL(0); - __GLX_SWAP_REPLY_HEADER(); -diff -Naur xorg-server-1.12.4.orig/glx/singlepix.c xorg-server-1.12.4/glx/singlepix.c ---- xorg-server-1.12.4.orig/glx/singlepix.c 2014-11-28 10:06:28.116140360 +0100 -+++ xorg-server-1.12.4/glx/singlepix.c 2014-11-28 10:26:39.465548161 +0100 -@@ -55,6 +55,8 @@ - int error; - char *answer, answerBuffer[200]; - -+ REQUEST_FIXED_SIZE(xGLXSingleReq, 28); -+ - cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); - if (!cx) { - return error; -@@ -107,6 +109,8 @@ - char *answer, answerBuffer[200]; - GLint width = 0, height = 0, depth = 1; - -+ REQUEST_FIXED_SIZE(xGLXSingleReq, 20); -+ - cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); - if (!cx) { - return error; -@@ -169,6 +173,8 @@ - GLubyte answerBuffer[200]; - char *answer; - -+ REQUEST_FIXED_SIZE(xGLXSingleReq, 4); -+ - cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); - if (!cx) { - return error; -@@ -231,15 +237,15 @@ - compsize = __glGetTexImage_size(target, 1, format, type, width, 1, 1); - compsize2 = __glGetTexImage_size(target, 1, format, type, height, 1, 1); - -- if (compsize < 0) -+ if ((compsize = safe_pad(compsize)) < 0) - return BadLength; -- if (compsize2 < 0) -+ -+ if ((compsize2 = safe_pad(compsize2)) < 0) - return BadLength; -- compsize = __GLX_PAD(compsize); -- compsize2 = __GLX_PAD(compsize2); - - CALL_PixelStorei(GET_DISPATCH(), (GL_PACK_SWAP_BYTES, swapBytes)); -- __GLX_GET_ANSWER_BUFFER(answer, cl, compsize + compsize2, 1); -+ __GLX_GET_ANSWER_BUFFER(answer, cl, safe_add(compsize, compsize2), 1); -+ - __glXClearErrorOccured(); - CALL_GetSeparableFilter(GET_DISPATCH(), (*(GLenum *) (pc + 0), - *(GLenum *) (pc + 4), -@@ -265,7 +271,8 @@ - __glXDisp_GetSeparableFilter(__GLXclientState * cl, GLbyte * pc) - { - const GLXContextTag tag = __GLX_GET_SINGLE_CONTEXT_TAG(pc); -- -+ ClientPtr client = cl->client; -+ REQUEST_FIXED_SIZE(xGLXSingleReq, 16); - return GetSeparableFilter(cl, pc + __GLX_SINGLE_HDR_SIZE, tag); - } - -@@ -273,7 +280,8 @@ - __glXDisp_GetSeparableFilterEXT(__GLXclientState * cl, GLbyte * pc) - { - const GLXContextTag tag = __GLX_GET_VENDPRIV_CONTEXT_TAG(pc); -- -+ ClientPtr client = cl->client; -+ REQUEST_FIXED_SIZE(xGLXVendorPrivateReq, 16); - return GetSeparableFilter(cl, pc + __GLX_VENDPRIV_HDR_SIZE, tag); - } - -@@ -343,7 +351,8 @@ - __glXDisp_GetConvolutionFilter(__GLXclientState * cl, GLbyte * pc) - { - const GLXContextTag tag = __GLX_GET_SINGLE_CONTEXT_TAG(pc); -- -+ ClientPtr client = cl->client; -+ REQUEST_FIXED_SIZE(xGLXSingleReq, 16); - return GetConvolutionFilter(cl, pc + __GLX_SINGLE_HDR_SIZE, tag); - } - -@@ -351,7 +360,8 @@ - __glXDisp_GetConvolutionFilterEXT(__GLXclientState * cl, GLbyte * pc) - { - const GLXContextTag tag = __GLX_GET_VENDPRIV_CONTEXT_TAG(pc); -- -+ ClientPtr client = cl->client; -+ REQUEST_FIXED_SIZE(xGLXVendorPrivateReq, 16); - return GetConvolutionFilter(cl, pc + __GLX_VENDPRIV_HDR_SIZE, tag); - } - -@@ -411,7 +421,8 @@ - __glXDisp_GetHistogram(__GLXclientState * cl, GLbyte * pc) - { - const GLXContextTag tag = __GLX_GET_SINGLE_CONTEXT_TAG(pc); -- -+ ClientPtr client = cl->client; -+ REQUEST_FIXED_SIZE(xGLXSingleReq, 16); - return GetHistogram(cl, pc + __GLX_SINGLE_HDR_SIZE, tag); - } - -@@ -419,7 +430,8 @@ - __glXDisp_GetHistogramEXT(__GLXclientState * cl, GLbyte * pc) - { - const GLXContextTag tag = __GLX_GET_VENDPRIV_CONTEXT_TAG(pc); -- -+ ClientPtr client = cl->client; -+ REQUEST_FIXED_SIZE(xGLXVendorPrivateReq, 16); - return GetHistogram(cl, pc + __GLX_VENDPRIV_HDR_SIZE, tag); - } - -@@ -471,7 +483,8 @@ - __glXDisp_GetMinmax(__GLXclientState * cl, GLbyte * pc) - { - const GLXContextTag tag = __GLX_GET_SINGLE_CONTEXT_TAG(pc); -- -+ ClientPtr client = cl->client; -+ REQUEST_FIXED_SIZE(xGLXSingleReq, 16); - return GetMinmax(cl, pc + __GLX_SINGLE_HDR_SIZE, tag); - } - -@@ -479,7 +492,8 @@ - __glXDisp_GetMinmaxEXT(__GLXclientState * cl, GLbyte * pc) - { - const GLXContextTag tag = __GLX_GET_VENDPRIV_CONTEXT_TAG(pc); -- -+ ClientPtr client = cl->client; -+ REQUEST_FIXED_SIZE(xGLXVendorPrivateReq, 16); - return GetMinmax(cl, pc + __GLX_VENDPRIV_HDR_SIZE, tag); - } - -@@ -540,7 +554,8 @@ - __glXDisp_GetColorTable(__GLXclientState * cl, GLbyte * pc) - { - const GLXContextTag tag = __GLX_GET_SINGLE_CONTEXT_TAG(pc); -- -+ ClientPtr client = cl->client; -+ REQUEST_FIXED_SIZE(xGLXSingleReq, 16); - return GetColorTable(cl, pc + __GLX_SINGLE_HDR_SIZE, tag); - } - -@@ -548,6 +563,7 @@ - __glXDisp_GetColorTableSGI(__GLXclientState * cl, GLbyte * pc) - { - const GLXContextTag tag = __GLX_GET_VENDPRIV_CONTEXT_TAG(pc); -- -+ ClientPtr client = cl->client; -+ REQUEST_FIXED_SIZE(xGLXVendorPrivateReq, 16); - return GetColorTable(cl, pc + __GLX_VENDPRIV_HDR_SIZE, tag); - } -diff -Naur xorg-server-1.12.4.orig/glx/singlepixswap.c xorg-server-1.12.4/glx/singlepixswap.c ---- xorg-server-1.12.4.orig/glx/singlepixswap.c 2014-11-28 10:06:28.116140360 +0100 -+++ xorg-server-1.12.4/glx/singlepixswap.c 2014-11-28 10:26:39.465548161 +0100 -@@ -57,6 +57,8 @@ - int error; - char *answer, answerBuffer[200]; - -+ REQUEST_FIXED_SIZE(xGLXSingleReq, 28); -+ - __GLX_SWAP_INT(&((xGLXSingleReq *) pc)->contextTag); - cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); - if (!cx) { -@@ -122,6 +124,8 @@ - char *answer, answerBuffer[200]; - GLint width = 0, height = 0, depth = 1; - -+ REQUEST_FIXED_SIZE(xGLXSingleReq, 20); -+ - __GLX_SWAP_INT(&((xGLXSingleReq *) pc)->contextTag); - cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); - if (!cx) { -@@ -197,6 +201,8 @@ - - __GLX_DECLARE_SWAP_VARIABLES; - -+ REQUEST_FIXED_SIZE(xGLXSingleReq, 4); -+ - __GLX_SWAP_INT(&((xGLXSingleReq *) pc)->contextTag); - cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); - if (!cx) { -@@ -266,15 +272,13 @@ - compsize = __glGetTexImage_size(target, 1, format, type, width, 1, 1); - compsize2 = __glGetTexImage_size(target, 1, format, type, height, 1, 1); - -- if (compsize < 0) -+ if ((compsize = safe_pad(compsize)) < 0) - return BadLength; -- if (compsize2 < 0) -+ if ((compsize2 = safe_pad(compsize2)) < 0) - return BadLength; -- compsize = __GLX_PAD(compsize); -- compsize2 = __GLX_PAD(compsize2); - - CALL_PixelStorei(GET_DISPATCH(), (GL_PACK_SWAP_BYTES, !swapBytes)); -- __GLX_GET_ANSWER_BUFFER(answer, cl, compsize + compsize2, 1); -+ __GLX_GET_ANSWER_BUFFER(answer, cl, safe_add(compsize, compsize2), 1); - __glXClearErrorOccured(); - CALL_GetSeparableFilter(GET_DISPATCH(), (*(GLenum *) (pc + 0), - *(GLenum *) (pc + 4), -@@ -302,7 +306,9 @@ - __glXDispSwap_GetSeparableFilter(__GLXclientState * cl, GLbyte * pc) - { - const GLXContextTag tag = __GLX_GET_SINGLE_CONTEXT_TAG(pc); -+ ClientPtr client = cl->client; - -+ REQUEST_FIXED_SIZE(xGLXSingleReq, 16); - return GetSeparableFilter(cl, pc + __GLX_SINGLE_HDR_SIZE, tag); - } - -@@ -310,7 +316,9 @@ - __glXDispSwap_GetSeparableFilterEXT(__GLXclientState * cl, GLbyte * pc) - { - const GLXContextTag tag = __GLX_GET_VENDPRIV_CONTEXT_TAG(pc); -+ ClientPtr client = cl->client; - -+ REQUEST_FIXED_SIZE(xGLXVendorPrivateReq, 16); - return GetSeparableFilter(cl, pc + __GLX_VENDPRIV_HDR_SIZE, tag); - } - -@@ -388,7 +396,9 @@ - __glXDispSwap_GetConvolutionFilter(__GLXclientState * cl, GLbyte * pc) - { - const GLXContextTag tag = __GLX_GET_SINGLE_CONTEXT_TAG(pc); -+ ClientPtr client = cl->client; - -+ REQUEST_FIXED_SIZE(xGLXSingleReq, 16); - return GetConvolutionFilter(cl, pc + __GLX_SINGLE_HDR_SIZE, tag); - } - -@@ -396,7 +406,9 @@ - __glXDispSwap_GetConvolutionFilterEXT(__GLXclientState * cl, GLbyte * pc) - { - const GLXContextTag tag = __GLX_GET_VENDPRIV_CONTEXT_TAG(pc); -+ ClientPtr client = cl->client; - -+ REQUEST_FIXED_SIZE(xGLXVendorPrivateReq, 16); - return GetConvolutionFilter(cl, pc + __GLX_VENDPRIV_HDR_SIZE, tag); - } - -@@ -463,7 +475,9 @@ - __glXDispSwap_GetHistogram(__GLXclientState * cl, GLbyte * pc) - { - const GLXContextTag tag = __GLX_GET_SINGLE_CONTEXT_TAG(pc); -+ ClientPtr client = cl->client; - -+ REQUEST_FIXED_SIZE(xGLXSingleReq, 16); - return GetHistogram(cl, pc + __GLX_SINGLE_HDR_SIZE, tag); - } - -@@ -471,7 +485,9 @@ - __glXDispSwap_GetHistogramEXT(__GLXclientState * cl, GLbyte * pc) - { - const GLXContextTag tag = __GLX_GET_VENDPRIV_CONTEXT_TAG(pc); -+ ClientPtr client = cl->client; - -+ REQUEST_FIXED_SIZE(xGLXVendorPrivateReq, 16); - return GetHistogram(cl, pc + __GLX_VENDPRIV_HDR_SIZE, tag); - } - -@@ -529,7 +545,9 @@ - __glXDispSwap_GetMinmax(__GLXclientState * cl, GLbyte * pc) - { - const GLXContextTag tag = __GLX_GET_SINGLE_CONTEXT_TAG(pc); -+ ClientPtr client = cl->client; - -+ REQUEST_FIXED_SIZE(xGLXSingleReq, 16); - return GetMinmax(cl, pc + __GLX_SINGLE_HDR_SIZE, tag); - } - -@@ -537,7 +555,9 @@ - __glXDispSwap_GetMinmaxEXT(__GLXclientState * cl, GLbyte * pc) - { - const GLXContextTag tag = __GLX_GET_VENDPRIV_CONTEXT_TAG(pc); -+ ClientPtr client = cl->client; - -+ REQUEST_FIXED_SIZE(xGLXVendorPrivateReq, 16); - return GetMinmax(cl, pc + __GLX_VENDPRIV_HDR_SIZE, tag); - } - -@@ -605,7 +625,9 @@ - __glXDispSwap_GetColorTable(__GLXclientState * cl, GLbyte * pc) - { - const GLXContextTag tag = __GLX_GET_SINGLE_CONTEXT_TAG(pc); -+ ClientPtr client = cl->client; - -+ REQUEST_FIXED_SIZE(xGLXSingleReq, 16); - return GetColorTable(cl, pc + __GLX_SINGLE_HDR_SIZE, tag); - } - -@@ -613,6 +635,8 @@ - __glXDispSwap_GetColorTableSGI(__GLXclientState * cl, GLbyte * pc) - { - const GLXContextTag tag = __GLX_GET_VENDPRIV_CONTEXT_TAG(pc); -+ ClientPtr client = cl->client; - -+ REQUEST_FIXED_SIZE(xGLXVendorPrivateReq, 16); - return GetColorTable(cl, pc + __GLX_VENDPRIV_HDR_SIZE, tag); - } -diff --git a/Xi/chgdctl.c b/Xi/chgdctl.c -index ff5d69a..e87df42 100644 ---- a/Xi/chgdctl.c -+++ b/Xi/chgdctl.c -@@ -78,7 +78,7 @@ SProcXChangeDeviceControl(ClientPtr client) - - REQUEST(xChangeDeviceControlReq); - swaps(&stuff->length); -- REQUEST_AT_LEAST_SIZE(xChangeDeviceControlReq); -+ REQUEST_AT_LEAST_EXTRA_SIZE(xChangeDeviceControlReq, sizeof(xDeviceCtl)); - swaps(&stuff->control); - ctl = (xDeviceCtl *) &stuff[1]; - swaps(&ctl->control); -@@ -116,7 +116,7 @@ ProcXChangeDeviceControl(ClientPtr client) - devicePresenceNotify dpn; - - REQUEST(xChangeDeviceControlReq); -- REQUEST_AT_LEAST_SIZE(xChangeDeviceControlReq); -+ REQUEST_AT_LEAST_EXTRA_SIZE(xChangeDeviceControlReq, sizeof(xDeviceCtl)); - - len = stuff->length - bytes_to_int32(sizeof(xChangeDeviceControlReq)); - ret = dixLookupDevice(&dev, stuff->deviceid, client, DixManageAccess); -@@ -184,6 +184,10 @@ ProcXChangeDeviceControl(ClientPtr client) - break; - case DEVICE_ENABLE: - e = (xDeviceEnableCtl *) &stuff[1]; -+ if ((len != bytes_to_int32(sizeof(xDeviceEnableCtl)))) { -+ ret = BadLength; -+ goto out; -+ } - - status = ChangeDeviceControl(client, dev, (xDeviceCtl *) e); - -diff --git a/Xi/chgfctl.c b/Xi/chgfctl.c -index 6dcf60c..224c2ba 100644 ---- a/Xi/chgfctl.c -+++ b/Xi/chgfctl.c -@@ -467,6 +467,8 @@ ProcXChangeFeedbackControl(ClientPtr client) - xStringFeedbackCtl *f = ((xStringFeedbackCtl *) &stuff[1]); - - if (client->swapped) { -+ if (len < bytes_to_int32(sizeof(xStringFeedbackCtl))) -+ return BadLength; - swaps(&f->num_keysyms); - } - if (len != -diff --git a/Xi/sendexev.c b/Xi/sendexev.c -index 3c21386..183f88d 100644 ---- a/Xi/sendexev.c -+++ b/Xi/sendexev.c -@@ -135,6 +135,9 @@ ProcXSendExtensionEvent(ClientPtr client) - if (ret != Success) - return ret; - -+ if (stuff->num_events == 0) -+ return ret; -+ - /* The client's event type must be one defined by an extension. */ - - first = ((xEvent *) &stuff[1]); -diff --git a/Xi/xiallowev.c b/Xi/xiallowev.c -index 62a0727..156c738 100644 ---- a/Xi/xiallowev.c -+++ b/Xi/xiallowev.c -@@ -48,6 +48,7 @@ int - SProcXIAllowEvents(ClientPtr client) - { - REQUEST(xXIAllowEventsReq); -+ REQUEST_AT_LEAST_SIZE(xXIAllowEventsReq); - - swaps(&stuff->length); - swaps(&stuff->deviceid); -@@ -55,6 +56,7 @@ SProcXIAllowEvents(ClientPtr client) - if (stuff->length > 3) { - xXI2_2AllowEventsReq *req_xi22 = (xXI2_2AllowEventsReq *) stuff; - -+ REQUEST_AT_LEAST_SIZE(xXI2_2AllowEventsReq); - swapl(&req_xi22->touchid); - swapl(&req_xi22->grab_window); - } -diff --git a/Xi/xichangecursor.c b/Xi/xichangecursor.c -index 0be6bc0..33e9e9c 100644 ---- a/Xi/xichangecursor.c -+++ b/Xi/xichangecursor.c -@@ -57,11 +57,11 @@ int - SProcXIChangeCursor(ClientPtr client) - { - REQUEST(xXIChangeCursorReq); -+ REQUEST_SIZE_MATCH(xXIChangeCursorReq); - swaps(&stuff->length); - swapl(&stuff->win); - swapl(&stuff->cursor); - swaps(&stuff->deviceid); -- REQUEST_SIZE_MATCH(xXIChangeCursorReq); - return (ProcXIChangeCursor(client)); - } - -diff --git a/Xi/xichangehierarchy.c b/Xi/xichangehierarchy.c -index 756aaac..d2244cf 100644 ---- a/Xi/xichangehierarchy.c -+++ b/Xi/xichangehierarchy.c -@@ -407,7 +407,7 @@ int - ProcXIChangeHierarchy(ClientPtr client) - { - xXIAnyHierarchyChangeInfo *any; -- int required_len = sizeof(xXIChangeHierarchyReq); -+ size_t len; /* length of data remaining in request */ - int rc = Success; - int flags[MAXDEVICES] = { 0 }; - -@@ -417,21 +417,46 @@ ProcXIChangeHierarchy(ClientPtr client) - if (!stuff->num_changes) - return rc; - -+ if (stuff->length > (INT_MAX >> 2)) -+ return BadAlloc; -+ len = (stuff->length << 2) - sizeof(xXIAnyHierarchyChangeInfo); -+ - any = (xXIAnyHierarchyChangeInfo *) &stuff[1]; - while (stuff->num_changes--) { -+ if (len < sizeof(xXIAnyHierarchyChangeInfo)) { -+ rc = BadLength; -+ goto unwind; -+ } -+ - SWAPIF(swaps(&any->type)); - SWAPIF(swaps(&any->length)); - -- required_len += any->length; -- if ((stuff->length * 4) < required_len) -+ if ((any->length > (INT_MAX >> 2)) || (len < (any->length << 2))) - return BadLength; - -+#define CHANGE_SIZE_MATCH(type) \ -+ do { \ -+ if ((len < sizeof(type)) || (any->length != (sizeof(type) >> 2))) { \ -+ rc = BadLength; \ -+ goto unwind; \ -+ } \ -+ } while(0) -+ - switch (any->type) { - case XIAddMaster: - { - xXIAddMasterInfo *c = (xXIAddMasterInfo *) any; - -+ /* Variable length, due to appended name string */ -+ if (len < sizeof(xXIAddMasterInfo)) { -+ rc = BadLength; -+ goto unwind; -+ } - SWAPIF(swaps(&c->name_len)); -+ if (c->name_len > (len - sizeof(xXIAddMasterInfo))) { -+ rc = BadLength; -+ goto unwind; -+ } - - rc = add_master(client, c, flags); - if (rc != Success) -@@ -442,6 +467,7 @@ ProcXIChangeHierarchy(ClientPtr client) - { - xXIRemoveMasterInfo *r = (xXIRemoveMasterInfo *) any; - -+ CHANGE_SIZE_MATCH(xXIRemoveMasterInfo); - rc = remove_master(client, r, flags); - if (rc != Success) - goto unwind; -@@ -451,6 +477,7 @@ ProcXIChangeHierarchy(ClientPtr client) - { - xXIDetachSlaveInfo *c = (xXIDetachSlaveInfo *) any; - -+ CHANGE_SIZE_MATCH(xXIDetachSlaveInfo); - rc = detach_slave(client, c, flags); - if (rc != Success) - goto unwind; -@@ -460,6 +487,7 @@ ProcXIChangeHierarchy(ClientPtr client) - { - xXIAttachSlaveInfo *c = (xXIAttachSlaveInfo *) any; - -+ CHANGE_SIZE_MATCH(xXIAttachSlaveInfo); - rc = attach_slave(client, c, flags); - if (rc != Success) - goto unwind; -@@ -467,6 +495,7 @@ ProcXIChangeHierarchy(ClientPtr client) - break; - } - -+ len -= any->length * 4; - any = (xXIAnyHierarchyChangeInfo *) ((char *) any + any->length * 4); - } - -diff --git a/Xi/xigetclientpointer.c b/Xi/xigetclientpointer.c -index 07dbf18..a066497 100644 ---- a/Xi/xigetclientpointer.c -+++ b/Xi/xigetclientpointer.c -@@ -50,6 +50,7 @@ int - SProcXIGetClientPointer(ClientPtr client) - { - REQUEST(xXIGetClientPointerReq); -+ REQUEST_SIZE_MATCH(xXIGetClientPointerReq); - - swaps(&stuff->length); - swapl(&stuff->win); -diff --git a/Xi/xigrabdev.c b/Xi/xigrabdev.c -index 8d2cf0b..3dafbbd 100644 ---- a/Xi/xigrabdev.c -+++ b/Xi/xigrabdev.c -@@ -47,6 +47,11 @@ int - SProcXIGrabDevice(ClientPtr client) - { - REQUEST(xXIGrabDeviceReq); -+ /* -+ * Check here for at least the length of the struct we swap, then -+ * let ProcXIGrabDevice check the full size after we swap mask_len. -+ */ -+ REQUEST_AT_LEAST_SIZE(xXIGrabDeviceReq); - - swaps(&stuff->length); - swaps(&stuff->deviceid); -@@ -69,7 +74,7 @@ ProcXIGrabDevice(ClientPtr client) - int mask_len; - - REQUEST(xXIGrabDeviceReq); -- REQUEST_AT_LEAST_SIZE(xXIGrabDeviceReq); -+ REQUEST_FIXED_SIZE(xXIGrabDeviceReq, ((size_t) stuff->mask_len) * 4); - - ret = dixLookupDevice(&dev, stuff->deviceid, client, DixGrabAccess); - if (ret != Success) -@@ -118,6 +123,7 @@ int - SProcXIUngrabDevice(ClientPtr client) - { - REQUEST(xXIUngrabDeviceReq); -+ REQUEST_SIZE_MATCH(xXIUngrabDeviceReq); - - swaps(&stuff->length); - swaps(&stuff->deviceid); -@@ -135,6 +141,7 @@ ProcXIUngrabDevice(ClientPtr client) - TimeStamp time; - - REQUEST(xXIUngrabDeviceReq); -+ REQUEST_SIZE_MATCH(xXIUngrabDeviceReq); - - ret = dixLookupDevice(&dev, stuff->deviceid, client, DixGetAttrAccess); - if (ret != Success) -diff --git a/Xi/xipassivegrab.c b/Xi/xipassivegrab.c -index 7130328..06f44d7 100644 ---- a/Xi/xipassivegrab.c -+++ b/Xi/xipassivegrab.c -@@ -53,6 +53,7 @@ SProcXIPassiveGrabDevice(ClientPtr client) - xXIModifierInfo *mods; - - REQUEST(xXIPassiveGrabDeviceReq); -+ REQUEST_AT_LEAST_SIZE(xXIPassiveGrabDeviceReq); - - swaps(&stuff->length); - swaps(&stuff->deviceid); -@@ -63,7 +64,9 @@ SProcXIPassiveGrabDevice(ClientPtr client) - swaps(&stuff->mask_len); - swaps(&stuff->num_modifiers); - -- mods = (xXIModifierInfo *) &stuff[1]; -+ REQUEST_FIXED_SIZE(xXIPassiveGrabDeviceReq, -+ ((uint32_t) stuff->mask_len + stuff->num_modifiers) *4); -+ mods = (uint32_t *) &stuff[1] + stuff->mask_len; - - for (i = 0; i < stuff->num_modifiers; i++, mods++) { - swapl(&mods->base_mods); -@@ -88,7 +91,8 @@ ProcXIPassiveGrabDevice(ClientPtr client) - int mask_len; - - REQUEST(xXIPassiveGrabDeviceReq); -- REQUEST_AT_LEAST_SIZE(xXIPassiveGrabDeviceReq); -+ REQUEST_FIXED_SIZE(xXIPassiveGrabDeviceReq, -+ ((uint32_t) stuff->mask_len + stuff->num_modifiers) * 4); - - if (stuff->deviceid == XIAllDevices) - dev = inputInfo.all_devices; -@@ -250,6 +254,7 @@ SProcXIPassiveUngrabDevice(ClientPtr client) - uint32_t *modifiers; - - REQUEST(xXIPassiveUngrabDeviceReq); -+ REQUEST_AT_LEAST_SIZE(xXIPassiveUngrabDeviceReq); - - swaps(&stuff->length); - swapl(&stuff->grab_window); -@@ -257,6 +262,8 @@ SProcXIPassiveUngrabDevice(ClientPtr client) - swapl(&stuff->detail); - swaps(&stuff->num_modifiers); - -+ REQUEST_FIXED_SIZE(xXIPassiveUngrabDeviceReq, -+ ((uint32_t) stuff->num_modifiers) << 2); - modifiers = (uint32_t *) &stuff[1]; - - for (i = 0; i < stuff->num_modifiers; i++, modifiers++) -@@ -275,7 +282,8 @@ ProcXIPassiveUngrabDevice(ClientPtr client) - int i, rc; - - REQUEST(xXIPassiveUngrabDeviceReq); -- REQUEST_AT_LEAST_SIZE(xXIPassiveUngrabDeviceReq); -+ REQUEST_FIXED_SIZE(xXIPassiveUngrabDeviceReq, -+ ((uint32_t) stuff->num_modifiers) << 2); - - if (stuff->deviceid == XIAllDevices) - dev = inputInfo.all_devices; -diff --git a/Xi/xiproperty.c b/Xi/xiproperty.c -index e51aadb..37dc0c6 100644 ---- a/Xi/xiproperty.c -+++ b/Xi/xiproperty.c -@@ -1007,10 +1007,9 @@ int - SProcXListDeviceProperties(ClientPtr client) - { - REQUEST(xListDevicePropertiesReq); -+ REQUEST_SIZE_MATCH(xListDevicePropertiesReq); - - swaps(&stuff->length); -- -- REQUEST_SIZE_MATCH(xListDevicePropertiesReq); - return (ProcXListDeviceProperties(client)); - } - -@@ -1031,10 +1030,10 @@ int - SProcXDeleteDeviceProperty(ClientPtr client) - { - REQUEST(xDeleteDevicePropertyReq); -+ REQUEST_SIZE_MATCH(xDeleteDevicePropertyReq); - - swaps(&stuff->length); - swapl(&stuff->property); -- REQUEST_SIZE_MATCH(xDeleteDevicePropertyReq); - return (ProcXDeleteDeviceProperty(client)); - } - -@@ -1042,13 +1041,13 @@ int - SProcXGetDeviceProperty(ClientPtr client) - { - REQUEST(xGetDevicePropertyReq); -+ REQUEST_SIZE_MATCH(xGetDevicePropertyReq); - - swaps(&stuff->length); - swapl(&stuff->property); - swapl(&stuff->type); - swapl(&stuff->longOffset); - swapl(&stuff->longLength); -- REQUEST_SIZE_MATCH(xGetDevicePropertyReq); - return (ProcXGetDeviceProperty(client)); - } - -@@ -1243,11 +1242,10 @@ int - SProcXIListProperties(ClientPtr client) - { - REQUEST(xXIListPropertiesReq); -+ REQUEST_SIZE_MATCH(xXIListPropertiesReq); - - swaps(&stuff->length); - swaps(&stuff->deviceid); -- -- REQUEST_SIZE_MATCH(xXIListPropertiesReq); - return (ProcXIListProperties(client)); - } - -@@ -1269,11 +1267,11 @@ int - SProcXIDeleteProperty(ClientPtr client) - { - REQUEST(xXIDeletePropertyReq); -+ REQUEST_SIZE_MATCH(xXIDeletePropertyReq); - - swaps(&stuff->length); - swaps(&stuff->deviceid); - swapl(&stuff->property); -- REQUEST_SIZE_MATCH(xXIDeletePropertyReq); - return (ProcXIDeleteProperty(client)); - } - -@@ -1281,6 +1279,7 @@ int - SProcXIGetProperty(ClientPtr client) - { - REQUEST(xXIGetPropertyReq); -+ REQUEST_SIZE_MATCH(xXIGetPropertyReq); - - swaps(&stuff->length); - swaps(&stuff->deviceid); -@@ -1288,7 +1287,6 @@ SProcXIGetProperty(ClientPtr client) - swapl(&stuff->type); - swapl(&stuff->offset); - swapl(&stuff->len); -- REQUEST_SIZE_MATCH(xXIGetPropertyReq); - return (ProcXIGetProperty(client)); - } - -diff --git a/Xi/xiquerydevice.c b/Xi/xiquerydevice.c -index 15c8b2a..5e5c875 100644 ---- a/Xi/xiquerydevice.c -+++ b/Xi/xiquerydevice.c -@@ -54,6 +54,7 @@ int - SProcXIQueryDevice(ClientPtr client) - { - REQUEST(xXIQueryDeviceReq); -+ REQUEST_SIZE_MATCH(xXIQueryDeviceReq); - - swaps(&stuff->length); - swaps(&stuff->deviceid); -diff --git a/Xi/xiquerypointer.c b/Xi/xiquerypointer.c -index 169436e..e61fa04 100644 ---- a/Xi/xiquerypointer.c -+++ b/Xi/xiquerypointer.c -@@ -62,6 +62,8 @@ int - SProcXIQueryPointer(ClientPtr client) - { - REQUEST(xXIQueryPointerReq); -+ REQUEST_SIZE_MATCH(xXIQueryPointerReq); -+ - swaps(&stuff->length); - swaps(&stuff->deviceid); - swapl(&stuff->win); -diff --git a/Xi/xiselectev.c b/Xi/xiselectev.c -index 07d3218..fc02034 100644 ---- a/Xi/xiselectev.c -+++ b/Xi/xiselectev.c -@@ -63,6 +63,7 @@ int - SProcXISelectEvents(ClientPtr client) - { - int i; -+ int len; - xXIEventMask *evmask; - - REQUEST(xXISelectEventsReq); -@@ -71,10 +72,17 @@ SProcXISelectEvents(ClientPtr client) - swapl(&stuff->win); - swaps(&stuff->num_masks); - -+ len = stuff->length - bytes_to_int32(sizeof(xXISelectEventsReq)); - evmask = (xXIEventMask *) &stuff[1]; - for (i = 0; i < stuff->num_masks; i++) { -+ if (len < bytes_to_int32(sizeof(xXIEventMask))) -+ return BadLength; -+ len -= bytes_to_int32(sizeof(xXIEventMask)); - swaps(&evmask->deviceid); - swaps(&evmask->mask_len); -+ if (len < evmask->mask_len) -+ return BadLength; -+ len -= evmask->mask_len; - evmask = - (xXIEventMask *) (((char *) &evmask[1]) + evmask->mask_len * 4); - } -diff --git a/Xi/xisetclientpointer.c b/Xi/xisetclientpointer.c -index 38ff51e..24d4a53 100644 ---- a/Xi/xisetclientpointer.c -+++ b/Xi/xisetclientpointer.c -@@ -51,10 +51,11 @@ int - SProcXISetClientPointer(ClientPtr client) - { - REQUEST(xXISetClientPointerReq); -+ REQUEST_SIZE_MATCH(xXISetClientPointerReq); -+ - swaps(&stuff->length); - swapl(&stuff->win); - swaps(&stuff->deviceid); -- REQUEST_SIZE_MATCH(xXISetClientPointerReq); - return (ProcXISetClientPointer(client)); - } - -diff --git a/Xi/xisetdevfocus.c b/Xi/xisetdevfocus.c -index b52c9cc..a32ccb1 100644 ---- a/Xi/xisetdevfocus.c -+++ b/Xi/xisetdevfocus.c -@@ -44,6 +44,8 @@ int - SProcXISetFocus(ClientPtr client) - { - REQUEST(xXISetFocusReq); -+ REQUEST_AT_LEAST_SIZE(xXISetFocusReq); -+ - swaps(&stuff->length); - swaps(&stuff->deviceid); - swapl(&stuff->focus); -@@ -56,6 +58,8 @@ int - SProcXIGetFocus(ClientPtr client) - { - REQUEST(xXIGetFocusReq); -+ REQUEST_AT_LEAST_SIZE(xXIGetFocusReq); -+ - swaps(&stuff->length); - swaps(&stuff->deviceid); - -diff --git a/Xi/xiwarppointer.c b/Xi/xiwarppointer.c -index 3f051f7..780758a 100644 ---- a/Xi/xiwarppointer.c -+++ b/Xi/xiwarppointer.c -@@ -56,6 +56,8 @@ int - SProcXIWarpPointer(ClientPtr client) - { - REQUEST(xXIWarpPointerReq); -+ REQUEST_SIZE_MATCH(xXIWarpPointerReq); -+ - swaps(&stuff->length); - swapl(&stuff->src_win); - swapl(&stuff->dst_win); -diff --git a/glx/glxcmds.c b/glx/glxcmds.c -index badc2cf..1479634 100644 ---- a/glx/glxcmds.c -+++ b/glx/glxcmds.c -@@ -1990,7 +1990,8 @@ __glXDisp_Render(__GLXclientState * cl, GLbyte * pc) - if (entry.varsize) { - /* variable size command */ - extra = (*entry.varsize) (pc + __GLX_RENDER_HDR_SIZE, -- client->swapped); -+ client->swapped, -+ left - __GLX_RENDER_HDR_SIZE); - if (extra < 0) { - return BadLength; - } -@@ -2067,6 +2068,7 @@ __glXDisp_RenderLarge(__GLXclientState * cl, GLbyte * pc) - if (cl->largeCmdRequestsSoFar == 0) { - __GLXrenderSizeData entry; - int extra = 0; -+ int left = (req->length << 2) - sz_xGLXRenderLargeReq; - size_t cmdlen; - int err; - -@@ -2107,7 +2109,8 @@ __glXDisp_RenderLarge(__GLXclientState * cl, GLbyte * pc) - ** will be in the 1st request, so it's okay to do this. - */ - extra = (*entry.varsize) (pc + __GLX_RENDER_LARGE_HDR_SIZE, -- client->swapped); -+ client->swapped, -+ left - __GLX_RENDER_LARGE_HDR_SIZE); - if (extra < 0) { - return BadLength; - } -diff --git a/glx/glxserver.h b/glx/glxserver.h -index 9bffcd8..ccb895e 100644 ---- a/glx/glxserver.h -+++ b/glx/glxserver.h -@@ -167,7 +167,7 @@ typedef int (*__GLXprocPtr) (__GLXclientState *, char *pc); - /* - * Tables for computing the size of each rendering command. - */ --typedef int (*gl_proto_size_func) (const GLbyte *, Bool); -+typedef int (*gl_proto_size_func) (const GLbyte *, Bool, int); - - typedef struct { - int bytes; -diff --git a/glx/indirect_reqsize.c b/glx/indirect_reqsize.c -index 86ea970..ce58214 100644 ---- a/glx/indirect_reqsize.c -+++ b/glx/indirect_reqsize.c -@@ -31,24 +31,22 @@ - #include "indirect_size.h" - #include "indirect_reqsize.h" - --#define __GLX_PAD(x) (((x) + 3) & ~3) -- - #if defined(__CYGWIN__) || defined(__MINGW32__) - #undef HAVE_ALIAS - #endif - #ifdef HAVE_ALIAS - #define ALIAS2(from,to) \ -- GLint __glX ## from ## ReqSize( const GLbyte * pc, Bool swap ) \ -+ GLint __glX ## from ## ReqSize( const GLbyte * pc, Bool swap, int reqlen ) \ - __attribute__ ((alias( # to ))); - #define ALIAS(from,to) ALIAS2( from, __glX ## to ## ReqSize ) - #else - #define ALIAS(from,to) \ -- GLint __glX ## from ## ReqSize( const GLbyte * pc, Bool swap ) \ -- { return __glX ## to ## ReqSize( pc, swap ); } -+ GLint __glX ## from ## ReqSize( const GLbyte * pc, Bool swap, int reqlen ) \ -+ { return __glX ## to ## ReqSize( pc, swap, reqlen ); } - #endif - - int --__glXCallListsReqSize(const GLbyte * pc, Bool swap) -+__glXCallListsReqSize(const GLbyte * pc, Bool swap, int reqlen) - { - GLsizei n = *(GLsizei *) (pc + 0); - GLenum type = *(GLenum *) (pc + 4); -@@ -60,11 +58,11 @@ __glXCallListsReqSize(const GLbyte * pc, Bool swap) - } - - compsize = __glCallLists_size(type); -- return __GLX_PAD((compsize * n)); -+ return safe_pad(safe_mul(compsize, n)); - } - - int --__glXBitmapReqSize(const GLbyte * pc, Bool swap) -+__glXBitmapReqSize(const GLbyte * pc, Bool swap, int reqlen) - { - GLint row_length = *(GLint *) (pc + 4); - GLint image_height = 0; -@@ -88,7 +86,7 @@ __glXBitmapReqSize(const GLbyte * pc, Bool swap) - } - - int --__glXFogfvReqSize(const GLbyte * pc, Bool swap) -+__glXFogfvReqSize(const GLbyte * pc, Bool swap, int reqlen) - { - GLenum pname = *(GLenum *) (pc + 0); - GLsizei compsize; -@@ -98,11 +96,11 @@ __glXFogfvReqSize(const GLbyte * pc, Bool swap) - } - - compsize = __glFogfv_size(pname); -- return __GLX_PAD((compsize * 4)); -+ return safe_pad(safe_mul(compsize, 4)); - } - - int --__glXLightfvReqSize(const GLbyte * pc, Bool swap) -+__glXLightfvReqSize(const GLbyte * pc, Bool swap, int reqlen) - { - GLenum pname = *(GLenum *) (pc + 4); - GLsizei compsize; -@@ -112,11 +110,11 @@ __glXLightfvReqSize(const GLbyte * pc, Bool swap) - } - - compsize = __glLightfv_size(pname); -- return __GLX_PAD((compsize * 4)); -+ return safe_pad(safe_mul(compsize, 4)); - } - - int --__glXLightModelfvReqSize(const GLbyte * pc, Bool swap) -+__glXLightModelfvReqSize(const GLbyte * pc, Bool swap, int reqlen) - { - GLenum pname = *(GLenum *) (pc + 0); - GLsizei compsize; -@@ -126,11 +124,11 @@ __glXLightModelfvReqSize(const GLbyte * pc, Bool swap) - } - - compsize = __glLightModelfv_size(pname); -- return __GLX_PAD((compsize * 4)); -+ return safe_pad(safe_mul(compsize, 4)); - } - - int --__glXMaterialfvReqSize(const GLbyte * pc, Bool swap) -+__glXMaterialfvReqSize(const GLbyte * pc, Bool swap, int reqlen) - { - GLenum pname = *(GLenum *) (pc + 4); - GLsizei compsize; -@@ -140,11 +138,11 @@ __glXMaterialfvReqSize(const GLbyte * pc, Bool swap) - } - - compsize = __glMaterialfv_size(pname); -- return __GLX_PAD((compsize * 4)); -+ return safe_pad(safe_mul(compsize, 4)); - } - - int --__glXPolygonStippleReqSize(const GLbyte * pc, Bool swap) -+__glXPolygonStippleReqSize(const GLbyte * pc, Bool swap, int reqlen) - { - GLint row_length = *(GLint *) (pc + 4); - GLint image_height = 0; -@@ -164,7 +162,7 @@ __glXPolygonStippleReqSize(const GLbyte * pc, Bool swap) - } - - int --__glXTexParameterfvReqSize(const GLbyte * pc, Bool swap) -+__glXTexParameterfvReqSize(const GLbyte * pc, Bool swap, int reqlen) - { - GLenum pname = *(GLenum *) (pc + 4); - GLsizei compsize; -@@ -174,11 +172,11 @@ __glXTexParameterfvReqSize(const GLbyte * pc, Bool swap) - } - - compsize = __glTexParameterfv_size(pname); -- return __GLX_PAD((compsize * 4)); -+ return safe_pad(safe_mul(compsize, 4)); - } - - int --__glXTexImage1DReqSize(const GLbyte * pc, Bool swap) -+__glXTexImage1DReqSize(const GLbyte * pc, Bool swap, int reqlen) - { - GLint row_length = *(GLint *) (pc + 4); - GLint image_height = 0; -@@ -206,7 +204,7 @@ __glXTexImage1DReqSize(const GLbyte * pc, Bool swap) - } - - int --__glXTexImage2DReqSize(const GLbyte * pc, Bool swap) -+__glXTexImage2DReqSize(const GLbyte * pc, Bool swap, int reqlen) - { - GLint row_length = *(GLint *) (pc + 4); - GLint image_height = 0; -@@ -236,7 +234,7 @@ __glXTexImage2DReqSize(const GLbyte * pc, Bool swap) - } - - int --__glXTexEnvfvReqSize(const GLbyte * pc, Bool swap) -+__glXTexEnvfvReqSize(const GLbyte * pc, Bool swap, int reqlen) - { - GLenum pname = *(GLenum *) (pc + 4); - GLsizei compsize; -@@ -246,11 +244,11 @@ __glXTexEnvfvReqSize(const GLbyte * pc, Bool swap) - } - - compsize = __glTexEnvfv_size(pname); -- return __GLX_PAD((compsize * 4)); -+ return safe_pad(safe_mul(compsize, 4)); - } - - int --__glXTexGendvReqSize(const GLbyte * pc, Bool swap) -+__glXTexGendvReqSize(const GLbyte * pc, Bool swap, int reqlen) - { - GLenum pname = *(GLenum *) (pc + 4); - GLsizei compsize; -@@ -260,11 +258,11 @@ __glXTexGendvReqSize(const GLbyte * pc, Bool swap) - } - - compsize = __glTexGendv_size(pname); -- return __GLX_PAD((compsize * 8)); -+ return safe_pad(safe_mul(compsize, 8)); - } - - int --__glXTexGenfvReqSize(const GLbyte * pc, Bool swap) -+__glXTexGenfvReqSize(const GLbyte * pc, Bool swap, int reqlen) - { - GLenum pname = *(GLenum *) (pc + 4); - GLsizei compsize; -@@ -274,11 +272,11 @@ __glXTexGenfvReqSize(const GLbyte * pc, Bool swap) - } - - compsize = __glTexGenfv_size(pname); -- return __GLX_PAD((compsize * 4)); -+ return safe_pad(safe_mul(compsize, 4)); - } - - int --__glXPixelMapfvReqSize(const GLbyte * pc, Bool swap) -+__glXPixelMapfvReqSize(const GLbyte * pc, Bool swap, int reqlen) - { - GLsizei mapsize = *(GLsizei *) (pc + 4); - -@@ -286,11 +284,11 @@ __glXPixelMapfvReqSize(const GLbyte * pc, Bool swap) - mapsize = bswap_32(mapsize); - } - -- return __GLX_PAD((mapsize * 4)); -+ return safe_pad(safe_mul(mapsize, 4)); - } - - int --__glXPixelMapusvReqSize(const GLbyte * pc, Bool swap) -+__glXPixelMapusvReqSize(const GLbyte * pc, Bool swap, int reqlen) - { - GLsizei mapsize = *(GLsizei *) (pc + 4); - -@@ -298,11 +296,11 @@ __glXPixelMapusvReqSize(const GLbyte * pc, Bool swap) - mapsize = bswap_32(mapsize); - } - -- return __GLX_PAD((mapsize * 2)); -+ return safe_pad(safe_mul(mapsize, 2)); - } - - int --__glXDrawPixelsReqSize(const GLbyte * pc, Bool swap) -+__glXDrawPixelsReqSize(const GLbyte * pc, Bool swap, int reqlen) - { - GLint row_length = *(GLint *) (pc + 4); - GLint image_height = 0; -@@ -330,7 +328,7 @@ __glXDrawPixelsReqSize(const GLbyte * pc, Bool swap) - } - - int --__glXPrioritizeTexturesReqSize(const GLbyte * pc, Bool swap) -+__glXPrioritizeTexturesReqSize(const GLbyte * pc, Bool swap, int reqlen) - { - GLsizei n = *(GLsizei *) (pc + 0); - -@@ -338,11 +336,11 @@ __glXPrioritizeTexturesReqSize(const GLbyte * pc, Bool swap) - n = bswap_32(n); - } - -- return __GLX_PAD((n * 4) + (n * 4)); -+ return safe_pad(safe_add(safe_mul(n, 4), safe_mul(n, 4))); - } - - int --__glXTexSubImage1DReqSize(const GLbyte * pc, Bool swap) -+__glXTexSubImage1DReqSize(const GLbyte * pc, Bool swap, int reqlen) - { - GLint row_length = *(GLint *) (pc + 4); - GLint image_height = 0; -@@ -370,7 +368,7 @@ __glXTexSubImage1DReqSize(const GLbyte * pc, Bool swap) - } - - int --__glXTexSubImage2DReqSize(const GLbyte * pc, Bool swap) -+__glXTexSubImage2DReqSize(const GLbyte * pc, Bool swap, int reqlen) - { - GLint row_length = *(GLint *) (pc + 4); - GLint image_height = 0; -@@ -400,7 +398,7 @@ __glXTexSubImage2DReqSize(const GLbyte * pc, Bool swap) - } - - int --__glXColorTableReqSize(const GLbyte * pc, Bool swap) -+__glXColorTableReqSize(const GLbyte * pc, Bool swap, int reqlen) - { - GLint row_length = *(GLint *) (pc + 4); - GLint image_height = 0; -@@ -428,7 +426,7 @@ __glXColorTableReqSize(const GLbyte * pc, Bool swap) - } - - int --__glXColorTableParameterfvReqSize(const GLbyte * pc, Bool swap) -+__glXColorTableParameterfvReqSize(const GLbyte * pc, Bool swap, int reqlen) - { - GLenum pname = *(GLenum *) (pc + 4); - GLsizei compsize; -@@ -438,11 +436,11 @@ __glXColorTableParameterfvReqSize(const GLbyte * pc, Bool swap) - } - - compsize = __glColorTableParameterfv_size(pname); -- return __GLX_PAD((compsize * 4)); -+ return safe_pad(safe_mul(compsize, 4)); - } - - int --__glXColorSubTableReqSize(const GLbyte * pc, Bool swap) -+__glXColorSubTableReqSize(const GLbyte * pc, Bool swap, int reqlen) - { - GLint row_length = *(GLint *) (pc + 4); - GLint image_height = 0; -@@ -470,7 +468,7 @@ __glXColorSubTableReqSize(const GLbyte * pc, Bool swap) - } - - int --__glXConvolutionFilter1DReqSize(const GLbyte * pc, Bool swap) -+__glXConvolutionFilter1DReqSize(const GLbyte * pc, Bool swap, int reqlen) - { - GLint row_length = *(GLint *) (pc + 4); - GLint image_height = 0; -@@ -498,7 +496,7 @@ __glXConvolutionFilter1DReqSize(const GLbyte * pc, Bool swap) - } - - int --__glXConvolutionFilter2DReqSize(const GLbyte * pc, Bool swap) -+__glXConvolutionFilter2DReqSize(const GLbyte * pc, Bool swap, int reqlen) - { - GLint row_length = *(GLint *) (pc + 4); - GLint image_height = 0; -@@ -528,7 +526,7 @@ __glXConvolutionFilter2DReqSize(const GLbyte * pc, Bool swap) - } - - int --__glXConvolutionParameterfvReqSize(const GLbyte * pc, Bool swap) -+__glXConvolutionParameterfvReqSize(const GLbyte * pc, Bool swap, int reqlen) - { - GLenum pname = *(GLenum *) (pc + 4); - GLsizei compsize; -@@ -538,11 +536,11 @@ __glXConvolutionParameterfvReqSize(const GLbyte * pc, Bool swap) - } - - compsize = __glConvolutionParameterfv_size(pname); -- return __GLX_PAD((compsize * 4)); -+ return safe_pad(safe_mul(compsize, 4)); - } - - int --__glXTexImage3DReqSize(const GLbyte * pc, Bool swap) -+__glXTexImage3DReqSize(const GLbyte * pc, Bool swap, int reqlen) - { - GLint row_length = *(GLint *) (pc + 4); - GLint image_height = *(GLint *) (pc + 8); -@@ -579,7 +577,7 @@ __glXTexImage3DReqSize(const GLbyte * pc, Bool swap) - } - - int --__glXTexSubImage3DReqSize(const GLbyte * pc, Bool swap) -+__glXTexSubImage3DReqSize(const GLbyte * pc, Bool swap, int reqlen) - { - GLint row_length = *(GLint *) (pc + 4); - GLint image_height = *(GLint *) (pc + 8); -@@ -613,7 +611,7 @@ __glXTexSubImage3DReqSize(const GLbyte * pc, Bool swap) - } - - int --__glXCompressedTexImage1DARBReqSize(const GLbyte * pc, Bool swap) -+__glXCompressedTexImage1DARBReqSize(const GLbyte * pc, Bool swap, int reqlen) - { - GLsizei imageSize = *(GLsizei *) (pc + 20); - -@@ -621,11 +619,11 @@ __glXCompressedTexImage1DARBReqSize(const GLbyte * pc, Bool swap) - imageSize = bswap_32(imageSize); - } - -- return __GLX_PAD(imageSize); -+ return safe_pad(imageSize); - } - - int --__glXCompressedTexImage2DARBReqSize(const GLbyte * pc, Bool swap) -+__glXCompressedTexImage2DARBReqSize(const GLbyte * pc, Bool swap, int reqlen) - { - GLsizei imageSize = *(GLsizei *) (pc + 24); - -@@ -633,11 +631,11 @@ __glXCompressedTexImage2DARBReqSize(const GLbyte * pc, Bool swap) - imageSize = bswap_32(imageSize); - } - -- return __GLX_PAD(imageSize); -+ return safe_pad(imageSize); - } - - int --__glXCompressedTexImage3DARBReqSize(const GLbyte * pc, Bool swap) -+__glXCompressedTexImage3DARBReqSize(const GLbyte * pc, Bool swap, int reqlen) - { - GLsizei imageSize = *(GLsizei *) (pc + 28); - -@@ -645,11 +643,11 @@ __glXCompressedTexImage3DARBReqSize(const GLbyte * pc, Bool swap) - imageSize = bswap_32(imageSize); - } - -- return __GLX_PAD(imageSize); -+ return safe_pad(imageSize); - } - - int --__glXCompressedTexSubImage3DARBReqSize(const GLbyte * pc, Bool swap) -+__glXCompressedTexSubImage3DARBReqSize(const GLbyte * pc, Bool swap, int reqlen) - { - GLsizei imageSize = *(GLsizei *) (pc + 36); - -@@ -657,11 +655,11 @@ __glXCompressedTexSubImage3DARBReqSize(const GLbyte * pc, Bool swap) - imageSize = bswap_32(imageSize); - } - -- return __GLX_PAD(imageSize); -+ return safe_pad(imageSize); - } - - int --__glXProgramStringARBReqSize(const GLbyte * pc, Bool swap) -+__glXProgramStringARBReqSize(const GLbyte * pc, Bool swap, int reqlen) - { - GLsizei len = *(GLsizei *) (pc + 8); - -@@ -669,11 +667,11 @@ __glXProgramStringARBReqSize(const GLbyte * pc, Bool swap) - len = bswap_32(len); - } - -- return __GLX_PAD(len); -+ return safe_pad(len); - } - - int --__glXDrawBuffersARBReqSize(const GLbyte * pc, Bool swap) -+__glXDrawBuffersARBReqSize(const GLbyte * pc, Bool swap, int reqlen) - { - GLsizei n = *(GLsizei *) (pc + 0); - -@@ -681,11 +679,11 @@ __glXDrawBuffersARBReqSize(const GLbyte * pc, Bool swap) - n = bswap_32(n); - } - -- return __GLX_PAD((n * 4)); -+ return safe_pad(safe_mul(n, 4)); - } - - int --__glXPointParameterfvEXTReqSize(const GLbyte * pc, Bool swap) -+__glXPointParameterfvEXTReqSize(const GLbyte * pc, Bool swap, int reqlen) - { - GLenum pname = *(GLenum *) (pc + 0); - GLsizei compsize; -@@ -695,11 +693,11 @@ __glXPointParameterfvEXTReqSize(const GLbyte * pc, Bool swap) - } - - compsize = __glPointParameterfvEXT_size(pname); -- return __GLX_PAD((compsize * 4)); -+ return safe_pad(safe_mul(compsize, 4)); - } - - int --__glXProgramParameters4dvNVReqSize(const GLbyte * pc, Bool swap) -+__glXProgramParameters4dvNVReqSize(const GLbyte * pc, Bool swap, int reqlen) - { - GLsizei num = *(GLsizei *) (pc + 8); - -@@ -707,11 +705,11 @@ __glXProgramParameters4dvNVReqSize(const GLbyte * pc, Bool swap) - num = bswap_32(num); - } - -- return __GLX_PAD((num * 32)); -+ return safe_pad(safe_mul(num, 32)); - } - - int --__glXProgramParameters4fvNVReqSize(const GLbyte * pc, Bool swap) -+__glXProgramParameters4fvNVReqSize(const GLbyte * pc, Bool swap, int reqlen) - { - GLsizei num = *(GLsizei *) (pc + 8); - -@@ -719,11 +717,11 @@ __glXProgramParameters4fvNVReqSize(const GLbyte * pc, Bool swap) - num = bswap_32(num); - } - -- return __GLX_PAD((num * 16)); -+ return safe_pad(safe_mul(num, 16)); - } - - int --__glXVertexAttribs1dvNVReqSize(const GLbyte * pc, Bool swap) -+__glXVertexAttribs1dvNVReqSize(const GLbyte * pc, Bool swap, int reqlen) - { - GLsizei n = *(GLsizei *) (pc + 4); - -@@ -731,11 +729,11 @@ __glXVertexAttribs1dvNVReqSize(const GLbyte * pc, Bool swap) - n = bswap_32(n); - } - -- return __GLX_PAD((n * 8)); -+ return safe_pad(safe_mul(n, 8)); - } - - int --__glXVertexAttribs2dvNVReqSize(const GLbyte * pc, Bool swap) -+__glXVertexAttribs2dvNVReqSize(const GLbyte * pc, Bool swap, int reqlen) - { - GLsizei n = *(GLsizei *) (pc + 4); - -@@ -743,11 +741,11 @@ __glXVertexAttribs2dvNVReqSize(const GLbyte * pc, Bool swap) - n = bswap_32(n); - } - -- return __GLX_PAD((n * 16)); -+ return safe_pad(safe_mul(n, 16)); - } - - int --__glXVertexAttribs3dvNVReqSize(const GLbyte * pc, Bool swap) -+__glXVertexAttribs3dvNVReqSize(const GLbyte * pc, Bool swap, int reqlen) - { - GLsizei n = *(GLsizei *) (pc + 4); - -@@ -755,11 +753,11 @@ __glXVertexAttribs3dvNVReqSize(const GLbyte * pc, Bool swap) - n = bswap_32(n); - } - -- return __GLX_PAD((n * 24)); -+ return safe_pad(safe_mul(n, 24)); - } - - int --__glXVertexAttribs3fvNVReqSize(const GLbyte * pc, Bool swap) -+__glXVertexAttribs3fvNVReqSize(const GLbyte * pc, Bool swap, int reqlen) - { - GLsizei n = *(GLsizei *) (pc + 4); - -@@ -767,11 +765,11 @@ __glXVertexAttribs3fvNVReqSize(const GLbyte * pc, Bool swap) - n = bswap_32(n); - } - -- return __GLX_PAD((n * 12)); -+ return safe_pad(safe_mul(n, 12)); - } - - int --__glXVertexAttribs3svNVReqSize(const GLbyte * pc, Bool swap) -+__glXVertexAttribs3svNVReqSize(const GLbyte * pc, Bool swap, int reqlen) - { - GLsizei n = *(GLsizei *) (pc + 4); - -@@ -779,11 +777,11 @@ __glXVertexAttribs3svNVReqSize(const GLbyte * pc, Bool swap) - n = bswap_32(n); - } - -- return __GLX_PAD((n * 6)); -+ return safe_pad(safe_mul(n, 6)); - } - - int --__glXVertexAttribs4dvNVReqSize(const GLbyte * pc, Bool swap) -+__glXVertexAttribs4dvNVReqSize(const GLbyte * pc, Bool swap, int reqlen) - { - GLsizei n = *(GLsizei *) (pc + 4); - -@@ -791,11 +789,11 @@ __glXVertexAttribs4dvNVReqSize(const GLbyte * pc, Bool swap) - n = bswap_32(n); - } - -- return __GLX_PAD((n * 32)); -+ return safe_pad(safe_mul(n, 32)); - } - - int --__glXProgramNamedParameter4fvNVReqSize(const GLbyte * pc, Bool swap) -+__glXProgramNamedParameter4fvNVReqSize(const GLbyte * pc, Bool swap, int reqlen) - { - GLsizei len = *(GLsizei *) (pc + 4); - -@@ -803,7 +801,7 @@ __glXProgramNamedParameter4fvNVReqSize(const GLbyte * pc, Bool swap) - len = bswap_32(len); - } - -- return __GLX_PAD(len); -+ return safe_pad(len); - } - - ALIAS(Fogiv, Fogfv) -diff --git a/glx/indirect_reqsize.h b/glx/indirect_reqsize.h -index d2c1da7..22e1350 100644 ---- a/glx/indirect_reqsize.h -+++ b/glx/indirect_reqsize.h -@@ -36,128 +36,128 @@ - #define PURE - #endif - --extern PURE _X_HIDDEN int __glXCallListsReqSize(const GLbyte * pc, Bool swap); --extern PURE _X_HIDDEN int __glXBitmapReqSize(const GLbyte * pc, Bool swap); --extern PURE _X_HIDDEN int __glXFogfvReqSize(const GLbyte * pc, Bool swap); --extern PURE _X_HIDDEN int __glXFogivReqSize(const GLbyte * pc, Bool swap); --extern PURE _X_HIDDEN int __glXLightfvReqSize(const GLbyte * pc, Bool swap); --extern PURE _X_HIDDEN int __glXLightivReqSize(const GLbyte * pc, Bool swap); -+extern PURE _X_HIDDEN int __glXCallListsReqSize(const GLbyte * pc, Bool swap, int reqlen); -+extern PURE _X_HIDDEN int __glXBitmapReqSize(const GLbyte * pc, Bool swap, int reqlen); -+extern PURE _X_HIDDEN int __glXFogfvReqSize(const GLbyte * pc, Bool swap, int reqlen); -+extern PURE _X_HIDDEN int __glXFogivReqSize(const GLbyte * pc, Bool swap, int reqlen); -+extern PURE _X_HIDDEN int __glXLightfvReqSize(const GLbyte * pc, Bool swap, int reqlen); -+extern PURE _X_HIDDEN int __glXLightivReqSize(const GLbyte * pc, Bool swap, int reqlen); - extern PURE _X_HIDDEN int __glXLightModelfvReqSize(const GLbyte * pc, -- Bool swap); -+ Bool swap, int reqlen); - extern PURE _X_HIDDEN int __glXLightModelivReqSize(const GLbyte * pc, -- Bool swap); --extern PURE _X_HIDDEN int __glXMaterialfvReqSize(const GLbyte * pc, Bool swap); --extern PURE _X_HIDDEN int __glXMaterialivReqSize(const GLbyte * pc, Bool swap); -+ Bool swap, int reqlen); -+extern PURE _X_HIDDEN int __glXMaterialfvReqSize(const GLbyte * pc, Bool swap, int reqlen); -+extern PURE _X_HIDDEN int __glXMaterialivReqSize(const GLbyte * pc, Bool swap, int reqlen); - extern PURE _X_HIDDEN int __glXPolygonStippleReqSize(const GLbyte * pc, -- Bool swap); -+ Bool swap, int reqlen); - extern PURE _X_HIDDEN int __glXTexParameterfvReqSize(const GLbyte * pc, -- Bool swap); -+ Bool swap, int reqlen); - extern PURE _X_HIDDEN int __glXTexParameterivReqSize(const GLbyte * pc, -- Bool swap); --extern PURE _X_HIDDEN int __glXTexImage1DReqSize(const GLbyte * pc, Bool swap); --extern PURE _X_HIDDEN int __glXTexImage2DReqSize(const GLbyte * pc, Bool swap); --extern PURE _X_HIDDEN int __glXTexEnvfvReqSize(const GLbyte * pc, Bool swap); --extern PURE _X_HIDDEN int __glXTexEnvivReqSize(const GLbyte * pc, Bool swap); --extern PURE _X_HIDDEN int __glXTexGendvReqSize(const GLbyte * pc, Bool swap); --extern PURE _X_HIDDEN int __glXTexGenfvReqSize(const GLbyte * pc, Bool swap); --extern PURE _X_HIDDEN int __glXTexGenivReqSize(const GLbyte * pc, Bool swap); --extern PURE _X_HIDDEN int __glXMap1dReqSize(const GLbyte * pc, Bool swap); --extern PURE _X_HIDDEN int __glXMap1fReqSize(const GLbyte * pc, Bool swap); --extern PURE _X_HIDDEN int __glXMap2dReqSize(const GLbyte * pc, Bool swap); --extern PURE _X_HIDDEN int __glXMap2fReqSize(const GLbyte * pc, Bool swap); --extern PURE _X_HIDDEN int __glXPixelMapfvReqSize(const GLbyte * pc, Bool swap); --extern PURE _X_HIDDEN int __glXPixelMapuivReqSize(const GLbyte * pc, Bool swap); --extern PURE _X_HIDDEN int __glXPixelMapusvReqSize(const GLbyte * pc, Bool swap); --extern PURE _X_HIDDEN int __glXDrawPixelsReqSize(const GLbyte * pc, Bool swap); --extern PURE _X_HIDDEN int __glXDrawArraysReqSize(const GLbyte * pc, Bool swap); -+ Bool swap, int reqlen); -+extern PURE _X_HIDDEN int __glXTexImage1DReqSize(const GLbyte * pc, Bool swap, int reqlen); -+extern PURE _X_HIDDEN int __glXTexImage2DReqSize(const GLbyte * pc, Bool swap, int reqlen); -+extern PURE _X_HIDDEN int __glXTexEnvfvReqSize(const GLbyte * pc, Bool swap, int reqlen); -+extern PURE _X_HIDDEN int __glXTexEnvivReqSize(const GLbyte * pc, Bool swap, int reqlen); -+extern PURE _X_HIDDEN int __glXTexGendvReqSize(const GLbyte * pc, Bool swap, int reqlen); -+extern PURE _X_HIDDEN int __glXTexGenfvReqSize(const GLbyte * pc, Bool swap, int reqlen); -+extern PURE _X_HIDDEN int __glXTexGenivReqSize(const GLbyte * pc, Bool swap, int reqlen); -+extern PURE _X_HIDDEN int __glXMap1dReqSize(const GLbyte * pc, Bool swap, int reqlen); -+extern PURE _X_HIDDEN int __glXMap1fReqSize(const GLbyte * pc, Bool swap, int reqlen); -+extern PURE _X_HIDDEN int __glXMap2dReqSize(const GLbyte * pc, Bool swap, int reqlen); -+extern PURE _X_HIDDEN int __glXMap2fReqSize(const GLbyte * pc, Bool swap, int reqlen); -+extern PURE _X_HIDDEN int __glXPixelMapfvReqSize(const GLbyte * pc, Bool swap, int reqlen); -+extern PURE _X_HIDDEN int __glXPixelMapuivReqSize(const GLbyte * pc, Bool swap, int reqlen); -+extern PURE _X_HIDDEN int __glXPixelMapusvReqSize(const GLbyte * pc, Bool swap, int reqlen); -+extern PURE _X_HIDDEN int __glXDrawPixelsReqSize(const GLbyte * pc, Bool swap, int reqlen); -+extern PURE _X_HIDDEN int __glXDrawArraysReqSize(const GLbyte * pc, Bool swap, int reqlen); - extern PURE _X_HIDDEN int __glXPrioritizeTexturesReqSize(const GLbyte * pc, -- Bool swap); -+ Bool swap, int reqlen); - extern PURE _X_HIDDEN int __glXTexSubImage1DReqSize(const GLbyte * pc, -- Bool swap); -+ Bool swap, int reqlen); - extern PURE _X_HIDDEN int __glXTexSubImage2DReqSize(const GLbyte * pc, -- Bool swap); --extern PURE _X_HIDDEN int __glXColorTableReqSize(const GLbyte * pc, Bool swap); -+ Bool swap, int reqlen); -+extern PURE _X_HIDDEN int __glXColorTableReqSize(const GLbyte * pc, Bool swap, int reqlen); - extern PURE _X_HIDDEN int __glXColorTableParameterfvReqSize(const GLbyte * pc, -- Bool swap); -+ Bool swap, int reqlen); - extern PURE _X_HIDDEN int __glXColorTableParameterivReqSize(const GLbyte * pc, -- Bool swap); -+ Bool swap, int reqlen); - extern PURE _X_HIDDEN int __glXColorSubTableReqSize(const GLbyte * pc, -- Bool swap); -+ Bool swap, int reqlen); - extern PURE _X_HIDDEN int __glXConvolutionFilter1DReqSize(const GLbyte * pc, -- Bool swap); -+ Bool swap, int reqlen); - extern PURE _X_HIDDEN int __glXConvolutionFilter2DReqSize(const GLbyte * pc, -- Bool swap); -+ Bool swap, int reqlen); - extern PURE _X_HIDDEN int __glXConvolutionParameterfvReqSize(const GLbyte * pc, -- Bool swap); -+ Bool swap, int reqlen); - extern PURE _X_HIDDEN int __glXConvolutionParameterivReqSize(const GLbyte * pc, -- Bool swap); -+ Bool swap, int reqlen); - extern PURE _X_HIDDEN int __glXSeparableFilter2DReqSize(const GLbyte * pc, -- Bool swap); --extern PURE _X_HIDDEN int __glXTexImage3DReqSize(const GLbyte * pc, Bool swap); -+ Bool swap, int reqlen); -+extern PURE _X_HIDDEN int __glXTexImage3DReqSize(const GLbyte * pc, Bool swap, int reqlen); - extern PURE _X_HIDDEN int __glXTexSubImage3DReqSize(const GLbyte * pc, -- Bool swap); -+ Bool swap, int reqlen); - extern PURE _X_HIDDEN int __glXCompressedTexImage1DARBReqSize(const GLbyte * pc, -- Bool swap); -+ Bool swap, int reqlen); - extern PURE _X_HIDDEN int __glXCompressedTexImage2DARBReqSize(const GLbyte * pc, -- Bool swap); -+ Bool swap, int reqlen); - extern PURE _X_HIDDEN int __glXCompressedTexImage3DARBReqSize(const GLbyte * pc, -- Bool swap); -+ Bool swap, int reqlen); - extern PURE _X_HIDDEN int __glXCompressedTexSubImage1DARBReqSize(const GLbyte * -- pc, Bool swap); -+ pc, Bool swap, int reqlen); - extern PURE _X_HIDDEN int __glXCompressedTexSubImage2DARBReqSize(const GLbyte * -- pc, Bool swap); -+ pc, Bool swap, int reqlen); - extern PURE _X_HIDDEN int __glXCompressedTexSubImage3DARBReqSize(const GLbyte * -- pc, Bool swap); -+ pc, Bool swap, int reqlen); - extern PURE _X_HIDDEN int __glXProgramStringARBReqSize(const GLbyte * pc, -- Bool swap); -+ Bool swap, int reqlen); - extern PURE _X_HIDDEN int __glXDrawBuffersARBReqSize(const GLbyte * pc, -- Bool swap); -+ Bool swap, int reqlen); - extern PURE _X_HIDDEN int __glXPointParameterfvEXTReqSize(const GLbyte * pc, -- Bool swap); -+ Bool swap, int reqlen); - extern PURE _X_HIDDEN int __glXLoadProgramNVReqSize(const GLbyte * pc, -- Bool swap); -+ Bool swap, int reqlen); - extern PURE _X_HIDDEN int __glXProgramParameters4dvNVReqSize(const GLbyte * pc, -- Bool swap); -+ Bool swap, int reqlen); - extern PURE _X_HIDDEN int __glXProgramParameters4fvNVReqSize(const GLbyte * pc, -- Bool swap); -+ Bool swap, int reqlen); - extern PURE _X_HIDDEN int __glXRequestResidentProgramsNVReqSize(const GLbyte * -- pc, Bool swap); -+ pc, Bool swap, int reqlen); - extern PURE _X_HIDDEN int __glXVertexAttribs1dvNVReqSize(const GLbyte * pc, -- Bool swap); -+ Bool swap, int reqlen); - extern PURE _X_HIDDEN int __glXVertexAttribs1fvNVReqSize(const GLbyte * pc, -- Bool swap); -+ Bool swap, int reqlen); - extern PURE _X_HIDDEN int __glXVertexAttribs1svNVReqSize(const GLbyte * pc, -- Bool swap); -+ Bool swap, int reqlen); - extern PURE _X_HIDDEN int __glXVertexAttribs2dvNVReqSize(const GLbyte * pc, -- Bool swap); -+ Bool swap, int reqlen); - extern PURE _X_HIDDEN int __glXVertexAttribs2fvNVReqSize(const GLbyte * pc, -- Bool swap); -+ Bool swap, int reqlen); - extern PURE _X_HIDDEN int __glXVertexAttribs2svNVReqSize(const GLbyte * pc, -- Bool swap); -+ Bool swap, int reqlen); - extern PURE _X_HIDDEN int __glXVertexAttribs3dvNVReqSize(const GLbyte * pc, -- Bool swap); -+ Bool swap, int reqlen); - extern PURE _X_HIDDEN int __glXVertexAttribs3fvNVReqSize(const GLbyte * pc, -- Bool swap); -+ Bool swap, int reqlen); - extern PURE _X_HIDDEN int __glXVertexAttribs3svNVReqSize(const GLbyte * pc, -- Bool swap); -+ Bool swap, int reqlen); - extern PURE _X_HIDDEN int __glXVertexAttribs4dvNVReqSize(const GLbyte * pc, -- Bool swap); -+ Bool swap, int reqlen); - extern PURE _X_HIDDEN int __glXVertexAttribs4fvNVReqSize(const GLbyte * pc, -- Bool swap); -+ Bool swap, int reqlen); - extern PURE _X_HIDDEN int __glXVertexAttribs4svNVReqSize(const GLbyte * pc, -- Bool swap); -+ Bool swap, int reqlen); - extern PURE _X_HIDDEN int __glXVertexAttribs4ubvNVReqSize(const GLbyte * pc, -- Bool swap); -+ Bool swap, int reqlen); - extern PURE _X_HIDDEN int __glXPointParameterivNVReqSize(const GLbyte * pc, -- Bool swap); -+ Bool swap, int reqlen); - extern PURE _X_HIDDEN int __glXProgramNamedParameter4dvNVReqSize(const GLbyte * -- pc, Bool swap); -+ pc, Bool swap, int reqlen); - extern PURE _X_HIDDEN int __glXProgramNamedParameter4fvNVReqSize(const GLbyte * -- pc, Bool swap); -+ pc, Bool swap, int reqlen); - extern PURE _X_HIDDEN int __glXDeleteFramebuffersEXTReqSize(const GLbyte * pc, -- Bool swap); -+ Bool swap, int reqlen); - extern PURE _X_HIDDEN int __glXDeleteRenderbuffersEXTReqSize(const GLbyte * pc, -- Bool swap); -+ Bool swap, int reqlen); - - #undef PURE - -diff --git a/glx/rensize.c b/glx/rensize.c -index 6ee0f9c..a532467 100644 ---- a/glx/rensize.c -+++ b/glx/rensize.c -@@ -44,7 +44,7 @@ - ((a & 0xff00U)<<8) | ((a & 0xffU)<<24)) - - int --__glXMap1dReqSize(const GLbyte * pc, Bool swap) -+__glXMap1dReqSize(const GLbyte * pc, Bool swap, int reqlen) - { - GLenum target; - GLint order; -@@ -61,7 +61,7 @@ __glXMap1dReqSize(const GLbyte * pc, Bool swap) - } - - int --__glXMap1fReqSize(const GLbyte * pc, Bool swap) -+__glXMap1fReqSize(const GLbyte * pc, Bool swap, int reqlen) - { - GLenum target; - GLint order; -@@ -86,7 +86,7 @@ Map2Size(int k, int majorOrder, int minorOrder) - } - - int --__glXMap2dReqSize(const GLbyte * pc, Bool swap) -+__glXMap2dReqSize(const GLbyte * pc, Bool swap, int reqlen) - { - GLenum target; - GLint uorder, vorder; -@@ -103,7 +103,7 @@ __glXMap2dReqSize(const GLbyte * pc, Bool swap) - } - - int --__glXMap2fReqSize(const GLbyte * pc, Bool swap) -+__glXMap2fReqSize(const GLbyte * pc, Bool swap, int reqlen) - { - GLenum target; - GLint uorder, vorder; -@@ -359,13 +359,14 @@ __glXTypeSize(GLenum enm) - } - - int --__glXDrawArraysReqSize(const GLbyte * pc, Bool swap) -+__glXDrawArraysReqSize(const GLbyte * pc, Bool swap, int reqlen) - { - __GLXdispatchDrawArraysHeader *hdr = (__GLXdispatchDrawArraysHeader *) pc; - __GLXdispatchDrawArraysComponentHeader *compHeader; - GLint numVertexes = hdr->numVertexes; - GLint numComponents = hdr->numComponents; - GLint arrayElementSize = 0; -+ GLint x, size; - int i; - - if (swap) { -@@ -374,6 +375,13 @@ __glXDrawArraysReqSize(const GLbyte * pc, Bool swap) - } - - pc += sizeof(__GLXdispatchDrawArraysHeader); -+ reqlen -= sizeof(__GLXdispatchDrawArraysHeader); -+ -+ size = safe_mul(sizeof(__GLXdispatchDrawArraysComponentHeader), -+ numComponents); -+ if (size < 0 || reqlen < 0 || reqlen < size) -+ return -1; -+ - compHeader = (__GLXdispatchDrawArraysComponentHeader *) pc; - - for (i = 0; i < numComponents; i++) { -@@ -417,17 +425,18 @@ __glXDrawArraysReqSize(const GLbyte * pc, Bool swap) - return -1; - } - -- arrayElementSize += __GLX_PAD(numVals * __glXTypeSize(datatype)); -+ x = safe_pad(safe_mul(numVals, __glXTypeSize(datatype))); -+ if ((arrayElementSize = safe_add(arrayElementSize, x)) < 0) -+ return -1; - - pc += sizeof(__GLXdispatchDrawArraysComponentHeader); - } - -- return ((numComponents * sizeof(__GLXdispatchDrawArraysComponentHeader)) + -- (numVertexes * arrayElementSize)); -+ return safe_add(size, safe_mul(numVertexes, arrayElementSize)); - } - - int --__glXSeparableFilter2DReqSize(const GLbyte * pc, Bool swap) -+__glXSeparableFilter2DReqSize(const GLbyte * pc, Bool swap, int reqlen) - { - __GLXdispatchConvolutionFilterHeader *hdr = - (__GLXdispatchConvolutionFilterHeader *) pc; -diff --git a/include/dix.h b/include/dix.h -index ea9d2cc..b48d828 100644 ---- a/include/dix.h -+++ b/include/dix.h -@@ -72,6 +72,10 @@ SOFTWARE. - if ((sizeof(req) >> 2) > client->req_len )\ - return(BadLength) - -+#define REQUEST_AT_LEAST_EXTRA_SIZE(req, extra) \ -+ if (((sizeof(req) + ((uint64_t) extra)) >> 2) > client->req_len ) \ -+ return(BadLength) -+ - #define REQUEST_FIXED_SIZE(req, n)\ - if (((sizeof(req) >> 2) > client->req_len) || \ - ((n >> 2) >= client->req_len) || \ -diff --git a/test/xi2/protocol-xipassivegrabdevice.c b/test/xi2/protocol-xipassivegrabdevice.c -index ff9aec5..25eb6e9 100644 ---- a/test/xi2/protocol-xipassivegrabdevice.c -+++ b/test/xi2/protocol-xipassivegrabdevice.c -@@ -136,6 +136,7 @@ request_XIPassiveGrabDevice(ClientPtr client, xXIPassiveGrabDeviceReq * req, - { - int rc; - int modifiers; -+ int mask_len; - - client_request.req_len = req->length; - rc = ProcXIPassiveGrabDevice(&client_request); -@@ -153,10 +154,11 @@ request_XIPassiveGrabDevice(ClientPtr client, xXIPassiveGrabDeviceReq * req, - swaps(&req->deviceid); - modifiers = req->num_modifiers; - swaps(&req->num_modifiers); -+ mask_len = req->mask_len; - swaps(&req->mask_len); - - while (modifiers--) { -- CARD32 *mod = ((CARD32 *) (req + 1)) + modifiers; -+ CARD32 *mod = (CARD32 *) (req + 1) + mask_len + modifiers; - - swapl(mod); - } -@@ -235,6 +237,11 @@ test_XIPassiveGrabDevice(void) - request->detail = XIAnyButton; - request_XIPassiveGrabDevice(&client_request, request, Success, 0); - -+ /* Set a few random masks to make sure we handle modifiers correctly */ -+ SetBit(mask, XI_ButtonPress); -+ SetBit(mask, XI_KeyPress); -+ SetBit(mask, XI_Enter); -+ - /* some modifiers */ - request->num_modifiers = N_MODS; - request->length += N_MODS; diff --git a/contrib/packages/rpm/el5/SOURCES/17_CVE-regressions.diff b/contrib/packages/rpm/el5/SOURCES/17_CVE-regressions.diff deleted file mode 100644 index c274d14..0000000 --- a/contrib/packages/rpm/el5/SOURCES/17_CVE-regressions.diff +++ /dev/null @@ -1,26 +0,0 @@ -diff --git a/include/dix.h b/include/dix.h -index 21176a8..921156b 100644 ---- a/include/dix.h -+++ b/include/dix.h -@@ -80,7 +80,7 @@ SOFTWARE. - - #define REQUEST_FIXED_SIZE(req, n)\ - if (((sizeof(req) >> 2) > client->req_len) || \ -- ((n >> 2) >= client->req_len) || \ -+ (((n) >> 2) >= client->req_len) || \ - ((((uint64_t) sizeof(req) + (n) + 3) >> 2) != (uint64_t) client->req_len)) \ - return(BadLength) - -diff --git a/os/access.c b/os/access.c -index f393c8d..28f2d32 100644 ---- a/os/access.c -+++ b/os/access.c -@@ -1308,7 +1308,7 @@ GetHosts(void **data, int *pnHosts, int *pLen, BOOL * pEnabled) - } - for (host = validhosts; host; host = host->next) { - len = host->len; -- if ((ptr + sizeof(xHostEntry) + len) > (data + n)) -+ if ((ptr + sizeof(xHostEntry) + len) > ((unsigned char *) *data + n)) - break; - ((xHostEntry *) ptr)->family = host->family; - ((xHostEntry *) ptr)->length = len; diff --git a/contrib/packages/rpm/el5/SOURCES/CVE-2013-7439.diff b/contrib/packages/rpm/el5/SOURCES/CVE-2013-7439.diff deleted file mode 100644 index 1037fa5..0000000 --- a/contrib/packages/rpm/el5/SOURCES/CVE-2013-7439.diff +++ /dev/null @@ -1,80 +0,0 @@ -From 39547d600a13713e15429f49768e54c3173c828d Mon Sep 17 00:00:00 2001 -From: Karl Tomlinson -Date: Mon, 18 Feb 2013 01:25:34 +0000 -Subject: MakeBigReq: don't move the last word, already handled by Data32 - -MakeBigReq inserts a length field after the first 4 bytes of the request -(after req->length), pushing everything else back by 4 bytes. - -The current memmove moves everything but the first 4 bytes back. -If a request aligns to the end of the buffer pointer when MakeBigReq is -invoked for that request, this runs over the buffer. -Instead, we need to memmove minus the first 4 bytes (which aren't moved), -minus the last 4 bytes (so we still align to the previous tail). - -The 4 bytes that fell out are already handled with Data32, which will -handle the buffermax correctly. - -The case where req->length = 1 was already not functional. - -Reported by Abhishek Arya . - -https://bugzilla.mozilla.org/show_bug.cgi?id=803762 - -Reviewed-by: Jeff Muizelaar -Reviewed-by: Peter Hutterer -Signed-off-by: Alan Coopersmith - -diff --git a/include/X11/Xlibint.h b/include/X11/Xlibint.h -index 40965c4..06395b3 100644 ---- a/include/X11/Xlibint.h -+++ b/include/X11/Xlibint.h -@@ -486,6 +486,14 @@ extern void *_XGetRequest(Display *dpy, CARD8 type, size_t len); - req = (xReq *) _XGetRequest(dpy, X_/**/name, SIZEOF(xReq)) - #endif - -+/* -+ * MakeBigReq sets the CARD16 "req->length" to 0 and inserts a new CARD32 -+ * length, after req->length, before the data in the request. The new length -+ * includes the "n" extra 32-bit words. -+ * -+ * Do not use MakeBigReq if there is no data already in the request. -+ * req->length must already be >= 2. -+ */ - #ifdef WORD64 - #define MakeBigReq(req,n) \ - { \ -@@ -493,7 +501,7 @@ extern void *_XGetRequest(Display *dpy, CARD8 type, size_t len); - CARD32 _BRlen = req->length - 1; \ - req->length = 0; \ - _BRdat = ((CARD32 *)req)[_BRlen]; \ -- memmove(((char *)req) + 8, ((char *)req) + 4, _BRlen << 2); \ -+ memmove(((char *)req) + 8, ((char *)req) + 4, (_BRlen - 1) << 2); \ - ((CARD32 *)req)[1] = _BRlen + n + 2; \ - Data32(dpy, &_BRdat, 4); \ - } -@@ -504,13 +512,20 @@ extern void *_XGetRequest(Display *dpy, CARD8 type, size_t len); - CARD32 _BRlen = req->length - 1; \ - req->length = 0; \ - _BRdat = ((CARD32 *)req)[_BRlen]; \ -- memmove(((char *)req) + 8, ((char *)req) + 4, _BRlen << 2); \ -+ memmove(((char *)req) + 8, ((char *)req) + 4, (_BRlen - 1) << 2); \ - ((CARD32 *)req)[1] = _BRlen + n + 2; \ - Data32(dpy, &_BRdat, 4); \ - } - #endif - #endif - -+/* -+ * SetReqLen increases the count of 32-bit words in the request by "n", -+ * or by "badlen" if "n" is too large. -+ * -+ * Do not use SetReqLen if "req" does not already have data after the -+ * xReq header. req->length must already be >= 2. -+ */ - #ifndef __clang_analyzer__ - #define SetReqLen(req,n,badlen) \ - if ((req->length + n) > (unsigned)65535) { \ --- -cgit v0.10.2 - diff --git a/contrib/packages/rpm/el5/SOURCES/CVE-2015-0255.diff b/contrib/packages/rpm/el5/SOURCES/CVE-2015-0255.diff deleted file mode 100644 index 32e5681..0000000 --- a/contrib/packages/rpm/el5/SOURCES/CVE-2015-0255.diff +++ /dev/null @@ -1,240 +0,0 @@ -From 81c90dc8f0aae3b65730409b1b615b5fa7280ebd Mon Sep 17 00:00:00 2001 -From: Olivier Fourdan -Date: Fri, 16 Jan 2015 20:08:59 +0100 -Subject: xkb: Don't swap XkbSetGeometry data in the input buffer - -The XkbSetGeometry request embeds data which needs to be swapped when the -server and the client have different endianess. - -_XkbSetGeometry() invokes functions that swap these data directly in the -input buffer. - -However, ProcXkbSetGeometry() may call _XkbSetGeometry() more than once -(if there is more than one keyboard), thus causing on swapped clients the -same data to be swapped twice in memory, further causing a server crash -because the strings lengths on the second time are way off bounds. - -To allow _XkbSetGeometry() to run reliably more than once with swapped -clients, do not swap the data in the buffer, use variables instead. - -Signed-off-by: Olivier Fourdan -Signed-off-by: Peter Hutterer - -diff --git a/xkb/xkb.c b/xkb/xkb.c -index 15c7f34..b9a3ac4 100644 ---- a/xkb/xkb.c -+++ b/xkb/xkb.c -@@ -4961,14 +4961,13 @@ static char * - _GetCountedString(char **wire_inout, Bool swap) - { - char *wire, *str; -- CARD16 len, *plen; -+ CARD16 len; - - wire = *wire_inout; -- plen = (CARD16 *) wire; -+ len = *(CARD16 *) wire; - if (swap) { -- swaps(plen); -+ swaps(&len); - } -- len = *plen; - str = malloc(len + 1); - if (str) { - memcpy(str, &wire[2], len); -@@ -4985,25 +4984,28 @@ _CheckSetDoodad(char **wire_inout, - { - char *wire; - xkbDoodadWireDesc *dWire; -+ xkbAnyDoodadWireDesc any; -+ xkbTextDoodadWireDesc text; - XkbDoodadPtr doodad; - - dWire = (xkbDoodadWireDesc *) (*wire_inout); -+ any = dWire->any; - wire = (char *) &dWire[1]; - if (client->swapped) { -- swapl(&dWire->any.name); -- swaps(&dWire->any.top); -- swaps(&dWire->any.left); -- swaps(&dWire->any.angle); -+ swapl(&any.name); -+ swaps(&any.top); -+ swaps(&any.left); -+ swaps(&any.angle); - } - CHK_ATOM_ONLY(dWire->any.name); -- doodad = XkbAddGeomDoodad(geom, section, dWire->any.name); -+ doodad = XkbAddGeomDoodad(geom, section, any.name); - if (!doodad) - return BadAlloc; - doodad->any.type = dWire->any.type; - doodad->any.priority = dWire->any.priority; -- doodad->any.top = dWire->any.top; -- doodad->any.left = dWire->any.left; -- doodad->any.angle = dWire->any.angle; -+ doodad->any.top = any.top; -+ doodad->any.left = any.left; -+ doodad->any.angle = any.angle; - switch (doodad->any.type) { - case XkbOutlineDoodad: - case XkbSolidDoodad: -@@ -5026,12 +5028,13 @@ _CheckSetDoodad(char **wire_inout, - dWire->text.colorNdx); - return BadMatch; - } -+ text = dWire->text; - if (client->swapped) { -- swaps(&dWire->text.width); -- swaps(&dWire->text.height); -+ swaps(&text.width); -+ swaps(&text.height); - } -- doodad->text.width = dWire->text.width; -- doodad->text.height = dWire->text.height; -+ doodad->text.width = text.width; -+ doodad->text.height = text.height; - doodad->text.color_ndx = dWire->text.colorNdx; - doodad->text.text = _GetCountedString(&wire, client->swapped); - doodad->text.font = _GetCountedString(&wire, client->swapped); --- -cgit v0.10.2 - -From 20079c36cf7d377938ca5478447d8b9045cb7d43 Mon Sep 17 00:00:00 2001 -From: Olivier Fourdan -Date: Fri, 16 Jan 2015 08:44:45 +0100 -Subject: xkb: Check strings length against request size - -Ensure that the given strings length in an XkbSetGeometry request remain -within the limits of the size of the request. - -Signed-off-by: Olivier Fourdan -Reviewed-by: Peter Hutterer -Signed-off-by: Peter Hutterer - -diff --git a/xkb/xkb.c b/xkb/xkb.c -index b9a3ac4..f3988f9 100644 ---- a/xkb/xkb.c -+++ b/xkb/xkb.c -@@ -4957,25 +4957,29 @@ ProcXkbGetGeometry(ClientPtr client) - - /***====================================================================***/ - --static char * --_GetCountedString(char **wire_inout, Bool swap) -+static Status -+_GetCountedString(char **wire_inout, ClientPtr client, char **str) - { -- char *wire, *str; -+ char *wire, *next; - CARD16 len; - - wire = *wire_inout; - len = *(CARD16 *) wire; -- if (swap) { -+ if (client->swapped) { - swaps(&len); - } -- str = malloc(len + 1); -- if (str) { -- memcpy(str, &wire[2], len); -- str[len] = '\0'; -- } -- wire += XkbPaddedSize(len + 2); -- *wire_inout = wire; -- return str; -+ next = wire + XkbPaddedSize(len + 2); -+ /* Check we're still within the size of the request */ -+ if (client->req_len < -+ bytes_to_int32(next - (char *) client->requestBuffer)) -+ return BadValue; -+ *str = malloc(len + 1); -+ if (!*str) -+ return BadAlloc; -+ memcpy(*str, &wire[2], len); -+ *(*str + len) = '\0'; -+ *wire_inout = next; -+ return Success; - } - - static Status -@@ -4987,6 +4991,7 @@ _CheckSetDoodad(char **wire_inout, - xkbAnyDoodadWireDesc any; - xkbTextDoodadWireDesc text; - XkbDoodadPtr doodad; -+ Status status; - - dWire = (xkbDoodadWireDesc *) (*wire_inout); - any = dWire->any; -@@ -5036,8 +5041,14 @@ _CheckSetDoodad(char **wire_inout, - doodad->text.width = text.width; - doodad->text.height = text.height; - doodad->text.color_ndx = dWire->text.colorNdx; -- doodad->text.text = _GetCountedString(&wire, client->swapped); -- doodad->text.font = _GetCountedString(&wire, client->swapped); -+ status = _GetCountedString(&wire, client, &doodad->text.text); -+ if (status != Success) -+ return status; -+ status = _GetCountedString(&wire, client, &doodad->text.font); -+ if (status != Success) { -+ free (doodad->text.text); -+ return status; -+ } - break; - case XkbIndicatorDoodad: - if (dWire->indicator.onColorNdx >= geom->num_colors) { -@@ -5072,7 +5083,9 @@ _CheckSetDoodad(char **wire_inout, - } - doodad->logo.color_ndx = dWire->logo.colorNdx; - doodad->logo.shape_ndx = dWire->logo.shapeNdx; -- doodad->logo.logo_name = _GetCountedString(&wire, client->swapped); -+ status = _GetCountedString(&wire, client, &doodad->logo.logo_name); -+ if (status != Success) -+ return status; - break; - default: - client->errorValue = _XkbErrCode2(0x4F, dWire->any.type); -@@ -5304,18 +5317,20 @@ _CheckSetGeom(XkbGeometryPtr geom, xkbSetGeometryReq * req, ClientPtr client) - char *wire; - - wire = (char *) &req[1]; -- geom->label_font = _GetCountedString(&wire, client->swapped); -+ status = _GetCountedString(&wire, client, &geom->label_font); -+ if (status != Success) -+ return status; - - for (i = 0; i < req->nProperties; i++) { - char *name, *val; - -- name = _GetCountedString(&wire, client->swapped); -- if (!name) -- return BadAlloc; -- val = _GetCountedString(&wire, client->swapped); -- if (!val) { -+ status = _GetCountedString(&wire, client, &name); -+ if (status != Success) -+ return status; -+ status = _GetCountedString(&wire, client, &val); -+ if (status != Success) { - free(name); -- return BadAlloc; -+ return status; - } - if (XkbAddGeomProperty(geom, name, val) == NULL) { - free(name); -@@ -5349,9 +5364,9 @@ _CheckSetGeom(XkbGeometryPtr geom, xkbSetGeometryReq * req, ClientPtr client) - for (i = 0; i < req->nColors; i++) { - char *name; - -- name = _GetCountedString(&wire, client->swapped); -- if (!name) -- return BadAlloc; -+ status = _GetCountedString(&wire, client, &name); -+ if (status != Success) -+ return status; - if (!XkbAddGeomColor(geom, name, geom->num_colors)) { - free(name); - return BadAlloc; --- -cgit v0.10.2 - diff --git a/contrib/packages/rpm/el5/SOURCES/CVE-2015-1802.diff b/contrib/packages/rpm/el5/SOURCES/CVE-2015-1802.diff deleted file mode 100644 index 1d87333..0000000 --- a/contrib/packages/rpm/el5/SOURCES/CVE-2015-1802.diff +++ /dev/null @@ -1,30 +0,0 @@ -From 2deda9906480f9c8ae07b8c2a5510cc7e4c59a8e Mon Sep 17 00:00:00 2001 -From: Alan Coopersmith -Date: Fri, 6 Feb 2015 15:50:45 -0800 -Subject: bdfReadProperties: property count needs range check [CVE-2015-1802] - -Avoid integer overflow or underflow when allocating memory arrays -by multiplying the number of properties reported for a BDF font. - -Reported-by: Ilja Van Sprundel -Signed-off-by: Alan Coopersmith -Reviewed-by: Julien Cristau - -diff --git a/src/bitmap/bdfread.c b/src/bitmap/bdfread.c -index 914a024..6387908 100644 ---- a/src/bitmap/bdfread.c -+++ b/src/bitmap/bdfread.c -@@ -604,7 +604,9 @@ bdfReadProperties(FontFilePtr file, FontPtr pFont, bdfFileState *pState) - bdfError("missing 'STARTPROPERTIES'\n"); - return (FALSE); - } -- if (sscanf((char *) line, "STARTPROPERTIES %d", &nProps) != 1) { -+ if ((sscanf((char *) line, "STARTPROPERTIES %d", &nProps) != 1) || -+ (nProps <= 0) || -+ (nProps > ((INT32_MAX / sizeof(FontPropRec)) - BDF_GENPROPS))) { - bdfError("bad 'STARTPROPERTIES'\n"); - return (FALSE); - } --- -cgit v0.10.2 - diff --git a/contrib/packages/rpm/el5/SOURCES/CVE-2015-1803.diff b/contrib/packages/rpm/el5/SOURCES/CVE-2015-1803.diff deleted file mode 100644 index 22d2d5b..0000000 --- a/contrib/packages/rpm/el5/SOURCES/CVE-2015-1803.diff +++ /dev/null @@ -1,33 +0,0 @@ -From 78c2e3d70d29698244f70164428bd2868c0ab34c Mon Sep 17 00:00:00 2001 -From: Alan Coopersmith -Date: Fri, 6 Feb 2015 15:54:00 -0800 -Subject: bdfReadCharacters: bailout if a char's bitmap cannot be read - [CVE-2015-1803] - -Previously would charge on ahead with a NULL pointer in ci->bits, and -then crash later in FontCharInkMetrics() trying to access the bits. - -Found with afl-1.23b. - -Signed-off-by: Alan Coopersmith -Reviewed-by: Julien Cristau - -diff --git a/src/bitmap/bdfread.c b/src/bitmap/bdfread.c -index 6387908..1b29b81 100644 ---- a/src/bitmap/bdfread.c -+++ b/src/bitmap/bdfread.c -@@ -458,7 +458,10 @@ bdfReadCharacters(FontFilePtr file, FontPtr pFont, bdfFileState *pState, - ci->metrics.descent = -bb; - ci->metrics.characterWidth = wx; - ci->bits = NULL; -- bdfReadBitmap(ci, file, bit, byte, glyph, scan, bitmapsSizes); -+ if (!bdfReadBitmap(ci, file, bit, byte, glyph, scan, bitmapsSizes)) { -+ bdfError("could not read bitmap for character '%s'\n", charName); -+ goto BAILOUT; -+ } - ci++; - ndx++; - } else --- -cgit v0.10.2 - diff --git a/contrib/packages/rpm/el5/SOURCES/CVE-2015-1804.diff b/contrib/packages/rpm/el5/SOURCES/CVE-2015-1804.diff deleted file mode 100644 index dd8d5be..0000000 --- a/contrib/packages/rpm/el5/SOURCES/CVE-2015-1804.diff +++ /dev/null @@ -1,73 +0,0 @@ -From 2351c83a77a478b49cba6beb2ad386835e264744 Mon Sep 17 00:00:00 2001 -From: Alan Coopersmith -Date: Fri, 6 Mar 2015 22:54:58 -0800 -Subject: bdfReadCharacters: ensure metrics fit into xCharInfo struct - [CVE-2015-1804] - -We use 32-bit ints to read from the bdf file, but then try to stick -into a 16-bit int in the xCharInfo struct, so make sure they won't -overflow that range. - -Found by afl-1.24b. - -v2: Verify that additions won't overflow 32-bit int range either. -v3: As Julien correctly observes, the previous check for bh & bw not - being < 0 reduces the number of cases we need to check for overflow. - -Signed-off-by: Alan Coopersmith -Reviewed-by: Julien Cristau - -diff --git a/src/bitmap/bdfread.c b/src/bitmap/bdfread.c -index 1b29b81..a0ace8f 100644 ---- a/src/bitmap/bdfread.c -+++ b/src/bitmap/bdfread.c -@@ -62,8 +62,16 @@ from The Open Group. - - #if HAVE_STDINT_H - #include --#elif !defined(INT32_MAX) --#define INT32_MAX 0x7fffffff -+#else -+# ifndef INT32_MAX -+# define INT32_MAX 0x7fffffff -+# endif -+# ifndef INT16_MAX -+# define INT16_MAX 0x7fff -+# endif -+# ifndef INT16_MIN -+# define INT16_MIN (0 - 0x8000) -+# endif - #endif - - #define INDICES 256 -@@ -417,6 +425,12 @@ bdfReadCharacters(FontFilePtr file, FontPtr pFont, bdfFileState *pState, - bdfError("DWIDTH y value must be zero\n"); - goto BAILOUT; - } -+ /* xCharInfo metrics are stored as INT16 */ -+ if ((wx < 0) || (wx > INT16_MAX)) { -+ bdfError("character '%s' has out of range width, %d\n", -+ charName, wx); -+ goto BAILOUT; -+ } - line = bdfGetLine(file, lineBuf, BDFLINELEN); - if ((!line) || (sscanf((char *) line, "BBX %d %d %d %d", &bw, &bh, &bl, &bb) != 4)) { - bdfError("bad 'BBX'\n"); -@@ -427,6 +441,14 @@ bdfReadCharacters(FontFilePtr file, FontPtr pFont, bdfFileState *pState, - charName, bw, bh); - goto BAILOUT; - } -+ /* xCharInfo metrics are read as int, but stored as INT16 */ -+ if ((bl > INT16_MAX) || (bl < INT16_MIN) || -+ (bb > INT16_MAX) || (bb < INT16_MIN) || -+ (bw > (INT16_MAX - bl)) || (bh > (INT16_MAX - bb))) { -+ bdfError("character '%s' has out of range metrics, %d %d %d %d\n", -+ charName, bl, (bl+bw), (bh+bb), -bb); -+ goto BAILOUT; -+ } - line = bdfGetLine(file, lineBuf, BDFLINELEN); - if ((line) && (bdfIsPrefix(line, "ATTRIBUTES"))) { - for (p = line + strlen("ATTRIBUTES "); --- -cgit v0.10.2 - diff --git a/contrib/packages/rpm/el5/SOURCES/FindX11.cmake b/contrib/packages/rpm/el5/SOURCES/FindX11.cmake deleted file mode 100644 index 21cb732..0000000 --- a/contrib/packages/rpm/el5/SOURCES/FindX11.cmake +++ /dev/null @@ -1,511 +0,0 @@ -# - Find X11 installation -# Try to find X11 on UNIX systems. The following values are defined -# X11_FOUND - True if X11 is available -# X11_INCLUDE_DIR - include directories to use X11 -# X11_LIBRARIES - link against these to use X11 -# -# and also the following more fine grained variables: -# Include paths: X11_ICE_INCLUDE_PATH, X11_ICE_LIB, X11_ICE_FOUND -# X11_SM_INCLUDE_PATH, X11_SM_LIB, X11_SM_FOUND -# X11_X11_INCLUDE_PATH, X11_X11_LIB -# X11_Xaccessrules_INCLUDE_PATH, X11_Xaccess_FOUND -# X11_Xaccessstr_INCLUDE_PATH, X11_Xaccess_FOUND -# X11_Xau_INCLUDE_PATH, X11_Xau_LIB, X11_Xau_FOUND -# X11_Xcomposite_INCLUDE_PATH, X11_Xcomposite_LIB, X11_Xcomposite_FOUND -# X11_Xcursor_INCLUDE_PATH, X11_Xcursor_LIB, X11_Xcursor_FOUND -# X11_Xdamage_INCLUDE_PATH, X11_Xdamage_LIB, X11_Xdamage_FOUND -# X11_Xdmcp_INCLUDE_PATH, X11_Xdmcp_LIB, X11_Xdmcp_FOUND -# X11_Xext_LIB, X11_Xext_FOUND -# X11_dpms_INCLUDE_PATH, (in X11_Xext_LIB), X11_dpms_FOUND -# X11_XShm_INCLUDE_PATH, (in X11_Xext_LIB), X11_XShm_FOUND -# X11_Xshape_INCLUDE_PATH, (in X11_Xext_LIB), X11_Xshape_FOUND -# X11_xf86misc_INCLUDE_PATH, X11_Xxf86misc_LIB, X11_xf86misc_FOUND -# X11_xf86vmode_INCLUDE_PATH, X11_Xxf86vm_LIB X11_xf86vmode_FOUND -# X11_Xfixes_INCLUDE_PATH, X11_Xfixes_LIB, X11_Xfixes_FOUND -# X11_Xft_INCLUDE_PATH, X11_Xft_LIB, X11_Xft_FOUND -# X11_Xi_INCLUDE_PATH, X11_Xi_LIB, X11_Xi_FOUND -# X11_Xinerama_INCLUDE_PATH, X11_Xinerama_LIB, X11_Xinerama_FOUND -# X11_Xinput_INCLUDE_PATH, X11_Xinput_LIB, X11_Xinput_FOUND -# X11_Xkb_INCLUDE_PATH, X11_Xkb_FOUND -# X11_Xkblib_INCLUDE_PATH, X11_Xkb_FOUND -# X11_Xkbfile_INCLUDE_PATH, X11_Xkbfile_LIB, X11_Xkbfile_FOUND -# X11_Xmu_INCLUDE_PATH, X11_Xmu_LIB, X11_Xmu_FOUND -# X11_Xpm_INCLUDE_PATH, X11_Xpm_LIB, X11_Xpm_FOUND -# X11_XTest_INCLUDE_PATH, X11_XTest_LIB, X11_XTest_FOUND -# X11_Xrandr_INCLUDE_PATH, X11_Xrandr_LIB, X11_Xrandr_FOUND -# X11_Xrender_INCLUDE_PATH, X11_Xrender_LIB, X11_Xrender_FOUND -# X11_Xscreensaver_INCLUDE_PATH, X11_Xscreensaver_LIB, X11_Xscreensaver_FOUND -# X11_Xt_INCLUDE_PATH, X11_Xt_LIB, X11_Xt_FOUND -# X11_Xutil_INCLUDE_PATH, X11_Xutil_FOUND -# X11_Xv_INCLUDE_PATH, X11_Xv_LIB, X11_Xv_FOUND -# X11_XSync_INCLUDE_PATH, (in X11_Xext_LIB), X11_XSync_FOUND - - -#============================================================================= -# Copyright 2001-2009 Kitware, Inc. -# -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. -#============================================================================= -# (To distribute this file outside of CMake, substitute the full -# License text for the above reference.) - -if (UNIX) - set(X11_FOUND 0) - # X11 is never a framework and some header files may be - # found in tcl on the mac - set(CMAKE_FIND_FRAMEWORK_SAVE ${CMAKE_FIND_FRAMEWORK}) - set(CMAKE_FIND_FRAMEWORK NEVER) - set(X11_INC_SEARCH_PATH - @_includedir@ - /usr/pkg/xorg/include - /usr/X11R6/include - /usr/X11R7/include - /usr/include/X11 - /usr/openwin/include - /usr/openwin/share/include - /opt/graphics/OpenGL/include - ) - - - set(X11_LIB_SEARCH_PATH - @_libdir@ - @_libdir@/tigervnc - /usr/pkg/xorg/lib - /usr/X11R6/lib - /usr/X11R7/lib - /usr/openwin/lib - ) - - find_path(X11_X11_INCLUDE_PATH X11/X.h ${X11_INC_SEARCH_PATH}) - find_path(X11_Xlib_INCLUDE_PATH X11/Xlib.h ${X11_INC_SEARCH_PATH}) - - # Look for includes; keep the list sorted by name of the cmake *_INCLUDE_PATH - # variable (which doesn't need to match the include file name). - - # Solaris lacks XKBrules.h, so we should skip kxkbd there. - find_path(X11_ICE_INCLUDE_PATH X11/ICE/ICE.h ${X11_INC_SEARCH_PATH}) - find_path(X11_SM_INCLUDE_PATH X11/SM/SM.h ${X11_INC_SEARCH_PATH}) - find_path(X11_Xaccessrules_INCLUDE_PATH X11/extensions/XKBrules.h ${X11_INC_SEARCH_PATH}) - find_path(X11_Xaccessstr_INCLUDE_PATH X11/extensions/XKBstr.h ${X11_INC_SEARCH_PATH}) - find_path(X11_Xau_INCLUDE_PATH X11/Xauth.h ${X11_INC_SEARCH_PATH}) - find_path(X11_Xcomposite_INCLUDE_PATH X11/extensions/Xcomposite.h ${X11_INC_SEARCH_PATH}) - find_path(X11_Xcursor_INCLUDE_PATH X11/Xcursor/Xcursor.h ${X11_INC_SEARCH_PATH}) - find_path(X11_Xdamage_INCLUDE_PATH X11/extensions/Xdamage.h ${X11_INC_SEARCH_PATH}) - find_path(X11_Xdmcp_INCLUDE_PATH X11/Xdmcp.h ${X11_INC_SEARCH_PATH}) - find_path(X11_dpms_INCLUDE_PATH X11/extensions/dpms.h ${X11_INC_SEARCH_PATH}) - find_path(X11_xf86misc_INCLUDE_PATH X11/extensions/xf86misc.h ${X11_INC_SEARCH_PATH}) - find_path(X11_xf86vmode_INCLUDE_PATH X11/extensions/xf86vmode.h ${X11_INC_SEARCH_PATH}) - find_path(X11_Xfixes_INCLUDE_PATH X11/extensions/Xfixes.h ${X11_INC_SEARCH_PATH}) - find_path(X11_Xft_INCLUDE_PATH X11/Xft/Xft.h ${X11_INC_SEARCH_PATH}) - find_path(X11_Xi_INCLUDE_PATH X11/extensions/XInput.h ${X11_INC_SEARCH_PATH}) - find_path(X11_Xinerama_INCLUDE_PATH X11/extensions/Xinerama.h ${X11_INC_SEARCH_PATH}) - find_path(X11_Xinput_INCLUDE_PATH X11/extensions/XInput.h ${X11_INC_SEARCH_PATH}) - find_path(X11_Xkb_INCLUDE_PATH X11/extensions/XKB.h ${X11_INC_SEARCH_PATH}) - find_path(X11_Xkblib_INCLUDE_PATH X11/XKBlib.h ${X11_INC_SEARCH_PATH}) - find_path(X11_Xkbfile_INCLUDE_PATH X11/extensions/XKBfile.h ${X11_INC_SEARCH_PATH}) - find_path(X11_Xmu_INCLUDE_PATH X11/Xmu/Xmu.h ${X11_INC_SEARCH_PATH}) - find_path(X11_Xpm_INCLUDE_PATH X11/xpm.h ${X11_INC_SEARCH_PATH}) - find_path(X11_XTest_INCLUDE_PATH X11/extensions/XTest.h ${X11_INC_SEARCH_PATH}) - find_path(X11_XShm_INCLUDE_PATH X11/extensions/XShm.h ${X11_INC_SEARCH_PATH}) - find_path(X11_Xrandr_INCLUDE_PATH X11/extensions/Xrandr.h ${X11_INC_SEARCH_PATH}) - find_path(X11_Xrender_INCLUDE_PATH X11/extensions/Xrender.h ${X11_INC_SEARCH_PATH}) - find_path(X11_XRes_INCLUDE_PATH X11/extensions/XRes.h ${X11_INC_SEARCH_PATH}) - find_path(X11_Xscreensaver_INCLUDE_PATH X11/extensions/scrnsaver.h ${X11_INC_SEARCH_PATH}) - find_path(X11_Xshape_INCLUDE_PATH X11/extensions/shape.h ${X11_INC_SEARCH_PATH}) - find_path(X11_Xutil_INCLUDE_PATH X11/Xutil.h ${X11_INC_SEARCH_PATH}) - find_path(X11_Xt_INCLUDE_PATH X11/Intrinsic.h ${X11_INC_SEARCH_PATH}) - find_path(X11_Xv_INCLUDE_PATH X11/extensions/Xvlib.h ${X11_INC_SEARCH_PATH}) - find_path(X11_XSync_INCLUDE_PATH X11/extensions/sync.h ${X11_INC_SEARCH_PATH}) - find_path(X11_xcb_INCLUDE_PATH X11/xcb.h ${X11_INC_SEARCH_PATH}) - - - find_library(X11_X11_LIB X11 ${X11_LIB_SEARCH_PATH}) - - # Find additional X libraries. Keep list sorted by library name. - find_library(X11_ICE_LIB ICE ${X11_LIB_SEARCH_PATH}) - find_library(X11_SM_LIB SM ${X11_LIB_SEARCH_PATH}) - find_library(X11_Xau_LIB Xau ${X11_LIB_SEARCH_PATH}) - find_library(X11_Xcomposite_LIB Xcomposite ${X11_LIB_SEARCH_PATH}) - find_library(X11_Xcursor_LIB Xcursor ${X11_LIB_SEARCH_PATH}) - find_library(X11_Xdamage_LIB Xdamage ${X11_LIB_SEARCH_PATH}) - find_library(X11_Xdmcp_LIB Xdmcp ${X11_LIB_SEARCH_PATH}) - find_library(X11_Xext_LIB Xext ${X11_LIB_SEARCH_PATH}) - find_library(X11_Xfixes_LIB Xfixes ${X11_LIB_SEARCH_PATH}) - find_library(X11_Xft_LIB Xft ${X11_LIB_SEARCH_PATH}) - find_library(X11_Xi_LIB Xi ${X11_LIB_SEARCH_PATH}) - find_library(X11_Xinerama_LIB Xinerama ${X11_LIB_SEARCH_PATH}) - find_library(X11_Xinput_LIB Xi ${X11_LIB_SEARCH_PATH}) - find_library(X11_Xkbfile_LIB xkbfile ${X11_LIB_SEARCH_PATH}) - find_library(X11_Xmu_LIB Xmu ${X11_LIB_SEARCH_PATH}) - find_library(X11_Xpm_LIB Xpm ${X11_LIB_SEARCH_PATH}) - find_library(X11_Xrandr_LIB Xrandr ${X11_LIB_SEARCH_PATH}) - find_library(X11_Xrender_LIB Xrender ${X11_LIB_SEARCH_PATH}) - find_library(X11_XRes_LIB XRes ${X11_LIB_SEARCH_PATH}) - find_library(X11_Xscreensaver_LIB Xss ${X11_LIB_SEARCH_PATH}) - find_library(X11_Xt_LIB Xt ${X11_LIB_SEARCH_PATH}) - find_library(X11_XTest_LIB Xtst ${X11_LIB_SEARCH_PATH}) - find_library(X11_Xv_LIB Xv ${X11_LIB_SEARCH_PATH}) - find_library(X11_Xxf86misc_LIB Xxf86misc ${X11_LIB_SEARCH_PATH}) - find_library(X11_Xxf86vm_LIB Xxf86vm ${X11_LIB_SEARCH_PATH}) - find_library(X11_xcb_LIB xcb ${X11_LIB_SEARCH_PATH}) - - set(X11_LIBRARY_DIR "") - if(X11_X11_LIB) - get_filename_component(X11_LIBRARY_DIR ${X11_X11_LIB} PATH) - endif() - - set(X11_INCLUDE_DIR) # start with empty list - if(X11_X11_INCLUDE_PATH) - set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_X11_INCLUDE_PATH}) - endif() - - if(X11_Xlib_INCLUDE_PATH) - set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xlib_INCLUDE_PATH}) - endif() - - if(X11_Xutil_INCLUDE_PATH) - set(X11_Xutil_FOUND TRUE) - set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xutil_INCLUDE_PATH}) - endif() - - if(X11_Xshape_INCLUDE_PATH) - set(X11_Xshape_FOUND TRUE) - set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xshape_INCLUDE_PATH}) - endif() - - set(X11_LIBRARIES) # start with empty list - if(X11_X11_LIB) - set(X11_LIBRARIES ${X11_LIBRARIES} ${X11_X11_LIB} ${X11_xcb_LIB}) - endif() - - if(X11_Xext_LIB) - set(X11_Xext_FOUND TRUE) - set(X11_LIBRARIES ${X11_LIBRARIES} ${X11_Xext_LIB}) - endif() - - if(X11_Xt_LIB AND X11_Xt_INCLUDE_PATH) - set(X11_Xt_FOUND TRUE) - endif() - - if(X11_Xft_LIB AND X11_Xft_INCLUDE_PATH) - set(X11_Xft_FOUND TRUE) - set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xft_INCLUDE_PATH}) - endif() - - if(X11_Xv_LIB AND X11_Xv_INCLUDE_PATH) - set(X11_Xv_FOUND TRUE) - set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xv_INCLUDE_PATH}) - endif() - - if (X11_Xau_LIB AND X11_Xau_INCLUDE_PATH) - set(X11_Xau_FOUND TRUE) - set(X11_LIBRARIES ${X11_LIBRARIES} ${X11_Xau_LIB}) - endif () - - if (X11_Xdmcp_INCLUDE_PATH AND X11_Xdmcp_LIB) - set(X11_Xdmcp_FOUND TRUE) - set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xdmcp_INCLUDE_PATH}) - set(X11_LIBRARIES ${X11_LIBRARIES} ${X11_Xdmcp_LIB}) - endif () - - if (X11_Xaccessrules_INCLUDE_PATH AND X11_Xaccessstr_INCLUDE_PATH) - set(X11_Xaccess_FOUND TRUE) - set(X11_Xaccess_INCLUDE_PATH ${X11_Xaccessstr_INCLUDE_PATH}) - set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xaccess_INCLUDE_PATH}) - endif () - - if (X11_Xpm_INCLUDE_PATH AND X11_Xpm_LIB) - set(X11_Xpm_FOUND TRUE) - set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xpm_INCLUDE_PATH}) - endif () - - if (X11_Xcomposite_INCLUDE_PATH AND X11_Xcomposite_LIB) - set(X11_Xcomposite_FOUND TRUE) - set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xcomposite_INCLUDE_PATH}) - endif () - - if (X11_Xdamage_INCLUDE_PATH AND X11_Xdamage_LIB) - set(X11_Xdamage_FOUND TRUE) - set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xdamage_INCLUDE_PATH}) - endif () - - if (X11_XShm_INCLUDE_PATH) - set(X11_XShm_FOUND TRUE) - set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_XShm_INCLUDE_PATH}) - endif () - - if (X11_XTest_INCLUDE_PATH AND X11_XTest_LIB) - set(X11_XTest_FOUND TRUE) - set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_XTest_INCLUDE_PATH}) - endif () - - if (X11_Xi_INCLUDE_PATH AND X11_Xi_LIB) - set(X11_Xi_FOUND TRUE) - set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xi_INCLUDE_PATH}) - endif () - - if (X11_Xinerama_INCLUDE_PATH AND X11_Xinerama_LIB) - set(X11_Xinerama_FOUND TRUE) - set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xinerama_INCLUDE_PATH}) - endif () - - if (X11_Xfixes_INCLUDE_PATH AND X11_Xfixes_LIB) - set(X11_Xfixes_FOUND TRUE) - set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xfixes_INCLUDE_PATH}) - endif () - - if (X11_Xrender_INCLUDE_PATH AND X11_Xrender_LIB) - set(X11_Xrender_FOUND TRUE) - set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xrender_INCLUDE_PATH}) - endif () - - if (X11_XRes_INCLUDE_PATH AND X11_XRes_LIB) - set(X11_XRes_FOUND TRUE) - set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_XRes_INCLUDE_PATH}) - endif () - - if (X11_Xrandr_INCLUDE_PATH AND X11_Xrandr_LIB) - set(X11_Xrandr_FOUND TRUE) - set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xrandr_INCLUDE_PATH}) - endif () - - if (X11_xf86misc_INCLUDE_PATH AND X11_Xxf86misc_LIB) - set(X11_xf86misc_FOUND TRUE) - set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_xf86misc_INCLUDE_PATH}) - endif () - - if (X11_xf86vmode_INCLUDE_PATH AND X11_Xxf86vm_LIB) - set(X11_xf86vmode_FOUND TRUE) - set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_xf86vmode_INCLUDE_PATH}) - endif () - - if (X11_Xcursor_INCLUDE_PATH AND X11_Xcursor_LIB) - set(X11_Xcursor_FOUND TRUE) - set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xcursor_INCLUDE_PATH}) - endif () - - if (X11_Xscreensaver_INCLUDE_PATH AND X11_Xscreensaver_LIB) - set(X11_Xscreensaver_FOUND TRUE) - set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xscreensaver_INCLUDE_PATH}) - endif () - - if (X11_dpms_INCLUDE_PATH) - set(X11_dpms_FOUND TRUE) - set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_dpms_INCLUDE_PATH}) - endif () - - if (X11_Xkb_INCLUDE_PATH AND X11_Xkblib_INCLUDE_PATH AND X11_Xlib_INCLUDE_PATH) - set(X11_Xkb_FOUND TRUE) - set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xkb_INCLUDE_PATH} ) - endif () - - if (X11_Xkbfile_INCLUDE_PATH AND X11_Xkbfile_LIB AND X11_Xlib_INCLUDE_PATH) - set(X11_Xkbfile_FOUND TRUE) - set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xkbfile_INCLUDE_PATH} ) - endif () - - if (X11_Xmu_INCLUDE_PATH AND X11_Xmu_LIB) - set(X11_Xmu_FOUND TRUE) - set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xmu_INCLUDE_PATH}) - endif () - - if (X11_Xinput_INCLUDE_PATH AND X11_Xinput_LIB) - set(X11_Xinput_FOUND TRUE) - set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xinput_INCLUDE_PATH}) - endif () - - if (X11_XSync_INCLUDE_PATH) - set(X11_XSync_FOUND TRUE) - set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_XSync_INCLUDE_PATH}) - endif () - - if(X11_ICE_LIB AND X11_ICE_INCLUDE_PATH) - set(X11_ICE_FOUND TRUE) - endif() - - if(X11_SM_LIB AND X11_SM_INCLUDE_PATH) - set(X11_SM_FOUND TRUE) - endif() - - if(X11_xcb_LIB AND X11_xcb_INCLUDE_PATH) - set(X11_xcb_FOUND TRUE) - endif() - - # Most of the X11 headers will be in the same directories, avoid - # creating a huge list of duplicates. - if (X11_INCLUDE_DIR) - list(REMOVE_DUPLICATES X11_INCLUDE_DIR) - endif () - - # Deprecated variable for backwards compatibility with CMake 1.4 - if (X11_X11_INCLUDE_PATH AND X11_LIBRARIES) - set(X11_FOUND 1) - endif () - - if(X11_FOUND) - include(/usr/share/cmake28/Modules/CheckFunctionExists.cmake) - include(/usr/share/cmake28/Modules/CheckLibraryExists.cmake) - - # Translated from an autoconf-generated configure script. - # See libs.m4 in autoconf's m4 directory. - if($ENV{ISC} MATCHES "^yes$") - set(X11_X_EXTRA_LIBS -lnsl_s -linet) - else() - set(X11_X_EXTRA_LIBS "-Wl,-Bdynamic -ldl") - - # See if XOpenDisplay in X11 works by itself. - CHECK_LIBRARY_EXISTS("${X11_LIBRARIES}" "XOpenDisplay" "${X11_LIBRARY_DIR}" X11_LIB_X11_SOLO) - if(NOT X11_LIB_X11_SOLO) - # Find library needed for dnet_ntoa. - CHECK_LIBRARY_EXISTS("dnet" "dnet_ntoa" "" X11_LIB_DNET_HAS_DNET_NTOA) - if (X11_LIB_DNET_HAS_DNET_NTOA) - set (X11_X_EXTRA_LIBS ${X11_X_EXTRA_LIBS} -ldnet) - else () - CHECK_LIBRARY_EXISTS("dnet_stub" "dnet_ntoa" "" X11_LIB_DNET_STUB_HAS_DNET_NTOA) - if (X11_LIB_DNET_STUB_HAS_DNET_NTOA) - set (X11_X_EXTRA_LIBS ${X11_X_EXTRA_LIBS} -ldnet_stub) - endif () - endif () - endif() - - # Find library needed for gethostbyname. - CHECK_FUNCTION_EXISTS("gethostbyname" CMAKE_HAVE_GETHOSTBYNAME) - if(NOT CMAKE_HAVE_GETHOSTBYNAME) - CHECK_LIBRARY_EXISTS("nsl" "gethostbyname" "" CMAKE_LIB_NSL_HAS_GETHOSTBYNAME) - if (CMAKE_LIB_NSL_HAS_GETHOSTBYNAME) - set (X11_X_EXTRA_LIBS ${X11_X_EXTRA_LIBS} -lnsl) - else () - CHECK_LIBRARY_EXISTS("bsd" "gethostbyname" "" CMAKE_LIB_BSD_HAS_GETHOSTBYNAME) - if (CMAKE_LIB_BSD_HAS_GETHOSTBYNAME) - set (X11_X_EXTRA_LIBS ${X11_X_EXTRA_LIBS} -lbsd) - endif () - endif () - endif() - - # Find library needed for connect. - CHECK_FUNCTION_EXISTS("connect" CMAKE_HAVE_CONNECT) - if(NOT CMAKE_HAVE_CONNECT) - CHECK_LIBRARY_EXISTS("socket" "connect" "" CMAKE_LIB_SOCKET_HAS_CONNECT) - if (CMAKE_LIB_SOCKET_HAS_CONNECT) - set (X11_X_EXTRA_LIBS -lsocket ${X11_X_EXTRA_LIBS}) - endif () - endif() - - # Find library needed for remove. - CHECK_FUNCTION_EXISTS("remove" CMAKE_HAVE_REMOVE) - if(NOT CMAKE_HAVE_REMOVE) - CHECK_LIBRARY_EXISTS("posix" "remove" "" CMAKE_LIB_POSIX_HAS_REMOVE) - if (CMAKE_LIB_POSIX_HAS_REMOVE) - set (X11_X_EXTRA_LIBS ${X11_X_EXTRA_LIBS} -lposix) - endif () - endif() - - # Find library needed for shmat. - CHECK_FUNCTION_EXISTS("shmat" CMAKE_HAVE_SHMAT) - if(NOT CMAKE_HAVE_SHMAT) - CHECK_LIBRARY_EXISTS("ipc" "shmat" "" CMAKE_LIB_IPS_HAS_SHMAT) - if (CMAKE_LIB_IPS_HAS_SHMAT) - set (X11_X_EXTRA_LIBS ${X11_X_EXTRA_LIBS} -lipc) - endif () - endif() - endif() - - if (X11_ICE_FOUND) - CHECK_LIBRARY_EXISTS("ICE" "IceConnectionNumber" "${X11_LIBRARY_DIR}" - CMAKE_LIB_ICE_HAS_ICECONNECTIONNUMBER) - if(CMAKE_LIB_ICE_HAS_ICECONNECTIONNUMBER) - set (X11_X_PRE_LIBS ${X11_ICE_LIB}) - if(X11_SM_LIB) - set (X11_X_PRE_LIBS ${X11_SM_LIB} ${X11_X_PRE_LIBS}) - endif() - endif() - endif () - - # Build the final list of libraries. - set(X11_LIBRARIES ${X11_X_PRE_LIBS} ${X11_LIBRARIES} ${X11_X_EXTRA_LIBS}) - - include(/usr/share/cmake28/Modules/FindPackageMessage.cmake) - FIND_PACKAGE_MESSAGE(X11 "Found X11: ${X11_X11_LIB}" - "[${X11_X11_LIB}][${X11_INCLUDE_DIR}]") - else () - if (X11_FIND_REQUIRED) - message(FATAL_ERROR "Could not find X11") - endif () - endif () - - mark_as_advanced( - X11_X11_INCLUDE_PATH - X11_X11_LIB - X11_Xext_LIB - X11_Xau_LIB - X11_Xau_INCLUDE_PATH - X11_Xlib_INCLUDE_PATH - X11_Xutil_INCLUDE_PATH - X11_Xcomposite_INCLUDE_PATH - X11_Xcomposite_LIB - X11_Xaccess_INCLUDE_PATH - X11_Xfixes_LIB - X11_Xfixes_INCLUDE_PATH - X11_Xrandr_LIB - X11_Xrandr_INCLUDE_PATH - X11_Xdamage_LIB - X11_Xdamage_INCLUDE_PATH - X11_Xrender_LIB - X11_Xrender_INCLUDE_PATH - X11_XRes_LIB - X11_XRes_INCLUDE_PATH - X11_Xxf86misc_LIB - X11_xf86misc_INCLUDE_PATH - X11_Xxf86vm_LIB - X11_xf86vmode_INCLUDE_PATH - X11_Xi_LIB - X11_Xi_INCLUDE_PATH - X11_Xinerama_LIB - X11_Xinerama_INCLUDE_PATH - X11_XTest_LIB - X11_XTest_INCLUDE_PATH - X11_Xcursor_LIB - X11_Xcursor_INCLUDE_PATH - X11_dpms_INCLUDE_PATH - X11_Xt_LIB - X11_Xt_INCLUDE_PATH - X11_Xdmcp_LIB - X11_LIBRARIES - X11_Xaccessrules_INCLUDE_PATH - X11_Xaccessstr_INCLUDE_PATH - X11_Xdmcp_INCLUDE_PATH - X11_Xkb_INCLUDE_PATH - X11_Xkblib_INCLUDE_PATH - X11_Xkbfile_INCLUDE_PATH - X11_Xkbfile_LIB - X11_Xmu_INCLUDE_PATH - X11_Xmu_LIB - X11_Xscreensaver_INCLUDE_PATH - X11_Xscreensaver_LIB - X11_Xpm_INCLUDE_PATH - X11_Xpm_LIB - X11_Xinput_LIB - X11_Xinput_INCLUDE_PATH - X11_Xft_LIB - X11_Xft_INCLUDE_PATH - X11_Xshape_INCLUDE_PATH - X11_Xv_LIB - X11_Xv_INCLUDE_PATH - X11_XShm_INCLUDE_PATH - X11_ICE_LIB - X11_ICE_INCLUDE_PATH - X11_SM_LIB - X11_SM_INCLUDE_PATH - X11_xcb_LIB - X11_xcb_INCLUDE_PATH - X11_XSync_INCLUDE_PATH - ) - set(CMAKE_FIND_FRAMEWORK ${CMAKE_FIND_FRAMEWORK_SAVE}) -endif () - -# X11_FIND_REQUIRED_ could be checked too diff --git a/contrib/packages/rpm/el5/SOURCES/fltk-1.3.3-static-libs.patch b/contrib/packages/rpm/el5/SOURCES/fltk-1.3.3-static-libs.patch deleted file mode 100644 index f26b31d..0000000 --- a/contrib/packages/rpm/el5/SOURCES/fltk-1.3.3-static-libs.patch +++ /dev/null @@ -1,29 +0,0 @@ ---- a/configure 2015-02-22 16:20:48.000000000 -0500 -+++ b/configure 2015-02-22 16:21:52.000000000 -0500 -@@ -6793,7 +6793,7 @@ - # See if we find them without any special options. - # Don't add to $LIBS permanently. - ac_save_LIBS=$LIBS -- LIBS="-lX11 $LIBS" -+ LIBS="-lX11 -lfreetype -lexpat -lXext -lXrender -lxcb -lXdmcp -lXau -lz $LIBS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext - /* end confdefs.h. */ - #include -@@ -6935,7 +6935,7 @@ - # Martyn Johnson says this is needed for Ultrix, if the X - # libraries were built with DECnet support. And Karl Berry says - # the Alpha needs dnet_stub (dnet does not exist). -- ac_xsave_LIBS="$LIBS"; LIBS="$LIBS $X_LIBS -lX11" -+ ac_xsave_LIBS="$LIBS"; LIBS="$LIBS $X_LIBS -lfreetype -lexpat -lX11 -lXext -lXrender -lxcb -lXdmcp -lXau -lz" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext - /* end confdefs.h. */ - -@@ -7359,7 +7359,7 @@ - $as_echo "$as_me: WARNING: Ignoring libraries \"$X_PRE_LIBS\" requested by configure." >&2;} - fi - -- LIBS="$LIBS -lX11 $X_EXTRA_LIBS" -+ LIBS="$LIBS -lfreetype -lexpat -lX11 -lXext -lXrender -lxcb -lXdmcp -lXau -lz $X_EXTRA_LIBS" - CFLAGS="$CFLAGS $X_CFLAGS" - CXXFLAGS="$CXXFLAGS $X_CFLAGS" - LDFLAGS="$X_LIBS $LDFLAGS" diff --git a/contrib/packages/rpm/el5/SOURCES/freetype-2.1.10-enable-ft2-bci.patch b/contrib/packages/rpm/el5/SOURCES/freetype-2.1.10-enable-ft2-bci.patch deleted file mode 100644 index b1766a0..0000000 --- a/contrib/packages/rpm/el5/SOURCES/freetype-2.1.10-enable-ft2-bci.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- freetype-2.1.10/include/freetype/config/ftoption.h.enable-ft2-bci 2005-10-12 13:50:40.000000000 -0400 -+++ freetype-2.1.10/include/freetype/config/ftoption.h 2005-10-12 14:18:50.000000000 -0400 -@@ -436,7 +436,7 @@ - /* Do not #undef this macro here, since the build system might */ - /* define it for certain configurations only. */ - /* */ --/* #define TT_CONFIG_OPTION_BYTECODE_INTERPRETER */ -+#define TT_CONFIG_OPTION_BYTECODE_INTERPRETER - - - /*************************************************************************/ diff --git a/contrib/packages/rpm/el5/SOURCES/freetype-2.2.1-enable-valid.patch b/contrib/packages/rpm/el5/SOURCES/freetype-2.2.1-enable-valid.patch deleted file mode 100644 index c78b6b7..0000000 --- a/contrib/packages/rpm/el5/SOURCES/freetype-2.2.1-enable-valid.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- freetype-2.2.1/modules.cfg.orig 2006-07-07 21:01:09.000000000 -0400 -+++ freetype-2.2.1/modules.cfg 2006-07-07 21:01:54.000000000 -0400 -@@ -110,7 +110,7 @@ - AUX_MODULES += cache - - # TrueType GX/AAT table validation. Needs ftgxval.c below. --# AUX_MODULES += gxvalid -+AUX_MODULES += gxvalid - - # Support for streams compressed with gzip (files with suffix .gz). - # -@@ -124,7 +124,7 @@ - - # OpenType table validation. Needs ftotval.c below. - # --# AUX_MODULES += otvalid -+AUX_MODULES += otvalid - - # Auxiliary PostScript driver component to share common code. - # diff --git a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.0-enable-spr.patch b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.0-enable-spr.patch deleted file mode 100644 index 8432e28..0000000 --- a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.0-enable-spr.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- freetype-2.3.0/include/freetype/config/ftoption.h.spf 2007-01-18 14:27:34.000000000 -0500 -+++ freetype-2.3.0/include/freetype/config/ftoption.h 2007-01-18 14:27:48.000000000 -0500 -@@ -92,7 +92,7 @@ - /* This is done to allow FreeType clients to run unmodified, forcing */ - /* them to display normal gray-level anti-aliased glyphs. */ - /* */ --/* #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING */ -+#define FT_CONFIG_OPTION_SUBPIXEL_RENDERING - - - /*************************************************************************/ diff --git a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-1797.patch b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-1797.patch deleted file mode 100644 index c2d79d1..0000000 --- a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-1797.patch +++ /dev/null @@ -1,101 +0,0 @@ ---- freetype-2.3.11/src/cff/cffgload.c.CVE-2010-1797-2 2009-09-10 17:52:21.000000000 +0200 -+++ freetype-2.3.11/src/cff/cffgload.c 2010-08-11 13:39:32.000000000 +0200 -@@ -2358,8 +2358,11 @@ - return CFF_Err_Unimplemented_Feature; - } - -- decoder->top = args; -+ decoder->top = args; - -+ if ( decoder->top - stack >= CFF_MAX_OPERANDS ) -+ goto Stack_Overflow; -+ - } /* general operator processing */ - - } /* while ip < limit */ -@@ -2627,48 +2630,54 @@ - /* now load the unscaled outline */ - error = cff_get_glyph_data( face, glyph_index, - &charstring, &charstring_len ); -- if ( !error ) -- { -- error = cff_decoder_prepare( &decoder, size, glyph_index ); -- if ( !error ) -- { -- error = cff_decoder_parse_charstrings( &decoder, -- charstring, -- charstring_len ); -+ if ( error ) -+ goto Glyph_Build_Finished; -+ -+ error = cff_decoder_prepare( &decoder, size, glyph_index ); -+ if ( error ) -+ goto Glyph_Build_Finished; - -- cff_free_glyph_data( face, &charstring, charstring_len ); -+ error = cff_decoder_parse_charstrings( &decoder, -+ charstring, -+ charstring_len ); -+ -+ cff_free_glyph_data( face, &charstring, charstring_len ); -+ -+ if ( error ) -+ goto Glyph_Build_Finished; - - - #ifdef FT_CONFIG_OPTION_INCREMENTAL -- /* Control data and length may not be available for incremental */ -- /* fonts. */ -- if ( face->root.internal->incremental_interface ) -- { -- glyph->root.control_data = 0; -- glyph->root.control_len = 0; -- } -- else -+ /* Control data and length may not be available for incremental */ -+ /* fonts. */ -+ if ( face->root.internal->incremental_interface ) -+ { -+ glyph->root.control_data = 0; -+ glyph->root.control_len = 0; -+ } -+ else - #endif /* FT_CONFIG_OPTION_INCREMENTAL */ - -- /* We set control_data and control_len if charstrings is loaded. */ -- /* See how charstring loads at cff_index_access_element() in */ -- /* cffload.c. */ -- { -- CFF_Index csindex = &cff->charstrings_index; -+ /* We set control_data and control_len if charstrings is loaded. */ -+ /* See how charstring loads at cff_index_access_element() in */ -+ /* cffload.c. */ -+ { -+ CFF_Index csindex = &cff->charstrings_index; - - -- if ( csindex->offsets ) -- { -- glyph->root.control_data = csindex->bytes + -- csindex->offsets[glyph_index] - 1; -- glyph->root.control_len = charstring_len; -- } -- } -+ if ( csindex->offsets ) -+ { -+ glyph->root.control_data = csindex->bytes + -+ csindex->offsets[glyph_index] - 1; -+ glyph->root.control_len = charstring_len; - } - } - -- /* save new glyph tables */ -- cff_builder_done( &decoder.builder ); -+ Glyph_Build_Finished: -+ /* save new glyph tables, if no error */ -+ if ( !error ) -+ cff_builder_done( &decoder.builder ); -+ /* XXX: anything to do for broken glyph entry? */ - } - - #ifdef FT_CONFIG_OPTION_INCREMENTAL diff --git a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-2498.patch b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-2498.patch deleted file mode 100644 index fede842..0000000 --- a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-2498.patch +++ /dev/null @@ -1,35 +0,0 @@ ---- freetype-2.3.11/src/pshinter/pshalgo.c 2009-07-03 15:28:24.000000000 +0200 -+++ freetype-2.3.11/src/pshinter/pshalgo.c 2010-07-13 13:14:22.000000000 +0200 -@@ -4,7 +4,8 @@ - /* */ - /* PostScript hinting algorithm (body). */ - /* */ --/* Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */ -+/* Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 */ -+/* by */ - /* David Turner, Robert Wilhelm, and Werner Lemberg. */ - /* */ - /* This file is part of the FreeType project, and may only be used */ -@@ -1690,7 +1691,10 @@ - /* process secondary hints to `selected' points */ - if ( num_masks > 1 && glyph->num_points > 0 ) - { -- first = mask->end_point; -+ /* the `endchar' op can reduce the number of points */ -+ first = mask->end_point > glyph->num_points -+ ? glyph->num_points -+ : mask->end_point; - mask++; - for ( ; num_masks > 1; num_masks--, mask++ ) - { -@@ -1698,7 +1702,9 @@ - FT_Int count; - - -- next = mask->end_point; -+ next = mask->end_point > glyph->num_points -+ ? glyph->num_points -+ : mask->end_point; - count = next - first; - if ( count > 0 ) - { diff --git a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-2499.patch b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-2499.patch deleted file mode 100644 index 5455fa0..0000000 --- a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-2499.patch +++ /dev/null @@ -1,39 +0,0 @@ ---- freetype-2.3.11/src/base/ftobjs.c 2009-09-02 08:42:41.000000000 +0200 -+++ freetype-2.3.11/src/base/ftobjs.c 2010-07-12 16:39:13.000000000 +0200 -@@ -1531,6 +1531,8 @@ - len += rlen; - else - { -+ if ( pfb_lenpos + 3 > pfb_len + 2 ) -+ goto Exit2; - pfb_data[pfb_lenpos ] = (FT_Byte)( len ); - pfb_data[pfb_lenpos + 1] = (FT_Byte)( len >> 8 ); - pfb_data[pfb_lenpos + 2] = (FT_Byte)( len >> 16 ); -@@ -1539,6 +1541,8 @@ - if ( ( flags >> 8 ) == 5 ) /* End of font mark */ - break; - -+ if ( pfb_pos + 6 > pfb_len + 2 ) -+ goto Exit2; - pfb_data[pfb_pos++] = 0x80; - - type = flags >> 8; -@@ -1553,12 +1557,18 @@ - } - - error = FT_Stream_Read( stream, (FT_Byte *)pfb_data + pfb_pos, rlen ); -+ if ( error ) -+ goto Exit2; - pfb_pos += rlen; - } - -+ if ( pfb_pos + 2 > pfb_len + 2 ) -+ goto Exit2; - pfb_data[pfb_pos++] = 0x80; - pfb_data[pfb_pos++] = 3; - -+ if ( pfb_lenpos + 3 > pfb_len + 2 ) -+ goto Exit2; - pfb_data[pfb_lenpos ] = (FT_Byte)( len ); - pfb_data[pfb_lenpos + 1] = (FT_Byte)( len >> 8 ); - pfb_data[pfb_lenpos + 2] = (FT_Byte)( len >> 16 ); diff --git a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-2500.patch b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-2500.patch deleted file mode 100644 index afc906d..0000000 --- a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-2500.patch +++ /dev/null @@ -1,31 +0,0 @@ ---- freetype-2.3.11/src/smooth/ftgrays.c 2009-07-31 18:45:19.000000000 +0200 -+++ freetype-2.3.11/src/smooth/ftgrays.c 2010-07-13 10:26:58.000000000 +0200 -@@ -1189,7 +1189,7 @@ - /* first of all, compute the scanline offset */ - p = (unsigned char*)map->buffer - y * map->pitch; - if ( map->pitch >= 0 ) -- p += ( map->rows - 1 ) * map->pitch; -+ p += (unsigned)( ( map->rows - 1 ) * map->pitch ); - - for ( ; count > 0; count--, spans++ ) - { ---- freetype-2.3.11/src/smooth/ftsmooth.c 2009-07-31 18:45:19.000000000 +0200 -+++ freetype-2.3.11/src/smooth/ftsmooth.c 2010-07-13 10:26:58.000000000 +0200 -@@ -4,7 +4,7 @@ - /* */ - /* Anti-aliasing renderer interface (body). */ - /* */ --/* Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006, 2009 by */ -+/* Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006, 2009, 2010 by */ - /* David Turner, Robert Wilhelm, and Werner Lemberg. */ - /* */ - /* This file is part of the FreeType project, and may only be used, */ -@@ -200,7 +200,7 @@ - - /* Required check is ( pitch * height < FT_ULONG_MAX ), */ - /* but we care realistic cases only. Always pitch <= width. */ -- if ( width > 0xFFFFU || height > 0xFFFFU ) -+ if ( width > 0x7FFFU || height > 0x7FFFU ) - { - FT_ERROR(( "ft_smooth_render_generic: glyph too large: %d x %d\n", - width, height )); diff --git a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-2519.patch b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-2519.patch deleted file mode 100644 index 49a639c..0000000 --- a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-2519.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- freetype-2.3.11/src/base/ftobjs.c 2010-07-12 17:03:47.000000000 +0200 -+++ freetype-2.3.11/src/base/ftobjs.c 2010-07-12 17:07:06.000000000 +0200 -@@ -1526,7 +1526,19 @@ - goto Exit; - if ( FT_READ_USHORT( flags ) ) - goto Exit; -- rlen -= 2; /* the flags are part of the resource */ -+ FT_TRACE3(( "POST fragment[%d]: offsets=0x%08x, rlen=0x%08x, flags=0x%04x\n", -+ i, offsets[i], rlen, flags )); -+ -+ if ( ( flags >> 8 ) == 0 ) /* Comment, should not be loaded */ -+ continue; -+ -+ /* the flags are part of the resource, so rlen >= 2. */ -+ /* but some fonts declare rlen = 0 for empty fragment */ -+ if ( rlen > 2 ) -+ rlen -= 2; -+ else -+ rlen = 0; -+ - if ( ( flags >> 8 ) == type ) - len += rlen; - else diff --git a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-2520.patch b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-2520.patch deleted file mode 100644 index 32cd3d8..0000000 --- a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-2520.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- freetype-2.3.11/src/truetype/ttinterp.c 2009-07-31 18:45:19.000000000 +0200 -+++ freetype-2.3.11/src/truetype/ttinterp.c 2010-07-15 14:44:23.000000000 +0200 -@@ -6466,8 +6466,8 @@ - end_point = CUR.pts.contours[contour] - CUR.pts.first_point; - first_point = point; - -- if ( CUR.pts.n_points <= end_point ) -- end_point = CUR.pts.n_points; -+ if ( BOUNDS ( end_point, CUR.pts.n_points ) ) -+ end_point = CUR.pts.n_points - 1; - - while ( point <= end_point && ( CUR.pts.tags[point] & mask ) == 0 ) - point++; diff --git a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-2527.patch b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-2527.patch deleted file mode 100644 index ed7ed1e..0000000 --- a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-2527.patch +++ /dev/null @@ -1,154 +0,0 @@ ---- freetype-2.3.11/ft2demos-2.3.11/src/ftdiff.c 2009-04-30 18:07:48.000000000 +0200 -+++ freetype-2.3.11/ft2demos-2.3.11/src/ftdiff.c 2010-07-22 18:18:06.000000000 +0200 -@@ -1054,11 +1054,11 @@ - - state->message = state->message0; - if ( total > 1 ) -- sprintf( state->message0, "%s %d/%d @ %5.1fpt", -+ sprintf( state->message0, "%.100s %d/%d @ %5.1fpt", - state->filename, idx + 1, total, - state->char_size ); - else -- sprintf( state->message0, "%s @ %5.1fpt", -+ sprintf( state->message0, "%.100s @ %5.1fpt", - state->filename, - state->char_size ); - } ---- freetype-2.3.11/ft2demos-2.3.11/src/ftgrid.c 2009-04-30 18:15:21.000000000 +0200 -+++ freetype-2.3.11/ft2demos-2.3.11/src/ftgrid.c 2010-07-22 18:18:06.000000000 +0200 -@@ -2,7 +2,7 @@ - /* */ - /* The FreeType project -- a free and portable quality TrueType renderer. */ - /* */ --/* Copyright 1996-2000, 2003, 2004, 2005, 2006, 2007, 2009 by */ -+/* Copyright 1996-2000, 2003, 2004, 2005, 2006, 2007, 2009, 2010 by */ - /* D. Turner, R.Wilhelm, and W. Lemberg */ - /* */ - /* */ -@@ -787,22 +787,22 @@ grid_status_draw_outline( GridStatus - switch ( error_code ) - { - case FT_Err_Ok: -- sprintf( status.header_buffer, "%s %s (file `%s')", -+ sprintf( status.header_buffer, "%.50s %.50s (file `%.100s')", - face->family_name, face->style_name, basename ); - break; - - case FT_Err_Invalid_Pixel_Size: -- sprintf( status.header_buffer, "Invalid pixel size (file `%s')", -+ sprintf( status.header_buffer, "Invalid pixel size (file `%.100s')", - basename ); - break; - - case FT_Err_Invalid_PPem: -- sprintf( status.header_buffer, "Invalid ppem value (file `%s')", -+ sprintf( status.header_buffer, "Invalid ppem value (file `%.100s')", - basename ); - break; - - default: -- sprintf( status.header_buffer, "File `%s': error 0x%04x", -+ sprintf( status.header_buffer, "File `%.100s': error 0x%04x", - basename, (FT_UShort)error_code ); - break; - } ---- freetype-2.3.11/ft2demos-2.3.11/src/ftmulti.c 2009-03-14 14:58:28.000000000 +0100 -+++ freetype-2.3.11/ft2demos-2.3.11/src/ftmulti.c 2010-07-22 18:18:39.000000000 +0200 -@@ -2,7 +2,7 @@ - /* */ - /* The FreeType project -- a free and portable quality TrueType renderer. */ - /* */ --/* Copyright 1996-2000, 2003, 2004, 2005 by */ -+/* Copyright 1996-2000, 2003, 2004, 2005, 2010 by */ - /* D. Turner, R.Wilhelm, and W. Lemberg */ - /* */ - /* */ -@@ -34,7 +34,7 @@ - - #define MAXPTSIZE 500 /* dtp */ - -- char Header[128]; -+ char Header[256]; - char* new_header = 0; - - const unsigned char* Text = (unsigned char*) -@@ -795,7 +795,7 @@ - Render_All( Num, ptsize ); - } - -- sprintf( Header, "%s %s (file %s)", -+ sprintf( Header, "%.50s %.50s (file %.100s)", - face->family_name, - face->style_name, - ft_basename( argv[file] ) ); -@@ -830,7 +830,7 @@ - } - else - { -- sprintf( Header, "%s: not an MM font file, or could not be opened", -+ sprintf( Header, "%.100s: not an MM font file, or could not be opened", - ft_basename( argv[file] ) ); - } - ---- freetype-2.3.11/ft2demos-2.3.11/src/ftstring.c 2009-03-14 14:58:28.000000000 +0100 -+++ freetype-2.3.11/ft2demos-2.3.11/src/ftstring.c 2010-07-22 18:18:06.000000000 +0200 -@@ -2,7 +2,7 @@ - /* */ - /* The FreeType project -- a free and portable quality TrueType renderer. */ - /* */ --/* Copyright 1996-2002, 2003, 2004, 2005, 2006, 2007, 2009 by */ -+/* Copyright 1996-2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010 by */ - /* D. Turner, R.Wilhelm, and W. Lemberg */ - /* */ - /* */ -@@ -413,19 +413,20 @@ - switch ( error_code ) - { - case FT_Err_Ok: -- sprintf( status.header_buffer, "%s %s (file `%s')", face->family_name, -+ sprintf( status.header_buffer, -+ "%.50s %.50s (file `%.100s')", face->family_name, - face->style_name, basename ); - break; - case FT_Err_Invalid_Pixel_Size: -- sprintf( status.header_buffer, "Invalid pixel size (file `%s')", -+ sprintf( status.header_buffer, "Invalid pixel size (file `%.100s')", - basename ); - break; - case FT_Err_Invalid_PPem: -- sprintf( status.header_buffer, "Invalid ppem value (file `%s')", -+ sprintf( status.header_buffer, "Invalid ppem value (file `%.100s')", - basename ); - break; - default: -- sprintf( status.header_buffer, "File `%s': error 0x%04x", basename, -+ sprintf( status.header_buffer, "File `%.100s': error 0x%04x", basename, - (FT_UShort)error_code ); - break; - } ---- freetype-2.3.11/ft2demos-2.3.11/src/ftview.c 2009-04-30 20:08:25.000000000 +0200 -+++ freetype-2.3.11/ft2demos-2.3.11/src/ftview.c 2010-07-22 18:18:06.000000000 +0200 -@@ -1086,19 +1086,19 @@ - switch ( error_code ) - { - case FT_Err_Ok: -- sprintf( status.header_buffer, "%s %s (file `%s')", -+ sprintf( status.header_buffer, "%.50s %.50s (file `%.100s')", - face->family_name, face->style_name, basename ); - break; - case FT_Err_Invalid_Pixel_Size: -- sprintf( status.header_buffer, "Invalid pixel size (file `%s')", -+ sprintf( status.header_buffer, "Invalid pixel size (file `%.100s')", - basename ); - break; - case FT_Err_Invalid_PPem: -- sprintf( status.header_buffer, "Invalid ppem value (file `%s')", -+ sprintf( status.header_buffer, "Invalid ppem value (file `%.100s')", - basename ); - break; - default: -- sprintf( status.header_buffer, "File `%s': error 0x%04x", -+ sprintf( status.header_buffer, "File `%.100s': error 0x%04x", - basename, (FT_UShort)error_code ); - break; - } diff --git a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-2805.patch b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-2805.patch deleted file mode 100644 index 74ff6be..0000000 --- a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-2805.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- freetype-2.3.11/src/base/ftstream.c 2009-08-03 19:51:40.000000000 +0200 -+++ freetype-2.3.11/src/base/ftstream.c 2010-09-30 13:46:08.000000000 +0200 -@@ -275,7 +275,7 @@ - { - /* check current and new position */ - if ( stream->pos >= stream->size || -- stream->pos + count > stream->size ) -+ stream->size - stream->pos < count ) - { - FT_ERROR(( "FT_Stream_EnterFrame:" - " invalid i/o; pos = 0x%lx, count = %lu, size = 0x%lx\n", diff --git a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-2806.patch b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-2806.patch deleted file mode 100644 index 564d6d3..0000000 --- a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-2806.patch +++ /dev/null @@ -1,41 +0,0 @@ ---- freetype-2.3.11/src/type42/t42parse.c 2009-07-03 15:28:24.000000000 +0200 -+++ freetype-2.3.11/src/type42/t42parse.c 2010-09-23 12:15:56.000000000 +0200 -@@ -4,7 +4,7 @@ - /* */ - /* Type 42 font parser (body). */ - /* */ --/* Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */ -+/* Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 by */ - /* Roberto Alameda. */ - /* */ - /* This file is part of the FreeType project, and may only be used, */ -@@ -575,6 +575,12 @@ - } - - string_size = T1_ToInt( parser ); -+ if ( string_size < 0 ) -+ { -+ FT_ERROR(( "t42_parse_sfnts: invalid string size\n" )); -+ error = T42_Err_Invalid_File_Format; -+ goto Fail; -+ } - - T1_Skip_PS_Token( parser ); /* `RD' */ - if ( parser->root.error ) -@@ -582,13 +588,14 @@ - - string_buf = parser->root.cursor + 1; /* one space after `RD' */ - -- parser->root.cursor += string_size + 1; -- if ( parser->root.cursor >= limit ) -+ if ( limit - parser->root.cursor < string_size ) - { - FT_ERROR(( "t42_parse_sfnts: too many binary data\n" )); - error = T42_Err_Invalid_File_Format; - goto Fail; - } -+ else -+ parser->root.cursor += string_size + 1; - } - - if ( !string_buf ) diff --git a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-2808.patch b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-2808.patch deleted file mode 100644 index a68a06f..0000000 --- a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-2808.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- freetype-2.3.11/src/base/ftobjs.c 2010-09-30 13:58:50.000000000 +0200 -+++ freetype-2.3.11/src/base/ftobjs.c 2010-09-30 13:59:31.000000000 +0200 -@@ -1529,6 +1529,7 @@ - FT_TRACE3(( "POST fragment[%d]: offsets=0x%08x, rlen=0x%08x, flags=0x%04x\n", - i, offsets[i], rlen, flags )); - -+ /* postpone the check of rlen longer than buffer until FT_Stream_Read() */ - if ( ( flags >> 8 ) == 0 ) /* Comment, should not be loaded */ - continue; - -@@ -1568,6 +1569,10 @@ - pfb_data[pfb_pos++] = 0; - } - -+ error = FT_Err_Cannot_Open_Resource; -+ if ( pfb_pos > pfb_len || pfb_pos + rlen > pfb_len ) -+ goto Exit2; -+ - error = FT_Stream_Read( stream, (FT_Byte *)pfb_data + pfb_pos, rlen ); - if ( error ) - goto Exit2; diff --git a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-3311.patch b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-3311.patch deleted file mode 100644 index 3645591..0000000 --- a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-3311.patch +++ /dev/null @@ -1,37 +0,0 @@ ---- freetype-2.3.11/src/base/ftstream.c 2010-09-30 14:12:38.000000000 +0200 -+++ freetype-2.3.11/src/base/ftstream.c 2010-09-30 14:12:59.000000000 +0200 -@@ -59,8 +59,17 @@ - { - FT_Error error = FT_Err_Ok; - -+ /* note that seeking to the first position after the file is valid */ -+ if ( pos > stream->size ) -+ { -+ FT_ERROR(( "FT_Stream_Seek:" -+ " invalid i/o; pos = 0x%lx, size = 0x%lx\n", -+ pos, stream->size )); - -- if ( stream->read ) -+ error = FT_Err_Invalid_Stream_Operation; -+ } -+ -+ if ( !error && stream->read ) - { - if ( stream->read( stream, pos, 0, 0 ) ) - { -@@ -71,15 +80,6 @@ - error = FT_Err_Invalid_Stream_Operation; - } - } -- /* note that seeking to the first position after the file is valid */ -- else if ( pos > stream->size ) -- { -- FT_ERROR(( "FT_Stream_Seek:" -- " invalid i/o; pos = 0x%lx, size = 0x%lx\n", -- pos, stream->size )); -- -- error = FT_Err_Invalid_Stream_Operation; -- } - - if ( !error ) - stream->pos = pos; diff --git a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-3855.patch b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-3855.patch deleted file mode 100644 index 31c6144..0000000 --- a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-3855.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- freetype-2.3.11/src/truetype/ttgxvar.c.orig 2009-07-31 18:45:19.000000000 +0200 -+++ freetype-2.3.11/src/truetype/ttgxvar.c 2010-10-22 08:52:37.000000000 +0200 -@@ -157,7 +157,7 @@ - runcnt = runcnt & GX_PT_POINT_RUN_COUNT_MASK; - first = points[i++] = FT_GET_USHORT(); - -- if ( runcnt < 1 ) -+ if ( runcnt < 1 || i + runcnt >= n ) - goto Exit; - - /* first point not included in runcount */ -@@ -168,7 +168,7 @@ - { - first = points[i++] = FT_GET_BYTE(); - -- if ( runcnt < 1 ) -+ if ( runcnt < 1 || i + runcnt >= n ) - goto Exit; - - for ( j = 0; j < runcnt; ++j ) diff --git a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2011-0226.patch b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2011-0226.patch deleted file mode 100644 index d610b90..0000000 --- a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2011-0226.patch +++ /dev/null @@ -1,108 +0,0 @@ ---- freetype-2.3.11/src/psaux/t1decode.c 2009-09-29 19:51:31.000000000 +0200 -+++ freetype-2.3.11/src/psaux/t1decode.c 2011-07-20 14:39:24.000000000 +0200 -@@ -4,7 +4,7 @@ - /* */ - /* PostScript Type 1 decoding routines (body). */ - /* */ --/* Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */ -+/* Copyright 2000-2011 by */ - /* David Turner, Robert Wilhelm, and Werner Lemberg. */ - /* */ - /* This file is part of the FreeType project, and may only be used, */ -@@ -27,6 +27,8 @@ - - #include "psauxerr.h" - -+/* ensure proper sign extension */ -+#define Fix2Int( f ) ( (FT_Int)(FT_Short)( (f) >> 16 ) ) - - /*************************************************************************/ - /* */ -@@ -665,7 +667,7 @@ - if ( large_int ) - FT_TRACE4(( " %ld", value )); - else -- FT_TRACE4(( " %ld", (FT_Int32)( value >> 16 ) )); -+ FT_TRACE4(( " %ld", Fix2Int( value ) )); - #endif - - *top++ = value; -@@ -687,8 +689,8 @@ - - top -= 2; - -- subr_no = (FT_Int)( top[1] >> 16 ); -- arg_cnt = (FT_Int)( top[0] >> 16 ); -+ subr_no = Fix2Int( top[1] ); -+ arg_cnt = Fix2Int( top[0] ); - - /***********************************************************/ - /* */ -@@ -861,7 +863,7 @@ - if ( arg_cnt != 1 || blend == NULL ) - goto Unexpected_OtherSubr; - -- idx = (FT_Int)( top[0] >> 16 ); -+ idx = Fix2Int( top[0] ); - - if ( idx < 0 || - idx + blend->num_designs > decoder->len_buildchar ) -@@ -929,7 +931,7 @@ - if ( arg_cnt != 2 || blend == NULL ) - goto Unexpected_OtherSubr; - -- idx = (FT_Int)( top[1] >> 16 ); -+ idx = Fix2Int( top[1] ); - - if ( idx < 0 || (FT_UInt) idx >= decoder->len_buildchar ) - goto Unexpected_OtherSubr; -@@ -950,7 +952,7 @@ - if ( arg_cnt != 1 || blend == NULL ) - goto Unexpected_OtherSubr; - -- idx = (FT_Int)( top[0] >> 16 ); -+ idx = Fix2Int( top[0] ); - - if ( idx < 0 || (FT_UInt) idx >= decoder->len_buildchar ) - goto Unexpected_OtherSubr; -@@ -1008,11 +1010,15 @@ - break; - - default: -- FT_ERROR(( "t1_decoder_parse_charstrings:" -- " unknown othersubr [%d %d], wish me luck\n", -- arg_cnt, subr_no )); -- unknown_othersubr_result_cnt = arg_cnt; -- break; -+ if ( arg_cnt >= 0 && subr_no >= 0 ) -+ { -+ FT_ERROR(( "t1_decoder_parse_charstrings:" -+ " unknown othersubr [%d %d], wish me luck\n", -+ arg_cnt, subr_no )); -+ unknown_othersubr_result_cnt = arg_cnt; -+ break; -+ } -+ /* fall through */ - - Unexpected_OtherSubr: - FT_ERROR(( "t1_decoder_parse_charstrings:" -@@ -1138,8 +1144,8 @@ - top[0], - top[1], - top[2], -- (FT_Int)( top[3] >> 16 ), -- (FT_Int)( top[4] >> 16 ) ); -+ Fix2Int( top[3] ), -+ Fix2Int( top[4] ) ); - - case op_sbw: - FT_TRACE4(( " sbw" )); -@@ -1313,7 +1319,7 @@ - - FT_TRACE4(( " callsubr" )); - -- idx = (FT_Int)( top[0] >> 16 ); -+ idx = Fix2Int( top[0] ); - if ( idx < 0 || idx >= (FT_Int)decoder->num_subrs ) - { - FT_ERROR(( "t1_decoder_parse_charstrings:" diff --git a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2011-3256.patch b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2011-3256.patch deleted file mode 100644 index d81f442..0000000 --- a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2011-3256.patch +++ /dev/null @@ -1,92 +0,0 @@ ---- freetype-2.3.11/src/base/ftbitmap.c 2009-07-31 18:45:18.000000000 +0200 -+++ freetype-2.3.11/src/base/ftbitmap.c 2011-10-19 12:25:26.000000000 +0200 -@@ -4,7 +4,7 @@ - /* */ - /* FreeType utility functions for bitmaps (body). */ - /* */ --/* Copyright 2004, 2005, 2006, 2007, 2008, 2009 by */ -+/* Copyright 2004-2009, 2011 by */ - /* David Turner, Robert Wilhelm, and Werner Lemberg. */ - /* */ - /* This file is part of the FreeType project, and may only be used, */ -@@ -417,6 +417,10 @@ - - target->pitch = source->width + pad; - -+ if ( target->pitch > 0 && -+ target->rows > FT_ULONG_MAX / target->pitch ) -+ return FT_Err_Invalid_Argument; -+ - if ( target->rows * target->pitch > old_size && - FT_QREALLOC( target->buffer, - old_size, target->rows * target->pitch ) ) ---- freetype-2.3.11/src/psaux/t1decode.c 2011-10-19 12:25:26.000000000 +0200 -+++ freetype-2.3.11/src/psaux/t1decode.c 2011-10-19 12:25:26.000000000 +0200 -@@ -748,6 +748,13 @@ - if ( arg_cnt != 0 ) - goto Unexpected_OtherSubr; - -+ if ( decoder->flex_state == 0 ) -+ { -+ FT_ERROR(( "t1_decoder_parse_charstrings:" -+ " missing flex start\n" )); -+ goto Syntax_Error; -+ } -+ - /* note that we should not add a point for index 0; */ - /* this will move our current position to the flex */ - /* point without adding any point to the outline */ ---- freetype-2.3.11/src/raster/ftrend1.c 2009-07-03 15:28:24.000000000 +0200 -+++ freetype-2.3.11/src/raster/ftrend1.c 2011-10-19 13:26:02.000000000 +0200 -@@ -4,7 +4,7 @@ - /* */ - /* The FreeType glyph rasterizer interface (body). */ - /* */ --/* Copyright 1996-2001, 2002, 2003, 2005, 2006 by */ -+/* Copyright 1996-2003, 2005, 2006, 2011 by */ - /* David Turner, Robert Wilhelm, and Werner Lemberg. */ - /* */ - /* This file is part of the FreeType project, and may only be used, */ -@@ -25,6 +25,7 @@ - - #include "rasterrs.h" - -+#define FT_USHORT_MAX USHRT_MAX - - /* initialize renderer -- init its raster */ - static FT_Error -@@ -168,6 +169,13 @@ - - width = (FT_UInt)( ( cbox.xMax - cbox.xMin ) >> 6 ); - height = (FT_UInt)( ( cbox.yMax - cbox.yMin ) >> 6 ); -+ -+ if ( width > FT_USHORT_MAX || height > FT_USHORT_MAX ) -+ { -+ error = Raster_Err_Invalid_Argument; -+ goto Exit; -+ } -+ - bitmap = &slot->bitmap; - memory = render->root.memory; - ---- freetype-2.3.11/src/truetype/ttgxvar.c 2011-10-19 12:25:26.000000000 +0200 -+++ freetype-2.3.11/src/truetype/ttgxvar.c 2011-10-19 12:25:26.000000000 +0200 -@@ -4,7 +4,7 @@ - /* */ - /* TrueType GX Font Variation loader */ - /* */ --/* Copyright 2004, 2005, 2006, 2007, 2008, 2009 by */ -+/* Copyright 2004-2011 by */ - /* David Turner, Robert Wilhelm, Werner Lemberg, and George Williams. */ - /* */ - /* This file is part of the FreeType project, and may only be used, */ -@@ -1473,6 +1473,9 @@ - { - for ( j = 0; j < point_count; ++j ) - { -+ if ( localpoints[j] >= n_points ) -+ continue; -+ - delta_xy[localpoints[j]].x += FT_MulFix( deltas_x[j], apply ); - delta_xy[localpoints[j]].y += FT_MulFix( deltas_y[j], apply ); - } diff --git a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2011-3439.patch b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2011-3439.patch deleted file mode 100644 index ee365b2..0000000 --- a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2011-3439.patch +++ /dev/null @@ -1,76 +0,0 @@ ---- freetype-2.3.11/src/cid/cidload.c 2009-07-03 15:28:24.000000000 +0200 -+++ freetype-2.3.11/src/cid/cidload.c 2011-11-15 12:58:41.000000000 +0100 -@@ -4,7 +4,7 @@ - /* */ - /* CID-keyed Type1 font loader (body). */ - /* */ --/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2009 by */ -+/* Copyright 1996-2006, 2009, 2011 by */ - /* David Turner, Robert Wilhelm, and Werner Lemberg. */ - /* */ - /* This file is part of the FreeType project, and may only be used, */ -@@ -110,7 +110,7 @@ - CID_FaceDict dict; - - -- if ( parser->num_dict < 0 ) -+ if ( parser->num_dict < 0 || parser->num_dict >= cid->num_dicts ) - { - FT_ERROR(( "cid_load_keyword: invalid use of `%s'\n", - keyword->ident )); -@@ -158,7 +158,7 @@ - FT_Fixed temp_scale; - - -- if ( parser->num_dict >= 0 ) -+ if ( parser->num_dict >= 0 && parser->num_dict < face->cid.num_dicts ) - { - dict = face->cid.font_dicts + parser->num_dict; - matrix = &dict->font_matrix; -@@ -249,7 +249,7 @@ - CID_FaceDict dict; - - -- if ( parser->num_dict >= 0 ) -+ if ( parser->num_dict >= 0 && parser->num_dict < face->cid.num_dicts ) - { - dict = face->cid.font_dicts + parser->num_dict; - -@@ -413,12 +413,25 @@ - FT_Byte* p; - - -+ /* Check for possible overflow. */ -+ if ( num_subrs == FT_UINT_MAX ) -+ { -+ error = CID_Err_Syntax_Error; -+ goto Fail; -+ } -+ - /* reallocate offsets array if needed */ - if ( num_subrs + 1 > max_offsets ) - { - FT_UInt new_max = FT_PAD_CEIL( num_subrs + 1, 4 ); - - -+ if ( new_max <= max_offsets ) -+ { -+ error = CID_Err_Syntax_Error; -+ goto Fail; -+ } -+ - if ( FT_RENEW_ARRAY( offsets, max_offsets, new_max ) ) - goto Fail; - -@@ -436,6 +449,11 @@ - - FT_FRAME_EXIT(); - -+ /* offsets must be ordered */ -+ for ( count = 1; count <= num_subrs; count++ ) -+ if ( offsets[count - 1] > offsets[count] ) -+ goto Fail; -+ - /* now, compute the size of subrs charstrings, */ - /* allocate, and read them */ - data_len = offsets[num_subrs] - offsets[0]; diff --git a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1126.patch b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1126.patch deleted file mode 100644 index 2a2e0c5..0000000 --- a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1126.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- freetype-2.3.11/src/bdf/bdflib.c 2009-09-12 23:14:25.000000000 +0200 -+++ freetype-2.3.11/src/bdf/bdflib.c 2012-03-28 10:19:23.000000000 +0200 -@@ -1,6 +1,6 @@ - /* - * Copyright 2000 Computing Research Labs, New Mexico State University -- * Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009 -+ * Copyright 2001-2012 - * Francesco Zappa Nardelli - * - * Permission is hereby granted, free of charge, to any person obtaining a -@@ -1235,7 +1235,8 @@ - ep = line + linelen; - - /* Trim the leading whitespace if it exists. */ -- *sp++ = 0; -+ if ( *sp ) -+ *sp++ = 0; - while ( *sp && - ( *sp == ' ' || *sp == '\t' ) ) - sp++; diff --git a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1127.patch b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1127.patch deleted file mode 100644 index a529f19..0000000 --- a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1127.patch +++ /dev/null @@ -1,43 +0,0 @@ ---- freetype-2.3.11/src/bdf/bdflib.c 2012-03-28 10:20:31.000000000 +0200 -+++ freetype-2.3.11/src/bdf/bdflib.c 2012-03-28 10:22:28.000000000 +0200 -@@ -1092,6 +1092,7 @@ - #define ACMSG13 "Glyph %ld extra rows removed.\n" - #define ACMSG14 "Glyph %ld extra columns removed.\n" - #define ACMSG15 "Incorrect glyph count: %ld indicated but %ld found.\n" -+#define ACMSG16 "Glyph %ld missing columns padded with zero bits.\n" - - /* Error messages. */ - #define ERRMSG1 "[line %ld] Missing \"%s\" line.\n" -@@ -1695,18 +1696,31 @@ - for ( i = 0; i < nibbles; i++ ) - { - c = line[i]; -+ if ( !c ) -+ break; - *bp = (FT_Byte)( ( *bp << 4 ) + a2i[c] ); - if ( i + 1 < nibbles && ( i & 1 ) ) - *++bp = 0; - } - -+ /* If any line has not enough columns, */ -+ /* indicate they have been padded with zero bits. */ -+ if ( i < nibbles && -+ !( p->flags & _BDF_GLYPH_WIDTH_CHECK ) ) -+ { -+ FT_TRACE2(( "_bdf_parse_glyphs: " ACMSG16, glyph->encoding )); -+ p->flags |= _BDF_GLYPH_WIDTH_CHECK; -+ font->modified = 1; -+ } -+ - /* Remove possible garbage at the right. */ - mask_index = ( glyph->bbx.width * p->font->bpp ) & 7; - if ( glyph->bbx.width ) - *bp &= nibble_mask[mask_index]; - - /* If any line has extra columns, indicate they have been removed. */ -- if ( ( line[nibbles] == '0' || a2i[(int)line[nibbles]] != 0 ) && -+ if ( i == nibbles && -+ ( line[nibbles] == '0' || a2i[(int)line[nibbles]] != 0 ) && - !( p->flags & _BDF_GLYPH_WIDTH_CHECK ) ) - { - FT_TRACE2(( "_bdf_parse_glyphs: " ACMSG14, glyph->encoding )); diff --git a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1130.patch b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1130.patch deleted file mode 100644 index 4d2f9a8..0000000 --- a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1130.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- freetype-2.3.11/src/pcf/pcfread.c 2009-10-10 19:32:28.000000000 +0200 -+++ freetype-2.3.11/src/pcf/pcfread.c 2012-03-28 10:29:54.000000000 +0200 -@@ -2,7 +2,7 @@ - - FreeType font driver for pcf fonts - -- Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by -+ Copyright 2000-2010, 2012 by - Francesco Zappa Nardelli - - Permission is hereby granted, free of charge, to any person obtaining a copy -@@ -495,7 +495,8 @@ THE SOFTWARE. - goto Bail; - } - -- if ( FT_NEW_ARRAY( strings, string_size ) ) -+ /* allocate one more byte so that we have a final null byte */ -+ if ( FT_NEW_ARRAY( strings, string_size + 1 ) ) - goto Bail; - - error = FT_Stream_Read( stream, (FT_Byte*)strings, string_size ); diff --git a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1131.patch b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1131.patch deleted file mode 100644 index cfbd748..0000000 --- a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1131.patch +++ /dev/null @@ -1,40 +0,0 @@ ---- freetype-2.3.11/src/smooth/ftsmooth.c 2012-03-28 10:30:52.000000000 +0200 -+++ freetype-2.3.11/src/smooth/ftsmooth.c 2012-03-28 10:33:13.000000000 +0200 -@@ -4,7 +4,7 @@ - /* */ - /* Anti-aliasing renderer interface (body). */ - /* */ --/* Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006, 2009, 2010 by */ -+/* Copyright 2000-2006, 2009-2012 by */ - /* David Turner, Robert Wilhelm, and Werner Lemberg. */ - /* */ - /* This file is part of the FreeType project, and may only be used, */ -@@ -105,7 +105,7 @@ - FT_Error error; - FT_Outline* outline = NULL; - FT_BBox cbox; -- FT_UInt width, height, height_org, width_org, pitch; -+ FT_Pos width, height, height_org, width_org, pitch; - FT_Bitmap* bitmap; - FT_Memory memory; - FT_Int hmul = mode == FT_RENDER_MODE_LCD; -@@ -140,8 +140,8 @@ - cbox.xMax = FT_PIX_CEIL( cbox.xMax ); - cbox.yMax = FT_PIX_CEIL( cbox.yMax ); - -- width = (FT_UInt)( ( cbox.xMax - cbox.xMin ) >> 6 ); -- height = (FT_UInt)( ( cbox.yMax - cbox.yMin ) >> 6 ); -+ width = ( cbox.xMax - cbox.xMin ) >> 6; -+ height = ( cbox.yMax - cbox.yMin ) >> 6; - bitmap = &slot->bitmap; - memory = render->root.memory; - -@@ -200,7 +200,7 @@ - - /* Required check is ( pitch * height < FT_ULONG_MAX ), */ - /* but we care realistic cases only. Always pitch <= width. */ -- if ( width > 0x7FFFU || height > 0x7FFFU ) -+ if ( width > 0x7FFF || height > 0x7FFF ) - { - FT_ERROR(( "ft_smooth_render_generic: glyph too large: %d x %d\n", - width, height )); diff --git a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1132.patch b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1132.patch deleted file mode 100644 index 550da7f..0000000 --- a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1132.patch +++ /dev/null @@ -1,130 +0,0 @@ ---- freetype-2.3.11/src/psaux/psobjs.c 2009-07-31 18:45:18.000000000 +0200 -+++ freetype-2.3.11/src/psaux/psobjs.c 2012-04-03 13:14:05.000000000 +0200 -@@ -4,7 +4,7 @@ - /* */ - /* Auxiliary functions for PostScript fonts (body). */ - /* */ --/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */ -+/* Copyright 1996-2012 by */ - /* David Turner, Robert Wilhelm, and Werner Lemberg. */ - /* */ - /* This file is part of the FreeType project, and may only be used, */ -@@ -589,7 +589,7 @@ - } - - Exit: -- if ( cur == parser->cursor ) -+ if ( cur < limit && cur == parser->cursor ) - { - FT_ERROR(( "ps_parser_skip_PS_token:" - " current token is `%c' which is self-delimiting\n" ---- freetype-2.3.11/src/type1/t1load.c 2009-09-01 08:07:32.000000000 +0200 -+++ freetype-2.3.11/src/type1/t1load.c 2012-04-03 13:14:30.000000000 +0200 -@@ -71,6 +71,13 @@ - #include "t1errors.h" - - -+#ifdef FT_CONFIG_OPTION_INCREMENTAL -+#define IS_INCREMENTAL ( face->root.internal->incremental_interface != 0 ) -+#else -+#define IS_INCREMENTAL 0 -+#endif -+ -+ - /*************************************************************************/ - /* */ - /* The macro FT_COMPONENT is used in trace mode. It is an implicit */ -@@ -1027,7 +1034,8 @@ - static int - read_binary_data( T1_Parser parser, - FT_Long* size, -- FT_Byte** base ) -+ FT_Byte** base, -+ FT_Bool incremental ) - { - FT_Byte* cur; - FT_Byte* limit = parser->root.limit; -@@ -1057,8 +1065,12 @@ - return !parser->root.error; - } - -- FT_ERROR(( "read_binary_data: invalid size field\n" )); -- parser->root.error = T1_Err_Invalid_File_Format; -+ if( !incremental ) -+ { -+ FT_ERROR(( "read_binary_data: invalid size field\n" )); -+ parser->root.error = T1_Err_Invalid_File_Format; -+ } -+ - return 0; - } - -@@ -1379,15 +1391,17 @@ - FT_Byte* base; - - -- /* If the next token isn't `dup' we are done. */ -- if ( ft_strncmp( (char*)parser->root.cursor, "dup", 3 ) != 0 ) -+ /* If we are out of data, or if the next token isn't `dup', */ -+ /* we are done. */ -+ if ( parser->root.cursor + 4 >= parser->root.limit || -+ ft_strncmp( (char*)parser->root.cursor, "dup", 3 ) != 0 ) - break; - - T1_Skip_PS_Token( parser ); /* `dup' */ - - idx = T1_ToInt( parser ); - -- if ( !read_binary_data( parser, &size, &base ) ) -+ if ( !read_binary_data( parser, &size, &base, IS_INCREMENTAL ) ) - return; - - /* The binary string is followed by one token, e.g. `NP' */ -@@ -1399,7 +1413,8 @@ - return; - T1_Skip_Spaces ( parser ); - -- if ( ft_strncmp( (char*)parser->root.cursor, "put", 3 ) == 0 ) -+ if ( parser->root.cursor + 4 < parser->root.limit && -+ ft_strncmp( (char*)parser->root.cursor, "put", 3 ) == 0 ) - { - T1_Skip_PS_Token( parser ); /* skip `put' */ - T1_Skip_Spaces ( parser ); -@@ -1572,7 +1587,7 @@ - cur++; /* skip `/' */ - len = parser->root.cursor - cur; - -- if ( !read_binary_data( parser, &size, &base ) ) -+ if ( !read_binary_data( parser, &size, &base, IS_INCREMENTAL ) ) - return; - - /* for some non-standard fonts like `Optima' which provides */ -@@ -1861,7 +1876,7 @@ - - - parser->root.cursor = start_binary; -- if ( !read_binary_data( parser, &s, &b ) ) -+ if ( !read_binary_data( parser, &s, &b, IS_INCREMENTAL ) ) - return T1_Err_Invalid_File_Format; - have_integer = 0; - } -@@ -1874,7 +1889,7 @@ - - - parser->root.cursor = start_binary; -- if ( !read_binary_data( parser, &s, &b ) ) -+ if ( !read_binary_data( parser, &s, &b, IS_INCREMENTAL ) ) - return T1_Err_Invalid_File_Format; - have_integer = 0; - } -@@ -2148,9 +2163,7 @@ - type1->subrs_len = loader.subrs.lengths; - } - --#ifdef FT_CONFIG_OPTION_INCREMENTAL -- if ( !face->root.internal->incremental_interface ) --#endif -+ if ( !IS_INCREMENTAL ) - if ( !loader.charstrings.init ) - { - FT_ERROR(( "T1_Open_Face: no `/CharStrings' array in face\n" )); diff --git a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1134.patch b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1134.patch deleted file mode 100644 index ca51f26..0000000 --- a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1134.patch +++ /dev/null @@ -1,26 +0,0 @@ ---- freetype-2.3.11/src/type1/t1parse.c 2009-07-03 15:28:24.000000000 +0200 -+++ freetype-2.3.11/src/type1/t1parse.c 2012-03-28 10:39:25.000000000 +0200 -@@ -4,7 +4,7 @@ - /* */ - /* Type 1 parser (body). */ - /* */ --/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2008, 2009 by */ -+/* Copyright 1996-2005, 2008, 2009, 2012 by */ - /* David Turner, Robert Wilhelm, and Werner Lemberg. */ - /* */ - /* This file is part of the FreeType project, and may only be used, */ -@@ -464,6 +464,14 @@ - /* we now decrypt the encoded binary private dictionary */ - psaux->t1_decrypt( parser->private_dict, parser->private_len, 55665U ); - -+ if ( parser->private_len < 4 ) -+ { -+ FT_ERROR(( "T1_Get_Private_Dict:" -+ " invalid private dictionary section\n" )); -+ error = T1_Err_Invalid_File_Format; -+ goto Fail; -+ } -+ - /* replace the four random bytes at the beginning with whitespace */ - parser->private_dict[0] = ' '; - parser->private_dict[1] = ' '; diff --git a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1136.patch b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1136.patch deleted file mode 100644 index fb017b6..0000000 --- a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1136.patch +++ /dev/null @@ -1,49 +0,0 @@ ---- freetype-2.3.11/src/bdf/bdflib.c 2012-03-28 10:40:25.000000000 +0200 -+++ freetype-2.3.11/src/bdf/bdflib.c 2012-03-28 10:44:30.000000000 +0200 -@@ -1736,12 +1736,7 @@ - if ( ft_memcmp( line, "SWIDTH", 6 ) == 0 ) - { - if ( !( p->flags & _BDF_ENCODING ) ) -- { -- /* Missing ENCODING field. */ -- FT_ERROR(( "_bdf_parse_glyphs: " ERRMSG1, lineno, "ENCODING" )); -- error = BDF_Err_Missing_Encoding_Field; -- goto Exit; -- } -+ goto Missing_Encoding; - - error = _bdf_list_split( &p->list, (char *)" +", line, linelen ); - if ( error ) -@@ -1756,6 +1751,9 @@ - /* Expect the DWIDTH (scalable width) field next. */ - if ( ft_memcmp( line, "DWIDTH", 6 ) == 0 ) - { -+ if ( !( p->flags & _BDF_ENCODING ) ) -+ goto Missing_Encoding; -+ - error = _bdf_list_split( &p->list, (char *)" +", line, linelen ); - if ( error ) - goto Exit; -@@ -1781,6 +1779,9 @@ - /* Expect the BBX field next. */ - if ( ft_memcmp( line, "BBX", 3 ) == 0 ) - { -+ if ( !( p->flags & _BDF_ENCODING ) ) -+ goto Missing_Encoding; -+ - error = _bdf_list_split( &p->list, (char *)" +", line, linelen ); - if ( error ) - goto Exit; -@@ -1880,6 +1881,12 @@ - } - - error = BDF_Err_Invalid_File_Format; -+ goto Exit; -+ -+ Missing_Encoding: -+ /* Missing ENCODING field. */ -+ FT_ERROR(( "_bdf_parse_glyphs: " ERRMSG1, lineno, "ENCODING" )); -+ error = BDF_Err_Missing_Encoding_Field; - - Exit: - return error; diff --git a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1137.patch b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1137.patch deleted file mode 100644 index 9086a78..0000000 --- a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1137.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- freetype-2.3.11/src/bdf/bdflib.c 2012-03-28 10:46:09.000000000 +0200 -+++ freetype-2.3.11/src/bdf/bdflib.c 2012-03-28 10:45:50.000000000 +0200 -@@ -424,7 +424,7 @@ - if ( num_items > list->size ) - { - unsigned long oldsize = list->size; /* same as _bdf_list_t.size */ -- unsigned long newsize = oldsize + ( oldsize >> 1 ) + 4; -+ unsigned long newsize = oldsize + ( oldsize >> 1 ) + 5; - unsigned long bigsize = (unsigned long)( FT_INT_MAX / sizeof ( char* ) ); - FT_Memory memory = list->memory; - diff --git a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1139.patch b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1139.patch deleted file mode 100644 index 4b27341..0000000 --- a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1139.patch +++ /dev/null @@ -1,33 +0,0 @@ ---- freetype-2.3.11/src/bdf/bdflib.c 2012-03-28 10:49:56.000000000 +0200 -+++ freetype-2.3.11/src/bdf/bdflib.c 2012-03-28 10:51:40.000000000 +0200 -@@ -785,7 +785,7 @@ - }; - - --#define isdigok( m, d ) (m[(d) >> 3] & ( 1 << ( (d) & 7 ) ) ) -+#define isdigok( m, d ) (m[(unsigned char)(d) >> 3] & ( 1 << ( (d) & 7 ) ) ) - - - /* Routine to convert an ASCII string into an unsigned long integer. */ -@@ -1696,7 +1696,7 @@ - for ( i = 0; i < nibbles; i++ ) - { - c = line[i]; -- if ( !c ) -+ if ( !isdigok( hdigits, c ) ) - break; - *bp = (FT_Byte)( ( *bp << 4 ) + a2i[c] ); - if ( i + 1 < nibbles && ( i & 1 ) ) -@@ -1719,9 +1719,9 @@ - *bp &= nibble_mask[mask_index]; - - /* If any line has extra columns, indicate they have been removed. */ -- if ( i == nibbles && -- ( line[nibbles] == '0' || a2i[(int)line[nibbles]] != 0 ) && -- !( p->flags & _BDF_GLYPH_WIDTH_CHECK ) ) -+ if ( i == nibbles && -+ isdigok( hdigits, line[nibbles] ) && -+ !( p->flags & _BDF_GLYPH_WIDTH_CHECK ) ) - { - FT_TRACE2(( "_bdf_parse_glyphs: " ACMSG14, glyph->encoding )); - p->flags |= _BDF_GLYPH_WIDTH_CHECK; diff --git a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1140.patch b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1140.patch deleted file mode 100644 index 9138127..0000000 --- a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1140.patch +++ /dev/null @@ -1,53 +0,0 @@ ---- freetype-2.3.11/src/psaux/psconv.c 2009-07-31 18:45:18.000000000 +0200 -+++ freetype-2.3.11/src/psaux/psconv.c 2012-03-28 10:55:16.000000000 +0200 -@@ -4,7 +4,7 @@ - /* */ - /* Some convenience conversions (body). */ - /* */ --/* Copyright 2006, 2008, 2009 by */ -+/* Copyright 2006, 2008, 2009, 2012 by */ - /* David Turner, Robert Wilhelm, and Werner Lemberg. */ - /* */ - /* This file is part of the FreeType project, and may only be used, */ -@@ -79,7 +79,7 @@ - FT_Bool sign = 0; - - -- if ( p == limit || base < 2 || base > 36 ) -+ if ( p >= limit || base < 2 || base > 36 ) - return 0; - - if ( *p == '-' || *p == '+' ) -@@ -150,7 +150,7 @@ - FT_Bool sign = 0; - - -- if ( p == limit ) -+ if ( p >= limit ) - return 0; - - if ( *p == '-' || *p == '+' ) -@@ -346,7 +346,11 @@ - - #if 1 - -- p = *cursor; -+ p = *cursor; -+ -+ if ( p >= limit ) -+ return 0; -+ - if ( n > (FT_UInt)( limit - p ) ) - n = (FT_UInt)( limit - p ); - -@@ -434,6 +438,10 @@ - #if 1 - - p = *cursor; -+ -+ if ( p >= limit ) -+ return 0; -+ - if ( n > (FT_UInt)(limit - p) ) - n = (FT_UInt)(limit - p); - diff --git a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1141.patch b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1141.patch deleted file mode 100644 index 2a6f29c..0000000 --- a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1141.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- freetype-2.3.11/src/bdf/bdflib.c 2012-03-28 11:53:32.000000000 +0200 -+++ freetype-2.3.11/src/bdf/bdflib.c 2012-03-28 11:54:12.000000000 +0200 -@@ -520,6 +520,14 @@ - - /* Initialize the list. */ - list->used = 0; -+ if ( list->size ) -+ { -+ list->field[0] = (char*)empty; -+ list->field[1] = (char*)empty; -+ list->field[2] = (char*)empty; -+ list->field[3] = (char*)empty; -+ list->field[4] = (char*)empty; -+ } - - /* If the line is empty, then simply return. */ - if ( linelen == 0 || line[0] == 0 ) diff --git a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1142.patch b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1142.patch deleted file mode 100644 index 5337d4b..0000000 --- a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1142.patch +++ /dev/null @@ -1,27 +0,0 @@ ---- freetype-2.3.11/src/winfonts/winfnt.c 2009-07-31 18:45:19.000000000 +0200 -+++ freetype-2.3.11/src/winfonts/winfnt.c 2012-03-28 11:57:05.000000000 +0200 -@@ -4,7 +4,7 @@ - /* */ - /* FreeType font driver for Windows FNT/FON files */ - /* */ --/* Copyright 1996-2001, 2002, 2003, 2004, 2006, 2007, 2008, 2009 by */ -+/* Copyright 1996-2004, 2006-2012 by */ - /* David Turner, Robert Wilhelm, and Werner Lemberg. */ - /* Copyright 2003 Huw D M Davies for Codeweavers */ - /* Copyright 2007 Dmitry Timoshkov for Codeweavers */ -@@ -825,7 +825,14 @@ - root->charmap = root->charmaps[0]; - } - -- /* setup remaining flags */ -+ /* set up remaining flags */ -+ -+ if ( font->header.last_char < font->header.first_char ) -+ { -+ FT_TRACE2(( "invalid number of glyphs\n" )); -+ error = FNT_Err_Invalid_File_Format; -+ goto Fail; -+ } - - /* reserve one slot for the .notdef glyph at index 0 */ - root->num_glyphs = font->header.last_char - diff --git a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1143.patch b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1143.patch deleted file mode 100644 index 551aeb9..0000000 --- a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1143.patch +++ /dev/null @@ -1,67 +0,0 @@ ---- freetype-2.3.11/src/base/ftcalc.c 2009-07-31 18:45:18.000000000 +0200 -+++ freetype-2.3.11/src/base/ftcalc.c 2012-03-28 11:59:17.000000000 +0200 -@@ -4,7 +4,7 @@ - /* */ - /* Arithmetic computations (body). */ - /* */ --/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2008 by */ -+/* Copyright 1996-2006, 2008, 2012 by */ - /* David Turner, Robert Wilhelm, and Werner Lemberg. */ - /* */ - /* This file is part of the FreeType project, and may only be used, */ -@@ -307,7 +307,7 @@ - q <<= 1; - r |= lo >> 31; - -- if ( r >= (FT_UInt32)y ) -+ if ( r >= y ) - { - r -= y; - q |= 1; -@@ -373,7 +373,7 @@ - if ( a <= 46340L && b <= 46340L && c <= 176095L && c > 0 ) - a = ( a * b + ( c >> 1 ) ) / c; - -- else if ( c > 0 ) -+ else if ( (FT_Int32)c > 0 ) - { - FT_Int64 temp, temp2; - -@@ -412,7 +412,7 @@ - if ( a <= 46340L && b <= 46340L && c > 0 ) - a = a * b / c; - -- else if ( c > 0 ) -+ else if ( (FT_Int32)c > 0 ) - { - FT_Int64 temp; - -@@ -544,7 +544,7 @@ - s = (FT_Int32)a; a = FT_ABS( a ); - s ^= (FT_Int32)b; b = FT_ABS( b ); - -- if ( b == 0 ) -+ if ( (FT_UInt32)b == 0 ) - { - /* check for division by 0 */ - q = (FT_UInt32)0x7FFFFFFFL; -@@ -552,15 +552,16 @@ - else if ( ( a >> 16 ) == 0 ) - { - /* compute result directly */ -- q = (FT_UInt32)( (a << 16) + (b >> 1) ) / (FT_UInt32)b; -+ q = (FT_UInt32)( ( a << 16 ) + ( b >> 1 ) ) / (FT_UInt32)b; - } - else - { - /* we need more bits; we have to do it by hand */ - FT_Int64 temp, temp2; - -- temp.hi = (FT_Int32) (a >> 16); -- temp.lo = (FT_UInt32)(a << 16); -+ -+ temp.hi = (FT_Int32) ( a >> 16 ); -+ temp.lo = (FT_UInt32)( a << 16 ); - temp2.hi = 0; - temp2.lo = (FT_UInt32)( b >> 1 ); - FT_Add64( &temp, &temp2, &temp ); diff --git a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1144.patch b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1144.patch deleted file mode 100644 index 62b47c2..0000000 --- a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1144.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- freetype-2.3.11/src/truetype/ttgload.c 2009-09-08 07:06:51.000000000 +0200 -+++ freetype-2.3.11/src/truetype/ttgload.c 2012-03-28 12:01:04.000000000 +0200 -@@ -267,14 +267,17 @@ - if ( n_contours >= 0xFFF || p + ( n_contours + 1 ) * 2 > limit ) - goto Invalid_Outline; - -- prev_cont = FT_NEXT_USHORT( p ); -+ prev_cont = FT_NEXT_SHORT( p ); - - if ( n_contours > 0 ) - cont[0] = prev_cont; - -+ if ( prev_cont < 0 ) -+ goto Invalid_Outline; -+ - for ( cont++; cont < cont_limit; cont++ ) - { -- cont[0] = FT_NEXT_USHORT( p ); -+ cont[0] = FT_NEXT_SHORT( p ); - if ( cont[0] <= prev_cont ) - { - /* unordered contours: this is invalid */ diff --git a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-5669.patch b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-5669.patch deleted file mode 100644 index 3e52997..0000000 --- a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-5669.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- freetype-2.3.11/src/bdf/bdflib.c 2013-01-15 09:57:36.000000000 +0100 -+++ freetype-2.3.11/src/bdf/bdflib.c 2013-01-15 10:04:37.000000000 +0100 -@@ -1588,9 +1588,11 @@ - - p->glyph_enc = _bdf_atol( p->list.field[1], 0, 10 ); - -- /* Check that the encoding is in the range [0,65536] because */ -- /* otherwise p->have (a bitmap with static size) overflows. */ -- if ( (size_t)p->glyph_enc >= sizeof ( p->have ) * 8 ) -+ /* Check that the encoding is in the Unicode range because */ -+ /* otherwise p->have (a bitmap with static size) overflows. */ -+ if ( p->glyph_enc > 0 && -+ (size_t)p->glyph_enc >= sizeof ( p->have ) / -+ sizeof ( unsigned long ) * 32 ) - { - error = BDF_Err_Invalid_File_Format; - goto Exit; diff --git a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-array-initialization.patch b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-array-initialization.patch deleted file mode 100644 index 254354b..0000000 --- a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-array-initialization.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- freetype-2.3.11/src/base/ftoutln.c 2009-03-14 14:45:26.000000000 +0100 -+++ freetype-2.3.11/src/base/ftoutln.c 2012-04-03 11:03:35.000000000 +0200 -@@ -990,7 +990,8 @@ - - int i; - FT_Pos ray_y[3]; -- FT_Orientation result[3]; -+ FT_Orientation result[3] = -+ { FT_ORIENTATION_NONE, FT_ORIENTATION_NONE, FT_ORIENTATION_NONE }; - - - if ( !outline || outline->n_points <= 0 ) diff --git a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-axis-name-overflow.patch b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-axis-name-overflow.patch deleted file mode 100644 index 5f32b8a..0000000 --- a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-axis-name-overflow.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- freetype-2.3.11/ft2demos-2.3.11/src/ftmulti.c 2010-07-22 19:11:50.000000000 +0200 -+++ freetype-2.3.11/ft2demos-2.3.11/src/ftmulti.c 2010-07-22 19:12:41.000000000 +0200 -@@ -813,13 +813,13 @@ - - for ( n = 0; n < (int)multimaster->num_axis; n++ ) - { -- char temp[32]; -+ char temp[100]; - - -- sprintf( temp, " %s:%g", -+ sprintf( temp, " %.50s:%g", - multimaster->axis[n].name, -- design_pos[n]/65536. ); -- strcat( Header, temp ); -+ design_pos[n] / 65536.0 ); -+ strncat( Header, temp, sizeof( Header ) - strlen( Header ) - 1 ); - } - } - grWriteCellString( &bit, 0, 16, Header, fore_color ); diff --git a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-bdf-overflow.patch b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-bdf-overflow.patch deleted file mode 100644 index 88e3419..0000000 --- a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-bdf-overflow.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- freetype-2.3.11/src/bdf/bdflib.c 2012-04-02 16:24:56.000000000 +0200 -+++ freetype-2.3.11/src/bdf/bdflib.c 2012-04-02 16:25:33.000000000 +0200 -@@ -1870,7 +1870,7 @@ - glyph->bpr = ( glyph->bbx.width * p->font->bpp + 7 ) >> 3; - - bitmap_size = glyph->bpr * glyph->bbx.height; -- if ( bitmap_size > 0xFFFFU ) -+ if ( glyph->bpr > 0xFFFFU || bitmap_size > 0xFFFFU ) - { - FT_ERROR(( "_bdf_parse_glyphs: " ERRMSG4, lineno )); - error = BDF_Err_Bbx_Too_Big; diff --git a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-more-demos.patch b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-more-demos.patch deleted file mode 100644 index 4b0046e..0000000 --- a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-more-demos.patch +++ /dev/null @@ -1,18 +0,0 @@ -diff -up freetype-2.3.11/ft2demos-2.3.11/Makefile.more-demos freetype-2.3.11/ft2demos-2.3.11/Makefile ---- freetype-2.3.11/ft2demos-2.3.11/Makefile.more-demos 2009-10-22 16:02:26.000000000 -0400 -+++ freetype-2.3.11/ft2demos-2.3.11/Makefile 2009-10-22 16:02:32.000000000 -0400 -@@ -288,10 +288,10 @@ else - # Note that ttdebug only works if the FreeType's `truetype' driver has - # been compiled with TT_CONFIG_OPTION_BYTECODE_INTERPRETER defined. - # -- # EXES += ftchkwd -- # EXES += ftmemchk -- # EXES += ftpatchk -- # EXES += fttimer -+ EXES += ftchkwd -+ EXES += ftmemchk -+ EXES += ftpatchk -+ EXES += fttimer - # EXES += testname - # EXES += ttdebug - diff --git a/contrib/packages/rpm/el5/SOURCES/freetype-multilib.patch b/contrib/packages/rpm/el5/SOURCES/freetype-multilib.patch deleted file mode 100644 index f369adb..0000000 --- a/contrib/packages/rpm/el5/SOURCES/freetype-multilib.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- freetype-2.2.1/builds/unix/freetype-config.in.multilib 2006-07-27 18:50:40.000000000 -0400 -+++ freetype-2.2.1/builds/unix/freetype-config.in 2006-07-27 18:58:13.000000000 -0400 -@@ -9,11 +9,11 @@ - # indicate that you have read the license and understand and accept it - # fully. - --prefix=@prefix@ --exec_prefix=@exec_prefix@ -+prefix=`pkg-config --variable prefix freetype2` -+exec_prefix=`pkg-config --variable exec_prefix freetype2` - exec_prefix_set=no --includedir=@includedir@ --libdir=@libdir@ -+includedir=`pkg-config --variable includedir freetype2` -+libdir=`pkg-config --variable libdir freetype2` - enable_shared=@build_libtool_libs@ - wl=@wl@ - hardcode_libdir_flag_spec='@hardcode_libdir_flag_spec@' diff --git a/contrib/packages/rpm/el5/SOURCES/pthread-stubs.pc.in b/contrib/packages/rpm/el5/SOURCES/pthread-stubs.pc.in deleted file mode 100644 index 1b722e9..0000000 --- a/contrib/packages/rpm/el5/SOURCES/pthread-stubs.pc.in +++ /dev/null @@ -1,8 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ - -Name: pthread stubs -Description: Stubs missing from libc for standard pthread functions -Version: 0.1 -Libs: diff --git a/contrib/packages/rpm/el5/SOURCES/tigervnc-2b76d02.patch b/contrib/packages/rpm/el5/SOURCES/tigervnc-2b76d02.patch deleted file mode 100644 index 8ff0b9f..0000000 --- a/contrib/packages/rpm/el5/SOURCES/tigervnc-2b76d02.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 2b76d028b0253be7c4496840fcd2e0fb47c0794e Mon Sep 17 00:00:00 2001 -From: Pierre Ossman -Date: Mon, 15 Dec 2014 10:52:43 +0100 -Subject: [PATCH] Band aid to work around inluding C headers in C++ code - ---- - unix/xserver/hw/vnc/Makefile.am | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/unix/xserver/hw/vnc/Makefile.am b/unix/xserver/hw/vnc/Makefile.am -index 9885b8a..372a57f 100644 ---- a/unix/xserver/hw/vnc/Makefile.am -+++ b/unix/xserver/hw/vnc/Makefile.am -@@ -7,6 +7,9 @@ NETWORK_LIB=$(LIB_DIR)/network/libnetwork.la - XREGION_LIB=$(LIB_DIR)/Xregion/libXregion.la - COMMON_LIBS=$(NETWORK_LIB) $(RFB_LIB) $(RDR_LIB) $(XREGION_LIB) - -+# Hack to get the C headers to work when included from C++ code -+AM_CXXFLAGS = -fpermissive -+ - noinst_LTLIBRARIES = libvnccommon.la - - HDRS = RegionHelper.h vncExtInit.h vncHooks.h XserverDesktop.h xorg-version.h \ diff --git a/contrib/packages/rpm/el5/SOURCES/tigervnc14-Add-dridir-param.patch b/contrib/packages/rpm/el5/SOURCES/tigervnc14-Add-dridir-param.patch deleted file mode 100644 index 2445f51..0000000 --- a/contrib/packages/rpm/el5/SOURCES/tigervnc14-Add-dridir-param.patch +++ /dev/null @@ -1,103 +0,0 @@ -From 0acffdd6f443198378012405e7f814f5abf278b3 Mon Sep 17 00:00:00 2001 -From: Adam Tkac -Date: Wed, 15 Sep 2010 15:37:01 +0200 -Subject: [PATCH] Add -dridir parameter to specify DRI drivers directory from command line. - -Signed-off-by: Adam Tkac ---- - glx/glxdri.c | 2 -- - glx/glxdri2.c | 2 -- - glx/glxdriswrast.c | 2 -- - glx/glxext.c | 27 +++++++++++++++++++++++++++ - glx/glxserver.h | 3 +++ - os/utils.c | 9 +++++++++ - 6 files changed, 39 insertions(+), 6 deletions(-) - -diff --git a/glx/glxext.c b/glx/glxext.c -index 89e58b0..5e7cf23 100644 ---- a/glx/glxext.c -+++ b/glx/glxext.c -@@ -608,3 +608,30 @@ static int __glXDispatch(ClientPtr client) - - return retval; - } -+ -+char *dri_driver_path = DRI_DRIVER_PATH; -+ -+int GlxProcessArguments(int argc, char *argv[], int i) -+{ -+ if (strncmp(argv[i], "-dridir", 7) == 0) { -+ if (++i < argc) { -+#if !defined(WIN32) && !defined(__CYGWIN__) -+ if (getuid() != geteuid()) { -+ LogMessage(X_WARNING, "-dridir is not available for setuid X servers\n"); -+ return -1; -+ } else -+#endif -+ { -+ if (strlen(argv[i]) < PATH_MAX) { -+ dri_driver_path = argv[i]; -+ return 2; -+ } else { -+ LogMessage(X_ERROR, "-dridir pathname too long\n"); -+ return -1; -+ } -+ } -+ } -+ } -+ -+ return 0; -+} -diff --git a/glx/glxserver.h b/glx/glxserver.h -index 1daf977..082ff82 100644 ---- a/glx/glxserver.h -+++ b/glx/glxserver.h -@@ -251,4 +251,7 @@ extern unsigned glxMinorVersion; - - extern int __glXEventBase; - -+extern char *dri_driver_path; -+extern int GlxProcessArguments(int argc, char *argv[], int i); -+ - #endif /* !__GLX_server_h__ */ -diff --git a/glx/glxdricommon.c b/glx/glxdricommon.c ---- a/glx/glxdricommon.c -+++ b/glx/glxdricommon.c -@@ -209,6 +209,4 @@ - return head.next; - } - --static const char dri_driver_path[] = DRI_DRIVER_PATH; -- - void * - glxProbeDriver(const char *driverName, -diff --git a/os/utils.c b/os/utils.c -index 13d3b3f..ff97c86 100644 ---- a/os/utils.c -+++ b/os/utils.c -@@ -139,6 +139,7 @@ Bool noDPMSExtension = FALSE; - #ifdef GLXEXT - Bool noGlxExtension = FALSE; - Bool noGlxVisualInit = FALSE; -+extern int GlxProcessArguments(int argc, char *argv[], int i); - #endif - #ifdef SCREENSAVER - Bool noScreenSaverExtension = FALSE; -@@ -704,6 +705,14 @@ ProcessCommandLine(int argc, char *argv[]) - else - UseMsg(); - } -+#ifdef GLXEXT -+ else if ((skip = GlxProcessArguments(argc,argv,i)) != 0) { -+ if (skip > 0) -+ i += skip - 1; -+ else -+ UseMsg(); -+ } -+#endif - #ifdef RLIMIT_DATA - else if (strcmp(argv[i], "-ld") == 0) { - if (++i < argc) { --- -1.7.3.2 - diff --git a/contrib/packages/rpm/el5/SOURCES/tigervnc14-Add-xkbcompdir-param.patch b/contrib/packages/rpm/el5/SOURCES/tigervnc14-Add-xkbcompdir-param.patch deleted file mode 100644 index 0d82ba4..0000000 --- a/contrib/packages/rpm/el5/SOURCES/tigervnc14-Add-xkbcompdir-param.patch +++ /dev/null @@ -1,46 +0,0 @@ -From 5e6e99eaef3ca346c78a3e520ed58ec8b8100b41 Mon Sep 17 00:00:00 2001 -From: Adam Tkac -Date: Thu, 2 Sep 2010 17:24:38 +0200 -Subject: [PATCH] Add -xkbcompdir parameter to modify "xkbcomp" path from commandline. - -Signed-off-by: Adam Tkac ---- - xkb/xkbInit.c | 21 +++++++++++++++++++++ - 1 files changed, 21 insertions(+), 0 deletions(-) - -diff --git a/xkb/xkbInit.c b/xkb/xkbInit.c -index fbf8f14..29fb33e 100644 ---- a/xkb/xkbInit.c -+++ b/xkb/xkbInit.c -@@ -742,7 +742,28 @@ XkbProcessArguments(int argc,char *argv[],int i) - } - } - return j; -+ } else if (strncmp(argv[i], "-xkbcompdir", 11)==0) { -+ if (++i < argc) { -+#if !defined(WIN32) && !defined(__CYGWIN__) -+ if (getuid() != geteuid()) { -+ LogMessage(X_WARNING, "-xkbdir is not available for setuid X servers\n"); -+ return -1; -+ } else -+#endif -+ { -+ if (strlen(argv[i]) < PATH_MAX) { -+ XkbBinDirectory = argv[i]; -+ return 2; -+ } else { -+ LogMessage(X_ERROR, "-xkbcompdir pathname too long\n"); -+ return -1; -+ } -+ } -+ } else { -+ return -1; -+ } - } -+ - if ((strcmp(argv[i], "-ardelay") == 0) || (strcmp(argv[i], "-ar1") == 0)) { /* -ardelay int */ - if (++i >= argc) - UseMsg(); --- -1.7.2.3 - diff --git a/contrib/packages/rpm/el5/SOURCES/tigervnc14-static-build-fixes.patch b/contrib/packages/rpm/el5/SOURCES/tigervnc14-static-build-fixes.patch deleted file mode 100644 index dd26ea6..0000000 --- a/contrib/packages/rpm/el5/SOURCES/tigervnc14-static-build-fixes.patch +++ /dev/null @@ -1,35 +0,0 @@ ---- a/cmake/StaticBuild.cmake 2014-12-25 23:28:45.000000000 -0500 -+++ b/cmake/StaticBuild.cmake 2015-01-01 18:18:36.000000000 -0500 -@@ -82,10 +82,10 @@ - if(${CMAKE_SYSTEM_NAME} MATCHES "SunOS") - set(FLTK_LIBRARIES "${FLTK_LIBRARIES} ${X11_Xcursor_LIB} ${X11_Xfixes_LIB} -Wl,-Bstatic -lXft -Wl,-Bdynamic -lfontconfig -lXext -R/usr/sfw/lib") - else() -- set(FLTK_LIBRARIES "${FLTK_LIBRARIES} -Wl,-Bstatic -lXcursor -lXfixes -lXft -lfontconfig -lexpat -lfreetype -lbz2 -lXrender -lXext -lXinerama -Wl,-Bdynamic") -+ set(FLTK_LIBRARIES "${FLTK_LIBRARIES} -Wl,-Bstatic -lXft -lfontconfig -lfreetype -lXcursor -lXfixes -lz -lbz2 -lXrender -lXinerama -lXext -lexpat -Wl,-Bdynamic") - endif() - -- set(FLTK_LIBRARIES "${FLTK_LIBRARIES} -lX11") -+ set(FLTK_LIBRARIES "${FLTK_LIBRARIES} -Wl,-Bdynamic -lX11 -Wl,-Bstatic -lxcb -lXdmcp -lXau -lICE -Wl,-Bdynamic -ldl") - endif() - endif() - -@@ -93,7 +93,7 @@ - # them statically, even libXext. libX11 is somewhat stable, although - # even it has had an ABI change once or twice. - if(X11_FOUND AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "SunOS") -- set(X11_LIBRARIES "-Wl,-Bstatic -lXext -Wl,-Bdynamic -lX11") -+ set(X11_LIBRARIES "-Wl,-Bstatic -lXext -Wl,-Bdynamic -lX11 -Wl,-Bstatic -lxcb -lXdmcp -lXau -lICE -Wl,-Bdynamic -ldl -lpthread") - if(X11_XTest_LIB) - set(X11_XTest_LIB "-Wl,-Bstatic -lXtst -Wl,-Bdynamic") - endif() ---- a/vncviewer/CMakeLists.txt 2014-11-04 21:38:36.000000000 -0500 -+++ b/vncviewer/CMakeLists.txt 2015-01-01 18:15:32.000000000 -0500 -@@ -46,7 +46,7 @@ - add_executable(vncviewer ${VNCVIEWER_SOURCES}) - endif() - --target_link_libraries(vncviewer rfb network rdr os Xregion ${FLTK_LIBRARIES} ${GETTEXT_LIBRARIES}) -+target_link_libraries(vncviewer ${FLTK_LIBRARIES} rfb network rdr os Xregion ${GETTEXT_LIBRARIES}) - - if(APPLE) - target_link_libraries(vncviewer "-framework Cocoa" "-framework Carbon") diff --git a/contrib/packages/rpm/el5/SOURCES/vncserver.service b/contrib/packages/rpm/el5/SOURCES/vncserver.service deleted file mode 100644 index fb4c0de..0000000 --- a/contrib/packages/rpm/el5/SOURCES/vncserver.service +++ /dev/null @@ -1,91 +0,0 @@ -#!/bin/bash -# -# Init file for TigerVNC Server -# -# Written by Dag Wieers -# -# chkconfig: - 91 35 -# description: TigerVNC remote X administration daemon. -# -# processname: Xvnc - -source /etc/rc.d/init.d/functions -source /etc/sysconfig/network - -# Check that networking is up. -[ ${NETWORKING} = "no" ] && exit 1 - -[ -x /usr/bin/Xvnc ] || exit 1 - -### Default variables -SYSCONFIG="/etc/sysconfig/vncservers" -VNCSERVERS="" - -### Read configuration -[ -r "$SYSCONFIG" ] && source "$SYSCONFIG" - -RETVAL=0 -prog="Xvnc" -desc="TigerVNC remote administration daemon" - -start() { - echo -n $"Starting $desc ($prog):" - ulimit -S -c 0 &>/dev/null - for display in ${VNCSERVERS}; do - echo -n "${display} " - unset BASH_ENV ENV - initlog $INITLOG_ARGS -c \ - "su ${display##*:} -c \"cd ~${display##*:} && [ -f .vnc/passwd ] && vncserver :${display%:*} ${VNCSERVERARGS[${display%:*}]}\"" - RETVAL=$? - [ "$RETVAL" -ne 0 ] && break - done - [ "$RETVAL" -eq 0 ] && success $"vncserver startup" || failure $"vncserver start" - echo - [ "$RETVAL" -eq 0 ] && touch /var/lock/subsys/$prog - return $RETVAL -} - -stop() { - echo -n $"Shutting down $desc ($prog): " - for display in ${VNCSERVERS}; do - echo -n "${display} " - unset BASH_ENV ENV - initlog $INITLOG_ARGS -c \ - "su ${display##*:} -c \"vncserver -kill :${display%:*}\" &>/dev/null" - done - RETVAL=$? - [ "$RETVAL" -eq 0 ] && success $"vncserver shutdown" || failure $"vncserver shutdown" - echo - [ "$RETVAL" -eq 0 ] && rm -f /var/lock/subsys/$prog - return $RETVAL -} - -restart() { - stop - start -} - -case "$1" in - start) - start - ;; - stop) - stop - ;; - restart|reload) - restart - ;; - condrestart) - [ -e /var/lock/subsys/$prog ] && restart - RETVAL=$? - ;; - status) - status $prog - RETVAL=$? - ;; - *) - echo $"Usage: $0 {start|stop|restart|condrestart|status}" - RETVAL=1 -esac - -exit $RETVAL diff --git a/contrib/packages/rpm/el5/SOURCES/vncserver.sysconfig b/contrib/packages/rpm/el5/SOURCES/vncserver.sysconfig deleted file mode 100644 index 5940a1e..0000000 --- a/contrib/packages/rpm/el5/SOURCES/vncserver.sysconfig +++ /dev/null @@ -1,19 +0,0 @@ -# The VNCSERVERS variable is a list of display:user pairs. -# -# Uncomment the lines below to start a VNC server on display :2 -# as my 'myusername' (adjust this to your own). You will also -# need to set a VNC password; run 'man vncpasswd' to see how -# to do that. -# -# DO NOT RUN THIS SERVICE if your local area network is -# untrusted! For a secure way of using VNC, see this URL: -# http://kbase.redhat.com/faq/docs/DOC-7028 - -# Use "-nolisten tcp" to prevent X connections to your VNC server via TCP. - -# Use "-localhost" to prevent remote VNC clients connecting except when -# doing so through a secure tunnel. See the "-via" option in the -# `man vncviewer' manual page. - -# VNCSERVERS="2:myusername" -# VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -localhost" diff --git a/contrib/packages/rpm/el5/SPECS/tigervnc.spec b/contrib/packages/rpm/el5/SPECS/tigervnc.spec deleted file mode 100644 index 12d3d33..0000000 --- a/contrib/packages/rpm/el5/SPECS/tigervnc.spec +++ /dev/null @@ -1,1427 +0,0 @@ -%define _default_patch_fuzz 2 -%define tigervnc_src_dir %{_builddir}/%{name}-%{version}%{?snap:-%{snap}} -%{!?_self_signed: %define _self_signed 1} -%{!?_bootstrap: %define _bootstrap 1} -#%global scl_name %{name}$(echo %version | sed -e 's/\\.//;s/\\..*//') -%define scl_name %{name}16 -%if %{_bootstrap} -%define xorg_buildroot $RPM_BUILD_ROOT/opt/%{name}/%{scl_name} -%else -%define xorg_buildroot /opt/%{name}/%{scl_name} -%endif - -Name: tigervnc -Version: @VERSION@ -Release: 3%{?snap:.%{snap}}%{?dist} -Summary: A TigerVNC remote display system - -Group: User Interface/Desktops -License: GPLv2+ -Packager: Brian P. Hinz -URL: http://www.tigervnc.com - -Source0: %{name}-%{version}%{?snap:-%{snap}}.tar.bz2 -Source1: vncserver.service -Source2: vncserver.sysconfig -Source9: FindX11.cmake -Source11: http://fltk.org/pub/fltk/1.3.3/fltk-1.3.3-source.tar.gz -Source12: http://downloads.sourceforge.net/project/libjpeg-turbo/1.4.2/libjpeg-turbo-1.4.2.tar.gz -Source13: http://downloads.sourceforge.net/project/libpng/libpng15/1.5.24/libpng-1.5.24.tar.bz2 -Source14: https://ftp.gnu.org/gnu/gmp/gmp-6.0.0a.tar.bz2 -Source15: http://ftp.gnu.org/gnu/libtasn1/libtasn1-4.7.tar.gz -Source16: https://ftp.gnu.org/gnu/nettle/nettle-2.7.1.tar.gz -Source17: ftp://ftp.gnutls.org/gcrypt/gnutls/v3.3/gnutls-3.3.19.tar.xz - -Source100: http://www.x.org/releases/X11R7.7/src/everything/bigreqsproto-1.1.2.tar.bz2 -Source101: http://www.x.org/releases/X11R7.7/src/everything/compositeproto-0.4.2.tar.bz2 -Source102: http://www.x.org/releases/X11R7.7/src/everything/damageproto-1.2.1.tar.bz2 -Source103: http://www.x.org/releases/X11R7.7/src/everything/dmxproto-2.3.1.tar.bz2 -Source104: http://www.x.org/releases/X11R7.7/src/everything/dri2proto-2.6.tar.bz2 -Source105: http://www.x.org/releases/X11R7.7/src/everything/fixesproto-5.0.tar.bz2 -Source106: http://www.x.org/releases/X11R7.7/src/everything/font-util-1.3.0.tar.bz2 -Source107: http://www.x.org/releases/X11R7.7/src/everything/fontsproto-2.1.2.tar.bz2 -Source108: http://www.x.org/releases/X11R7.7/src/everything/glproto-1.4.15.tar.bz2 -Source109: http://www.x.org/releases/X11R7.7/src/everything/inputproto-2.2.tar.bz2 -Source110: http://www.x.org/releases/X11R7.7/src/everything/kbproto-1.0.6.tar.bz2 -Source111: http://www.x.org/releases/X11R7.7/src/everything/libICE-1.0.8.tar.bz2 -Source112: http://www.x.org/releases/X11R7.7/src/everything/libSM-1.2.1.tar.bz2 -Source113: http://www.x.org/releases/X11R7.7/src/everything/libX11-1.5.0.tar.bz2 -Source114: http://www.x.org/releases/X11R7.7/src/everything/libXScrnSaver-1.2.2.tar.bz2 -Source115: http://www.x.org/releases/X11R7.7/src/everything/libXau-1.0.7.tar.bz2 -Source116: http://www.x.org/releases/X11R7.7/src/everything/libXaw-1.0.11.tar.bz2 -Source117: http://www.x.org/releases/X11R7.7/src/everything/libXcomposite-0.4.3.tar.bz2 -Source118: http://www.x.org/releases/X11R7.7/src/everything/libXcursor-1.1.13.tar.bz2 -Source119: http://www.x.org/releases/X11R7.7/src/everything/libXdamage-1.1.3.tar.bz2 -Source120: http://www.x.org/releases/X11R7.7/src/everything/libXdmcp-1.1.1.tar.bz2 -Source121: http://www.x.org/releases/X11R7.7/src/everything/libXext-1.3.1.tar.bz2 -Source122: http://www.x.org/releases/X11R7.7/src/everything/libXfixes-5.0.tar.bz2 -Source123: http://www.x.org/releases/X11R7.7/src/everything/libXfont-1.4.5.tar.bz2 -Source124: http://www.x.org/releases/X11R7.7/src/everything/libXft-2.3.1.tar.bz2 -Source125: http://www.x.org/releases/X11R7.7/src/everything/libXi-1.6.1.tar.bz2 -Source126: http://www.x.org/releases/X11R7.7/src/everything/libXinerama-1.1.2.tar.bz2 -Source127: http://www.x.org/releases/X11R7.7/src/everything/libXmu-1.1.1.tar.bz2 -Source128: http://www.x.org/releases/X11R7.7/src/everything/libXpm-3.5.10.tar.bz2 -Source129: http://www.x.org/releases/X11R7.7/src/everything/libXrandr-1.3.2.tar.bz2 -Source130: http://www.x.org/releases/X11R7.7/src/everything/libXrender-0.9.7.tar.bz2 -Source131: http://www.x.org/releases/X11R7.7/src/everything/libXres-1.0.6.tar.bz2 -Source132: http://www.x.org/releases/X11R7.7/src/everything/libXt-1.1.3.tar.bz2 -Source133: http://www.x.org/releases/X11R7.7/src/everything/libXtst-1.2.1.tar.bz2 -Source134: http://www.x.org/releases/X11R7.7/src/everything/libXv-1.0.7.tar.bz2 -Source135: http://www.x.org/releases/X11R7.7/src/everything/libXvMC-1.0.7.tar.bz2 -Source136: http://www.x.org/releases/X11R7.7/src/everything/libXxf86dga-1.1.3.tar.bz2 -Source137: http://www.x.org/releases/X11R7.7/src/everything/libXxf86vm-1.1.2.tar.bz2 -Source138: http://www.x.org/releases/X11R7.7/src/everything/libfontenc-1.1.1.tar.bz2 -Source139: http://www.x.org/releases/X11R7.7/src/everything/libpciaccess-0.13.1.tar.bz2 -#Source140: http://www.x.org/releases/X11R7.7/src/everything/libpthread-stubs-0.3.tar.bz2 -# libpthread-stubs fails to compile, so we use the same method -# as the el6 libxcb rpm. pthread-stubs.pc.in taken from el6 libxcb rpm -Source140: pthread-stubs.pc.in -Source141: http://www.x.org/releases/X11R7.7/src/everything/libxcb-1.8.1.tar.bz2 -Source142: http://www.x.org/releases/X11R7.7/src/everything/libxkbfile-1.0.8.tar.bz2 -Source143: http://www.x.org/releases/X11R7.7/src/everything/makedepend-1.0.4.tar.bz2 -Source144: http://www.x.org/releases/X11R7.7/src/everything/randrproto-1.3.2.tar.bz2 -Source145: http://www.x.org/releases/X11R7.7/src/everything/recordproto-1.14.2.tar.bz2 -Source146: http://www.x.org/releases/X11R7.7/src/everything/renderproto-0.11.1.tar.bz2 -Source147: http://www.x.org/releases/X11R7.7/src/everything/resourceproto-1.2.0.tar.bz2 -Source148: http://www.x.org/releases/X11R7.7/src/everything/scrnsaverproto-1.2.2.tar.bz2 -Source149: http://www.x.org/releases/X11R7.7/src/everything/util-macros-1.17.tar.bz2 -Source150: http://www.x.org/releases/X11R7.7/src/everything/videoproto-2.3.1.tar.bz2 -Source151: http://www.x.org/releases/X11R7.7/src/everything/xcb-proto-1.7.1.tar.bz2 -Source152: http://www.x.org/releases/X11R7.7/src/everything/xcmiscproto-1.2.2.tar.bz2 -Source153: http://www.x.org/releases/X11R7.7/src/everything/xextproto-7.2.1.tar.bz2 -Source154: http://www.x.org/releases/X11R7.7/src/everything/xf86bigfontproto-1.2.0.tar.bz2 -Source155: http://www.x.org/releases/X11R7.7/src/everything/xf86dgaproto-2.1.tar.bz2 -Source156: http://www.x.org/releases/X11R7.7/src/everything/xf86driproto-2.1.1.tar.bz2 -Source157: http://www.x.org/releases/X11R7.7/src/everything/xf86vidmodeproto-2.3.1.tar.bz2 -Source158: http://www.x.org/releases/X11R7.7/src/everything/xineramaproto-1.2.1.tar.bz2 -Source159: http://www.x.org/releases/X11R7.7/src/everything/xorg-server-1.12.2.tar.bz2 -Source160: http://www.x.org/releases/X11R7.7/src/everything/xproto-7.0.23.tar.bz2 -Source161: http://www.x.org/releases/X11R7.7/src/everything/xrandr-1.3.5.tar.bz2 -Source162: http://www.x.org/releases/X11R7.7/src/everything/xtrans-1.2.7.tar.bz2 - -Source200: http://fontconfig.org/release/fontconfig-2.8.0.tar.gz -Source201: http://download.savannah.gnu.org/releases/freetype/freetype-old/freetype-2.3.11.tar.bz2 -Source202: http://xorg.freedesktop.org/archive/individual/lib/pixman-0.32.4.tar.bz2 -Source203: http://dri.freedesktop.org/libdrm/libdrm-2.4.52.tar.bz2 -Source204: ftp://ftp.freedesktop.org/pub/mesa/older-versions/9.x/9.2.5/MesaLib-9.2.5.tar.bz2 -# NOTE: -# libgcrypt from el5 is not new enough to satisfy newer Xorg requirements for --with-sha1, -# which causes Xorg to link against libssl.so and introduce about 10 dynamic dependencies. -# to prevent this, build a static libsha1 and link against that. -# NOTE: -Source205: https://github.com/dottedmag/libsha1/archive/0.3.tar.gz - -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) - -# xorg requires newer versions of automake, & autoconf than are available with el5. Use el6 versions. -BuildRequires: automake >= 1.11, autoconf >= 2.60, libtool >= 1.4, gettext >= 0.14.4, gettext-devel >= 0.14.4, bison-devel, python26 -BuildRequires: java-devel, jpackage-utils -BuildRequires: pam-devel -BuildRequires: cmake28 -BuildRequires: pkgconfig >= 0.20 -BuildRequires: gcc44, gcc44-c++ -BuildRequires: glibc-devel, libstdc++-devel, libpng-devel -BuildRequires: expat-devel -BuildRequires: git, gperf, intltool, libtalloc-devel -BuildRequires: kernel-headers, libatomic_ops-devel -BuildRequires: xz -%if !%{_bootstrap} -BuildRequires: %{name}-static-devel == %{version} -BuildRequires: nasm >= 2.01 -%endif - -Requires(post): initscripts chkconfig coreutils -Requires(postun):coreutils -Requires: hicolor-icon-theme -Requires: tigervnc-license - -Provides: vnc = 4.1.3-2, vnc-libs = 4.1.3-2 -Obsoletes: vnc < 4.1.3-2, vnc-libs < 4.1.3-2 -Provides: tightvnc = 1.5.0-0.15.20090204svn3586 -Obsoletes: tightvnc < 1.5.0-0.15.20090204svn3586 - -# tigervnc patches -Patch12: tigervnc14-static-build-fixes.patch -Patch13: tigervnc14-Add-dridir-param.patch -Patch14: tigervnc14-Add-xkbcompdir-param.patch - -# fltk patches -Patch15: fltk-1.3.3-static-libs.patch - -# freetype patches -Patch20: freetype-2.1.10-enable-ft2-bci.patch -Patch21: freetype-2.3.0-enable-spr.patch - -# Enable otvalid and gxvalid modules -Patch46: freetype-2.2.1-enable-valid.patch - -# Fix multilib conflicts -Patch88: freetype-multilib.patch - -Patch89: freetype-2.3.11-CVE-2010-2498.patch -Patch90: freetype-2.3.11-CVE-2010-2499.patch -Patch91: freetype-2.3.11-CVE-2010-2500.patch -Patch92: freetype-2.3.11-CVE-2010-2519.patch -Patch93: freetype-2.3.11-CVE-2010-2520.patch -Patch96: freetype-2.3.11-CVE-2010-1797.patch -Patch97: freetype-2.3.11-CVE-2010-2805.patch -Patch98: freetype-2.3.11-CVE-2010-2806.patch -Patch99: freetype-2.3.11-CVE-2010-2808.patch -Patch100: freetype-2.3.11-CVE-2010-3311.patch -Patch101: freetype-2.3.11-CVE-2010-3855.patch -Patch102: freetype-2.3.11-CVE-2011-0226.patch -Patch103: freetype-2.3.11-CVE-2011-3256.patch -Patch104: freetype-2.3.11-CVE-2011-3439.patch -Patch105: freetype-2.3.11-CVE-2012-1126.patch -Patch106: freetype-2.3.11-CVE-2012-1127.patch -Patch107: freetype-2.3.11-CVE-2012-1130.patch -Patch108: freetype-2.3.11-CVE-2012-1131.patch -Patch109: freetype-2.3.11-CVE-2012-1132.patch -Patch110: freetype-2.3.11-CVE-2012-1134.patch -Patch111: freetype-2.3.11-CVE-2012-1136.patch -Patch112: freetype-2.3.11-CVE-2012-1137.patch -Patch113: freetype-2.3.11-CVE-2012-1139.patch -Patch114: freetype-2.3.11-CVE-2012-1140.patch -Patch115: freetype-2.3.11-CVE-2012-1141.patch -Patch116: freetype-2.3.11-CVE-2012-1142.patch -Patch117: freetype-2.3.11-CVE-2012-1143.patch -Patch118: freetype-2.3.11-CVE-2012-1144.patch -Patch119: freetype-2.3.11-bdf-overflow.patch -Patch120: freetype-2.3.11-array-initialization.patch -Patch121: freetype-2.3.11-CVE-2012-5669.patch - -# Patches for Xorg CVE-2014-12-09 taken from Debian: -# https://release.debian.org/proposed-updates/stable_diffs/xorg-server_1.12.4-6+deb7u5.debdiff -Patch10000: 16_CVE-2014-mult.diff -Patch10001: 17_CVE-regressions.diff -# http://www.x.org/wiki/Development/Security/Advisory-2015-02-10/ -Patch10002: CVE-2015-0255.diff -# http://www.x.org/wiki/Development/Security/Advisory-2015-03-17/ -Patch10003: CVE-2015-1802.diff -Patch10004: CVE-2015-1803.diff -Patch10005: CVE-2015-1804.diff -# http://lists.x.org/archives/xorg-announce/2015-April/002561.html -Patch10006: CVE-2013-7439.diff - -%description -Virtual Network Computing (VNC) is a remote display system which -allows you to view a computing 'desktop' environment not only on the -machine where it is running, but from anywhere on the Internet and -from a wide variety of machine architectures. This package contains a -client which will allow you to connect to other desktops running a VNC -server. - -%package server -Summary: A TigerVNC server -Group: User Interface/X -Provides: vnc-server = 4.1.3-2, vnc-libs = 4.1.3-2 -Obsoletes: vnc-server < 4.1.3-2, vnc-libs < 4.1.3-2 -Provides: tightvnc-server = 1.5.0-0.15.20090204svn3586 -Obsoletes: tightvnc-server < 1.5.0-0.15.20090204svn3586 -Requires: perl -Requires: tigervnc-server-minimal -Requires: xorg-x11-xauth - -%description server -The VNC system allows you to access the same desktop from a wide -variety of platforms. This package includes set of utilities -which make usage of TigerVNC server more user friendly. It also -contains x0vncserver program which can export your active -X session. - -%package server-minimal -Summary: A minimal installation of TigerVNC server -Group: User Interface/X -Requires(post): chkconfig -Requires(preun):chkconfig -Requires(preun):initscripts -Requires(postun):initscripts - -Requires: xkeyboard-config, xorg-x11-xkb-utils -Requires: keyutils-libs-devel -Requires: tigervnc-license - -%description server-minimal -The VNC system allows you to access the same desktop from a wide -variety of platforms. This package contains minimal installation -of TigerVNC server, allowing others to access the desktop on your -machine. - -%package server-applet -Summary: Java TigerVNC viewer applet for TigerVNC server -Group: User Interface/X -Requires: tigervnc-server, java, jpackage-utils -%if 0%{?fedora} >= 10 || 0%{?rhel} >= 6 || 0%{?centos} >= 6 -BuildArch: noarch -%endif - -%description server-applet -The Java TigerVNC viewer applet for web browsers. Install this package to allow -clients to use web browser when connect to the TigerVNC server. - -%package license -Summary: License of TigerVNC suite -Group: User Interface/X -%if 0%{?fedora} >= 10 || 0%{?rhel} >= 6 || 0%{?centos} >= 6 -BuildArch: noarch -%endif - -%description license -This package contains license of the TigerVNC suite - -%package icons -Summary: Icons for TigerVNC viewer -Group: User Interface/X -%if 0%{?fedora} >= 10 || 0%{?rhel} >= 6 || 0%{?centos} >= 6 -BuildArch: noarch -%endif - -%description icons -This package contains icons for TigerVNC viewer - -%if %{_bootstrap} -%package static-devel -Summary: Static development files necessary to build TigerVNC -Group: Development/Libraries - -%description static-devel -This package contains static development files necessary to build TigerVNC -%endif - -%prep -rm -rf $RPM_BUILD_ROOT -rm -rf %{_builddir}/%{name}-%{version}%{?snap:-%{snap}} -%setup -q -n %{name}-%{version}%{?snap:-%{snap}} - -# Search paths for X11 are hard coded into FindX11.cmake -cp %SOURCE9 cmake/Modules/ -sed -i -e "s#@_includedir@#%{xorg_buildroot}%{_includedir}#" cmake/Modules/FindX11.cmake -sed -i -e "s#@_libdir@#%{xorg_buildroot}%{_libdir}#" cmake/Modules/FindX11.cmake -%patch12 -p1 -b .static-build-fixes - -%if %{_bootstrap} -tar xzf %SOURCE11 -pushd fltk-* -%patch15 -p1 -b .static-libs -popd - -tar xzf %SOURCE12 -tar xjf %SOURCE13 -tar xjf %SOURCE14 -tar xzf %SOURCE15 -tar xzf %SOURCE16 -xzcat %SOURCE17 | tar xf - -%endif - -mkdir xorg -pushd xorg -%if %{_bootstrap} -tar xjf %SOURCE100 -tar xjf %SOURCE101 -tar xjf %SOURCE102 -tar xjf %SOURCE103 -tar xjf %SOURCE104 -tar xjf %SOURCE105 -tar xjf %SOURCE106 -tar xjf %SOURCE107 -tar xjf %SOURCE108 -tar xjf %SOURCE109 -tar xjf %SOURCE110 -tar xjf %SOURCE111 -tar xjf %SOURCE112 -tar xjf %SOURCE113 -pushd libX11-* -%patch10006 -p1 -b .CVE-2013-7439 -popd -tar xjf %SOURCE114 -tar xjf %SOURCE115 -tar xjf %SOURCE116 -tar xjf %SOURCE117 -tar xjf %SOURCE118 -tar xjf %SOURCE119 -tar xjf %SOURCE120 -tar xjf %SOURCE121 -tar xjf %SOURCE122 -tar xjf %SOURCE123 -pushd libXfont-* -%patch10003 -p1 -b .CVE-2015-1802 -%patch10004 -p1 -b .CVE-2015-1803 -%patch10005 -p1 -b .CVE-2015-1804 -popd -tar xjf %SOURCE124 -tar xjf %SOURCE125 -tar xjf %SOURCE126 -tar xjf %SOURCE127 -tar xjf %SOURCE128 -tar xjf %SOURCE129 -tar xjf %SOURCE130 -tar xjf %SOURCE131 -tar xjf %SOURCE132 -tar xjf %SOURCE133 -tar xjf %SOURCE134 -tar xjf %SOURCE135 -tar xjf %SOURCE136 -tar xjf %SOURCE137 -tar xjf %SOURCE138 -tar xjf %SOURCE139 - -tar xjf %SOURCE141 -tar xjf %SOURCE142 -tar xjf %SOURCE143 -tar xjf %SOURCE144 -tar xjf %SOURCE145 -tar xjf %SOURCE146 -tar xjf %SOURCE147 -tar xjf %SOURCE148 -tar xjf %SOURCE149 -tar xjf %SOURCE150 -tar xjf %SOURCE151 -tar xjf %SOURCE152 -tar xjf %SOURCE153 -tar xjf %SOURCE154 -tar xjf %SOURCE155 -tar xjf %SOURCE156 -tar xjf %SOURCE157 -tar xjf %SOURCE158 -%endif -tar xjf %SOURCE159 -%if %{_bootstrap} -tar xjf %SOURCE160 -tar xjf %SOURCE161 -tar xjf %SOURCE162 -tar xzf %SOURCE200 -tar xjf %SOURCE201 -pushd freetype-* -%patch46 -p1 -b .enable-valid -%patch88 -p1 -b .multilib -%patch89 -p1 -b .CVE-2010-2498 -%patch90 -p1 -b .CVE-2010-2499 -%patch91 -p1 -b .CVE-2010-2500 -%patch92 -p1 -b .CVE-2010-2519 -%patch93 -p1 -b .CVE-2010-2520 -%patch96 -p1 -b .CVE-2010-1797 -%patch97 -p1 -b .CVE-2010-2805 -%patch98 -p1 -b .CVE-2010-2806 -%patch99 -p1 -b .CVE-2010-2808 -%patch100 -p1 -b .CVE-2010-3311 -%patch101 -p1 -b .CVE-2010-3855 -%patch102 -p1 -b .CVE-2011-0226 -%patch103 -p1 -b .CVE-2011-3256 -%patch104 -p1 -b .CVE-2011-3439 -%patch105 -p1 -b .CVE-2012-1126 -%patch106 -p1 -b .CVE-2012-1127 -%patch107 -p1 -b .CVE-2012-1130 -%patch108 -p1 -b .CVE-2012-1131 -%patch109 -p1 -b .CVE-2012-1132 -%patch110 -p1 -b .CVE-2012-1134 -%patch111 -p1 -b .CVE-2012-1136 -%patch112 -p1 -b .CVE-2012-1137 -%patch113 -p1 -b .CVE-2012-1139 -%patch114 -p1 -b .CVE-2012-1140 -%patch115 -p1 -b .CVE-2012-1141 -%patch116 -p1 -b .CVE-2012-1142 -%patch117 -p1 -b .CVE-2012-1143 -%patch118 -p1 -b .CVE-2012-1144 -%patch119 -p1 -b .bdf-overflow -%patch120 -p1 -b .array-initialization -%patch121 -p1 -b .CVE-2012-5669 -popd -tar xjf %SOURCE202 -tar xjf %SOURCE203 -tar xjf %SOURCE204 -%endif -pushd xorg-server-1* -%patch10000 -p1 -b .CVE-2014-mult -%patch10001 -p1 -b .CVE-regressions -%patch10002 -p1 -b .CVE-2015-0255 -for f in `find . -type f -perm -000`; do - chmod +r "$f" -done -popd -%if %{_bootstrap} -tar xzf %SOURCE205 -%endif -popd - -cp -a xorg/xorg-server-1*/* unix/xserver - -pushd unix/xserver -for all in `find . -type f -perm -001`; do - chmod -x "$all" -done -patch -p1 < %{_builddir}/%{name}-%{version}%{?snap:-%{snap}}/unix/xserver112.patch -%patch13 -p1 -b .dridir -%patch14 -p1 -b .xkbcompdir - -popd - -%build -export CC=gcc44 -export CXX=g++44 -export CFLAGS="-g $RPM_OPT_FLAGS -fPIC" -export CXXFLAGS="$CFLAGS -static-libgcc" -export PYTHON=python26 - -%if %{_bootstrap} -mkdir -p %{xorg_buildroot}%{_libdir} -pushd %{xorg_buildroot}%{_libdir} -ln -s `g++44 -print-file-name=libz.a` . -ln -s `g++44 -print-file-name=libgcc.a` . -ln -s `g++44 -print-file-name=libexpat.a` . -ln -s `g++44 -print-file-name=libcrypto.a` . -popd - -echo "*** Building libjpeg-turbo ***" -pushd libjpeg-turbo-* -LDFLAGS="$LDFLAGS -static" PKG_CONFIG="pkg-config --static" ./configure --host=%{_host} --build=%{_build} --prefix=%{_prefix} --libdir=%{_libdir} --disable-nls --enable-static --disable-shared -make %{?_smp_mflags} DESTDIR=%{xorg_buildroot} install -popd - -echo "*** Building Xorg ***" -pushd xorg - -echo "*** Building libsha1 ***" -pushd libsha1-* -autoreconf -fiv -LDFLAGS="$LDFLAGS -static" PKG_CONFIG="pkg-config --static" ./configure --host=%{_host} --build=%{_build} --prefix=%{_prefix} --libdir=%{_libdir} --disable-nls --enable-static --disable-shared -make %{?_smp_mflags} DESTDIR=%{xorg_buildroot} install -find %{xorg_buildroot}%{_prefix} -type f -name "*.la" -delete -find %{xorg_buildroot}%{_prefix} -type f -name "*.pc" -exec sed -i -e "s|libdir=%{_libdir}|libdir=%{xorg_buildroot}%{_libdir}|" {} \; -find %{xorg_buildroot}%{_prefix} -type f -name "*.pc" -exec sed -i -e "s|prefix=%{_prefix}|prefix=%{xorg_buildroot}%{_prefix}|" {} \; -popd -popd -%endif - -export CFLAGS="$RPM_OPT_FLAGS -fPIC -I%{xorg_buildroot}%{_includedir}" -export CXXFLAGS="$RPM_OPT_FLAGS -fPIC -I%{xorg_buildroot}%{_includedir} -static-libgcc" -export CPPFLAGS=$CXXFLAGS -export LDFLAGS="-L%{xorg_buildroot}%{_libdir} -L%{xorg_buildroot}%{_libdir}/tigervnc $LDFLAGS" -export ACLOCAL="aclocal -I %{xorg_buildroot}%{_datadir}/aclocal" -export PKG_CONFIG_PATH="%{xorg_buildroot}%{_libdir}/pkgconfig:%{xorg_buildroot}%{_libdir}/tigervnc/pkgconfig:%{xorg_buildroot}%{_datadir}/pkgconfig:%{_libdir}/pkgconfig:%{_datadir}/pkgconfig" - -%if %{_bootstrap} -echo "*** Building gmp ***" -pushd gmp-* -%ifarch x86_64 s390x ia64 ppc64 alpha sparc64 -LDFLAGS="$LDFLAGS -static" PKG_CONFIG="pkg-config --static" ABI=64 ./configure --host=%{_host} --build=%{_build} --prefix=%{_prefix} --libdir=%{_libdir} --enable-static --disable-shared --enable-cxx -%else -LDFLAGS="$LDFLAGS -static" PKG_CONFIG="pkg-config --static" ABI=32 ./configure --host=%{_host} --build=%{_build} --prefix=%{_prefix} --libdir=%{_libdir} --enable-static --disable-shared --enable-cxx -%endif -make %{?_smp_mflags} DESTDIR=%{xorg_buildroot} install -find %{xorg_buildroot}%{_prefix} -type f -name "*.la" -delete -find %{xorg_buildroot}%{_prefix} -type f -name "*.pc" -exec sed -i -e "s|libdir=%{_libdir}|libdir=%{xorg_buildroot}%{_libdir}|" {} \; -find %{xorg_buildroot}%{_prefix} -type f -name "*.pc" -exec sed -i -e "s|prefix=%{_prefix}|prefix=%{xorg_buildroot}%{_prefix}|" {} \; -popd - -echo "*** Building libtasn1 ***" -pushd libtasn1-* -LDFLAGS="$LDFLAGS -static" PKG_CONFIG="pkg-config --static" ./configure --host=%{_host} --build=%{_build} --prefix=%{_prefix} --libdir=%{_libdir} --enable-static --disable-shared -make %{?_smp_mflags} DESTDIR=%{xorg_buildroot} install -find %{xorg_buildroot}%{_prefix} -type f -name "*.la" -delete -find %{xorg_buildroot}%{_prefix} -type f -name "*.pc" -exec sed -i -e "s|libdir=%{_libdir}|libdir=%{xorg_buildroot}%{_libdir}|" {} \; -find %{xorg_buildroot}%{_prefix} -type f -name "*.pc" -exec sed -i -e "s|prefix=%{_prefix}|prefix=%{xorg_buildroot}%{_prefix}|" {} \; -popd - -echo "*** Building nettle ***" -pushd nettle-* -autoreconf -fiv -LDFLAGS="$LDFLAGS -static" PKG_CONFIG="pkg-config --static" ./configure --host=%{_host} --build=%{_build} --prefix=%{_prefix} --libdir=%{_libdir} --enable-static --disable-shared --disable-openssl -make %{?_smp_mflags} DESTDIR=%{xorg_buildroot} install -find %{xorg_buildroot}%{_prefix} -type f -name "*.la" -delete -find %{xorg_buildroot}%{_prefix} -type f -name "*.pc" -exec sed -i -e "s|libdir=%{_libdir}|libdir=%{xorg_buildroot}%{_libdir}|" {} \; -find %{xorg_buildroot}%{_prefix} -type f -name "*.pc" -exec sed -i -e "s|prefix=%{_prefix}|prefix=%{xorg_buildroot}%{_prefix}|" {} \; -popd - -echo "*** Building gnutls ***" -pushd gnutls-* -LDFLAGS="-L%{xorg_buildroot}%{_libdir} -lgmp $LDFLAGS -static" PKG_CONFIG="pkg-config --static" ./configure \ - --host=%{_host} \ - --build=%{_build} \ - --prefix=%{_prefix} \ - --libdir=%{_libdir} \ - --enable-static \ - --disable-shared \ - --without-p11-kit \ - --disable-guile \ - --disable-srp-authentication \ - --disable-libdane \ - --disable-doc \ - --enable-local-libopts \ - --without-tpm \ - --disable-dependency-tracking \ - --disable-silent-rules \ - --disable-heartbeat-support -make %{?_smp_mflags} DESTDIR=%{xorg_buildroot} install -find %{xorg_buildroot}%{_prefix} -type f -name "*.la" -delete -find %{xorg_buildroot}%{_prefix} -type f -name "*.pc" -exec sed -i -e "s|libdir=%{_libdir}|libdir=%{xorg_buildroot}%{_libdir}|" {} \; -find %{xorg_buildroot}%{_prefix} -type f -name "*.pc" -exec sed -i -e "s|prefix=%{_prefix}|prefix=%{xorg_buildroot}%{_prefix}|" {} \; -popd - -pushd xorg - -echo "*** Building freetype ***" -pushd freetype-* -LDFLAGS="$LDFLAGS -static" PKG_CONFIG="pkg-config --static" CFLAGS="$CFLAGS -fno-strict-aliasing" ./configure --host=%{_host} --build=%{_build} --prefix=%{_prefix} --libdir=%{_libdir} --enable-static --disable-shared -sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' builds/unix/libtool -sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' builds/unix/libtool -make DESTDIR=%{xorg_buildroot} install -# FIXME: fontconfig bails out if we delete the libtool archives -find %{xorg_buildroot}%{_prefix} -type f -name "*.la" -exec sed -i -e "s|libdir='%{_libdir}'|libdir='%{xorg_buildroot}%{_libdir}'|" {} \; -find %{xorg_buildroot}%{_prefix} -type f -name "*.pc" -exec sed -i -e "s|libdir=%{_libdir}|libdir=%{xorg_buildroot}%{_libdir}|" {} \; -find %{xorg_buildroot}%{_prefix} -type f -name "*.pc" -exec sed -i -e "s|prefix=%{_prefix}|prefix=%{xorg_buildroot}%{_prefix}|" {} \; -# fix multilib issues -%ifarch x86_64 s390x ia64 ppc64 alpha sparc64 -%define wordsize 64 -%else -%define wordsize 32 -%endif - -mv %{xorg_buildroot}%{_includedir}/freetype2/freetype/config/ftconfig.h \ - %{xorg_buildroot}%{_includedir}/freetype2/freetype/config/ftconfig-%{wordsize}.h -cat >%{xorg_buildroot}%{_includedir}/freetype2/freetype/config/ftconfig.h < - -#if __WORDSIZE == 32 -# include "ftconfig-32.h" -#elif __WORDSIZE == 64 -# include "ftconfig-64.h" -#else -# error "unexpected value for __WORDSIZE macro" -#endif - -#endif -EOF -popd - -echo "*** Building fontconfig ***" -pushd fontconfig-* -autoreconf -fiv -LDFLAGS="$LDFLAGS -static" PKG_CONFIG="pkg-config --static" HASDOCBOOK=no ./configure --host=%{_host} --build=%{_build} --prefix=%{_prefix} --libdir=%{_libdir} --enable-static --disable-shared --with-confdir=%{_sysconfdir}/fonts --with-cache-dir=%{_localstatedir}/cache/fontconfig --with-default-fonts=%{_datadir}/fonts --with-add-fonts="%{_datadir}/X11/fonts/Type1,%{_datadir}/X11/fonts/OTF,%{_datadir}/X11/fonts/TTF,%{_datadir}/X11/fonts/misc,%{_datadir}/X11/fonts/100dpi,%{_datadir}/X11/fonts/75dpi,%{_prefix}/local/share/fonts,~/.fonts" -make %{?_smp_mflags} -make DESTDIR=%{xorg_buildroot} install -find %{xorg_buildroot}%{_prefix} -type f -name "*.la" -delete -find %{xorg_buildroot}%{_prefix} -type f -name "*.pc" -exec sed -i -e "s|libdir=%{_libdir}|libdir=%{xorg_buildroot}%{_libdir}|" {} \; -find %{xorg_buildroot}%{_prefix} -type f -name "*.pc" -exec sed -i -e "s|prefix=%{_prefix}|prefix=%{xorg_buildroot}%{_prefix}|" {} \; -popd - -pushd util-macros-* -echo "Building macros" -LDFLAGS="$LDFLAGS -static" PKG_CONFIG="pkg-config --static" ./configure --host=%{_host} --build=%{_build} --prefix=%{_prefix} --libdir=%{_libdir} --enable-static --disable-shared -make DESTDIR=%{xorg_buildroot} install -find %{xorg_buildroot}%{_prefix} -type f -name "*.la" -delete -find %{xorg_buildroot}%{_prefix} -type f -name "*.pc" -exec sed -i -e "s|libdir=%{_libdir}|libdir=%{xorg_buildroot}%{_libdir}|" {} \; -find %{xorg_buildroot}%{_prefix} -type f -name "*.pc" -exec sed -i -e "s|prefix=%{_prefix}|prefix=%{xorg_buildroot}%{_prefix}|" {} \; -popd - -modules="\ - bigreqsproto \ - compositeproto \ - damageproto \ - dri2proto \ - fixesproto \ - fontsproto \ - glproto \ - inputproto \ - kbproto \ - randrproto \ - recordproto \ - renderproto \ - resourceproto \ - scrnsaverproto \ - videoproto \ - xcb-proto \ - xproto \ - xcmiscproto \ - xextproto \ - xf86bigfontproto \ - xf86dgaproto \ - xf86driproto \ - xf86vidmodeproto \ - xineramaproto \ - makedepend \ - xtrans \ - libXau \ - libXdmcp \ - libxcb \ - libX11 \ - libXext \ - libfontenc \ - libICE \ - libSM \ - libXt \ - libXmu \ - libXpm \ - libXaw \ - libXfixes \ - libXcomposite \ - libXrender \ - libXdamage \ - libXcursor \ - libXfont \ - libXft \ - libXi \ - libXinerama \ - libxkbfile \ - libXrandr \ - libXres \ - libXScrnSaver \ - libXtst \ - libXv \ - libXxf86dga \ - libXxf86vm \ - libpciaccess \ - pixman \ - libdrm \ - font-util" - -for module in ${modules}; do - extraoptions="" - pushd ${module}-* - echo ====================== - echo configuring ${module} - echo ====================== -%ifarch i386 i686 x86_64 - if [ "${module}" = "libdrm" ]; then - autoreconf -fiv - extraoptions="${extraoptions} --enable-udev --disable-libkms --disable-manpages --disable-intel --disable-radeon --disable-nouveau --disable-vmwgfx" - fi -%endif - if [ "${module}" = "libXdmcp" ]; then - autoreconf -fiv - fi - if [ "${module}" = "libXcursor" ]; then - autoreconf -fiv - fi - if [ "${module}" = "libfontenc" ]; then - autoconf - fi - if [ "${module}" = "libXi" ]; then - autoreconf -fiv - fi - if [ "${module}" = "libXaw" ]; then - extraoptions="${extraoptions} --disable-xaw8 --disable-xaw6" - fi - if [ "${module}" = "libxcb" ]; then - sed -i 's/pthread-stubs //' configure.ac - autoreconf -fiv - fi - if [ "${module}" = "libX11" ]; then - autoreconf -fiv - extraoptions="${extraoptions} --disable-specs" - fi - if [ "${module}" = "libSM" ]; then - extraoptions="${extraoptions} --without-libuuid" - fi - if [ "${module}" = "pixman" ]; then - extraoptions="${extraoptions} --disable-gtk --disable-openmp" - aclocal -I %{xorg_buildroot}%{_datadir}/aclocal - autoconf - autoreconf -fiv - fi - if [ "${module}" = "libXfont" ]; then - extraoptions="${extraoptions} --with-freetype-config=%{xorg_buildroot}%{_bindir}/freetype-config" - fi - if [ "${module}" = "libXScrnSaver" ]; then - LDFLAGS="$LDFLAGS -static" PKG_CONFIG="pkg-config --static" CFLAGS="$CFLAGS -fno-strict-aliasing" ./configure --host=%{_host} --build=%{_build} --prefix=%{_prefix} --libdir=%{_libdir} ${extraoptions} --enable-static --disable-shared --with-pic - elif [ "${module}" = "libxkbfile" ]; then - LDFLAGS="$LDFLAGS -static" PKG_CONFIG="pkg-config --static" CFLAGS="$CFLAGS -fno-strict-aliasing" ./configure --host=%{_host} --build=%{_build} --prefix=%{_prefix} --libdir=%{_libdir} ${extraoptions} --enable-static --disable-shared --with-pic - elif [ "${module}" = "pixman" ]; then - LDFLAGS="$LDFLAGS -static" PKG_CONFIG="pkg-config --static" CFLAGS="$CFLAGS -fno-strict-aliasing" ./configure --host=%{_host} --build=%{_build} --prefix=%{_prefix} --libdir=%{_libdir} ${extraoptions} --enable-static --disable-shared --with-pic - elif [ "${module}" = "libXt" ]; then - LDFLAGS="$LDFLAGS -static" PKG_CONFIG="pkg-config --static" CFLAGS="$CFLAGS -fno-strict-aliasing" ./configure --host=%{_host} --build=%{_build} --prefix=%{_prefix} --libdir=%{_libdir} ${extraoptions} --enable-static --disable-shared --with-pic --with-xfile-search-path="%{_sysconfdir}/X11/%%L/%%T/%%N%%C%%S:%{_sysconfdir}/X11/%%l/%%T/\%%N%%C%%S:%{_sysconfdir}/X11/%%T/%%N%%C%%S:%{_sysconfdir}/X11/%%L/%%T/%%N%%S:%{_sysconfdir}/X\11/%%l/%%T/%%N%%S:%{_sysconfdir}/X11/%%T/%%N%%S:%{_datadir}/X11/%%L/%%T/%%N%%C%%S:%{_datadir}/X1\1/%%l/%%T/%%N%%C%%S:%{_datadir}/X11/%%T/%%N%%C%%S:%{_datadir}/X11/%%L/%%T/%%N%%S:%{_datadir}/X11/%%\l/%%T/%%N%%S:%{_datadir}/X11/%%T/%%N%%S" - elif [ "${module}" = "libX11" ]; then - LDFLAGS="$LDFLAGS -lpthread" PKG_CONFIG="pkg-config --static" ./configure --host=%{_host} --build=%{_build} --prefix=%{_prefix} --libdir=%{_libdir} ${extraoptions} --disable-static --enable-shared --with-pic - elif [ "${module}" = "libXtst" ]; then - LDFLAGS="$LDFLAGS -static" PKG_CONFIG="pkg-config --static" ./configure --host=%{_host} --build=%{_build} --prefix=%{_prefix} --libdir=%{_libdir} ${extraoptions} --enable-static --disable-shared --with-pic - elif [ "${module}" = "libXpm" ]; then - LDFLAGS="$LDFLAGS -static" PKG_CONFIG="pkg-config --static" ./configure --host=%{_host} --build=%{_build} --prefix=%{_prefix} --libdir=%{_libdir} ${extraoptions} --enable-static --disable-shared --with-pic - else - LDFLAGS="$LDFLAGS -static" PKG_CONFIG="pkg-config --static" ./configure --host=%{_host} --build=%{_build} --prefix=%{_prefix} --libdir=%{_libdir} ${extraoptions} --enable-static --disable-shared --with-pic - fi - echo ====================== - echo building ${module} - echo ====================== - make DESTDIR=%{xorg_buildroot} - if [ "${module}" = "libX11" ]; then - make DESTDIR=%{xorg_buildroot} INSTALL="install -p" install - else - make DESTDIR=%{xorg_buildroot} install - fi - find %{xorg_buildroot}%{_prefix} -type f -name "*.la" -delete - find %{xorg_buildroot}%{_prefix} -type f -name "*.pc" -exec sed -i -e "s|libdir=%{_libdir}|libdir=%{xorg_buildroot}%{_libdir}|" {} \; - find %{xorg_buildroot}%{_prefix} -type f -name "*.pc" -exec sed -i -e "s|prefix=%{_prefix}|prefix=%{xorg_buildroot}%{_prefix}|" {} \; - if [ "${module}" = "libxcb" ]; then - sed 's,@libdir@,%{xorg_buildroot}%{_libdir},;s,@prefix@,%{xorg_buildroot}%{_prefix},;s,@exec_prefix@,%{xorg_buildroot}%{_exec_prefix},' %{SOURCE140} > %{xorg_buildroot}%{_libdir}/pkgconfig/pthread-stubs.pc - sed -i -e 's/^\(Libs.private:.*\)$/\1 -L${libdir} -lXdmcp -lXau/' %{xorg_buildroot}%{_libdir}/pkgconfig/xcb.pc - elif [ "${module}" = "libX11" ]; then - sed -i -e 's/^\(Libs:.*\)$/\1 -ldl/' %{xorg_buildroot}%{_libdir}/pkgconfig/x11.pc - sed -i -e 's/^\(Libs.private:.*\)$/\1 -L${libdir} -lxcb/' %{xorg_buildroot}%{_libdir}/pkgconfig/x11.pc - elif [ "${module}" = "libSM" ]; then - echo 'Libs.private: -L${libdir} -lICE' >> %{xorg_buildroot}%{_libdir}/pkgconfig/sm.pc - fi - - popd -done -%else -pushd xorg -%endif - -%if %{_bootstrap} -# build mesa -echo "*** Building Mesa ***" -pushd Mesa-* -export PYTHON2=python26 -%ifarch %{ix86} -sed -i -e 's/-std=c99/-std=gnu99/g' configure.ac -%endif -autoreconf -fiv -%ifarch %{ix86} -# i do not have words for how much the assembly dispatch code infuriates me -%define common_flags --disable-selinux --enable-pic --disable-asm -%else -%define common_flags --disable-selinux --enable-pic -%endif - -# link libGL statically against any xorg libraries built above -LDFLAGS="$LDFLAGS -Wl,-Bstatic -lxcb -lXdmcp -lXau -lXext -lXxf86vm -ldrm -Wl,-Bdynamic -lX11 -lpthread -Wl,-rpath,"'\$$'"ORIGIN/../..%{_libdir}/tigervnc:%{_libdir}/tigervnc:%{_libdir}" \ -PKG_CONFIG="pkg-config --static" ./configure %{common_flags} \ - --host=%{_host} \ - --build=%{_build} \ - --prefix=%{_prefix} \ - --libdir=%{_libdir}/tigervnc \ - --disable-osmesa \ - --disable-shared-glapi \ - --disable-egl \ - --disable-gbm \ - --enable-glx \ - --disable-glx-tls \ - --disable-opencl \ - --disable-xvmc \ - --with-dri-driverdir=%{_libdir}/tigervnc/dri \ - --disable-gallium-egl \ - --with-gallium-drivers="" \ - --with-dri-drivers=swrast - -make DESTDIR=%{xorg_buildroot} -make install DESTDIR=%{xorg_buildroot} -find %{xorg_buildroot}%{_prefix} -type f -name "*.la" -delete -find %{xorg_buildroot}%{_prefix} -type f -name "*.pc" -exec sed -i -e "s|libdir=%{_libdir}|libdir=%{xorg_buildroot}%{_libdir}|" {} \; -find %{xorg_buildroot}%{_prefix} -type f -name "*.pc" -exec sed -i -e "s|prefix=%{_prefix}|prefix=%{xorg_buildroot}%{_prefix}|" {} \; -popd -%endif - -popd - -%if %{_bootstrap} -echo "*** Building libpng ***" -pushd libpng-* -CFLAGS="${CFLAGS}" CXXFLAGS="${CXXFLAGS}" LDFLAGS="${LDFLAGS}" ./configure \ - --host=%{_host} \ - --build=%{_build} \ - --prefix=%{_prefix} \ - --libdir=%{_libdir} \ - --disable-shared \ - --enable-static -make %{?_smp_mflags} -make DESTDIR=%{xorg_buildroot} install -popd - -echo "*** Building fltk ***" -pushd fltk-* -%endif -export CMAKE_PREFIX_PATH="%{xorg_buildroot}%{_prefix}:%{_prefix}" -export CMAKE_EXE_LINKER_FLAGS=$LDFLAGS -export PKG_CONFIG="pkg-config --static" -%if %{_bootstrap} -./configure \ - --host=%{_host} \ - --build=%{_build} \ - --prefix=%{_prefix} \ - --libdir=%{_libdir} \ - --enable-x11 \ - --enable-gl \ - --disable-shared \ - --enable-localjpeg \ - --enable-localzlib \ - --disable-localpng \ - --enable-xinerama \ - --enable-xft \ - --enable-xdbe \ - --enable-xfixes \ - --enable-xcursor \ - --with-x -make %{?_smp_mflags} -make DESTDIR=%{xorg_buildroot} install -popd -%endif - -echo "*** Building VNC ***" -export CFLAGS="$CFLAGS -fPIC" -export CXXFLAGS=`echo $CXXFLAGS | sed -e 's/ -c //g'` -%{cmake28} -G"Unix Makefiles" \ - -DFLTK_FLUID_EXECUTABLE=%{xorg_buildroot}%{_bindir}/fluid \ - -DFLTK_LIBRARY_DIR=%{xorg_buildroot}%{_libdir} \ - -DFLTK_INCLUDE_DIR=%{xorg_buildroot}%{_includedir} \ - -DBUILD_STATIC=1 \ - -DCMAKE_BUILD_TYPE=Release \ - -DUSE_INCLUDED_ZLIB=0 \ - -DZLIB_INCLUDE_DIR=%{_includedir} \ - -DZLIB_LIBRARY=%{_libdir}/libz.a \ - -DCMAKE_INSTALL_PREFIX=%{_prefix} - -make %{?_smp_mflags} - -pushd unix/xserver -export PIXMANINCDIR=%{xorg_buildroot}%{_includedir}/pixman-1 -sed -i -e 's/^\(\s*WAYLAND_SCANNER_RULES.*\)/dnl\1/' configure.ac -autoreconf -fiv -chmod +x ./configure -# create a relocatable Xvnc so that we can bundle the custom libGL & swrast w/o overwriting existing libs -GL_LIBS='-Wl,-Bdynamic -lGL' LDFLAGS="$LDFLAGS -Wl,-rpath,"'\$$'"ORIGIN/../..%{_libdir}/tigervnc:%{_libdir}/tigervnc:%{_libdir}" \ -%configure \ - --prefix=%{_prefix} --libdir=%{_libdir} --mandir=%{_datadir}/man \ - --sysconfdir=%{_sysconfdir} --localstatedir=%{_localstatedir} \ - --with-vendor-name="The TigerVNC Project" --with-vendor-name-short="TigerVNC" \ - --with-vendor-web="http://www.tigervnc.org" \ - --disable-xorg --disable-xnest --disable-xvfb --disable-dmx \ - --disable-xwin --disable-xephyr --disable-kdrive --disable-wayland \ - --with-pic --enable-static --disable-shared --enable-xinerama \ - --with-default-xkb-rules=base \ - --with-default-font-path="catalogue:%{_sysconfdir}/X11/fontpath.d,%{_datadir}/X11/fonts/misc,%{_datadir}/X11/fonts/OTF,%{_datadir}/X11/fonts/TTF,%{_datadir}/X11/fonts/Type1,%{_datadir}/X11/fonts/100dpi,%{_datadir}/X11/fonts/75dpi,built-ins" \ - --with-serverconfig-path=%{_libdir}/xorg \ - --with-fontrootdir=%{_datadir}/X11/fonts \ - --with-xkb-output=%{_localstatedir}/lib/xkb \ - --enable-install-libxf86config \ - --enable-glx --disable-glx-tls --disable-dri --enable-dri2 --disable-dri3 \ - --disable-present \ - --disable-config-dbus \ - --disable-config-hal \ - --disable-config-udev \ - --without-dtrace \ - --disable-unit-tests \ - --disable-docs \ - --disable-devel-docs \ - --disable-selective-werror \ - --with-sha1=libsha1 - -make TIGERVNC_SRCDIR=%{tigervnc_src_dir} %{?_smp_mflags} -popd - -# Build icons -pushd media -make -popd - -# Build Java applet -pushd java -%{cmake28} \ -%if !%{_self_signed} - -DJAVA_KEYSTORE=%{_keystore} \ - -DJAVA_KEYSTORE_TYPE=%{_keystore_type} \ - -DJAVA_KEY_ALIAS=%{_key_alias} \ - -DJAVA_STOREPASS=":env STOREPASS" \ - -DJAVA_KEYPASS=":env KEYPASS" \ - -DJAVA_TSA_URL=https://timestamp.geotrust.com/tsa . -%endif - -JAVA_TOOL_OPTIONS="-Dfile.encoding=UTF8" make -popd - -%install -make install DESTDIR=$RPM_BUILD_ROOT - -pushd unix/xserver/hw/vnc -make install DESTDIR=$RPM_BUILD_ROOT -popd - -mkdir -p $RPM_BUILD_ROOT%{_libdir}/tigervnc/dri -install -m644 -p %{xorg_buildroot}%{_libdir}/tigervnc/dri/swrast_dri.so $RPM_BUILD_ROOT%{_libdir}/tigervnc/dri -for f in `find %{xorg_buildroot}%{_libdir}/tigervnc -name "lib*" -print` ; do -cp -a $f $RPM_BUILD_ROOT%{_libdir}/tigervnc -done - -mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/init.d -mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig -install -m644 %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/init.d/vncserver -install -m644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/vncservers - -# Install Java applet -pushd java -mkdir -p $RPM_BUILD_ROOT%{_datadir}/vnc/classes -install -m755 VncViewer.jar $RPM_BUILD_ROOT%{_datadir}/vnc/classes -install -m644 com/tigervnc/vncviewer/index.vnc $RPM_BUILD_ROOT%{_datadir}/vnc/classes -popd - -%find_lang %{name} %{name}.lang - -%if %{_bootstrap} -find %{xorg_buildroot}%{_prefix} -type f -name "*.la" -delete -find %{xorg_buildroot}%{_prefix} -type f -name "*.pc" -exec sed -i -e "s|libdir=%{xorg_buildroot}%{_libdir}|libdir=/opt/%{name}/%{scl_name}%{_libdir}|" {} \; -find %{xorg_buildroot}%{_prefix} -type f -name "*.pc" -exec sed -i -e "s|prefix=%{xorg_buildroot}%{_prefix}|prefix=/opt/%{name}/%{scl_name}%{_prefix}|" {} \; -%endif - -# remove unwanted files -rm -rf $RPM_BUILD_ROOT%{_libdir}/tigervnc/pkgconfig -rm -rf $RPM_BUILD_ROOT%{_libdir}/pkgconfig -rm -rf $RPM_BUILD_ROOT%{_libdir}/xorg -rm -rf $RPM_BUILD_ROOT%{_includedir} -rm -f $RPM_BUILD_ROOT%{_libdir}/tigervnc/*.la -rm -f $RPM_BUILD_ROOT%{_libdir}/tigervnc/dri/*.la - -%clean -rm -rf $RPM_BUILD_ROOT - -%post -touch -c %{_datadir}/icons/hicolor -if [ -x %{_bindir}/gtk-update-icon-cache ]; then - %{_bindir}/gtk-update-icon-cache -q %{_datadir}/icons/hicolor || : -fi - -%postun -touch -c %{_datadir}/icons/hicolor -if [ -x %{_bindir}/gtk-update-icon-cache ]; then - %{_bindir}/gtk-update-icon-cache -q %{_datadir}/icons/hicolor || : -fi - -%post server -/sbin/chkconfig --add vncserver - -%preun server -if [ $1 -eq 0 ]; then - /sbin/service vncserver stop &>/dev/null || : - /sbin/chkconfig --del vncserver -fi - -%postun server -/sbin/service vncserver condrestart &>/dev/null || : - -%files -f %{name}.lang -%defattr(-,root,root,-) -%doc README.md -%{_bindir}/vncviewer -%{_datadir}/applications/* -%{_mandir}/man1/vncviewer.1* - -%files server -%defattr(-,root,root,-) -%config(noreplace) %{_sysconfdir}/sysconfig/vncservers -%config(noreplace) %{_sysconfdir}/init.d/vncserver -%{_bindir}/x0vncserver -%{_bindir}/vncserver -%{_mandir}/man1/vncserver.1* -%{_mandir}/man1/x0vncserver.1* - -%files server-minimal -%defattr(-,root,root,-) -%{_bindir}/vncconfig -%{_bindir}/vncpasswd -%{_bindir}/Xvnc -%{_mandir}/man1/Xvnc.1* -%{_mandir}/man1/vncpasswd.1* -%{_mandir}/man1/vncconfig.1* -%{_libdir}/* - -%files server-applet -%defattr(-,root,root,-) -%doc java/com/tigervnc/vncviewer/README -%{_datadir}/vnc/classes/* - -%files license -%defattr(-,root,root,-) -%doc LICENSE.TXT - -%files icons -%defattr(-,root,root,-) -%{_datadir}/icons/hicolor/*/apps/* - -%if %{_bootstrap} -%files static-devel -%defattr(-,root,root,-) -/opt/%{name}/%{scl_name}%{_sysconfdir}/* -/opt/%{name}/%{scl_name}%{_bindir}/* -/opt/%{name}/%{scl_name}%{_datadir}/* -/opt/%{name}/%{scl_name}%{_includedir}/* -/opt/%{name}/%{scl_name}%{_libdir}/* -%ifarch x86_64 s390x ia64 ppc64 alpha sparc64 -/opt/%{name}/%{scl_name}%{_prefix}/lib/python2.6/* -%endif -%endif - -%changelog -* Fri Dec 11 2015 Brian P. Hinz 1.6.80-3 -- Configure with --host and --build to avoid build host-specific compiler opts - -* Fri Nov 27 2015 Brian P. Hinz 1.6.80-2 -- Split static pre-reqs into separate package - -* Thu Nov 26 2015 Brian P. Hinz 1.6.80-1 -- Version bump for 1.6 release -- Update libjpeg-turbo, gnutls, libtasn1, libpng to latest upstream versions. - -* Sun Sep 12 2015 Brian P. Hinz 1.5.80-8 -- Build Xvnc with link path relative to $ORIGIN and apply dridir patch - to make it portable. - -* Sun Aug 09 2015 Brian P. Hinz 1.5.80-7 -- Patch Xorg sources with latest relevant CVE patches. -- Update libjpeg-turbo, gnutls, libtasn1 to latest upstream versions. - -* Sat Mar 14 2015 Brian P. Hinz 1.4.80-6 -- Build static libraries to meet new minimum requirements - -* Sat Mar 07 2015 Brian P. Hinz 1.4.80-5 -- Don't disable xinerama extension - -* Thu Feb 19 2015 Brian P. Hinz 1.4.80-4 -- Bumped fltk to 1.3.3, no longer requires patching - -* Mon Jan 19 2015 Brian P. Hinz 1.4.0-3 -- Added default font paths to Xvnc and fontconfig -- Added vendor strings to Xvnc -- Specified xfile-search-path when configuring libXt the same way el6 does - -* Wed Dec 24 2014 Brian P. Hinz 1.4.80-1.20141119git59c5a55c -- Rebuilt against Xorg 7.7 with CVE-2104-12-09 patches from debian. -- Bumped versions of Mesa, Freetype, fontconfig, etc. -- Link against our own version of libGL to improve portability. -- Added static libsha1 to avoid linking against libssl.so. - -* Wed Nov 19 2014 Brian P. Hinz 1.3.80-18.20141119git59c5a55c -- Removed server module sub-package - -* Thu Nov 28 2013 Brian P. Hinz 1.3.80-17.20131128svn5139 -- Bumped version to 1.3.80 -- Cleaned up linter warnings - -* Thu Jul 05 2013 Brian P. Hinz 1.3.0 -- Upstream 1.3.0 release -- Conditional-ized %snap for release - -* Fri Jun 14 2013 Brian P. Hinz 1.2.90-14.20130531svn5120 -- Update libjpeg-turbo to 1.3.0 - -* Fri May 24 2013 Brian P. Hinz 1.2.90-14.20130524svn5114 -- Improve spec file portability - -* Fri May 17 2013 Brian P. Hinz 1.2.90-13.20130425svn5087 -- Improve portability with more static linking - -* Thu Apr 04 2013 Brian P. Hinz 1.2.80-12.20130330svn5066 -- Added conditional -march arg to libdrm-intel to allow building on i386 -- Fixed version to reflect upstream pre-release versioning - -* Sat Mar 30 2013 Brian P. Hinz 1.2.0-11.20130330svn5066 -- Updated to TigerVNC svn 5066 -- Updated fltk to 1.3.2 and updated fltk patches per BUILDING.txt -- Fixed vncserver init script & config file which had been overwritten by - systemd versions. - -* Wed Nov 28 2012 Brian P. Hinz 1.2.0-7.20120915svn4999 -- Changed BuildRequires to cmake28 -- Set PIXMANINCDIR when building Xvnc - -* Tue Sep 18 2012 Brian P. Hinz 1.2.0-6.20120915svn4999 -- Applied icon support patch - -* Sat Sep 15 2012 Brian P. Hinz 1.2.0-5.20120915svn4999 -- Update to TigerVNC svn r4999 snapshot -- Build a static libjpeg-turbo to remove the external dependency -- Applied Cendio's Fltk patches, except for the icon patch which I cannot get to build - without creating undefined reference errors during linking - -* Thu Jul 19 2012 Brian P. Hinz 1.2.0-4.20120719svn4941 -- Update to TigerVNC svn r4941 snapshot -- Removed border-hook.patch since it's been committed - -* Wed Jul 18 2012 Brian P. Hinz 1.2.0-3.20120715svn4937 -- Update to TigerVNC svn r4937 snapshot -- Applied border-hook.patch from devel list to fix bug #3415308 -- Use build order recommended by cgit.freedesktop.org/xorg/util/modular/tree/build.sh -- Removed tigervnc11-rh692048.patch as it seems to break support for VeNCrypt - -* Sun Jul 15 2012 Brian P. Hinz 1.2.0-1.20120715svn4935 -- Adapted spec file for building static linked binary on RHEL5 from F16 - spec file and DRC's build-xorg script included in src tarball. -- Update to TigerVNC svn r4935 snapshot -- Need to use inkscape on RHEL5 because convert is broken - -* Tue Nov 22 2011 Adam Tkac - 1.1.0-3 -- don't build X.Org devel docs (#755782) -- applet: BR generic java-devel instead of java-gcj-devel (#755783) -- use runuser to start Xvnc in systemd service file (#754259) -- don't attepmt to restart Xvnc session during update/erase (#753216) - -* Fri Nov 11 2011 Adam Tkac - 1.1.0-2 -- libvnc.so: don't use unexported GetMaster function (#744881) -- remove nasm buildreq - -* Mon Sep 12 2011 Adam Tkac - 1.1.0-1 -- update to 1.1.0 -- update the xorg11 patch -- patches merged - - tigervnc11-glx.patch - - tigervnc11-CVE-2011-1775.patch - - 0001-Use-memmove-instead-of-memcpy-in-fbblt.c-when-memory.patch - -* Thu Jul 28 2011 Adam Tkac - 1.0.90-6 -- add systemd service file and remove legacy SysV initscript (#717227) - -* Tue May 12 2011 Adam Tkac - 1.0.90-5 -- make Xvnc buildable against X.Org 1.11 - -* Tue May 10 2011 Adam Tkac - 1.0.90-4 -- viewer can send password without proper validation of X.509 certs - (CVE-2011-1775) - -* Wed Apr 13 2011 Adam Tkac - 1.0.90-3 -- fix wrong usage of memcpy which caused screen artifacts (#652590) -- don't point to inaccessible link in sysconfig/vncservers (#644975) - -* Fri Apr 08 2011 Adam Tkac - 1.0.90-2 -- improve compatibility with vinagre client (#692048) - -* Tue Mar 22 2011 Adam Tkac - 1.0.90-1 -- update to 1.0.90 - -* Wed Feb 09 2011 Fedora Release Engineering - 1.0.90-0.32.20110117svn4237 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild - -* Mon Jan 17 2011 Adam Tkac 1.0.90-0.31.20110117svn4237 -- fix libvnc.so module loading - -* Mon Jan 17 2011 Adam Tkac 1.0.90-0.30.20110117svn4237 -- update to r4237 -- patches merged - - tigervnc11-optionsdialog.patch - - tigervnc11-rh607866.patch - -* Fri Jan 14 2011 Adam Tkac 1.0.90-0.29.20101208svn4225 -- improve patch for keyboard issues - -* Fri Jan 14 2011 Adam Tkac 1.0.90-0.28.20101208svn4225 -- attempt to fix various keyboard-related issues (key repeating etc) - -* Fri Jan 07 2011 Adam Tkac 1.0.90-0.27.20101208svn4225 -- render "Ok" and "Cancel" buttons in the options dialog correctly - -* Wed Dec 15 2010 Jan Görig 1.0.90-0.26.20101208svn4225 -- added vncserver lock file (#662784) - -* Fri Dec 10 2010 Adam Tkac 1.0.90-0.25.20101208svn4225 -- update to r4225 -- patches merged - - tigervnc11-rh611677.patch - - tigervnc11-rh633931.patch - - tigervnc11-xorg1.10.patch -- enable VeNCrypt and PAM support - -* Mon Dec 06 2010 Adam Tkac 1.0.90-0.24.20100813svn4123 -- rebuild against xserver 1.10.X -- 0001-Return-Success-from-generate_modkeymap-when-max_keys.patch merged - -* Wed Sep 29 2010 jkeating - 1.0.90-0.23.20100813svn4123 -- Rebuilt for gcc bug 634757 - -* Tue Sep 21 2010 Adam Tkac 1.0.90-0.22.20100420svn4030 -- drop xorg-x11-fonts-misc dependency (#636170) - -* Tue Sep 21 2010 Adam Tkac 1.0.90-0.21.20100420svn4030 -- improve patch for #633645 (fix tcsh incompatibilities) - -* Thu Sep 16 2010 Adam Tkac 1.0.90-0.20.20100813svn4123 -- press fake modifiers correctly (#633931) -- supress unneeded debug information emitted from initscript (#633645) - -* Wed Aug 25 2010 Adam Tkac 1.0.90-0.19.20100813svn4123 -- separate Xvnc, vncpasswd and vncconfig to -server-minimal subpkg (#626946) -- move license to separate subpkg and Requires it from main subpkgs -- Xvnc: handle situations when no modifiers exist well (#611677) - -* Fri Aug 13 2010 Adam Tkac 1.0.90-0.18.20100813svn4123 -- update to r4123 (#617973) -- add perl requires to -server subpkg (#619791) - -* Thu Jul 22 2010 Adam Tkac 1.0.90-0.17.20100721svn4113 -- update to r4113 -- patches merged - - tigervnc11-rh586406.patch - - tigervnc11-libvnc.patch - - tigervnc11-rh597172.patch - - tigervnc11-rh600070.patch - - tigervnc11-options.patch -- don't own %%{_datadir}/icons directory (#614301) -- minor improvements in the .desktop file (#616340) -- bundled libjpeg configure requires nasm; is executed even if system-wide - libjpeg is used - -* Fri Jul 02 2010 Adam Tkac 1.0.90-0.16.20100420svn4030 -- build against system-wide libjpeg-turbo (#494458) -- build no longer requires nasm - -* Mon Jun 28 2010 Adam Tkac 1.0.90-0.15.20100420svn4030 -- vncserver: accept <+optname> option when specified as the first one - -* Thu Jun 24 2010 Adam Tkac 1.0.90-0.14.20100420svn4030 -- fix memory leak in Xvnc input code (#597172) -- don't crash when receive negative encoding (#600070) -- explicitly disable udev configuration support -- add gettext-autopoint to BR - -* Mon Jun 14 2010 Adam Tkac 1.0.90-0.13.20100420svn4030 -- update URL about SSH tunneling in the sysconfig file (#601996) - -* Fri Jun 11 2010 Adam Tkac 1.0.90-0.12.20100420svn4030 -- use newer gettext -- autopoint now uses git instead of cvs, adjust BuildRequires appropriately - -* Thu May 13 2010 Adam Tkac 1.0.90-0.11.20100420svn4030 -- link libvnc.so "now" to catch "undefined symbol" errors during Xorg startup -- use always XkbConvertCase instead of XConvertCase (#580159, #586406) -- don't link libvnc.so against libXi.la, libdix.la and libxkb.la; use symbols - from Xorg instead - -* Thu May 13 2010 Adam Tkac 1.0.90-0.10.20100420svn4030 -- update to r4030 snapshot -- patches merged to upstream - - tigervnc11-rh522369.patch - - tigervnc11-rh551262.patch - - tigervnc11-r4002.patch - - tigervnc11-r4014.patch - -* Thu Apr 08 2010 Adam Tkac 1.0.90-0.9.20100219svn3993 -- add server-applet subpackage which contains Java vncviewer applet -- fix Java applet; it didn't work when run from web browser -- add xorg-x11-xkb-utils to server Requires - -* Fri Mar 12 2010 Adam Tkac 1.0.90-0.8.20100219svn3993 -- add French translation to vncviewer.desktop (thanks to Alain Portal) - -* Thu Mar 04 2010 Adam Tkac 1.0.90-0.7.20100219svn3993 -- don't crash during pixel format change (#522369, #551262) - -* Mon Mar 01 2010 Adam Tkac 1.0.90-0.6.20100219svn3993 -- add mesa-dri-drivers and xkeyboard-config to -server Requires -- update to r3993 1.0.90 snapshot - - tigervnc11-noexecstack.patch merged - - tigervnc11-xorg18.patch merged - - xserver18.patch is no longer needed - -* Wed Jan 27 2010 Jan Gorig 1.0.90-0.5.20091221svn3929 -- initscript LSB compliance fixes (#523974) - -* Fri Jan 22 2010 Adam Tkac 1.0.90-0.4.20091221svn3929 -- mark stack as non-executable in jpeg ASM code -- add xorg-x11-xauth to Requires -- add support for X.Org 1.8 -- drop shave sources, they are no longer needed - -* Thu Jan 21 2010 Adam Tkac 1.0.90-0.3.20091221svn3929 -- drop tigervnc-xorg25909.patch, it has been merged to X.Org upstream - -* Thu Jan 07 2010 Adam Tkac 1.0.90-0.2.20091221svn3929 -- add patch for upstream X.Org issue #25909 -- add libXdmcp-devel to build requires to build Xvnc with XDMCP support (#552322) - -* Mon Dec 21 2009 Adam Tkac 1.0.90-0.1.20091221svn3929 -- update to 1.0.90 snapshot -- patches merged - - tigervnc10-compat.patch - - tigervnc10-rh510185.patch - - tigervnc10-rh524340.patch - - tigervnc10-rh516274.patch - -* Mon Oct 26 2009 Adam Tkac 1.0.0-3 -- create Xvnc keyboard mapping before first keypress (#516274) - -* Thu Oct 08 2009 Adam Tkac 1.0.0-2 -- update underlying X source to 1.6.4-0.3.fc11 -- remove bogus '-nohttpd' parameter from /etc/sysconfig/vncservers (#525629) -- initscript LSB compliance fixes (#523974) -- improve -LowColorSwitch documentation and handling (#510185) -- honor dotWhenNoCursor option (and it's changes) every time (#524340) - -* Fri Aug 28 2009 Adam Tkac 1.0.0-1 -- update to 1.0.0 -- tigervnc10-rh495457.patch merged to upstream - -* Mon Aug 24 2009 Karsten Hopp 0.0.91-0.17 -- fix ifnarch s390x for server-module - -* Fri Aug 21 2009 Tomas Mraz - 0.0.91-0.16 -- rebuilt with new openssl - -* Tue Aug 04 2009 Adam Tkac 0.0.91-0.15 -- make Xvnc compilable - -* Sun Jul 26 2009 Fedora Release Engineering - 0.0.91-0.14.1 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild - -* Mon Jul 13 2009 Adam Tkac 0.0.91-0.13.1 -- don't write warning when initscript is called with condrestart param (#508367) - -* Tue Jun 23 2009 Adam Tkac 0.0.91-0.13 -- temporary use F11 Xserver base to make Xvnc compilable -- BuildRequires: libXi-devel -- don't ship tigervnc-server-module on s390/s390x - -* Mon Jun 22 2009 Adam Tkac 0.0.91-0.12 -- fix local rendering of cursor (#495457) - -* Thu Jun 18 2009 Adam Tkac 0.0.91-0.11 -- update to 0.0.91 (1.0.0 RC1) -- patches merged - - tigervnc10-rh499401.patch - - tigervnc10-rh497592.patch - - tigervnc10-rh501832.patch -- after discusion in upstream drop tigervnc-bounds.patch -- configure flags cleanup - -* Thu May 21 2009 Adam Tkac 0.0.90-0.10 -- rebuild against 1.6.1.901 X server (#497835) -- disable i18n, vncviewer is not UTF-8 compatible (#501832) - -* Mon May 18 2009 Adam Tkac 0.0.90-0.9 -- fix vncpasswd crash on long passwords (#499401) -- start session dbus daemon correctly (#497592) - -* Mon May 11 2009 Adam Tkac 0.0.90-0.8.1 -- remove merged tigervnc-manminor.patch - -* Tue May 05 2009 Adam Tkac 0.0.90-0.8 -- update to 0.0.90 - -* Thu Apr 30 2009 Adam Tkac 0.0.90-0.7.20090427svn3789 -- server package now requires xorg-x11-fonts-misc (#498184) - -* Mon Apr 27 2009 Adam Tkac 0.0.90-0.6.20090427svn3789 -- update to r3789 - - tigervnc-rh494801.patch merged -- tigervnc-newfbsize.patch is no longer needed -- fix problems when vncviewer and Xvnc run on different endianess (#496653) -- UltraVNC and TightVNC clients work fine again (#496786) - -* Wed Apr 08 2009 Adam Tkac 0.0.90-0.5.20090403svn3751 -- workaround broken fontpath handling in vncserver script (#494801) - -* Fri Apr 03 2009 Adam Tkac 0.0.90-0.4.20090403svn3751 -- update to r3751 -- patches merged - - tigervnc-xclients.patch - - tigervnc-clipboard.patch - - tigervnc-rh212985.patch -- basic RandR support in Xvnc (resize of the desktop) -- use built-in libjpeg (SSE2/MMX accelerated encoding on x86 platform) -- use Tight encoding by default -- use TigerVNC icons - -* Tue Mar 03 2009 Adam Tkac 0.0.90-0.3.20090303svn3631 -- update to r3631 - -* Tue Mar 03 2009 Adam Tkac 0.0.90-0.2.20090302svn3621 -- package review related fixes - -* Mon Mar 02 2009 Adam Tkac 0.0.90-0.1.20090302svn3621 -- initial package, r3621 diff --git a/contrib/packages/rpm/el6/SOURCES/fetch_sources.sh b/contrib/packages/rpm/el6/SOURCES/fetch_sources.sh deleted file mode 100644 index 6f6d7b0..0000000 --- a/contrib/packages/rpm/el6/SOURCES/fetch_sources.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -SPEC=$1 - -SOURCES=`grep -i "^SOURCE\d\+\s*:\s*\([fht]\+tp://.*\)" ${SPEC} | sed -e 's/^.*:[[:space:]]//'` -for URL in ${SOURCES} ; do - curl -OL ${URL} -done - diff --git a/contrib/packages/rpm/el6/SOURCES/fltk-1.3.x-clipboard.patch b/contrib/packages/rpm/el6/SOURCES/fltk-1.3.x-clipboard.patch deleted file mode 100644 index 3f12bc5..0000000 --- a/contrib/packages/rpm/el6/SOURCES/fltk-1.3.x-clipboard.patch +++ /dev/null @@ -1,106 +0,0 @@ -diff -up fltk-1.3.x-r8659/FL/Fl.H.orig fltk-1.3.x-r8659/FL/Fl.H ---- fltk-1.3.x-r8659/FL/Fl.H.orig 2011-05-17 16:25:56.671744548 +0200 -+++ fltk-1.3.x-r8659/FL/Fl.H 2011-05-17 16:26:05.709101536 +0200 -@@ -108,6 +108,9 @@ typedef int (*Fl_Args_Handler)(int argc, - \see Fl::event_dispatch(Fl_Event_Dispatch) */ - typedef int (*Fl_Event_Dispatch)(int event, Fl_Window *w); - -+/** Signature of add_clipboard_notify functions passed as parameters */ -+typedef void (*Fl_Clipboard_Notify_Handler)(int source, void *data); -+ - /** @} */ /* group callback_functions */ - - -@@ -744,6 +747,19 @@ public: - */ - static void paste(Fl_Widget &receiver, int source /*=0*/); // platform dependent - /** -+ FLTK will call the registered callback whenever there is a change to the -+ selection buffer or the clipboard. The source argument indicates which -+ of the two has changed. Only changes by other applications are reported. -+ \note Some systems require polling to monitor the clipboard and may -+ therefore have some delay in detecting changes. -+ */ -+ static void add_clipboard_notify(Fl_Clipboard_Notify_Handler h, void *data); -+ /** -+ Stop calling the specified callback when there are changes to the selection -+ buffer or the clipboard. -+ */ -+ static void remove_clipboard_notify(Fl_Clipboard_Notify_Handler h); -+ /** - Initiate a Drag And Drop operation. The selection buffer should be - filled with relevant data before calling this method. FLTK will - then initiate the system wide drag and drop handling. Dropped data -diff -up fltk-1.3.x-r8659/src/Fl.cxx.orig fltk-1.3.x-r8659/src/Fl.cxx ---- fltk-1.3.x-r8659/src/Fl.cxx.orig 2011-05-18 15:20:26.667291459 +0200 -+++ fltk-1.3.x-r8659/src/Fl.cxx 2011-05-18 16:31:15.522026086 +0200 -@@ -430,6 +430,69 @@ static char in_idle; - #endif - - //////////////////////////////////////////////////////////////// -+// Clipboard notifications -+ -+struct Clipboard_Notify { -+ Fl_Clipboard_Notify_Handler handler; -+ void *data; -+ struct Clipboard_Notify *next; -+}; -+ -+static struct Clipboard_Notify *clip_notify_list = NULL; -+ -+extern void fl_clipboard_notify_change(); // in Fl_.cxx -+ -+void Fl::add_clipboard_notify(Fl_Clipboard_Notify_Handler h, void *data) { -+ struct Clipboard_Notify *node; -+ -+ remove_clipboard_notify(h); -+ -+ node = new Clipboard_Notify; -+ -+ node->handler = h; -+ node->data = data; -+ node->next = clip_notify_list; -+ -+ clip_notify_list = node; -+ -+ fl_clipboard_notify_change(); -+} -+ -+void Fl::remove_clipboard_notify(Fl_Clipboard_Notify_Handler h) { -+ struct Clipboard_Notify *node, **prev; -+ -+ node = clip_notify_list; -+ prev = &clip_notify_list; -+ while (node != NULL) { -+ if (node->handler == h) { -+ *prev = node->next; -+ delete node; -+ -+ fl_clipboard_notify_change(); -+ -+ return; -+ } -+ -+ prev = &node->next; -+ node = node->next; -+ } -+} -+ -+bool fl_clipboard_notify_empty(void) { -+ return clip_notify_list == NULL; -+} -+ -+void fl_trigger_clipboard_notify(int source) { -+ struct Clipboard_Notify *node; -+ -+ node = clip_notify_list; -+ while (node != NULL) { -+ node->handler(source, node->data); -+ node = node->next; -+ } -+} -+ -+//////////////////////////////////////////////////////////////// - // wait/run/check/ready: - - void (*Fl::idle)(); // see Fl::add_idle.cxx for the add/remove functions diff --git a/contrib/packages/rpm/el6/SOURCES/fltk-1.3.x-screen_num.patch b/contrib/packages/rpm/el6/SOURCES/fltk-1.3.x-screen_num.patch deleted file mode 100644 index c157af6..0000000 --- a/contrib/packages/rpm/el6/SOURCES/fltk-1.3.x-screen_num.patch +++ /dev/null @@ -1,131 +0,0 @@ -diff -up fltk-1.3.0r9619/FL/Fl.H.screen_num fltk-1.3.0r9619/FL/Fl.H ---- fltk-1.3.0r9619/FL/Fl.H.screen_num 2012-07-03 13:49:28.663085580 +0200 -+++ fltk-1.3.0r9619/FL/Fl.H 2012-07-03 13:49:28.731084402 +0200 -@@ -806,6 +806,8 @@ public: - static void screen_xywh(int &X, int &Y, int &W, int &H, int mx, int my); - static void screen_xywh(int &X, int &Y, int &W, int &H, int n); - static void screen_xywh(int &X, int &Y, int &W, int &H, int mx, int my, int mw, int mh); -+ static int screen_num(int x, int y); -+ static int screen_num(int x, int y, int w, int h); - static void screen_dpi(float &h, float &v, int n=0); - static void screen_work_area(int &X, int &Y, int &W, int &H, int mx, int my); - static void screen_work_area(int &X, int &Y, int &W, int &H, int n); -diff -up fltk-1.3.0r9619/src/screen_xywh.cxx.screen_num fltk-1.3.0r9619/src/screen_xywh.cxx ---- fltk-1.3.0r9619/src/screen_xywh.cxx.screen_num 2012-03-23 17:47:53.000000000 +0100 -+++ fltk-1.3.0r9619/src/screen_xywh.cxx 2012-07-03 13:58:01.947195396 +0200 -@@ -215,21 +215,6 @@ int Fl::screen_count() { - return num_screens ? num_screens : 1; - } - --static int find_screen_with_point(int mx, int my) { -- int screen = 0; -- if (num_screens < 0) screen_init(); -- -- for (int i = 0; i < num_screens; i ++) { -- int sx, sy, sw, sh; -- Fl::screen_xywh(sx, sy, sw, sh, i); -- if ((mx >= sx) && (mx < (sx+sw)) && (my >= sy) && (my < (sy+sh))) { -- screen = i; -- break; -- } -- } -- return screen; --} -- - /** - Gets the bounding box of a screen - that contains the specified screen position \p mx, \p my -@@ -237,7 +222,7 @@ static int find_screen_with_point(int mx - \param[in] mx, my the absolute screen position - */ - void Fl::screen_xywh(int &X, int &Y, int &W, int &H, int mx, int my) { -- screen_xywh(X, Y, W, H, find_screen_with_point(mx, my)); -+ screen_xywh(X, Y, W, H, screen_num(mx, my)); - } - - -@@ -248,7 +233,7 @@ void Fl::screen_xywh(int &X, int &Y, int - \param[in] mx, my the absolute screen position - */ - void Fl::screen_work_area(int &X, int &Y, int &W, int &H, int mx, int my) { -- screen_work_area(X, Y, W, H, find_screen_with_point(mx, my)); -+ screen_work_area(X, Y, W, H, screen_num(mx, my)); - } - - /** -@@ -321,6 +306,38 @@ void Fl::screen_xywh(int &X, int &Y, int - #endif // WIN32 - } - -+/** -+ Gets the screen bounding rect for the screen -+ which intersects the most with the rectangle -+ defined by \p mx, \p my, \p mw, \p mh. -+ \param[out] X,Y,W,H the corresponding screen bounding box -+ \param[in] mx, my, mw, mh the rectangle to search for intersection with -+ \see void screen_xywh(int &X, int &Y, int &W, int &H, int n) -+ */ -+void Fl::screen_xywh(int &X, int &Y, int &W, int &H, int mx, int my, int mw, int mh) { -+ screen_xywh(X, Y, W, H, screen_num(mx, my, mw, mh)); -+} -+ -+/** -+ Gets the screen number of a screen -+ that contains the specified screen position \p x, \p y -+ \param[in] x, y the absolute screen position -+*/ -+int Fl::screen_num(int x, int y) { -+ int screen = 0; -+ if (num_screens < 0) screen_init(); -+ -+ for (int i = 0; i < num_screens; i ++) { -+ int sx, sy, sw, sh; -+ Fl::screen_xywh(sx, sy, sw, sh, i); -+ if ((x >= sx) && (x < (sx+sw)) && (y >= sy) && (y < (sy+sh))) { -+ screen = i; -+ break; -+ } -+ } -+ return screen; -+} -+ - static inline float fl_intersection(int x1, int y1, int w1, int h1, - int x2, int y2, int w2, int h2) { - if(x1+w1 < x2 || x2+w2 < x1 || y1+h1 < y2 || y2+h2 < y1) -@@ -333,30 +350,27 @@ static inline float fl_intersection(int - } - - /** -- Gets the screen bounding rect for the screen -+ Gets the screen number for the screen - which intersects the most with the rectangle -- defined by \p mx, \p my, \p mw, \p mh. -- \param[out] X,Y,W,H the corresponding screen bounding box -- \param[in] mx, my, mw, mh the rectangle to search for intersection with -- \see void screen_xywh(int &X, int &Y, int &W, int &H, int n) -+ defined by \p x, \p y, \p w, \p h. -+ \param[in] x, y, w, h the rectangle to search for intersection with - */ --void Fl::screen_xywh(int &X, int &Y, int &W, int &H, int mx, int my, int mw, int mh) { -+int Fl::screen_num(int x, int y, int w, int h) { - int best_screen = 0; - float best_intersection = 0.; - for(int i = 0; i < Fl::screen_count(); i++) { - int sx, sy, sw, sh; - Fl::screen_xywh(sx, sy, sw, sh, i); -- float sintersection = fl_intersection(mx, my, mw, mh, sx, sy, sw, sh); -+ float sintersection = fl_intersection(x, y, w, h, sx, sy, sw, sh); - if(sintersection > best_intersection) { - best_screen = i; - best_intersection = sintersection; - } - } -- screen_xywh(X, Y, W, H, best_screen); -+ return best_screen; - } - - -- - /** - Gets the screen resolution in dots-per-inch for the given screen. - \param[out] h, v horizontal and vertical resolution diff --git a/contrib/packages/rpm/el6/SOURCES/fltk-1_v2.3.0-modal.patch b/contrib/packages/rpm/el6/SOURCES/fltk-1_v2.3.0-modal.patch deleted file mode 100644 index 7b1b791..0000000 --- a/contrib/packages/rpm/el6/SOURCES/fltk-1_v2.3.0-modal.patch +++ /dev/null @@ -1,75 +0,0 @@ -diff -bur fltk-1.3.0r9619.org/src/Fl_cocoa.mm fltk-1.3.0r9619/src/Fl_cocoa.mm ---- fltk-1.3.0r9619.org/src/Fl_cocoa.mm 2012-06-19 12:54:43.694231638 +0200 -+++ fltk-1.3.0r9619/src/Fl_cocoa.mm 2012-06-19 12:57:05.899048602 +0200 -@@ -697,12 +697,9 @@ - return NO; // prevent the caption to be redrawn as active on click - // when another modal window is currently the key win - -- return !(w->tooltip_window() || w->menu_window()); -+ return !w->tooltip_window(); - } - --// TODO see if we really need a canBecomeMainWindow ... --#if 0 -- - - (BOOL)canBecomeMainWindow - { - if (Fl::modal_ && (Fl::modal_ != w)) -@@ -711,7 +708,6 @@ - - return !(w->tooltip_window() || w->menu_window()); - } --#endif - - @end - -diff -bur fltk-1.3.0r9619.org/src/Fl_win32.cxx fltk-1.3.0r9619/src/Fl_win32.cxx ---- fltk-1.3.0r9619.org/src/Fl_win32.cxx 2012-06-19 12:54:43.696231735 +0200 -+++ fltk-1.3.0r9619/src/Fl_win32.cxx 2012-06-19 12:54:43.803236862 +0200 -@@ -1065,6 +1065,10 @@ - break; - - case WM_SETFOCUS: -+ if ((Fl::modal_) && (Fl::modal_ != window)) { -+ SetFocus(fl_xid(Fl::modal_)); -+ return 0; -+ } - Fl::handle(FL_FOCUS, window); - break; - -@@ -1826,6 +1830,11 @@ - Fl::e_number = old_event; - w->redraw(); // force draw to happen - } -+ -+ // Needs to be done before ShowWindow() to get the correct behaviour -+ // when we get WM_SETFOCUS. -+ if (w->modal()) {Fl::modal_ = w; fl_fix_focus();} -+ - // If we've captured the mouse, we dont want to activate any - // other windows from the code, or we lose the capture. - ShowWindow(x->xid, !showit ? SW_SHOWMINNOACTIVE : -@@ -1843,7 +1852,6 @@ - } - } - -- if (w->modal()) {Fl::modal_ = w; fl_fix_focus();} - return x; - } - -diff -bur fltk-1.3.0r9619.org/src/Fl_x.cxx fltk-1.3.0r9619/src/Fl_x.cxx ---- fltk-1.3.0r9619.org/src/Fl_x.cxx 2012-06-19 12:54:43.697231783 +0200 -+++ fltk-1.3.0r9619/src/Fl_x.cxx 2012-06-19 12:54:43.804236911 +0200 -@@ -2101,6 +2101,12 @@ - while (wp->parent()) wp = wp->window(); - XSetTransientForHint(fl_display, xp->xid, fl_xid(wp)); - if (!wp->visible()) showit = 0; // guess that wm will not show it -+ if (win->modal()) { -+ Atom net_wm_state = XInternAtom (fl_display, "_NET_WM_STATE", 0); -+ Atom net_wm_state_skip_taskbar = XInternAtom (fl_display, "_NET_WM_STATE_MODAL", 0); -+ XChangeProperty (fl_display, xp->xid, net_wm_state, XA_ATOM, 32, -+ PropModeAppend, (unsigned char*) &net_wm_state_skip_taskbar, 1); -+ } - } - - // Make sure that borderless windows do not show in the task bar diff --git a/contrib/packages/rpm/el6/SOURCES/fltk-1_v2.3.x-clipboard-osx.patch b/contrib/packages/rpm/el6/SOURCES/fltk-1_v2.3.x-clipboard-osx.patch deleted file mode 100644 index 22e6939..0000000 --- a/contrib/packages/rpm/el6/SOURCES/fltk-1_v2.3.x-clipboard-osx.patch +++ /dev/null @@ -1,44 +0,0 @@ -diff -bur fltk-1.3.0r9619.org/src/Fl_cocoa.mm fltk-1.3.0r9619/src/Fl_cocoa.mm ---- fltk-1.3.0r9619.org/src/Fl_cocoa.mm 2012-06-18 19:24:30.971688769 +0200 -+++ fltk-1.3.0r9619/src/Fl_cocoa.mm 2012-06-18 19:25:25.700310375 +0200 -@@ -1319,9 +1319,13 @@ - } - @end - -+static void clipboard_check(void); -+ - @implementation FLApplication - + (void)sendEvent:(NSEvent *)theEvent - { -+ // update clipboard status -+ clipboard_check(); - NSEventType type = [theEvent type]; - if (type == NSLeftMouseDown) { - fl_lock_function(); -@@ -2790,6 +2794,26 @@ - PasteboardCreate(kPasteboardClipboard, &myPasteboard); - } - -+extern void fl_trigger_clipboard_notify(int source); -+ -+void fl_clipboard_notify_change() { -+ // No need to do anything here... -+} -+ -+static void clipboard_check(void) -+{ -+ PasteboardSyncFlags flags; -+ -+ allocatePasteboard(); -+ flags = PasteboardSynchronize(myPasteboard); -+ -+ if (!(flags & kPasteboardModified)) -+ return; -+ if (flags & kPasteboardClientIsOwner) -+ return; -+ -+ fl_trigger_clipboard_notify(1); -+} - - /* - * create a selection diff --git a/contrib/packages/rpm/el6/SOURCES/fltk-1_v2.3.x-clipboard-win32.patch b/contrib/packages/rpm/el6/SOURCES/fltk-1_v2.3.x-clipboard-win32.patch deleted file mode 100644 index ac94779..0000000 --- a/contrib/packages/rpm/el6/SOURCES/fltk-1_v2.3.x-clipboard-win32.patch +++ /dev/null @@ -1,99 +0,0 @@ -diff -ur fltk-1.3.0r9110.org/src/Fl.cxx fltk-1.3.0r9110/src/Fl.cxx ---- fltk-1.3.0r9110.org/src/Fl.cxx 2012-06-17 19:47:09.988183253 +0200 -+++ fltk-1.3.0r9110/src/Fl.cxx 2012-06-17 19:47:10.127189919 +0200 -@@ -1421,6 +1421,7 @@ - // hide() destroys the X window, it does not do unmap! - - #if defined(WIN32) -+extern void fl_clipboard_notify_untarget(HWND wnd); - extern void fl_update_clipboard(void); - #elif USE_XFT - extern void fl_destroy_xft_draw(Window); -@@ -1471,6 +1472,8 @@ - // to destroy the window that owns the selection. - if (GetClipboardOwner()==ip->xid) - fl_update_clipboard(); -+ // Make sure we unlink this window from the clipboard chain -+ fl_clipboard_notify_untarget(ip->xid); - // Send a message to myself so that I'll get out of the event loop... - PostMessage(ip->xid, WM_APP, 0, 0); - if (ip->private_dc) fl_release_dc(ip->xid, ip->private_dc); -diff -ur fltk-1.3.0r9110.org/src/Fl_win32.cxx fltk-1.3.0r9110/src/Fl_win32.cxx ---- fltk-1.3.0r9110.org/src/Fl_win32.cxx 2012-06-17 19:47:09.987183205 +0200 -+++ fltk-1.3.0r9110/src/Fl_win32.cxx 2012-06-17 19:47:19.069618739 +0200 -@@ -646,6 +646,38 @@ - } - } - -+static HWND clipboard_wnd = 0; -+static HWND next_clipboard_wnd = 0; -+ -+static bool initial_clipboard = true; -+ -+void fl_clipboard_notify_change() { -+ // No need to do anything here... -+} -+ -+void fl_clipboard_notify_target(HWND wnd) { -+ if (clipboard_wnd) -+ return; -+ -+ // We get one fake WM_DRAWCLIPBOARD immediately, which we therefore -+ // need to ignore. -+ initial_clipboard = true; -+ -+ clipboard_wnd = wnd; -+ next_clipboard_wnd = SetClipboardViewer(wnd); -+} -+ -+void fl_clipboard_notify_untarget(HWND wnd) { -+ if (wnd != clipboard_wnd) -+ return; -+ -+ ChangeClipboardChain(wnd, next_clipboard_wnd); -+ clipboard_wnd = next_clipboard_wnd = 0; -+ -+ if (Fl::first_window()) -+ fl_clipboard_notify_target(fl_xid(Fl::first_window())); -+} -+ - //////////////////////////////////////////////////////////////// - char fl_is_ime = 0; - void fl_get_codepage() -@@ -1327,6 +1359,27 @@ - Fl::handle(FL_SCREEN_CONFIGURATION_CHANGED, NULL); - return 0; - -+ case WM_CHANGECBCHAIN: -+ if ((hWnd == clipboard_wnd) && -+ (next_clipboard_wnd == (HWND)wParam)) { -+ next_clipboard_wnd = (HWND)lParam; -+ return 0; -+ } -+ break; -+ -+ case WM_DRAWCLIPBOARD: -+ // When the clipboard moves between two FLTK windows, -+ // fl_i_own_selection will temporarily be false as we are -+ // processing this message. Hence the need to use fl_find(). -+ if (!initial_clipboard && !fl_find(GetClipboardOwner())) -+ fl_trigger_clipboard_notify(1); -+ initial_clipboard = false; -+ -+ if (next_clipboard_wnd) -+ SendMessage(next_clipboard_wnd, WM_DRAWCLIPBOARD, wParam, lParam); -+ -+ return 0; -+ - default: - if (Fl::handle(0,0)) return 0; - break; -@@ -1685,6 +1738,8 @@ - x->next = Fl_X::first; - Fl_X::first = x; - -+ fl_clipboard_notify_target(x->xid); -+ - x->wait_for_expose = 1; - if (fl_show_iconic) {showit = 0; fl_show_iconic = 0;} - if (showit) { diff --git a/contrib/packages/rpm/el6/SOURCES/fltk-1_v3.3.0-icons.patch b/contrib/packages/rpm/el6/SOURCES/fltk-1_v3.3.0-icons.patch deleted file mode 100644 index 20b30b8..0000000 --- a/contrib/packages/rpm/el6/SOURCES/fltk-1_v3.3.0-icons.patch +++ /dev/null @@ -1,645 +0,0 @@ -diff -ur fltk-1.3.2.org/FL/Fl_Window.H fltk-1.3.2/FL/Fl_Window.H ---- fltk-1.3.2.org/FL/Fl_Window.H 2013-01-16 10:49:40.904228200 +0100 -+++ fltk-1.3.2/FL/Fl_Window.H 2013-01-16 10:49:55.554353925 +0100 -@@ -22,6 +22,10 @@ - #ifndef Fl_Window_H - #define Fl_Window_H - -+#ifdef WIN32 -+#include -+#endif -+ - #include "Fl_Group.H" - - #define FL_WINDOW 0xF0 ///< window type id all subclasses have type() >= this -@@ -73,9 +77,19 @@ - friend class Fl_X; - Fl_X *i; // points at the system-specific stuff - -+ struct icon_data { -+ const void *legacy_icon; -+ Fl_RGB_Image **icons; -+ int count; -+#ifdef WIN32 -+ HICON big_icon; -+ HICON small_icon; -+#endif -+ }; -+ - const char* iconlabel_; - char* xclass_; -- const void* icon_; -+ struct icon_data *icon_; - // size_range stuff: - int minw, minh, maxw, maxh; - int dw, dh, aspect; -@@ -121,6 +135,8 @@ - */ - int force_position() const { return ((flags() & FORCE_POSITION)?1:0); } - -+ void free_icons(); -+ - public: - - /** -@@ -350,6 +366,18 @@ - static const char *default_xclass(); - const char* xclass() const; - void xclass(const char* c); -+ -+ static void default_icon(const Fl_RGB_Image*); -+ static void default_icons(const Fl_RGB_Image*[], int); -+ void icon(const Fl_RGB_Image*); -+ void icons(const Fl_RGB_Image*[], int); -+ -+#ifdef WIN32 -+ static void default_icons(HICON big_icon, HICON small_icon); -+ void icons(HICON big_icon, HICON small_icon); -+#endif -+ -+ /* for legacy compatibility */ - const void* icon() const; - void icon(const void * ic); - -diff -ur fltk-1.3.2.org/FL/mac.H fltk-1.3.2/FL/mac.H ---- fltk-1.3.2.org/FL/mac.H 2013-01-16 10:49:40.904228200 +0100 -+++ fltk-1.3.2/FL/mac.H 2013-01-16 10:49:55.554353925 +0100 -@@ -120,6 +120,9 @@ - void collapse(void); - WindowRef window_ref(void); - void set_key_window(void); -+ // OS X doesn't have per window icons -+ static void set_default_icons(const Fl_RGB_Image*[], int) {}; -+ void set_icons() {}; - int set_cursor(Fl_Cursor); - int set_cursor(const Fl_RGB_Image*, int, int); - static CGImageRef CGImage_from_window_rect(Fl_Window *win, int x, int y, int w, int h); -diff -ur fltk-1.3.2.org/FL/win32.H fltk-1.3.2/FL/win32.H ---- fltk-1.3.2.org/FL/win32.H 2013-01-16 10:49:40.904228200 +0100 -+++ fltk-1.3.2/FL/win32.H 2013-01-16 10:49:55.555355617 +0100 -@@ -84,6 +84,9 @@ - void flush() {w->flush();} - void set_minmax(LPMINMAXINFO minmax); - void mapraise(); -+ static void set_default_icons(const Fl_RGB_Image*[], int); -+ static void set_default_icons(HICON, HICON); -+ void set_icons(); - int set_cursor(Fl_Cursor); - int set_cursor(const Fl_RGB_Image*, int, int); - static Fl_X* make(Fl_Window*); -diff -ur fltk-1.3.2.org/FL/x.H fltk-1.3.2/FL/x.H ---- fltk-1.3.2.org/FL/x.H 2013-01-16 10:49:40.904228200 +0100 -+++ fltk-1.3.2/FL/x.H 2013-01-16 10:49:55.555355617 +0100 -@@ -154,6 +154,8 @@ - static Fl_X* i(const Fl_Window* wi) {return wi->i;} - void setwindow(Fl_Window* wi) {w=wi; wi->i=this;} - void sendxjunk(); -+ static void set_default_icons(const Fl_RGB_Image*[], int); -+ void set_icons(); - int set_cursor(Fl_Cursor); - int set_cursor(const Fl_RGB_Image*, int, int); - static void make_xid(Fl_Window*,XVisualInfo* =fl_visual, Colormap=fl_colormap); -diff -ur fltk-1.3.2.org/src/Fl.cxx fltk-1.3.2/src/Fl.cxx ---- fltk-1.3.2.org/src/Fl.cxx 2013-01-16 10:49:40.895228113 +0100 -+++ fltk-1.3.2/src/Fl.cxx 2013-01-16 10:49:55.556137979 +0100 -@@ -1530,6 +1530,8 @@ - if (xclass_) { - free(xclass_); - } -+ free_icons(); -+ delete icon_; - } - - // FL_SHOW and FL_HIDE are called whenever the visibility of this widget -diff -ur fltk-1.3.2.org/src/Fl_win32.cxx fltk-1.3.2/src/Fl_win32.cxx ---- fltk-1.3.2.org/src/Fl_win32.cxx 2013-01-16 10:49:40.911227539 +0100 -+++ fltk-1.3.2/src/Fl_win32.cxx 2013-01-16 10:49:55.556137979 +0100 -@@ -1804,6 +1804,8 @@ - ); - if (lab) free(lab); - -+ x->set_icons(); -+ - if (w->fullscreen_active()) { - /* We need to make sure that the fullscreen is created on the - default monitor, ie the desktop where the shortcut is located -@@ -2034,71 +2036,19 @@ - - //////////////////////////////////////////////////////////////// - --#ifndef IDC_HAND --# define IDC_HAND MAKEINTRESOURCE(32649) --#endif // !IDC_HAND -- --int Fl_X::set_cursor(Fl_Cursor c) { -- LPSTR n; -- HCURSOR new_cursor; -- -- if (c == FL_CURSOR_NONE) -- new_cursor = NULL; -- else { -- switch (c) { -- case FL_CURSOR_ARROW: n = IDC_ARROW; break; -- case FL_CURSOR_CROSS: n = IDC_CROSS; break; -- case FL_CURSOR_WAIT: n = IDC_WAIT; break; -- case FL_CURSOR_INSERT: n = IDC_IBEAM; break; -- case FL_CURSOR_HAND: n = IDC_HAND; break; -- case FL_CURSOR_HELP: n = IDC_HELP; break; -- case FL_CURSOR_MOVE: n = IDC_SIZEALL; break; -- case FL_CURSOR_N: -- case FL_CURSOR_S: -- // FIXME: Should probably have fallbacks for these instead -- case FL_CURSOR_NS: n = IDC_SIZENS; break; -- case FL_CURSOR_NE: -- case FL_CURSOR_SW: -- // FIXME: Dito. -- case FL_CURSOR_NESW: n = IDC_SIZENESW; break; -- case FL_CURSOR_E: -- case FL_CURSOR_W: -- // FIXME: Dito. -- case FL_CURSOR_WE: n = IDC_SIZEWE; break; -- case FL_CURSOR_SE: -- case FL_CURSOR_NW: -- // FIXME: Dito. -- case FL_CURSOR_NWSE: n = IDC_SIZENWSE; break; -- default: -- return 0; -- } -- -- new_cursor = LoadCursor(NULL, n); -- if (new_cursor == NULL) -- return 0; -- } -- -- if ((cursor != NULL) && custom_cursor) -- DestroyIcon(cursor); -- -- cursor = new_cursor; -- custom_cursor = 0; -- -- SetCursor(cursor); -- -- return 1; --} -- --int Fl_X::set_cursor(const Fl_RGB_Image *image, int hotx, int hoty) { -+static HICON image_to_icon(const Fl_RGB_Image *image, bool is_icon=true, -+ int hotx = 0, int hoty = 0) { - BITMAPV5HEADER bi; - HBITMAP bitmap, mask; - DWORD *bits; -- HCURSOR new_cursor; -+ HICON icon; - -+ if (!is_icon) { - if ((hotx < 0) || (hotx >= image->w())) -- return 0; -+ return NULL; - if ((hoty < 0) || (hoty >= image->h())) -- return 0; -+ return NULL; -+ } - - memset(&bi, 0, sizeof(BITMAPV5HEADER)); - -@@ -2120,7 +2070,7 @@ - ReleaseDC(NULL, hdc); - - if (bits == NULL) -- return 0; -+ return NULL; - - const uchar *i = (const uchar*)*image->data(); - for (int y = 0;y < image->h();y++) { -@@ -2149,22 +2099,206 @@ - mask = CreateBitmap(image->w(),image->h(),1,1,NULL); - if (mask == NULL) { - DeleteObject(bitmap); -- return 0; -+ return NULL; - } - - ICONINFO ii; - -- ii.fIcon = FALSE; -+ ii.fIcon = is_icon; - ii.xHotspot = hotx; - ii.yHotspot = hoty; - ii.hbmMask = mask; - ii.hbmColor = bitmap; - -- new_cursor = CreateIconIndirect(&ii); -+ icon = CreateIconIndirect(&ii); - - DeleteObject(bitmap); - DeleteObject(mask); - -+ if (icon == NULL) -+ return NULL; -+ -+ return icon; -+} -+ -+//////////////////////////////////////////////////////////////// -+ -+static HICON default_big_icon = NULL; -+static HICON default_small_icon = NULL; -+ -+const Fl_RGB_Image *find_best_icon(int ideal_width, -+ const Fl_RGB_Image *icons[], int count) { -+ const Fl_RGB_Image *best; -+ -+ best = NULL; -+ -+ for (int i = 0;i < count;i++) { -+ if (best == NULL) -+ best = icons[i]; -+ else { -+ if (best->w() < ideal_width) { -+ if (icons[i]->w() > best->w()) -+ best = icons[i]; -+ } else { -+ if ((icons[i]->w() >= ideal_width) && -+ (icons[i]->w() < best->w())) -+ best = icons[i]; -+ } -+ } -+ } -+ -+ return best; -+} -+ -+void Fl_X::set_default_icons(const Fl_RGB_Image *icons[], int count) { -+ const Fl_RGB_Image *best_big, *best_small; -+ -+ if (default_big_icon != NULL) -+ DestroyIcon(default_big_icon); -+ if (default_small_icon != NULL) -+ DestroyIcon(default_small_icon); -+ -+ best_big = find_best_icon(GetSystemMetrics(SM_CXICON), icons, count); -+ best_small = find_best_icon(GetSystemMetrics(SM_CXSMICON), icons, count); -+ -+ if (best_big != NULL) -+ default_big_icon = image_to_icon(best_big); -+ else -+ default_big_icon = NULL; -+ -+ if (best_small != NULL) -+ default_small_icon = image_to_icon(best_small); -+ else -+ default_small_icon = NULL; -+} -+ -+void Fl_X::set_default_icons(HICON big_icon, HICON small_icon) { -+ if (default_big_icon != NULL) -+ DestroyIcon(default_big_icon); -+ if (default_small_icon != NULL) -+ DestroyIcon(default_small_icon); -+ -+ if (big_icon != NULL) -+ default_big_icon = CopyIcon(big_icon); -+ if (small_icon != NULL) -+ default_small_icon = CopyIcon(small_icon); -+} -+ -+void Fl_X::set_icons() { -+ HICON big_icon, small_icon; -+ -+ big_icon = NULL; -+ small_icon = NULL; -+ -+ if (w->icon_->count) { -+ const Fl_RGB_Image *best_big, *best_small; -+ -+ best_big = find_best_icon(GetSystemMetrics(SM_CXICON), -+ (const Fl_RGB_Image **)w->icon_->icons, -+ w->icon_->count); -+ best_small = find_best_icon(GetSystemMetrics(SM_CXSMICON), -+ (const Fl_RGB_Image **)w->icon_->icons, -+ w->icon_->count); -+ -+ if (best_big != NULL) -+ big_icon = image_to_icon(best_big); -+ if (best_small != NULL) -+ small_icon = image_to_icon(best_small); -+ } else { -+ big_icon = default_big_icon; -+ small_icon = default_small_icon; -+ } -+ -+ if (big_icon != NULL) -+ SendMessage(xid, WM_SETICON, ICON_BIG, (LPARAM)big_icon); -+ if (small_icon != NULL) -+ SendMessage(xid, WM_SETICON, ICON_SMALL, (LPARAM)small_icon); -+ -+ if (w->icon_->count) { -+ if (big_icon != NULL) -+ DestroyIcon(big_icon); -+ if (small_icon != NULL) -+ DestroyIcon(small_icon); -+ } -+} -+ -+void Fl_Window::default_icons(HICON big_icon, HICON small_icon) { -+ Fl_X::set_default_icons(big_icon, small_icon); -+} -+ -+void Fl_Window::icons(HICON big_icon, HICON small_icon) { -+ free_icons(); -+ -+ if (big_icon != NULL) -+ icon_->big_icon = CopyIcon(big_icon); -+ if (small_icon != NULL) -+ icon_->small_icon = CopyIcon(small_icon); -+ -+ if (i) -+ i->set_icons(); -+} -+ -+//////////////////////////////////////////////////////////////// -+ -+#ifndef IDC_HAND -+# define IDC_HAND MAKEINTRESOURCE(32649) -+#endif // !IDC_HAND -+ -+int Fl_X::set_cursor(Fl_Cursor c) { -+ LPSTR n; -+ HCURSOR new_cursor; -+ -+ if (c == FL_CURSOR_NONE) -+ new_cursor = NULL; -+ else { -+ switch (c) { -+ case FL_CURSOR_ARROW: n = IDC_ARROW; break; -+ case FL_CURSOR_CROSS: n = IDC_CROSS; break; -+ case FL_CURSOR_WAIT: n = IDC_WAIT; break; -+ case FL_CURSOR_INSERT: n = IDC_IBEAM; break; -+ case FL_CURSOR_HAND: n = IDC_HAND; break; -+ case FL_CURSOR_HELP: n = IDC_HELP; break; -+ case FL_CURSOR_MOVE: n = IDC_SIZEALL; break; -+ case FL_CURSOR_N: -+ case FL_CURSOR_S: -+ // FIXME: Should probably have fallbacks for these instead -+ case FL_CURSOR_NS: n = IDC_SIZENS; break; -+ case FL_CURSOR_NE: -+ case FL_CURSOR_SW: -+ // FIXME: Dito. -+ case FL_CURSOR_NESW: n = IDC_SIZENESW; break; -+ case FL_CURSOR_E: -+ case FL_CURSOR_W: -+ // FIXME: Dito. -+ case FL_CURSOR_WE: n = IDC_SIZEWE; break; -+ case FL_CURSOR_SE: -+ case FL_CURSOR_NW: -+ // FIXME: Dito. -+ case FL_CURSOR_NWSE: n = IDC_SIZENWSE; break; -+ default: -+ return 0; -+ } -+ -+ new_cursor = LoadCursor(NULL, n); -+ if (new_cursor == NULL) -+ return 0; -+ } -+ -+ if ((cursor != NULL) && custom_cursor) -+ DestroyIcon(cursor); -+ -+ cursor = new_cursor; -+ custom_cursor = 0; -+ -+ SetCursor(cursor); -+ -+ return 1; -+} -+ -+int Fl_X::set_cursor(const Fl_RGB_Image *image, int hotx, int hoty) { -+ HCURSOR new_cursor; -+ -+ new_cursor = image_to_icon(image, false, hotx, hoty); - if (new_cursor == NULL) - return 0; - -diff -ur fltk-1.3.2.org/src/Fl_Window.cxx fltk-1.3.2/src/Fl_Window.cxx ---- fltk-1.3.2.org/src/Fl_Window.cxx 2013-01-16 10:49:40.908130903 +0100 -+++ fltk-1.3.2/src/Fl_Window.cxx 2013-01-16 10:49:55.557353865 +0100 -@@ -23,6 +23,7 @@ - #include - #include - #include -+#include - #include - #include - #include "flstring.h" -@@ -45,7 +46,8 @@ - } - i = 0; - xclass_ = 0; -- icon_ = 0; -+ icon_ = new icon_data; -+ memset(icon_, 0, sizeof(*icon_)); - iconlabel_ = 0; - resizable(0); - size_range_set = 0; -@@ -264,16 +266,68 @@ - } - } - -+void Fl_Window::default_icon(const Fl_RGB_Image *icon) { -+ default_icons(&icon, 1); -+} -+ -+void Fl_Window::default_icons(const Fl_RGB_Image **icons, int count) { -+ Fl_X::set_default_icons(icons, count); -+} -+ -+void Fl_Window::icon(const Fl_RGB_Image *icon) { -+ icons(&icon, 1); -+} -+ -+void Fl_Window::icons(const Fl_RGB_Image **icons, int count) { -+ free_icons(); -+ -+ if (count > 0) { -+ icon_->icons = new Fl_RGB_Image*[count]; -+ icon_->count = count; -+ // FIXME: Fl_RGB_Image lacks const modifiers on methods -+ for (int i = 0;i < count;i++) -+ icon_->icons[i] = (Fl_RGB_Image*)((Fl_RGB_Image*)icons[i])->copy(); -+ } -+ -+ if (i) -+ i->set_icons(); -+} -+ - /** Gets the current icon window target dependent data. */ - const void *Fl_Window::icon() const { -- return icon_; -+ return icon_->legacy_icon; - } - - /** Sets the current icon window target dependent data. */ - void Fl_Window::icon(const void * ic) { -- icon_ = ic; -+ free_icons(); -+ icon_->legacy_icon = ic; - } - -+void Fl_Window::free_icons() { -+ int i; -+ -+ icon_->legacy_icon = 0L; -+ -+ if (icon_->icons) { -+ for (i = 0;i < icon_->count;i++) -+ delete icon_->icons[i]; -+ delete [] icon_->icons; -+ icon_->icons = 0L; -+ } -+ -+ icon_->count = 0; -+ -+#ifdef WIN32 -+ if (icon_->big_icon) -+ DestroyIcon(icon_->big_icon); -+ if (icon_->small_icon) -+ DestroyIcon(icon_->small_icon); -+ -+ icon_->big_icon = NULL; -+ icon_->small_icon = NULL; -+#endif -+} - - // - // End of "$Id: Fl_Window.cxx 9706 2012-11-06 20:46:14Z matt $". -diff -ur fltk-1.3.2.org/src/Fl_x.cxx fltk-1.3.2/src/Fl_x.cxx ---- fltk-1.3.2.org/src/Fl_x.cxx 2013-01-16 10:49:40.912227213 +0100 -+++ fltk-1.3.2/src/Fl_x.cxx 2013-01-16 10:49:55.558137113 +0100 -@@ -345,6 +345,7 @@ - Atom fl_NET_WM_STATE; - Atom fl_NET_WM_STATE_FULLSCREEN; - Atom fl_NET_WORKAREA; -+Atom fl_NET_WM_ICON; - - /* - X defines 32-bit-entities to have a format value of max. 32, -@@ -709,6 +710,7 @@ - fl_NET_WM_STATE = XInternAtom(d, "_NET_WM_STATE", 0); - fl_NET_WM_STATE_FULLSCREEN = XInternAtom(d, "_NET_WM_STATE_FULLSCREEN", 0); - fl_NET_WORKAREA = XInternAtom(d, "_NET_WORKAREA", 0); -+ fl_NET_WM_ICON = XInternAtom(d, "_NET_WM_ICON", 0); - - if (sizeof(Atom) < 4) - atom_bits = sizeof(Atom) * 8; -@@ -2138,12 +2140,14 @@ - fl_show_iconic = 0; - showit = 0; - } -- if (win->icon()) { -- hints->icon_pixmap = (Pixmap)win->icon(); -+ if (win->icon_->legacy_icon) { -+ hints->icon_pixmap = (Pixmap)win->icon_->legacy_icon; - hints->flags |= IconPixmapHint; - } - XSetWMHints(fl_display, xp->xid, hints); - XFree(hints); -+ -+ xp->set_icons(); - } - - // set the window type for menu and tooltip windows to avoid animations (compiz) -@@ -2263,6 +2267,93 @@ - - //////////////////////////////////////////////////////////////// - -+static unsigned long *default_net_wm_icons = 0L; -+static size_t default_net_wm_icons_size = 0; -+ -+void icons_to_property(const Fl_RGB_Image *icons[], int count, -+ unsigned long **property, size_t *len) { -+ size_t sz; -+ unsigned long *data; -+ -+ sz = 0; -+ for (int i = 0;i < count;i++) -+ sz += 2 + icons[i]->w() * icons[i]->h(); -+ -+ // FIXME: Might want to sort the icons -+ -+ *property = data = new unsigned long[sz]; -+ *len = sz; -+ -+ for (int i = 0;i < count;i++) { -+ const Fl_RGB_Image *image; -+ -+ image = icons[i]; -+ -+ data[0] = image->w(); -+ data[1] = image->h(); -+ data += 2; -+ -+ const uchar *in = (const uchar*)*image->data(); -+ for (int y = 0;y < image->h();y++) { -+ for (int x = 0;x < image->w();x++) { -+ switch (image->d()) { -+ case 1: -+ *data = ( 0xff<<24) | (in[0]<<16) | (in[0]<<8) | in[0]; -+ break; -+ case 2: -+ *data = (in[1]<<24) | (in[0]<<16) | (in[0]<<8) | in[0]; -+ break; -+ case 3: -+ *data = ( 0xff<<24) | (in[0]<<16) | (in[1]<<8) | in[2]; -+ break; -+ case 4: -+ *data = (in[3]<<24) | (in[0]<<16) | (in[1]<<8) | in[2]; -+ break; -+ } -+ in += image->d(); -+ data++; -+ } -+ in += image->ld(); -+ } -+ } -+} -+ -+void Fl_X::set_default_icons(const Fl_RGB_Image *icons[], int count) { -+ if (default_net_wm_icons) { -+ delete [] default_net_wm_icons; -+ default_net_wm_icons = 0L; -+ default_net_wm_icons_size = 0; -+ } -+ -+ if (count > 0) -+ icons_to_property(icons, count, -+ &default_net_wm_icons, &default_net_wm_icons_size); -+} -+ -+void Fl_X::set_icons() { -+ unsigned long *net_wm_icons; -+ size_t net_wm_icons_size; -+ -+ if (w->icon_->count) { -+ icons_to_property((const Fl_RGB_Image **)w->icon_->icons, w->icon_->count, -+ &net_wm_icons, &net_wm_icons_size); -+ } else { -+ net_wm_icons = default_net_wm_icons; -+ net_wm_icons_size = default_net_wm_icons_size; -+ } -+ -+ XChangeProperty (fl_display, xid, fl_NET_WM_ICON, XA_CARDINAL, 32, -+ PropModeReplace, (unsigned char*) net_wm_icons, net_wm_icons_size); -+ -+ if (w->icon_->count) { -+ delete [] net_wm_icons; -+ net_wm_icons = 0L; -+ net_wm_icons_size = 0; -+ } -+} -+ -+//////////////////////////////////////////////////////////////// -+ - int Fl_X::set_cursor(Fl_Cursor c) { - unsigned int shape; - Cursor xc; diff --git a/contrib/packages/rpm/el6/SOURCES/fltk-1_v3.3.x-clipboard-win32-fix.patch b/contrib/packages/rpm/el6/SOURCES/fltk-1_v3.3.x-clipboard-win32-fix.patch deleted file mode 100644 index b41af79..0000000 --- a/contrib/packages/rpm/el6/SOURCES/fltk-1_v3.3.x-clipboard-win32-fix.patch +++ /dev/null @@ -1,135 +0,0 @@ -diff -ur fltk-1.3.0r9110.org/src/Fl_win32.cxx fltk-1.3.0r9110/src/Fl_win32.cxx ---- fltk-1.3.0r9110.org/src/Fl_win32.cxx 2012-06-17 19:42:02.169422400 +0200 -+++ fltk-1.3.0r9110/src/Fl_win32.cxx 2012-06-17 19:43:38.286031455 +0200 -@@ -543,6 +543,37 @@ - const char* GetValue() const { return(out); } - }; - -+void fl_update_clipboard(void) { -+ Fl_Window *w1 = Fl::first_window(); -+ if (!w1) -+ return; -+ -+ HWND hwnd = fl_xid(w1); -+ -+ if (!OpenClipboard(hwnd)) -+ return; -+ -+ EmptyClipboard(); -+ -+ int utf16_len = fl_utf8toUtf16(fl_selection_buffer[1], -+ fl_selection_length[1], 0, 0); -+ -+ HGLOBAL hMem = GlobalAlloc(GHND, utf16_len * 2 + 2); // moveable and zero'ed mem alloc. -+ LPVOID memLock = GlobalLock(hMem); -+ -+ fl_utf8toUtf16(fl_selection_buffer[1], fl_selection_length[1], -+ (unsigned short*) memLock, utf16_len + 1); -+ -+ GlobalUnlock(hMem); -+ SetClipboardData(CF_UNICODETEXT, hMem); -+ -+ CloseClipboard(); -+ -+ // In case Windows managed to lob of a WM_DESTROYCLIPBOARD during -+ // the above. -+ fl_i_own_selection[1] = 1; -+} -+ - // call this when you create a selection: - void Fl::copy(const char *stuff, int len, int clipboard) { - if (!stuff || len<0) return; -@@ -560,25 +591,9 @@ - memcpy(fl_selection_buffer[clipboard], stuff, len); - fl_selection_buffer[clipboard][len] = 0; // needed for direct paste - fl_selection_length[clipboard] = len; -- if (clipboard) { -- // set up for "delayed rendering": -- if (OpenClipboard(NULL)) { -- // if the system clipboard works, use it -- int utf16_len = fl_utf8toUtf16(fl_selection_buffer[clipboard], fl_selection_length[clipboard], 0, 0); -- EmptyClipboard(); -- HGLOBAL hMem = GlobalAlloc(GHND, utf16_len * 2 + 2); // moveable and zero'ed mem alloc. -- LPVOID memLock = GlobalLock(hMem); -- fl_utf8toUtf16(fl_selection_buffer[clipboard], fl_selection_length[clipboard], (unsigned short*) memLock, utf16_len + 1); -- GlobalUnlock(hMem); -- SetClipboardData(CF_UNICODETEXT, hMem); -- CloseClipboard(); -- GlobalFree(hMem); -- fl_i_own_selection[clipboard] = 0; -- } else { -- // only if it fails, instruct paste() to use the internal buffers -- fl_i_own_selection[clipboard] = 1; -- } -- } -+ fl_i_own_selection[clipboard] = 1; -+ if (clipboard) -+ fl_update_clipboard(); - } - - // Call this when a "paste" operation happens: -@@ -1307,33 +1322,6 @@ - fl_i_own_selection[1] = 0; - return 1; - -- case WM_RENDERALLFORMATS: -- fl_i_own_selection[1] = 0; -- // Windoze seems unhappy unless I do these two steps. Documentation -- // seems to vary on whether opening the clipboard is necessary or -- // is in fact wrong: -- CloseClipboard(); -- OpenClipboard(NULL); -- // fall through... -- case WM_RENDERFORMAT: { -- HANDLE h; -- --// int l = fl_utf_nb_char((unsigned char*)fl_selection_buffer[1], fl_selection_length[1]); -- int l = fl_utf8toUtf16(fl_selection_buffer[1], fl_selection_length[1], NULL, 0); // Pass NULL buffer to query length required -- h = GlobalAlloc(GHND, (l+1) * sizeof(unsigned short)); -- if (h) { -- unsigned short *g = (unsigned short*) GlobalLock(h); --// fl_utf2unicode((unsigned char *)fl_selection_buffer[1], fl_selection_length[1], (xchar*)g); -- l = fl_utf8toUtf16(fl_selection_buffer[1], fl_selection_length[1], g, (l+1)); -- g[l] = 0; -- GlobalUnlock(h); -- SetClipboardData(CF_UNICODETEXT, h); -- } -- -- // Windoze also seems unhappy if I don't do this. Documentation very -- // unclear on what is correct: -- if (fl_msg.message == WM_RENDERALLFORMATS) CloseClipboard(); -- return 1;} - case WM_DISPLAYCHANGE: // occurs when screen configuration (number, position) changes - Fl::call_screen_init(); - Fl::handle(FL_SCREEN_CONFIGURATION_CHANGED, NULL); -diff -ur fltk-1.3.0r9110.org/src/Fl.cxx fltk-1.3.0r9110/src/Fl.cxx ---- fltk-1.3.0r9110.org/src/Fl.cxx 2012-06-17 19:42:02.173422595 +0200 -+++ fltk-1.3.0r9110/src/Fl.cxx 2012-06-17 19:42:02.317429497 +0200 -@@ -1420,7 +1420,9 @@ - //////////////////////////////////////////////////////////////// - // hide() destroys the X window, it does not do unmap! - --#if !defined(WIN32) && USE_XFT -+#if defined(WIN32) -+extern void fl_update_clipboard(void); -+#elif USE_XFT - extern void fl_destroy_xft_draw(Window); - #endif - -@@ -1467,14 +1469,8 @@ - #if defined(WIN32) - // this little trick keeps the current clipboard alive, even if we are about - // to destroy the window that owns the selection. -- if (GetClipboardOwner()==ip->xid) { -- Fl_Window *w1 = Fl::first_window(); -- if (w1 && OpenClipboard(fl_xid(w1))) { -- EmptyClipboard(); -- SetClipboardData(CF_TEXT, NULL); -- CloseClipboard(); -- } -- } -+ if (GetClipboardOwner()==ip->xid) -+ fl_update_clipboard(); - // Send a message to myself so that I'll get out of the event loop... - PostMessage(ip->xid, WM_APP, 0, 0); - if (ip->private_dc) fl_release_dc(ip->xid, ip->private_dc); diff --git a/contrib/packages/rpm/el6/SOURCES/fltk-1_v3.3.x-multihead.patch b/contrib/packages/rpm/el6/SOURCES/fltk-1_v3.3.x-multihead.patch deleted file mode 100644 index e4a010a..0000000 --- a/contrib/packages/rpm/el6/SOURCES/fltk-1_v3.3.x-multihead.patch +++ /dev/null @@ -1,468 +0,0 @@ -diff -urp fltk-1.3.2.org/FL/Fl_Window.H fltk-1.3.2/FL/Fl_Window.H ---- fltk-1.3.2.org/FL/Fl_Window.H 2013-01-16 10:52:33.017228122 +0100 -+++ fltk-1.3.2/FL/Fl_Window.H 2013-01-16 10:52:47.876478968 +0100 -@@ -54,7 +54,7 @@ class Fl_RGB_Image; - class FL_EXPORT Fl_Window : public Fl_Group { - - static char *default_xclass_; -- // Note: we must use separate statements for each of the following 4 variables, -+ // Note: we must use separate statements for each of the following 8 variables, - // with the static attribute, otherwise MS VC++ 2008/2010 complains :-( - // AlbrechtS 04/2012 - #if FLTK_ABI_VERSION < 10301 -@@ -73,6 +73,22 @@ class FL_EXPORT Fl_Window : public Fl_Gr - static // when these members are static, ABI compatibility with 1.3.0 is respected - #endif - int no_fullscreen_h; -+#if FLTK_ABI_VERSION < 10302 -+ static // when these members are static, ABI compatibility with 1.3.0 is respected -+#endif -+ int fullscreen_screen_top; -+#if FLTK_ABI_VERSION < 10302 -+ static // when these members are static, ABI compatibility with 1.3.0 is respected -+#endif -+ int fullscreen_screen_bottom; -+#if FLTK_ABI_VERSION < 10302 -+ static // when these members are static, ABI compatibility with 1.3.0 is respected -+#endif -+ int fullscreen_screen_left; -+#if FLTK_ABI_VERSION < 10302 -+ static // when these members are static, ABI compatibility with 1.3.0 is respected -+#endif -+ int fullscreen_screen_right; - - friend class Fl_X; - Fl_X *i; // points at the system-specific stuff -@@ -430,13 +446,15 @@ public: - */ - void show(int argc, char **argv); - /** -- Makes the window completely fill the screen, without any window -- manager border visible. You must use fullscreen_off() to undo -- this. -+ Makes the window completely fill one or more screens, without any -+ window manager border visible. You must use fullscreen_off() to -+ undo this. - - \note On some platforms, this can result in the keyboard being - grabbed. The window may also be recreated, meaning hide() and - show() will be called. -+ -+ \see void Fl_Window::fullscreen_screens() - */ - void fullscreen(); - /** -@@ -453,6 +471,17 @@ public: - */ - unsigned int fullscreen_active() const { return flags() & FULLSCREEN; } - /** -+ Sets which screens should be used when this window is in fullscreen -+ mode. The window will be resized to the top of the screen with index -+ \p top, the bottom of the screen with index \p bottom, etc. -+ -+ If this method is never called, or if any argument is < 0, then the -+ window will be resized to fill the screen it is currently on. -+ -+ \see void Fl_Window::fullscreen() -+ */ -+ void fullscreen_screens(int top, int bottom, int left, int right); -+ /** - Iconifies the window. If you call this when shown() is false - it will show() it as an icon. If the window is already - iconified this does nothing. -diff -urp fltk-1.3.2.org/FL/win32.H fltk-1.3.2/FL/win32.H ---- fltk-1.3.2.org/FL/win32.H 2013-01-16 10:52:33.017228122 +0100 -+++ fltk-1.3.2/FL/win32.H 2013-01-16 10:52:47.876478968 +0100 -@@ -80,6 +80,7 @@ public: - static Fl_X* i(const Fl_Window* w) {return w->i;} - static int fake_X_wm(const Fl_Window* w,int &X, int &Y, - int &bt,int &bx,int &by); -+ void make_fullscreen(int X, int Y, int W, int H); - void setwindow(Fl_Window* wi) {w=wi; wi->i=this;} - void flush() {w->flush();} - void set_minmax(LPMINMAXINFO minmax); -diff -urp fltk-1.3.2.org/src/Fl_cocoa.mm fltk-1.3.2/src/Fl_cocoa.mm ---- fltk-1.3.2.org/src/Fl_cocoa.mm 2013-01-16 10:52:33.014229574 +0100 -+++ fltk-1.3.2/src/Fl_cocoa.mm 2013-01-16 10:52:47.877480606 +0100 -@@ -2438,9 +2438,32 @@ void Fl_X::make(Fl_Window* w) - - NSRect crect; - if (w->fullscreen_active()) { -- int sx, sy, sw, sh; -- Fl::screen_xywh(sx, sy, sw, sh, w->x(), w->y(), w->w(), w->h()); -- w->resize(sx, sy, sw, sh); -+ int top, bottom, left, right; -+ int sx, sy, sw, sh, X, Y, W, H; -+ -+ top = w->fullscreen_screen_top; -+ bottom = w->fullscreen_screen_bottom; -+ left = w->fullscreen_screen_left; -+ right = w->fullscreen_screen_right; -+ -+ if ((top < 0) || (bottom < 0) || (left < 0) || (right < 0)) { -+ top = Fl::screen_num(w->x(), w->y(), w->w(), w->h()); -+ bottom = top; -+ left = top; -+ right = top; -+ } -+ -+ Fl::screen_xywh(sx, sy, sw, sh, top); -+ Y = sy; -+ Fl::screen_xywh(sx, sy, sw, sh, bottom); -+ H = sy + sh - Y; -+ Fl::screen_xywh(sx, sy, sw, sh, left); -+ X = sx; -+ Fl::screen_xywh(sx, sy, sw, sh, right); -+ W = sx + sw - X; -+ -+ w->resize(X, Y, W, H); -+ - winstyle = NSBorderlessWindowMask; - winlevel = NSStatusWindowLevel; - } -diff -urp fltk-1.3.2.org/src/Fl_win32.cxx fltk-1.3.2/src/Fl_win32.cxx ---- fltk-1.3.2.org/src/Fl_win32.cxx 2013-01-16 10:52:33.019230734 +0100 -+++ fltk-1.3.2/src/Fl_win32.cxx 2013-01-16 10:52:47.878480504 +0100 -@@ -1493,7 +1493,6 @@ int Fl_X::fake_X_wm(const Fl_Window* w,i - Y+=yoff; - - if (w->fullscreen_active()) { -- X = Y = 0; - bx = by = bt = 0; - } - -@@ -1547,19 +1546,42 @@ void Fl_Window::resize(int X,int Y,int W - } - } - --static void make_fullscreen(Fl_Window *w, Window xid, int X, int Y, int W, int H) { -+void Fl_X::make_fullscreen(int X, int Y, int W, int H) { -+ int top, bottom, left, right; - int sx, sy, sw, sh; -- Fl::screen_xywh(sx, sy, sw, sh, X, Y, W, H); -+ -+ top = w->fullscreen_screen_top; -+ bottom = w->fullscreen_screen_bottom; -+ left = w->fullscreen_screen_left; -+ right = w->fullscreen_screen_right; -+ -+ if ((top < 0) || (bottom < 0) || (left < 0) || (right < 0)) { -+ top = Fl::screen_num(X, Y, W, H); -+ bottom = top; -+ left = top; -+ right = top; -+ } -+ -+ Fl::screen_xywh(sx, sy, sw, sh, top); -+ Y = sy; -+ Fl::screen_xywh(sx, sy, sw, sh, bottom); -+ H = sy + sh - Y; -+ Fl::screen_xywh(sx, sy, sw, sh, left); -+ X = sx; -+ Fl::screen_xywh(sx, sy, sw, sh, right); -+ W = sx + sw - X; -+ - DWORD flags = GetWindowLong(xid, GWL_STYLE); - flags = flags & ~(WS_THICKFRAME|WS_CAPTION); - SetWindowLong(xid, GWL_STYLE, flags); -+ - // SWP_NOSENDCHANGING is so that we can override size limits -- SetWindowPos(xid, HWND_TOP, sx, sy, sw, sh, SWP_NOSENDCHANGING | SWP_FRAMECHANGED); -+ SetWindowPos(xid, HWND_TOP, X, Y, W, H, SWP_NOSENDCHANGING | SWP_FRAMECHANGED); - } - - void Fl_Window::fullscreen_x() { - _set_fullscreen(); -- make_fullscreen(this, fl_xid(this), x(), y(), w(), h()); -+ i->make_fullscreen(x(), y(), w(), h()); - Fl::handle(FL_FULLSCREEN, this); - } - -@@ -1814,8 +1836,8 @@ Fl_X* Fl_X::make(Fl_Window* w) { - monitor the window was placed on. */ - RECT rect; - GetWindowRect(x->xid, &rect); -- make_fullscreen(w, x->xid, rect.left, rect.top, -- rect.right - rect.left, rect.bottom - rect.top); -+ x->make_fullscreen(rect.left, rect.top, -+ rect.right - rect.left, rect.bottom - rect.top); - } - - x->next = Fl_X::first; -diff -urp fltk-1.3.2.org/src/Fl_Window_fullscreen.cxx fltk-1.3.2/src/Fl_Window_fullscreen.cxx ---- fltk-1.3.2.org/src/Fl_Window_fullscreen.cxx 2012-11-06 21:46:14.000000000 +0100 -+++ fltk-1.3.2/src/Fl_Window_fullscreen.cxx 2013-01-16 10:52:47.879480608 +0100 -@@ -36,6 +36,10 @@ int Fl_Window::no_fullscreen_x = 0; - int Fl_Window::no_fullscreen_y = 0; - int Fl_Window::no_fullscreen_w = 0; - int Fl_Window::no_fullscreen_h = 0; -+int Fl_Window::fullscreen_screen_top = -1; -+int Fl_Window::fullscreen_screen_bottom = -1; -+int Fl_Window::fullscreen_screen_left = -1; -+int Fl_Window::fullscreen_screen_right = -1; - #endif - - void Fl_Window::border(int b) { -@@ -95,6 +99,23 @@ void Fl_Window::fullscreen_off() { - fullscreen_off(no_fullscreen_x, no_fullscreen_y, no_fullscreen_w, no_fullscreen_h); - } - -+void Fl_Window::fullscreen_screens(int top, int bottom, int left, int right) { -+ if ((top < 0) || (bottom < 0) || (left < 0) || (right < 0)) { -+ fullscreen_screen_top = -1; -+ fullscreen_screen_bottom = -1; -+ fullscreen_screen_left = -1; -+ fullscreen_screen_right = -1; -+ } else { -+ fullscreen_screen_top = top; -+ fullscreen_screen_bottom = bottom; -+ fullscreen_screen_left = left; -+ fullscreen_screen_right = right; -+ } -+ -+ if (shown() && (flags() & Fl_Widget::FULLSCREEN)) -+ fullscreen_x(); -+} -+ - - // - // End of "$Id: Fl_Window_fullscreen.cxx 9706 2012-11-06 20:46:14Z matt $". -diff -urp fltk-1.3.2.org/src/Fl_x.cxx fltk-1.3.2/src/Fl_x.cxx ---- fltk-1.3.2.org/src/Fl_x.cxx 2013-01-16 10:52:33.020228202 +0100 -+++ fltk-1.3.2/src/Fl_x.cxx 2013-01-16 10:52:47.880480556 +0100 -@@ -344,6 +344,7 @@ Atom fl_NET_WM_ICON_NAME; // utf8 aware - Atom fl_NET_SUPPORTING_WM_CHECK; - Atom fl_NET_WM_STATE; - Atom fl_NET_WM_STATE_FULLSCREEN; -+Atom fl_NET_WM_FULLSCREEN_MONITORS; - Atom fl_NET_WORKAREA; - Atom fl_NET_WM_ICON; - -@@ -709,6 +710,7 @@ void fl_open_display(Display* d) { - fl_NET_SUPPORTING_WM_CHECK = XInternAtom(d, "_NET_SUPPORTING_WM_CHECK", 0); - fl_NET_WM_STATE = XInternAtom(d, "_NET_WM_STATE", 0); - fl_NET_WM_STATE_FULLSCREEN = XInternAtom(d, "_NET_WM_STATE_FULLSCREEN", 0); -+ fl_NET_WM_FULLSCREEN_MONITORS = XInternAtom(d, "_NET_WM_FULLSCREEN_MONITORS", 0); - fl_NET_WORKAREA = XInternAtom(d, "_NET_WORKAREA", 0); - fl_NET_WM_ICON = XInternAtom(d, "_NET_WM_ICON", 0); - -@@ -1872,22 +1874,30 @@ void Fl_Window::resize(int X,int Y,int W - #define _NET_WM_STATE_ADD 1 /* add/set property */ - #define _NET_WM_STATE_TOGGLE 2 /* toggle property */ - --static void send_wm_state_event(Window wnd, int add, Atom prop) { -+static void send_wm_event(Window wnd, Atom message, -+ unsigned long d0, unsigned long d1=0, -+ unsigned long d2=0, unsigned long d3=0, -+ unsigned long d4=0) { - XEvent e; - e.xany.type = ClientMessage; - e.xany.window = wnd; -- e.xclient.message_type = fl_NET_WM_STATE; -+ e.xclient.message_type = message; - e.xclient.format = 32; -- e.xclient.data.l[0] = add ? _NET_WM_STATE_ADD : _NET_WM_STATE_REMOVE; -- e.xclient.data.l[1] = prop; -- e.xclient.data.l[2] = 0; -- e.xclient.data.l[3] = 0; -- e.xclient.data.l[4] = 0; -+ e.xclient.data.l[0] = d0; -+ e.xclient.data.l[1] = d1; -+ e.xclient.data.l[2] = d2; -+ e.xclient.data.l[3] = d3; -+ e.xclient.data.l[4] = d4; - XSendEvent(fl_display, RootWindow(fl_display, fl_screen), - 0, SubstructureNotifyMask | SubstructureRedirectMask, - &e); - } - -+static void send_wm_state_event(Window wnd, int add, Atom prop) { -+ send_wm_event(wnd, fl_NET_WM_STATE, -+ add ? _NET_WM_STATE_ADD : _NET_WM_STATE_REMOVE, prop); -+} -+ - int Fl_X::ewmh_supported() { - static int result = -1; - -@@ -1911,6 +1921,22 @@ int Fl_X::ewmh_supported() { - /* Change an existing window to fullscreen */ - void Fl_Window::fullscreen_x() { - if (Fl_X::ewmh_supported()) { -+ int top, bottom, left, right; -+ -+ top = fullscreen_screen_top; -+ bottom = fullscreen_screen_bottom; -+ left = fullscreen_screen_left; -+ right = fullscreen_screen_right; -+ -+ if ((top < 0) || (bottom < 0) || (left < 0) || (right < 0)) { -+ top = Fl::screen_num(x(), y(), w(), h()); -+ bottom = top; -+ left = top; -+ right = top; -+ } -+ -+ send_wm_event(fl_xid(this), fl_NET_WM_FULLSCREEN_MONITORS, -+ top, bottom, left, right); - send_wm_state_event(fl_xid(this), 1, fl_NET_WM_STATE_FULLSCREEN); - } else { - _set_fullscreen(); -@@ -1997,7 +2023,7 @@ void Fl_X::make_xid(Fl_Window* win, XVis - // force the window to be on-screen. Usually the X window manager - // does this, but a few don't, so we do it here for consistency: - int scr_x, scr_y, scr_w, scr_h; -- Fl::screen_xywh(scr_x, scr_y, scr_w, scr_h, X, Y); -+ Fl::screen_xywh(scr_x, scr_y, scr_w, scr_h, X, Y, W, H); - - if (win->border()) { - // ensure border is on screen: -@@ -2026,6 +2052,23 @@ void Fl_X::make_xid(Fl_Window* win, XVis - return; - } - -+ // Compute which screen(s) we should be on if we want to go fullscreen -+ int fullscreen_top, fullscreen_bottom, fullscreen_left, fullscreen_right; -+ -+ fullscreen_top = win->fullscreen_screen_top; -+ fullscreen_bottom = win->fullscreen_screen_bottom; -+ fullscreen_left = win->fullscreen_screen_left; -+ fullscreen_right = win->fullscreen_screen_right; -+ -+ if ((fullscreen_top < 0) || (fullscreen_bottom < 0) || -+ (fullscreen_left < 0) || (fullscreen_right < 0)) { -+ fullscreen_top = Fl::screen_num(X, Y, W, H); -+ fullscreen_bottom = fullscreen_top; -+ fullscreen_left = fullscreen_top; -+ fullscreen_right = fullscreen_top; -+ } -+ -+ - ulong root = win->parent() ? - fl_xid(win->window()) : RootWindow(fl_display, fl_screen); - -@@ -2049,9 +2092,17 @@ void Fl_X::make_xid(Fl_Window* win, XVis - // border, and cannot grab without an existing window. Besides, - // there is no clear_override(). - if (win->flags() & Fl_Widget::FULLSCREEN && !Fl_X::ewmh_supported()) { -+ int sx, sy, sw, sh; - attr.override_redirect = 1; - mask |= CWOverrideRedirect; -- Fl::screen_xywh(X, Y, W, H, X, Y, W, H); -+ Fl::screen_xywh(sx, sy, sw, sh, fullscreen_left); -+ X = sx; -+ Fl::screen_xywh(sx, sy, sw, sh, fullscreen_right); -+ W = sx + sw - X; -+ Fl::screen_xywh(sx, sy, sw, sh, fullscreen_top); -+ Y = sy; -+ Fl::screen_xywh(sx, sy, sw, sh, fullscreen_bottom); -+ H = sy + sh - Y; - } - - if (fl_background_pixel >= 0) { -@@ -2122,6 +2173,13 @@ void Fl_X::make_xid(Fl_Window* win, XVis - - // If asked for, create fullscreen - if (win->flags() & Fl_Widget::FULLSCREEN && Fl_X::ewmh_supported()) { -+ unsigned long data[4]; -+ data[0] = fullscreen_top; -+ data[1] = fullscreen_bottom; -+ data[2] = fullscreen_left; -+ data[3] = fullscreen_right; -+ XChangeProperty (fl_display, xp->xid, fl_NET_WM_FULLSCREEN_MONITORS, XA_ATOM, 32, -+ PropModeReplace, (unsigned char*) data, 4); - XChangeProperty (fl_display, xp->xid, fl_NET_WM_STATE, XA_ATOM, 32, - PropModeAppend, (unsigned char*) &fl_NET_WM_STATE_FULLSCREEN, 1); - } -diff -urp fltk-1.3.2.org/test/fullscreen.cxx fltk-1.3.2/test/fullscreen.cxx ---- fltk-1.3.2.org/test/fullscreen.cxx 2012-06-14 17:09:46.000000000 +0200 -+++ fltk-1.3.2/test/fullscreen.cxx 2013-01-16 10:52:47.881104801 +0100 -@@ -127,7 +127,7 @@ class fullscreen_window : public Fl_Sing - fullscreen_window(int W, int H, const char *t=0); - int handle (int e); - Fl_Toggle_Light_Button *b3; -- -+ Fl_Toggle_Light_Button *b4; - }; - - fullscreen_window::fullscreen_window(int W, int H, const char *t) : Fl_Single_Window(W, H, t) { -@@ -170,23 +170,54 @@ void border_cb(Fl_Widget *o, void *p) { - #endif - } - --int px,py,pw,ph; - Fl_Button *border_button; - void fullscreen_cb(Fl_Widget *o, void *p) { - Fl_Window *w = (Fl_Window *)p; - int d = ((Fl_Button *)o)->value(); - if (d) { -- px = w->x(); -- py = w->y(); -- pw = w->w(); -- ph = w->h(); -+ if (((fullscreen_window*)w)->b4->value()) { -+ int top, bottom, left, right; -+ int top_y, bottom_y, left_x, right_x; -+ -+ int sx, sy, sw, sh; -+ -+ top = bottom = left = right = 0; -+ -+ Fl::screen_xywh(sx, sy, sw, sh, 0); -+ top_y = sy; -+ bottom_y = sy + sh; -+ left_x = sx; -+ right_x = sx + sw; -+ -+ for (int i = 1;i < Fl::screen_count();i++) { -+ Fl::screen_xywh(sx, sy, sw, sh, i); -+ if (sy < top_y) { -+ top = i; -+ top_y = sy; -+ } -+ if ((sy + sh) > bottom_y) { -+ bottom = i; -+ bottom_y = sy + sh; -+ } -+ if (sx < left_x) { -+ left = i; -+ left_x = sx; -+ } -+ if ((sx + sw) > right_x) { -+ right = i; -+ right_x = sx + sw; -+ } -+ } -+ -+ w->fullscreen_screens(top, bottom, left, right); -+ } else { -+ w->fullscreen_screens(-1, -1, -1, -1); -+ } - w->fullscreen(); -- w->override(); - #ifndef WIN32 // update our border state in case border was turned off - border_button->value(w->border()); - #endif - } else { -- //w->fullscreen_off(px,py,pw,ph); - w->fullscreen_off(); - } - } -@@ -219,7 +250,7 @@ void exit_cb(Fl_Widget *, void *) { - exit(0); - } - --#define NUMB 7 -+#define NUMB 8 - - int twowindow = 0; - int initfull = 0; -@@ -284,6 +315,9 @@ int main(int argc, char **argv) { - window.b3->callback(fullscreen_cb,w); - y+=30; - -+ window.b4 = new Fl_Toggle_Light_Button(50,y,window.w()-60,30,"All Screens"); -+ y+=30; -+ - Fl_Button eb(50,y,window.w()-60,30,"Exit"); - eb.callback(exit_cb); - y+=30; diff --git a/contrib/packages/rpm/el6/SOURCES/fltk-1_v4.3.x-keyboard-win32.patch b/contrib/packages/rpm/el6/SOURCES/fltk-1_v4.3.x-keyboard-win32.patch deleted file mode 100644 index c29d3b9..0000000 --- a/contrib/packages/rpm/el6/SOURCES/fltk-1_v4.3.x-keyboard-win32.patch +++ /dev/null @@ -1,256 +0,0 @@ -diff -ur fltk-1.3.0r9293.org/src/Fl_win32.cxx fltk-1.3.0r9293/src/Fl_win32.cxx ---- fltk-1.3.0r9293.org/src/Fl_win32.cxx 2012-06-18 09:07:56.522314557 +0200 -+++ fltk-1.3.0r9293/src/Fl_win32.cxx 2012-06-18 09:08:07.392836285 +0200 -@@ -87,6 +87,8 @@ - static Fl_Display_Device fl_gdi_display(&fl_gdi_driver); - Fl_Display_Device *Fl_Display_Device::_display = &fl_gdi_display; // the platform display - -+bool use_simple_keyboard = false; -+ - // dynamic wsock dll handling api: - #if defined(__CYGWIN__) && !defined(SOCKET) - # define SOCKET int -@@ -120,6 +122,8 @@ - * size and link dependencies. - */ - static HMODULE s_imm_module = 0; -+typedef BOOL (WINAPI* flTypeImmAssociateContextEx)(HWND, HIMC, DWORD); -+static flTypeImmAssociateContextEx flImmAssociateContextEx = 0; - typedef HIMC (WINAPI* flTypeImmGetContext)(HWND); - static flTypeImmGetContext flImmGetContext = 0; - typedef BOOL (WINAPI* flTypeImmSetCompositionWindow)(HIMC, LPCOMPOSITIONFORM); -@@ -135,6 +139,7 @@ - if (!s_imm_module) - Fl::fatal("FLTK Lib Error: IMM32.DLL file not found!\n\n" - "Please check your input method manager library accessibility."); -+ flImmAssociateContextEx = (flTypeImmAssociateContextEx)GetProcAddress(s_imm_module, "ImmAssociateContextEx"); - flImmGetContext = (flTypeImmGetContext)GetProcAddress(s_imm_module, "ImmGetContext"); - flImmSetCompositionWindow = (flTypeImmSetCompositionWindow)GetProcAddress(s_imm_module, "ImmSetCompositionWindow"); - flImmReleaseContext = (flTypeImmReleaseContext)GetProcAddress(s_imm_module, "ImmReleaseContext"); -@@ -413,7 +418,12 @@ - } - } - -- TranslateMessage(&fl_msg); -+ // Don't bother with key to character translation as we do -+ // it manually for simpley keyboard widgets. In fact, calling -+ // TranslateMessage() just makes it more difficult as it sets -+ // a bunch of internal state. -+ if (!use_simple_keyboard) -+ TranslateMessage(&fl_msg); - DispatchMessageW(&fl_msg); - have_message = PeekMessageW(&fl_msg, NULL, 0, 0, PM_REMOVE); - } -@@ -638,6 +648,49 @@ - } - } - -+void fl_update_focus(void) -+{ -+ Fl_Widget *focus; -+ Fl_Window *win; -+ -+ get_imm_module(); -+ -+ focus = Fl::grab(); -+ if (!focus) -+ focus = Fl::focus(); -+ if (!focus) -+ return; -+ -+ // Grabs are special in that events are sent to the first -+ // available window -+ if (focus == Fl::grab()) -+ win = Fl::first_window(); -+ else { -+ win = focus->as_window(); -+ if (!win) -+ win = focus->window(); -+ } -+ -+ if (!win) { -+ Fl::warning("Cannot find window for widget receiving focus"); -+ return; -+ } -+ -+ // No Win32 window created yet -+ if (!Fl_X::i(win) || !fl_xid(win)) -+ return; -+ -+ if (focus->simple_keyboard()) { -+ use_simple_keyboard = true; -+ if (flImmGetContext(fl_xid(win)) != 0) -+ flImmAssociateContextEx(fl_xid(win), 0, 0); -+ } else { -+ use_simple_keyboard = false; -+ if (flImmGetContext(fl_xid(win)) == 0) -+ flImmAssociateContextEx(fl_xid(win), 0, IACE_DEFAULT); -+ } -+} -+ - HWND fl_capture; - - static int mouse_event(Fl_Window *window, int what, int button, -@@ -785,6 +838,27 @@ - return extended ? extendedlut[vk] : vklut[vk]; - } - -+static xchar msdead2fltk(xchar in) -+{ -+ switch (in) { -+ case 0x0060: // GRAVE ACCENT -+ return 0x0300; // COMBINING GRAVE ACCENT -+ case 0x00b4: // ACUTE ACCENT -+ return 0x0301; // COMBINING ACUTE ACCENT -+ case 0x005e: // CIRCUMFLEX ACCENT -+ return 0x0302; // COMBINING CIRCUMFLEX ACCENT -+ case 0x007e: // TILDE -+ return 0x0303; // COMBINING TILDE -+ case 0x00a8: // DIAERESIS -+ return 0x0308; // COMBINING DIAERESIS -+ // FIXME: Windows dead key behaviour isn't documented and I don't have -+ // any more keyboards to test with... -+ } -+ -+ // hope that Windows gave us something proper to begin with -+ return in; -+} -+ - #if USE_COLORMAP - extern HPALETTE fl_select_palette(void); // in fl_color_win32.cxx - #endif -@@ -846,6 +920,8 @@ - //fl_msg.pt = ??? - //fl_msg.lPrivate = ??? - -+ MSG fl_orig_msg = fl_msg; -+ - Fl_Window *window = fl_find(hWnd); - - if (window) switch (uMsg) { -@@ -1025,23 +1101,82 @@ - if (GetKeyState(VK_SCROLL)) state |= FL_SCROLL_LOCK; - Fl::e_state = state; - static char buffer[1024]; -- if (uMsg == WM_CHAR || uMsg == WM_SYSCHAR) { - -+ if (use_simple_keyboard) { -+ BYTE keystate[256]; -+ WCHAR wbuf[8]; -+ int ret; -+ -+ // I'm not sure if we ever get WM_CHAR (& friends) without an initial -+ // WM_KEYDOWN (& friends), but if we do then we should not send such -+ // side band events to simple keyboard widgets. -+ if ((fl_orig_msg.message != WM_KEYDOWN) && -+ (fl_orig_msg.message != WM_SYSKEYDOWN) && -+ (fl_orig_msg.message != WM_KEYUP) && -+ (fl_orig_msg.message != WM_SYSKEYUP)) -+ break; -+ -+ GetKeyboardState(keystate); -+ -+ // Pressing Ctrl wreaks havoc with the symbol lookup, so turn that off. -+ // But AltGr shows up as Ctrl+Alt in Windows, so keep Ctrl if Alt is -+ // active. -+ if (!(keystate[VK_MENU] & 0x80)) -+ keystate[VK_CONTROL] = keystate[VK_LCONTROL] = keystate[VK_RCONTROL] = 0; -+ -+ // We cannot inspect or modify Windows' internal state of the keyboard -+ // so we have to try to infer information from ToUnicode() and wedge -+ // things into a known state. -+ for (int i = 0;i < 2;i++) { -+ ret = ToUnicode(fl_orig_msg.wParam, 0, keystate, wbuf, -+ sizeof(wbuf)/sizeof(wbuf[0]), 0); -+ -+ // No symbol for this key (or unexpected length) -+ if ((ret == 0) || (ret < -1)) { -+ buffer[0] = 0; -+ Fl::e_length = 0; -+ break; -+ } -+ -+ // A dead key. Convert this to a Unicode combining character so -+ // that the application can tell the difference between dead and -+ // normal keys. -+ if (ret == -1) { -+ xchar u = (xchar) msdead2fltk(wbuf[0]); -+ Fl::e_length = fl_utf8fromwc(buffer, 1024, &u, 1); -+ buffer[Fl::e_length] = 0; -+ break; -+ } -+ -+ // If we have two characters (or more) from ToUnicode(), that's -+ // an invalid sequence. One character chould mean a proper symbol, -+ // or it could mean a composed one. In both cases we need to call -+ // ToUnicode() again to get something sane. -+ if (i == 0) -+ continue; -+ -+ // We should now have something sane. Give whatever we have to the -+ // application. -+ Fl::e_length = fl_utf8fromwc(buffer, 1024, wbuf, ret); -+ buffer[Fl::e_length] = 0; -+ } -+ } else if (uMsg == WM_CHAR || uMsg == WM_SYSCHAR) { - xchar u = (xchar) wParam; - // Fl::e_length = fl_unicode2utf(&u, 1, buffer); - Fl::e_length = fl_utf8fromwc(buffer, 1024, &u, 1); - buffer[Fl::e_length] = 0; -+ } else { -+ buffer[0] = 0; -+ Fl::e_length = 0; -+ } - -- -- } else if (Fl::e_keysym >= FL_KP && Fl::e_keysym <= FL_KP_Last) { -- if (state & FL_NUM_LOCK) { -- // Convert to regular keypress... -- buffer[0] = Fl::e_keysym-FL_KP; -- Fl::e_length = 1; -- } else { -- // Convert to special keypress... -- buffer[0] = 0; -- Fl::e_length = 0; -+ // The keypad area is a bit odd in that we need to change the keysym -+ // to properly indicate what the user meant, unlike other keys where -+ // we normally change the text and keep keysym stable. -+ if (Fl::e_keysym >= FL_KP && Fl::e_keysym <= FL_KP_Last) { -+ // The initial mapping tables give us a keysym that corresponds to -+ // numlock being on, so we only do something when it is off. -+ if (!(state & FL_NUM_LOCK)) { - switch (Fl::e_keysym) { - case FL_KP + '0' : - Fl::e_keysym = FL_Insert; -@@ -1073,30 +1208,10 @@ - case FL_KP + '.' : - Fl::e_keysym = FL_Delete; - break; -- case FL_KP + '/' : -- case FL_KP + '*' : -- case FL_KP + '-' : -- case FL_KP + '+' : -- buffer[0] = Fl::e_keysym-FL_KP; -- Fl::e_length = 1; -- break; - } - } -- } else if ((lParam & (1<<31))==0) { --#ifdef FLTK_PREVIEW_DEAD_KEYS -- if ((lParam & (1<<24))==0) { // clear if dead key (always?) -- xchar u = (xchar) wParam; -- Fl::e_length = fl_utf8fromwc(buffer, 1024, &u, 1); -- buffer[Fl::e_length] = 0; -- } else { // set if "extended key" (never printable?) -- buffer[0] = 0; -- Fl::e_length = 0; -- } --#else -- buffer[0] = 0; -- Fl::e_length = 0; --#endif - } -+ - Fl::e_text = buffer; - if (lParam & (1<<31)) { // key up events. - if (Fl::handle(FL_KEYUP, window)) return 0; diff --git a/contrib/packages/rpm/el6/SOURCES/fltk-1_v4.3.x-keyboard-x11.patch b/contrib/packages/rpm/el6/SOURCES/fltk-1_v4.3.x-keyboard-x11.patch deleted file mode 100644 index cabc0f1..0000000 --- a/contrib/packages/rpm/el6/SOURCES/fltk-1_v4.3.x-keyboard-x11.patch +++ /dev/null @@ -1,286 +0,0 @@ -diff -ur fltk-1.3.0r9619.org/FL/Fl_Widget.H fltk-1.3.0r9619/FL/Fl_Widget.H ---- fltk-1.3.0r9619.org/FL/Fl_Widget.H 2012-04-23 22:12:06.000000000 +0200 -+++ fltk-1.3.0r9619/FL/Fl_Widget.H 2012-06-18 13:46:07.302320825 +0200 -@@ -171,6 +171,7 @@ - GROUP_RELATIVE = 1<<16, ///< position this widget relative to the parent group, not to the window - COPIED_TOOLTIP = 1<<17, ///< the widget tooltip is internally copied, its destruction is handled by the widget - FULLSCREEN = 1<<18, ///< a fullscreen window (Fl_Window) -+ SIMPLE_KEYBOARD = 1<<19, ///< the widget wants simple, consistent keypresses and not advanced input (like character composition and CJK input) - // (space for more flags) - USERFLAG3 = 1<<29, ///< reserved for 3rd party extensions - USERFLAG2 = 1<<30, ///< reserved for 3rd party extensions -@@ -776,6 +777,35 @@ - */ - void clear_changed() {flags_ &= ~CHANGED;} - -+ /** -+ Returns if the widget sees a simplified keyboard model or not. -+ -+ Normally widgets get a full-featured keyboard model that is geared -+ towards text input. This includes support for compose sequences and -+ advanced input methods, commonly used for asian writing system. This -+ system however has downsides in that extra graphic can be presented -+ to the user and that a physical key press doesn't correspond directly -+ to a FLTK event. -+ -+ Widgets that need a direct correspondence between actual key events -+ and those seen by the widget can swith to the simplified keyboard -+ model. -+ -+ \retval 0 if the widget uses the normal keyboard model -+ \see set_changed(), clear_changed() -+ */ -+ unsigned int simple_keyboard() const {return flags_&SIMPLE_KEYBOARD;} -+ -+ /** Marks a widget to use the simple keyboard model. -+ \see changed(), clear_changed() -+ */ -+ void set_simple_keyboard() {flags_ |= SIMPLE_KEYBOARD;} -+ -+ /** Marks a widget to use the normal keyboard model. -+ \see changed(), set_changed() -+ */ -+ void set_normal_keyboard() {flags_ &= ~SIMPLE_KEYBOARD;} -+ - /** Gives the widget the keyboard focus. - Tries to make this widget be the Fl::focus() widget, by first sending - it an FL_FOCUS event, and if it returns non-zero, setting -diff -ur fltk-1.3.0r9619.org/src/Fl.cxx fltk-1.3.0r9619/src/Fl.cxx ---- fltk-1.3.0r9619.org/src/Fl.cxx 2012-03-23 17:47:53.000000000 +0100 -+++ fltk-1.3.0r9619/src/Fl.cxx 2012-06-18 13:46:07.303320877 +0200 -@@ -70,6 +70,8 @@ - extern double fl_mac_flush_and_wait(double time_to_wait, char in_idle); - #endif // WIN32 - -+extern void fl_update_focus(void); -+ - // - // Globals... - // -@@ -876,6 +878,8 @@ - fl_oldfocus = p; - } - e_number = old_event; -+ // let the platform code do what it needs -+ fl_update_focus(); - } - } - -diff -ur fltk-1.3.0r9619.org/src/Fl_grab.cxx fltk-1.3.0r9619/src/Fl_grab.cxx ---- fltk-1.3.0r9619.org/src/Fl_grab.cxx 2012-03-23 17:47:53.000000000 +0100 -+++ fltk-1.3.0r9619/src/Fl_grab.cxx 2012-06-18 13:46:07.303320877 +0200 -@@ -29,6 +29,7 @@ - // override_redirect, it does similar things on WIN32. - - extern void fl_fix_focus(); // in Fl.cxx -+void fl_update_focus(void); - - #ifdef WIN32 - // We have to keep track of whether we have captured the mouse, since -@@ -80,6 +81,7 @@ - #endif - } - grab_ = win; -+ fl_update_focus(); - } else { - if (grab_) { - #ifdef WIN32 -@@ -98,6 +100,7 @@ - XFlush(fl_display); - #endif - grab_ = 0; -+ fl_update_focus(); - fl_fix_focus(); - } - } -diff -ur fltk-1.3.0r9619.org/src/Fl_x.cxx fltk-1.3.0r9619/src/Fl_x.cxx ---- fltk-1.3.0r9619.org/src/Fl_x.cxx 2012-06-18 13:46:07.205316173 +0200 -+++ fltk-1.3.0r9619/src/Fl_x.cxx 2012-06-18 13:46:18.216844629 +0200 -@@ -298,6 +298,7 @@ - Colormap fl_colormap; - XIM fl_xim_im = 0; - XIC fl_xim_ic = 0; -+Window fl_xim_win = 0; - char fl_is_over_the_spot = 0; - static XRectangle status_area; - -@@ -583,6 +584,65 @@ - if(xim_styles) XFree(xim_styles); - } - -+void fl_xim_deactivate(void); -+ -+void fl_xim_activate(Window xid) -+{ -+ if (!fl_xim_im) -+ return; -+ -+ // If the focused window has changed, then use the brute force method -+ // of completely recreating the input context. -+ if (fl_xim_win != xid) { -+ fl_xim_deactivate(); -+ -+ fl_new_ic(); -+ fl_xim_win = xid; -+ -+ XSetICValues(fl_xim_ic, -+ XNFocusWindow, fl_xim_win, -+ XNClientWindow, fl_xim_win, -+ NULL); -+ } -+ -+ fl_set_spot(spotf, spots, spot.x, spot.y, spot.width, spot.height); -+} -+ -+void fl_xim_deactivate(void) -+{ -+ if (!fl_xim_ic) -+ return; -+ -+ XDestroyIC(fl_xim_ic); -+ fl_xim_ic = NULL; -+ -+ fl_xim_win = 0; -+} -+ -+extern Fl_Window *fl_xfocus; -+ -+void fl_update_focus(void) -+{ -+ Fl_Widget *focus; -+ -+ focus = Fl::grab(); -+ if (!focus) -+ focus = Fl::focus(); -+ if (!focus) -+ return; -+ -+ if (focus->simple_keyboard()) { -+ fl_xim_deactivate(); -+ } else { -+ // fl_xfocus should always be set if something has focus, but let's -+ // play it safe -+ if (!fl_xfocus || !fl_xid(fl_xfocus)) -+ return; -+ -+ fl_xim_activate(fl_xid(fl_xfocus)); -+ } -+} -+ - void fl_open_display() { - if (fl_display) return; - -@@ -917,10 +977,9 @@ - XEvent xevent = thisevent; - fl_xevent = &thisevent; - Window xid = xevent.xany.window; -- static Window xim_win = 0; - - if (fl_xim_ic && xevent.type == DestroyNotify && -- xid != xim_win && !fl_find(xid)) -+ xid != fl_xim_win && !fl_find(xid)) - { - XIM xim_im; - xim_im = XOpenIM(fl_display, NULL, NULL, NULL); -@@ -935,48 +994,10 @@ - return 0; - } - -- if (fl_xim_ic && (xevent.type == FocusIn)) -- { --#define POOR_XIM --#ifdef POOR_XIM -- if (xim_win != xid) -- { -- xim_win = xid; -- XDestroyIC(fl_xim_ic); -- fl_xim_ic = NULL; -- fl_new_ic(); -- XSetICValues(fl_xim_ic, -- XNFocusWindow, xevent.xclient.window, -- XNClientWindow, xid, -- NULL); -- } -- fl_set_spot(spotf, spots, spot.x, spot.y, spot.width, spot.height); --#else -- if (Fl::first_window() && Fl::first_window()->modal()) { -- Window x = fl_xid(Fl::first_window()); -- if (x != xim_win) { -- xim_win = x; -- XSetICValues(fl_xim_ic, -- XNFocusWindow, xim_win, -- XNClientWindow, xim_win, -- NULL); -- fl_set_spot(spotf, spots, spot.x, spot.y, spot.width, spot.height); -- } -- } else if (xim_win != xid && xid) { -- xim_win = xid; -- XSetICValues(fl_xim_ic, -- XNFocusWindow, xevent.xclient.window, -- XNClientWindow, xid, -- //XNFocusWindow, xim_win, -- //XNClientWindow, xim_win, -- NULL); -- fl_set_spot(spotf, spots, spot.x, spot.y, spot.width, spot.height); -- } --#endif -+ if (fl_xim_ic) { -+ if (XFilterEvent((XEvent *)&xevent, 0)) -+ return 1; - } -- -- if ( XFilterEvent((XEvent *)&xevent, 0) ) -- return(1); - - #if USE_XRANDR - if( XRRUpdateConfiguration_f && xevent.type == randrEventBase + RRScreenChangeNotify) { -@@ -1326,15 +1347,15 @@ - //static XComposeStatus compose; - len = XLookupString((XKeyEvent*)&(xevent.xkey), - buffer, buffer_len, &keysym, 0/*&compose*/); -- if (keysym && keysym < 0x400) { // a character in latin-1,2,3,4 sets -- // force it to type a character (not sure if this ever is needed): -- // if (!len) {buffer[0] = char(keysym); len = 1;} -- len = fl_utf8encode(XKeysymToUcs(keysym), buffer); -- if (len < 1) len = 1; -- // ignore all effects of shift on the keysyms, which makes it a lot -- // easier to program shortcuts and is Windoze-compatible: -- keysym = XKeycodeToKeysym(fl_display, keycode, 0); -- } -+ // XLookupString() is only defined to return Latin-1 (although it -+ // often gives you more). To be safe, use our own lookups based on -+ // keysym. -+ len = fl_utf8encode(XKeysymToUcs(keysym), buffer); -+ if (len < 1) -+ len = 1; -+ // ignore all effects of shift on the keysyms, which makes it a lot -+ // easier to program shortcuts and is Windoze-compatable: -+ keysym = XKeycodeToKeysym(fl_display, keycode, 0); - } - // MRS: Can't use Fl::event_state(FL_CTRL) since the state is not - // set until set_event_xy() is called later... -diff -ur fltk-1.3.0r9619.org/src/xutf8/imKStoUCS.c fltk-1.3.0r9619/src/xutf8/imKStoUCS.c ---- fltk-1.3.0r9619.org/src/xutf8/imKStoUCS.c 2009-03-13 23:43:43.000000000 +0100 -+++ fltk-1.3.0r9619/src/xutf8/imKStoUCS.c 2012-06-18 13:46:07.304320930 +0200 -@@ -266,6 +266,12 @@ - 0x20a8, 0x20a9, 0x20aa, 0x20ab, 0x20ac /* 0x20a8-0x20af */ - }; - -+static unsigned short const keysym_to_unicode_fe50_fe60[] = { -+ 0x0300, 0x0301, 0x0302, 0x0303, 0x0304, 0x0306, 0x0307, 0x0308, /* 0xfe50-0xfe57 */ -+ 0x030a, 0x030b, 0x030c, 0x0327, 0x0328, 0x1da5, 0x3099, 0x309a, /* 0xfe58-0xfe5f */ -+ 0x0323 /* 0xfe60-0xfe67 */ -+}; -+ - unsigned int - KeySymToUcs4(KeySym keysym) - { -@@ -315,6 +321,8 @@ - return keysym_to_unicode_1e9f_1eff[keysym - 0x1e9f]; - else if (keysym > 0x209f && keysym < 0x20ad) - return keysym_to_unicode_20a0_20ac[keysym - 0x20a0]; -+ else if (keysym > 0xfe4f && keysym < 0xfe61) -+ return keysym_to_unicode_fe50_fe60[keysym - 0xfe50]; - else - return 0; - } diff --git a/contrib/packages/rpm/el6/SOURCES/fltk-1_v5.3.x-clipboard-x11.patch b/contrib/packages/rpm/el6/SOURCES/fltk-1_v5.3.x-clipboard-x11.patch deleted file mode 100644 index 467160f..0000000 --- a/contrib/packages/rpm/el6/SOURCES/fltk-1_v5.3.x-clipboard-x11.patch +++ /dev/null @@ -1,350 +0,0 @@ -diff -up fltk-1.3.2/CMakeLists.txt.clp-x11 fltk-1.3.2/CMakeLists.txt ---- fltk-1.3.2/CMakeLists.txt.clp-x11 2012-09-13 16:19:01.000000000 +0200 -+++ fltk-1.3.2/CMakeLists.txt 2013-01-30 15:56:25.810663430 +0100 -@@ -515,6 +515,20 @@ else() - endif(OPTION_USE_XINERAMA) - - ####################################################################### -+if(X11_Xfixes_FOUND) -+ option(OPTION_USE_XFIXES "use lib XFIXES" ON) -+endif(X11_Xfixes_FOUND) -+ -+if(OPTION_USE_XFIXES) -+ set(HAVE_XFIXES ${X11_Xfixes_FOUND}) -+ include_directories(${X11_Xfixes_INCLUDE_PATH}) -+ list(APPEND FLTK_LDLIBS -lXfixes) -+ set(FLTK_XFIXES_FOUND TRUE) -+else() -+ set(FLTK_XFIXES_FOUND FALSE) -+endif(OPTION_USE_XFIXES) -+ -+####################################################################### - if(X11_Xft_FOUND) - option(OPTION_USE_XFT "use lib Xft" ON) - endif(X11_Xft_FOUND) -diff -up fltk-1.3.2/configh.cmake.in.clp-x11 fltk-1.3.2/configh.cmake.in ---- fltk-1.3.2/configh.cmake.in.clp-x11 2011-07-19 06:49:30.000000000 +0200 -+++ fltk-1.3.2/configh.cmake.in 2013-01-30 15:56:25.810663430 +0100 -@@ -108,6 +108,14 @@ - #define USE_XDBE HAVE_XDBE - - /* -+ * HAVE_XFIXES: -+ * -+ * Do we have the X fixes extension? -+ */ -+ -+#cmakedefine01 HAVE_XFIXES -+ -+/* - * __APPLE_QUARTZ__: - * - * If __APPLE_QUARTZ__ is defined, FLTK will be -diff -up fltk-1.3.2/configh.in.clp-x11 fltk-1.3.2/configh.in ---- fltk-1.3.2/configh.in.clp-x11 2011-10-04 11:21:47.000000000 +0200 -+++ fltk-1.3.2/configh.in 2013-01-30 15:56:25.810663430 +0100 -@@ -108,6 +108,14 @@ - #define USE_XDBE HAVE_XDBE - - /* -+ * HAVE_XFIXES: -+ * -+ * Do we have the X fixes extension? -+ */ -+ -+#define HAVE_XFIXES 0 -+ -+/* - * __APPLE_QUARTZ__: - * - * All Apple implementations are now based on Quartz and Cocoa, -diff -up fltk-1.3.2/configure.in.clp-x11 fltk-1.3.2/configure.in ---- fltk-1.3.2/configure.in.clp-x11 2013-01-30 15:56:25.802663573 +0100 -+++ fltk-1.3.2/configure.in 2013-01-30 15:56:25.810663430 +0100 -@@ -999,6 +999,16 @@ case $uname_GUI in - LIBS="-lXext $LIBS") - fi - -+ dnl Check for the Xfixes extension unless disabled... -+ AC_ARG_ENABLE(xfixes, [ --enable-xfixes turn on Xfixes support [default=yes]]) -+ -+ if test x$enable_xfixes != xno; then -+ AC_CHECK_HEADER(X11/extensions/Xfixes.h, AC_DEFINE(HAVE_XFIXES),, -+ [#include ]) -+ AC_CHECK_LIB(Xfixes, XFixesQueryExtension, -+ LIBS="-lXfixes $LIBS") -+ fi -+ - dnl Check for overlay visuals... - AC_PATH_PROG(XPROP, xprop) - AC_CACHE_CHECK(for X overlay visuals, ac_cv_have_overlay, -diff -up fltk-1.3.2/fluid/CMakeLists.txt.clp-x11 fltk-1.3.2/fluid/CMakeLists.txt -diff -up fltk-1.3.2/src/CMakeLists.txt.clp-x11 fltk-1.3.2/src/CMakeLists.txt ---- fltk-1.3.2/src/CMakeLists.txt.clp-x11 2013-01-30 16:06:00.785430590 +0100 -+++ fltk-1.3.2/src/CMakeLists.txt 2013-01-30 16:06:17.883126642 +0100 -@@ -243,6 +243,10 @@ if(HAVE_XINERAMA) - target_link_libraries(fltk ${X11_Xinerama_LIB}) - endif(HAVE_XINERAMA) - -+if(HAVE_XFIXES) -+ target_link_libraries(fltk ${X11_Xfixes_LIB}) -+endif(HAVE_XFIXES) -+ - if(USE_XFT) - target_link_libraries(fltk ${X11_Xft_LIB}) - endif(USE_XFT) -diff -up fltk-1.3.2/src/Fl_x.cxx.clp-x11 fltk-1.3.2/src/Fl_x.cxx ---- fltk-1.3.2/src/Fl_x.cxx.clp-x11 2013-01-30 15:56:25.793663733 +0100 -+++ fltk-1.3.2/src/Fl_x.cxx 2013-01-30 16:03:37.355981103 +0100 -@@ -53,6 +53,12 @@ static XRRUpdateConfiguration_type XRRUp - static int randrEventBase; // base of RandR-defined events - #endif - -+# if HAVE_XFIXES -+# include -+static int xfixes_event_base = 0; -+static bool have_xfixes = false; -+# endif -+ - static Fl_Xlib_Graphics_Driver fl_xlib_driver; - static Fl_Display_Device fl_xlib_display(&fl_xlib_driver); - Fl_Display_Device *Fl_Display_Device::_display = &fl_xlib_display;// the platform display -@@ -307,6 +313,9 @@ static Atom WM_PROTOCOLS; - static Atom fl_MOTIF_WM_HINTS; - static Atom TARGETS; - static Atom CLIPBOARD; -+static Atom TIMESTAMP; -+static Atom PRIMARY_TIMESTAMP; -+static Atom CLIPBOARD_TIMESTAMP; - Atom fl_XdndAware; - Atom fl_XdndSelection; - Atom fl_XdndEnter; -@@ -667,6 +676,9 @@ void fl_open_display(Display* d) { - fl_MOTIF_WM_HINTS = XInternAtom(d, "_MOTIF_WM_HINTS", 0); - TARGETS = XInternAtom(d, "TARGETS", 0); - CLIPBOARD = XInternAtom(d, "CLIPBOARD", 0); -+ TIMESTAMP = XInternAtom(d, "TIMESTAMP", 0); -+ PRIMARY_TIMESTAMP = XInternAtom(d, "PRIMARY_TIMESTAMP", 0); -+ CLIPBOARD_TIMESTAMP = XInternAtom(d, "CLIPBOARD_TIMESTAMP", 0); - fl_XdndAware = XInternAtom(d, "XdndAware", 0); - fl_XdndSelection = XInternAtom(d, "XdndSelection", 0); - fl_XdndEnter = XInternAtom(d, "XdndEnter", 0); -@@ -713,6 +725,15 @@ void fl_open_display(Display* d) { - #if !USE_COLORMAP - Fl::visual(FL_RGB); - #endif -+ -+#if HAVE_XFIXES -+ int error_base; -+ if (XFixesQueryExtension(fl_display, &xfixes_event_base, &error_base)) -+ have_xfixes = true; -+ else -+ have_xfixes = false; -+#endif -+ - #if USE_XRANDR - void *libxrandr_addr = dlopen("libXrandr.so.2", RTLD_LAZY); - if (!libxrandr_addr) libxrandr_addr = dlopen("libXrandr.so", RTLD_LAZY); -@@ -901,6 +922,102 @@ void Fl::copy(const char *stuff, int len - } - - //////////////////////////////////////////////////////////////// -+// Code for tracking clipboard changes: -+ -+static Time primary_timestamp = -1; -+static Time clipboard_timestamp = -1; -+ -+extern bool fl_clipboard_notify_empty(void); -+extern void fl_trigger_clipboard_notify(int source); -+ -+static void poll_clipboard_owner(void) { -+ Window xid; -+ -+#if HAVE_XFIXES -+ // No polling needed with Xfixes -+ if (have_xfixes) -+ return; -+#endif -+ -+ // No one is interested, so no point polling -+ if (fl_clipboard_notify_empty()) -+ return; -+ -+ // We need a window for this to work -+ if (!Fl::first_window()) -+ return; -+ xid = fl_xid(Fl::first_window()); -+ if (!xid) -+ return; -+ -+ // Request an update of the selection time for both the primary and -+ // clipboard selections. Magic continues when we get a SelectionNotify. -+ if (!fl_i_own_selection[0]) -+ XConvertSelection(fl_display, XA_PRIMARY, TIMESTAMP, PRIMARY_TIMESTAMP, -+ xid, fl_event_time); -+ if (!fl_i_own_selection[1]) -+ XConvertSelection(fl_display, CLIPBOARD, TIMESTAMP, CLIPBOARD_TIMESTAMP, -+ xid, fl_event_time); -+} -+ -+static void clipboard_timeout(void *data) -+{ -+ // No one is interested, so stop polling -+ if (fl_clipboard_notify_empty()) -+ return; -+ -+ poll_clipboard_owner(); -+ -+ Fl::repeat_timeout(0.5, clipboard_timeout); -+} -+ -+static void handle_clipboard_timestamp(int clipboard, Time time) -+{ -+ Time *timestamp; -+ -+ timestamp = clipboard ? &clipboard_timestamp : &primary_timestamp; -+ -+#if HAVE_XFIXES -+ if (!have_xfixes) -+#endif -+ { -+ // Initial scan, just store the value -+ if (*timestamp == (Time)-1) { -+ *timestamp = time; -+ return; -+ } -+ } -+ -+ // Same selection -+ if (time == *timestamp) -+ return; -+ -+ *timestamp = time; -+ -+ // Something happened! Let's tell someone! -+ fl_trigger_clipboard_notify(clipboard); -+} -+ -+void fl_clipboard_notify_change() { -+ // Reset the timestamps if we've going idle so that you don't -+ // get a bogus immediate trigger next time they're activated. -+ if (fl_clipboard_notify_empty()) { -+ primary_timestamp = -1; -+ clipboard_timestamp = -1; -+ } else { -+#if HAVE_XFIXES -+ if (!have_xfixes) -+#endif -+ { -+ poll_clipboard_owner(); -+ -+ if (!Fl::has_timeout(clipboard_timeout)) -+ Fl::add_timeout(0.5, clipboard_timeout); -+ } -+ } -+} -+ -+//////////////////////////////////////////////////////////////// - - const XEvent* fl_xevent; // the current x event - ulong fl_event_time; // the last timestamp from an x event -@@ -1024,7 +1141,6 @@ int fl_handle(const XEvent& thisevent) - return 0; - - case SelectionNotify: { -- if (!fl_selection_requestor) return 0; - static unsigned char* buffer = 0; - if (buffer) {XFree(buffer); buffer = 0;} - long bytesread = 0; -@@ -1040,6 +1156,19 @@ int fl_handle(const XEvent& thisevent) - bytesread/4, 65536, 1, 0, - &actual, &format, &count, &remaining, - &portion)) break; // quit on error -+ -+ if ((fl_xevent->xselection.property == PRIMARY_TIMESTAMP) || -+ (fl_xevent->xselection.property == CLIPBOARD_TIMESTAMP)) { -+ if (portion && format == 32 && count == 1) { -+ Time t = *(unsigned int*)portion; -+ if (fl_xevent->xselection.property == CLIPBOARD_TIMESTAMP) -+ handle_clipboard_timestamp(1, t); -+ else -+ handle_clipboard_timestamp(0, t); -+ } -+ return true; -+ } -+ - if (actual == TARGETS || actual == XA_ATOM) { - Atom type = XA_STRING; - for (unsigned i = 0; ixselectionclear.selection == CLIPBOARD; - fl_i_own_selection[clipboard] = 0; -+ poll_clipboard_owner(); - return 1;} - - case SelectionRequest: { -@@ -1308,6 +1441,9 @@ int fl_handle(const XEvent& thisevent) - case FocusIn: - if (fl_xim_ic) XSetICFocus(fl_xim_ic); - event = FL_FOCUS; -+ // If the user has toggled from another application to this one, -+ // then it's a good time to check for clipboard changes. -+ poll_clipboard_owner(); - break; - - case FocusOut: -@@ -1676,6 +1812,25 @@ int fl_handle(const XEvent& thisevent) - } - } - -+#if HAVE_XFIXES -+ switch (xevent.type - xfixes_event_base) { -+ case XFixesSelectionNotify: { -+ // Someone feeding us bogus events? -+ if (!have_xfixes) -+ return true; -+ -+ XFixesSelectionNotifyEvent *selection_notify = (XFixesSelectionNotifyEvent *)&xevent; -+ -+ if ((selection_notify->selection == XA_PRIMARY) && !fl_i_own_selection[0]) -+ handle_clipboard_timestamp(0, selection_notify->selection_timestamp); -+ else if ((selection_notify->selection == CLIPBOARD) && !fl_i_own_selection[1]) -+ handle_clipboard_timestamp(1, selection_notify->selection_timestamp); -+ -+ return true; -+ } -+ } -+#endif -+ - return Fl::handle(event, window); - } - -@@ -1995,6 +2150,16 @@ void Fl_X::make_xid(Fl_Window* win, XVis - XChangeProperty(fl_display, xp->xid, net_wm_type, XA_ATOM, 32, PropModeReplace, (unsigned char*)&net_wm_type_kind, 1); - } - -+#if HAVE_XFIXES -+ // register for clipboard change notifications -+ if (have_xfixes && !win->parent()) { -+ XFixesSelectSelectionInput(fl_display, xp->xid, XA_PRIMARY, -+ XFixesSetSelectionOwnerNotifyMask); -+ XFixesSelectSelectionInput(fl_display, xp->xid, CLIPBOARD, -+ XFixesSetSelectionOwnerNotifyMask); -+ } -+#endif -+ - XMapWindow(fl_display, xp->xid); - if (showit) { - win->set_visible(); -diff -up fltk-1.3.2/test/CMakeLists.txt.clp-x11 fltk-1.3.2/test/CMakeLists.txt diff --git a/contrib/packages/rpm/el6/SOURCES/fltk-1_v5.3.x-cursor.patch b/contrib/packages/rpm/el6/SOURCES/fltk-1_v5.3.x-cursor.patch deleted file mode 100644 index 8e99050..0000000 --- a/contrib/packages/rpm/el6/SOURCES/fltk-1_v5.3.x-cursor.patch +++ /dev/null @@ -1,1623 +0,0 @@ -diff -up fltk-1.3.2/CMakeLists.txt.cursor fltk-1.3.2/CMakeLists.txt ---- fltk-1.3.2/CMakeLists.txt.cursor 2013-01-30 16:07:59.510320246 +0100 -+++ fltk-1.3.2/CMakeLists.txt 2013-01-30 16:07:59.528319926 +0100 -@@ -529,6 +529,20 @@ else() - endif(OPTION_USE_XFIXES) - - ####################################################################### -+if(X11_Xcursor_FOUND) -+ option(OPTION_USE_XCURSOR "use lib XCURSOR" ON) -+endif(X11_Xcursor_FOUND) -+ -+if(OPTION_USE_XCURSOR) -+ set(HAVE_XCURSOR ${X11_Xcursor_FOUND}) -+ include_directories(${X11_Xcursor_INCLUDE_PATH}) -+ list(APPEND FLTK_LDLIBS -lXcursor) -+ set(FLTK_XCURSOR_FOUND TRUE) -+else() -+ set(FLTK_XCURSOR_FOUND FALSE) -+endif(OPTION_USE_XCURSOR) -+ -+####################################################################### - if(X11_Xft_FOUND) - option(OPTION_USE_XFT "use lib Xft" ON) - endif(X11_Xft_FOUND) -diff -up fltk-1.3.2/configh.cmake.in.cursor fltk-1.3.2/configh.cmake.in ---- fltk-1.3.2/configh.cmake.in.cursor 2013-01-30 16:07:59.510320246 +0100 -+++ fltk-1.3.2/configh.cmake.in 2013-01-30 16:07:59.529319908 +0100 -@@ -116,6 +116,14 @@ - #cmakedefine01 HAVE_XFIXES - - /* -+ * HAVE_XCURSOR: -+ * -+ * Do we have the X cursor library? -+ */ -+ -+#cmakedefine01 HAVE_XCURSOR -+ -+/* - * __APPLE_QUARTZ__: - * - * If __APPLE_QUARTZ__ is defined, FLTK will be -diff -up fltk-1.3.2/configh.in.cursor fltk-1.3.2/configh.in ---- fltk-1.3.2/configh.in.cursor 2013-01-30 16:07:59.510320246 +0100 -+++ fltk-1.3.2/configh.in 2013-01-30 16:07:59.529319908 +0100 -@@ -116,6 +116,14 @@ - #define HAVE_XFIXES 0 - - /* -+ * HAVE_XCURSOR: -+ * -+ * Do we have the X cursor library? -+ */ -+ -+#define HAVE_XCURSOR 0 -+ -+/* - * __APPLE_QUARTZ__: - * - * All Apple implementations are now based on Quartz and Cocoa, -diff -up fltk-1.3.2/configure.in.cursor fltk-1.3.2/configure.in ---- fltk-1.3.2/configure.in.cursor 2013-01-30 16:07:59.511320228 +0100 -+++ fltk-1.3.2/configure.in 2013-01-30 16:07:59.529319908 +0100 -@@ -1009,6 +1009,16 @@ case $uname_GUI in - LIBS="-lXfixes $LIBS") - fi - -+ dnl Check for the Xcursor library unless disabled... -+ AC_ARG_ENABLE(xcursor, [ --enable-xcursor turn on Xcursor support [default=yes]]) -+ -+ if test x$enable_xcursor != xno; then -+ AC_CHECK_HEADER(X11/Xcursor/Xcursor.h, AC_DEFINE(HAVE_XCURSOR),, -+ [#include ]) -+ AC_CHECK_LIB(Xcursor, XcursorImageCreate, -+ LIBS="-lXcursor $LIBS") -+ fi -+ - dnl Check for overlay visuals... - AC_PATH_PROG(XPROP, xprop) - AC_CACHE_CHECK(for X overlay visuals, ac_cv_have_overlay, -diff -up fltk-1.3.2/FL/Enumerations.H.cursor fltk-1.3.2/FL/Enumerations.H ---- fltk-1.3.2/FL/Enumerations.H.cursor 2013-01-30 16:07:59.486320673 +0100 -+++ fltk-1.3.2/FL/Enumerations.H 2013-01-30 16:07:59.530319891 +0100 -@@ -879,35 +879,36 @@ inline Fl_Color fl_color_cube(int r, int - - /** The following constants define the mouse cursors that are available in FLTK. - -- The double-headed arrows are bitmaps provided by FLTK on X, the others -- are provided by system-defined cursors. -+ Cursors are provided by the system when available, or bitmaps built into -+ FLTK as a fallback. - - \todo enum Fl_Cursor needs maybe an image. - */ - enum Fl_Cursor { - FL_CURSOR_DEFAULT = 0, /**< the default cursor, usually an arrow. */ -- FL_CURSOR_ARROW = 35, /**< an arrow pointer. */ -- FL_CURSOR_CROSS = 66, /**< crosshair. */ -- FL_CURSOR_WAIT = 76, /**< watch or hourglass. */ -- FL_CURSOR_INSERT = 77, /**< I-beam. */ -- FL_CURSOR_HAND = 31, /**< hand (uparrow on MSWindows). */ -- FL_CURSOR_HELP = 47, /**< question mark. */ -- FL_CURSOR_MOVE = 27, /**< 4-pointed arrow. */ -- // fltk provides bitmaps for these: -- FL_CURSOR_NS = 78, /**< up/down arrow. */ -- FL_CURSOR_WE = 79, /**< left/right arrow. */ -- FL_CURSOR_NWSE = 80, /**< diagonal arrow. */ -- FL_CURSOR_NESW = 81, /**< diagonal arrow. */ -- FL_CURSOR_NONE =255, /**< invisible. */ -- // for back compatibility (non MSWindows ones): -- FL_CURSOR_N = 70, /**< for back compatibility. */ -- FL_CURSOR_NE = 69, /**< for back compatibility. */ -- FL_CURSOR_E = 49, /**< for back compatibility. */ -- FL_CURSOR_SE = 8, /**< for back compatibility. */ -- FL_CURSOR_S = 9, /**< for back compatibility. */ -- FL_CURSOR_SW = 7, /**< for back compatibility. */ -- FL_CURSOR_W = 36, /**< for back compatibility. */ -- FL_CURSOR_NW = 68 /**< for back compatibility. */ -+ FL_CURSOR_ARROW = 1, /**< an arrow pointer. */ -+ FL_CURSOR_CROSS = 2, /**< crosshair. */ -+ FL_CURSOR_WAIT = 3, /**< busy indicator (e.g. hourglass). */ -+ FL_CURSOR_INSERT = 4, /**< I-beam. */ -+ FL_CURSOR_HAND = 5, /**< pointing hand. */ -+ FL_CURSOR_HELP = 6, /**< question mark pointer. */ -+ FL_CURSOR_MOVE = 7, /**< 4-pointed arrow or hand. */ -+ -+ /* Resize indicators */ -+ FL_CURSOR_NS = 101, /**< up/down resize. */ -+ FL_CURSOR_WE = 102, /**< left/right resize. */ -+ FL_CURSOR_NWSE = 103, /**< diagonal resize. */ -+ FL_CURSOR_NESW = 104, /**< diagonal resize. */ -+ FL_CURSOR_NE = 110, /**< upwards, right resize. */ -+ FL_CURSOR_N = 111, /**< upwards resize. */ -+ FL_CURSOR_NW = 112, /**< upwards, left resize. */ -+ FL_CURSOR_E = 113, /**< leftwards resize. */ -+ FL_CURSOR_W = 114, /**< rightwards resize. */ -+ FL_CURSOR_SE = 115, /**< downwards, right resize. */ -+ FL_CURSOR_S = 116, /**< downwards resize. */ -+ FL_CURSOR_SW = 117, /**< downwards, left resize. */ -+ -+ FL_CURSOR_NONE = 255, /**< invisible. */ - }; - /*@}*/ // group: Cursors - -diff -up fltk-1.3.2/FL/fl_draw.H.cursor fltk-1.3.2/FL/fl_draw.H ---- fltk-1.3.2/FL/fl_draw.H.cursor 2012-05-08 18:15:34.000000000 +0200 -+++ fltk-1.3.2/FL/fl_draw.H 2013-01-30 16:07:59.530319891 +0100 -@@ -751,7 +751,8 @@ FL_EXPORT const char* fl_shortcut_label( - FL_EXPORT unsigned int fl_old_shortcut(const char* s); - FL_EXPORT void fl_overlay_rect(int x,int y,int w,int h); - FL_EXPORT void fl_overlay_clear(); --FL_EXPORT void fl_cursor(Fl_Cursor, Fl_Color fg=FL_BLACK, Fl_Color bg=FL_WHITE); -+FL_EXPORT void fl_cursor(Fl_Cursor); -+FL_EXPORT void fl_cursor(Fl_Cursor, Fl_Color fg, Fl_Color bg=FL_WHITE); - FL_EXPORT const char* fl_expand_text(const char* from, char* buf, int maxbuf, - double maxw, int& n, double &width, - int wrap, int draw_symbols = 0); -diff -up fltk-1.3.2/FL/Fl_Window.H.cursor fltk-1.3.2/FL/Fl_Window.H ---- fltk-1.3.2/FL/Fl_Window.H.cursor 2012-11-06 21:46:14.000000000 +0100 -+++ fltk-1.3.2/FL/Fl_Window.H 2013-01-30 16:07:59.531319873 +0100 -@@ -28,6 +28,7 @@ - #define FL_DOUBLE_WINDOW 0xF1 ///< double window type id - - class Fl_X; -+class Fl_RGB_Image; - - /** - This widget produces an actual window. This can either be a main -@@ -81,7 +82,6 @@ class FL_EXPORT Fl_Window : public Fl_Gr - uchar size_range_set; - // cursor stuff - Fl_Cursor cursor_default; -- Fl_Color cursor_fg, cursor_bg; - void size_range_(); - void _Fl_Window(); // constructor innards - void fullscreen_x(); // platform-specific part of sending a window to full screen -@@ -466,14 +466,17 @@ public: - is different. - - The type Fl_Cursor is an enumeration defined in . -- (Under X you can get any XC_cursor value by passing -- Fl_Cursor((XC_foo/2)+1)). The colors only work on X, they are -- not implemented on WIN32. - -- For back compatibility only. -+ \see cursor(const Fl_RGB_Image*, int, int), default_cursor() - */ -- void cursor(Fl_Cursor, Fl_Color=FL_BLACK, Fl_Color=FL_WHITE); // platform dependent -- void default_cursor(Fl_Cursor, Fl_Color=FL_BLACK, Fl_Color=FL_WHITE); -+ void cursor(Fl_Cursor); -+ void cursor(const Fl_RGB_Image*, int, int); -+ void default_cursor(Fl_Cursor); -+ -+ /* for legacy compatibility */ -+ void cursor(Fl_Cursor c, Fl_Color, Fl_Color=FL_WHITE); -+ void default_cursor(Fl_Cursor c, Fl_Color, Fl_Color=FL_WHITE); -+ - static void default_callback(Fl_Window*, void* v); - - /** Returns the window width including any frame added by the window manager. -diff -up fltk-1.3.2/FL/mac.H.cursor fltk-1.3.2/FL/mac.H ---- fltk-1.3.2/FL/mac.H.cursor 2012-11-13 15:45:42.000000000 +0100 -+++ fltk-1.3.2/FL/mac.H 2013-01-30 16:07:59.531319873 +0100 -@@ -120,7 +120,8 @@ public: - void collapse(void); - WindowRef window_ref(void); - void set_key_window(void); -- void set_cursor(Fl_Cursor); -+ int set_cursor(Fl_Cursor); -+ int set_cursor(const Fl_RGB_Image*, int, int); - static CGImageRef CGImage_from_window_rect(Fl_Window *win, int x, int y, int w, int h); - static unsigned char *bitmap_from_window_rect(Fl_Window *win, int x, int y, int w, int h, int *bytesPerPixel); - static Fl_Region intersect_region_and_rect(Fl_Region current, int x,int y,int w, int h); -diff -up fltk-1.3.2/FL/win32.H.cursor fltk-1.3.2/FL/win32.H ---- fltk-1.3.2/FL/win32.H.cursor 2012-03-12 12:55:50.000000000 +0100 -+++ fltk-1.3.2/FL/win32.H 2013-01-30 16:07:59.531319873 +0100 -@@ -73,6 +73,7 @@ public: - int wait_for_expose; - HDC private_dc; // used for OpenGL - HCURSOR cursor; -+ int custom_cursor; - HDC saved_hdc; // saves the handle of the DC currently loaded - // static variables, static functions and member functions - static Fl_X* first; -@@ -83,6 +84,8 @@ public: - void flush() {w->flush();} - void set_minmax(LPMINMAXINFO minmax); - void mapraise(); -+ int set_cursor(Fl_Cursor); -+ int set_cursor(const Fl_RGB_Image*, int, int); - static Fl_X* make(Fl_Window*); - }; - extern FL_EXPORT HCURSOR fl_default_cursor; -diff -up fltk-1.3.2/FL/x.H.cursor fltk-1.3.2/FL/x.H ---- fltk-1.3.2/FL/x.H.cursor 2012-03-23 17:47:53.000000000 +0100 -+++ fltk-1.3.2/FL/x.H 2013-01-30 16:07:59.532319855 +0100 -@@ -154,6 +154,8 @@ public: - static Fl_X* i(const Fl_Window* wi) {return wi->i;} - void setwindow(Fl_Window* wi) {w=wi; wi->i=this;} - void sendxjunk(); -+ int set_cursor(Fl_Cursor); -+ int set_cursor(const Fl_RGB_Image*, int, int); - static void make_xid(Fl_Window*,XVisualInfo* =fl_visual, Colormap=fl_colormap); - static Fl_X* set_xid(Fl_Window*, Window); - // kludges to get around protection: -diff -up fltk-1.3.2/src/CMakeLists.txt.cursor fltk-1.3.2/src/CMakeLists.txt ---- fltk-1.3.2/src/CMakeLists.txt.cursor 2013-01-30 16:09:11.981032475 +0100 -+++ fltk-1.3.2/src/CMakeLists.txt 2013-01-30 16:09:26.497774461 +0100 -@@ -247,6 +247,10 @@ if(HAVE_XFIXES) - target_link_libraries(fltk ${X11_Xfixes_LIB}) - endif(HAVE_XFIXES) - -+if(HAVE_XCURSOR) -+ target_link_libraries(fltk ${X11_Xcursor_LIB}) -+endif(HAVE_XCURSOR) -+ - if(USE_XFT) - target_link_libraries(fltk ${X11_Xft_LIB}) - endif(USE_XFT) -diff -up fltk-1.3.2/src/Fl_cocoa.mm.cursor fltk-1.3.2/src/Fl_cocoa.mm ---- fltk-1.3.2/src/Fl_cocoa.mm.cursor 2013-01-30 16:07:59.522320033 +0100 -+++ fltk-1.3.2/src/Fl_cocoa.mm 2013-01-30 16:07:59.533319837 +0100 -@@ -98,7 +98,6 @@ Fl_Display_Device *Fl_Display_Device::_d - CGContextRef fl_gc = 0; - void *fl_system_menu; // this is really a NSMenu* - Fl_Sys_Menu_Bar *fl_sys_menu_bar = 0; --void *fl_default_cursor; // this is really a NSCursor* - void *fl_capture = 0; // (NSWindow*) we need this to compensate for a missing(?) mouse capture - bool fl_show_iconic; // true if called from iconize() - shows the next created window in collapsed state - //int fl_disable_transient_for; // secret method of removing TRANSIENT_FOR -@@ -1392,8 +1391,6 @@ void fl_open_display() { - dequeue:YES]; - while (ign_event); - -- fl_default_cursor = [NSCursor arrowCursor]; -- - // bring the application into foreground without a 'CARB' resource - Boolean same_psn; - ProcessSerialNumber cur_psn, front_psn; -@@ -1698,6 +1695,7 @@ static void q_set_window_title(NSWindow - - (void)drawRect:(NSRect)rect; - - (BOOL)acceptsFirstResponder; - - (BOOL)acceptsFirstMouse:(NSEvent*)theEvent; -+- (void)resetCursorRects; - - (BOOL)performKeyEquivalent:(NSEvent*)theEvent; - - (void)mouseUp:(NSEvent *)theEvent; - - (void)rightMouseUp:(NSEvent *)theEvent; -@@ -1756,6 +1754,16 @@ static void q_set_window_title(NSWindow - Fl_Window *first = Fl::first_window(); - return (first == w || !first->modal()); - } -+- (void)resetCursorRects { -+ Fl_Window *w = [(FLWindow*)[self window] getFl_Window]; -+ Fl_X *i = Fl_X::i(w); -+ // We have to have at least one cursor rect for invalidateCursorRectsForView -+ // to work, hence the "else" clause. -+ if (i->cursor) -+ [self addCursorRect:[self visibleRect] cursor:(NSCursor*)i->cursor]; -+ else -+ [self addCursorRect:[self visibleRect] cursor:[NSCursor arrowCursor]]; -+} - - (void)mouseUp:(NSEvent *)theEvent { - cocoaMouseHandler(theEvent); - } -@@ -2331,7 +2339,7 @@ void Fl_X::make(Fl_Window* w) - x->other_xid = 0; - x->region = 0; - x->subRegion = 0; -- x->cursor = fl_default_cursor; -+ x->cursor = NULL; - x->gc = 0; // stay 0 for Quickdraw; fill with CGContext for Quartz - Fl_Window *win = w->window(); - Fl_X *xo = Fl_X::i(win); -@@ -2427,7 +2435,7 @@ void Fl_X::make(Fl_Window* w) - x->other_xid = 0; // room for doublebuffering image map. On OS X this is only used by overlay windows - x->region = 0; - x->subRegion = 0; -- x->cursor = fl_default_cursor; -+ x->cursor = NULL; - x->xidChildren = 0; - x->xidNext = 0; - x->gc = 0; -@@ -2974,6 +2982,10 @@ void Fl_X::map() { - Fl_X::relink(w, w->window() ); - w->redraw(); - } -+ if (cursor) { -+ [(NSCursor*)cursor release]; -+ cursor = NULL; -+ } - } - - void Fl_X::unmap() { -@@ -3078,68 +3090,106 @@ static NSImage *CGBitmapContextToNSImage - return [image autorelease]; - } - --static NSCursor *PrepareCursor(NSCursor *cursor, CGContextRef (*f)() ) -+int Fl_X::set_cursor(Fl_Cursor c) - { -- if (cursor == nil) { -- CGContextRef c = f(); -- NSImage *image = CGBitmapContextToNSImage(c); -- fl_delete_offscreen( (Fl_Offscreen)c ); -- NSPoint pt = {[image size].width/2, [image size].height/2}; -- cursor = [[NSCursor alloc] initWithImage:image hotSpot:pt]; -+ if (cursor) { -+ [(NSCursor*)cursor release]; -+ cursor = NULL; - } -- return cursor; --} - --void Fl_X::set_cursor(Fl_Cursor c) --{ -- NSCursor *icrsr; - switch (c) { -- case FL_CURSOR_CROSS: icrsr = [NSCursor crosshairCursor]; break; -- case FL_CURSOR_WAIT: -- static NSCursor *watch = nil; -- watch = PrepareCursor(watch, &Fl_X::watch_cursor_image); -- icrsr = watch; -- break; -- case FL_CURSOR_INSERT: icrsr = [NSCursor IBeamCursor]; break; -- case FL_CURSOR_N: icrsr = [NSCursor resizeUpCursor]; break; -- case FL_CURSOR_S: icrsr = [NSCursor resizeDownCursor]; break; -- case FL_CURSOR_NS: icrsr = [NSCursor resizeUpDownCursor]; break; -- case FL_CURSOR_HELP: -- static NSCursor *help = nil; -- help = PrepareCursor(help, &Fl_X::help_cursor_image); -- icrsr = help; -- break; -- case FL_CURSOR_HAND: icrsr = [NSCursor pointingHandCursor]; break; -- case FL_CURSOR_MOVE: icrsr = [NSCursor openHandCursor]; break; -- case FL_CURSOR_NE: -- case FL_CURSOR_SW: -- case FL_CURSOR_NESW: -- static NSCursor *nesw = nil; -- nesw = PrepareCursor(nesw, &Fl_X::nesw_cursor_image); -- icrsr = nesw; -- break; -- case FL_CURSOR_E: icrsr = [NSCursor resizeRightCursor]; break; -- case FL_CURSOR_W: icrsr = [NSCursor resizeLeftCursor]; break; -- case FL_CURSOR_WE: icrsr = [NSCursor resizeLeftRightCursor]; break; -- case FL_CURSOR_SE: -- case FL_CURSOR_NW: -- case FL_CURSOR_NWSE: -- static NSCursor *nwse = nil; -- nwse = PrepareCursor(nwse, &Fl_X::nwse_cursor_image); -- icrsr = nwse; -- break; -- case FL_CURSOR_NONE: -- static NSCursor *none = nil; -- none = PrepareCursor(none, &Fl_X::none_cursor_image); -- icrsr = none; -- break; -- case FL_CURSOR_ARROW: -- case FL_CURSOR_DEFAULT: -- default: icrsr = [NSCursor arrowCursor]; -- break; -+ case FL_CURSOR_ARROW: cursor = [NSCursor arrowCursor]; break; -+ case FL_CURSOR_CROSS: cursor = [NSCursor crosshairCursor]; break; -+ case FL_CURSOR_INSERT: cursor = [NSCursor IBeamCursor]; break; -+ case FL_CURSOR_HAND: cursor = [NSCursor pointingHandCursor]; break; -+ case FL_CURSOR_MOVE: cursor = [NSCursor openHandCursor]; break; -+ case FL_CURSOR_NS: cursor = [NSCursor resizeUpDownCursor]; break; -+ case FL_CURSOR_WE: cursor = [NSCursor resizeLeftRightCursor]; break; -+ case FL_CURSOR_N: cursor = [NSCursor resizeUpCursor]; break; -+ case FL_CURSOR_E: cursor = [NSCursor resizeRightCursor]; break; -+ case FL_CURSOR_W: cursor = [NSCursor resizeLeftCursor]; break; -+ case FL_CURSOR_S: cursor = [NSCursor resizeDownCursor]; break; -+ default: -+ return 0; -+ } -+ -+ [(NSCursor*)cursor retain]; -+ -+ [(NSWindow*)xid invalidateCursorRectsForView:[(NSWindow*)xid contentView]]; -+ -+ return 1; -+} -+ -+int Fl_X::set_cursor(const Fl_RGB_Image *image, int hotx, int hoty) { -+ if (cursor) { -+ [(NSCursor*)cursor release]; -+ cursor = NULL; -+ } -+ -+ if ((hotx < 0) || (hotx >= image->w())) -+ return 0; -+ if ((hoty < 0) || (hoty >= image->h())) -+ return 0; -+ -+ // OS X >= 10.6 can create a NSImage from a CGImage, but we need to -+ // support older versions, hence this pesky handling. -+ -+ NSBitmapImageRep *bitmap = [[NSBitmapImageRep alloc] -+ initWithBitmapDataPlanes:NULL -+ pixelsWide:image->w() -+ pixelsHigh:image->h() -+ bitsPerSample:8 -+ samplesPerPixel:image->d() -+ hasAlpha:!(image->d() & 1) -+ isPlanar:NO -+ colorSpaceName:(image->d()<=2) ? NSDeviceWhiteColorSpace : NSDeviceRGBColorSpace -+ bytesPerRow:(image->w() * image->d()) -+ bitsPerPixel:(image->d()*8)]; -+ -+ // Alpha needs to be premultiplied for this format -+ -+ const uchar *i = (const uchar*)*image->data(); -+ unsigned char *o = [bitmap bitmapData]; -+ for (int y = 0;y < image->h();y++) { -+ if (image->d() & 1) { -+ for (int x = 0;x < image->w();x++) { -+ unsigned int alpha; -+ if (image->d() == 4) { -+ alpha = i[3]; -+ *o++ = (unsigned char)((unsigned int)*i++ * alpha / 255); -+ *o++ = (unsigned char)((unsigned int)*i++ * alpha / 255); -+ } -+ -+ alpha = i[1]; -+ *o++ = (unsigned char)((unsigned int)*i++ * alpha / 255); -+ *o++ = alpha; -+ i++; -+ } -+ } else { -+ // No alpha, so we can just copy everything directly. -+ int len = image->w() * image->d(); -+ memcpy(o, i, len); -+ o += len; -+ i += len; -+ } -+ i += image->ld(); - } -- [icrsr set]; -- cursor = icrsr; -+ -+ NSImage *nsimage = [[NSImage alloc] -+ initWithSize:NSMakeSize(image->w(), image->h())]; -+ -+ [nsimage addRepresentation:bitmap]; -+ -+ cursor = [[NSCursor alloc] -+ initWithImage:nsimage -+ hotSpot:NSMakePoint(hotx, hoty)]; -+ -+ [(NSWindow*)xid invalidateCursorRectsForView:[(NSWindow*)xid contentView]]; -+ -+ [bitmap release]; -+ [nsimage release]; -+ -+ return 1; - } - - @interface FLaboutItemTarget : NSObject -diff -up fltk-1.3.2/src/fl_cursor.cxx.cursor fltk-1.3.2/src/fl_cursor.cxx ---- fltk-1.3.2/src/fl_cursor.cxx.cursor 2012-03-12 12:55:50.000000000 +0100 -+++ fltk-1.3.2/src/fl_cursor.cxx 2013-01-30 16:07:59.534319820 +0100 -@@ -24,297 +24,165 @@ - - #include - #include -+#include -+#include - #include --#if !defined(WIN32) && !defined(__APPLE__) --# include --#endif - #include - -+#include "fl_cursor_wait.xpm" -+#include "fl_cursor_help.xpm" -+#include "fl_cursor_nwse.xpm" -+#include "fl_cursor_nesw.xpm" -+#include "fl_cursor_none.xpm" -+ - /** - Sets the cursor for the current window to the specified shape and colors. - The cursors are defined in the header file. - */ -+void fl_cursor(Fl_Cursor c) { -+ if (Fl::first_window()) Fl::first_window()->cursor(c); -+} -+ -+/* For back compatibility only. */ - void fl_cursor(Fl_Cursor c, Fl_Color fg, Fl_Color bg) { -- if (Fl::first_window()) Fl::first_window()->cursor(c,fg,bg); -+ fl_cursor(c); - } -+ -+ - /** -- Sets the default window cursor as well as its color. -+ Sets the default window cursor. This is the cursor that will be used -+ after the mouse pointer leaves a widget with a custom cursor set. - -- For back compatibility only. -+ \see cursor(const Fl_RGB_Image*, int, int), default_cursor() - */ --void Fl_Window::default_cursor(Fl_Cursor c, Fl_Color fg, Fl_Color bg) { --// if (c == FL_CURSOR_DEFAULT) c = FL_CURSOR_ARROW; -- -+void Fl_Window::default_cursor(Fl_Cursor c) { - cursor_default = c; -- cursor_fg = fg; -- cursor_bg = bg; -+ cursor(c); -+} -+ -+ -+void fallback_cursor(Fl_Window *w, Fl_Cursor c) { -+ const char **xpm; -+ int hotx, hoty; -+ -+ // The standard arrow is our final fallback, so something is broken -+ // if we get called back here with that as an argument. -+ if (c == FL_CURSOR_ARROW) -+ return; -+ -+ switch (c) { -+ case FL_CURSOR_WAIT: -+ xpm = (const char**)fl_cursor_wait_xpm; -+ hotx = 8; -+ hoty = 15; -+ break; -+ case FL_CURSOR_HELP: -+ xpm = (const char**)fl_cursor_help_xpm; -+ hotx = 1; -+ hoty = 3; -+ break; -+ case FL_CURSOR_NWSE: -+ xpm = (const char**)fl_cursor_nwse_xpm; -+ hotx = 7; -+ hoty = 7; -+ break; -+ case FL_CURSOR_NESW: -+ xpm = (const char**)fl_cursor_nesw_xpm; -+ hotx = 7; -+ hoty = 7; -+ break; -+ case FL_CURSOR_NONE: -+ xpm = (const char**)fl_cursor_none_xpm; -+ hotx = 0; -+ hoty = 0; -+ break; -+ default: -+ w->cursor(FL_CURSOR_ARROW); -+ return; -+ } - -- cursor(c, fg, bg); -+ Fl_Pixmap pxm(xpm); -+ Fl_RGB_Image image(&pxm); -+ -+ w->cursor(&image, hotx, hoty); - } - --#ifdef WIN32 - --# ifndef IDC_HAND --# define IDC_HAND MAKEINTRESOURCE(32649) --# endif // !IDC_HAND -+void Fl_Window::cursor(Fl_Cursor c) { -+ int ret; - --void Fl_Window::cursor(Fl_Cursor c, Fl_Color c1, Fl_Color c2) { -- if (!shown()) return; - // the cursor must be set for the top level window, not for subwindows - Fl_Window *w = window(), *toplevel = this; -- while (w) { toplevel = w; w = w->window(); } -- if (toplevel != this) { toplevel->cursor(c, c1, c2); return; } -- // now set the actual cursor -- if (c == FL_CURSOR_DEFAULT) { -- c = cursor_default; -- } -- if (c > FL_CURSOR_NESW) { -- i->cursor = 0; -- } else if (c == FL_CURSOR_DEFAULT) { -- i->cursor = fl_default_cursor; -- } else { -- LPSTR n; -- switch (c) { -- case FL_CURSOR_ARROW: n = IDC_ARROW; break; -- case FL_CURSOR_CROSS: n = IDC_CROSS; break; -- case FL_CURSOR_WAIT: n = IDC_WAIT; break; -- case FL_CURSOR_INSERT: n = IDC_IBEAM; break; -- case FL_CURSOR_HELP: n = IDC_HELP; break; -- case FL_CURSOR_HAND: { -- OSVERSIONINFO osvi; -- -- // Get the OS version: Windows 98 and 2000 have a standard -- // hand cursor. -- memset(&osvi, 0, sizeof(OSVERSIONINFO)); -- osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); -- GetVersionEx(&osvi); -- -- if (osvi.dwMajorVersion > 4 || -- (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion > 0 && -- osvi.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS)) n = IDC_HAND; -- else n = IDC_UPARROW; -- } break; -- case FL_CURSOR_MOVE: n = IDC_SIZEALL; break; -- case FL_CURSOR_N: -- case FL_CURSOR_S: -- case FL_CURSOR_NS: n = IDC_SIZENS; break; -- case FL_CURSOR_NE: -- case FL_CURSOR_SW: -- case FL_CURSOR_NESW: n = IDC_SIZENESW; break; -- case FL_CURSOR_E: -- case FL_CURSOR_W: -- case FL_CURSOR_WE: n = IDC_SIZEWE; break; -- case FL_CURSOR_SE: -- case FL_CURSOR_NW: -- case FL_CURSOR_NWSE: n = IDC_SIZENWSE; break; -- default: n = IDC_NO; break; -- } -- i->cursor = LoadCursor(NULL, n); -+ -+ while (w) { -+ toplevel = w; -+ w = w->window(); - } -- SetCursor(i->cursor); --} - --#elif defined(__APPLE__) -+ if (toplevel != this) { -+ toplevel->cursor(c); -+ return; -+ } - --#ifdef __BIG_ENDIAN__ --# define E(x) x --#elif defined __LITTLE_ENDIAN__ --// Don't worry. This will be resolved at compile time --# define E(x) (x>>8)|((x<<8)&0xff00) --#else --# error "Either __LITTLE_ENDIAN__ or __BIG_ENDIAN__ must be defined" --#endif -- --CGContextRef Fl_X::help_cursor_image(void) --{ -- int w = 20, h = 20; -- Fl_Offscreen off = Fl_Quartz_Graphics_Driver::create_offscreen_with_alpha(w, h); -- fl_begin_offscreen(off); -- CGContextSetRGBFillColor( (CGContextRef)off, 0,0,0,0); -- fl_rectf(0,0,w,h); -- fl_color(FL_BLACK); -- fl_font(FL_COURIER_BOLD, 20); -- fl_draw("?", 1, h-1); -- fl_end_offscreen(); -- return (CGContextRef)off; --} -+ if (c == FL_CURSOR_DEFAULT) -+ c = cursor_default; - --CGContextRef Fl_X::none_cursor_image(void) --{ -- int w = 20, h = 20; -- Fl_Offscreen off = Fl_Quartz_Graphics_Driver::create_offscreen_with_alpha(w, h); -- fl_begin_offscreen(off); -- CGContextSetRGBFillColor( (CGContextRef)off, 0,0,0,0); -- fl_rectf(0,0,w,h); -- fl_end_offscreen(); -- return (CGContextRef)off; --} -+ if (!i) -+ return; - --CGContextRef Fl_X::watch_cursor_image(void) --{ -- int w, h, r = 5; -- w = 2*r+6; -- h = 4*r; -- Fl_Offscreen off = Fl_Quartz_Graphics_Driver::create_offscreen_with_alpha(w, h); -- fl_begin_offscreen(off); -- CGContextSetRGBFillColor( (CGContextRef)off, 0,0,0,0); -- fl_rectf(0,0,w,h); -- CGContextTranslateCTM( (CGContextRef)off, w/2, h/2); -- fl_color(FL_WHITE); -- fl_circle(0, 0, r+1); -- fl_color(FL_BLACK); -- fl_rectf(int(-r*0.7), int(-r*1.7), int(1.4*r), int(3.4*r)); -- fl_rectf(r-1, -1, 3, 3); -- fl_color(FL_WHITE); -- fl_pie(-r, -r, 2*r, 2*r, 0, 360); -- fl_color(FL_BLACK); -- fl_circle(0,0,r); -- fl_xyline(0, 0, int(-r*.7)); -- fl_xyline(0, 0, 0, int(-r*.7)); -- fl_end_offscreen(); -- return (CGContextRef)off; --} -+ ret = i->set_cursor(c); -+ if (ret) -+ return; - --CGContextRef Fl_X::nesw_cursor_image(void) --{ -- int c = 7, r = 2*c; -- int w = r, h = r; -- Fl_Offscreen off = Fl_Quartz_Graphics_Driver::create_offscreen_with_alpha(w, h); -- fl_begin_offscreen(off); -- CGContextSetRGBFillColor( (CGContextRef)off, 0,0,0,0); -- fl_rectf(0,0,w,h); -- CGContextTranslateCTM( (CGContextRef)off, 0, h); -- CGContextScaleCTM( (CGContextRef)off, 1, -1); -- fl_color(FL_BLACK); -- fl_polygon(0, 0, c, 0, 0, c); -- fl_polygon(r, r, r, r-c, r-c, r); -- fl_line_style(FL_SOLID, 2, 0); -- fl_line(0,1, r,r+1); -- fl_line_style(FL_SOLID, 0, 0); -- fl_end_offscreen(); -- return (CGContextRef)off; -+ fallback_cursor(this, c); - } - --CGContextRef Fl_X::nwse_cursor_image(void) --{ -- int c = 7, r = 2*c; -- int w = r, h = r; -- Fl_Offscreen off = Fl_Quartz_Graphics_Driver::create_offscreen_with_alpha(w, h); -- fl_begin_offscreen(off); -- CGContextSetRGBFillColor( (CGContextRef)off, 0,0,0,0); -- fl_rectf(0,0,w,h); -- CGContextTranslateCTM( (CGContextRef)off, 0, h); -- CGContextScaleCTM( (CGContextRef)off, 1, -1); -- fl_color(FL_BLACK); -- fl_polygon(r-1, 0, r-1, c, r-1-c, 0); -- fl_polygon(-1, r, c-1, r, -1, r-c); -- fl_line_style(FL_SOLID, 2, 0); -- fl_line(r-1,1, -1,r+1); -- fl_line_style(FL_SOLID, 0, 0); -- fl_end_offscreen(); -- return (CGContextRef)off; --} -- --void Fl_Window::cursor(Fl_Cursor c, Fl_Color, Fl_Color) { -- if (c == FL_CURSOR_DEFAULT) { -- c = cursor_default; -- } -- if (i) i->set_cursor(c); --} -+/** -+ Changes the cursor for this window. This always calls the system, if -+ you are changing the cursor a lot you may want to keep track of how -+ you set it in a static variable and call this only if the new cursor -+ is different. - --#else -+ The default cursor will be used if the provided image cannot be used -+ as a cursor. - --// I like the MSWindows resize cursors, so I duplicate them here: -+ \see cursor(Fl_Cursor), default_cursor() -+*/ -+void Fl_Window::cursor(const Fl_RGB_Image *image, int hotx, int hoty) { -+ int ret; - --#define CURSORSIZE 16 --#define HOTXY 7 --static struct TableEntry { -- uchar bits[CURSORSIZE*CURSORSIZE/8]; -- uchar mask[CURSORSIZE*CURSORSIZE/8]; -- Cursor cursor; --} table[] = { -- {{ // FL_CURSOR_NS -- 0x00, 0x00, 0x80, 0x01, 0xc0, 0x03, 0xe0, 0x07, 0x80, 0x01, 0x80, 0x01, -- 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, -- 0xe0, 0x07, 0xc0, 0x03, 0x80, 0x01, 0x00, 0x00}, -- { -- 0x80, 0x01, 0xc0, 0x03, 0xe0, 0x07, 0xf0, 0x0f, 0xf0, 0x0f, 0xc0, 0x03, -- 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xf0, 0x0f, -- 0xf0, 0x0f, 0xe0, 0x07, 0xc0, 0x03, 0x80, 0x01}}, -- {{ // FL_CURSOR_EW -- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x10, -- 0x0c, 0x30, 0xfe, 0x7f, 0xfe, 0x7f, 0x0c, 0x30, 0x08, 0x10, 0x00, 0x00, -- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, -- { -- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x1c, 0x38, -- 0xfe, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x7f, 0x1c, 0x38, 0x18, 0x18, -- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}}, -- {{ // FL_CURSOR_NWSE -- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x00, 0x38, 0x00, 0x78, 0x00, -- 0xe8, 0x00, 0xc0, 0x01, 0x80, 0x03, 0x00, 0x17, 0x00, 0x1e, 0x00, 0x1c, -- 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, -- { -- 0x00, 0x00, 0x00, 0x00, 0xfc, 0x00, 0xfc, 0x00, 0x7c, 0x00, 0xfc, 0x00, -- 0xfc, 0x01, 0xec, 0x03, 0xc0, 0x37, 0x80, 0x3f, 0x00, 0x3f, 0x00, 0x3e, -- 0x00, 0x3f, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00}}, -- {{ // FL_CURSOR_NESW -- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x1c, 0x00, 0x1e, -- 0x00, 0x17, 0x80, 0x03, 0xc0, 0x01, 0xe8, 0x00, 0x78, 0x00, 0x38, 0x00, -- 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, -- { -- 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x3f, 0x00, 0x3e, 0x00, 0x3f, -- 0x80, 0x3f, 0xc0, 0x37, 0xec, 0x03, 0xfc, 0x01, 0xfc, 0x00, 0x7c, 0x00, -- 0xfc, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00}}, -- {{0}, {0}} // FL_CURSOR_NONE & unknown --}; -+ // the cursor must be set for the top level window, not for subwindows -+ Fl_Window *w = window(), *toplevel = this; - --void Fl_Window::cursor(Fl_Cursor c, Fl_Color fg, Fl_Color bg) { -- if (!shown()) return; -- Cursor xc; -- int deleteit = 0; -- if (c == FL_CURSOR_DEFAULT) { -- c = cursor_default; -- fg = cursor_fg; -- bg = cursor_bg; -+ while (w) { -+ toplevel = w; -+ w = w->window(); - } - -- if (!c) { -- xc = None; -- } else { -- if (c >= FL_CURSOR_NS) { -- TableEntry *q = (c > FL_CURSOR_NESW) ? table+4 : table+(c-FL_CURSOR_NS); -- if (!(q->cursor)) { -- XColor dummy = { 0 }; -- Pixmap p = XCreateBitmapFromData(fl_display, -- RootWindow(fl_display, fl_screen), (const char*)(q->bits), -- CURSORSIZE, CURSORSIZE); -- Pixmap m = XCreateBitmapFromData(fl_display, -- RootWindow(fl_display, fl_screen), (const char*)(q->mask), -- CURSORSIZE, CURSORSIZE); -- q->cursor = XCreatePixmapCursor(fl_display, p,m,&dummy, &dummy, -- HOTXY, HOTXY); -- XFreePixmap(fl_display, m); -- XFreePixmap(fl_display, p); -- } -- xc = q->cursor; -- } else { -- xc = XCreateFontCursor(fl_display, (c-1)*2); -- deleteit = 1; -- } -- XColor fgc; -- uchar r,g,b; -- Fl::get_color(fg,r,g,b); -- fgc.red = r<<8; fgc.green = g<<8; fgc.blue = b<<8; -- XColor bgc; -- Fl::get_color(bg,r,g,b); -- bgc.red = r<<8; bgc.green = g<<8; bgc.blue = b<<8; -- XRecolorCursor(fl_display, xc, &fgc, &bgc); -+ if (toplevel != this) { -+ toplevel->cursor(image, hotx, hoty); -+ return; - } -- XDefineCursor(fl_display, fl_xid(this), xc); -- if (deleteit) XFreeCursor(fl_display, xc); -+ -+ if (!i) -+ return; -+ -+ ret = i->set_cursor(image, hotx, hoty); -+ if (ret) -+ return; -+ -+ cursor(FL_CURSOR_DEFAULT); - } - --#endif -+/* For back compatibility only. */ -+void Fl_Window::cursor(Fl_Cursor c, Fl_Color, Fl_Color) { -+ cursor(c); -+}; -+ -+void Fl_Window::default_cursor(Fl_Cursor c, Fl_Color, Fl_Color) { -+ default_cursor(c); -+}; -+ - - // - // End of "$Id: fl_cursor.cxx 9278 2012-03-12 11:55:50Z manolo $". -diff -up fltk-1.3.2/src/fl_cursor_help.xpm.cursor fltk-1.3.2/src/fl_cursor_help.xpm ---- fltk-1.3.2/src/fl_cursor_help.xpm.cursor 2013-01-30 16:07:59.534319820 +0100 -+++ fltk-1.3.2/src/fl_cursor_help.xpm 2013-01-30 16:07:59.534319820 +0100 -@@ -0,0 +1,95 @@ -+/* XPM */ -+static const char * fl_cursor_help_xpm[] = { -+"16 27 65 1", -+" c None", -+". c #FFFFFF", -+"+ c #E2E2E2", -+"@ c #1C1C1C", -+"# c #E7E7E7", -+"$ c #000000", -+"% c #212121", -+"& c #EAEAEA", -+"* c #262626", -+"= c #EDEDED", -+"- c #2C2C2C", -+"; c #F0F0F0", -+"> c #333333", -+", c #F1F1F1", -+"' c #393939", -+") c #F3F3F3", -+"! c #404040", -+"~ c #484848", -+"{ c #F4F4F4", -+"] c #050505", -+"^ c #202020", -+"/ c #707070", -+"( c #F5F5F5", -+"_ c #040404", -+": c #E1E1E1", -+"< c #EEEEEE", -+"[ c #EFEFEF", -+"} c #FEFEFE", -+"| c #3D3D3D", -+"1 c #7E7E7E", -+"2 c #696969", -+"3 c #414141", -+"4 c #131313", -+"5 c #080808", -+"6 c #454545", -+"7 c #F2F2F2", -+"8 c #878787", -+"9 c #7D7D7D", -+"0 c #101010", -+"a c #111111", -+"b c #FDFDFD", -+"c c #8A8A8A", -+"d c #E6E6E6", -+"e c #7B7B7B", -+"f c #4C4C4C", -+"g c #5C5C5C", -+"h c #9F9F9F", -+"i c #F9F9F9", -+"j c #F7F7F7", -+"k c #B1B1B1", -+"l c #2E2E2E", -+"m c #767676", -+"n c #DCDCDC", -+"o c #DEDEDE", -+"p c #C7C7C7", -+"q c #1B1B1B", -+"r c #6B6B6B", -+"s c #575757", -+"t c #797979", -+"u c #020202", -+"v c #010101", -+"w c #FBFBFB", -+"x c #D7D7D7", -+"y c #D8D8D8", -+"z c #060606", -+" ", -+". ", -+".+ ", -+".@# ", -+".$%& ", -+".$$*= ", -+".$$$-; ", -+".$$$$>, ", -+".$$$$$') ", -+".$$$$$$!) ", -+".$$$$$$$~{ ", -+".$$$$]^^^/( ", -+".$$$$_:(<<[} ", -+".$$|1$2< ", -+".$3,(45[ ", -+".67 78$9, ", -+".7 {0a( .... ", -+"b ,c5[defgh, ", -+" )ijk_la$m.", -+" no.p$q.", -+" .r$s.", -+" .t$-= ", -+" 7uv+ ", -+" wxy. ", -+" :$z. ", -+" :$z. ", -+" .... "}; -diff -up fltk-1.3.2/src/fl_cursor_nesw.xpm.cursor fltk-1.3.2/src/fl_cursor_nesw.xpm ---- fltk-1.3.2/src/fl_cursor_nesw.xpm.cursor 2013-01-30 16:07:59.534319820 +0100 -+++ fltk-1.3.2/src/fl_cursor_nesw.xpm 2013-01-30 16:07:59.534319820 +0100 -@@ -0,0 +1,46 @@ -+/* XPM */ -+static const char * fl_cursor_nesw_xpm[] = { -+"15 15 28 1", -+" c None", -+". c #FFFFFF", -+"+ c #767676", -+"@ c #000000", -+"# c #4E4E4E", -+"$ c #0C0C0C", -+"% c #494949", -+"& c #4D4D4D", -+"* c #1B1B1B", -+"= c #515151", -+"- c #646464", -+"; c #363636", -+"> c #6A6A6A", -+", c #545454", -+"' c #585858", -+") c #242424", -+"! c #797979", -+"~ c #2E2E2E", -+"{ c #444444", -+"] c #3B3B3B", -+"^ c #0A0A0A", -+"/ c #595959", -+"( c #F7F7F7", -+"_ c #080808", -+": c #6B6B6B", -+"< c #FDFDFD", -+"[ c #FCFCFC", -+"} c #FEFEFE", -+" ..........", -+" .+@@@@@@.", -+" .#@@@@@.", -+" .$@@@@.", -+" .%@@@@@.", -+". .&@@@*@@.", -+".. .=@@@-.;@.", -+".>. .,@@@'. .).", -+".@!.'@@@#. ..", -+".@@~@@@{. .", -+".@@@@@]. ", -+".@@@@^. ", -+".@@@@@/( ", -+".______:( ", -+"<[[[[[[[[} "}; -diff -up fltk-1.3.2/src/fl_cursor_none.xpm.cursor fltk-1.3.2/src/fl_cursor_none.xpm ---- fltk-1.3.2/src/fl_cursor_none.xpm.cursor 2013-01-30 16:07:59.534319820 +0100 -+++ fltk-1.3.2/src/fl_cursor_none.xpm 2013-01-30 16:07:59.534319820 +0100 -@@ -0,0 +1,19 @@ -+/* XPM */ -+static const char * fl_cursor_none_xpm[] = { -+"15 15 1 1", -+" c None", -+" ", -+" ", -+" ", -+" ", -+" ", -+" ", -+" ", -+" ", -+" ", -+" ", -+" ", -+" ", -+" ", -+" ", -+" "}; -diff -up fltk-1.3.2/src/fl_cursor_nwse.xpm.cursor fltk-1.3.2/src/fl_cursor_nwse.xpm ---- fltk-1.3.2/src/fl_cursor_nwse.xpm.cursor 2013-01-30 16:07:59.534319820 +0100 -+++ fltk-1.3.2/src/fl_cursor_nwse.xpm 2013-01-30 16:07:59.535319802 +0100 -@@ -0,0 +1,46 @@ -+/* XPM */ -+static const char * fl_cursor_nwse_xpm[] = { -+"15 15 28 1", -+" c None", -+". c #FFFFFF", -+"+ c #000000", -+"@ c #767676", -+"# c #4E4E4E", -+"$ c #0C0C0C", -+"% c #494949", -+"& c #1B1B1B", -+"* c #4D4D4D", -+"= c #363636", -+"- c #646464", -+"; c #515151", -+"> c #242424", -+", c #585858", -+"' c #545454", -+") c #6A6A6A", -+"! c #797979", -+"~ c #444444", -+"{ c #2E2E2E", -+"] c #3B3B3B", -+"^ c #0A0A0A", -+"/ c #F7F7F7", -+"( c #595959", -+"_ c #6B6B6B", -+": c #080808", -+"< c #FEFEFE", -+"[ c #FCFCFC", -+"} c #FDFDFD", -+".......... ", -+".++++++@. ", -+".+++++#. ", -+".++++$. ", -+".+++++%. ", -+".++&+++*. .", -+".+=.-+++;. ..", -+".>. .,+++'. .).", -+".. .#+++,.!+.", -+". .~+++{++.", -+" .]+++++.", -+" .^++++.", -+" /(+++++.", -+" /_::::::.", -+" <[[[[[[[[}"}; -diff -up fltk-1.3.2/src/fl_cursor_wait.xpm.cursor fltk-1.3.2/src/fl_cursor_wait.xpm ---- fltk-1.3.2/src/fl_cursor_wait.xpm.cursor 2013-01-30 16:07:59.535319802 +0100 -+++ fltk-1.3.2/src/fl_cursor_wait.xpm 2013-01-30 16:07:59.535319802 +0100 -@@ -0,0 +1,72 @@ -+/* XPM */ -+static const char * fl_cursor_wait_xpm[] = { -+"17 32 37 1", -+" c None", -+". c #FFFFFF", -+"+ c #2E2E2E", -+"@ c #202020", -+"# c #F1F1F1", -+"$ c #2D2D2D", -+"% c #000000", -+"& c #EDEDED", -+"* c #585858", -+"= c #575757", -+"- c #FBFBFB", -+"; c #848484", -+"> c #B8B8B8", -+", c #E5E5E5", -+"' c #F7F7F7", -+") c #181818", -+"! c #F0F0F0", -+"~ c #616161", -+"{ c #B7B7B7", -+"] c #F5F5F5", -+"^ c #050505", -+"/ c #D4D4D4", -+"( c #EEEEEE", -+"_ c #595959", -+": c #7B7B7B", -+"< c #E9E9E9", -+"[ c #131313", -+"} c #E3E3E3", -+"| c #767676", -+"1 c #505050", -+"2 c #F3F3F3", -+"3 c #2A2A2A", -+"4 c #070707", -+"5 c #343434", -+"6 c #939393", -+"7 c #191919", -+"8 c #6A6A6A", -+".................", -+".+@@@@@@@@@@@@@+.", -+".................", -+" #$%%%%%%%%%%%$# ", -+" &*%%%%%%%%%%%=& ", -+" -;%%%%%%%%%%%;- ", -+" >%%%%%%%%%%%> ", -+" ,%%%%%%%%%%%, ", -+" ')%%%%%%%%%)' ", -+" !~%%%%%%%%%~! ", -+" {%%%%%%%%%{ ", -+" ]^/...../^] ", -+" (_:.....:_( ", -+" <[}...}[< ", -+" !|1...1|! ", -+" 2[3.3[2 ", -+" 2[%.%[2 ", -+" !|%%.%%|! ", -+" <4%%.%%4< ", -+" (_%%%.%%%_( ", -+" ]^%%%.%%%^] ", -+" {%%%%.%%%%{ ", -+" !~%%%%.%%%%~! ", -+" ')%%%%.%%%%)' ", -+" ,%%56{.{65%%, ", -+" >%*.......*%> ", -+" -;7&.......&7;- ", -+" &*8.........8=& ", -+" #$%%%%%%%%%%%$# ", -+".................", -+".+@@@@@@@@@@@@@+.", -+"................."}; -diff -up fltk-1.3.2/src/Fl_win32.cxx.cursor fltk-1.3.2/src/Fl_win32.cxx ---- fltk-1.3.2/src/Fl_win32.cxx.cursor 2013-01-30 16:07:59.519320086 +0100 -+++ fltk-1.3.2/src/Fl_win32.cxx 2013-01-30 16:07:59.536319784 +0100 -@@ -1633,7 +1633,6 @@ void fl_fix_focus(); // in Fl.cxx - - char fl_show_iconic; // hack for Fl_Window::iconic() - // int fl_background_pixel = -1; // color to use for background --HCURSOR fl_default_cursor; - UINT fl_wake_msg = 0; - int fl_disable_transient_for; // secret method of removing TRANSIENT_FOR - -@@ -1682,7 +1681,7 @@ Fl_X* Fl_X::make(Fl_Window* w) { - if (!w->icon()) - w->icon((void *)LoadIcon(NULL, IDI_APPLICATION)); - wcw.hIcon = wcw.hIconSm = (HICON)w->icon(); -- wcw.hCursor = fl_default_cursor = LoadCursor(NULL, IDC_ARROW); -+ wcw.hCursor = LoadCursor(NULL, IDC_ARROW); - //uchar r,g,b; Fl::get_color(FL_GRAY,r,g,b); - //wc.hbrBackground = (HBRUSH)CreateSolidBrush(RGB(r,g,b)); - wcw.hbrBackground = NULL; -@@ -1774,7 +1773,8 @@ Fl_X* Fl_X::make(Fl_Window* w) { - x->setwindow(w); - x->region = 0; - x->private_dc = 0; -- x->cursor = fl_default_cursor; -+ x->cursor = LoadCursor(NULL, IDC_ARROW); -+ x->custom_cursor = 0; - if (!fl_codepage) fl_get_codepage(); - - WCHAR *lab = NULL; -@@ -2025,6 +2025,153 @@ void Fl_Window::label(const char *name,c - } - - //////////////////////////////////////////////////////////////// -+ -+#ifndef IDC_HAND -+# define IDC_HAND MAKEINTRESOURCE(32649) -+#endif // !IDC_HAND -+ -+int Fl_X::set_cursor(Fl_Cursor c) { -+ LPSTR n; -+ HCURSOR new_cursor; -+ -+ if (c == FL_CURSOR_NONE) -+ new_cursor = NULL; -+ else { -+ switch (c) { -+ case FL_CURSOR_ARROW: n = IDC_ARROW; break; -+ case FL_CURSOR_CROSS: n = IDC_CROSS; break; -+ case FL_CURSOR_WAIT: n = IDC_WAIT; break; -+ case FL_CURSOR_INSERT: n = IDC_IBEAM; break; -+ case FL_CURSOR_HAND: n = IDC_HAND; break; -+ case FL_CURSOR_HELP: n = IDC_HELP; break; -+ case FL_CURSOR_MOVE: n = IDC_SIZEALL; break; -+ case FL_CURSOR_N: -+ case FL_CURSOR_S: -+ // FIXME: Should probably have fallbacks for these instead -+ case FL_CURSOR_NS: n = IDC_SIZENS; break; -+ case FL_CURSOR_NE: -+ case FL_CURSOR_SW: -+ // FIXME: Dito. -+ case FL_CURSOR_NESW: n = IDC_SIZENESW; break; -+ case FL_CURSOR_E: -+ case FL_CURSOR_W: -+ // FIXME: Dito. -+ case FL_CURSOR_WE: n = IDC_SIZEWE; break; -+ case FL_CURSOR_SE: -+ case FL_CURSOR_NW: -+ // FIXME: Dito. -+ case FL_CURSOR_NWSE: n = IDC_SIZENWSE; break; -+ default: -+ return 0; -+ } -+ -+ new_cursor = LoadCursor(NULL, n); -+ if (new_cursor == NULL) -+ return 0; -+ } -+ -+ if ((cursor != NULL) && custom_cursor) -+ DestroyIcon(cursor); -+ -+ cursor = new_cursor; -+ custom_cursor = 0; -+ -+ SetCursor(cursor); -+ -+ return 1; -+} -+ -+int Fl_X::set_cursor(const Fl_RGB_Image *image, int hotx, int hoty) { -+ BITMAPV5HEADER bi; -+ HBITMAP bitmap, mask; -+ DWORD *bits; -+ HCURSOR new_cursor; -+ -+ if ((hotx < 0) || (hotx >= image->w())) -+ return 0; -+ if ((hoty < 0) || (hoty >= image->h())) -+ return 0; -+ -+ memset(&bi, 0, sizeof(BITMAPV5HEADER)); -+ -+ bi.bV5Size = sizeof(BITMAPV5HEADER); -+ bi.bV5Width = image->w(); -+ bi.bV5Height = -image->h(); // Negative for top-down -+ bi.bV5Planes = 1; -+ bi.bV5BitCount = 32; -+ bi.bV5Compression = BI_BITFIELDS; -+ bi.bV5RedMask = 0x00FF0000; -+ bi.bV5GreenMask = 0x0000FF00; -+ bi.bV5BlueMask = 0x000000FF; -+ bi.bV5AlphaMask = 0xFF000000; -+ -+ HDC hdc; -+ -+ hdc = GetDC(NULL); -+ bitmap = CreateDIBSection(hdc, (BITMAPINFO*)&bi, DIB_RGB_COLORS, (void**)&bits, NULL, 0); -+ ReleaseDC(NULL, hdc); -+ -+ if (bits == NULL) -+ return 0; -+ -+ const uchar *i = (const uchar*)*image->data(); -+ for (int y = 0;y < image->h();y++) { -+ for (int x = 0;x < image->w();x++) { -+ switch (image->d()) { -+ case 1: -+ *bits = (0xff<<24) | (i[0]<<16) | (i[0]<<8) | i[0]; -+ break; -+ case 2: -+ *bits = (i[1]<<24) | (i[0]<<16) | (i[0]<<8) | i[0]; -+ break; -+ case 3: -+ *bits = (0xff<<24) | (i[0]<<16) | (i[1]<<8) | i[2]; -+ break; -+ case 4: -+ *bits = (i[3]<<24) | (i[0]<<16) | (i[1]<<8) | i[2]; -+ break; -+ } -+ i += image->d(); -+ bits++; -+ } -+ i += image->ld(); -+ } -+ -+ // A mask bitmap is still needed even though it isn't used -+ mask = CreateBitmap(image->w(),image->h(),1,1,NULL); -+ if (mask == NULL) { -+ DeleteObject(bitmap); -+ return 0; -+ } -+ -+ ICONINFO ii; -+ -+ ii.fIcon = FALSE; -+ ii.xHotspot = hotx; -+ ii.yHotspot = hoty; -+ ii.hbmMask = mask; -+ ii.hbmColor = bitmap; -+ -+ new_cursor = CreateIconIndirect(&ii); -+ -+ DeleteObject(bitmap); -+ DeleteObject(mask); -+ -+ if (new_cursor == NULL) -+ return 0; -+ -+ if ((cursor != NULL) && custom_cursor) -+ DestroyIcon(cursor); -+ -+ cursor = new_cursor; -+ custom_cursor = 1; -+ -+ SetCursor(cursor); -+ -+ return 1; -+} -+ -+//////////////////////////////////////////////////////////////// - // Implement the virtual functions for the base Fl_Window class: - - // If the box is a filled rectangle, we can make the redisplay *look* -diff -up fltk-1.3.2/src/Fl_Window.cxx.cursor fltk-1.3.2/src/Fl_Window.cxx ---- fltk-1.3.2/src/Fl_Window.cxx.cursor 2012-11-06 21:46:14.000000000 +0100 -+++ fltk-1.3.2/src/Fl_Window.cxx 2013-01-30 16:07:59.536319784 +0100 -@@ -62,8 +62,6 @@ void Fl_Window::_Fl_Window() { - Fl_Window::Fl_Window(int X,int Y,int W, int H, const char *l) - : Fl_Group(X, Y, W, H, l) { - cursor_default = FL_CURSOR_DEFAULT; -- cursor_fg = FL_BLACK; -- cursor_bg = FL_WHITE; - - _Fl_Window(); - set_flag(FORCE_POSITION); -@@ -73,8 +71,6 @@ Fl_Window::Fl_Window(int W, int H, const - // fix common user error of a missing end() with current(0): - : Fl_Group((Fl_Group::current(0),0), 0, W, H, l) { - cursor_default = FL_CURSOR_DEFAULT; -- cursor_fg = FL_BLACK; -- cursor_bg = FL_WHITE; - - _Fl_Window(); - clear_visible(); -diff -up fltk-1.3.2/src/Fl_x.cxx.cursor fltk-1.3.2/src/Fl_x.cxx ---- fltk-1.3.2/src/Fl_x.cxx.cursor 2013-01-30 16:07:59.512320211 +0100 -+++ fltk-1.3.2/src/Fl_x.cxx 2013-01-30 16:07:59.537319766 +0100 -@@ -59,6 +59,11 @@ static int xfixes_event_base = 0; - static bool have_xfixes = false; - # endif - -+# include -+ -+# if HAVE_XCURSOR -+# include -+# endif - static Fl_Xlib_Graphics_Driver fl_xlib_driver; - static Fl_Display_Device fl_xlib_display(&fl_xlib_driver); - Fl_Display_Device *Fl_Display_Device::_display = &fl_xlib_display;// the platform display -@@ -2259,6 +2264,94 @@ void Fl_Window::size_range_() { - } - - //////////////////////////////////////////////////////////////// -+ -+int Fl_X::set_cursor(Fl_Cursor c) { -+ unsigned int shape; -+ Cursor xc; -+ -+ switch (c) { -+ case FL_CURSOR_ARROW: shape = XC_left_ptr; break; -+ case FL_CURSOR_CROSS: shape = XC_tcross; break; -+ case FL_CURSOR_WAIT: shape = XC_watch; break; -+ case FL_CURSOR_INSERT: shape = XC_xterm; break; -+ case FL_CURSOR_HAND: shape = XC_hand2; break; -+ case FL_CURSOR_HELP: shape = XC_question_arrow; break; -+ case FL_CURSOR_MOVE: shape = XC_fleur; break; -+ case FL_CURSOR_NS: shape = XC_sb_v_double_arrow; break; -+ case FL_CURSOR_WE: shape = XC_sb_h_double_arrow; break; -+ case FL_CURSOR_NE: shape = XC_top_right_corner; break; -+ case FL_CURSOR_N: shape = XC_top_side; break; -+ case FL_CURSOR_NW: shape = XC_top_left_corner; break; -+ case FL_CURSOR_E: shape = XC_right_side; break; -+ case FL_CURSOR_W: shape = XC_left_side; break; -+ case FL_CURSOR_SE: shape = XC_bottom_right_corner; break; -+ case FL_CURSOR_S: shape = XC_bottom_side; break; -+ case FL_CURSOR_SW: shape = XC_bottom_left_corner; break; -+ default: -+ return 0; -+ } -+ -+ xc = XCreateFontCursor(fl_display, shape); -+ XDefineCursor(fl_display, xid, xc); -+ XFreeCursor(fl_display, xc); -+ -+ return 1; -+} -+ -+int Fl_X::set_cursor(const Fl_RGB_Image *image, int hotx, int hoty) { -+#if ! HAVE_XCURSOR -+ return 0; -+#else -+ XcursorImage *cursor; -+ Cursor xc; -+ -+ if ((hotx < 0) || (hotx >= image->w())) -+ return 0; -+ if ((hoty < 0) || (hoty >= image->h())) -+ return 0; -+ -+ cursor = XcursorImageCreate(image->w(), image->h()); -+ if (!cursor) -+ return 0; -+ -+ const uchar *i = (const uchar*)*image->data(); -+ XcursorPixel *o = cursor->pixels; -+ for (int y = 0;y < image->h();y++) { -+ for (int x = 0;x < image->w();x++) { -+ switch (image->d()) { -+ case 1: -+ *o = (0xff<<24) | (i[0]<<16) | (i[0]<<8) | i[0]; -+ break; -+ case 2: -+ *o = (i[1]<<24) | (i[0]<<16) | (i[0]<<8) | i[0]; -+ break; -+ case 3: -+ *o = (0xff<<24) | (i[0]<<16) | (i[1]<<8) | i[2]; -+ break; -+ case 4: -+ *o = (i[3]<<24) | (i[0]<<16) | (i[1]<<8) | i[2]; -+ break; -+ } -+ i += image->d(); -+ o++; -+ } -+ i += image->ld(); -+ } -+ -+ cursor->xhot = hotx; -+ cursor->yhot = hoty; -+ -+ xc = XcursorImageLoadCursor(fl_display, cursor); -+ XDefineCursor(fl_display, xid, xc); -+ XFreeCursor(fl_display, xc); -+ -+ XcursorImageDestroy(cursor); -+ -+ return 1; -+#endif -+} -+ -+//////////////////////////////////////////////////////////////// - - // returns pointer to the filename, or null if name ends with '/' - const char *fl_filename_name(const char *name) { -diff -up fltk-1.3.2/test/cursor.cxx.cursor fltk-1.3.2/test/cursor.cxx ---- fltk-1.3.2/test/cursor.cxx.cursor 2011-07-19 06:49:30.000000000 +0200 -+++ fltk-1.3.2/test/cursor.cxx 2013-01-30 16:07:59.537319766 +0100 -@@ -23,8 +23,6 @@ - #include - #include - --Fl_Color fg = FL_BLACK; --Fl_Color bg = FL_WHITE; - Fl_Cursor cursor = FL_CURSOR_DEFAULT; - - Fl_Hor_Value_Slider *cursor_slider; -@@ -32,7 +30,7 @@ Fl_Hor_Value_Slider *cursor_slider; - void choice_cb(Fl_Widget *, void *v) { - cursor = (Fl_Cursor)(fl_intptr_t)v; - cursor_slider->value(cursor); -- fl_cursor(cursor,fg,bg); -+ fl_cursor(cursor); - } - - Fl_Menu_Item choices[] = { -@@ -48,8 +46,6 @@ Fl_Menu_Item choices[] = { - {"FL_CURSOR_WE",0,choice_cb,(void*)FL_CURSOR_WE}, - {"FL_CURSOR_NWSE",0,choice_cb,(void*)FL_CURSOR_NWSE}, - {"FL_CURSOR_NESW",0,choice_cb,(void*)FL_CURSOR_NESW}, -- {"FL_CURSOR_NONE",0,choice_cb,(void*)FL_CURSOR_NONE}, --#if 0 - {"FL_CURSOR_N",0,choice_cb,(void*)FL_CURSOR_N}, - {"FL_CURSOR_NE",0,choice_cb,(void*)FL_CURSOR_NE}, - {"FL_CURSOR_E",0,choice_cb,(void*)FL_CURSOR_E}, -@@ -58,26 +54,14 @@ Fl_Menu_Item choices[] = { - {"FL_CURSOR_SW",0,choice_cb,(void*)FL_CURSOR_SW}, - {"FL_CURSOR_W",0,choice_cb,(void*)FL_CURSOR_W}, - {"FL_CURSOR_NW",0,choice_cb,(void*)FL_CURSOR_NW}, --#endif -+ {"FL_CURSOR_NONE",0,choice_cb,(void*)FL_CURSOR_NONE}, - {0} - }; - - void setcursor(Fl_Widget *o, void *) { - Fl_Hor_Value_Slider *slider = (Fl_Hor_Value_Slider *)o; - cursor = Fl_Cursor((int)slider->value()); -- fl_cursor(cursor,fg,bg); --} -- --void setfg(Fl_Widget *o, void *) { -- Fl_Hor_Value_Slider *slider = (Fl_Hor_Value_Slider *)o; -- fg = Fl_Color((int)slider->value()); -- fl_cursor(cursor,fg,bg); --} -- --void setbg(Fl_Widget *o, void *) { -- Fl_Hor_Value_Slider *slider = (Fl_Hor_Value_Slider *)o; -- bg = Fl_Color((int)slider->value()); -- fl_cursor(cursor,fg,bg); -+ fl_cursor(cursor); - } - - // draw the label without any ^C or \nnn conversions: -@@ -103,29 +87,11 @@ int main(int argc, char **argv) { - slider1.align(FL_ALIGN_LEFT); - slider1.step(1); - slider1.precision(0); -- slider1.bounds(0,100); -+ slider1.bounds(0,255); - slider1.value(0); - slider1.callback(setcursor); - slider1.value(cursor); - -- Fl_Hor_Value_Slider slider2(80,220,310,30,"fgcolor:"); -- slider2.align(FL_ALIGN_LEFT); -- slider2.step(1); -- slider2.precision(0); -- slider2.bounds(0,255); -- slider2.value(0); -- slider2.callback(setfg); -- slider2.value(fg); -- -- Fl_Hor_Value_Slider slider3(80,260,310,30,"bgcolor:"); -- slider3.align(FL_ALIGN_LEFT); -- slider3.step(1); -- slider3.precision(0); -- slider3.bounds(0,255); -- slider3.value(0); -- slider3.callback(setbg); -- slider3.value(bg); -- - #if 0 - // draw the manual's diagram of cursors... - window.size(400,800); diff --git a/contrib/packages/rpm/el6/SOURCES/fltk-1_v6.3.x-clipboard-x11.patch b/contrib/packages/rpm/el6/SOURCES/fltk-1_v6.3.x-clipboard-x11.patch deleted file mode 100644 index 9e253a3..0000000 --- a/contrib/packages/rpm/el6/SOURCES/fltk-1_v6.3.x-clipboard-x11.patch +++ /dev/null @@ -1,355 +0,0 @@ -diff -up fltk-1.3.2/CMakeLists.txt.clp-x11 fltk-1.3.2/CMakeLists.txt ---- fltk-1.3.2/CMakeLists.txt.clp-x11 2012-09-13 16:19:01.000000000 +0200 -+++ fltk-1.3.2/CMakeLists.txt 2013-01-30 15:56:25.810663430 +0100 -@@ -515,6 +515,20 @@ else() - endif(OPTION_USE_XINERAMA) - - ####################################################################### -+if(X11_Xfixes_FOUND) -+ option(OPTION_USE_XFIXES "use lib XFIXES" ON) -+endif(X11_Xfixes_FOUND) -+ -+if(OPTION_USE_XFIXES) -+ set(HAVE_XFIXES ${X11_Xfixes_FOUND}) -+ include_directories(${X11_Xfixes_INCLUDE_PATH}) -+ list(APPEND FLTK_LDLIBS -lXfixes) -+ set(FLTK_XFIXES_FOUND TRUE) -+else() -+ set(FLTK_XFIXES_FOUND FALSE) -+endif(OPTION_USE_XFIXES) -+ -+####################################################################### - if(X11_Xft_FOUND) - option(OPTION_USE_XFT "use lib Xft" ON) - endif(X11_Xft_FOUND) -diff -up fltk-1.3.2/configh.cmake.in.clp-x11 fltk-1.3.2/configh.cmake.in ---- fltk-1.3.2/configh.cmake.in.clp-x11 2011-07-19 06:49:30.000000000 +0200 -+++ fltk-1.3.2/configh.cmake.in 2013-01-30 15:56:25.810663430 +0100 -@@ -108,6 +108,14 @@ - #define USE_XDBE HAVE_XDBE - - /* -+ * HAVE_XFIXES: -+ * -+ * Do we have the X fixes extension? -+ */ -+ -+#cmakedefine01 HAVE_XFIXES -+ -+/* - * __APPLE_QUARTZ__: - * - * If __APPLE_QUARTZ__ is defined, FLTK will be -diff -up fltk-1.3.2/configh.in.clp-x11 fltk-1.3.2/configh.in ---- fltk-1.3.2/configh.in.clp-x11 2011-10-04 11:21:47.000000000 +0200 -+++ fltk-1.3.2/configh.in 2013-01-30 15:56:25.810663430 +0100 -@@ -108,6 +108,14 @@ - #define USE_XDBE HAVE_XDBE - - /* -+ * HAVE_XFIXES: -+ * -+ * Do we have the X fixes extension? -+ */ -+ -+#define HAVE_XFIXES 0 -+ -+/* - * __APPLE_QUARTZ__: - * - * All Apple implementations are now based on Quartz and Cocoa, -diff -up fltk-1.3.2/configure.in.clp-x11 fltk-1.3.2/configure.in ---- fltk-1.3.2/configure.in.clp-x11 2013-01-30 15:56:25.802663573 +0100 -+++ fltk-1.3.2/configure.in 2013-01-30 15:56:25.810663430 +0100 -@@ -999,6 +999,16 @@ case $uname_GUI in - LIBS="-lXext $LIBS") - fi - -+ dnl Check for the Xfixes extension unless disabled... -+ AC_ARG_ENABLE(xfixes, [ --enable-xfixes turn on Xfixes support [default=yes]]) -+ -+ if test x$enable_xfixes != xno; then -+ AC_CHECK_HEADER(X11/extensions/Xfixes.h, AC_DEFINE(HAVE_XFIXES),, -+ [#include ]) -+ AC_CHECK_LIB(Xfixes, XFixesQueryExtension, -+ LIBS="-lXfixes $LIBS") -+ fi -+ - dnl Check for overlay visuals... - AC_PATH_PROG(XPROP, xprop) - AC_CACHE_CHECK(for X overlay visuals, ac_cv_have_overlay, -diff -up fltk-1.3.2/fluid/CMakeLists.txt.clp-x11 fltk-1.3.2/fluid/CMakeLists.txt -diff -up fltk-1.3.2/src/CMakeLists.txt.clp-x11 fltk-1.3.2/src/CMakeLists.txt ---- fltk-1.3.2/src/CMakeLists.txt.clp-x11 2013-01-30 16:06:00.785430590 +0100 -+++ fltk-1.3.2/src/CMakeLists.txt 2013-01-30 16:06:17.883126642 +0100 -@@ -243,6 +243,10 @@ if(HAVE_XINERAMA) - target_link_libraries(fltk ${X11_Xinerama_LIB}) - endif(HAVE_XINERAMA) - -+if(HAVE_XFIXES) -+ target_link_libraries(fltk ${X11_Xfixes_LIB}) -+endif(HAVE_XFIXES) -+ - if(USE_XFT) - target_link_libraries(fltk ${X11_Xft_LIB}) - endif(USE_XFT) -diff -up fltk-1.3.2/src/Fl_x.cxx.clp-x11 fltk-1.3.2/src/Fl_x.cxx ---- fltk-1.3.2/src/Fl_x.cxx.clp-x11 2013-01-30 15:56:25.793663733 +0100 -+++ fltk-1.3.2/src/Fl_x.cxx 2013-01-30 16:03:37.355981103 +0100 -@@ -53,6 +53,12 @@ static XRRUpdateConfiguration_type XRRUp - static int randrEventBase; // base of RandR-defined events - #endif - -+# if HAVE_XFIXES -+# include -+static int xfixes_event_base = 0; -+static bool have_xfixes = false; -+# endif -+ - static Fl_Xlib_Graphics_Driver fl_xlib_driver; - static Fl_Display_Device fl_xlib_display(&fl_xlib_driver); - Fl_Display_Device *Fl_Display_Device::_display = &fl_xlib_display;// the platform display -@@ -307,6 +313,9 @@ static Atom WM_PROTOCOLS; - static Atom fl_MOTIF_WM_HINTS; - static Atom TARGETS; - static Atom CLIPBOARD; -+static Atom TIMESTAMP; -+static Atom PRIMARY_TIMESTAMP; -+static Atom CLIPBOARD_TIMESTAMP; - Atom fl_XdndAware; - Atom fl_XdndSelection; - Atom fl_XdndEnter; -@@ -667,6 +676,9 @@ void fl_open_display(Display* d) { - fl_MOTIF_WM_HINTS = XInternAtom(d, "_MOTIF_WM_HINTS", 0); - TARGETS = XInternAtom(d, "TARGETS", 0); - CLIPBOARD = XInternAtom(d, "CLIPBOARD", 0); -+ TIMESTAMP = XInternAtom(d, "TIMESTAMP", 0); -+ PRIMARY_TIMESTAMP = XInternAtom(d, "PRIMARY_TIMESTAMP", 0); -+ CLIPBOARD_TIMESTAMP = XInternAtom(d, "CLIPBOARD_TIMESTAMP", 0); - fl_XdndAware = XInternAtom(d, "XdndAware", 0); - fl_XdndSelection = XInternAtom(d, "XdndSelection", 0); - fl_XdndEnter = XInternAtom(d, "XdndEnter", 0); -@@ -713,6 +725,15 @@ void fl_open_display(Display* d) { - #if !USE_COLORMAP - Fl::visual(FL_RGB); - #endif -+ -+#if HAVE_XFIXES -+ int error_base; -+ if (XFixesQueryExtension(fl_display, &xfixes_event_base, &error_base)) -+ have_xfixes = true; -+ else -+ have_xfixes = false; -+#endif -+ - #if USE_XRANDR - void *libxrandr_addr = dlopen("libXrandr.so.2", RTLD_LAZY); - if (!libxrandr_addr) libxrandr_addr = dlopen("libXrandr.so", RTLD_LAZY); -@@ -901,6 +922,107 @@ void Fl::copy(const char *stuff, int len - } - - //////////////////////////////////////////////////////////////// -+// Code for tracking clipboard changes: -+ -+static Time primary_timestamp = -1; -+static Time clipboard_timestamp = -1; -+ -+extern bool fl_clipboard_notify_empty(void); -+extern void fl_trigger_clipboard_notify(int source); -+ -+static void poll_clipboard_owner(void) { -+ Window xid; -+ -+#if HAVE_XFIXES -+ // No polling needed with Xfixes -+ if (have_xfixes) -+ return; -+#endif -+ -+ // No one is interested, so no point polling -+ if (fl_clipboard_notify_empty()) -+ return; -+ -+ // We need a window for this to work -+ if (!Fl::first_window()) -+ return; -+ xid = fl_xid(Fl::first_window()); -+ if (!xid) -+ return; -+ -+ // Request an update of the selection time for both the primary and -+ // clipboard selections. Magic continues when we get a SelectionNotify. -+ if (!fl_i_own_selection[0]) -+ XConvertSelection(fl_display, XA_PRIMARY, TIMESTAMP, PRIMARY_TIMESTAMP, -+ xid, fl_event_time); -+ if (!fl_i_own_selection[1]) -+ XConvertSelection(fl_display, CLIPBOARD, TIMESTAMP, CLIPBOARD_TIMESTAMP, -+ xid, fl_event_time); -+} -+ -+static void clipboard_timeout(void *data) -+{ -+ // No one is interested, so stop polling -+ if (fl_clipboard_notify_empty()) -+ return; -+ -+ poll_clipboard_owner(); -+ -+ Fl::repeat_timeout(0.5, clipboard_timeout); -+} -+ -+static void handle_clipboard_timestamp(int clipboard, Time time) -+{ -+ Time *timestamp; -+ -+ timestamp = clipboard ? &clipboard_timestamp : &primary_timestamp; -+ -+#if HAVE_XFIXES -+ if (!have_xfixes) -+#endif -+ { -+ // Initial scan, just store the value -+ if (*timestamp == (Time)-1) { -+ *timestamp = time; -+ return; -+ } -+ } -+ -+ // Same selection -+ if (time == *timestamp) -+ return; -+ -+ *timestamp = time; -+ -+ // The clipboard change is the event that caused us to request -+ // the clipboard data, so use that time as the latest event. -+ if (time > fl_event_time) -+ fl_event_time = time; -+ -+ // Something happened! Let's tell someone! -+ fl_trigger_clipboard_notify(clipboard); -+} -+ -+void fl_clipboard_notify_change() { -+ // Reset the timestamps if we've going idle so that you don't -+ // get a bogus immediate trigger next time they're activated. -+ if (fl_clipboard_notify_empty()) { -+ primary_timestamp = -1; -+ clipboard_timestamp = -1; -+ } else { -+#if HAVE_XFIXES -+ if (!have_xfixes) -+#endif -+ { -+ poll_clipboard_owner(); -+ -+ if (!Fl::has_timeout(clipboard_timeout)) -+ Fl::add_timeout(0.5, clipboard_timeout); -+ } -+ } -+} -+ -+//////////////////////////////////////////////////////////////// - - const XEvent* fl_xevent; // the current x event - ulong fl_event_time; // the last timestamp from an x event -@@ -1024,7 +1141,6 @@ int fl_handle(const XEvent& thisevent) - return 0; - - case SelectionNotify: { -- if (!fl_selection_requestor) return 0; - static unsigned char* buffer = 0; - if (buffer) {XFree(buffer); buffer = 0;} - long bytesread = 0; -@@ -1040,6 +1156,19 @@ int fl_handle(const XEvent& thisevent) - bytesread/4, 65536, 1, 0, - &actual, &format, &count, &remaining, - &portion)) break; // quit on error -+ -+ if ((fl_xevent->xselection.property == PRIMARY_TIMESTAMP) || -+ (fl_xevent->xselection.property == CLIPBOARD_TIMESTAMP)) { -+ if (portion && format == 32 && count == 1) { -+ Time t = *(unsigned int*)portion; -+ if (fl_xevent->xselection.property == CLIPBOARD_TIMESTAMP) -+ handle_clipboard_timestamp(1, t); -+ else -+ handle_clipboard_timestamp(0, t); -+ } -+ return true; -+ } -+ - if (actual == TARGETS || actual == XA_ATOM) { - Atom type = XA_STRING; - for (unsigned i = 0; ixselectionclear.selection == CLIPBOARD; - fl_i_own_selection[clipboard] = 0; -+ poll_clipboard_owner(); - return 1;} - - case SelectionRequest: { -@@ -1308,6 +1441,9 @@ int fl_handle(const XEvent& thisevent) - case FocusIn: - if (fl_xim_ic) XSetICFocus(fl_xim_ic); - event = FL_FOCUS; -+ // If the user has toggled from another application to this one, -+ // then it's a good time to check for clipboard changes. -+ poll_clipboard_owner(); - break; - - case FocusOut: -@@ -1676,6 +1812,25 @@ int fl_handle(const XEvent& thisevent) - } - } - -+#if HAVE_XFIXES -+ switch (xevent.type - xfixes_event_base) { -+ case XFixesSelectionNotify: { -+ // Someone feeding us bogus events? -+ if (!have_xfixes) -+ return true; -+ -+ XFixesSelectionNotifyEvent *selection_notify = (XFixesSelectionNotifyEvent *)&xevent; -+ -+ if ((selection_notify->selection == XA_PRIMARY) && !fl_i_own_selection[0]) -+ handle_clipboard_timestamp(0, selection_notify->selection_timestamp); -+ else if ((selection_notify->selection == CLIPBOARD) && !fl_i_own_selection[1]) -+ handle_clipboard_timestamp(1, selection_notify->selection_timestamp); -+ -+ return true; -+ } -+ } -+#endif -+ - return Fl::handle(event, window); - } - -@@ -1995,6 +2150,16 @@ void Fl_X::make_xid(Fl_Window* win, XVis - XChangeProperty(fl_display, xp->xid, net_wm_type, XA_ATOM, 32, PropModeReplace, (unsigned char*)&net_wm_type_kind, 1); - } - -+#if HAVE_XFIXES -+ // register for clipboard change notifications -+ if (have_xfixes && !win->parent()) { -+ XFixesSelectSelectionInput(fl_display, xp->xid, XA_PRIMARY, -+ XFixesSetSelectionOwnerNotifyMask); -+ XFixesSelectSelectionInput(fl_display, xp->xid, CLIPBOARD, -+ XFixesSetSelectionOwnerNotifyMask); -+ } -+#endif -+ - XMapWindow(fl_display, xp->xid); - if (showit) { - win->set_visible(); -diff -up fltk-1.3.2/test/CMakeLists.txt.clp-x11 fltk-1.3.2/test/CMakeLists.txt diff --git a/contrib/packages/rpm/el6/SOURCES/fltk-1_v6.3.x-keyboard-osx.patch b/contrib/packages/rpm/el6/SOURCES/fltk-1_v6.3.x-keyboard-osx.patch deleted file mode 100644 index cf13aad..0000000 --- a/contrib/packages/rpm/el6/SOURCES/fltk-1_v6.3.x-keyboard-osx.patch +++ /dev/null @@ -1,375 +0,0 @@ -diff -ur fltk-1.3.0r9619.org/configure.in fltk-1.3.0r9619/configure.in ---- fltk-1.3.0r9619.org/configure.in 2012-04-22 04:45:09.000000000 +0200 -+++ fltk-1.3.0r9619/configure.in 2012-06-18 13:47:33.290447462 +0200 -@@ -865,6 +865,8 @@ - Darwin*) - # MacOS X uses Cocoa for graphics. - LIBS="$LIBS -framework Cocoa" -+ # And some Carbon for keyboard handling -+ LIBS="$LIBS -framework Carbon" - - if test x$have_pthread = xyes; then - AC_DEFINE(HAVE_PTHREAD) -diff -ur fltk-1.3.0r9619.org/src/Fl_cocoa.mm fltk-1.3.0r9619/src/Fl_cocoa.mm ---- fltk-1.3.0r9619.org/src/Fl_cocoa.mm 2012-06-16 10:49:52.000000000 +0200 -+++ fltk-1.3.0r9619/src/Fl_cocoa.mm 2012-06-18 13:47:42.944910782 +0200 -@@ -53,6 +53,7 @@ - #include - - #import -+#import - - #ifndef NSINTEGER_DEFINED // appears with 10.5 in NSObjCRuntime.h - #if defined(__LP64__) && __LP64__ -@@ -114,6 +115,8 @@ - extern Fl_Window* fl_xmousewin; - #endif - -+bool use_simple_keyboard = false; -+ - enum { FLTKTimerEvent = 1, FLTKDataReadyEvent }; - - -@@ -130,6 +133,39 @@ - { - } - -+// Undocumented voodoo. Taken from Mozilla. -+#define ENABLE_ROMAN_KYBDS_ONLY -23 -+ -+void fl_update_focus(void) -+{ -+ Fl_Widget *focus; -+ -+ focus = Fl::grab(); -+ if (!focus) -+ focus = Fl::focus(); -+ if (!focus) -+ return; -+ -+ if (focus->simple_keyboard()) -+ use_simple_keyboard = true; -+ else -+ use_simple_keyboard = false; -+ -+ // Force a "Roman" or "ASCII" keyboard, which both the Mozilla and -+ // Safari people seem to think implies turning off advanced IME stuff -+ // (see nsTSMManager::SyncKeyScript in Mozilla and enableSecureTextInput -+ // in Safari/Webcore). Should be good enough for us then... -+#if (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5) -+ CFArrayRef inputSources = TISCreateASCIICapableInputSourceList(); -+ TSMSetDocumentProperty(TSMGetActiveDocument(), -+ kTSMDocumentEnabledInputSourcesPropertyTag, -+ sizeof(CFArrayRef), &inputSources); -+ CFRelease(inputSources); -+#else -+ KeyScript(use_simple_keyboard ? ENABLE_ROMAN_KYBDS_ONLY : smKeyEnableKybds); -+#endif -+} -+ - /* - * Mac keyboard lookup table - */ -@@ -908,6 +944,25 @@ - } - @end - -+static const char* cocoaDead2FLTK(const char *in) -+{ -+ if (strcmp(in, "\140") == 0) // GRAVE ACCENT -+ return "\314\200"; // COMBINING GRAVE ACCENT -+ if (strcmp(in, "\302\264") == 0) // ACUTE ACCENT -+ return "\314\201"; // COMBINING ACUTE ACCENT -+ if (strcmp(in, "\136") == 0) // CIRCUMFLEX ACCENT -+ return "\314\202"; // COMBINING CIRCUMFLEX ACCENT -+ if (strcmp(in, "\176") == 0) // TILDE -+ return "\314\203"; // COMBINING TILDE -+ if (strcmp(in, "\302\250") == 0) // DIAERESIS -+ return "\314\210"; // COMBINING DIAERESIS -+ // FIXME: OS X dead key behaviour isn't documented and I don't have -+ // any more keyboards to test with... -+ -+ // hope that OS X gave us something proper to begin with -+ return in; -+} -+ - /* - Handle cocoa keyboard events - Events during a character composition sequence: -@@ -1648,6 +1703,7 @@ - - (void)rightMouseDragged:(NSEvent *)theEvent; - - (void)otherMouseDragged:(NSEvent *)theEvent; - - (void)scrollWheel:(NSEvent *)theEvent; -++ (NSString *)keyTranslate:(UInt16)keyCode withModifierFlags:(UInt32)modifierFlags; - - (BOOL)handleKeyDown:(NSEvent *)theEvent; - - (void)keyDown:(NSEvent *)theEvent; - - (void)keyUp:(NSEvent *)theEvent; -@@ -1726,6 +1782,130 @@ - - (void)scrollWheel:(NSEvent *)theEvent { - cocoaMouseWheelHandler(theEvent); - } -++ (NSString *)keyTranslate:(UInt16)keyCode withModifierFlags:(UInt32)modifierFlags { -+ const UCKeyboardLayout *layout; -+ OSStatus err; -+ -+ layout = NULL; -+ -+#if (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5) -+ TISInputSourceRef keyboard; -+ CFDataRef uchr; -+ -+ keyboard = TISCopyCurrentKeyboardInputSource(); -+ uchr = (CFDataRef)TISGetInputSourceProperty(keyboard, -+ kTISPropertyUnicodeKeyLayoutData); -+ if (uchr == NULL) -+ return nil; -+ -+ layout = (const UCKeyboardLayout*)CFDataGetBytePtr(uchr); -+#else -+ KeyboardLayoutRef old_layout; -+ int kind; -+ -+ err = KLGetCurrentKeyboardLayout(&old_layout); -+ if (err != noErr) -+ return nil; -+ -+ err = KLGetKeyboardLayoutProperty(old_layout, kKLKind, -+ (const void**)&kind); -+ if (err != noErr) -+ return nil; -+ -+ // Old, crufty layout format? -+ if (kind == kKLKCHRKind) { -+ void *kchr_layout; -+ -+ UInt32 chars, state; -+ char buf[3]; -+ -+ unichar result[16]; -+ ByteCount in_len, out_len; -+ -+ err = KLGetKeyboardLayoutProperty(old_layout, kKLKCHRData, -+ (const void**)&kchr_layout); -+ if (err != noErr) -+ return nil; -+ -+ state = 0; -+ -+ keyCode &= 0x7f; -+ modifierFlags &= 0xff00; -+ -+ chars = KeyTranslate(kchr_layout, keyCode | modifierFlags, &state); -+ -+ buf[0] = (chars >> 16) & 0xff; -+ buf[1] = chars & 0xff; -+ buf[2] = '\0'; -+ -+ if (buf[0] == '\0') { -+ buf[0] = buf[1]; -+ buf[1] = '\0'; -+ } -+ -+ // The data is now in some layout specific encoding. Need to convert -+ // this to unicode. -+ -+ ScriptCode script; -+ TextEncoding encoding; -+ TECObjectRef converter; -+ -+ script = (ScriptCode)GetScriptManagerVariable(smKeyScript); -+ -+ err = UpgradeScriptInfoToTextEncoding(script, kTextLanguageDontCare, -+ kTextRegionDontCare, NULL, -+ &encoding); -+ if (err != noErr) -+ return nil; -+ -+ err = TECCreateConverter(&converter, encoding, kTextEncodingUnicodeV4_0); -+ if (err != noErr) -+ return nil; -+ -+ in_len = strlen(buf); -+ out_len = sizeof(result); -+ -+ err = TECConvertText(converter, (ConstTextPtr)buf, in_len, &in_len, -+ (TextPtr)result, out_len, &out_len); -+ -+ TECDisposeConverter(converter); -+ -+ if (err != noErr) -+ return nil; -+ -+ return [NSString stringWithCharacters:result -+ length:(out_len / sizeof(unichar))]; -+ } -+ -+ if ((kind != kKLKCHRuchrKind) && (kind != kKLuchrKind)) -+ return nil; -+ -+ err = KLGetKeyboardLayoutProperty(old_layout, kKLuchrData, -+ (const void**)&layout); -+ if (err != noErr) -+ return nil; -+#endif -+ -+ if (layout == NULL) -+ return nil; -+ -+ UInt32 dead_state; -+ UniCharCount max_len, actual_len; -+ UniChar string[255]; -+ -+ dead_state = 0; -+ max_len = sizeof(string)/sizeof(*string); -+ -+ modifierFlags = (modifierFlags >> 8) & 0xff; -+ -+ err = UCKeyTranslate(layout, keyCode, kUCKeyActionDown, modifierFlags, -+ LMGetKbdType(), 0, &dead_state, max_len, &actual_len, -+ string); -+ if (err != noErr) -+ return nil; -+ -+ return [NSString stringWithCharacters:string length:actual_len]; -+} - - (BOOL)handleKeyDown:(NSEvent *)theEvent { - //NSLog(@"handleKeyDown"); - fl_lock_function(); -@@ -1752,14 +1932,47 @@ - break; - } - } -- if (!no_text_key && !(Fl::e_state & FL_META) ) { -- // Don't send cmd- to interpretKeyEvents because it beeps. -+ if (!no_text_key) { -+ // The simple keyboard model will ignore insertText, so we need to grab -+ // the symbol directly from the event. Note that we still use setMarkedText. -+ if (use_simple_keyboard) { -+ NSString *simple_chars; -+ UInt32 modifiers; -+ -+ // We want a "normal" symbol out of the event, which basically means -+ // we only respect the shift and alt/altgr modifiers. Cocoa can help -+ // us if we only wanted shift, but as we also want alt/altgr, we'll -+ // have to do some lookup ourselves. This matches our behaviour on -+ // other platforms. -+ -+ modifiers = 0; -+ if ([theEvent modifierFlags] & NSAlphaShiftKeyMask) -+ modifiers |= alphaLock; -+ if ([theEvent modifierFlags] & NSShiftKeyMask) -+ modifiers |= shiftKey; -+ if ([theEvent modifierFlags] & NSAlternateKeyMask) -+ modifiers |= optionKey; -+ -+ simple_chars = [FLView keyTranslate:[theEvent keyCode] -+ withModifierFlags:modifiers]; -+ if (simple_chars == nil) { -+ // Something went wrong. Fall back to what Cocoa gave us... -+ simple_chars = [theEvent charactersIgnoringModifiers]; -+ } -+ -+ [FLView prepareEtext:simple_chars]; -+ } -+ - // Then we can let the OS have a stab at it and see if it thinks it - // should result in some text -- NSText *edit = [[theEvent window] fieldEditor:YES forObject:nil]; -- in_key_event = true; -- [edit interpretKeyEvents:[NSArray arrayWithObject:theEvent]]; -- in_key_event = false; -+ -+ // Don't send cmd- to interpretKeyEvents because it beeps. -+ if (!(Fl::e_state & FL_META)) { -+ NSText *edit = [[theEvent window] fieldEditor:YES forObject:nil]; -+ in_key_event = true; -+ [edit interpretKeyEvents:[NSArray arrayWithObject:theEvent]]; -+ in_key_event = false; -+ } - } - //NSLog(@"to text=%@ l=%d", [NSString stringWithUTF8String:Fl::e_text], Fl::e_length); - int handled = Fl::handle(FL_KEYDOWN, window); -@@ -1937,21 +2150,30 @@ - //NSLog(@"insertText: received=%@",received); - - if (!in_key_event) fl_lock_function(); -+ -+ // Simple keyboard widgets do not want these side channel inputs. -+ if (use_simple_keyboard) -+ goto end; -+ - [FLView prepareEtext:received]; -+ - // We can get called outside of key events (e.g. from the character -- // palette). Transform such actions to FL_PASTE events. -+ // palette). We need to fake our own key event at that point. - if (!in_key_event) { - Fl_Window *target = [(FLWindow*)[self window] getFl_Window]; -- Fl::handle(FL_PASTE, target); -+ Fl::e_keysym = Fl::e_original_keysym = 0; -+ Fl::handle(FL_KEYDOWN, target); - // for some reason, the window does not redraw until the next mouse move or button push - // sending a 'redraw()' or 'awake()' does not solve the issue! - Fl::flush(); - } -+ -+end: - if (!in_key_event) fl_unlock_function(); - } - - - (void)setMarkedText:(id)aString selectedRange:(NSRange)newSelection { -- NSString *received; -+ NSString *received, *current, *aggregate; - if (newSelection.location == 0) { - [self unmarkText]; - return; -@@ -1962,11 +2184,47 @@ - received = (NSString*)aString; - } - //NSLog(@"setMarkedText: %@ %d %d",received,newSelection.location,newSelection.length); -+ -+ fl_lock_function(); -+ -+ // Simple keyboard widgets generally do not want these side channel -+ // inputs, but we have no other way of getting dead keys so we make -+ // an exception in that case. -+ if (use_simple_keyboard) { -+ if (in_key_event && (Fl::e_length == 0)) { -+ [FLView prepareEtext:received]; -+ -+ Fl::e_text = (char*)cocoaDead2FLTK(Fl::e_text); -+ Fl::e_length = strlen(Fl::e_text); -+ } -+ goto end; -+ } -+ - // This code creates the OS X behaviour of seeing dead keys as things - // are being composed. -+ // -+ // Note: The concatenation thing is because of how OS X deals with -+ // invalid sequences. At that point it will spit out one call -+ // to insertText with the now aborted sequence, and one new -+ // call to setMarkedText with the new sequence. Since we want -+ // both to be visible, we need to concatenate. - next_compose_length = newSelection.location; -- [FLView prepareEtext:received]; -- //NSLog(@"Fl::e_text=%@ Fl::e_length=%d next_compose_length=%d", received, Fl::e_length, next_compose_length); -+ current = [NSString stringWithUTF8String:Fl::e_text]; -+ aggregate = [current stringByAppendingString:received]; -+ -+ [FLView prepareEtext:aggregate]; -+ //NSLog(@"Fl::e_text=%@ Fl::e_length=%d next_compose_length=%d", aggregate, Fl::e_length, next_compose_length); -+ -+ // We can get called outside of key events (e.g. from the character -+ // palette). We need to fake our own key event at that point. -+ if (!in_key_event) { -+ Fl_Window *target = [(FLWindow*)[self window] getFl_Window]; -+ Fl::e_keysym = Fl::e_original_keysym = 0; -+ Fl::handle(FL_KEYDOWN, target); -+ } -+ -+end: -+ fl_unlock_function(); - } - - - (void)unmarkText { diff --git a/contrib/packages/rpm/el6/SOURCES/nettle-2.7.1-ecc-cve.patch b/contrib/packages/rpm/el6/SOURCES/nettle-2.7.1-ecc-cve.patch deleted file mode 100644 index 130f2fc..0000000 --- a/contrib/packages/rpm/el6/SOURCES/nettle-2.7.1-ecc-cve.patch +++ /dev/null @@ -1,275 +0,0 @@ -diff --git a/ecc-256.c b/ecc-256.c -index 571cf73..07841b1 100644 ---- a/ecc-256.c -+++ b/ecc-256.c -@@ -108,7 +108,10 @@ ecc_256_modp (const struct ecc_curve *ecc, mp_limb_t *rp) - u0 -= t; - t = (u1 < cy); - u1 -= cy; -- u1 += cnd_add_n (t, rp + n - 4, ecc->p, 3); -+ -+ cy = cnd_add_n (t, rp + n - 4, ecc->p, 2); -+ u0 += cy; -+ u1 += (u0 < cy); - u1 -= (-t) & 0xffffffff; - } - rp[2] = u0; -@@ -195,7 +198,7 @@ ecc_256_modq (const struct ecc_curve *ecc, mp_limb_t *rp) - - /* Conditional add of p */ - u1 += t; -- u2 += (t<<32) + (u0 < t); -+ u2 += (t<<32) + (u1 < t); - - t = cnd_add_n (t, rp + n - 4, ecc->q, 2); - u1 += t; -diff --git a/x86_64/ecc-384-modp.asm b/x86_64/ecc-384-modp.asm -index 698838f..31b739e 100644 ---- a/x86_64/ecc-384-modp.asm -+++ b/x86_64/ecc-384-modp.asm -@@ -20,7 +20,7 @@ C MA 02111-1301, USA. - .file "ecc-384-modp.asm" - - define(, <%rsi>) --define(, <%rax>) -+define(, <%rax>) - define(, <%rbx>) - define(, <%rcx>) - define(, <%rdx>) -@@ -35,8 +35,8 @@ define(

, <%r13>) - define(

, <%r14>) - define(, <%r15>) - define(, H5) C Overlap --define(, RP) C Overlap --define(, H4) C Overlap -+define(, RP) C Overlap -+ - - PROLOGUE(nettle_ecc_384_modp) - W64_ENTRY(2, 0) -@@ -48,34 +48,38 @@ PROLOGUE(nettle_ecc_384_modp) - push %r14 - push %r15 - -- C First get top 2 limbs, which need folding twice -+ C First get top 2 limbs, which need folding twice. -+ C B^10 = B^6 + B^4 + 2^32 (B-1)B^4. -+ C We handle the terms as follow: - C -- C H5 H4 -- C -H5 -- C ------ -- C H0 D4 -+ C B^6: Folded immediatly. - C -- C Then shift right, (H1,H0,D4) <-- (H0,D4) << 32 -- C and add -+ C B^4: Delayed, added in in the next folding. - C -- C H5 H4 -- C H1 H0 -- C ---------- -- C C2 H1 H0 -- -- mov 80(RP), D4 -- mov 88(RP), H0 -- mov D4, H4 -- mov H0, H5 -- sub H0, D4 -- sbb $0, H0 -- -- mov D4, T2 -- mov H0, H1 -- shl $32, H0 -- shr $32, T2 -+ C 2^32(B-1) B^4: Low half limb delayed until the next -+ C folding. Top 1.5 limbs subtracted and shifter now, resulting -+ C in 2.5 limbs. The low limb saved in D5, high 1.5 limbs added -+ C in. -+ -+ mov 80(RP), H4 -+ mov 88(RP), H5 -+ C Shift right 32 bits, into H1, H0 -+ mov H4, H0 -+ mov H5, H1 -+ mov H5, D5 - shr $32, H1 -- or T2, H0 -+ shl $32, D5 -+ shr $32, H0 -+ or D5, H0 -+ -+ C H1 H0 -+ C - H1 H0 -+ C -------- -+ C H1 H0 D5 -+ mov H0, D5 -+ neg D5 -+ sbb H1, H0 -+ sbb $0, H1 - - xor C2, C2 - add H4, H0 -@@ -114,118 +118,95 @@ PROLOGUE(nettle_ecc_384_modp) - adc H3, T5 - adc $0, C0 - -- C H3 H2 H1 H0 0 -- C - H4 H3 H2 H1 H0 -- C --------------- -- C H3 H2 H1 H0 D0 -- -- mov XREG(D4), XREG(D4) -- mov H0, D0 -- neg D0 -- sbb H1, H0 -- sbb H2, H1 -- sbb H3, H2 -- sbb H4, H3 -- sbb $0, D4 -- -- C Shift right. High bits are sign, to be added to C0. -- mov D4, TMP -- sar $32, TMP -- shl $32, D4 -- add TMP, C0 -- -+ C Shift left, including low half of H4 - mov H3, TMP -+ shl $32, H4 - shr $32, TMP -- shl $32, H3 -- or TMP, D4 -+ or TMP, H4 - - mov H2, TMP -+ shl $32, H3 - shr $32, TMP -- shl $32, H2 - or TMP, H3 - - mov H1, TMP -+ shl $32, H2 - shr $32, TMP -- shl $32, H1 - or TMP, H2 - - mov H0, TMP -+ shl $32, H1 - shr $32, TMP -- shl $32, H0 - or TMP, H1 - -- mov D0, TMP -- shr $32, TMP -- shl $32, D0 -- or TMP, H0 -+ shl $32, H0 -+ -+ C H4 H3 H2 H1 H0 0 -+ C - H4 H3 H2 H1 H0 -+ C --------------- -+ C H4 H3 H2 H1 H0 TMP - -- add D0, T0 -+ mov H0, TMP -+ neg TMP -+ sbb H1, H0 -+ sbb H2, H1 -+ sbb H3, H2 -+ sbb H4, H3 -+ sbb $0, H4 -+ -+ add TMP, T0 - adc H0, T1 - adc H1, T2 - adc H2, T3 - adc H3, T4 -- adc D4, T5 -+ adc H4, T5 - adc $0, C0 - - C Remains to add in C2 and C0 -- C C0 C0<<32 (-2^32+1)C0 -- C C2 C2<<32 (-2^32+1)C2 -- C where C2 is always positive, while C0 may be -1. -+ C Set H1, H0 = (2^96 - 2^32 + 1) C0 - mov C0, H0 - mov C0, H1 -- mov C0, H2 -- sar $63, C0 C Get sign - shl $32, H1 -- sub H1, H0 C Gives borrow iff C0 > 0 -+ sub H1, H0 - sbb $0, H1 -- add C0, H2 - -+ C Set H3, H2 = (2^96 - 2^32 + 1) C2 -+ mov C2, H2 -+ mov C2, H3 -+ shl $32, H3 -+ sub H3, H2 -+ sbb $0, H3 -+ add C0, H2 C No carry. Could use lea trick -+ -+ xor C0, C0 - add H0, T0 - adc H1, T1 -- adc $0, H2 -- adc $0, C0 -- -- C Set (H1 H0) <-- C2 << 96 - C2 << 32 + 1 -- mov C2, H0 -- mov C2, H1 -- shl $32, H1 -- sub H1, H0 -- sbb $0, H1 -- -- add H2, H0 -- adc C0, H1 -- adc C2, C0 -- mov C0, H2 -- sar $63, C0 -- add H0, T2 -- adc H1, T3 -- adc H2, T4 -- adc C0, T5 -- sbb C0, C0 -+ adc H2, T2 -+ adc H3, T3 -+ adc C2, T4 -+ adc D5, T5 C Value delayed from initial folding -+ adc $0, C0 C Use sbb and switch sign? - - C Final unlikely carry - mov C0, H0 - mov C0, H1 -- mov C0, H2 -- sar $63, C0 - shl $32, H1 - sub H1, H0 - sbb $0, H1 -- add C0, H2 - - pop RP - -- sub H0, T0 -+ add H0, T0 - mov T0, (RP) -- sbb H1, T1 -+ adc H1, T1 - mov T1, 8(RP) -- sbb H2, T2 -+ adc C0, T2 - mov T2, 16(RP) -- sbb C0, T3 -+ adc $0, T3 - mov T3, 24(RP) -- sbb C0, T4 -+ adc $0, T4 - mov T4, 32(RP) -- sbb C0, T5 -+ adc $0, T5 - mov T5, 40(RP) - - pop %r15 diff --git a/contrib/packages/rpm/el6/SOURCES/pixmap_v2.patch b/contrib/packages/rpm/el6/SOURCES/pixmap_v2.patch deleted file mode 100644 index 3031513..0000000 --- a/contrib/packages/rpm/el6/SOURCES/pixmap_v2.patch +++ /dev/null @@ -1,554 +0,0 @@ -diff -ur fltk-1.3.2.org/FL/Fl_Image.H fltk-1.3.2/FL/Fl_Image.H ---- fltk-1.3.2.org/FL/Fl_Image.H 2012-11-09 17:02:08.000000000 +0100 -+++ fltk-1.3.2/FL/Fl_Image.H 2013-01-16 14:40:51.543230638 +0100 -@@ -26,6 +26,7 @@ - #include - - class Fl_Widget; -+class Fl_Pixmap; - struct Fl_Menu_Item; - struct Fl_Label; - -@@ -203,6 +204,7 @@ - */ - Fl_RGB_Image(const uchar *bits, int W, int H, int D=3, int LD=0) : - Fl_Image(W,H,D), array(bits), alloc_array(0), id_(0), mask_(0) {data((const char **)&array, 1); ld(LD);} -+ Fl_RGB_Image(const Fl_Pixmap *pxm, Fl_Color bg=FL_GRAY); - virtual ~Fl_RGB_Image(); - virtual Fl_Image *copy(int W, int H); - Fl_Image *copy() { return copy(w(), h()); } -diff -ur fltk-1.3.2.org/src/fl_draw_pixmap.cxx fltk-1.3.2/src/fl_draw_pixmap.cxx ---- fltk-1.3.2.org/src/fl_draw_pixmap.cxx 2012-04-22 05:09:31.000000000 +0200 -+++ fltk-1.3.2/src/fl_draw_pixmap.cxx 2013-01-16 14:40:51.542230588 +0100 -@@ -58,99 +58,6 @@ - return 1; - } - --#ifdef U64 -- --// The callback from fl_draw_image to get a row of data passes this: --struct pixmap_data { -- int w, h; -- const uchar*const* data; -- union { -- U64 colors[256]; -- U64* byte1[256]; -- }; --}; -- --// callback for 1 byte per pixel: --static void cb1(void*v, int x, int y, int w, uchar* buf) { -- pixmap_data& d = *(pixmap_data*)v; -- const uchar* p = d.data[y]+x; -- U64* q = (U64*)buf; -- for (int X=w; X>0; X-=2, p += 2) { -- if (X>1) { --# if WORDS_BIGENDIAN -- *q++ = (d.colors[p[0]]<<32) | d.colors[p[1]]; --# else -- *q++ = (d.colors[p[1]]<<32) | d.colors[p[0]]; --# endif -- } else { --# if WORDS_BIGENDIAN -- *q++ = d.colors[p[0]]<<32; --# else -- *q++ = d.colors[p[0]]; --# endif -- } -- } --} -- --// callback for 2 bytes per pixel: --static void cb2(void*v, int x, int y, int w, uchar* buf) { -- pixmap_data& d = *(pixmap_data*)v; -- const uchar* p = d.data[y]+2*x; -- U64* q = (U64*)buf; -- for (int X=w; X>0; X-=2) { -- U64* colors = d.byte1[*p++]; -- int index = *p++; -- if (X>1) { -- U64* colors1 = d.byte1[*p++]; -- int index1 = *p++; --# if WORDS_BIGENDIAN -- *q++ = (colors[index]<<32) | colors1[index1]; --# else -- *q++ = (colors1[index1]<<32) | colors[index]; --# endif -- } else { --# if WORDS_BIGENDIAN -- *q++ = colors[index]<<32; --# else -- *q++ = colors[index]; --# endif -- } -- } --} -- --#else // U32 -- --// The callback from fl_draw_image to get a row of data passes this: --struct pixmap_data { -- int w, h; -- const uchar*const* data; -- union { -- U32 colors[256]; -- U32* byte1[256]; -- }; --}; -- --// callback for 1 byte per pixel: --static void cb1(void*v, int x, int y, int w, uchar* buf) { -- pixmap_data& d = *(pixmap_data*)v; -- const uchar* p = d.data[y]+x; -- U32* q = (U32*)buf; -- for (int X=w; X--;) *q++ = d.colors[*p++]; --} -- --// callback for 2 bytes per pixel: --static void cb2(void*v, int x, int y, int w, uchar* buf) { -- pixmap_data& d = *(pixmap_data*)v; -- const uchar* p = d.data[y]+2*x; -- U32* q = (U32*)buf; -- for (int X=w; X--;) { -- U32* colors = d.byte1[*p++]; -- *q++ = colors[*p++]; -- } --} -- --#endif // U64 else U32 -- - uchar **fl_mask_bitmap; // if non-zero, create bitmap and store pointer here - - /** -@@ -200,34 +107,33 @@ - } - #endif - --/** -- Draw XPM image data, with the top-left corner at the given position. -- \see fl_draw_pixmap(char* const* data, int x, int y, Fl_Color bg) -- */ --int fl_draw_pixmap(const char*const* cdata, int x, int y, Fl_Color bg) { -- pixmap_data d; -- if (!fl_measure_pixmap(cdata, d.w, d.h)) return 0; -+int fl_convert_pixmap(const char*const* cdata, uchar* out, Fl_Color bg) { -+ int w, h; - const uchar*const* data = (const uchar*const*)(cdata+1); - int transparent_index = -1; -+ -+ if (!fl_measure_pixmap(cdata, w, h)) -+ return 0; -+ -+ if ((chars_per_pixel < 1) || (chars_per_pixel > 2)) -+ return 0; -+ -+ uchar colors[1<<(chars_per_pixel*8)][4]; -+ - #ifdef WIN32 - uchar *transparent_c = (uchar *)0; // such that transparent_c[0,1,2] are the RGB of the transparent color - color_count = 0; - used_colors = (uchar *)malloc(abs(ncolors)*3*sizeof(uchar)); - #endif - -- if (ncolors < 0) { // FLTK (non standard) compressed colormap -+ if (ncolors < 0) { -+ // FLTK (non standard) compressed colormap - ncolors = -ncolors; - const uchar *p = *data++; - // if first color is ' ' it is transparent (put it later to make - // it not be transparent): - if (*p == ' ') { -- uchar* c = (uchar*)&d.colors[(int)' ']; --#ifdef U64 -- *(U64*)c = 0; --# if WORDS_BIGENDIAN -- c += 4; --# endif --#endif -+ uchar* c = colors[(int)' ']; - transparent_index = ' '; - Fl::get_color(bg, c[0], c[1], c[2]); c[3] = 0; - #ifdef WIN32 -@@ -238,13 +144,7 @@ - } - // read all the rest of the colors: - for (int i=0; i < ncolors; i++) { -- uchar* c = (uchar*)&d.colors[*p++]; --#ifdef U64 -- *(U64*)c = 0; --# if WORDS_BIGENDIAN -- c += 4; --# endif --#endif -+ uchar* c = colors[*p++]; - #ifdef WIN32 - used_colors[3*color_count] = *p; - used_colors[3*color_count+1] = *(p+1); -@@ -254,69 +154,44 @@ - *c++ = *p++; - *c++ = *p++; - *c++ = *p++; --#ifdef __APPLE_QUARTZ__ - *c = 255; --#else -- *c = 0; --#endif - } -- } else { // normal XPM colormap with names -- if (chars_per_pixel>1) memset(d.byte1, 0, sizeof(d.byte1)); -+ } else { -+ // normal XPM colormap with names - for (int i=0; i1) { --#ifdef U64 -- U64* colors = d.byte1[ind]; -- if (!colors) colors = d.byte1[ind] = new U64[256]; --#else -- U32* colors = d.byte1[ind]; -- if (!colors) colors = d.byte1[ind] = new U32[256]; --#endif -- c = (uchar*)&colors[*p]; -- ind = (ind<<8)|*p++; -- } else { -- c = (uchar *)&d.colors[ind]; -- } -+ if (chars_per_pixel>1) -+ ind = (ind<<8)|*p++; -+ c = colors[ind]; - // look for "c word", or last word if none: - const uchar *previous_word = p; - for (;;) { -- while (*p && isspace(*p)) p++; -- uchar what = *p++; -- while (*p && !isspace(*p)) p++; -- while (*p && isspace(*p)) p++; -- if (!*p) {p = previous_word; break;} -- if (what == 'c') break; -- previous_word = p; -- while (*p && !isspace(*p)) p++; -+ while (*p && isspace(*p)) p++; -+ uchar what = *p++; -+ while (*p && !isspace(*p)) p++; -+ while (*p && isspace(*p)) p++; -+ if (!*p) {p = previous_word; break;} -+ if (what == 'c') break; -+ previous_word = p; -+ while (*p && !isspace(*p)) p++; - } --#ifdef U64 -- *(U64*)c = 0; --# if WORDS_BIGENDIAN -- c += 4; --# endif --#endif --#ifdef __APPLE_QUARTZ__ -- c[3] = 255; --#endif - int parse = fl_parse_color((const char*)p, c[0], c[1], c[2]); -+ c[3] = 255; - if (parse) { - #ifdef WIN32 -- used_colors[3*color_count] = c[0]; -- used_colors[3*color_count+1] = c[1]; -- used_colors[3*color_count+2] = c[2]; -- color_count++; -+ used_colors[3*color_count] = c[0]; -+ used_colors[3*color_count+1] = c[1]; -+ used_colors[3*color_count+2] = c[2]; -+ color_count++; - #endif -- } -- else { -+ } else { - // assume "None" or "#transparent" for any errors -- // "bg" should be transparent... -- Fl::get_color(bg, c[0], c[1], c[2]); --#ifdef __APPLE_QUARTZ__ -+ // "bg" should be transparent... -+ Fl::get_color(bg, c[0], c[1], c[2]); - c[3] = 0; --#endif - transparent_index = ind; - #ifdef WIN32 - transparent_c = c; -@@ -324,7 +199,6 @@ - } - } - } -- d.data = data; - #ifdef WIN32 - if (transparent_c) { - make_unused_color(transparent_c[0], transparent_c[1], transparent_c[2]); -@@ -334,77 +208,76 @@ - make_unused_color(r, g, b); - } - #endif -+ -+ U32 *q = (U32*)out; -+ for (int Y = 0; Y < h; Y++) { -+ const uchar* p = data[Y]; -+ if (chars_per_pixel <= 1) { -+ for (int X = 0; X < w; X++) -+ memcpy(q++, colors[*p++], 4); -+ } else { -+ for (int X = 0; X < w; X++) { -+ int ind = (*p++)<<8; -+ ind |= *p++; -+ memcpy(q++, colors[ind], 4); -+ } -+ } -+ } - -+ return 1; -+} -+ -+/** -+ Draw XPM image data, with the top-left corner at the given position. -+ \see fl_draw_pixmap(char* const* data, int x, int y, Fl_Color bg) -+ */ -+int fl_draw_pixmap(const char*const* cdata, int x, int y, Fl_Color bg) { -+ int w, h; -+ -+ if (!fl_measure_pixmap(cdata, w, h)) -+ return 0; -+ -+ uchar buffer[w*h*4]; -+ -+ if (!fl_convert_pixmap(cdata, buffer, bg)) -+ return 0; -+ -+ // FIXME: Hack until fl_draw_image() supports alpha properly - #ifdef __APPLE_QUARTZ__ - if (Fl_Surface_Device::surface() == Fl_Display_Device::display_device()) { -- U32 *array = new U32[d.w * d.h], *q = array; -- for (int Y = 0; Y < d.h; Y++) { -- const uchar* p = data[Y]; -- if (chars_per_pixel <= 1) { -- for (int X = 0; X < d.w; X++) { -- *q++ = d.colors[*p++]; -- } -- } else { -- for (int X = 0; X < d.w; X++) { -- U32* colors = (U32*)d.byte1[*p++]; -- *q++ = colors[*p++]; -- } -- } -- } -- Fl_RGB_Image* rgb = new Fl_RGB_Image((uchar*)array, d.w, d.h, 4); -+ Fl_RGB_Image* rgb = new Fl_RGB_Image(buffer, w, h, 4); - rgb->draw(x, y); - delete rgb; -- delete[] array; -- } -- else { -+ } else { - #endif // __APPLE_QUARTZ__ -- - // build the mask bitmap used by Fl_Pixmap: -- if (fl_mask_bitmap && transparent_index >= 0) { -- int W = (d.w+7)/8; -- uchar* bitmap = new uchar[W * d.h]; -+ if (fl_mask_bitmap) { -+ int W = (w+7)/8; -+ uchar* bitmap = new uchar[W * h]; - *fl_mask_bitmap = bitmap; -- for (int Y = 0; Y < d.h; Y++) { -- const uchar* p = data[Y]; -- if (chars_per_pixel <= 1) { -- int dw = d.w; -- for (int X = 0; X < W; X++) { -- uchar b = (dw-->0 && *p++ != transparent_index); -- if (dw-->0 && *p++ != transparent_index) b |= 2; -- if (dw-->0 && *p++ != transparent_index) b |= 4; -- if (dw-->0 && *p++ != transparent_index) b |= 8; -- if (dw-->0 && *p++ != transparent_index) b |= 16; -- if (dw-->0 && *p++ != transparent_index) b |= 32; -- if (dw-->0 && *p++ != transparent_index) b |= 64; -- if (dw-->0 && *p++ != transparent_index) b |= 128; -+ const uchar *p = &buffer[3]; -+ uchar b = 0; -+ for (int Y = 0; Y < h; Y++) { -+ b = 0; -+ for (int X = 0, bit = 1; X < w; X++, p += 4) { -+ if (*p > 127) b |= bit; -+ bit <<= 1; -+ if (bit > 0x80 || X == w-1) { - *bitmap++ = b; -- } -- } else { -- uchar b = 0, bit = 1; -- for (int X = 0; X < d.w; X++) { -- int ind = *p++; -- ind = (ind<<8) | (*p++); -- if (ind != transparent_index) b |= bit; -- -- if (bit < 128) bit <<= 1; -- else { -- *bitmap++ = b; -- b = 0; -- bit = 1; -+ bit = 1; -+ b = 0; - } - } -- -- if (bit > 1) *bitmap++ = b; - } -- } -+ - } - -- fl_draw_image(chars_per_pixel==1 ? cb1 : cb2, &d, x, y, d.w, d.h, 4); -+ fl_draw_image(buffer, x, y, w, h, 4); -+ - #ifdef __APPLE_QUARTZ__ - } - #endif - -- if (chars_per_pixel > 1) for (int i = 0; i < 256; i++) delete[] d.byte1[i]; - return 1; - } - -diff -ur fltk-1.3.2.org/src/Fl_Image.cxx fltk-1.3.2/src/Fl_Image.cxx ---- fltk-1.3.2.org/src/Fl_Image.cxx 2012-11-09 17:02:08.000000000 +0100 -+++ fltk-1.3.2/src/Fl_Image.cxx 2013-01-16 14:41:38.404162795 +0100 -@@ -165,7 +165,22 @@ - // - size_t Fl_RGB_Image::max_size_ = ~((size_t)0); - --/** The destructor free all memory and server resources that are used by the image. */ -+int fl_convert_pixmap(const char*const* cdata, uchar* out, Fl_Color bg); -+ -+/** The constructor creates a new RGBA image from the specified Fl_Pixmap. -+ -+ The RGBA image is built fully opaque except for the transparent area -+ of the pixmap that is assigned the \par bg color with full transparency */ -+Fl_RGB_Image::Fl_RGB_Image(const Fl_Pixmap *pxm, Fl_Color bg): -+ Fl_Image(pxm->w(), pxm->h(), 4), id_(0), mask_(0) -+{ -+ array = new uchar[w() * h() * d()]; -+ alloc_array = 1; -+ fl_convert_pixmap(pxm->data(), (uchar*)array, bg); -+ data((const char **)&array, 1); -+} -+ -+/** The destructor frees all memory and server resources that are used by the image. */ - Fl_RGB_Image::~Fl_RGB_Image() { - uncache(); - if (alloc_array) delete[] (uchar *)array; -diff -ur fltk-1.3.2.org/src/ps_image.cxx fltk-1.3.2/src/ps_image.cxx ---- fltk-1.3.2.org/src/ps_image.cxx 2011-07-19 06:49:30.000000000 +0200 -+++ fltk-1.3.2/src/ps_image.cxx 2013-01-16 14:40:51.541228080 +0100 -@@ -185,72 +185,38 @@ - - extern uchar **fl_mask_bitmap; - -+struct callback_data { -+ const uchar *data; -+ int D, LD; -+}; - --void Fl_PostScript_Graphics_Driver::draw_image(const uchar *data, int ix, int iy, int iw, int ih, int D, int LD) { -- double x = ix, y = iy, w = iw, h = ih; - -- if (D<3){ //mono -- draw_image_mono(data, ix, iy, iw, ih, D, LD); -- return; -- } -+static void draw_image_cb(void *data, int x, int y, int w, uchar *buf) { -+ struct callback_data *cb_data; -+ const uchar *curdata; - -+ cb_data = (struct callback_data*)data; -+ curdata = cb_data->data + x*cb_data->D + y*cb_data->LD; - -- int i,j, k; -+ memcpy(buf, curdata, w*cb_data->D); -+} - -- fprintf(output,"save\n"); - -- const char * interpol; -- if (lang_level_>1){ -- if (interpolate_) -- interpol="true"; -- else -- interpol="false"; -- if (mask && lang_level_>2) -- fprintf(output, "%g %g %g %g %i %i %i %i %s CIM\n", x , y+h , w , -h , iw , ih, mx, my, interpol); -- else -- fprintf(output, "%g %g %g %g %i %i %s CII\n", x , y+h , w , -h , iw , ih, interpol); -- } else -- fprintf(output , "%g %g %g %g %i %i CI", x , y+h , w , -h , iw , ih); -+void Fl_PostScript_Graphics_Driver::draw_image(const uchar *data, int ix, int iy, int iw, int ih, int D, int LD) { -+ if (D<3){ //mono -+ draw_image_mono(data, ix, iy, iw, ih, D, LD); -+ return; -+ } - -+ struct callback_data cb_data; - - if (!LD) LD = iw*D; -- uchar *curmask=mask; -- -- for (j=0; j3) { //can do mixing using bg_* colors) -- unsigned int a2 = curdata[3]; //must be int -- unsigned int a = 255-a2; -- r = (a2 * r + bg_r * a)/255; -- g = (a2 * g + bg_g * a)/255; -- b = (a2 * b + bg_b * a)/255; -- } -- if (!(i%40)) fprintf(output, "\n"); -- fprintf(output, "%.2x%.2x%.2x", r, g, b); -- curdata +=D; -- } -- fprintf(output,"\n"); -- -- } -- -- fprintf(output," >\nrestore\n" ); - -+ cb_data.data = data; -+ cb_data.D = D; -+ cb_data.LD = LD; - -+ draw_image(draw_image_cb, &cb_data, ix, iy, iw, ih, D); - } - - void Fl_PostScript_Graphics_Driver::draw_image(Fl_Draw_Image_Cb call, void *data, int ix, int iy, int iw, int ih, int D) { -@@ -325,6 +291,14 @@ - uchar g = curdata[1]; - uchar b = curdata[2]; - -+ if (lang_level_<3 && D>3) { //can do mixing using bg_* colors) -+ unsigned int a2 = curdata[3]; //must be int -+ unsigned int a = 255-a2; -+ r = (a2 * r + bg_r * a)/255; -+ g = (a2 * g + bg_g * a)/255; -+ b = (a2 * b + bg_b * a)/255; -+ } -+ - if (!(i%40)) fputs("\n", output); - fprintf(output, "%.2x%.2x%.2x", r, g, b); - diff --git a/contrib/packages/rpm/el6/SOURCES/tigervnc-xorg-manpages.patch b/contrib/packages/rpm/el6/SOURCES/tigervnc-xorg-manpages.patch deleted file mode 100644 index 229cf3f..0000000 --- a/contrib/packages/rpm/el6/SOURCES/tigervnc-xorg-manpages.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- unix/xserver/man/Makefile.am 2013-03-30 17:51:01.707258746 -0400 -+++ unix/xserver/man/Makefile.am 2013-03-30 17:51:47.606569692 -0400 -@@ -2,5 +2,7 @@ - # (i.e. those handled in the os/utils.c options processing instead of in - # the DDX-level options processing) - -+if ENABLE_DOCS - include $(top_srcdir)/manpages.am - appman_PRE = Xserver.man -+endif ENABLE_DOCS diff --git a/contrib/packages/rpm/el6/SOURCES/vncserver.service b/contrib/packages/rpm/el6/SOURCES/vncserver.service deleted file mode 100644 index 51439de..0000000 --- a/contrib/packages/rpm/el6/SOURCES/vncserver.service +++ /dev/null @@ -1,154 +0,0 @@ -#!/bin/bash -# -# chkconfig: - 91 35 -# description: Starts and stops vncserver. \ -# used to provide remote X administration services. - -### BEGIN INIT INFO -# Provides: vncserver -# Required-Start: $network $named -# Required-Stop: $network $named -# Default-Start: -# Default-Stop: 0 1 2 3 4 5 6 -# Short-Description: start|stop|restart|try-restart|status|force-reload vncserver -# Description: control vncserver which exports your desktop -### END INIT INFO - -# Source function library. -. /etc/init.d/functions - -[ -r /etc/sysconfig/vncservers ] && . /etc/sysconfig/vncservers - -prog=$"VNC server" - -RETVAL=0 - -start() { - [ "$EUID" != "0" ] && exit 4 - - # Source networking configuration. - . /etc/sysconfig/network - - # Check that networking is up. - [ ${NETWORKING} = "no" ] && exit 1 - - [ -x /usr/bin/vncserver ] || exit 5 - [ -x /usr/bin/Xvnc ] || exit 5 - - echo -n $"Starting $prog: " - RETVAL=0 - if [ ! -d /tmp/.X11-unix ] - then - mkdir -m 1777 /tmp/.X11-unix || : - restorecon /tmp/.X11-unix 2>/dev/null || : - fi - - for display in ${VNCSERVERS} - do - SERVS=1 - echo -n "${display} " - DISP="${display%%:*}" - USER="${display##*:}" - VNCUSERARGS="${VNCSERVERARGS[${DISP}]}" - if [ -r $(eval echo ~${USER})/.vnc/passwd ]; then - runuser -l ${USER} -c \ - "cd ~${USER} && vncserver :${DISP} ${VNCUSERARGS}" - RETVAL=$? - else - echo - echo VNC password for user ${USER} is not configured - RETVAL=1 - fi - [ "$RETVAL" -eq 0 ] || break - done - if [ -z "$SERVS" ]; then - echo -n "no displays configured " - failure - RETVAL=6 - else - if [ "$RETVAL" -eq 0 ]; then - success $"vncserver startup" - touch /var/lock/subsys/Xvnc - else - failure $"vncserver start" - fi - fi - echo - -# As written in https://bugzilla.redhat.com/show_bug.cgi?id=523974 (LSB -# compliance) start of already running service is OK. - [ "$RETVAL" -eq 98 ] && RETVAL=0 - - return "$RETVAL" -} - -stop() { - [ "$EUID" != "0" ] && exit 4 - - echo -n $"Shutting down $prog: " - - status Xvnc > /dev/null 2>&1 - RETVAL=$? - - # 3 means service is already stopped - if ! [ "$RETVAL" -eq 3 ]; then - for display in ${VNCSERVERS}; do - echo -n "${display} " - export USER="${display##*:}" - runuser ${USER} -c "vncserver -kill :${display%%:*}" >/dev/null 2>&1 - done - RETVAL=$? - else - let RETVAL=0 - fi - - [ "$RETVAL" -eq 0 ] && success $"vncserver shutdown" || \ - failure $"vncserver shutdown" - echo - [ "$RETVAL" -eq 0 ] && rm -f /var/lock/subsys/Xvnc - return "$RETVAL" -} - -# See how we were called. -case "$1" in - start) - start - ;; - stop) - stop - ;; - restart|force-reload) - stop - sleep 3 - start - ;; - condrestart) -# https://bugzilla.redhat.com/show_bug.cgi?id=508367 -# echo "condrestart is obsolete, use try-restart instead" - if [ -e /var/lock/subsys/Xvnc ]; then - stop - sleep 3 - start - fi - ;; - try-restart) - if [ -e /var/lock/subsys/Xvnc ]; then - stop - sleep 3 - start - fi - ;; - status) - status Xvnc - RETVAL=$? - ;; - reload) - exit 3 - ;; - *) - echo $"Usage: $0 {start|stop|restart|try-restart|status|force-reload}" - exit 2 -esac - -exit "$RETVAL" - diff --git a/contrib/packages/rpm/el6/SOURCES/vncserver.sysconfig b/contrib/packages/rpm/el6/SOURCES/vncserver.sysconfig deleted file mode 100644 index 5940a1e..0000000 --- a/contrib/packages/rpm/el6/SOURCES/vncserver.sysconfig +++ /dev/null @@ -1,19 +0,0 @@ -# The VNCSERVERS variable is a list of display:user pairs. -# -# Uncomment the lines below to start a VNC server on display :2 -# as my 'myusername' (adjust this to your own). You will also -# need to set a VNC password; run 'man vncpasswd' to see how -# to do that. -# -# DO NOT RUN THIS SERVICE if your local area network is -# untrusted! For a secure way of using VNC, see this URL: -# http://kbase.redhat.com/faq/docs/DOC-7028 - -# Use "-nolisten tcp" to prevent X connections to your VNC server via TCP. - -# Use "-localhost" to prevent remote VNC clients connecting except when -# doing so through a secure tunnel. See the "-via" option in the -# `man vncviewer' manual page. - -# VNCSERVERS="2:myusername" -# VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -localhost" diff --git a/contrib/packages/rpm/el6/SPECS/tigervnc.spec b/contrib/packages/rpm/el6/SPECS/tigervnc.spec deleted file mode 100644 index 01f0dcc..0000000 --- a/contrib/packages/rpm/el6/SPECS/tigervnc.spec +++ /dev/null @@ -1,844 +0,0 @@ -%{!?_self_signed: %define _self_signed 1} -%{!?_bootstrap: %define _bootstrap 1} -%define tigervnc_src_dir %{_builddir}/%{name}-%{version}%{?snap:-%{snap}} -%global scl_name %{name}16 -%if %{_bootstrap} -%define static_lib_buildroot %{tigervnc_src_dir}/opt/%{name}/%{scl_name} -%else -%define static_lib_buildroot /opt/%{name}/%{scl_name} -%endif - -Name: tigervnc -Version: @VERSION@ -Release: 5%{?snap:.%{snap}}%{?dist} -Summary: A TigerVNC remote display system - -Group: User Interface/Desktops -License: GPLv2+ -Packager: Brian P. Hinz -URL: http://www.tigervnc.com - -Source0: %{name}-%{version}%{?snap:-%{snap}}.tar.bz2 -Source1: vncserver.service -Source2: vncserver.sysconfig -Source11: http://fltk.org/pub/fltk/1.3.3/fltk-1.3.3-source.tar.gz -Source13: http://downloads.sourceforge.net/project/libpng/libpng15/1.5.24/libpng-1.5.24.tar.bz2 -Source14: https://ftp.gnu.org/gnu/gmp/gmp-6.0.0a.tar.bz2 -Source15: http://ftp.gnu.org/gnu/libtasn1/libtasn1-4.7.tar.gz -Source16: https://ftp.gnu.org/gnu/nettle/nettle-2.7.1.tar.gz -Source17: ftp://ftp.gnutls.org/gcrypt/gnutls/v3.3/gnutls-3.3.19.tar.xz -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) - -BuildRequires: gcc, gcc-c++ -BuildRequires: libX11-devel, automake, autoconf, libtool, gettext, gettext-devel -BuildRequires: libXext-devel, xorg-x11-server-source, libXi-devel -BuildRequires: xorg-x11-xtrans-devel, xorg-x11-util-macros, libXtst-devel -BuildRequires: libdrm-devel, libXt-devel, pixman-devel libXfont-devel -BuildRequires: libxkbfile-devel, openssl-devel, libpciaccess-devel -BuildRequires: mesa-libGL-devel, libXinerama-devel, ImageMagick -BuildRequires: freetype-devel, libXdmcp-devel -BuildRequires: java-devel, jpackage-utils -BuildRequires: libjpeg-turbo-devel, pam-devel -BuildRequires: cmake >= 2.8 -%if !%{_bootstrap} -BuildRequires: %{name}-static-devel == %{version} -%endif -%ifnarch s390 s390x -BuildRequires: xorg-x11-server-devel -%endif - -Requires(post): initscripts chkconfig coreutils -Requires(postun): coreutils -Requires: libjpeg-turbo -Requires: hicolor-icon-theme -Requires: tigervnc-license -Requires: tigervnc-icons - -Provides: vnc = 4.1.3-2, vnc-libs = 4.1.3-2 -Obsoletes: vnc < 4.1.3-2, vnc-libs < 4.1.3-2 -Provides: tightvnc = 1.5.0-0.15.20090204svn3586 -Obsoletes: tightvnc < 1.5.0-0.15.20090204svn3586 - -Patch16: tigervnc-xorg-manpages.patch -Patch17: nettle-2.7.1-ecc-cve.patch - -%description -Virtual Network Computing (VNC) is a remote display system which -allows you to view a computing 'desktop' environment not only on the -machine where it is running, but from anywhere on the Internet and -from a wide variety of machine architectures. This package contains a -client which will allow you to connect to other desktops running a VNC -server. - -%package server -Summary: A TigerVNC server -Group: User Interface/X -Provides: vnc-server = 4.1.3-2, vnc-libs = 4.1.3-2 -Obsoletes: vnc-server < 4.1.3-2, vnc-libs < 4.1.3-2 -Provides: tightvnc-server = 1.5.0-0.15.20090204svn3586 -Obsoletes: tightvnc-server < 1.5.0-0.15.20090204svn3586 -Requires: perl -Requires: tigervnc-server-minimal -Requires: xorg-x11-xauth - -%description server -The VNC system allows you to access the same desktop from a wide -variety of platforms. This package includes set of utilities -which make usage of TigerVNC server more user friendly. It also -contains x0vncserver program which can export your active -X session. - -%package server-minimal -Summary: A minimal installation of TigerVNC server -Group: User Interface/X -Requires(post): chkconfig -Requires(preun):chkconfig -Requires(preun):initscripts -Requires(postun):initscripts - -Requires: mesa-dri-drivers, xkeyboard-config, xorg-x11-xkb-utils -Requires: tigervnc-license - -%description server-minimal -The VNC system allows you to access the same desktop from a wide -variety of platforms. This package contains minimal installation -of TigerVNC server, allowing others to access the desktop on your -machine. - -%ifnarch s390 s390x %{?rhel:ppc ppc64} -%package server-module -Summary: TigerVNC module to Xorg -Group: User Interface/X -Provides: vnc-server = 4.1.3-2, vnc-libs = 4.1.3-2 -Obsoletes: vnc-server < 4.1.3-2, vnc-libs < 4.1.3-2 -Provides: tightvnc-server-module = 1.5.0-0.15.20090204svn3586 -Obsoletes: tightvnc-server-module < 1.5.0-0.15.20090204svn3586 -Requires: xorg-x11-server-Xorg -Requires: tigervnc-license - -%description server-module -This package contains libvnc.so module to X server, allowing others -to access the desktop on your machine. -%endif - -%package server-applet -Summary: Java TigerVNC viewer applet for TigerVNC server -Group: User Interface/X -Requires: tigervnc-server, java, jpackage-utils -BuildArch: noarch - -%description server-applet -The Java TigerVNC viewer applet for web browsers. Install this package to allow -clients to use web browser when connect to the TigerVNC server. - -%package license -Summary: License of TigerVNC suite -Group: User Interface/X -BuildArch: noarch - -%description license -This package contains license of the TigerVNC suite - -%package icons -Summary: Icons for TigerVNC viewer -Group: User Interface/X -BuildArch: noarch - -%description icons -This package contains icons for TigerVNC viewer - -%if %{_bootstrap} -%package static-devel -Summary: Static development files necessary to build TigerVNC -Group: Development/Libraries - -%description static-devel -This package contains static development files necessary to build TigerVNC -%endif - -%prep -rm -rf $RPM_BUILD_ROOT -%setup -q -n %{name}-%{version}%{?snap:-%{snap}} - -%if %{_bootstrap} -tar xzf %SOURCE11 -tar xjf %SOURCE13 -tar xjf %SOURCE14 -tar xzf %SOURCE15 -tar xzf %SOURCE16 -pushd nettle-* -%patch17 -p1 -b .ecc-cve -popd -xzcat %SOURCE17 | tar xf - -%endif - -cp -r /usr/share/xorg-x11-server-source/* unix/xserver -pushd unix/xserver -for all in `find . -type f -perm -001`; do - chmod -x "$all" -done -patch -p1 -b --suffix .vnc < ../xserver117.patch -popd - -%patch16 -p0 -b .man - -%build -%if %{_bootstrap} -mkdir -p %{static_lib_buildroot}%{_libdir} -%endif - -%ifarch sparcv9 sparc64 s390 s390x -export CFLAGS="$RPM_OPT_FLAGS -fPIC -I%{static_lib_buildroot}%{_includedir}" -%else -export CFLAGS="$RPM_OPT_FLAGS -fpic -I%{static_lib_buildroot}%{_includedir}" -%endif -export CXXFLAGS=$CFLAGS -export CPPFLAGS=$CXXFLAGS -export PKG_CONFIG_PATH="%{static_lib_buildroot}%{_libdir}/pkgconfig:%{static_lib_buildroot}%{_datadir}/pkgconfig:%{_libdir}/pkgconfig:%{_datadir}/pkgconfig" - -%if %{_bootstrap} -echo "*** Building gmp ***" -pushd gmp-* -./configure --prefix=%{_prefix} --libdir=%{_libdir} --enable-static --disable-shared --enable-cxx --disable-assembly -make %{?_smp_mflags} DESTDIR=%{static_lib_buildroot} install -find %{static_lib_buildroot}%{_prefix} -type f -name "*.la" -delete -find %{static_lib_buildroot}%{_prefix} -type f -name "*.pc" -exec sed -i -e "s|libdir=%{_libdir}|libdir=%{static_lib_buildroot}%{_libdir}|" {} \; -find %{static_lib_buildroot}%{_prefix} -type f -name "*.pc" -exec sed -i -e "s|prefix=%{_prefix}|prefix=%{static_lib_buildroot}%{_prefix}|" {} \; -popd - -echo "*** Building libtasn1 ***" -pushd libtasn1-* -LDFLAGS="-L%{static_lib_buildroot}%{_libdir} $LDFLAGS" ./configure --prefix=%{_prefix} --libdir=%{_libdir} --enable-static --disable-shared --host=%{_host} --build=%{_build} -make %{?_smp_mflags} DESTDIR=%{static_lib_buildroot} install -find %{static_lib_buildroot}%{_prefix} -type f -name "*.la" -delete -find %{static_lib_buildroot}%{_prefix} -type f -name "*.pc" -exec sed -i -e "s|libdir=%{_libdir}|libdir=%{static_lib_buildroot}%{_libdir}|" {} \; -find %{static_lib_buildroot}%{_prefix} -type f -name "*.pc" -exec sed -i -e "s|prefix=%{_prefix}|prefix=%{static_lib_buildroot}%{_prefix}|" {} \; -popd - -echo "*** Building nettle ***" -pushd nettle-* -autoreconf -fiv -LDFLAGS="-L%{static_lib_buildroot}%{_libdir} -Wl,-Bstatic -ltasn1 -lgmp -Wl,-Bdynamic $LDFLAGS" ./configure --prefix=%{_prefix} --libdir=%{_libdir} --enable-static --disable-shared --disable-openssl --host=%{_host} --build=%{_build} -make %{?_smp_mflags} DESTDIR=%{static_lib_buildroot} install -find %{static_lib_buildroot}%{_prefix} -type f -name "*.la" -delete -find %{static_lib_buildroot}%{_prefix} -type f -name "*.pc" -exec sed -i -e "s|libdir=%{_libdir}|libdir=%{static_lib_buildroot}%{_libdir}|" {} \; -find %{static_lib_buildroot}%{_prefix} -type f -name "*.pc" -exec sed -i -e "s|prefix=%{_prefix}|prefix=%{static_lib_buildroot}%{_prefix}|" {} \; -popd - -echo "*** Building gnutls ***" -pushd gnutls-* -LDFLAGS="-L%{static_lib_buildroot}%{_libdir} -Wl,-Bstatic -lnettle -lhogweed -ltasn1 -lgmp -Wl,-Bdynamic $LDFLAGS" ./configure \ - --prefix=%{_prefix} \ - --libdir=%{_libdir} \ - --host=%{_host} \ - --build=%{_build} \ - --enable-static \ - --disable-shared \ - --without-p11-kit \ - --disable-guile \ - --disable-srp-authentication \ - --disable-libdane \ - --disable-doc \ - --enable-local-libopts \ - --without-tpm \ - --disable-dependency-tracking \ - --disable-silent-rules \ - --disable-heartbeat-support -make %{?_smp_mflags} DESTDIR=%{static_lib_buildroot} install -find %{static_lib_buildroot}%{_prefix} -type f -name "*.la" -delete -find %{static_lib_buildroot}%{_prefix} -type f -name "*.pc" -exec sed -i -e "s|libdir=%{_libdir}|libdir=%{static_lib_buildroot}%{_libdir}|" {} \; -find %{static_lib_buildroot}%{_prefix} -type f -name "*.pc" -exec sed -i -e "s|prefix=%{_prefix}|prefix=%{static_lib_buildroot}%{_prefix}|" {} \; -popd - -echo "*** Building libpng ***" -pushd libpng-* -CFLAGS="${CFLAGS}" CXXFLAGS="${CXXFLAGS}" LDFLAGS="${LDFLAGS}" ./configure \ - --prefix=%{_prefix} \ - --libdir=%{_libdir} \ - --host=%{_host} \ - --build=%{_build} \ - --disable-shared \ - --enable-static -make %{?_smp_mflags} -make DESTDIR=%{static_lib_buildroot} install -popd - -echo "*** Building fltk ***" -pushd fltk-* -%endif -export CMAKE_PREFIX_PATH="%{static_lib_buildroot}%{_prefix}:%{_prefix}" -export CMAKE_EXE_LINKER_FLAGS=$LDFLAGS -export PKG_CONFIG="pkg-config --static" -%if %{_bootstrap} -CFLAGS="${CFLAGS}" CXXFLAGS="${CXXFLAGS}" LDFLAGS="-L%{static_lib_buildroot}%{_libdir} -Wl,-Bstatic -lpng -Wl,-Bdynamic $LDFLAGS" ./configure \ - --prefix=%{_prefix} \ - --libdir=%{_libdir} \ - --host=%{_host} \ - --build=%{_build} \ - --enable-x11 \ - --enable-gl \ - --disable-shared \ - --enable-localjpeg \ - --enable-localzlib \ - --disable-localpng \ - --enable-xinerama \ - --enable-xft \ - --enable-xdbe \ - --enable-xfixes \ - --enable-xcursor \ - --with-x -make %{?_smp_mflags} -make DESTDIR=%{static_lib_buildroot} install -popd -%endif - -%{cmake} -G"Unix Makefiles" \ - -DBUILD_STATIC=off \ - -DCMAKE_INSTALL_PREFIX=%{_prefix} \ - -DFLTK_LIBRARIES="%{static_lib_buildroot}%{_libdir}/libfltk.a;%{static_lib_buildroot}%{_libdir}/libfltk_images.a;%{static_lib_buildroot}%{_libdir}/libpng.a" \ - -DFLTK_INCLUDE_DIR=%{static_lib_buildroot}%{_includedir} \ - -DGNUTLS_INCLUDE_DIR=%{static_lib_buildroot}%{_includedir} \ - -DGNUTLS_LIBRARY="%{static_lib_buildroot}%{_libdir}/libgnutls.a;%{static_lib_buildroot}%{_libdir}/libtasn1.a;%{static_lib_buildroot}%{_libdir}/libnettle.a;%{static_lib_buildroot}%{_libdir}/libhogweed.a;%{static_lib_buildroot}%{_libdir}/libgmp.a" -make %{?_smp_mflags} - -pushd unix/xserver -autoreconf -fiv -%configure \ - --disable-xorg --disable-xnest --disable-xvfb --disable-dmx \ - --disable-xwin --disable-xephyr --disable-kdrive --disable-wayland \ - --with-pic --disable-static --enable-xinerama \ - --with-default-font-path="catalogue:%{_sysconfdir}/X11/fontpath.d,built-ins" \ - --with-serverconfig-path=%{_libdir}/xorg \ - --with-fontrootdir=%{_datadir}/X11/fonts \ - --with-xkb-output=%{_localstatedir}/lib/xkb \ - --enable-install-libxf86config \ - --enable-glx --enable-glx-tls --disable-dri --enable-dri2 --disable-dri3 \ - --disable-config-dbus \ - --disable-config-hal \ - --disable-config-udev \ - --without-dtrace \ - --disable-unit-tests \ - --disable-docs \ - --disable-devel-docs \ - --disable-selective-werror - -make %{?_smp_mflags} -popd - -# Build icons -pushd media -make -popd - -# Build Java applet -pushd java -%{cmake} \ -%if !%{_self_signed} - -DJAVA_KEYSTORE=%{_keystore} \ - -DJAVA_KEYSTORE_TYPE=%{_keystore_type} \ - -DJAVA_KEY_ALIAS=%{_key_alias} \ - -DJAVA_STOREPASS=":env STOREPASS" \ - -DJAVA_KEYPASS=":env KEYPASS" \ - -DJAVA_TSA_URL=http://timestamp.geotrust.com/tsa . -%endif - -make -popd - -%install -%if %{_bootstrap} -for l in gmp libtasn1 nettle gnutls libpng fltk; do -pushd $l-* -make install DESTDIR=$RPM_BUILD_ROOT/opt/%{name}/%{scl_name} -popd -done -find %{buildroot}/opt/%{name}/%{scl_name}%{_prefix} -type f -name "*.la" -delete -find %{buildroot}/opt/%{name}/%{scl_name}%{_prefix} -type f -name "*.pc" -exec sed -i -e "s|libdir=%{_libdir}|libdir=/opt/%{name}/%{scl_name}%{_libdir}|" {} \; -find %{buildroot}/opt/%{name}/%{scl_name}%{_prefix} -type f -name "*.pc" -exec sed -i -e "s|prefix=%{_prefix}|prefix=/opt/%{name}/%{scl_name}%{_prefix}|" {} \; -%endif - -make install DESTDIR=$RPM_BUILD_ROOT - -pushd unix/xserver/hw/vnc -make install DESTDIR=$RPM_BUILD_ROOT -popd - -mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/init.d -mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig -install -m644 %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/init.d/vncserver -install -m644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/vncservers - -# Install Java applet -pushd java -mkdir -p $RPM_BUILD_ROOT%{_datadir}/vnc/classes -install -m755 VncViewer.jar $RPM_BUILD_ROOT%{_datadir}/vnc/classes -install -m644 com/tigervnc/vncviewer/index.vnc $RPM_BUILD_ROOT%{_datadir}/vnc/classes -popd - -%find_lang %{name} %{name}.lang - -# remove unwanted files -rm -f $RPM_BUILD_ROOT%{_libdir}/xorg/modules/extensions/libvnc.la - -%ifarch s390 s390x %{?rhel:ppc ppc64} -rm -f $RPM_BUILD_ROOT%{_libdir}/xorg/modules/extensions/libvnc.so -%endif - -%clean -rm -rf $RPM_BUILD_ROOT - -%post -touch -c %{_datadir}/icons/hicolor -if [ -x %{_bindir}/gtk-update-icon-cache ]; then - %{_bindir}/gtk-update-icon-cache -q %{_datadir}/icons/hicolor || : -fi - -%postun -touch -c %{_datadir}/icons/hicolor -if [ -x %{_bindir}/gtk-update-icon-cache ]; then - %{_bindir}/gtk-update-icon-cache -q %{_datadir}/icons/hicolor || : -fi - -%post server -/sbin/chkconfig --add vncserver - -%triggerun -- tigervnc-server < 1.0.90-6 -/sbin/service vncserver stop &>/dev/null || : -/sbin/chkconfig --del vncserver >/dev/null 2>&1 || : - -%files -f %{name}.lang -%defattr(-,root,root,-) -%doc README.md -%{_bindir}/vncviewer -%{_datadir}/applications/* -%{_mandir}/man1/vncviewer.1* - -%files server -%defattr(-,root,root,-) -%config(noreplace) %{_sysconfdir}/sysconfig/vncservers -%config(noreplace) %{_sysconfdir}/init.d/vncserver -%{_bindir}/x0vncserver -%{_bindir}/vncserver -%{_mandir}/man1/vncserver.1* -%{_mandir}/man1/x0vncserver.1* - -%files server-minimal -%defattr(-,root,root,-) -%{_bindir}/vncconfig -%{_bindir}/vncpasswd -%{_bindir}/Xvnc -%{_mandir}/man1/Xvnc.1* -%{_mandir}/man1/vncpasswd.1* -%{_mandir}/man1/vncconfig.1* - -%ifnarch s390 s390x %{?rhel:ppc ppc64} -%files server-module -%defattr(-,root,root,-) -%{_libdir}/xorg/modules/extensions/libvnc.so -%endif - -%files server-applet -%defattr(-,root,root,-) -%doc java/com/tigervnc/vncviewer/README -%{_datadir}/vnc/classes/* - -%files license -%defattr(-,root,root,-) -%doc LICENSE.TXT - -%files icons -%defattr(-,root,root,-) -%{_datadir}/icons/hicolor/*/apps/* - -%if %{_bootstrap} -%files static-devel -%defattr(-,root,root,-) -/opt/%{name}/%{scl_name}%{_bindir}/* -/opt/%{name}/%{scl_name}%{_includedir}/* -/opt/%{name}/%{scl_name}%{_libdir}/* -/opt/%{name}/%{scl_name}%{_datadir}/* -%endif - -%changelog -* Mon Jun 20 2016 Brian P. Hinz 1.6.80-5 -- Patch for Xorg 1.17 due to vendor bump of Xorg version - -* Sat Apr 02 2016 Brian P. Hinz 1.6.80-4 -- Fixed CVE-2015-8803 CVE-2015-8804 CVE-2015-8805 secp256r1 and secp384r1 bugs - -* Fri Dec 11 2015 Brian P. Hinz 1.6.80-3 -- Configure with --host and --build to avoid build host-specific compiler opts - -* Sun Nov 29 2015 Brian P. Hinz 1.6.80-2 -- Split static pre-reqs into separate package - -* Thu Nov 26 2015 Brian P. Hinz 1.6.80-1 -- Version bump for 1.6 release -- Update gnutls, libtasn1, libpng to latest upstream versions. - -* Sat Mar 14 2015 Brian P. Hinz 1.4.80-21 -- Build static libraries to meet new minimum requirements - -* Sat Mar 07 2015 Brian P. Hinz 1.4.80-20 -- Don't disable xinerama extension - -* Thu Feb 19 2015 Brian P. Hinz 1.4.80-19 -- Bumped fltk version to 1.3.3, no longer requires any patching - -* Tue Nov 04 2014 Brian P. Hinz 1.3.80-18.20131128svn5139 -- Bumped xserver patch to keep pace with native version - -* Thu Nov 28 2013 Brian P. Hinz 1.3.80-17.20131128svn5139 -- Bumped version to 1.3.80 -- Cleaned up linter warnings - -* Thu Jul 05 2013 Brian P. Hinz 1.3.0 -- Upstream 1.3.0 release -- Conditional-ized %snap for release - -* Thu Apr 04 2013 Brian P. Hinz 1.2.90-12.20130524svn5114 -- Improve spec file portability - -* Thu Apr 04 2013 Brian P. Hinz 1.2.80-12.20130330svn5066 -- Adapted from fedora for el6 - -* Thu Mar 14 2013 Adam Tkac - 1.2.80-0.10.20130314svn5065 -- include /etc/X11/xorg.conf.d/10-libvnc.conf sample configuration (#712482) -- vncserver now honors specified -geometry parameter (#755947) - -* Tue Mar 12 2013 Adam Tkac - 1.2.80-0.9.20130307svn5060 -- update to r5060 -- split icons to separate package to avoid multilib issues - -* Thu Jan 24 2013 Adam Tkac 1.2.80-0.8.20130124svn5036 -- update to r5036 (#892351) - -* Wed Jan 16 2013 Adam Tkac 1.2.80-0.7.20121126svn5015 -- rebuild - -* Tue Dec 04 2012 Adam Tkac 1.2.80-0.6.20121126svn5015 -- rebuild against new fltk - -* Mon Nov 26 2012 Adam Tkac 1.2.80-0.5.20121126svn5015 -- update to r5015 -- build with -fpic instead of -fPIC on all archs except s390/sparc - -* Wed Nov 7 2012 Peter Robinson 1.2.80-0.4.20120905svn4996 -- Build with -fPIC to fix FTBFS on ARM - -* Wed Oct 31 2012 Adam Jackson 1.2.80-0.3.20120905svn4996 -- tigervnc12-xorg113-glx.patch: Fix to only init glx on the first server - generation - -* Fri Sep 28 2012 Adam Jackson 1.2.80-0.2.20120905svn4996 -- tigervnc12-xorg113-glx.patch: Re-enable GLX against xserver 1.13 - -* Fri Aug 17 2012 Adam Tkac 1.2.80-0.1.20120905svn4996 -- update to 1.2.80 -- remove deprecated patches - - tigervnc-102434.patch - - tigervnc-viewer-reparent.patch - - tigervnc11-java7.patch -- patches merged - - tigervnc11-xorg111.patch - - tigervnc11-xorg112.patch - -* Fri Aug 10 2012 Dave Airlie 1.1.0-10 -- fix build against newer X server - -* Mon Jul 23 2012 Adam Jackson 1.1.0-9 -- Build with the Composite extension for feature parity with other X servers - -* Sat Jul 21 2012 Fedora Release Engineering - 1.1.0-8 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild - -* Thu Jul 19 2012 Dave Airlie 1.1.0-7 -- fix building against X.org 1.13 - -* Wed Apr 04 2012 Adam Jackson 1.1.0-6 -- RHEL exclusion for -server-module on ppc* too - -* Mon Mar 26 2012 Adam Tkac - 1.1.0-5 -- clean Xvnc's /tmp environment in service file before startup -- fix building against the latest JAVA 7 and X.Org 1.12 - -* Sat Jan 14 2012 Fedora Release Engineering - 1.1.0-4 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild - -* Tue Nov 22 2011 Adam Tkac - 1.1.0-3 -- don't build X.Org devel docs (#755782) -- applet: BR generic java-devel instead of java-gcj-devel (#755783) -- use runuser to start Xvnc in systemd service file (#754259) -- don't attepmt to restart Xvnc session during update/erase (#753216) - -* Fri Nov 11 2011 Adam Tkac - 1.1.0-2 -- libvnc.so: don't use unexported GetMaster function (#744881) -- remove nasm buildreq - -* Mon Sep 12 2011 Adam Tkac - 1.1.0-1 -- update to 1.1.0 -- update the xorg11 patch -- patches merged - - tigervnc11-glx.patch - - tigervnc11-CVE-2011-1775.patch - - 0001-Use-memmove-instead-of-memcpy-in-fbblt.c-when-memory.patch - -* Thu Jul 28 2011 Adam Tkac - 1.0.90-6 -- add systemd service file and remove legacy SysV initscript (#717227) - -* Tue May 12 2011 Adam Tkac - 1.0.90-5 -- make Xvnc buildable against X.Org 1.11 - -* Tue May 10 2011 Adam Tkac - 1.0.90-4 -- viewer can send password without proper validation of X.509 certs - (CVE-2011-1775) - -* Wed Apr 13 2011 Adam Tkac - 1.0.90-3 -- fix wrong usage of memcpy which caused screen artifacts (#652590) -- don't point to inaccessible link in sysconfig/vncservers (#644975) - -* Fri Apr 08 2011 Adam Tkac - 1.0.90-2 -- improve compatibility with vinagre client (#692048) - -* Tue Mar 22 2011 Adam Tkac - 1.0.90-1 -- update to 1.0.90 - -* Wed Feb 09 2011 Fedora Release Engineering - 1.0.90-0.32.20110117svn4237 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild - -* Mon Jan 17 2011 Adam Tkac 1.0.90-0.31.20110117svn4237 -- fix libvnc.so module loading - -* Mon Jan 17 2011 Adam Tkac 1.0.90-0.30.20110117svn4237 -- update to r4237 -- patches merged - - tigervnc11-optionsdialog.patch - - tigervnc11-rh607866.patch - -* Fri Jan 14 2011 Adam Tkac 1.0.90-0.29.20101208svn4225 -- improve patch for keyboard issues - -* Fri Jan 14 2011 Adam Tkac 1.0.90-0.28.20101208svn4225 -- attempt to fix various keyboard-related issues (key repeating etc) - -* Fri Jan 07 2011 Adam Tkac 1.0.90-0.27.20101208svn4225 -- render "Ok" and "Cancel" buttons in the options dialog correctly - -* Wed Dec 15 2010 Jan Görig 1.0.90-0.26.20101208svn4225 -- added vncserver lock file (#662784) - -* Fri Dec 10 2010 Adam Tkac 1.0.90-0.25.20101208svn4225 -- update to r4225 -- patches merged - - tigervnc11-rh611677.patch - - tigervnc11-rh633931.patch - - tigervnc11-xorg1.10.patch -- enable VeNCrypt and PAM support - -* Mon Dec 06 2010 Adam Tkac 1.0.90-0.24.20100813svn4123 -- rebuild against xserver 1.10.X -- 0001-Return-Success-from-generate_modkeymap-when-max_keys.patch merged - -* Wed Sep 29 2010 jkeating - 1.0.90-0.23.20100813svn4123 -- Rebuilt for gcc bug 634757 - -* Tue Sep 21 2010 Adam Tkac 1.0.90-0.22.20100420svn4030 -- drop xorg-x11-fonts-misc dependency (#636170) - -* Tue Sep 21 2010 Adam Tkac 1.0.90-0.21.20100420svn4030 -- improve patch for #633645 (fix tcsh incompatibilities) - -* Thu Sep 16 2010 Adam Tkac 1.0.90-0.20.20100813svn4123 -- press fake modifiers correctly (#633931) -- supress unneeded debug information emitted from initscript (#633645) - -* Wed Aug 25 2010 Adam Tkac 1.0.90-0.19.20100813svn4123 -- separate Xvnc, vncpasswd and vncconfig to -server-minimal subpkg (#626946) -- move license to separate subpkg and Requires it from main subpkgs -- Xvnc: handle situations when no modifiers exist well (#611677) - -* Fri Aug 13 2010 Adam Tkac 1.0.90-0.18.20100813svn4123 -- update to r4123 (#617973) -- add perl requires to -server subpkg (#619791) - -* Thu Jul 22 2010 Adam Tkac 1.0.90-0.17.20100721svn4113 -- update to r4113 -- patches merged - - tigervnc11-rh586406.patch - - tigervnc11-libvnc.patch - - tigervnc11-rh597172.patch - - tigervnc11-rh600070.patch - - tigervnc11-options.patch -- don't own %%{_datadir}/icons directory (#614301) -- minor improvements in the .desktop file (#616340) -- bundled libjpeg configure requires nasm; is executed even if system-wide - libjpeg is used - -* Fri Jul 02 2010 Adam Tkac 1.0.90-0.16.20100420svn4030 -- build against system-wide libjpeg-turbo (#494458) -- build no longer requires nasm - -* Mon Jun 28 2010 Adam Tkac 1.0.90-0.15.20100420svn4030 -- vncserver: accept <+optname> option when specified as the first one - -* Thu Jun 24 2010 Adam Tkac 1.0.90-0.14.20100420svn4030 -- fix memory leak in Xvnc input code (#597172) -- don't crash when receive negative encoding (#600070) -- explicitly disable udev configuration support -- add gettext-autopoint to BR - -* Mon Jun 14 2010 Adam Tkac 1.0.90-0.13.20100420svn4030 -- update URL about SSH tunneling in the sysconfig file (#601996) - -* Fri Jun 11 2010 Adam Tkac 1.0.90-0.12.20100420svn4030 -- use newer gettext -- autopoint now uses git instead of cvs, adjust BuildRequires appropriately - -* Thu May 13 2010 Adam Tkac 1.0.90-0.11.20100420svn4030 -- link libvnc.so "now" to catch "undefined symbol" errors during Xorg startup -- use always XkbConvertCase instead of XConvertCase (#580159, #586406) -- don't link libvnc.so against libXi.la, libdix.la and libxkb.la; use symbols - from Xorg instead - -* Thu May 13 2010 Adam Tkac 1.0.90-0.10.20100420svn4030 -- update to r4030 snapshot -- patches merged to upstream - - tigervnc11-rh522369.patch - - tigervnc11-rh551262.patch - - tigervnc11-r4002.patch - - tigervnc11-r4014.patch - -* Thu Apr 08 2010 Adam Tkac 1.0.90-0.9.20100219svn3993 -- add server-applet subpackage which contains Java vncviewer applet -- fix Java applet; it didn't work when run from web browser -- add xorg-x11-xkb-utils to server Requires - -* Fri Mar 12 2010 Adam Tkac 1.0.90-0.8.20100219svn3993 -- add French translation to vncviewer.desktop (thanks to Alain Portal) - -* Thu Mar 04 2010 Adam Tkac 1.0.90-0.7.20100219svn3993 -- don't crash during pixel format change (#522369, #551262) - -* Mon Mar 01 2010 Adam Tkac 1.0.90-0.6.20100219svn3993 -- add mesa-dri-drivers and xkeyboard-config to -server Requires -- update to r3993 1.0.90 snapshot - - tigervnc11-noexecstack.patch merged - - tigervnc11-xorg18.patch merged - - xserver18.patch is no longer needed - -* Wed Jan 27 2010 Jan Gorig 1.0.90-0.5.20091221svn3929 -- initscript LSB compliance fixes (#523974) - -* Fri Jan 22 2010 Adam Tkac 1.0.90-0.4.20091221svn3929 -- mark stack as non-executable in jpeg ASM code -- add xorg-x11-xauth to Requires -- add support for X.Org 1.8 -- drop shave sources, they are no longer needed - -* Thu Jan 21 2010 Adam Tkac 1.0.90-0.3.20091221svn3929 -- drop tigervnc-xorg25909.patch, it has been merged to X.Org upstream - -* Thu Jan 07 2010 Adam Tkac 1.0.90-0.2.20091221svn3929 -- add patch for upstream X.Org issue #25909 -- add libXdmcp-devel to build requires to build Xvnc with XDMCP support (#552322) - -* Mon Dec 21 2009 Adam Tkac 1.0.90-0.1.20091221svn3929 -- update to 1.0.90 snapshot -- patches merged - - tigervnc10-compat.patch - - tigervnc10-rh510185.patch - - tigervnc10-rh524340.patch - - tigervnc10-rh516274.patch - -* Mon Oct 26 2009 Adam Tkac 1.0.0-3 -- create Xvnc keyboard mapping before first keypress (#516274) - -* Thu Oct 08 2009 Adam Tkac 1.0.0-2 -- update underlying X source to 1.6.4-0.3.fc11 -- remove bogus '-nohttpd' parameter from /etc/sysconfig/vncservers (#525629) -- initscript LSB compliance fixes (#523974) -- improve -LowColorSwitch documentation and handling (#510185) -- honor dotWhenNoCursor option (and it's changes) every time (#524340) - -* Fri Aug 28 2009 Adam Tkac 1.0.0-1 -- update to 1.0.0 -- tigervnc10-rh495457.patch merged to upstream - -* Mon Aug 24 2009 Karsten Hopp 0.0.91-0.17 -- fix ifnarch s390x for server-module - -* Fri Aug 21 2009 Tomas Mraz - 0.0.91-0.16 -- rebuilt with new openssl - -* Tue Aug 04 2009 Adam Tkac 0.0.91-0.15 -- make Xvnc compilable - -* Sun Jul 26 2009 Fedora Release Engineering - 0.0.91-0.14.1 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild - -* Mon Jul 13 2009 Adam Tkac 0.0.91-0.13.1 -- don't write warning when initscript is called with condrestart param (#508367) - -* Tue Jun 23 2009 Adam Tkac 0.0.91-0.13 -- temporary use F11 Xserver base to make Xvnc compilable -- BuildRequires: libXi-devel -- don't ship tigervnc-server-module on s390/s390x - -* Mon Jun 22 2009 Adam Tkac 0.0.91-0.12 -- fix local rendering of cursor (#495457) - -* Thu Jun 18 2009 Adam Tkac 0.0.91-0.11 -- update to 0.0.91 (1.0.0 RC1) -- patches merged - - tigervnc10-rh499401.patch - - tigervnc10-rh497592.patch - - tigervnc10-rh501832.patch -- after discusion in upstream drop tigervnc-bounds.patch -- configure flags cleanup - -* Thu May 21 2009 Adam Tkac 0.0.90-0.10 -- rebuild against 1.6.1.901 X server (#497835) -- disable i18n, vncviewer is not UTF-8 compatible (#501832) - -* Mon May 18 2009 Adam Tkac 0.0.90-0.9 -- fix vncpasswd crash on long passwords (#499401) -- start session dbus daemon correctly (#497592) - -* Mon May 11 2009 Adam Tkac 0.0.90-0.8.1 -- remove merged tigervnc-manminor.patch - -* Tue May 05 2009 Adam Tkac 0.0.90-0.8 -- update to 0.0.90 - -* Thu Apr 30 2009 Adam Tkac 0.0.90-0.7.20090427svn3789 -- server package now requires xorg-x11-fonts-misc (#498184) - -* Mon Apr 27 2009 Adam Tkac 0.0.90-0.6.20090427svn3789 -- update to r3789 - - tigervnc-rh494801.patch merged -- tigervnc-newfbsize.patch is no longer needed -- fix problems when vncviewer and Xvnc run on different endianess (#496653) -- UltraVNC and TightVNC clients work fine again (#496786) - -* Wed Apr 08 2009 Adam Tkac 0.0.90-0.5.20090403svn3751 -- workaround broken fontpath handling in vncserver script (#494801) - -* Fri Apr 03 2009 Adam Tkac 0.0.90-0.4.20090403svn3751 -- update to r3751 -- patches merged - - tigervnc-xclients.patch - - tigervnc-clipboard.patch - - tigervnc-rh212985.patch -- basic RandR support in Xvnc (resize of the desktop) -- use built-in libjpeg (SSE2/MMX accelerated encoding on x86 platform) -- use Tight encoding by default -- use TigerVNC icons - -* Tue Mar 03 2009 Adam Tkac 0.0.90-0.3.20090303svn3631 -- update to r3631 - -* Tue Mar 03 2009 Adam Tkac 0.0.90-0.2.20090302svn3621 -- package review related fixes - -* Mon Mar 02 2009 Adam Tkac 0.0.90-0.1.20090302svn3621 -- initial package, r3621 diff --git a/contrib/packages/rpm/el7/SOURCES/10-libvnc.conf b/contrib/packages/rpm/el7/SOURCES/10-libvnc.conf deleted file mode 100644 index a053a7d..0000000 --- a/contrib/packages/rpm/el7/SOURCES/10-libvnc.conf +++ /dev/null @@ -1,19 +0,0 @@ -# This file contains configuration of libvnc.so module -# -# To get libvnc.so module working, do this: -# 1. run "vncpasswd" from tigervnc-server package as root user -# 2. uncomment configuration lines below -# -# Please note you can specify any option which Xvnc accepts. -# Refer to `Xvnc -help` output for detailed list of options. - -#Section "Module" -# Load "vnc" -#EndSection - -#Section "Screen" -# Identifier "Screen0 -# DefaultDepth 16 -# Option "SecurityTypes" "VncAuth" -# Option "PasswordFile" "/root/.vnc/passwd" -#EndSection diff --git a/contrib/packages/rpm/el7/SOURCES/tigervnc-shebang.patch b/contrib/packages/rpm/el7/SOURCES/tigervnc-shebang.patch deleted file mode 100644 index f76af87..0000000 --- a/contrib/packages/rpm/el7/SOURCES/tigervnc-shebang.patch +++ /dev/null @@ -1,9 +0,0 @@ -diff -up tigervnc-1.3.0/unix/vncserver.shebang tigervnc-1.3.0/unix/vncserver ---- tigervnc-1.3.0/unix/vncserver.shebang 2013-07-24 12:22:34.962158378 +0100 -+++ tigervnc-1.3.0/unix/vncserver 2013-07-24 12:22:41.593188190 +0100 -@@ -1,4 +1,4 @@ --#!/usr/bin/env perl -+#!/usr/bin/perl - # - # Copyright (C) 2009-2010 D. R. Commander. All Rights Reserved. - # Copyright (C) 2005-2006 Sun Microsystems, Inc. All Rights Reserved. diff --git a/contrib/packages/rpm/el7/SOURCES/vncserver.service b/contrib/packages/rpm/el7/SOURCES/vncserver.service deleted file mode 100644 index 4cec744..0000000 --- a/contrib/packages/rpm/el7/SOURCES/vncserver.service +++ /dev/null @@ -1,45 +0,0 @@ -# The vncserver service unit file -# -# Quick HowTo: -# 1. Copy this file to /etc/systemd/system/vncserver@.service -# 2. Edit and vncserver parameters appropriately -# ("runuser -l -c /usr/bin/vncserver %i -arg1 -arg2") -# 3. Run `systemctl daemon-reload` -# 4. Run `systemctl enable vncserver@:.service` -# -# DO NOT RUN THIS SERVICE if your local area network is -# untrusted! For a secure way of using VNC, you should -# limit connections to the local host and then tunnel from -# the machine you want to view VNC on (host A) to the machine -# whose VNC output you want to view (host B) -# -# [user@hostA ~]$ ssh -v -C -L 590N:localhost:590M hostB -# -# this will open a connection on port 590N of your hostA to hostB's port 590M -# (in fact, it ssh-connects to hostB and then connects to localhost (on hostB). -# See the ssh man page for details on port forwarding) -# -# You can then point a VNC client on hostA at vncdisplay N of localhost and with -# the help of ssh, you end up seeing what hostB makes available on port 590M -# -# Use "-nolisten tcp" to prevent X connections to your VNC server via TCP. -# -# Use "-localhost" to prevent remote VNC clients connecting except when -# doing so through a secure tunnel. See the "-via" option in the -# `man vncviewer' manual page. - - -[Unit] -Description=Remote desktop service (VNC) -After=syslog.target network.target - -[Service] -Type=forking -# Clean any existing files in /tmp/.X11-unix environment -ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :' -ExecStart=/usr/sbin/runuser -l -c "/usr/bin/vncserver %i" -PIDFile=/home//.vnc/%H%i.pid -ExecStop=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :' - -[Install] -WantedBy=multi-user.target diff --git a/contrib/packages/rpm/el7/SOURCES/vncserver.sysconfig b/contrib/packages/rpm/el7/SOURCES/vncserver.sysconfig deleted file mode 100644 index 4d0489b..0000000 --- a/contrib/packages/rpm/el7/SOURCES/vncserver.sysconfig +++ /dev/null @@ -1 +0,0 @@ -# THIS FILE HAS BEEN REPLACED BY /lib/systemd/system/vncserver@.service diff --git a/contrib/packages/rpm/el7/SPECS/tigervnc.spec b/contrib/packages/rpm/el7/SPECS/tigervnc.spec deleted file mode 100644 index 50569b1..0000000 --- a/contrib/packages/rpm/el7/SPECS/tigervnc.spec +++ /dev/null @@ -1,830 +0,0 @@ -%{!?_self_signed: %define _self_signed 1} -%{!?_bootstrap: %define _bootstrap 1} -%define tigervnc_src_dir %{_builddir}/%{name}-%{version}%{?snap:-%{snap}} -%global scl_name %{name}16 -%if %{_bootstrap} -%define static_lib_buildroot %{tigervnc_src_dir}/opt/%{name}/%{scl_name} -%else -%define static_lib_buildroot /opt/%{name}/%{scl_name} -%endif - -Name: tigervnc -Version: 1.6.80 -Release: 1%{?snap:.%{snap}}%{?dist} -Summary: A TigerVNC remote display system - -Group: User Interface/Desktops -License: GPLv2+ -Packager: Brian P. Hinz -URL: http://www.tigervnc.com - -Source0: %{name}-%{version}%{?snap:-%{snap}}.tar.bz2 -Source1: vncserver.service -Source2: vncserver.sysconfig -Source3: 10-libvnc.conf -Source11: http://fltk.org/pub/fltk/1.3.3/fltk-1.3.3-source.tar.gz -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) - -BuildRequires: libX11-devel, automake, autoconf, libtool, gettext, gettext-autopoint -BuildRequires: libXext-devel, xorg-x11-server-source, libXi-devel -BuildRequires: xorg-x11-xtrans-devel, xorg-x11-util-macros, libXtst-devel -BuildRequires: libdrm-devel, libXt-devel, pixman-devel libXfont-devel -BuildRequires: libxkbfile-devel, openssl-devel, libpciaccess-devel -BuildRequires: mesa-libGL-devel, libXinerama-devel, ImageMagick -BuildRequires: freetype-devel, libXdmcp-devel, libXfont2-devel -BuildRequires: java-devel, jpackage-utils -BuildRequires: libjpeg-turbo-devel, gnutls-devel, pam-devel -BuildRequires: systemd, cmake - -Requires(post): coreutils -Requires(postun): coreutils - -Requires: hicolor-icon-theme -Requires: tigervnc-license -Requires: tigervnc-icons - -Provides: vnc = 4.1.3-2, vnc-libs = 4.1.3-2 -Obsoletes: vnc < 4.1.3-2, vnc-libs < 4.1.3-2 -Provides: tightvnc = 1.5.0-0.15.20090204svn3586 -Obsoletes: tightvnc < 1.5.0-0.15.20090204svn3586 - -Patch17: tigervnc-shebang.patch - -%description -Virtual Network Computing (VNC) is a remote display system which -allows you to view a computing 'desktop' environment not only on the -machine where it is running, but from anywhere on the Internet and -from a wide variety of machine architectures. This package contains a -client which will allow you to connect to other desktops running a VNC -server. - -%package server -Summary: A TigerVNC server -Group: User Interface/X -Provides: vnc-server = 4.1.3-2, vnc-libs = 4.1.3-2 -Obsoletes: vnc-server < 4.1.3-2, vnc-libs < 4.1.3-2 -Provides: tightvnc-server = 1.5.0-0.15.20090204svn3586 -Obsoletes: tightvnc-server < 1.5.0-0.15.20090204svn3586 -Requires: perl -Requires: tigervnc-server-minimal -Requires: xorg-x11-xauth -Requires: xorg-x11-xinit -Requires(post): systemd -Requires(preun): systemd -Requires(postun): systemd -Requires(post): systemd-sysv chkconfig - -%description server -The VNC system allows you to access the same desktop from a wide -variety of platforms. This package includes set of utilities -which make usage of TigerVNC server more user friendly. It also -contains x0vncserver program which can export your active -X session. - -%package server-minimal -Summary: A minimal installation of TigerVNC server -Group: User Interface/X -Requires(post): chkconfig -Requires(preun): chkconfig -Requires(preun): initscripts -Requires(postun): initscripts - -Requires: mesa-dri-drivers, xkeyboard-config, xorg-x11-xkb-utils -Requires: tigervnc-license - -%description server-minimal -The VNC system allows you to access the same desktop from a wide -variety of platforms. This package contains minimal installation -of TigerVNC server, allowing others to access the desktop on your -machine. - -%ifnarch s390 s390x -%package server-module -Summary: TigerVNC module to Xorg -Group: User Interface/X -Provides: vnc-server = 4.1.3-2, vnc-libs = 4.1.3-2 -Obsoletes: vnc-server < 4.1.3-2, vnc-libs < 4.1.3-2 -Provides: tightvnc-server-module = 1.5.0-0.15.20090204svn3586 -Obsoletes: tightvnc-server-module < 1.5.0-0.15.20090204svn3586 -Requires: xorg-x11-server-Xorg -Requires: tigervnc-license - -%description server-module -This package contains libvnc.so module to X server, allowing others -to access the desktop on your machine. -%endif - -%package server-applet -Summary: Java TigerVNC viewer applet for TigerVNC server -Group: User Interface/X -Requires: tigervnc-server, java, jpackage-utils -BuildArch: noarch - -%description server-applet -The Java TigerVNC viewer applet for web browsers. Install this package to allow -clients to use web browser when connect to the TigerVNC server. - -%package license -Summary: License of TigerVNC suite -Group: User Interface/X -BuildArch: noarch - -%description license -This package contains license of the TigerVNC suite - -%package icons -Summary: Icons for TigerVNC viewer -Group: User Interface/X -BuildArch: noarch - -%description icons -This package contains icons for TigerVNC viewer - -%if %{_bootstrap} -%package static-devel -Summary: Static development files necessary to build TigerVNC -Group: Development/Libraries - -%description static-devel -This package contains static development files necessary to build TigerVNC -%endif - -%prep -rm -rf $RPM_BUILD_ROOT -%setup -q -n %{name}-%{version}%{?snap:-%{snap}} - -%if %{_bootstrap} -tar xzf %SOURCE11 -%endif - -cp -r /usr/share/xorg-x11-server-source/* unix/xserver -pushd unix/xserver -for all in `find . -type f -perm -001`; do - chmod -x "$all" -done -patch -p1 -b --suffix .vnc < ../xserver119.patch -popd - -# Don't use shebang in vncserver script. -%patch17 -p1 -b .shebang - -%build -%if %{_bootstrap} -mkdir -p %{static_lib_buildroot}%{_libdir} -%endif - -%ifarch sparcv9 sparc64 s390 s390x -export CFLAGS="$RPM_OPT_FLAGS -fPIC -I%{static_lib_buildroot}%{_includedir}" -%else -export CFLAGS="$RPM_OPT_FLAGS -fpic -I%{static_lib_buildroot}%{_includedir}" -%endif -export CXXFLAGS="$CFLAGS" -export CPPFLAGS="$CXXFLAGS" -export PKG_CONFIG_PATH="%{static_lib_buildroot}%{_libdir}/pkgconfig:%{static_lib_buildroot}%{_datadir}/pkgconfig:%{_libdir}/pkgconfig:%{_datadir}/pkgconfig" - -%if %{_bootstrap} -echo "*** Building fltk ***" -pushd fltk-* -%endif -export CMAKE_PREFIX_PATH="%{static_lib_buildroot}%{_prefix}:%{_prefix}" -export CMAKE_EXE_LINKER_FLAGS=$LDFLAGS -export PKG_CONFIG="pkg-config --static" -%if %{_bootstrap} -#CFLAGS="${CFLAGS}" CXXFLAGS="${CXXFLAGS}" LDFLAGS="-L%{static_lib_buildroot}%{_libdir} -Wl,-Bstatic -lpng -Wl,-Bdynamic $LDFLAGS" -./configure \ - --prefix=%{_prefix} \ - --libdir=%{_libdir} \ - --host=%{_host} \ - --build=%{_build} \ - --enable-x11 \ - --enable-gl \ - --disable-shared \ - --enable-localjpeg \ - --enable-localzlib \ - --disable-localpng \ - --enable-xinerama \ - --enable-xft \ - --enable-xdbe \ - --enable-xfixes \ - --enable-xcursor \ - --with-x -make %{?_smp_mflags} -make DESTDIR=%{static_lib_buildroot} install -popd -%endif - -%{cmake} -G"Unix Makefiles" \ - -DBUILD_STATIC=off \ - -DCMAKE_INSTALL_PREFIX=%{_prefix} \ - -DFLTK_LIBRARIES="%{static_lib_buildroot}%{_libdir}/libfltk.a;%{static_lib_buildroot}%{_libdir}/libfltk_images.a;-lpng;-ldl" \ - -DFLTK_INCLUDE_DIR=%{static_lib_buildroot}%{_includedir} -make %{?_smp_mflags} - -pushd unix/xserver -autoreconf -fiv -%configure \ - --disable-xorg --disable-xnest --disable-xvfb --disable-dmx \ - --disable-xwin --disable-xephyr --disable-kdrive --with-pic \ - --disable-static --disable-xwayland \ - --with-default-font-path="catalogue:%{_sysconfdir}/X11/fontpath.d,built-ins" \ - --with-fontdir=%{_datadir}/X11/fonts \ - --with-xkb-output=%{_localstatedir}/lib/xkb \ - --enable-install-libxf86config \ - --enable-glx --disable-dri --enable-dri2 \ - --disable-wayland \ - --disable-present \ - --disable-config-dbus \ - --disable-config-hal \ - --disable-config-udev \ - --with-dri-driver-path=%{_libdir}/dri \ - --without-dtrace \ - --disable-unit-tests \ - --disable-devel-docs \ - --disable-selective-werror - -make %{?_smp_mflags} -popd - -# Build icons -pushd media -make -popd - -# Build Java applet -pushd java -%{cmake} \ -%if !%{_self_signed} - -DJAVA_KEYSTORE=%{_keystore} \ - -DJAVA_KEYSTORE_TYPE=%{_keystore_type} \ - -DJAVA_KEY_ALIAS=%{_key_alias} \ - -DJAVA_STOREPASS=":env STOREPASS" \ - -DJAVA_KEYPASS=":env KEYPASS" \ - -DJAVA_TSA_URL=http://timestamp.geotrust.com/tsa . -%endif - -make -popd - -%install -%if %{_bootstrap} -for l in fltk; do -pushd $l-* -make install DESTDIR=$RPM_BUILD_ROOT/opt/%{name}/%{scl_name} -popd -done -find %{buildroot}/opt/%{name}/%{scl_name}%{_prefix} -type f -name "*.la" -delete -find %{buildroot}/opt/%{name}/%{scl_name}%{_prefix} -type f -name "*.pc" -exec sed -i -e "s|libdir=%{_libdir}|libdir=/opt/%{name}/%{scl_name}%{_libdir}|" {} \; -find %{buildroot}/opt/%{name}/%{scl_name}%{_prefix} -type f -name "*.pc" -exec sed -i -e "s|prefix=%{_prefix}|prefix=/opt/%{name}/%{scl_name}%{_prefix}|" {} \; -%endif - -make install DESTDIR=$RPM_BUILD_ROOT - -pushd unix/xserver/hw/vnc -make install DESTDIR=$RPM_BUILD_ROOT -popd - -# Install systemd unit file -mkdir -p %{buildroot}%{_unitdir} -install -m644 %{SOURCE1} %{buildroot}%{_unitdir}/vncserver@.service -rm -rf %{buildroot}%{_initrddir} - -mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig -install -m644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/vncservers - -# Install Java applet -pushd java -mkdir -p $RPM_BUILD_ROOT%{_datadir}/vnc/classes -install -m755 VncViewer.jar $RPM_BUILD_ROOT%{_datadir}/vnc/classes -install -m644 com/tigervnc/vncviewer/index.vnc $RPM_BUILD_ROOT%{_datadir}/vnc/classes -popd - -%find_lang %{name} %{name}.lang - -# remove unwanted files -rm -f $RPM_BUILD_ROOT%{_libdir}/xorg/modules/extensions/libvnc.la - -%ifarch s390 s390x -rm -f $RPM_BUILD_ROOT%{_libdir}/xorg/modules/extensions/libvnc.so -%else -mkdir -p %{buildroot}%{_sysconfdir}/X11/xorg.conf.d/ -install -m 644 %{SOURCE3} %{buildroot}%{_sysconfdir}/X11/xorg.conf.d/10-libvnc.conf -%endif - -%clean -rm -rf $RPM_BUILD_ROOT - -%post -touch -c %{_datadir}/icons/hicolor -if [ -x %{_bindir}/gtk-update-icon-cache ]; then - %{_bindir}/gtk-update-icon-cache -q %{_datadir}/icons/hicolor || : -fi - -%postun -touch -c %{_datadir}/icons/hicolor -if [ -x %{_bindir}/gtk-update-icon-cache ]; then - %{_bindir}/gtk-update-icon-cache -q %{_datadir}/icons/hicolor || : -fi - -%post server -%systemd_post vncserver.service - -%triggerun -- tigervnc-server < 1.0.90-6 -%{_bindir}/systemd-sysv-convert --save vncserver >/dev/null 2>&1 ||: -/sbin/chkconfig --del vncserver >/dev/null 2>&1 || : - -%preun server -%systemd_preun vncserver.service - -%postun server -%systemd_postun - -%files -f %{name}.lang -%defattr(-,root,root,-) -%doc %{_docdir}/%{name}-%{version}/README.md -%{_bindir}/vncviewer -%{_datadir}/applications/* -%{_mandir}/man1/vncviewer.1* - -%files server -%defattr(-,root,root,-) -%config(noreplace) %{_sysconfdir}/sysconfig/vncservers -%{_unitdir}/vncserver@.service -%{_bindir}/x0vncserver -%{_bindir}/vncserver -%{_mandir}/man1/vncserver.1* -%{_mandir}/man1/x0vncserver.1* - -%files server-minimal -%defattr(-,root,root,-) -%{_bindir}/vncconfig -%{_bindir}/vncpasswd -%{_bindir}/Xvnc -%{_mandir}/man1/Xvnc.1* -%{_mandir}/man1/vncpasswd.1* -%{_mandir}/man1/vncconfig.1* - -%ifnarch s390 s390x -%files server-module -%defattr(-,root,root,-) -%{_libdir}/xorg/modules/extensions/libvnc.so -%config %{_sysconfdir}/X11/xorg.conf.d/10-libvnc.conf -%endif - -%files server-applet -%defattr(-,root,root,-) -%doc java/com/tigervnc/vncviewer/README -%{_datadir}/vnc/classes/* - -%files license -%doc %{_docdir}/%{name}-%{version}/LICENSE.TXT - -%files icons -%defattr(-,root,root,-) -%{_datadir}/icons/hicolor/*/apps/* - -%if %{_bootstrap} -%files static-devel -%defattr(-,root,root,-) -/opt/%{name}/%{scl_name}%{_bindir}/* -/opt/%{name}/%{scl_name}%{_includedir}/* -/opt/%{name}/%{scl_name}%{_libdir}/* -/opt/%{name}/%{scl_name}%{_datadir}/* -%endif - -%changelog -* Thu Dec 24 2015 Brian P. Hinz 1.6.80-1 -- Adapted from RedHat EL7 Spec - -* Wed Sep 02 2015 Jan Grulich - 1.3.1-3 -- Do not mention that display number is required in the file name - Resolves: bz#1195266 - -* Thu Jul 30 2015 Jan Grulich - 1.3.1-2 -- Resolves: bz#1248422 - CVE-2014-8240 CVE-2014-8241 tigervnc: various flaws - -* Wed Apr 15 2015 Jan Grulich - 1.3.1-1 -- Drop unecessary patches -- Re-base to 1.3.1 (bug #1199453) -- Re-build against re-based xserver (bug #1194898) -- Check the return value from XShmAttach (bug #1072733) -- Add missing part of xserver114.patch (bug #1140603) -- Keep pointer in sync (bug #1100661) -- Make input device class global (bug #1119640) -- Add IPv6 support (bug #1162722) -- Set initial mode as prefered (bug #1181287) -- Do not mention that display number is required in the file name (bug #1195266) -- Enable Xinerama extension (bug #1199437) -- Specify full path for runuser command (bug #1208817) - -* Tue Sep 23 2014 Tim Waugh - 1.2.80-0.31.20130314svn5065 -- Rebuilt against xorg-x11-server to pick up ppc64le fix (bug #1140424). - -* Mon Mar 10 2014 Tim Waugh - 1.2.80-0.30.20130314svn5065 -- Fixed heap-based buffer overflow (CVE-2014-0011, bug #1050928). - -* Tue Feb 18 2014 Tim Waugh - 1.2.80-0.29.20130314svn5065 -- Previous patch was not applied. - -* Mon Feb 10 2014 Tim Waugh - 1.2.80-0.28.20130314svn5065 -- Clearer xstartup file (bug #923655). - -* Tue Jan 28 2014 Tim Waugh - 1.2.80-0.27.20130314svn5065 -- Use keyboard input code from tigervnc-1.3.0 (bug #1053536). - -* Fri Jan 24 2014 Daniel Mach - 1.2.80-0.26.20130314svn5065 -- Mass rebuild 2014-01-24 - -* Fri Jan 10 2014 Tim Waugh - 1.2.80-0.25.20130314svn5065 -- Fixed viewer crash when cursor has not been set (bug #1051333). - -* Fri Dec 27 2013 Daniel Mach - 1.2.80-0.24.20130314svn5065 -- Mass rebuild 2013-12-27 - -* Thu Dec 12 2013 Tim Waugh 1.2.80-0.23.20130314svn5065 -- Avoid invalid read when ZRLE connection closed (bug #1039926). - -* Tue Dec 10 2013 Tim Waugh 1.2.80-0.22.20130314svn5065 -- Fixed GLX initialisation (bug #1039126). - -* Tue Nov 19 2013 Tim Waugh 1.2.80-0.21.20130314svn5065 -- Better fix for PIDFile problem (bug #1031625). - -* Fri Nov 08 2013 Adam Jackson 1.2.80-0.20.20130314svn5065 -- Rebuild against xserver 1.15RC1 - -* Wed Jul 24 2013 Tim Waugh 1.2.80-0.18.20130314svn5065 -- Avoid PIDFile problems in systemd unit file (bug #983232). -- Don't use shebang in vncserver script. - -* Wed Jul 3 2013 Tim Waugh 1.2.80-0.18.20130314svn5065 -- Removed systemd_requires macro in order to fix the build. - -* Wed Jul 3 2013 Tim Waugh 1.2.80-0.17.20130314svn5065 -- Synchronise manpages and --help output (bug #980870). - -* Mon Jun 17 2013 Adam Jackson 1.2.80-0.16.20130314svn5065 -- tigervnc-setcursor-crash.patch: Attempt to paper over a crash in Xvnc when - setting the cursor. - -* Sat Jun 08 2013 Dennis Gilmore 1.2.80-0.15.20130314svn5065 -- bump to rebuild and pick up bugfix causing X to crash on ppc and arm - -* Thu May 23 2013 Tim Waugh 1.2.80-0.14.20130314svn5065 -- Use systemd rpm macros (bug #850340). Moved systemd requirements - from main package to server sub-package. -- Applied Debian patch to fix busy loop when run from inetd in nowait - mode (bug #920373). -- Added dependency on xorg-x11-xinit to server sub-package so that - default window manager can be found (bug #896284, bug #923655). -- Fixed bogus changelog date. - -* Thu Mar 14 2013 Adam Jackson 1.2.80-0.13.20130314svn5065 -- Less RHEL customization - -* Thu Mar 14 2013 Adam Tkac - 1.2.80-0.12.20130314svn5065 -- include /etc/X11/xorg.conf.d/10-libvnc.conf sample configuration (#712482) -- vncserver now honors specified -geometry parameter (#755947) - -* Tue Mar 12 2013 Adam Tkac - 1.2.80-0.11.20130307svn5060 -- update to r5060 -- split icons to separate package to avoid multilib issues - -* Tue Feb 19 2013 Adam Tkac - 1.2.80-0.10.20130219svn5047 -- update to r5047 (X.Org 1.14 support) - -* Fri Feb 15 2013 Fedora Release Engineering - 1.2.80-0.9.20121126svn5015 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild - -* Mon Jan 21 2013 Adam Tkac - 1.2.80-0.8.20121126svn5015 -- rebuild due to "jpeg8-ABI" feature drop - -* Wed Jan 16 2013 Adam Tkac 1.2.80-0.7.20121126svn5015 -- rebuild - -* Tue Dec 04 2012 Adam Tkac 1.2.80-0.6.20121126svn5015 -- rebuild against new fltk - -* Mon Nov 26 2012 Adam Tkac 1.2.80-0.5.20121126svn5015 -- update to r5015 -- build with -fpic instead of -fPIC on all archs except s390/sparc - -* Wed Nov 7 2012 Peter Robinson 1.2.80-0.4.20120905svn4996 -- Build with -fPIC to fix FTBFS on ARM - -* Wed Oct 31 2012 Adam Jackson 1.2.80-0.3.20120905svn4996 -- tigervnc12-xorg113-glx.patch: Fix to only init glx on the first server - generation - -* Fri Sep 28 2012 Adam Jackson 1.2.80-0.2.20120905svn4996 -- tigervnc12-xorg113-glx.patch: Re-enable GLX against xserver 1.13 - -* Fri Aug 17 2012 Adam Tkac 1.2.80-0.1.20120905svn4996 -- update to 1.2.80 -- remove deprecated patches - - tigervnc-102434.patch - - tigervnc-viewer-reparent.patch - - tigervnc11-java7.patch -- patches merged - - tigervnc11-xorg111.patch - - tigervnc11-xorg112.patch - -* Fri Aug 10 2012 Dave Airlie 1.1.0-10 -- fix build against newer X server - -* Mon Jul 23 2012 Adam Jackson 1.1.0-9 -- Build with the Composite extension for feature parity with other X servers - -* Sat Jul 21 2012 Fedora Release Engineering - 1.1.0-8 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild - -* Thu Jul 19 2012 Dave Airlie 1.1.0-7 -- fix building against X.org 1.13 - -* Wed Apr 04 2012 Adam Jackson 1.1.0-6 -- RHEL exclusion for -server-module on ppc* too - -* Mon Mar 26 2012 Adam Tkac - 1.1.0-5 -- clean Xvnc's /tmp environment in service file before startup -- fix building against the latest JAVA 7 and X.Org 1.12 - -* Sat Jan 14 2012 Fedora Release Engineering - 1.1.0-4 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild - -* Tue Nov 22 2011 Adam Tkac - 1.1.0-3 -- don't build X.Org devel docs (#755782) -- applet: BR generic java-devel instead of java-gcj-devel (#755783) -- use runuser to start Xvnc in systemd service file (#754259) -- don't attepmt to restart Xvnc session during update/erase (#753216) - -* Fri Nov 11 2011 Adam Tkac - 1.1.0-2 -- libvnc.so: don't use unexported GetMaster function (#744881) -- remove nasm buildreq - -* Mon Sep 12 2011 Adam Tkac - 1.1.0-1 -- update to 1.1.0 -- update the xorg11 patch -- patches merged - - tigervnc11-glx.patch - - tigervnc11-CVE-2011-1775.patch - - 0001-Use-memmove-instead-of-memcpy-in-fbblt.c-when-memory.patch - -* Thu Jul 28 2011 Adam Tkac - 1.0.90-6 -- add systemd service file and remove legacy SysV initscript (#717227) - -* Thu May 12 2011 Adam Tkac - 1.0.90-5 -- make Xvnc buildable against X.Org 1.11 - -* Tue May 10 2011 Adam Tkac - 1.0.90-4 -- viewer can send password without proper validation of X.509 certs - (CVE-2011-1775) - -* Wed Apr 13 2011 Adam Tkac - 1.0.90-3 -- fix wrong usage of memcpy which caused screen artifacts (#652590) -- don't point to inaccessible link in sysconfig/vncservers (#644975) - -* Fri Apr 08 2011 Adam Tkac - 1.0.90-2 -- improve compatibility with vinagre client (#692048) - -* Tue Mar 22 2011 Adam Tkac - 1.0.90-1 -- update to 1.0.90 - -* Wed Feb 09 2011 Fedora Release Engineering - 1.0.90-0.32.20110117svn4237 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild - -* Mon Jan 17 2011 Adam Tkac 1.0.90-0.31.20110117svn4237 -- fix libvnc.so module loading - -* Mon Jan 17 2011 Adam Tkac 1.0.90-0.30.20110117svn4237 -- update to r4237 -- patches merged - - tigervnc11-optionsdialog.patch - - tigervnc11-rh607866.patch - -* Fri Jan 14 2011 Adam Tkac 1.0.90-0.29.20101208svn4225 -- improve patch for keyboard issues - -* Fri Jan 14 2011 Adam Tkac 1.0.90-0.28.20101208svn4225 -- attempt to fix various keyboard-related issues (key repeating etc) - -* Fri Jan 07 2011 Adam Tkac 1.0.90-0.27.20101208svn4225 -- render "Ok" and "Cancel" buttons in the options dialog correctly - -* Wed Dec 15 2010 Jan Görig 1.0.90-0.26.20101208svn4225 -- added vncserver lock file (#662784) - -* Fri Dec 10 2010 Adam Tkac 1.0.90-0.25.20101208svn4225 -- update to r4225 -- patches merged - - tigervnc11-rh611677.patch - - tigervnc11-rh633931.patch - - tigervnc11-xorg1.10.patch -- enable VeNCrypt and PAM support - -* Mon Dec 06 2010 Adam Tkac 1.0.90-0.24.20100813svn4123 -- rebuild against xserver 1.10.X -- 0001-Return-Success-from-generate_modkeymap-when-max_keys.patch merged - -* Wed Sep 29 2010 jkeating - 1.0.90-0.23.20100813svn4123 -- Rebuilt for gcc bug 634757 - -* Tue Sep 21 2010 Adam Tkac 1.0.90-0.22.20100420svn4030 -- drop xorg-x11-fonts-misc dependency (#636170) - -* Tue Sep 21 2010 Adam Tkac 1.0.90-0.21.20100420svn4030 -- improve patch for #633645 (fix tcsh incompatibilities) - -* Thu Sep 16 2010 Adam Tkac 1.0.90-0.20.20100813svn4123 -- press fake modifiers correctly (#633931) -- supress unneeded debug information emitted from initscript (#633645) - -* Wed Aug 25 2010 Adam Tkac 1.0.90-0.19.20100813svn4123 -- separate Xvnc, vncpasswd and vncconfig to -server-minimal subpkg (#626946) -- move license to separate subpkg and Requires it from main subpkgs -- Xvnc: handle situations when no modifiers exist well (#611677) - -* Fri Aug 13 2010 Adam Tkac 1.0.90-0.18.20100813svn4123 -- update to r4123 (#617973) -- add perl requires to -server subpkg (#619791) - -* Thu Jul 22 2010 Adam Tkac 1.0.90-0.17.20100721svn4113 -- update to r4113 -- patches merged - - tigervnc11-rh586406.patch - - tigervnc11-libvnc.patch - - tigervnc11-rh597172.patch - - tigervnc11-rh600070.patch - - tigervnc11-options.patch -- don't own %%{_datadir}/icons directory (#614301) -- minor improvements in the .desktop file (#616340) -- bundled libjpeg configure requires nasm; is executed even if system-wide - libjpeg is used - -* Fri Jul 02 2010 Adam Tkac 1.0.90-0.16.20100420svn4030 -- build against system-wide libjpeg-turbo (#494458) -- build no longer requires nasm - -* Mon Jun 28 2010 Adam Tkac 1.0.90-0.15.20100420svn4030 -- vncserver: accept <+optname> option when specified as the first one - -* Thu Jun 24 2010 Adam Tkac 1.0.90-0.14.20100420svn4030 -- fix memory leak in Xvnc input code (#597172) -- don't crash when receive negative encoding (#600070) -- explicitly disable udev configuration support -- add gettext-autopoint to BR - -* Mon Jun 14 2010 Adam Tkac 1.0.90-0.13.20100420svn4030 -- update URL about SSH tunneling in the sysconfig file (#601996) - -* Fri Jun 11 2010 Adam Tkac 1.0.90-0.12.20100420svn4030 -- use newer gettext -- autopoint now uses git instead of cvs, adjust BuildRequires appropriately - -* Thu May 13 2010 Adam Tkac 1.0.90-0.11.20100420svn4030 -- link libvnc.so "now" to catch "undefined symbol" errors during Xorg startup -- use always XkbConvertCase instead of XConvertCase (#580159, #586406) -- don't link libvnc.so against libXi.la, libdix.la and libxkb.la; use symbols - from Xorg instead - -* Thu May 13 2010 Adam Tkac 1.0.90-0.10.20100420svn4030 -- update to r4030 snapshot -- patches merged to upstream - - tigervnc11-rh522369.patch - - tigervnc11-rh551262.patch - - tigervnc11-r4002.patch - - tigervnc11-r4014.patch - -* Thu Apr 08 2010 Adam Tkac 1.0.90-0.9.20100219svn3993 -- add server-applet subpackage which contains Java vncviewer applet -- fix Java applet; it didn't work when run from web browser -- add xorg-x11-xkb-utils to server Requires - -* Fri Mar 12 2010 Adam Tkac 1.0.90-0.8.20100219svn3993 -- add French translation to vncviewer.desktop (thanks to Alain Portal) - -* Thu Mar 04 2010 Adam Tkac 1.0.90-0.7.20100219svn3993 -- don't crash during pixel format change (#522369, #551262) - -* Mon Mar 01 2010 Adam Tkac 1.0.90-0.6.20100219svn3993 -- add mesa-dri-drivers and xkeyboard-config to -server Requires -- update to r3993 1.0.90 snapshot - - tigervnc11-noexecstack.patch merged - - tigervnc11-xorg18.patch merged - - xserver18.patch is no longer needed - -* Wed Jan 27 2010 Jan Gorig 1.0.90-0.5.20091221svn3929 -- initscript LSB compliance fixes (#523974) - -* Fri Jan 22 2010 Adam Tkac 1.0.90-0.4.20091221svn3929 -- mark stack as non-executable in jpeg ASM code -- add xorg-x11-xauth to Requires -- add support for X.Org 1.8 -- drop shave sources, they are no longer needed - -* Thu Jan 21 2010 Adam Tkac 1.0.90-0.3.20091221svn3929 -- drop tigervnc-xorg25909.patch, it has been merged to X.Org upstream - -* Thu Jan 07 2010 Adam Tkac 1.0.90-0.2.20091221svn3929 -- add patch for upstream X.Org issue #25909 -- add libXdmcp-devel to build requires to build Xvnc with XDMCP support (#552322) - -* Mon Dec 21 2009 Adam Tkac 1.0.90-0.1.20091221svn3929 -- update to 1.0.90 snapshot -- patches merged - - tigervnc10-compat.patch - - tigervnc10-rh510185.patch - - tigervnc10-rh524340.patch - - tigervnc10-rh516274.patch - -* Mon Oct 26 2009 Adam Tkac 1.0.0-3 -- create Xvnc keyboard mapping before first keypress (#516274) - -* Thu Oct 08 2009 Adam Tkac 1.0.0-2 -- update underlying X source to 1.6.4-0.3.fc11 -- remove bogus '-nohttpd' parameter from /etc/sysconfig/vncservers (#525629) -- initscript LSB compliance fixes (#523974) -- improve -LowColorSwitch documentation and handling (#510185) -- honor dotWhenNoCursor option (and it's changes) every time (#524340) - -* Fri Aug 28 2009 Adam Tkac 1.0.0-1 -- update to 1.0.0 -- tigervnc10-rh495457.patch merged to upstream - -* Mon Aug 24 2009 Karsten Hopp 0.0.91-0.17 -- fix ifnarch s390x for server-module - -* Fri Aug 21 2009 Tomas Mraz - 0.0.91-0.16 -- rebuilt with new openssl - -* Tue Aug 04 2009 Adam Tkac 0.0.91-0.15 -- make Xvnc compilable - -* Sun Jul 26 2009 Fedora Release Engineering - 0.0.91-0.14.1 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild - -* Mon Jul 13 2009 Adam Tkac 0.0.91-0.13.1 -- don't write warning when initscript is called with condrestart param (#508367) - -* Tue Jun 23 2009 Adam Tkac 0.0.91-0.13 -- temporary use F11 Xserver base to make Xvnc compilable -- BuildRequires: libXi-devel -- don't ship tigervnc-server-module on s390/s390x - -* Mon Jun 22 2009 Adam Tkac 0.0.91-0.12 -- fix local rendering of cursor (#495457) - -* Thu Jun 18 2009 Adam Tkac 0.0.91-0.11 -- update to 0.0.91 (1.0.0 RC1) -- patches merged - - tigervnc10-rh499401.patch - - tigervnc10-rh497592.patch - - tigervnc10-rh501832.patch -- after discusion in upstream drop tigervnc-bounds.patch -- configure flags cleanup - -* Thu May 21 2009 Adam Tkac 0.0.90-0.10 -- rebuild against 1.6.1.901 X server (#497835) -- disable i18n, vncviewer is not UTF-8 compatible (#501832) - -* Mon May 18 2009 Adam Tkac 0.0.90-0.9 -- fix vncpasswd crash on long passwords (#499401) -- start session dbus daemon correctly (#497592) - -* Mon May 11 2009 Adam Tkac 0.0.90-0.8.1 -- remove merged tigervnc-manminor.patch - -* Tue May 05 2009 Adam Tkac 0.0.90-0.8 -- update to 0.0.90 - -* Thu Apr 30 2009 Adam Tkac 0.0.90-0.7.20090427svn3789 -- server package now requires xorg-x11-fonts-misc (#498184) - -* Mon Apr 27 2009 Adam Tkac 0.0.90-0.6.20090427svn3789 -- update to r3789 - - tigervnc-rh494801.patch merged -- tigervnc-newfbsize.patch is no longer needed -- fix problems when vncviewer and Xvnc run on different endianess (#496653) -- UltraVNC and TightVNC clients work fine again (#496786) - -* Wed Apr 08 2009 Adam Tkac 0.0.90-0.5.20090403svn3751 -- workaround broken fontpath handling in vncserver script (#494801) - -* Fri Apr 03 2009 Adam Tkac 0.0.90-0.4.20090403svn3751 -- update to r3751 -- patches merged - - tigervnc-xclients.patch - - tigervnc-clipboard.patch - - tigervnc-rh212985.patch -- basic RandR support in Xvnc (resize of the desktop) -- use built-in libjpeg (SSE2/MMX accelerated encoding on x86 platform) -- use Tight encoding by default -- use TigerVNC icons - -* Tue Mar 03 2009 Adam Tkac 0.0.90-0.3.20090303svn3631 -- update to r3631 - -* Tue Mar 03 2009 Adam Tkac 0.0.90-0.2.20090302svn3621 -- package review related fixes - -* Mon Mar 02 2009 Adam Tkac 0.0.90-0.1.20090302svn3621 -- initial package, r3621 From 8e4efda0b55fd72d66c0158a792b248e3d899d2b Mon Sep 17 00:00:00 2001 From: Dmitry Maksyoma Date: Tue, 5 Aug 2025 14:40:39 +1200 Subject: [PATCH 135/150] VNC-239 Remove unused files in contrib/systemd --- contrib/systemd/user/vncserver@.service | 26 ------------------------- 1 file changed, 26 deletions(-) delete mode 100644 contrib/systemd/user/vncserver@.service diff --git a/contrib/systemd/user/vncserver@.service b/contrib/systemd/user/vncserver@.service deleted file mode 100644 index 7797504..0000000 --- a/contrib/systemd/user/vncserver@.service +++ /dev/null @@ -1,26 +0,0 @@ -# -# /usr/lib/systemd/user/vncserver@.service -# -# 1. Switches for vncserver should be entered in ~/.vnc/config rather than -# hard-coded into this unit file. See the vncserver(1) manpage. -# -# 2. Users wishing for the server to continue running after the owner logs -# out MUST enable 'linger' with loginctl like this: -# `loginctl enable-linger username` -# -# 3. The server can be enabled and started like this once configured: -# `systemctl --user start vncserver@:.service` -# `systemctl --user enable vncserver@:.service` - -[Unit] -Description=Remote desktop service (VNC) -After=syslog.target network.target - -[Service] -Type=forking -ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :' -ExecStart=/usr/bin/vncserver %i -ExecStop=/usr/bin/vncserver -kill %i - -[Install] -WantedBy=default.target From 65e9f0c156c47116785171a930aac30429aa8d15 Mon Sep 17 00:00:00 2001 From: Dmitry Maksyoma Date: Tue, 5 Aug 2025 15:09:15 +1200 Subject: [PATCH 136/150] VNC-239 Remove unused temporary files --- t | 9 --------- t2 | 11 ----------- 2 files changed, 20 deletions(-) delete mode 100644 t delete mode 100644 t2 diff --git a/t b/t deleted file mode 100644 index 9b0d895..0000000 --- a/t +++ /dev/null @@ -1,9 +0,0 @@ -use DateTime::TimeZone; - -my $timezone = $ARGV[0]; - -if (DateTime::TimeZone->is_valid_name($timezone)) { - print "Valid timezone\n"; -} else { - print "Invalid timezone\n"; -} diff --git a/t2 b/t2 deleted file mode 100644 index c224895..0000000 --- a/t2 +++ /dev/null @@ -1,11 +0,0 @@ -use DateTime; -use DateTime::TimeZone; - -#my $timezone_name = 'America/New_York'; -my $timezone_name = 'UTC'; - -my $dt = DateTime->now(time_zone => $timezone_name); -my $offset = $dt->offset(); - -print "Timezone: $timezone_name\n"; -print "Offset: $offset seconds\n"; From d1ab547922b6aa90a343c5348b49ed879b38837a Mon Sep 17 00:00:00 2001 From: Dmitry Maksyoma Date: Tue, 5 Aug 2025 15:17:05 +1200 Subject: [PATCH 137/150] VNC-239 Remove unused Debian Buster files --- ...ockerfile.debian_buster.barebones.deb.test | 19 ------- builder/dockerfile.debian_buster.build | 27 --------- builder/dockerfile.debian_buster.deb.build | 19 ------- builder/dockerfile.debian_buster.deb.test | 56 ------------------- 4 files changed, 121 deletions(-) delete mode 100644 builder/dockerfile.debian_buster.barebones.deb.test delete mode 100644 builder/dockerfile.debian_buster.build delete mode 100644 builder/dockerfile.debian_buster.deb.build delete mode 100644 builder/dockerfile.debian_buster.deb.test diff --git a/builder/dockerfile.debian_buster.barebones.deb.test b/builder/dockerfile.debian_buster.barebones.deb.test deleted file mode 100644 index 516bbca..0000000 --- a/builder/dockerfile.debian_buster.barebones.deb.test +++ /dev/null @@ -1,19 +0,0 @@ -FROM debian:buster-slim - -ENV STARTUPDIR=/dockerstartup - -COPY ./builder/scripts/ /tmp/scripts/ -COPY ./debian/changelog /tmp - -ARG KASMVNC_PACKAGE_DIR -COPY $KASMVNC_PACKAGE_DIR/kasmvncserver_*.deb /tmp/ -RUN /tmp/scripts/install_kasmvncserver_package -RUN apt-get update && apt-get -y install xterm - -RUN mkdir -p $STARTUPDIR -COPY builder/startup/vnc_startup_barebones.sh $STARTUPDIR - -RUN useradd -m foo -USER foo:ssl-cert - -ENTRYPOINT "/$STARTUPDIR/vnc_startup_barebones.sh" diff --git a/builder/dockerfile.debian_buster.build b/builder/dockerfile.debian_buster.build deleted file mode 100644 index 9b0bed5..0000000 --- a/builder/dockerfile.debian_buster.build +++ /dev/null @@ -1,27 +0,0 @@ -FROM debian:buster - -ENV KASMVNC_BUILD_OS debian -ENV KASMVNC_BUILD_OS_CODENAME buster -ENV XORG_VER 1.20.10 -ENV DEBIAN_FRONTEND noninteractive - -RUN grep '^deb' /etc/apt/sources.list | sed 's#^deb#deb-src#' >> /etc/apt/sources.list - -RUN apt-get update && \ - apt-get -y install sudo - -RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends tzdata -RUN apt-get update && apt-get -y build-dep xorg-server libxfont-dev -RUN apt-get update && apt-get -y install ninja-build cmake nasm git libgnutls28-dev vim wget tightvncserver curl -RUN apt-get update && apt-get -y install libpng-dev libtiff-dev libgif-dev libavcodec-dev libssl-dev libxrandr-dev libxcursor-dev - -ENV SCRIPTS_DIR=/tmp/scripts -COPY builder/scripts $SCRIPTS_DIR -RUN $SCRIPTS_DIR/build-deps.sh - -RUN useradd -m docker && echo "docker:docker" | chpasswd && adduser docker sudo - -COPY --chown=docker:docker . /src/ - -USER docker -ENTRYPOINT ["/src/builder/build.sh"] diff --git a/builder/dockerfile.debian_buster.deb.build b/builder/dockerfile.debian_buster.deb.build deleted file mode 100644 index eb3a6bf..0000000 --- a/builder/dockerfile.debian_buster.deb.build +++ /dev/null @@ -1,19 +0,0 @@ -FROM debian:buster - -ENV DEBIAN_FRONTEND noninteractive - -RUN apt-get update && \ - apt-get -y install vim build-essential devscripts equivs - -# Install build-deps for the package. -COPY ./debian/control /tmp -RUN apt-get update && echo YYY | mk-build-deps --install --remove /tmp/control - -ARG L_UID -RUN if [ "$L_UID" -eq 0 ]; then \ - useradd -m docker; \ - else \ - useradd -m docker -u $L_UID;\ - fi - -USER docker diff --git a/builder/dockerfile.debian_buster.deb.test b/builder/dockerfile.debian_buster.deb.test deleted file mode 100644 index 416e9fc..0000000 --- a/builder/dockerfile.debian_buster.deb.test +++ /dev/null @@ -1,56 +0,0 @@ -FROM debian:buster-slim - -ENV DISPLAY=:1 \ - VNC_PORT=8443 \ - VNC_RESOLUTION=1280x720 \ - MAX_FRAME_RATE=24 \ - VNCOPTIONS="-PreferBandwidth -DynamicQualityMin=4 -DynamicQualityMax=7" \ - HOME=/home/user \ - TERM=xterm \ - STARTUPDIR=/dockerstartup \ - INST_SCRIPTS=/dockerstartup/install \ - KASM_RX_HOME=/dockerstartup/kasmrx \ - DEBIAN_FRONTEND=noninteractive \ - VNC_COL_DEPTH=24 \ - VNC_RESOLUTION=1280x1024 \ - VNC_PW=vncpassword \ - VNC_USER=user \ - VNC_VIEW_ONLY_PW=vncviewonlypassword \ - LD_LIBRARY_PATH=/usr/local/lib/ \ - OMP_WAIT_POLICY=PASSIVE \ - SHELL=/bin/bash \ - SINGLE_APPLICATION=0 \ - KASMVNC_BUILD_OS=debian \ - KASMVNC_BUILD_OS_CODENAME=buster - -EXPOSE $VNC_PORT - -WORKDIR $HOME - -### REQUIRED STUFF ### - -RUN apt-get update && apt-get install -y supervisor xfce4 xfce4-terminal xterm libnss-wrapper gettext wget -RUN apt-get purge -y pm-utils xscreensaver* -RUN apt-get update && apt-get install -y vim less -RUN apt-get update && apt-get -y install lsb-release - -RUN echo 'source $STARTUPDIR/generate_container_user' >> $HOME/.bashrc - -RUN mkdir -p $STARTUPDIR -COPY builder/startup/ $STARTUPDIR - -### START CUSTOM STUFF #### -COPY ./builder/scripts/ /tmp/scripts/ -COPY ./debian/changelog /tmp - -ARG KASMVNC_PACKAGE_DIR -COPY $KASMVNC_PACKAGE_DIR/kasmvncserver_*.deb /tmp/ -RUN /tmp/scripts/install_kasmvncserver_package - -### END CUSTOM STUFF ### - -RUN chown -R 1000:0 $HOME -USER 1000:ssl-cert -WORKDIR $HOME - -ENTRYPOINT [ "/dockerstartup/vnc_startup.sh" ] From 20aaaedb67afbf0c129f4e28caff03aad547271c Mon Sep 17 00:00:00 2001 From: Dmitry Maksyoma Date: Tue, 5 Aug 2025 15:20:46 +1200 Subject: [PATCH 138/150] VNC-239 Remove unused Fedora 39 files --- builder/dockerfile.fedora_thirtynine.build | 88 ------------------- .../dockerfile.fedora_thirtynine.rpm.build | 13 --- 2 files changed, 101 deletions(-) delete mode 100644 builder/dockerfile.fedora_thirtynine.build delete mode 100644 builder/dockerfile.fedora_thirtynine.rpm.build diff --git a/builder/dockerfile.fedora_thirtynine.build b/builder/dockerfile.fedora_thirtynine.build deleted file mode 100644 index aeaaf88..0000000 --- a/builder/dockerfile.fedora_thirtynine.build +++ /dev/null @@ -1,88 +0,0 @@ -FROM fedora:39 - -ENV KASMVNC_BUILD_OS fedora -ENV KASMVNC_BUILD_OS_CODENAME thirtynine -ENV XORG_VER 1.20.14 - -RUN \ - echo "**** install build deps ****" && \ - dnf group install -y \ - "C Development Tools and Libraries" \ - "Development Tools" && \ - dnf install -y \ - autoconf \ - automake \ - bison \ - byacc \ - bzip2 \ - cmake \ - nasm \ - diffutils \ - doxygen \ - file \ - flex \ - fop \ - gcc \ - gcc-c++ \ - git \ - glibc-devel \ - libdrm-devel \ - libepoxy-devel \ - libmd-devel \ - libpciaccess-devel \ - libtool \ - libwebp-devel \ - libX11-devel \ - libXau-devel \ - libxcb-devel \ - libXcursor-devel \ - libxcvt-devel \ - libXdmcp-devel \ - libXext-devel \ - libXfont2-devel \ - libxkbfile-devel \ - libXrandr-devel \ - libxshmfence-devel \ - libXtst-devel \ - mesa-libEGL-devel \ - mesa-libgbm-devel \ - mesa-libGL-devel \ - meson \ - mingw64-binutils \ - mt-st \ - nettle-devel \ - openssl-devel \ - patch \ - pixman-devel \ - wayland-devel \ - wget \ - which \ - xcb-util-devel \ - xcb-util-image-devel \ - xcb-util-keysyms-devel \ - xcb-util-renderutil-devel \ - xcb-util-wm-devel \ - xinit \ - xkbcomp \ - xkbcomp-devel \ - xkeyboard-config \ - xmlto \ - xorg-x11-font-utils \ - xorg-x11-proto-devel \ - xorg-x11-server-common \ - xorg-x11-server-devel \ - xorg-x11-xtrans-devel \ - xsltproc \ - libavformat-free-devel \ - libswscale-free-devel - -ENV SCRIPTS_DIR=/tmp/scripts -COPY builder/scripts $SCRIPTS_DIR -RUN $SCRIPTS_DIR/build-deps.sh - -RUN useradd -m docker && echo "docker:docker" | chpasswd - -COPY --chown=docker:docker . /src/ - -USER docker -ENTRYPOINT ["/src/builder/build.sh"] diff --git a/builder/dockerfile.fedora_thirtynine.rpm.build b/builder/dockerfile.fedora_thirtynine.rpm.build deleted file mode 100644 index 0a1bfc4..0000000 --- a/builder/dockerfile.fedora_thirtynine.rpm.build +++ /dev/null @@ -1,13 +0,0 @@ -FROM fedora:39 - -RUN dnf install -y fedora-packager fedora-review -RUN dnf install -y tree vim less -RUN dnf install -y redhat-lsb-core -RUN dnf install -y dnf-plugins-core - -COPY fedora/*.spec /tmp -RUN dnf builddep -y /tmp/*.spec - -RUN useradd -m docker && echo "docker:docker" | chpasswd - -USER docker From 474cc92dacc755dc20efaf68bef8d0a2ad2e27ad Mon Sep 17 00:00:00 2001 From: Dmitry Maksyoma Date: Wed, 6 Aug 2025 15:20:03 +1200 Subject: [PATCH 139/150] VNC-239 Remove unused Java applet page --- win/winvnc/index.vnc | 22 ---------------------- 1 file changed, 22 deletions(-) delete mode 100644 win/winvnc/index.vnc diff --git a/win/winvnc/index.vnc b/win/winvnc/index.vnc deleted file mode 100644 index 560fa2e..0000000 --- a/win/winvnc/index.vnc +++ /dev/null @@ -1,22 +0,0 @@ - - - - -$USER's $DESKTOP desktop - - - - - - -
-TigerVNC site - From 52d76bc40c85ed11cc5dfe083a2e73de3c1919d8 Mon Sep 17 00:00:00 2001 From: Dmitry Maksyoma Date: Wed, 6 Aug 2025 15:39:26 +1200 Subject: [PATCH 140/150] VNC-239 Remove unused build script --- builder/build_and_deploy_kasm.sh | 20 -------------------- 1 file changed, 20 deletions(-) delete mode 100755 builder/build_and_deploy_kasm.sh diff --git a/builder/build_and_deploy_kasm.sh b/builder/build_and_deploy_kasm.sh deleted file mode 100755 index 84234b6..0000000 --- a/builder/build_and_deploy_kasm.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash - -# this script will build kasmvnc and build a new kasm desktop image -# this script assumes you have an instance of kasm already deployed -# it will replace the existing kasm desktop image so the next kasm you launch will use the updated image - -set -e - -if [[ $EUID -ne 0 ]]; then - echo "This script must be run as root" - exit 1 -fi - -docker build -t kasmvncbuilder:latest -f builder/dockerfile.build . -docker run -v /tmp:/build kasmvncbuilder:latest -cp /tmp/kasmvnc*.tar.gz builder/ -cd builder -docker build -t kasmweb/desktop-deluxe:develop -f dockerfile.test . -docker ps -aq --no-trunc -f status=exited | xargs docker rm -docker rmi $(docker images | grep "" | awk "{print $3}") From 5acd17bbfe4dbee5234a9c4b44b3f8bfcd2fe89a Mon Sep 17 00:00:00 2001 From: Dmitry Maksyoma Date: Wed, 6 Aug 2025 15:43:13 +1200 Subject: [PATCH 141/150] VNC-239 Remove unused easy-start script --- builder/startup/deb/kasmvncserver-easy-start | 11 ----------- debian/examples | 1 - 2 files changed, 12 deletions(-) delete mode 100755 builder/startup/deb/kasmvncserver-easy-start delete mode 100644 debian/examples diff --git a/builder/startup/deb/kasmvncserver-easy-start b/builder/startup/deb/kasmvncserver-easy-start deleted file mode 100755 index 538bbd6..0000000 --- a/builder/startup/deb/kasmvncserver-easy-start +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -set -e - -display=:10 -interface=0.0.0.0 - -vncserver $display -depth 24 -geometry 1280x1050 -websocketPort 8443 \ - -cert /etc/ssl/certs/ssl-cert-snakeoil.pem \ - -key /etc/ssl/private/ssl-cert-snakeoil.key -sslOnly -FrameRate=24 \ - -interface $interface -httpd /usr/share/kasmvnc/www diff --git a/debian/examples b/debian/examples deleted file mode 100644 index ff8543d..0000000 --- a/debian/examples +++ /dev/null @@ -1 +0,0 @@ -builder/startup/deb/kasmvncserver-easy-start From 6889ca07f9e3ead79df523c9de4e85c3e63cd3c6 Mon Sep 17 00:00:00 2001 From: Dmitry Maksyoma Date: Fri, 8 Aug 2025 14:30:01 +1200 Subject: [PATCH 142/150] VNC-239 Remove unused Doom demo --- docker/Dockerfile.ubuntu18.doom | 62 ------- docker/README.md | 27 --- docker/src/startup/generate_container_user | 37 ---- docker/src/startup/vnc_startup.sh | 68 -------- docker/src/startup/window_manager_startup.sh | 15 -- docker/src/xfce/xfce4-desktop-single-app.xml | 58 ------- docker/src/xfce/xfce4-desktop.xml | 32 ---- docker/src/xfce/xfce4-keyboard-shortcuts.xml | 172 ------------------- docker/src/xfce/xfce4-panel.xml | 57 ------ docker/src/xfce/xfce4-session.xml | 36 ---- docker/src/xfce/xfwm4.xml | 105 ----------- docker/src/xfce/xsettings.xml | 59 ------- 12 files changed, 728 deletions(-) delete mode 100644 docker/Dockerfile.ubuntu18.doom delete mode 100644 docker/README.md delete mode 100755 docker/src/startup/generate_container_user delete mode 100755 docker/src/startup/vnc_startup.sh delete mode 100755 docker/src/startup/window_manager_startup.sh delete mode 100644 docker/src/xfce/xfce4-desktop-single-app.xml delete mode 100644 docker/src/xfce/xfce4-desktop.xml delete mode 100644 docker/src/xfce/xfce4-keyboard-shortcuts.xml delete mode 100644 docker/src/xfce/xfce4-panel.xml delete mode 100644 docker/src/xfce/xfce4-session.xml delete mode 100644 docker/src/xfce/xfwm4.xml delete mode 100644 docker/src/xfce/xsettings.xml diff --git a/docker/Dockerfile.ubuntu18.doom b/docker/Dockerfile.ubuntu18.doom deleted file mode 100644 index 8e29ef7..0000000 --- a/docker/Dockerfile.ubuntu18.doom +++ /dev/null @@ -1,62 +0,0 @@ -FROM ubuntu:18.04 - -ENV DISPLAY=:1 \ - VNC_PORT=8443 \ - VNC_RESOLUTION=1280x720 \ - MAX_FRAME_RATE=24 \ - VNCOPTIONS="-PreferBandwidth -DynamicQualityMin=4 -DynamicQualityMax=7" \ - HOME=/home/user \ - TERM=xterm \ - STARTUPDIR=/dockerstartup \ - INST_SCRIPTS=/dockerstartup/install \ - KASM_RX_HOME=/dockerstartup/kasmrx \ - DEBIAN_FRONTEND=noninteractive \ - VNC_COL_DEPTH=24 \ - VNC_RESOLUTION=1280x1024 \ - VNC_PW=vncpassword \ - VNC_USER=user \ - VNC_VIEW_ONLY_PW=vncviewonlypassword \ - LD_LIBRARY_PATH=/usr/local/lib/ \ - OMP_WAIT_POLICY=PASSIVE \ - SHELL=/bin/bash \ - SINGLE_APPLICATION=1 - -EXPOSE $VNC_PORT - -WORKDIR $HOME - -### REQUIRED STUFF ### - -RUN apt-get update && apt-get install -y supervisor xfce4 xfce4-terminal xterm libnss-wrapper gettext libjpeg-dev wget -RUN apt-get purge -y pm-utils xscreensaver* - -RUN mkdir -p $STARTUPDIR -COPY src/startup/ $STARTUPDIR -RUN mkdir -p $HOME/.config/xfce4/xfconf/xfce-perchannel-xml -COPY src/xfce/ $HOME/.config/xfce4/xfconf/xfce-perchannel-xml -# overwite default with single app config -RUN mv $HOME/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-desktop-single-app.xml $HOME/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-desktop.xml -RUN echo 'source $STARTUPDIR/generate_container_user' >> $HOME/.bashrc - -# KasmVNC install -RUN wget -qO- https://github.com/kasmtech/KasmVNC/releases/download/v0.9.1-beta/KasmVNC_0.9.1-beta_Ubuntu_18.04.tar.gz | tar xz --strip 1 -C / - -### START CUSTOM STUFF #### - -# We need the server to use a fixed resulution and have the client scale, which is not the default behavior of KasmVNC -RUN sed -i "s#UI.initSetting('resize', 'remote');#UI.initSetting('resize', 'scale');#" /usr/local/share/kasmvnc/www/app/ui.js - -RUN apt-get install -y chocolate-doom doom-wad-shareware prboom-plus freedoom - -# Use software rendering, comment this out if you have a GPU -#RUN mkdir -p $HOME/.local/share/chocolate-doom && \ -# echo 'force_software_renderer 1' > $HOME/.local/share/chocolate-doom/chocolate-doom.cfg - - -### END CUSTOM STUFF ### - -RUN chown -R 1000:0 $HOME -USER 1000 -WORKDIR $HOME - -ENTRYPOINT [ "/dockerstartup/vnc_startup.sh", "xfce4-terminal", "-e", "/usr/games/chocolate-doom" ] diff --git a/docker/README.md b/docker/README.md deleted file mode 100644 index 22cd204..0000000 --- a/docker/README.md +++ /dev/null @@ -1,27 +0,0 @@ -# Containerized Examples - -These example containers show how to do UI app streaming within Docker containers using KasmVNC. - -## Doom - -What better way to demonstrait containerized app streaming then to stream Doom! The included Dockerfile.ubuntu18.doom file and the source code have everything you need to hit the ground running. - -### Building -```sh -sudo docker build -t kasm/doom -f Dockerfile.ubuntu18.doom . -``` - -### Running -```sh -sudo docker run -it -p 8443:8443 --rm -e "VNC_USER=matt" -e "VNC_PW=password123" kasm/doom:latest -``` - -The environmental variables VNC_USER and VNC_PW set the username and password respectively. The VNC_PW is unset during container startup. - -Now navigate to https://:8443/vnc.html - -![Kasm Technologies](https://kasm-static-content.s3.amazonaws.com/doom-screenshot.jpg "Doom rendered in browser") - -### License - -See the Chocolate Doom project for details on license specifics of Doom. (https://github.com/chocolate-doom/chocolate-doom) diff --git a/docker/src/startup/generate_container_user b/docker/src/startup/generate_container_user deleted file mode 100755 index b259e7c..0000000 --- a/docker/src/startup/generate_container_user +++ /dev/null @@ -1,37 +0,0 @@ -# Set current user in nss_wrapper -USER_ID=$(id -u) -GROUP_ID=$(id -g) -echo "USER_ID: $USER_ID, GROUP_ID: $GROUP_ID" - -# Attempt to set the username to the kasm username -USERNAME=${VNC_USER:-default} -# Make the username posix compliant -USERNAME=$(echo "$USERNAME" | sed -r 's#[^a-zA-Z0-9\._\-]#_#g') -if ! echo "$USERNAME" | grep -qP "^[a-zA-Z0-9_\.][a-zA-Z0-9_\-\.]*"; then - USERNAME="default" -fi -export PS1="$USERNAME:\w\$ " - -if [ x"$USER_ID" != x"0" ]; then - - NSS_WRAPPER_PASSWD=/tmp/passwd - NSS_WRAPPER_GROUP=/etc/group - - cat /etc/passwd > $NSS_WRAPPER_PASSWD - - echo "${USERNAME}:x:${USER_ID}:${GROUP_ID}:Default Application User:${HOME}:/bin/bash" >> $NSS_WRAPPER_PASSWD - - export NSS_WRAPPER_PASSWD - export NSS_WRAPPER_GROUP - - if [ -r /usr/lib/libnss_wrapper.so ]; then - LD_PRELOAD=/usr/lib/libnss_wrapper.so - elif [ -r /usr/lib64/libnss_wrapper.so ]; then - LD_PRELOAD=/usr/lib64/libnss_wrapper.so - else - echo "no libnss_wrapper.so installed!" - exit 1 - fi - echo "nss_wrapper location: $LD_PRELOAD" - export LD_PRELOAD -fi diff --git a/docker/src/startup/vnc_startup.sh b/docker/src/startup/vnc_startup.sh deleted file mode 100755 index 42ff912..0000000 --- a/docker/src/startup/vnc_startup.sh +++ /dev/null @@ -1,68 +0,0 @@ -#!/bin/bash -### every exit != 0 fails the script -set -e - -# should also source $STARTUPDIR/generate_container_user -source $HOME/.bashrc - -## correct forwarding of shutdown signal -cleanup () { - kill -s SIGTERM $! - exit 0 -} -trap cleanup SIGINT SIGTERM - -## resolve_vnc_connection -VNC_IP=$(hostname -i) - -# first entry is control, second is view (if only one is valid for both) -mkdir -p "$HOME/.vnc" -PASSWD_PATH="$HOME/.vnc/passwd" -echo "$VNC_PW" | kasmvncpasswd -f > $HOME/.kasmpasswd -chmod 0600 $HOME/.kasmpasswd -openssl req -x509 -nodes -days 3650 -newkey rsa:2048 -keyout $HOME/.vnc/self.pem -out $HOME/.vnc/self.pem -subj "/C=US/ST=VA/L=None/O=None/OU=DoFu/CN=kasm/emailAddress=none@none.none" - -vncserver :1 -interface 0.0.0.0 -vncserver -kill :1 - -if [[ -f $PASSWD_PATH ]]; then - rm -f $PASSWD_PATH -fi - -#echo "$VNC_PW" | vncpasswd -f > $PASSWD_PATH -#echo "$VNC_VIEW_ONLY_PW" | vncpasswd -f >> $PASSWD_PATH -#chmod 600 $PASSWD_PATH - -unset VNC_VIEW_ONLY_PW -unset VNC_PW - -if [[ $DEBUG == true ]]; then - echo -e "\n------------------ start VNC server ------------------------" - echo "remove old vnc locks to be a reattachable container" -fi -vncserver -kill $DISPLAY &> $HOME/.vnc/vnc_startup.log \ - || rm -rfv /tmp/.X*-lock /tmp/.X11-unix &> $HOME/.vnc/vnc_startup.log \ - || echo "no locks present" - -echo -e "start vncserver with param: VNC_COL_DEPTH=$VNC_COL_DEPTH, VNC_RESOLUTION=$VNC_RESOLUTION\n..." -vncserver $DISPLAY -depth $VNC_COL_DEPTH -geometry $VNC_RESOLUTION -FrameRate=$MAX_FRAME_RATE -websocketPort $VNC_PORT -cert $HOME/.vnc/self.pem -sslOnly -interface 0.0.0.0 $VNCOPTIONS #&> $STARTUPDIR/no_vnc_startup.log - -PID_SUN=$! - -echo -e "start window manager\n..." -$STARTUPDIR/window_manager_startup.sh #&> $STARTUPDIR/window_manager_startup.log - -## log connect options -echo -e "\n\n------------------ VNC environment started ------------------" -echo -e "\nVNCSERVER started on DISPLAY= $DISPLAY \n\t=> connect via VNC viewer with $VNC_IP:$VNC_PORT" -echo -e "\nnoVNC HTML client started:\n\t=> connect via http://$VNC_IP:$NO_VNC_PORT/?password=...\n" -echo "WEB PID: $PID_SUB" - -# tail vncserver logs -tail -f $HOME/.vnc/*$DISPLAY.log & - -eval "$@" - -wait $PID_SUB - -echo "Exiting Kasm container" diff --git a/docker/src/startup/window_manager_startup.sh b/docker/src/startup/window_manager_startup.sh deleted file mode 100755 index d5e1774..0000000 --- a/docker/src/startup/window_manager_startup.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env bash -set -e - -echo -e "\n------------------ Xfce4 window manager startup------------------" - -### disable screen saver and power management -xset -dpms & -xset s noblank & -xset s off & - -if [ "$SINGLE_APPLICATION" -eq "1" ]; then - echo "Configured of Single Application Mode" - sed -i "s/O|SHMC/|/g" $HOME/.config/xfce4/xfconf/xfce-perchannel-xml/xfwm4.xml - #xfwm4 --daemon -fi diff --git a/docker/src/xfce/xfce4-desktop-single-app.xml b/docker/src/xfce/xfce4-desktop-single-app.xml deleted file mode 100644 index 8b30c0e..0000000 --- a/docker/src/xfce/xfce4-desktop-single-app.xml +++ /dev/null @@ -1,58 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/docker/src/xfce/xfce4-desktop.xml b/docker/src/xfce/xfce4-desktop.xml deleted file mode 100644 index b76cbea..0000000 --- a/docker/src/xfce/xfce4-desktop.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/docker/src/xfce/xfce4-keyboard-shortcuts.xml b/docker/src/xfce/xfce4-keyboard-shortcuts.xml deleted file mode 100644 index 4e2cea2..0000000 --- a/docker/src/xfce/xfce4-keyboard-shortcuts.xml +++ /dev/null @@ -1,172 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/docker/src/xfce/xfce4-panel.xml b/docker/src/xfce/xfce4-panel.xml deleted file mode 100644 index df7cdd4..0000000 --- a/docker/src/xfce/xfce4-panel.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/docker/src/xfce/xfce4-session.xml b/docker/src/xfce/xfce4-session.xml deleted file mode 100644 index cc2b30c..0000000 --- a/docker/src/xfce/xfce4-session.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/docker/src/xfce/xfwm4.xml b/docker/src/xfce/xfwm4.xml deleted file mode 100644 index 28e861c..0000000 --- a/docker/src/xfce/xfwm4.xml +++ /dev/null @@ -1,105 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/docker/src/xfce/xsettings.xml b/docker/src/xfce/xsettings.xml deleted file mode 100644 index 3324472..0000000 --- a/docker/src/xfce/xsettings.xml +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From 2f7d2d90be709a506ad352661231452869ec280b Mon Sep 17 00:00:00 2001 From: Dmitry Maksyoma Date: Fri, 15 Aug 2025 15:08:08 +1200 Subject: [PATCH 143/150] Bump functional tests to release/1.0.6 --- .gitlab-ci.yml | 3 +++ kasmvnc-functional-tests | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index abe98b8..fe77053 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -72,6 +72,9 @@ functional_test: artifacts: paths: - kasmvnc-functional-tests/output/ + reports: + junit: + - kasmvnc-functional-tests/report/*.xml build_www: stage: www diff --git a/kasmvnc-functional-tests b/kasmvnc-functional-tests index d7242d7..bcdc4d2 160000 --- a/kasmvnc-functional-tests +++ b/kasmvnc-functional-tests @@ -1 +1 @@ -Subproject commit d7242d738eab59865d4fdab7231f7a3c9c6de640 +Subproject commit bcdc4d2bb680df0abaab70c0cf73b0113a7f2e6c From 46b49ba37e06a00001b6ceadeded1666e8b66b76 Mon Sep 17 00:00:00 2001 From: Dmitry Maksyoma Date: Fri, 15 Aug 2025 15:24:57 +1200 Subject: [PATCH 144/150] VNC-252 CI: Functional tests: set proper content type for report files --- .ci/helpers.sh | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/.ci/helpers.sh b/.ci/helpers.sh index 3d22720..442a8aa 100644 --- a/.ci/helpers.sh +++ b/.ci/helpers.sh @@ -85,7 +85,6 @@ prepare_functional_tests_source_and_cd_into_it() { upload_report_to_s3() { s3_tests_directory="kasmvnc/${CI_COMMIT_SHA}/tests" upload_directory_to_s3 report "$s3_tests_directory" "$S3_BUCKET" - aws s3 cp report/index.html "s3://${S3_BUCKET}/${s3_tests_directory}/report/index.html" --metadata-directive REPLACE --content-type "text/html" } put_report_into_ci_pipeline() { @@ -106,7 +105,6 @@ prepare_kasmvnc_built_packages_to_replace_workspaces_image_packages() { prepare_to_run_functional_tests() { install_packages_needed_for_functional_tests prepare_functional_tests_source_and_cd_into_it - prepare_s3_uploader prepare_kasmvnc_built_packages_to_replace_workspaces_image_packages heed_debug_variable_and_toggle_debug_in_functional_tests } @@ -122,10 +120,8 @@ heed_debug_variable_and_toggle_debug_in_functional_tests() { } install_packages_needed_for_functional_tests() { - export DEBIAN_FRONTEND=noninteractive - apt-get update && apt-get install -y git tree curl docker.io awscli - apt-get install -y ruby3.1 wget - apt-get install -y python3 python3-pip python3-boto3 curl pkg-config libxmlsec1-dev + prepare_to_run_scripts_and_s3_uploads + apt-get install -y tree docker.io } is_build_this_distro() { @@ -139,21 +135,18 @@ function upload_to_s3() { local s3_bucket="$3"; # Transfer to S3 - python3 amazon-s3-bitbucket-pipelines-python/s3_upload.py "$s3_bucket" "$file_to_upload" "$s3_url_for_file"; + aws s3 cp "$file_to_upload" \ + "s3://${S3_BUCKET}/${s3_url_for_file}" \ + --metadata-directive REPLACE \ + --content-type "$(file --mime-type -b \"$file_to_upload\")" # Use the Gitlab API to tell Gitlab where the artifact was stored export S3_URL="https://${s3_bucket}.s3.amazonaws.com/${s3_url_for_file}"; }; -function prepare_s3_uploader() { - git clone https://bitbucket.org/awslabs/amazon-s3-bitbucket-pipelines-python.git -} - function prepare_to_run_scripts_and_s3_uploads() { export DEBIAN_FRONTEND=noninteractive apt-get update - apt-get install -y ruby3.1 git wget - apt-get install -y python3 python3-pip python3-boto3 curl pkg-config libxmlsec1-dev - prepare_s3_uploader + apt-get install -y ruby3.1 wget curl file awscli } detect_release_branch() { From ca71e145fad992963126e939ec3281b8607d9a05 Mon Sep 17 00:00:00 2001 From: Dmitry Maksyoma Date: Sat, 16 Aug 2025 15:34:15 +1200 Subject: [PATCH 145/150] Bump functional tests to release/1.0.7 --- kasmvnc-functional-tests | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kasmvnc-functional-tests b/kasmvnc-functional-tests index bcdc4d2..ce3f4db 160000 --- a/kasmvnc-functional-tests +++ b/kasmvnc-functional-tests @@ -1 +1 @@ -Subproject commit bcdc4d2bb680df0abaab70c0cf73b0113a7f2e6c +Subproject commit ce3f4db9b96084fcb8b8b75ce62836b72ce59738 From e5999705b4b268812b4f4e79d4c58683d36e028c Mon Sep 17 00:00:00 2001 From: Dmitry Maksyoma Date: Wed, 27 Aug 2025 13:42:16 +1200 Subject: [PATCH 146/150] Bump functional tests to release/1.0.8 --- kasmvnc-functional-tests | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kasmvnc-functional-tests b/kasmvnc-functional-tests index ce3f4db..8af65a3 160000 --- a/kasmvnc-functional-tests +++ b/kasmvnc-functional-tests @@ -1 +1 @@ -Subproject commit ce3f4db9b96084fcb8b8b75ce62836b72ce59738 +Subproject commit 8af65a338e92c055fbdc958404a87d719cf05d8a From 6e3d2072f2f506f9cf15e4a209ef2cf29e606e87 Mon Sep 17 00:00:00 2001 From: Dmitry Maksyoma Date: Wed, 8 Oct 2025 18:41:34 +0000 Subject: [PATCH 147/150] VNC-257 Implement env var config override --- .gitignore | 3 + spec/helper/spec_helper.py | 11 +++ spec/vncserver_env_var_to_cli_spec.py | 133 ++++++++++++++++++++++++++ spec/vncserver_yaml_to_cli_spec.py | 73 +++++--------- unix/KasmVNC/CliOption.pm | 67 +++---------- unix/KasmVNC/Config.pm | 8 ++ unix/KasmVNC/ConfigEnvVars.pm | 119 +++++++++++++++++++++++ unix/KasmVNC/ConfigKey.pm | 12 +-- unix/KasmVNC/ConfigSetting.pm | 57 +++++++++++ unix/KasmVNC/SettingValidation.pm | 33 +++++++ unix/KasmVNC/Utils.pm | 15 ++- unix/kasmvnc_defaults.yaml | 1 + unix/vncserver | 80 +++++++++++++--- 13 files changed, 483 insertions(+), 129 deletions(-) create mode 100644 spec/vncserver_env_var_to_cli_spec.py create mode 100644 unix/KasmVNC/ConfigEnvVars.pm create mode 100644 unix/KasmVNC/ConfigSetting.pm create mode 100644 unix/KasmVNC/SettingValidation.pm diff --git a/.gitignore b/.gitignore index 3f92e8f..026ae1e 100644 --- a/.gitignore +++ b/.gitignore @@ -21,6 +21,9 @@ builder/build/ builder/www/ spec/tmp +Benchmark.xml +SelfBench.xml + # Deb building artefacts debian/.debhelper/ debian/files diff --git a/spec/helper/spec_helper.py b/spec/helper/spec_helper.py index c31692e..d746235 100644 --- a/spec/helper/spec_helper.py +++ b/spec/helper/spec_helper.py @@ -1,4 +1,5 @@ import os +import re import sys import shutil import subprocess @@ -15,6 +16,16 @@ config_filename = os.path.join(config_dir, "config.yaml") if os.getenv('KASMVNC_SPEC_DEBUG_OUTPUT'): debug_output = True +def run_vncserver_to_print_xvnc_cli_options(env=os.environ): + return run_cmd(f'vncserver -dry-run -config {config_filename}', env=env) + +def pick_cli_option(cli_option, xvnc_cmd): + cli_option_regex = re.compile(f'\'?-{cli_option}\'?(?:\s+[^-][^\s]*|$)') + results = cli_option_regex.findall(xvnc_cmd) + if len(results) == 0: + return None + + return ' '.join(results) def write_config(config_text): os.makedirs(config_dir, exist_ok=True) diff --git a/spec/vncserver_env_var_to_cli_spec.py b/spec/vncserver_env_var_to_cli_spec.py new file mode 100644 index 0000000..2a73004 --- /dev/null +++ b/spec/vncserver_env_var_to_cli_spec.py @@ -0,0 +1,133 @@ +import os +from mamba import description, context, fcontext, it, fit, _it, before, after +from expects import expect, equal, contain, match + +from helper.spec_helper import start_xvnc, kill_xvnc, run_cmd, clean_env, \ + add_kasmvnc_user_docker, clean_kasm_users, start_xvnc_pexpect, \ + write_config, config_filename, pick_cli_option, \ + run_vncserver_to_print_xvnc_cli_options + +with description('Env var config override') as self: + with context("env var override is turned off"): + with it("doesn't override, when setting is defined in config"): + write_config(''' + desktop: + allow_resize: true + server: + allow_environment_variables_to_override_config_settings: false + ''') + env = os.environ.copy() + env["KVNC_DESKTOP_ALLOW_RESIZE"] = "false" + + completed_process = run_vncserver_to_print_xvnc_cli_options(env=env) + cli_option = pick_cli_option('AcceptSetDesktopSize', + completed_process.stdout) + expect(cli_option).to(equal("-AcceptSetDesktopSize '1'")) + + with it("doesn't override, when setting is not defined in config"): + write_config(''' + desktop: + allow_resize: true + ''') + env = os.environ.copy() + env["KVNC_DESKTOP_ALLOW_RESIZE"] = "false" + + completed_process = run_vncserver_to_print_xvnc_cli_options(env=env) + cli_option = pick_cli_option('AcceptSetDesktopSize', + completed_process.stdout) + expect(cli_option).to(equal("-AcceptSetDesktopSize '1'")) + + with context("env var override is turned on"): + with it("converts env var to CLI option"): + write_config(''' + desktop: + allow_resize: true + server: + allow_environment_variables_to_override_config_settings: true + ''') + env = os.environ.copy() + env["KVNC_DESKTOP_ALLOW_RESIZE"] = "false" + + completed_process = run_vncserver_to_print_xvnc_cli_options(env=env) + cli_option = pick_cli_option('AcceptSetDesktopSize', + completed_process.stdout) + expect(cli_option).to(equal("-AcceptSetDesktopSize '0'")) + + with it("produces error message if env var has invalid value"): + write_config(''' + desktop: + allow_resize: true + server: + allow_environment_variables_to_override_config_settings: true + ''') + env = os.environ.copy() + env["KVNC_DESKTOP_ALLOW_RESIZE"] = "none" + + completed_process = run_cmd(f'vncserver -dry-run -test-output-topic validation -config {config_filename}', print_stderr=False, env=env) + expect(completed_process.stderr).to(contain("desktop.allow_resize 'none': must be true or false")) + + with it("produces error message and exits if env var name is unsupported"): + write_config(''' + foo: true + desktop: + allow_resize: true + server: + allow_environment_variables_to_override_config_settings: true + ''') + env = os.environ.copy() + env["KVNC_FOO"] = "none" + + completed_process = run_cmd(f'vncserver -test-output-topic validation -config {config_filename}', print_stderr=False, env=env) + expect(completed_process.stderr).to(contain("Unsupported config env vars found:\nKVNC_FOO")) + + with context("config setting server.allow_environment_variables_to_override_config_settings"): + with it("produces error message if config has invalid value"): + write_config(''' + server: + allow_environment_variables_to_override_config_settings: none + ''') + + completed_process = run_cmd(f'vncserver -dry-run -test-output-topic validation -config {config_filename}', print_stderr=False) + expect(completed_process.stderr).to(contain("server.allow_environment_variables_to_override_config_settings 'none': must be true or false")) + + with it("doesn't interpolate env vars into value"): + write_config(''' + server: + allow_environment_variables_to_override_config_settings: ${ALLOW_OVERRIDE} + ''') + + env = os.environ.copy() + env["ALLOW_OVERRIDE"] = "true" + + completed_process = run_cmd(f'vncserver -dry-run -test-output-topic validation -config {config_filename}',\ + print_stderr=False, env=env) + expect(completed_process.stderr).\ + to(contain("server.allow_environment_variables_to_override_config_settings '${ALLOW_OVERRIDE}': must be true or false")) + + with it("doesn't allow to override it with the corresponding env var if set to false"): + write_config(''' + server: + allow_environment_variables_to_override_config_settings: false + ''') + + env = os.environ.copy() + env["KVNC_SERVER_ALLOW_ENVIRONMENT_VARIABLES_TO_OVERRIDE_CONFIG_SETTINGS"] = "${ALLOW_OVERRIDE}" + + completed_process = run_cmd(f'vncserver -dry-run -test-output-topic validation -config {config_filename}',\ + print_stderr=False, env=env) + expect(completed_process.stderr).\ + not_to(contain("server.allow_environment_variables_to_override_config_settings '${ALLOW_OVERRIDE}': must be true or false")) + + with it("doesn't allow to override it with the env var if set to true"): + write_config(''' + server: + allow_environment_variables_to_override_config_settings: true + ''') + + env = os.environ.copy() + env["KVNC_SERVER_ALLOW_ENVIRONMENT_VARIABLES_TO_OVERRIDE_CONFIG_SETTINGS"] = "${ALLOW_OVERRIDE}" + + completed_process = run_cmd(f'vncserver -dry-run -test-output-topic validation -config {config_filename}',\ + print_stderr=False, env=env) + expect(completed_process.stderr).\ + not_to(contain("server.allow_environment_variables_to_override_config_settings '${ALLOW_OVERRIDE}': must be true or false")) diff --git a/spec/vncserver_yaml_to_cli_spec.py b/spec/vncserver_yaml_to_cli_spec.py index 2e8a516..44bf598 100644 --- a/spec/vncserver_yaml_to_cli_spec.py +++ b/spec/vncserver_yaml_to_cli_spec.py @@ -1,48 +1,19 @@ -import os -import re -import shutil -from os.path import expanduser from mamba import description, context, fcontext, it, fit, _it, before, after from expects import expect, equal, contain, match from helper.spec_helper import start_xvnc, kill_xvnc, run_cmd, clean_env, \ add_kasmvnc_user_docker, clean_kasm_users, start_xvnc_pexpect, \ - write_config, config_filename - -home_dir = expanduser("~") -vnc_dir = f'{home_dir}/.vnc' -user_config = f'{vnc_dir}/kasmvnc.yaml' - - -def run_vncserver(): - return run_cmd(f'vncserver -dry-run -config {config_filename}') - - -def pick_cli_option(cli_option, xvnc_cmd): - cli_option_regex = re.compile(f'\'?-{cli_option}\'?(?:\s+[^-][^\s]*|$)') - results = cli_option_regex.findall(xvnc_cmd) - if len(results) == 0: - return None - - return ' '.join(results) - - -def prepare_env(): - os.makedirs(vnc_dir, exist_ok=True) - shutil.copyfile('spec/kasmvnc.yaml', user_config) - + write_config, config_filename, pick_cli_option, \ + run_vncserver_to_print_xvnc_cli_options with description('YAML to CLI') as self: - with before.all: - prepare_env() - with context("convert a boolean key"): with it("convert true to 1"): write_config(''' desktop: allow_resize: true ''') - completed_process = run_vncserver() + completed_process = run_vncserver_to_print_xvnc_cli_options() cli_option = pick_cli_option('AcceptSetDesktopSize', completed_process.stdout) expect(cli_option).to(equal("-AcceptSetDesktopSize '1'")) @@ -52,7 +23,7 @@ with description('YAML to CLI') as self: desktop: allow_resize: false ''') - completed_process = run_vncserver() + completed_process = run_vncserver_to_print_xvnc_cli_options() cli_option = pick_cli_option('AcceptSetDesktopSize', completed_process.stdout) expect(cli_option).to(equal("-AcceptSetDesktopSize '0'")) @@ -63,7 +34,7 @@ with description('YAML to CLI') as self: brute_force_protection: blacklist_threshold: 2 ''') - completed_process = run_vncserver() + completed_process = run_vncserver_to_print_xvnc_cli_options() cli_option = pick_cli_option('BlacklistThreshold', completed_process.stdout) expect(cli_option).to(equal("-BlacklistThreshold '2'")) @@ -74,7 +45,7 @@ with description('YAML to CLI') as self: ssl: pem_certificate: /etc/ssl/certs/ssl-cert-snakeoil.pem ''') - completed_process = run_vncserver() + completed_process = run_vncserver_to_print_xvnc_cli_options() cli_option = pick_cli_option('cert', completed_process.stdout) expect(cli_option).to( @@ -87,7 +58,7 @@ with description('YAML to CLI') as self: - 0x22->0x40 - 0x24->0x40 ''') - completed_process = run_vncserver() + completed_process = run_vncserver_to_print_xvnc_cli_options() cli_option = pick_cli_option('RemapKeys', completed_process.stdout) expect(cli_option).to( @@ -100,7 +71,7 @@ with description('YAML to CLI') as self: server_to_client: size: 20 ''') - completed_process = run_vncserver() + completed_process = run_vncserver_to_print_xvnc_cli_options() cli_option = pick_cli_option('DLP_ClipSendMax', completed_process.stdout) expect(cli_option).to(equal("-DLP_ClipSendMax '20'")) @@ -111,7 +82,7 @@ with description('YAML to CLI') as self: network: websocket_port: auto ''') - completed_process = run_vncserver() + completed_process = run_vncserver_to_print_xvnc_cli_options() cli_option = pick_cli_option('websocketPort', completed_process.stdout) expect(["-websocketPort '8444'", "-websocketPort '8445'"]). \ @@ -122,7 +93,7 @@ with description('YAML to CLI') as self: network: websocket_port: 8555 ''') - completed_process = run_vncserver() + completed_process = run_vncserver_to_print_xvnc_cli_options() cli_option = pick_cli_option('websocketPort', completed_process.stdout) expect(cli_option).to(equal("-websocketPort '8555'")) @@ -130,7 +101,7 @@ with description('YAML to CLI') as self: with it("no key - no CLI option"): write_config(''' ''') - completed_process = run_vncserver() + completed_process = run_vncserver_to_print_xvnc_cli_options() cli_option = pick_cli_option('websocketPort', completed_process.stdout) expect(cli_option).to(equal(None)) @@ -141,7 +112,7 @@ with description('YAML to CLI') as self: network: protocol: http ''') - completed_process = run_vncserver() + completed_process = run_vncserver_to_print_xvnc_cli_options() cli_option = pick_cli_option('noWebsocket', completed_process.stdout) expect(cli_option).to(equal(None)) @@ -151,7 +122,7 @@ with description('YAML to CLI') as self: network: protocol: vnc ''') - completed_process = run_vncserver() + completed_process = run_vncserver_to_print_xvnc_cli_options() cli_option = pick_cli_option('noWebsocket', completed_process.stdout) expect(cli_option).to(equal("-noWebsocket '1'")) @@ -162,7 +133,7 @@ with description('YAML to CLI') as self: advanced: kasm_password_file: ${HOME}/.kasmpasswd ''') - completed_process = run_vncserver() + completed_process = run_vncserver_to_print_xvnc_cli_options() cli_option = pick_cli_option('KasmPasswordFile', completed_process.stdout) expect(cli_option).to(equal("-KasmPasswordFile '/home/docker/.kasmpasswd'")) @@ -174,7 +145,7 @@ with description('YAML to CLI') as self: log_dest: logfile level: 40 ''') - completed_process = run_vncserver() + completed_process = run_vncserver_to_print_xvnc_cli_options() cli_option = pick_cli_option('Log', completed_process.stdout) expect(cli_option).to(equal("-Log '*:stdout:40'")) @@ -188,7 +159,7 @@ with description('YAML to CLI') as self: right: 40% bottom: 40 ''') - completed_process = run_vncserver() + completed_process = run_vncserver_to_print_xvnc_cli_options() cli_option = pick_cli_option('DLP_Region', completed_process.stdout) expect(cli_option).to(equal("-DLP_Region '10,-10,40%,40'")) @@ -200,7 +171,7 @@ with description('YAML to CLI') as self: advanced: x_font_path: auto ''') - completed_process = run_vncserver() + completed_process = run_vncserver_to_print_xvnc_cli_options() cli_option = pick_cli_option('fp', completed_process.stdout) expect(cli_option).to(match(r'/usr/share/fonts')) @@ -208,7 +179,7 @@ with description('YAML to CLI') as self: with it("none specified"): write_config(''' ''') - completed_process = run_vncserver() + completed_process = run_vncserver_to_print_xvnc_cli_options() cli_option = pick_cli_option('fp', completed_process.stdout) expect(cli_option).to(match(r'/usr/share/fonts')) @@ -219,7 +190,7 @@ with description('YAML to CLI') as self: advanced: x_font_path: /src ''') - completed_process = run_vncserver() + completed_process = run_vncserver_to_print_xvnc_cli_options() cli_option = pick_cli_option('fp', completed_process.stdout) expect(cli_option).to(equal("-fp '/src'")) @@ -239,7 +210,7 @@ with description('YAML to CLI') as self: network: interface: 0.0.0.0 ''') - completed_process = run_vncserver() + completed_process = run_vncserver_to_print_xvnc_cli_options() cli_option = pick_cli_option('interface', completed_process.stdout) expect(cli_option).to(equal("-interface '0.0.0.0'")) @@ -263,7 +234,7 @@ with description('YAML to CLI') as self: width: 1024 height: 768 ''') - completed_process = run_vncserver() + completed_process = run_vncserver_to_print_xvnc_cli_options() cli_option = pick_cli_option('geometry', completed_process.stdout) expect(cli_option).to(equal("-geometry '1024x768'")) @@ -275,7 +246,7 @@ with description('YAML to CLI') as self: text: template: "星街すいせい" ''') - completed_process = run_vncserver() + completed_process = run_vncserver_to_print_xvnc_cli_options() cli_option = pick_cli_option('DLP_WatermarkText', completed_process.stdout) expect(cli_option).to(equal("-DLP_WatermarkText '星街すいせい'")) diff --git a/unix/KasmVNC/CliOption.pm b/unix/KasmVNC/CliOption.pm index ae61bb0..4b48728 100644 --- a/unix/KasmVNC/CliOption.pm +++ b/unix/KasmVNC/CliOption.pm @@ -10,10 +10,13 @@ use Data::Dumper; use KasmVNC::DataClumpValidator; use KasmVNC::Utils; +use KasmVNC::SettingValidation; -our $fetchValueSub; -$KasmVNC::CliOption::dataClumpValidator = KasmVNC::DataClumpValidator->new(); -@KasmVNC::CliOption::isActiveCallbacks = (); +our @ISA = ('KasmVNC::SettingValidation'); + +our $ConfigValue; +our $dataClumpValidator = KasmVNC::DataClumpValidator->new(); +our @isActiveCallbacks = (); sub new { my ($class, $args) = @_; @@ -56,20 +59,20 @@ sub activate { sub beforeIsActive { my $callback = shift; - push @KasmVNC::CliOption::isActiveCallbacks, $callback; + push @isActiveCallbacks, $callback; } sub isActiveByCallbacks { my $self = shift; - all { $_->($self) } @KasmVNC::CliOption::isActiveCallbacks; + all { $_->($self) } @isActiveCallbacks; } sub makeKeysWithValuesAccessible { my $self = shift; foreach my $name (@{ $self->configKeyNames() }) { - my $value = $self->fetchValue($name); + my $value = $ConfigValue->($name); $self->{$name} = $value if defined($value); } } @@ -100,39 +103,11 @@ sub deriveValue { my $self = shift; my $value = $self->{deriveValueSub}->($self); - $self->interpolateEnvVars($value); -} - -sub interpolateEnvVars { - my $self = shift; - my $value = shift; - - return $value unless defined($value); - - while ($value =~ /\$\{(\w+)\}/) { - my $envValue = $ENV{$1}; - $value =~ s/\Q$&\E/$envValue/; - } - - $value; -} - -sub errorMessages { - my $self = shift; - - join "\n", @{ $self->{errors} }; + interpolateEnvVars($value); } # private -sub isValid { - my $self = shift; - - $self->validate() unless $self->{validated}; - - $self->isNoErrorsPresent(); -} - sub validate { my $self = shift; @@ -142,22 +117,16 @@ sub validate { $self->{validated} = 1; } -sub isNoErrorsPresent { - my $self = shift; - - scalar @{ $self->{errors} } == 0; -} - sub validateDataClump { my $self = shift; - $KasmVNC::CliOption::dataClumpValidator->validate($self); + $dataClumpValidator->validate($self); } sub configValues { my $self = shift; - map { $self->fetchValue($_->{name}) } @{ $self->{configKeys} }; + map { $ConfigValue->($_->{name}) } @{ $self->{configKeys} }; } sub configValue { @@ -183,22 +152,10 @@ sub hasKey { first { $_ eq $configKey } @{ $self->configKeyNames() }; } -sub addErrorMessage { - my ($self, $errorMessage) = @_; - - push @{ $self->{errors} }, $errorMessage; -} - sub validateConfigValues { my $self = shift; map { $_->validate($self) } @{ $self->{configKeys} }; } -sub fetchValue { - my $self = shift; - - &$fetchValueSub(shift); -} - 1; diff --git a/unix/KasmVNC/Config.pm b/unix/KasmVNC/Config.pm index 78d49d3..96e5a63 100644 --- a/unix/KasmVNC/Config.pm +++ b/unix/KasmVNC/Config.pm @@ -53,6 +53,14 @@ sub get { $value; } +sub set { + my ($self, $absoluteKey, $value) = @_; + my $path = absoluteKeyToHashPath($absoluteKey); + my $config = $self->{data}; + + eval "\$config$path = \$value"; +} + sub exists { my ($self, $absoluteKey) = @_; my $path = absoluteKeyToHashPath($absoluteKey); diff --git a/unix/KasmVNC/ConfigEnvVars.pm b/unix/KasmVNC/ConfigEnvVars.pm new file mode 100644 index 0000000..cc9abb0 --- /dev/null +++ b/unix/KasmVNC/ConfigEnvVars.pm @@ -0,0 +1,119 @@ +package KasmVNC::ConfigEnvVars; + +use strict; +use warnings; +use v5.10; +use Data::Dumper; + +use Exporter; + +@KasmVNC::ConfigEnvVars::ISA = qw(Exporter); + +our @EXPORT = ( + 'OverrideConfigWithConfigEnvVars', + 'CheckForUnsupportedConfigEnvVars' +); + +use constant ENV_VAR_OVERRIDE_SETTING => "server.allow_environment_variables_to_override_config_settings"; + +our @configKeyOverrideDenylist = ( + ENV_VAR_OVERRIDE_SETTING +); + +our $logger; +our %prefixedEnvVars; +our %envVarAllowlist; + +our $ConfigValue; +our $SetConfigValue; +our $ShouldPrintTopic; +our $SupportedAbsoluteKeys; + +sub IsAllowEnvVarOverride { + my $allowOverride = $ConfigValue->(ENV_VAR_OVERRIDE_SETTING) // "false"; + $allowOverride eq "true"; +} + +sub OverrideConfigWithConfigEnvVars { + return unless IsAllowEnvVarOverride(); + + %prefixedEnvVars = FetchPrefixedEnvVarsFromEnvironment(); + PrepareEnvVarAllowlist(); + + for my $envVarName (sort keys %prefixedEnvVars) { + my $configKey = $envVarAllowlist{$envVarName}; + next unless defined($configKey); + + my $envVarValue = GetEnvVarValue($envVarName); + $logger->debug("Overriding $configKey with $envVarName=$envVarValue"); + $SetConfigValue->($configKey, $envVarValue); + } +} + +sub GetEnvVarValue { + my $envVarName = shift; + + $prefixedEnvVars{$envVarName}; +} + +sub PrepareEnvVarAllowlist { + %envVarAllowlist = (); + my %configKeyOverrideAllowlist = %{ ConfigKeyOverrideAllowlist() }; + + for my $configKey (keys %configKeyOverrideAllowlist) { + my $allowedEnvVarName = ConvertConfigKeyToEnvVarName($configKey); + $envVarAllowlist{$allowedEnvVarName} = $configKey; + } +} + +sub ConfigKeyOverrideAllowlist { + my %configKeyOverrideAllowlist = %{ $SupportedAbsoluteKeys->() }; + delete @configKeyOverrideAllowlist{@configKeyOverrideDenylist}; + + \%configKeyOverrideAllowlist; +} + +sub FetchPrefixedEnvVarsFromEnvironment { + my %prefixedEnvVars = map { $_ => $ENV{$_} } grep { /^KVNC_/ } keys %ENV; + PrintPrefixedEnvVars(); + + %prefixedEnvVars; +} + +sub ConvertConfigKeyToEnvVarName { + my $configKey = shift; + my $envVarName = $configKey; + + $envVarName =~ s/\./_/g; + $envVarName = "KVNC_$envVarName"; + $envVarName = uc $envVarName; + $logger->debug("$configKey -> $envVarName"); + + $envVarName; +} + +sub PrintPrefixedEnvVars { + $logger->debug("Found KVNC_ env vars:"); + for my $envVarName (sort keys %prefixedEnvVars) { + $logger->debug("$envVarName=$prefixedEnvVars{$envVarName}"); + } +} + +sub CheckForUnsupportedConfigEnvVars { + return unless IsAllowEnvVarOverride(); + + my @unsupportedEnvVars = + grep(!defined($envVarAllowlist{$_}), keys %prefixedEnvVars); + + return if (scalar @unsupportedEnvVars == 0); + + if ($ShouldPrintTopic->("validation")) { + $logger->warn("Unsupported config env vars found:"); + $logger->warn(join("\n", @unsupportedEnvVars)); + $logger->warn(); + } + + exit 1; +} + +1; diff --git a/unix/KasmVNC/ConfigKey.pm b/unix/KasmVNC/ConfigKey.pm index b8ff425..a926b6f 100644 --- a/unix/KasmVNC/ConfigKey.pm +++ b/unix/KasmVNC/ConfigKey.pm @@ -8,7 +8,7 @@ use Data::Dumper; use KasmVNC::Utils; -our $fetchValueSub; +our $ConfigValue; use constant { INT => 0, @@ -86,18 +86,12 @@ sub isValueBlank { !defined($value) || $value eq ""; } -sub fetchValue { - my $self = shift; - - &$fetchValueSub(shift); -} - sub constructErrorMessage { my $self = shift; my $staticErrorMessage = shift; my $name = $self->{name}; - my $value = join ", ", @{ listify($self->fetchValue($name)) }; + my $value = join ", ", @{ listify($ConfigValue->($name)) }; "$name '$value': $staticErrorMessage"; } @@ -117,7 +111,7 @@ sub isValidBoolean { sub value { my $self = shift; - $self->fetchValue($self->{name}); + $ConfigValue->($self->{name}); } our @EXPORT_OK = ('INT', 'STRING', 'BOOLEAN'); diff --git a/unix/KasmVNC/ConfigSetting.pm b/unix/KasmVNC/ConfigSetting.pm new file mode 100644 index 0000000..d0d1166 --- /dev/null +++ b/unix/KasmVNC/ConfigSetting.pm @@ -0,0 +1,57 @@ +package KasmVNC::ConfigSetting; + +use strict; +use warnings; +use v5.10; + +use KasmVNC::SettingValidation; + +our @ISA = ('KasmVNC::SettingValidation'); + +our $ConfigValue; + +sub new { + my ($class, $args) = @_; + my $self = bless { + configKey => $args->{configKey}, + errors => [] + }, $class; +} + +sub toValue { + my $self = shift; + + $self->deriveValue(); +} + +sub deriveValue { + my $self = shift; + + my $configKeyName = $self->{configKey}->{name}; + my $value = $ConfigValue->($configKeyName); + interpolateEnvVars($value); +} + +sub configKeyNames { + my $self = shift; + + [$self->{configKey}->{name}]; +} + +# private + +sub validate { + my $self = shift; + + $self->validateConfigValue(); + + $self->{validated} = 1; +} + +sub validateConfigValue { + my $self = shift; + + $self->{configKey}->validate($self); +} + +1; diff --git a/unix/KasmVNC/SettingValidation.pm b/unix/KasmVNC/SettingValidation.pm new file mode 100644 index 0000000..831a1c9 --- /dev/null +++ b/unix/KasmVNC/SettingValidation.pm @@ -0,0 +1,33 @@ +package KasmVNC::SettingValidation; + +use strict; +use warnings; +use v5.10; + +sub isValid { + my $self = shift; + + $self->validate() unless $self->{validated}; + + $self->isNoErrorsPresent(); +} + +sub errorMessages { + my $self = shift; + + join "\n", @{ $self->{errors} }; +} + +sub isNoErrorsPresent { + my $self = shift; + + scalar @{ $self->{errors} } == 0; +} + +sub addErrorMessage { + my ($self, $errorMessage) = @_; + + push @{ $self->{errors} }, $errorMessage; +} + +1; diff --git a/unix/KasmVNC/Utils.pm b/unix/KasmVNC/Utils.pm index a280150..5ca885b 100644 --- a/unix/KasmVNC/Utils.pm +++ b/unix/KasmVNC/Utils.pm @@ -11,7 +11,7 @@ use Exporter; @KasmVNC::Utils::ISA = qw(Exporter); our @EXPORT = ('listify', 'flatten', 'isBlank', 'isPresent', 'deriveBoolean', - 'printStackTrace'); + 'printStackTrace', 'interpolateEnvVars'); sub listify { # Implementation based on Hyper::Functions @@ -73,4 +73,17 @@ sub containsWideSymbols { $string =~ /[^\x00-\xFF]/; } +sub interpolateEnvVars { + my $value = shift; + + return $value unless defined($value); + + while ($value =~ /\$\{(\w+)\}/) { + my $envValue = $ENV{$1}; + $value =~ s/\Q$&\E/$envValue/; + } + + $value; +} + 1; diff --git a/unix/kasmvnc_defaults.yaml b/unix/kasmvnc_defaults.yaml index 0ed63ce..13aecf1 100644 --- a/unix/kasmvnc_defaults.yaml +++ b/unix/kasmvnc_defaults.yaml @@ -153,6 +153,7 @@ server: no_user_session_timeout: never active_user_session_timeout: never inactive_user_session_timeout: never + allow_environment_variables_to_override_config_settings: false command_line: prompt: true diff --git a/unix/vncserver b/unix/vncserver index 7a9588f..09543e2 100755 --- a/unix/vncserver +++ b/unix/vncserver @@ -43,6 +43,7 @@ use DateTime; use DateTime::TimeZone; use KasmVNC::CliOption; +use KasmVNC::ConfigSetting; use KasmVNC::ConfigKey; use KasmVNC::PatternValidator; use KasmVNC::EnumValidator; @@ -54,6 +55,8 @@ use KasmVNC::TextUI; use KasmVNC::Utils; use KasmVNC::Logger; +use KasmVNC::ConfigEnvVars; + use constant { NO_ARG_VALUE => 0, REQUIRED_ARG_VALUE => 1, @@ -71,9 +74,18 @@ ParseAndProcessCliOptions(); PrepareLoggingAndXvncKillingFramework(); CreateUserConfigIfNeeded(); -DefineConfigToCLIConversion(); + +DefinePossibleConfigSettings(); + LoadConfigs(); +OverrideConfigWithConfigEnvVars(); +InterpolateEnvVarsIntoConfigValues(); +ValidateConfigValues(); +CheckForUnsupportedConfigEnvVars(); +CheckForUnsupportedConfigKeys(); + ActivateConfigToCLIConversion(); + SetAppSettingsFromConfigAndCli(); DisableLegacyVncAuth(); AllowXProgramsToConnectToXvnc(); @@ -1178,6 +1190,11 @@ sub DefineFilePathsAndStuff { $KasmVNC::Users::vncPasswdBin = $exedir . "kasmvncpasswd"; $KasmVNC::Users::logger = $logger; $KasmVNC::Config::logger = $logger; + $KasmVNC::ConfigEnvVars::logger = $logger; + $KasmVNC::ConfigEnvVars::SupportedAbsoluteKeys = \&SupportedAbsoluteKeys; + $KasmVNC::ConfigEnvVars::ConfigValue = \&ConfigValue; + $KasmVNC::ConfigEnvVars::SetConfigValue = \&SetConfigValue; + $KasmVNC::ConfigEnvVars::ShouldPrintTopic = \&ShouldPrintTopic; $vncSystemConfigDir = "/etc/kasmvnc"; if ($ENV{KASMVNC_DEVELOPMENT}) { @@ -1227,8 +1244,9 @@ sub limitVncModeOptions { } sub DefineConfigToCLIConversion { - $KasmVNC::CliOption::fetchValueSub = \&ConfigValue; - $KasmVNC::ConfigKey::fetchValueSub = \&ConfigValue; + $KasmVNC::CliOption::ConfigValue = \&ConfigValue; + $KasmVNC::ConfigSetting::ConfigValue = \&ConfigValue; + $KasmVNC::ConfigKey::ConfigValue = \&ConfigValue; my $regionValidator = KasmVNC::PatternValidator->new({ pattern => qr/^(-)?\d+(%)?$/, @@ -2700,7 +2718,7 @@ sub ShouldPrintTopic { sub SupportedAbsoluteKeys { my @supportedAbsoluteKeys = - map { $_->configKeyNames() } @allCliOptions; + map { $_->configKeyNames() } (@allCliOptions, @configSettings); @supportedAbsoluteKeys = flatten(@supportedAbsoluteKeys); my %result = map { $_ => 1 } @supportedAbsoluteKeys; @@ -2724,7 +2742,6 @@ sub SupportedSectionsFromAbsoluteKey { sub StartXvncOrExit { $cmd = ConstructXvncCmd(); - CheckForUnsupportedConfigKeys(); CheckSslCertReadable(); say $cmd if ($debug || IsDryRun()) && ShouldPrintTopic("xvnc-cmd"); @@ -2877,6 +2894,13 @@ sub ConfigValue { return $configRef->get($absoluteKey); } +sub SetConfigValue { + my ($absoluteKey, $value, $configRef) = @_; + $configRef ||= $mergedConfig; + + $configRef->set($absoluteKey, $value); +} + sub DerivedValue { my $absoluteKey = shift; @@ -2951,7 +2975,6 @@ sub ConstructOptFromConfig{ } sub ConfigToCmd { - ValidateConfig(); %optFromConfig = %{ ConstructOptFromConfig() }; my @cmd = map { $cliArgMap{$_}->toString() } (keys %optFromConfig); @@ -2960,20 +2983,20 @@ sub ConfigToCmd { return $cmdStr; } -sub ValidateConfig { - foreach my $cliOption (@allCliOptions) { - ValidateCliOption($cliOption); +sub ValidateConfigValues { + foreach my $setting (@allCliOptions, @configSettings) { + ValidateSetting($setting); } } -sub ValidateCliOption { - my $cliOption = $_[0]; +sub ValidateSetting { + my $setting = $_[0]; - return if ($cliOption->isValid()); + return if ($setting->isValid()); if (ShouldPrintTopic("validation")) { $logger->warn("config errors:"); - $logger->warn($cliOption->errorMessages()); + $logger->warn($setting->errorMessages()); $logger->warn(); } @@ -3033,3 +3056,34 @@ sub InitLogger { sub UseUtfStdio { use open qw( :std :encoding(UTF-8) ); } + +sub DefinePossibleConfigSettings { + DefineConfigToCLIConversion(); + DefineConfigSettings(); +} + +sub DefineConfigSettings { + @configSettings = ( + KasmVNC::ConfigSetting->new({ + configKey => KasmVNC::ConfigKey->new({ + name => "server.allow_environment_variables_to_override_config_settings", + type => KasmVNC::ConfigKey::BOOLEAN + }) + }), + ); +} + +sub InterpolateEnvVarsIntoConfigValues { + my @interpolationDenylist = ( + "server.allow_environment_variables_to_override_config_settings" + ); + my %supportedAbsoluteKeys = %{ SupportedAbsoluteKeys() }; + + delete @supportedAbsoluteKeys{@interpolationDenylist}; + + for my $absoluteKey (keys %supportedAbsoluteKeys) { + my $value = ConfigValue($absoluteKey); + my $interpolatedValue = interpolateEnvVars($value); + SetConfigValue($absoluteKey, $interpolatedValue); + } +} From b63645a115b9ff916c6fe555a1ec78da1754185b Mon Sep 17 00:00:00 2001 From: El Date: Fri, 10 Oct 2025 21:44:36 +0000 Subject: [PATCH 148/150] VNC-272 Suppress stringop-overflow warnings in build script --- builder/dockerfile.kali_kali-rolling.build | 2 ++ 1 file changed, 2 insertions(+) diff --git a/builder/dockerfile.kali_kali-rolling.build b/builder/dockerfile.kali_kali-rolling.build index cf97c83..7dad223 100644 --- a/builder/dockerfile.kali_kali-rolling.build +++ b/builder/dockerfile.kali_kali-rolling.build @@ -4,6 +4,8 @@ ENV KASMVNC_BUILD_OS kali ENV KASMVNC_BUILD_OS_CODENAME kali-rolling ENV XORG_VER 21.1.14 ENV DEBIAN_FRONTEND noninteractive +ENV CXXFLAGS="-Wno-stringop-overflow" +ENV CFLAGS="-Wno-stringop-overflow" RUN grep '^deb' /etc/apt/sources.list | sed 's#^deb#deb-src#' >> /etc/apt/sources.list From 9914303047f4b7916686957149cd7ac116b0ed36 Mon Sep 17 00:00:00 2001 From: Dani M Date: Mon, 13 Oct 2025 14:02:41 +0000 Subject: [PATCH 149/150] KASM-7182 Update Kasm noVNC ref --- kasmweb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kasmweb b/kasmweb index 699daf8..da6b8f3 160000 --- a/kasmweb +++ b/kasmweb @@ -1 +1 @@ -Subproject commit 699daf8a81d10b9acb6816626333e90277e3ab95 +Subproject commit da6b8f3cfbed05891380f33aa4ca541c99d1f4c6 From f53f450c190482cf508e5db0944f929a7f92429c Mon Sep 17 00:00:00 2001 From: Huan Truong Date: Tue, 21 Oct 2025 12:36:03 +0000 Subject: [PATCH 150/150] Resolve QA-195 "Feature/ retrying jobs" --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index fe77053..b653e0e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -51,6 +51,7 @@ stages: - echo core > /proc/sys/kernel/core_pattern default: + retry: 2 tags: - oci-fixed-amd