libXmu: Branch 'master' - 5 commits

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Aug 29 20:49:36 UTC 2022


 configure.ac    |    5 ---
 doc/Xmu.xml     |    2 -
 src/CvtStdSel.c |   72 +++++++++-----------------------------------------------
 src/GetHost.c   |   19 --------------
 4 files changed, 14 insertions(+), 84 deletions(-)

New commits:
commit b4e47d3807da4f204dbee8682dac98318f913bd0
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Sun Aug 21 11:21:52 2022 -0700

    get_os_name: Use autoconf to detect uname() support
    
    Stop maintaining a list of #ifdefs for ancient platforms
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>

diff --git a/configure.ac b/configure.ac
index 1ac8612..4afe3d5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -33,6 +33,7 @@ PKG_CHECK_MODULES(XMU, xt xext x11 xextproto)
 PKG_CHECK_MODULES(XMUU, x11)
 
 # Checks for library functions.
+AC_CHECK_FUNCS([uname])
 AC_REPLACE_FUNCS([reallocarray])
 
 # Allow checking code with lint, sparse, etc.
diff --git a/src/CvtStdSel.c b/src/CvtStdSel.c
index 177de1b..439ab7a 100644
--- a/src/CvtStdSel.c
+++ b/src/CvtStdSel.c
@@ -65,26 +65,14 @@ in this Software without prior written authorization from The Open Group.
 #include <X11/Xfuncs.h>
 
 #ifndef OS_NAME
-#ifndef X_OS_FILE
-#ifdef SYSV			/* keep separate until makedepend fixed */
-#define USE_UNAME
-#endif
-#ifdef SVR4
-#define USE_UNAME
-#endif
-#ifdef ultrix
-#define USE_UNAME
-#endif
-#ifdef CSRG_BASED
-#define USE_UNAME
-#endif
-#ifdef __linux__
-#define USE_UNAME
-#endif
-#endif /*X_OS_FILE*/
-#ifdef USE_UNAME
-#include <sys/utsname.h>
-#endif
+# ifndef X_OS_FILE
+#  ifdef HAVE_UNAME
+#   define USE_UNAME
+#  endif
+# endif /*X_OS_FILE*/
+# ifdef USE_UNAME
+#  include <sys/utsname.h>
+# endif
 #endif
 
 /*
@@ -148,14 +136,10 @@ get_os_name(void)
 	}
 #endif
 
-#ifdef sun
-	return XtNewString("SunOS");
-#else
-# if !defined(SYSV) && (defined(CSRG_BASED) || defined(unix))
+#if !defined(SYSV) && (defined(CSRG_BASED) || defined(unix))
 	return XtNewString("BSD");
-# else
+#else
 	return NULL;
-# endif
 #endif
 
 #endif /*OS_NAME*/
commit bcc112ca1ba3505899d97ef0502fcb0fb4d6e0a0
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Mon Aug 15 15:56:32 2022 -0700

    XmuGetHostname: Drop support for ancient USG systems
    
    USG was defined for a handful of pre-SVR4 systems based on
    AT&T's Unix System Group releases in the old imake configs
    and has never been defined in X11R7 modular builds.
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>

diff --git a/src/GetHost.c b/src/GetHost.c
index 2f0bccd..fdb1741 100644
--- a/src/GetHost.c
+++ b/src/GetHost.c
@@ -42,13 +42,7 @@ in this Software without prior written authorization from The Open Group.
 #include <X11/Xwinsock.h>
 #endif
 
-#ifdef USG
-#define NEED_UTSNAME
-#endif
 
-#ifdef NEED_UTSNAME
-#include <sys/utsname.h>
-#endif
 
 #include <X11/Xmu/SysUtil.h>
 
@@ -63,22 +57,9 @@ XmuGetHostname(char *buf, int maxlen)
 	return -1;
 #endif
 
