Skip to content

Commit

Permalink
Enable flag for ACL systemcalls
Browse files Browse the repository at this point in the history
Renamed define ENABLE_ACCESS_LOG to ENABLE_ACCESS_SYSCALL
  • Loading branch information
Ratler committed Jul 20, 2018
1 parent e5723fa commit ec17ce5
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
12 changes: 11 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,17 @@ AC_ARG_ENABLE([access-syscall],
[],
[enable_access_syscall=yes])
if test "x$enable_access_syscall" = "xyes"; then
AC_DEFINE(ENABLE_ACCESS_LOG, 1, [Log access syscalls])
AC_DEFINE(ENABLE_ACCESS_SYSCALL, 1, [Log access syscalls])
fi

dnl Enable "acl" syscalls (setxattr, removexattr) logging
AC_ARG_ENABLE([acl-syscall],
[AS_HELP_STRING([--enable-acl-syscall],
[Log acl (setxattr, removexattr) syscalls [default=yes]])],
[],
[enable_acl_syscall=yes])
if test "x$enable_acl_syscall" = "xyes"; then
AC_DEFINE(ENABLE_ACL_SYSCALL, 1, [Log acl syscalls])
fi

AC_OUTPUT
16 changes: 12 additions & 4 deletions installwatch.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,14 @@ static int (*true_truncate)(const char *, TRUNCATE_T);
static int (*true_unlink)(const char *);
static int (*true_utime)(const char *,const struct utimbuf *);
static int (*true_utimes)(const char *,const struct timeval *);
#ifdef ENABLE_ACCESS_LOG
#ifdef ENABLE_ACCESS_SYSCALL
static int (*true_access)(const char *, int);
#endif
#ifdef ENABLE_ACL_SYSCALL
static int (*true_setxattr)(const char *,const char *,const void *,
size_t, int);
static int (*true_removexattr)(const char *,const char *);
#endif

#if(GLIBC_MINOR >= 1)

Expand Down Expand Up @@ -405,9 +407,11 @@ static void initialize(void) {
true_truncate = dlsym(libc_handle, "truncate");
true_unlink = dlsym(libc_handle, "unlink");
true_utime = dlsym(libc_handle, "utime");
#ifdef ENABLE_ACL_SYSCALL
true_setxattr = dlsym(libc_handle, "setxattr");
#endif
true_utimes = dlsym(libc_handle, "utimes");
#ifdef ENABLE_ACCESS_LOG
#ifdef ENABLE_ACCESS_SYSCALL
true_access = dlsym(libc_handle, "access");
#endif

Expand All @@ -422,7 +426,9 @@ static void initialize(void) {
true_xstat64 = dlsym(libc_handle, "__xstat64");
true_lxstat64 = dlsym(libc_handle, "__lxstat64");
true_truncate64 = dlsym(libc_handle, "truncate64");
true_removexattr = dlsym(libc_handle, "removexattr");
#ifdef ENABLE_ACL_SYSCALL
true_removexattr = dlsym(libc_handle, "removexattr");
#endif
#endif

#if (GLIBC_MINOR >= 4)
Expand Down Expand Up @@ -3422,7 +3428,7 @@ int utimes (const char *pathname, const struct timeval *newtimes) {
return result;
}

#ifdef ENABLE_ACCESS_LOG
#ifdef ENABLE_ACCESS_SYSCALL
int access (const char *pathname, int type) {
int result;
instw_t instw;
Expand Down Expand Up @@ -3460,6 +3466,7 @@ int access (const char *pathname, int type) {
}
#endif

#ifdef ENABLE_ACL_SYSCALL
int setxattr (const char *pathname, const char *name,
const void *value, size_t size, int flags)
{
Expand Down Expand Up @@ -3539,6 +3546,7 @@ int removexattr (const char *pathname, const char *name)

return result;
}
#endif

#if(GLIBC_MINOR >= 1)

Expand Down

0 comments on commit ec17ce5

Please sign in to comment.