Add support for HP-UX
tested on: HP-UX 11.31 ia64, gcc 4.7.1(HP AllianceOne version) gcc 4.2.3(http://hpux.connect.org.uk) HP C/aC++ HP-UX defaults to use LP32 and it treats long as 32 bit (= 4 bytes). This build forces LP64 for treating long as 64 bit.
This commit is contained in:
@@ -86,6 +86,9 @@ endif
|
||||
if HOST_WIN
|
||||
libcompat_la_SOURCES += compat/getentropy_win.c
|
||||
endif
|
||||
if HOST_HPUX
|
||||
libcompat_la_SOURCES += compat/getentropy_hpux.c
|
||||
endif
|
||||
endif
|
||||
|
||||
endif
|
||||
@@ -97,6 +100,9 @@ endif
|
||||
if HOST_WIN
|
||||
libcompat_la_SOURCES += compat/issetugid_win.c
|
||||
endif
|
||||
if HOST_HPUX
|
||||
libcompat_la_SOURCES += compat/issetugid_hpux.c
|
||||
endif
|
||||
endif
|
||||
|
||||
noinst_HEADERS =
|
||||
@@ -106,6 +112,7 @@ noinst_HEADERS += compat/arc4random_linux.h
|
||||
noinst_HEADERS += compat/arc4random_osx.h
|
||||
noinst_HEADERS += compat/arc4random_solaris.h
|
||||
noinst_HEADERS += compat/arc4random_win.h
|
||||
noinst_HEADERS += compat/arc4random_hpux.h
|
||||
noinst_HEADERS += compat/chacha_private.h
|
||||
|
||||
libcrypto_la_SOURCES =
|
||||
|
@@ -6,6 +6,9 @@
|
||||
#if defined(__FreeBSD__)
|
||||
#include "arc4random_freebsd.h"
|
||||
|
||||
#elif defined(__hpux)
|
||||
#include "arc4random_hpux.h"
|
||||
|
||||
#elif defined(__linux__)
|
||||
#include "arc4random_linux.h"
|
||||
|
||||
|
26
crypto/compat/issetugid_hpux.c
Normal file
26
crypto/compat/issetugid_hpux.c
Normal file
@@ -0,0 +1,26 @@
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/pstat.h>
|
||||
|
||||
/*
|
||||
* HP-UX does not have issetugid().
|
||||
* This experimental implementation uses pstat_getproc() and get*id().
|
||||
* First, try pstat_getproc() and check PS_CHANGEDPRIV bit of pst_flag.
|
||||
* In case unsuccessful calling pstat_getproc(), using get*id().
|
||||
*
|
||||
*/
|
||||
int issetugid(void)
|
||||
{
|
||||
struct pst_status buf;
|
||||
if(pstat_getproc(&buf, sizeof(buf), 0, getpid()) != 1) {
|
||||
perror("pstat_getproc()");
|
||||
} else {
|
||||
if(buf.pst_flag & PS_CHANGEDPRIV)
|
||||
return 1;
|
||||
}
|
||||
if(getuid() != geteuid())
|
||||
return 1;
|
||||
if(getgid() != getegid())
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user