Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Anders Blomdell
libnfsidmap-files
Commits
11f52a61
Commit
11f52a61
authored
Jun 28, 2019
by
Anders Blomdell
Browse files
Add hack to test without installing
parent
cab7991e
Changes
4
Hide whitespace changes
Inline
Side-by-side
.gitignore
View file @
11f52a61
...
...
@@ -6,6 +6,8 @@
libtest
# Automake stuff
*.la
*.lo
.deps/
Makefile
Makefile.in
...
...
Makefile.am
View file @
11f52a61
...
...
@@ -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
...
...
ldpreload_dlopen.c
0 → 100644
View file @
11f52a61
#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
);
}
}
libtest.c
View file @
11f52a61
...
...
@@ -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
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment