X-Git-Url: http://ftp.carnet.hr/carnet-debian/scm?p=ossec-hids.git;a=blobdiff_plain;f=src%2Fheaders%2Fshared.h;h=40e4d38854a1ba864b5547d46290e697be0c1c41;hp=87fda42f0e1fbf6f2b26496547b8ceda7e57f748;hb=3f728675941dc69d4e544d3a880a56240a6e394a;hpb=927951d1c1ad45ba9e7325f07d996154a91c911b diff --git a/src/headers/shared.h b/src/headers/shared.h old mode 100755 new mode 100644 index 87fda42..40e4d38 --- a/src/headers/shared.h +++ b/src/headers/shared.h @@ -1,6 +1,3 @@ -/* @(#) $Id: ./src/headers/shared.h, 2011/09/08 dcid Exp $ - */ - /* Copyright (C) 2009 Trend Micro Inc. * All rights reserved. * @@ -10,11 +7,6 @@ * Foundation */ -/* v0.3 (2007/12/23): Adding SSP & FORTIFY_SOURCE - * v0.2 (2005/12/23): Adding 'u_int16_t' for Solaris. - * v0.1 (2005/10/27): first version. - */ - /* * The stack smashing protector defeats some BoF via: gcc -fstack-protector * Reference: http://gcc.gnu.org/onlinedocs/gcc-4.1.2/cpp.pdf @@ -24,16 +16,16 @@ ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2)) || \ (__GNUC__ >= 5)) -/* Heuristicly enable the stack protector on sensitive functions */ +/* Heuristically enable the stack protector on sensitive functions */ #define __SSP__ 1 -/* FORTIFY_SOURCE is Redhat / Fedora specific */ +/* FORTIFY_SOURCE is RedHat / Fedora specific */ #define FORTIFY_SOURCE #endif #ifndef __SHARED_H - #define __SHARED_H + #ifndef _LARGEFILE64_SOURCE #define _LARGEFILE64_SOURCE #endif @@ -42,15 +34,16 @@ #define _FILE_OFFSET_BITS 64 #endif - /* Global headers */ #include #include #include #include +#ifdef __OpenBSD__ +#include +#endif -/* Making windows happy */ #ifndef WIN32 #include @@ -60,7 +53,8 @@ #endif #include -#endif +#endif /* WIN32 */ + #include #include #include @@ -71,15 +65,24 @@ #include #include -/* Making Windows happy */ -#ifndef WIN32 +/* The mingw32 builder used by travis.ci can't find glob.h + * Yet glob must work on actual win32. + */ +#ifndef __MINGW32__ #include +#endif + +#ifndef WIN32 #include #include #include #include #include #else +/* WINVER needs to be 0x0501 or higher to pull in IPv6 functions */ +#ifndef WINVER +#define WINVER 0x0501 +#endif #include #include #include @@ -103,7 +106,6 @@ #define _FILE_OFFSET_BITS 64 #endif - /* Global portability code */ #ifdef SOLARIS @@ -118,8 +120,6 @@ typedef uint8_t u_int8_t; #endif /* SOLARIS */ - -/* For HP-UX */ #if defined HPUX #include typedef uint32_t u_int32_t; @@ -129,19 +129,14 @@ typedef uint8_t u_int8_t; #define MSG_DONTWAIT 0 #endif - -/* For Darwin */ #ifdef Darwin typedef int sock2len_t; #endif - #ifndef WIN32 #define CloseSocket(x) close(x) #endif - -/* For Windows */ #ifdef WIN32 typedef int uid_t; typedef int gid_t; @@ -154,54 +149,48 @@ typedef int socklen_t; void WinSetError(); typedef unsigned short int u_int16_t; typedef unsigned char u_int8_t; -/* typedef closesocket close; */ #define MSG_DONTWAIT 0 #ifndef PROCESSOR_ARCHITECTURE_AMD64 - #define PROCESSOR_ARCHITECTURE_AMD64 9 -#endif +#define PROCESSOR_ARCHITECTURE_AMD64 9 #endif +#endif /* WIN32 */ -/* For AIX */ #ifdef AIX #define MSG_DONTWAIT MSG_NONBLOCK #endif - - /* Local name */ -char *__local_name; - +extern const char *__local_name; /*** Global prototypes ***/ /*** These functions will exit on error. No need to check return code ***/ /* for calloc: x = calloc(4,sizeof(char)) -> os_calloc(4,sizeof(char),x) */ -#define os_calloc(x,y,z) ((z = calloc(x,y)))?(void)1:ErrorExit(MEM_ERROR, ARGV0) +#define os_calloc(x,y,z) ((z = (__typeof__(z)) calloc(x,y)))?(void)1:ErrorExit(MEM_ERROR, __local_name, errno, strerror(errno)) -#define os_strdup(x,y) ((y = strdup(x)))?(void)1:ErrorExit(MEM_ERROR, ARGV0) +#define os_strdup(x,y) ((y = strdup(x)))?(void)1:ErrorExit(MEM_ERROR, __local_name, errno, strerror(errno)) -#define os_malloc(x,y) ((y = malloc(x)))?(void)1:ErrorExit(MEM_ERROR, ARGV0) +#define os_malloc(x,y) ((y = (__typeof__(y)) malloc(x)))?(void)1:ErrorExit(MEM_ERROR, __local_name, errno, strerror(errno)) #define os_free(x) (x)?free(x):merror("free a null") -#define os_realloc(x,y,z) ((z = realloc(x,y)))?(void)1:ErrorExit(MEM_ERROR, ARGV0) +#define os_realloc(x,y,z) ((z = (__typeof__(z))realloc(x,y)))?(void)1:ErrorExit(MEM_ERROR, __local_name, errno, strerror(errno)) #define os_clearnl(x,p) if((p = strrchr(x, '\n')))*p = '\0'; #ifdef CLIENT - #define isAgent 1 +#define isAgent 1 #else - #define isAgent 0 +#define isAgent 0 #endif - - #include "debug_op.h" #include "wait_op.h" #include "agent_op.h" #include "file_op.h" +#include "fs_op.h" #include "mem_op.h" #include "math_op.h" #include "mq_op.h" @@ -220,6 +209,7 @@ char *__local_name; #include "read-agents.h" #include "report_op.h" #include "string_op.h" +#include "randombytes.h" #include "os_xml/os_xml.h" #include "os_regex/os_regex.h" @@ -227,7 +217,5 @@ char *__local_name; #include "error_messages/error_messages.h" #include "custom_output_search.h" - #endif /* __SHARED_H */ -/* EOF */