-#ifdef NEED_UTSNAME
-    /*
-     * same host name crock as in server and xinit.
-     */
-    struct utsname name;
-
-    uname (&name);
-    len = strlen (name.nodename);
-    if (len >= maxlen) len = maxlen - 1;
-    strncpy (buf, name.nodename, len);
-    buf[len] = '\0';
-#else
     buf[0] = '\0';
     (void) gethostname (buf, maxlen);
     buf [maxlen - 1] = '\0';
     len = strlen(buf);
-#endif /* hpux */
     return len;
 }
commit e3cad27560774ca1a5587d26900c1bd09bad7dfc
Author: Matthieu Herrb <matthieu at herrb.eu>
Date:   Tue Jan 14 22:23:15 2020 +0100

    Remove support for XA_IP_ADDRESS
    
    This code has a number of issues:
    - It doesn't support IPv6 https://bugs.freedesktop.org/show_bug.cgi?id=7611
    - The IP address is set by the selection owner so it doesn't bring any
      security for anyone querying the selection
    - The extra DNS query that it does is problematic in some sandboxed
      environments (like OpenBSD's pledge
      https://marc.info/?l=openbsd-bugs&m=157842725819911&w=2)
    
    Signed-off-by: Matthieu Herrb <matthieu at herrb.eu>
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>

diff --git a/configure.ac b/configure.ac
index 68f685f..1ac8612 100644
--- a/configure.ac
+++ b/configure.ac
@@ -32,10 +32,6 @@ XORG_CHECK_SGML_DOCTOOLS(1.8)
 PKG_CHECK_MODULES(XMU, xt xext x11 xextproto)
 PKG_CHECK_MODULES(XMUU, x11)
 
-# CvtStdSel.c needs to know which network transports to build hostname
-# conversion routines for
-XTRANS_CONNECTION_FLAGS
-
 # Checks for library functions.
 AC_REPLACE_FUNCS([reallocarray])
 
diff --git a/doc/Xmu.xml b/doc/Xmu.xml
index 2d363a9..fdd60e0 100644
--- a/doc/Xmu.xml
+++ b/doc/Xmu.xml
@@ -1442,7 +1442,7 @@ returns the size in bits of the elements</para>
       </variablelist>
 
 This function converts the following standard selections: CLASS,
-CLIENT_WINDOW, DECNET_ADDRESS, HOSTNAME, IP_ADDRESS, NAME, OWNER_OS,
+CLIENT_WINDOW, DECNET_ADDRESS, HOSTNAME, NAME, OWNER_OS,
 TARGETS, TIMESTAMP, and USER.  It returns
 <symbol>True</symbol>
 if the conversion was successful, else it returns
diff --git a/src/CvtStdSel.c b/src/CvtStdSel.c
index 4865658..177de1b 100644
--- a/src/CvtStdSel.c
+++ b/src/CvtStdSel.c
@@ -46,7 +46,6 @@ in this Software without prior written authorization from The Open Group.
 
 #ifdef WIN32
 #include <X11/Xwinsock.h>
-#define XOS_USE_MTSAFE_NETDBAPI
 #else
 #ifndef Lynx
 #include <sys/socket.h>
@@ -56,7 +55,6 @@ in this Software without prior written authorization from The Open Group.
 #endif
 #define XOS_USE_XT_LOCKING
 #endif
-#define X_INCLUDE_NETDB_H
 #include <X11/Xos_r.h>
 
 #include <X11/Xos.h>
@@ -213,29 +211,6 @@ XmuConvertStandardSelection(Widget w, Time time, Atom *selection, Atom *target,
 	*format = 8;
 	return True;
     }
-#if defined(TCPCONN)
-    if (*target == XA_IP_ADDRESS(d)) {
-	char hostname[1024];
-#ifdef XTHREADS_NEEDS_BYNAMEPARAMS
-	_Xgethostbynameparams hparams;
-#endif
-	struct hostent *hostp;
-
-	hostname[0] = '\0';
-	(void) XmuGetHostname (hostname, sizeof hostname);
-
-	if ((hostp = _XGethostbyname (hostname,hparams)) == NULL)
-	    return False;
-
-	if (hostp->h_addrtype != AF_INET) return False;
-	*length = hostp->h_length;
-	*value = XtMalloc(*length);
-	(void) memmove (*value, hostp->h_addr, *length);
-	*type = XA_NET_ADDRESS(d);
-	*format = 8;
-	return True;
-    }
-#endif
     if (*target == XA_USER(d)) {
 	char *name = (char*)getenv("USER");
 	if (name == NULL) return False;
@@ -302,15 +277,14 @@ XmuConvertStandardSelection(Widget w, Time time, Atom *selection, Atom *target,
     }
     if (*target == XA_TARGETS(d)) {
 #if defined(unix)
-#  define NUM_TARGETS 8
-#else
 #  define NUM_TARGETS 7
+#else
+#  define NUM_TARGETS 6
 #endif
 	Atom* std_targets = (Atom*)XtMalloc(NUM_TARGETS*sizeof(Atom));
 	int i = 0;
 	std_targets[i++] = XA_TIMESTAMP(d);
 	std_targets[i++] = XA_HOSTNAME(d);
-	std_targets[i++] = XA_IP_ADDRESS(d);
 	std_targets[i++] = XA_USER(d);
 	std_targets[i++] = XA_CLASS(d);
 	std_targets[i++] = XA_NAME(d);
commit 71f24beca39c957c9f54e77b3d2fc54cd89400b1
Author: Matthieu Herrb <matthieu at herrb.eu>
Date:   Tue Jan 14 23:32:46 2020 +0100

    Fix OWNER_OS in XmuConvertStandardSelection() on Linux
    
    It used to return BSD
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>

diff --git a/src/CvtStdSel.c b/src/CvtStdSel.c
index a9ead44..4865658 100644
--- a/src/CvtStdSel.c
+++ b/src/CvtStdSel.c
@@ -80,6 +80,9 @@ in this Software without prior written authorization from The Open Group.
 #ifdef CSRG_BASED
 #define USE_UNAME
 #endif
+#ifdef __linux__
+#define USE_UNAME
+#endif
 #endif /*X_OS_FILE*/
 #ifdef USE_UNAME
 #include <sys/utsname.h>
commit 6b4f114d4cc76c0f3b1a49ed05db305f0b96bdfe
Author: Matthieu Herrb <matthieu at herrb.eu>
Date:   Tue Jan 14 22:23:16 2020 +0100

    Unifdef SYSVNET
    
    This has not been set by configure since the switch to autotools.
    
    Signed-off-by: Matthieu Herrb <matthieu at herrb.eu>
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>

diff --git a/src/CvtStdSel.c b/src/CvtStdSel.c
index 36423c6..a9ead44 100644
--- a/src/CvtStdSel.c
+++ b/src/CvtStdSel.c
@@ -36,13 +36,6 @@ in this Software without prior written authorization from The Open Group.
 #include <config.h>
 #endif
 
-#ifdef SYSVNET
-#include <interlan/il_types.h>
-#define __TYPES__		/* prevent #include <sys/types.h> in Xlib.h */
-#include <interlan/netdb.h>
-#include <interlan/socket.h>
-#endif /* SYSVNET */
-
 #include <X11/IntrinsicP.h>
 #include <X11/Xatom.h>
 #include <X11/ShellP.h>
@@ -51,7 +44,6 @@ in this Software without prior written authorization from The Open Group.
 #endif
 #include <stdio.h>
 
-#ifndef SYSVNET
 #ifdef WIN32
 #include <X11/Xwinsock.h>
 #define XOS_USE_MTSAFE_NETDBAPI
@@ -66,7 +58,6 @@ in this Software without prior written authorization from The Open Group.
 #endif
 #define X_INCLUDE_NETDB_H
 #include <X11/Xos_r.h>
-#endif
 
 #include <X11/Xos.h>
 #include <stdlib.h>


More information about the xorg-commit mailing list