diff options
author | Ulrich Sibiller <uli42@gmx.de> | 2021-03-02 22:14:52 +0100 |
---|---|---|
committer | Ulrich Sibiller <uli42@gmx.de> | 2021-06-20 20:12:51 +0200 |
commit | 03502b36edbd2390c8b93edcc6b5f57299977578 (patch) | |
tree | e09e79b8b4636b08bb6ad1c17ee03baf23670fb3 /nx-X11/programs | |
parent | 5c205f57a76e99063f29dbe20e58019d6b39fb7e (diff) | |
download | nx-libs-03502b36edbd2390c8b93edcc6b5f57299977578.tar.gz nx-libs-03502b36edbd2390c8b93edcc6b5f57299977578.tar.bz2 nx-libs-03502b36edbd2390c8b93edcc6b5f57299977578.zip |
Clipboard.c: print clipboard content only on explicit request
This helps making people aware that their debug logs might contain
sensible information.
Diffstat (limited to 'nx-X11/programs')
-rw-r--r-- | nx-X11/programs/Xserver/hw/nxagent/Clipboard.c | 46 |
1 files changed, 36 insertions, 10 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c index 4bdd32e8f..27aa49578 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c @@ -60,6 +60,13 @@ #undef DEBUG /* + * define this to see the clipboard content in the debug output. As + * this can lead to information leaking it must be activated + * explicitly! + */ +#undef PRINT_CLIPBOARD_CONTENT_ON_DEBUG + +/* * Define these to also support special targets TEXT and COMPOUND_TEXT * in text-only mode. We do not have a special handling for these. See * https://www.x.org/releases/X11R7.6/doc/xorg-docs/specs/ICCCM/icccm.html#text_properties @@ -432,6 +439,11 @@ void nxagentDumpClipboardStat(void) fprintf(stderr, " serverLastRequestedSelection [% 4ld][%s]\n", serverLastRequestedSelection, NameForRemAtom(serverLastRequestedSelection)); fprintf(stderr, "Compile time settings\n"); +#ifdef PRINT_CLIPBOARD_CONTENT_ON_DEBUG + fprintf(stderr, " PRINT_CLIPBOARD_CONTENT_ON_DEBUG [enabled]\n"); +#else + fprintf(stderr, " PRINT_CLIPBOARD_CONTENT_ON_DEBUG [disabled]\n"); +#endif #ifdef SUPPORT_TEXT_TARGET fprintf(stderr, " SUPPORT_TEXT_TARGET [enabled]\n"); #else @@ -1771,12 +1783,19 @@ Bool nxagentCollectPropertyEventFromXServer(int resource) ulReturnItems, pszReturnData, 1); #ifdef DEBUG - fprintf(stderr, "%s: Selection property [%d][%s] changed to [\"%*.*s\"...]\n", __func__, - lastClients[index].property, - validateString(NameForIntAtom(lastClients[index].property)), - (int)(min(20, ulReturnItems * resultFormat / 8)), - (int)(min(20, ulReturnItems * resultFormat / 8)), - pszReturnData); + fprintf(stderr, "%s: Selection property [%d][%s] changed to" + #ifdef PRINT_CLIPBOARD_CONTENT_ON_DEBUG + "[\"%*.*s\"...]" + #endif + "\n", __func__, + lastClients[index].property, + validateString(NameForIntAtom(lastClients[index].property)) + #ifdef PRINT_CLIPBOARD_CONTENT_ON_DEBUG + ,(int)(min(20, ulReturnItems * resultFormat / 8)), + (int)(min(20, ulReturnItems * resultFormat / 8)), + pszReturnData + #endif + ); #endif endTransfer(index, SELECTION_SUCCESS); @@ -2033,15 +2052,22 @@ void handlePropertyTransferFromAgentToXserver(int index, XlibAtom property) ulReturnItems); #ifdef DEBUG { - fprintf(stderr, "%s: XChangeProperty sent to window [0x%lx] for property [%ld][%s] len [%d] value [\"%*.*s\"...]\n", + fprintf(stderr, "%s: XChangeProperty sent to window [0x%lx] for property [%ld][%s] len [%d]" + #ifdef PRINT_CLIPBOARD_CONTENT_ON_DEBUG + "value [\"%*.*s\"...]" + #endif + "\n", __func__, lastServers[index].requestor, lastServers[index].property, NameForRemAtom(lastServers[index].property), - (int)ulReturnItems * 8 / 8, - (int)(min(20, ulReturnItems * 8 / 8)), + (int)ulReturnItems * 8 / 8 + #ifdef PRINT_CLIPBOARD_CONTENT_ON_DEBUG + ,(int)(min(20, ulReturnItems * 8 / 8)), (int)(min(20, ulReturnItems * 8 / 8)), - pszReturnData); + pszReturnData + #endif + ); } #endif } |