Commit 11f52a61 authored by Anders Blomdell's avatar Anders Blomdell
Browse files

Add hack to test without installing

parent cab7991e
......@@ -6,6 +6,8 @@
libtest
# Automake stuff
*.la
*.lo
.deps/
Makefile
Makefile.in
......
......@@ -7,6 +7,12 @@ files_la_LDFLAGS = -module -avoid-version
files_la_CFLAGS = $(AM_CFLAGS)
files_la_LIBADD = -lnfsidmap
lib_LTLIBRARIES += ldpreload_dlopen.la
ldpreload_dlopen_la_SOURCES = ldpreload_dlopen.c
ldpreload_dlopen_la_LDFLAGS = -module -avoid-version -fPIC -shared
ldpreload_dlopen_la_CFLAGS = $(AM_CFLAGS)
ldpreload_dlopen_la_LIBADD = -ldl
man5_MANS = libnfsidmap-files.5
EXTRA_DIST = $(man5_MANS)
......@@ -33,11 +39,15 @@ maintainer-clean-local:
clean-local:
echo CLEAN
test: libtest
./libtest -u user1@test.domain user1@test.domain
./libtest -u user2@test2.domain user2@test2.domain
./libtest -g group11@test1.domain
./libtest -g group21@test2.domain
test: libtest .libs/ldpreload_dlopen.so
LD_PRELOAD=.libs/ldpreload_dlopen.so \
./libtest -u user1@test.domain user1@test.domain
LD_PRELOAD=.libs/ldpreload_dlopen.so \
./libtest -u user2@test2.domain user2@test2.domain
LD_PRELOAD=.libs/ldpreload_dlopen.so \
./libtest -g group11@test1.domain
LD_PRELOAD=.libs/ldpreload_dlopen.so \
./libtest -g group21@test2.domain
nodist_libtest_SOURCES = libtest.c
libtest_LDADD = -lnfsidmap
......
#define _GNU_SOURCE
#include <sys/types.h>
#include <pwd.h>
#include <stdlib.h>
#include <dlfcn.h>
#include <string.h>
void *dlopen(const char *filename, int flags)
{
static void * (*func)(const char *filename, int flags);
static uid_t my_uid;
static char *override;
struct passwd *p;
if(!func) {
func = (void *(*)(const char *filename, int flags))
dlsym(RTLD_NEXT, "dlopen");
}
if (strcmp(filename, "/usr/lib64/libnfsidmap/files.so") == 0) {
return func(".libs/files.so", flags);
} else {
return func(filename, flags);
}
}
......@@ -58,10 +58,12 @@ char *conf_path = PATH_IDMAPDCONF;
#define TEST(RESULT, ERR, OK) \
{ \
int err = RESULT; \
if (err != 0) \
if (err != 0) { \
printf ERR ; \
else \
exit(1); \
} else { \
printf OK ; \
} \
}
int main(int ac, char **av)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment