From 2211199962d5e93e74531a415ea83888e44ee45e Mon Sep 17 00:00:00 2001 From: Jakub Hrozek Date: Wed, 5 Oct 2011 17:52:06 +0200 Subject: Append PID to sbus server socket name, let clients use a symlink Add option to follow symlinks to check_file() Append PID to sbus server socket name, let clients use a symlink https://fedorahosted.org/sssd/ticket/1034 --- src/util/check_and_open.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/util/check_and_open.c') diff --git a/src/util/check_and_open.c b/src/util/check_and_open.c index db926f10d..27ef1c883 100644 --- a/src/util/check_and_open.c +++ b/src/util/check_and_open.c @@ -35,7 +35,7 @@ static errno_t perform_checks(struct stat *stat_buf, errno_t check_file(const char *filename, const int uid, const int gid, const int mode, enum check_file_type type, - struct stat *caller_stat_buf) + struct stat *caller_stat_buf, bool follow_symlink) { int ret; struct stat local_stat_buf; @@ -47,7 +47,8 @@ errno_t check_file(const char *filename, const int uid, const int gid, stat_buf = caller_stat_buf; } - ret = lstat(filename, stat_buf); + ret = follow_symlink ? stat(filename, stat_buf) : \ + lstat(filename, stat_buf); if (ret == -1) { DEBUG(1, ("lstat for [%s] failed: [%d][%s].\n", filename, errno, strerror(errno))); -- cgit