Add SunOS specific patches

Signed-off-by: Denis Kozadaev <denis@dilos.org>
pull/201/head
Denis Kozadaev 12 months ago committed by Michele Calgaro
parent 394b5ef0fb
commit e5acdb1b39
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -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 )

@ -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

@ -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

@ -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}

@ -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;

@ -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

@ -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>

@ -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);

@ -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);

@ -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>

@ -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>

@ -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(),

@ -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);

Loading…
Cancel
Save