Index: Makefile --- Makefile.orig 2003-04-29 06:16:07.000000000 +0200 +++ Makefile 2012-04-06 14:21:32.000000000 +0200 @@ -6,21 +6,21 @@ #CFLAGS=-g -Werror -fPIC LD=ld LDFLAGS=-g +LIBS=-ldl -lm libdir=/lib sysconfdir=/etc bindir=/usr/bin SRC=libsoapbox.c -LIB=libsoapbox.so +LIB=soapbox.so BIN=soapbox.sh SPEC=soapbox.spec all: $(LIB) $(BIN) $(SPEC) $(LIB): $(SRC) -# $(CC) $(CFLAGS) $(SRC) -nostartfiles -shared -Wl,-soname,$(LIB) -o $(LIB) -ldl -lm -lc - $(CC) $(CFLAGS) $(SRC) -nostartfiles -shared -rdynamic -Wl,-soname,$(LIB) -o $(LIB) -ldl -lm + $(CC) $(CFLAGS) $(SRC) -nostartfiles -shared -rdynamic -Wl,-soname,$(LIB) -o $(LIB) $(LIBS) $(BIN): cat $(BIN).in | sed -e 's|@@VERSION@@|$(VERSION)|' > $(BIN) Index: libsoapbox.c --- libsoapbox.c.orig 2003-06-05 18:49:26.000000000 +0200 +++ libsoapbox.c 2012-04-06 14:21:51.000000000 +0200 @@ -31,6 +31,12 @@ #define _GNU_SOURCE +#ifdef __FreeBSD__ +#define dirname freebsd_dirname +#include +#undef dirname +#endif + #include #include #include @@ -124,7 +130,7 @@ // Check of dlsym worked static void dlcheck(const char *err) { -// sb_log(0,"TEST: --%s--\n", err); +// sb_log(1,"TEST: --%s--\n", err); if (err!=NULL) sb_die(stdlog, "%s", err); } @@ -136,7 +142,7 @@ setvbuf(stderr, (char *) NULL, _IONBF, 0); // Handle and unset logging environment variable - soapboxlog=getenv("SOAPBOXLOG"); // unsetenv("SOAPBOXLOG"); + soapboxlog=getenv("SOAPBOXLOG"); unsetenv("SOAPBOXLOG"); if (!soapboxlog || *soapboxlog=='\0') { stdlog=stderr; } else { @@ -149,12 +155,12 @@ } // Handle and unset debugging environment variable - soapboxdbg=getenv("SOAPBOXDEBUG"); // unsetenv("SOAPBOXDEBUG"); + soapboxdbg=getenv("SOAPBOXDEBUG"); unsetenv("SOAPBOXDEBUG"); if (soapboxdbg) soapboxdebug=atoi(soapboxdbg); sb_log(8, "Variable SOAPBOXDEBUG is set to %i.", soapboxdebug); // Handle and unset path environment variable - soapboxpath=getenv("SOAPBOXPATH"); // unsetenv("SOAPBOXPATH"); + soapboxpath=getenv("SOAPBOXPATH"); unsetenv("SOAPBOXPATH"); if (!soapboxpath) soapboxpath=""; if (!soapboxpath || *soapboxpath=='\0') sb_log(8, "Variable SOAPBOXPATH is not set. Not allowed to write anywhere."); @@ -162,7 +168,7 @@ sb_log(8, "Variable SOAPBOXPATH is set to \"%s\".", soapboxpath); // Handle and unset action environment variable - soapboxaction=getenv("SOAPBOXACTION"); // unsetenv("SOAPBOXACTION"); + soapboxaction=getenv("SOAPBOXACTION"); unsetenv("SOAPBOXACTION"); if (!soapboxaction || *soapboxaction=='\0') { soapboxaction=DEFAULT_ACTION; sb_log(8, "Variable SOAPBOXACTION is not set. Using \"%s\" by default.", DEFAULT_ACTION); @@ -191,12 +197,18 @@ _real_mkfifo=dlsym(RTLD_NEXT, "mkfifo"); dlcheck(dlerror()); _real_mknod=dlsym(RTLD_NEXT, "mknod"); dlcheck(dlerror()); +#ifdef __linux__ _real___xmknod=dlsym(RTLD_NEXT, "__xmknod"); dlcheck(dlerror()); +#endif _real_open=dlsym(RTLD_NEXT, "open"); dlcheck(dlerror()); +#ifdef __linux__ _real_open64=dlsym(RTLD_NEXT, "open64"); dlcheck(dlerror()); +#endif _real_creat=dlsym(RTLD_NEXT, "creat"); dlcheck(dlerror()); +#ifdef __linux__ _real_creat64=dlsym(RTLD_NEXT, "creat64"); dlcheck(dlerror()); +#endif // _real_fopen=dlsym(RTLD_NEXT, "fopen"); dlcheck(dlerror()); @@ -212,6 +224,7 @@ devnull=_real_open("/dev/zero", O_RDWR); if (devnull==-1) sb_die(stdlog, "/dev/null: %s", strerror(errno)); +#if 0 // Print each process execution if (soapboxdebug & 1) { int i; @@ -219,6 +232,7 @@ for(i=0; i