diff options
Diffstat (limited to 'xorg-server/os')
-rw-r--r-- | xorg-server/os/log.c | 28 | ||||
-rw-r--r-- | xorg-server/os/xdmcp.c | 17 |
2 files changed, 41 insertions, 4 deletions
diff --git a/xorg-server/os/log.c b/xorg-server/os/log.c index 3af277b72..64796a052 100644 --- a/xorg-server/os/log.c +++ b/xorg-server/os/log.c @@ -361,6 +361,7 @@ vpnprintf(char *string, int size_in, const char *f, va_list args) uint64_t ui; int64_t si; size_t size = size_in; + int precision; for (; f_idx < f_len && s_idx < size - 1; f_idx++) { int length_modifier = 0; @@ -371,9 +372,29 @@ vpnprintf(char *string, int size_in, const char *f, va_list args) f_idx++; - /* silently swallow digit length modifiers */ - while (f_idx < f_len && ((f[f_idx] >= '0' && f[f_idx] <= '9') || f[f_idx] == '.')) + /* silently swallow minimum field width */ + if (f[f_idx] == '*') { f_idx++; + va_arg(args, int); + } else { + while (f_idx < f_len && ((f[f_idx] >= '0' && f[f_idx] <= '9'))) + f_idx++; + } + + /* is there a precision? */ + precision = size; + if (f[f_idx] == '.') { + f_idx++; + if (f[f_idx] == '*') { + f_idx++; + /* precision is supplied in an int argument */ + precision = va_arg(args, int); + } else { + /* silently swallow precision digits */ + while (f_idx < f_len && ((f[f_idx] >= '0' && f[f_idx] <= '9'))) + f_idx++; + } + } /* non-digit length modifiers */ if (f_idx < f_len) { @@ -389,9 +410,8 @@ vpnprintf(char *string, int size_in, const char *f, va_list args) switch (f[f_idx]) { case 's': string_arg = va_arg(args, char*); - p_len = strlen_sigsafe(string_arg); - for (i = 0; i < p_len && s_idx < size - 1; i++) + for (i = 0; string_arg[i] != 0 && s_idx < size - 1 && s_idx < precision; i++) string[s_idx++] = string_arg[i]; break; diff --git a/xorg-server/os/xdmcp.c b/xorg-server/os/xdmcp.c index 6025be1cc..2c8538ba6 100644 --- a/xorg-server/os/xdmcp.c +++ b/xorg-server/os/xdmcp.c @@ -48,6 +48,11 @@ #include <netdir.h> #endif +#define XSERV_t +#define TRANS_SERVER +#define TRANS_REOPEN +#include <X11/Xtrans/Xtrans.h> + #ifdef XDMCP #undef REQUEST @@ -249,6 +254,14 @@ XdmcpUseMsg(void) ErrorF("-displayID display-id manufacturer display ID for request\n"); } +static void +XdmcpDefaultListen(void) +{ + /* Even when configured --disable-listen-tcp, we should listen on tcp in + XDMCP modes */ + _XSERVTransListen("tcp"); +} + int XdmcpOptions(int argc, char **argv, int i) { @@ -256,11 +269,13 @@ XdmcpOptions(int argc, char **argv, int i) get_manager_by_name(argc, argv, i++); XDM_INIT_STATE = XDM_QUERY; AccessUsingXdmcp(); + XdmcpDefaultListen(); return i + 1; } if (strcmp(argv[i], "-broadcast") == 0) { XDM_INIT_STATE = XDM_BROADCAST; AccessUsingXdmcp(); + XdmcpDefaultListen(); return i + 1; } #if defined(IPv6) && defined(AF_INET6) @@ -268,6 +283,7 @@ XdmcpOptions(int argc, char **argv, int i) i = get_mcast_options(argc, argv, ++i); XDM_INIT_STATE = XDM_MULTICAST; AccessUsingXdmcp(); + XdmcpDefaultListen(); return i + 1; } #endif @@ -275,6 +291,7 @@ XdmcpOptions(int argc, char **argv, int i) get_manager_by_name(argc, argv, i++); XDM_INIT_STATE = XDM_INDIRECT; AccessUsingXdmcp(); + XdmcpDefaultListen(); return i + 1; } if (strcmp(argv[i], "-port") == 0) { |