summaryrefslogtreecommitdiffstats
path: root/src/util
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2011-10-05 17:52:06 +0200
committerStephen Gallagher <sgallagh@redhat.com>2011-10-26 10:29:39 -0400
commit910f14ced1b5b7783f13f26b4ead776b96f567d5 (patch)
treedd33868f46f9f5eec96ed5b4494cc88463010aeb /src/util
parent18c350d62900aaf404600849fe6093b03771ac60 (diff)
downloadsssd-910f14ced1b5b7783f13f26b4ead776b96f567d5.tar.gz
sssd-910f14ced1b5b7783f13f26b4ead776b96f567d5.tar.xz
sssd-910f14ced1b5b7783f13f26b4ead776b96f567d5.zip
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
Diffstat (limited to 'src/util')
-rw-r--r--src/util/check_and_open.c5
-rw-r--r--src/util/util.h2
2 files changed, 4 insertions, 3 deletions
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)));
diff --git a/src/util/util.h b/src/util/util.h
index 61fe7f6c2..8438e8ce3 100644
--- a/src/util/util.h
+++ b/src/util/util.h
@@ -333,7 +333,7 @@ enum check_file_type {
*/
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);
/* check_fd()
* Verify that an open file descriptor has certain permissions and/or