summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt23
-rw-r--r--config.h.cmake9
-rw-r--r--dcop/dcopclient.cpp17
-rw-r--r--tdecore/CMakeLists.txt2
-rw-r--r--tdecore/kdebug.cpp8
-rw-r--r--tdecore/kmountpoint.cpp1
-rw-r--r--tdecore/ksimpledirwatch.cpp6
-rw-r--r--tdecore/tdesycoca.cpp2
-rw-r--r--tdehtml/misc/knsplugininstaller.cpp4
-rw-r--r--tdeio/tdeio/global.cpp2
-rw-r--r--tdeio/tdeio/kdirwatch.cpp6
-rw-r--r--tdeioslave/file/file.cpp16
-rw-r--r--tdesu/client.cpp18
13 files changed, 100 insertions, 14 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5230577e3..cd431dfda 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -23,6 +23,7 @@ set( PACKAGE tdelibs )
include( FindPkgConfig )
include( CheckIncludeFile )
+include( CheckIncludeFiles )
include( CheckSymbolExists )
include( CheckFunctionExists )
include( CheckCSourceCompiles )
@@ -225,6 +226,7 @@ check_include_file( "dirent.h" HAVE_DIRENT_H )
check_include_file( "dld.h" HAVE_DLD_H )
check_include_file( "dlfcn.h" HAVE_DLFCN_H )
check_include_file( "dl.h" HAVE_DL_H )
+check_include_files( "sys/types.h;sys/dl.h" HAVE_SYS_DL_H )
check_include_file( "float.h" HAVE_FLOAT_H )
check_include_file( "fstab.h" HAVE_FSTAB_H )
check_include_file( "ieeefp.h" HAVE_IEEEFP_H )
@@ -237,6 +239,7 @@ check_include_file( "machine/soundcard.h" HAVE_MACHINE_SOUNDCARD_H )
check_include_file( "malloc.h" HAVE_MALLOC_H )
check_include_file( "memory.h" HAVE_MEMORY_H )
check_include_file( "mntent.h" HAVE_MNTENT_H )
+check_include_file( "sys/mntent.h" HAVE_SYS_MNTENT_H )
check_include_file( "ndir.h" HAVE_NDIR_H )
check_include_file( "netinet/in.h" HAVE_NETINET_IN_H )
check_include_file( "net/if.h" HAVE_NET_IF_H )
@@ -260,7 +263,7 @@ check_include_file( "sys/dir.h" HAVE_SYS_DIR_H )
check_include_file( "sys/filio.h" HAVE_SYS_FILIO_H )
check_include_file( "sys/mman.h" HAVE_SYS_MMAN_H )
check_include_file( "sys/mntent.h" HAVE_SYS_MNTENT_H )
-check_include_file( "sys/mnttab.h" HAVE_SYS_MNTTAB_H )
+check_include_files( "stdio.h;sys/mnttab.h" HAVE_SYS_MNTTAB_H )
check_include_file( "sys/mount.h" HAVE_SYS_MOUNT_H )
if( NOT HAVE_SYS_MOUNT_H )
find_path( SYS_MOUNT_PATH "sys/mount.h" )
@@ -280,9 +283,16 @@ check_include_file( "sys/ucred.h" HAVE_SYS_UCRED_H )
if( NOT HAVE_SYS_UCRED_H )
find_path( SYS_UCRED_PATH "sys/ucred.h" )
if( SYS_UCRED_PATH )
- set( HAVE_SYS_UCRED_H "1" )
+ set( HAVE_SYS_UCRED_H 1 )
endif( )
endif( )
+check_include_file( "ucred.h" HAVE_UCRED_H )
+if( NOT HAVE_UCRED_H )
+ find_path( UCRED_PATH "ucred.h" )
+ if( UCRED_PATH )
+ set( HAVE_UCRED_H 1 )
+ endif()
+endif()
check_include_file( "sys/xattr.h" HAVE_SYS_XATTR_H )
check_include_file( "termios.h" HAVE_TERMIOS_H )
check_include_file( "termio.h" HAVE_TERMIO_H )
@@ -427,6 +437,7 @@ endif( HAVE_GETMNTINFO )
check_function_exists( getnameinfo HAVE_GETNAMEINFO )
check_function_exists( getpagesize HAVE_GETPAGESIZE )
check_function_exists( getpeereid HAVE_GETPEEREID )
+check_function_exists( getpeerucred HAVE_GETPEERUCRED )
check_function_exists( getpeername HAVE_GETPEERNAME )
check_function_exists( getprotobyname_r HAVE_GETPROTOBYNAME_R )
check_function_exists( getpt HAVE_GETPT )
@@ -466,6 +477,14 @@ check_function_exists( __argz_count HAVE___ARGZ_COUNT )
check_function_exists( __argz_next HAVE___ARGZ_NEXT )
check_function_exists( __argz_stringify HAVE___ARGZ_STRINGIFY )
check_function_exists( sendfile HAVE_SENDFILE )
+set( SENDFILE_LIBRARIES "" )
+if( NOT HAVE_SENDFILE)
+ check_library_exists( sendfile sendfile "" HAVE_SENDFILE_LIB )
+ if( HAVE_SENDFILE_LIB )
+ set( HAVE_SENDFILE 1 )
+ set( SENDFILE_LIBRARIES sendfile )
+ endif( HAVE_SENDFILE_LIB )
+endif()
check_function_exists( rindex HAVE_RINDEX )
check_function_exists( putenv HAVE_PUTENV )
check_function_exists( poll HAVE_POLL )
diff --git a/config.h.cmake b/config.h.cmake
index b2daa5979..17a871252 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -174,6 +174,9 @@
/* Define to 1 if you have the <dl.h> header file. */
#cmakedefine HAVE_DL_H 1
+/* Define to 1 if you have the <sys/dl.h> header file. */
+#cmakedefine HAVE_SYS_DL_H 1
+
/* Define if your system has Linux Directory Notification */
#undef HAVE_DNOTIFY
@@ -240,6 +243,9 @@
/* Define to 1 if you have the `getpeereid' function. */
#cmakedefine HAVE_GETPEEREID 1
+/* Define to 1 if you have the `getpeerucred' function. */
+#cmakedefine HAVE_GETPEERUCRED 1
+
/* Define to 1 if you have the `getpeername' function. */
#cmakedefine HAVE_GETPEERNAME 1
@@ -651,6 +657,9 @@
/* Define to 1 if you have the <sys/ucred.h> header file. */
#cmakedefine HAVE_SYS_UCRED_H 1
+/* Define to 1 if you have the <ucred.h> header file. */
+#cmakedefine HAVE_UCRED_H 1
+
/* Define if system has the sys/xattr.h header. */
#cmakedefine HAVE_SYS_XATTR_H 1
diff --git a/dcop/dcopclient.cpp b/dcop/dcopclient.cpp
index 5523365c8..52d9097c1 100644
--- a/dcop/dcopclient.cpp
+++ b/dcop/dcopclient.cpp
@@ -50,6 +50,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <stdlib.h>
#include <assert.h>
#include <string.h>
+#ifdef HAVE_UCRED_H
+#include <ucred.h>
+#endif /* HAVE_UCRED_H */
#include <tqguardedptr.h>
#include <tqtextstream.h>
@@ -724,7 +727,7 @@ bool DCOPClient::isSuspended() const
return !d->notifier->isEnabled();
}
-#if defined(SO_PEERCRED) || defined(LOCAL_PEEREID)
+#if defined(SO_PEERCRED) || defined(LOCAL_PEEREID) || defined(HAVE_GETPEERUCRED)
#define USE_PEER_IS_US
// Check whether the remote end is owned by the same user.
static bool peerIsUs(int sockfd)
@@ -745,6 +748,18 @@ static bool peerIsUs(int sockfd)
if (getsockopt(sockfd, 0, LOCAL_PEEREID, &cred, &siz) != 0 || siz != sizeof(cred))
return false;
return (cred.unp_euid == geteuid());
+#elif defined(HAVE_GETPEERUCRED)
+ ucred_t *cred = nullptr;
+ uint_t peer_uid;
+
+ if (getpeerucred(sockfd, &cred) != 0) {
+ if (cred != nullptr)
+ ucred_free(cred);
+ return false;
+ }
+ peer_uid = ucred_geteuid(cred);
+ ucred_free(cred);
+ return (peer_uid == getuid());
#endif
}
#else
diff --git a/tdecore/CMakeLists.txt b/tdecore/CMakeLists.txt
index 22c3bbc88..c794a8039 100644
--- a/tdecore/CMakeLists.txt
+++ b/tdecore/CMakeLists.txt
@@ -141,7 +141,7 @@ tde_add_library( ${target} SHARED AUTOMOC
SOURCES ${${target}_SRCS}
VERSION 14.1.0
EMBED tdecorenetwork-static
- LINK DCOP-shared tdefx-shared ICE SM ${ZLIB_LIBRARIES}
+ LINK DCOP-shared tdefx-shared ICE SM ${ZLIB_LIBRARIES} ${RESOLV_LIBRARIES}
LINK_PRIVATE ltdlc-static ${KDESVGICONS} ${XCOMPOSITE_LIBRARIES}
${LIBIDN_LIBRARIES} ${LIBBFD_LIBRARIES} ${LIB_UTIL} ${GAMIN_LIBRARIES}
${Backtrace_LIBRARY}
diff --git a/tdecore/kdebug.cpp b/tdecore/kdebug.cpp
index afd925190..78fc06247 100644
--- a/tdecore/kdebug.cpp
+++ b/tdecore/kdebug.cpp
@@ -759,7 +759,13 @@ TQString formatBacktrace(void *addr) {
// NOTE: if somebody would compile for some non-linux-glibc platform
// check if dladdr function is avalible there
Dl_info info;
- dladdr(func.addr, &info); // obtain information about the function.
+
+ // obtain information about the function.
+#ifdef Q_OS_SOLARIS
+ dladdr((void *)func.addr, &info);
+#else
+ dladdr(func.addr, &info);
+#endif /* Solaris */
func.fileName = info.dli_fname;
func.base = info.dli_fbase;
diff --git a/tdecore/kmountpoint.cpp b/tdecore/kmountpoint.cpp
index a9be89e76..ae698c2af 100644
--- a/tdecore/kmountpoint.cpp
+++ b/tdecore/kmountpoint.cpp
@@ -33,6 +33,7 @@
#include <volmgt.h>
#endif
#ifdef HAVE_SYS_MNTTAB_H
+#include <stdio.h>
#include <sys/mnttab.h>
#endif
#ifdef HAVE_MNTENT_H
diff --git a/tdecore/ksimpledirwatch.cpp b/tdecore/ksimpledirwatch.cpp
index cbb4ce682..a5bab80ce 100644
--- a/tdecore/ksimpledirwatch.cpp
+++ b/tdecore/ksimpledirwatch.cpp
@@ -52,11 +52,17 @@
// debug
#include <sys/ioctl.h>
+#ifdef Q_OS_SOLARIS
+#include <sys/filio.h> /* FIONREAD is defined here */
+#endif /* solaris */
+
#ifdef HAVE_INOTIFY
#include <unistd.h>
#include <fcntl.h>
#include <sys/syscall.h>
+#ifdef Q_OS_LINUX
#include <linux/types.h>
+#endif /* Linux */
// Linux kernel headers are documented to not compile
#define _S390_BITOPS_H
#include <sys/inotify.h>
diff --git a/tdecore/tdesycoca.cpp b/tdecore/tdesycoca.cpp
index a11175117..c109d5ff4 100644
--- a/tdecore/tdesycoca.cpp
+++ b/tdecore/tdesycoca.cpp
@@ -42,7 +42,7 @@
#include <sys/mman.h>
#endif
-#ifdef Q_OS_SOLARIS
+#if defined(Q_OS_SOLARIS) && !defined(__dilos__)
extern "C"
{
extern int madvise(caddr_t, size_t, int);
diff --git a/tdehtml/misc/knsplugininstaller.cpp b/tdehtml/misc/knsplugininstaller.cpp
index b8b94cd6b..db83e5c75 100644
--- a/tdehtml/misc/knsplugininstaller.cpp
+++ b/tdehtml/misc/knsplugininstaller.cpp
@@ -157,7 +157,11 @@ bool KNSPluginInstallEngine::findPlugin()
// get system infos
// TODO/FIX : correct this to work with x86-64 machines
+#ifdef Q_OS_SOLARIS
+ struct utsname sysinfo;
+#else /* default */
utsname sysinfo;
+#endif /* default */
if(uname(&sysinfo))
return false;
TQString sysname(sysinfo.sysname);
diff --git a/tdeio/tdeio/global.cpp b/tdeio/tdeio/global.cpp
index c53929b1e..21437cdd3 100644
--- a/tdeio/tdeio/global.cpp
+++ b/tdeio/tdeio/global.cpp
@@ -1307,6 +1307,8 @@ TDEIO_EXPORT TQByteArray TDEIO::rawErrorDetail(int errorCode, const TQString &er
#endif
#ifdef HAVE_SYS_UCRED_H
#include <sys/ucred.h>
+#elifdef HAVE_UCRED_H
+#include <ucred.h>
#endif
#ifdef HAVE_SYS_MOUNT_H
#include <sys/mount.h>
diff --git a/tdeio/tdeio/kdirwatch.cpp b/tdeio/tdeio/kdirwatch.cpp
index b3763978d..c87558e1d 100644
--- a/tdeio/tdeio/kdirwatch.cpp
+++ b/tdeio/tdeio/kdirwatch.cpp
@@ -64,11 +64,17 @@
// debug
#include <sys/ioctl.h>
+#ifdef Q_OS_SOLARIS
+#include <sys/filio.h> /* FIONREAD */
+#endif /* solaris */
+
#ifdef HAVE_INOTIFY
#include <unistd.h>
#include <fcntl.h>
#include <sys/syscall.h>
+#ifdef Q_OS_LINUX
#include <linux/types.h>
+#endif /* Linux */
// Linux kernel headers are documented to not compile
#define _S390_BITOPS_H
#include <sys/inotify.h>
diff --git a/tdeioslave/file/file.cpp b/tdeioslave/file/file.cpp
index b7ac91bfd..bf18a069b 100644
--- a/tdeioslave/file/file.cpp
+++ b/tdeioslave/file/file.cpp
@@ -1446,15 +1446,15 @@ void FileProtocol::mount( bool _ro, const char *_fstype, const TQString& _dev, c
buffer.sprintf( "%s %s %s %s 2>%s", mountProg.latin1(), readonly.data(), dev.data(), point.data(), tmp );
else
// mount giving device + mountpoint + fstype
-#if defined(__svr4__) && defined(__sun__)
- // MACRO for Solaris 8 and I
+#if defined(Q_OS_SOLARIS)
+ // MACRO for Solaris 8 and I
// believe this is true for SVR4 in general
- buffer.sprintf( "%s -F %s %s %s %s 2>%s"
- mountProg.latin1()
- fstype.data()
- _ro ? "-oro" : ""
- dev.data()
- point.data()
+ buffer.sprintf( "%s -F %s %s %s %s 2>%s",
+ mountProg.latin1(),
+ fstype.data(),
+ _ro ? "-oro" : "",
+ dev.data(),
+ point.data(),
tmp );
#elif defined(__OpenBSD__)
buffer.sprintf( "%s %s %s -t %s %s %s 2>%s", "tdesu", mountProg.latin1(), readonly.data(),
diff --git a/tdesu/client.cpp b/tdesu/client.cpp
index fe5733ee7..8c775bbed 100644
--- a/tdesu/client.cpp
+++ b/tdesu/client.cpp
@@ -19,6 +19,9 @@
#include <pwd.h>
#include <errno.h>
#include <string.h>
+#ifdef HAVE_UCRED_H
+#include <ucred.h>
+#endif /* HAVE_UCRED_H */
#include <sys/types.h>
#include <sys/socket.h>
@@ -146,6 +149,21 @@ int TDEsuClient::connect()
return -1;
}
# endif
+#elif defined(HAVE_GETPEERUCRED)
+ ucred_t *cred = nullptr;
+
+ if (getpeerucred(sockfd, &cred) == 0) {
+ uid_t peer_uid = ucred_geteuid(cred);
+
+ ucred_free(cred);
+ if (peer_uid != getuid()) {
+ kdWarning(900) << "socket not owned by me! socket uid = " << peer_uid << endl;
+ close(sockfd); sockfd = -1;
+ return -1;
+ }
+ }
+ if (cred != nullptr)
+ ucred_free(cred);
#else
struct ucred cred;
socklen_t siz = sizeof(cred);