From 02d7da7cb7cc43911b632b871915192059c1c159 Mon Sep 17 00:00:00 2001 From: wbaumann Date: Sat, 14 Jan 2012 19:05:53 +0000 Subject: [PATCH] Set default user config file in parse_config --- ChangeLog | 6 ++++-- src/mount_davfs.c | 22 ++++++++++------------ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4637fe5..c6835ff 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,10 +6,12 @@ ChangeLog for davfs2 Typo in $(top_builddir) Added ../gl/libgnu.a to _LDADD (bug #31537, thanks Tomi). - mount_davfs.h, mount_davfs.c, cache.c, kernel_interface.c: + * mount_davfs.h, mount_davfs.c, cache.c, kernel_interface.c: Rename members uid and gid of args into fsuid and fsgid. - mount_davfs.h, mount_davfs.c: + * mount_davfs.h, mount_davfs.c: Store process persona in args. + * mount_davfs.c, parse_config, new_args: + Set default user config file in parse_config. 2012-01-12 Werner Baumann (werner.baumann@onlinehome.de) * dav_coda.c, dav_fuse.c: diff --git a/src/mount_davfs.c b/src/mount_davfs.c index 35dd912..aa163fb 100644 --- a/src/mount_davfs.c +++ b/src/mount_davfs.c @@ -153,7 +153,7 @@ static dav_args * parse_commandline(dav_args *args, int argc, char *argv[]); static void -parse_config(int argc, char *argv[], dav_args *args); +parse_config(dav_args *args); static void parse_secrets(dav_args *args); @@ -194,7 +194,7 @@ static dav_args * new_args(void); static void -log_dbg_config(char *argv[], dav_args *args); +log_dbg_config(dav_args *args); static int parse_line(char *line, int parmc, char *parmv[]); @@ -248,7 +248,7 @@ main(int argc, char *argv[]) if (getuid() != 0) check_fstab(args); - parse_config(argc, argv, args); + parse_config(args); check_mountpoint(args); @@ -1034,10 +1034,14 @@ parse_commandline(dav_args *args, int argc, char *argv[]) given it will be parsed too and overwrites the values from the system wide configuration file. */ static void -parse_config(int argc, char *argv[], dav_args *args) +parse_config(dav_args *args) { read_config(args, DAV_SYS_CONF_DIR "/" DAV_CONFIG, 1); + if (!args->privileged && !args->conf) + args->conf = ne_concat(args->home, "/.", PACKAGE, "/", DAV_CONFIG, + NULL); + struct passwd *pw = getpwuid(getuid()); if (!pw || !pw->pw_dir) error(EXIT_FAILURE, 0, _("can't determine home directory")); @@ -1153,7 +1157,7 @@ parse_config(int argc, char *argv[], dav_args *args) } if (args->debug & DAV_DBG_CONFIG) - log_dbg_config(argv, args); + log_dbg_config(args); } @@ -1742,12 +1746,6 @@ new_args(void) args->dav_user = ne_strdup(DAV_USER); args->dav_group = ne_strdup(DAV_GROUP); - if (getuid() != 0) { - args->conf = ne_concat(user_dir, "/", DAV_CONFIG, NULL); - } else { - args->conf = NULL; - } - args->user = 0; args->users = 0; args->netdev = 1; @@ -1830,7 +1828,7 @@ new_args(void) static void -log_dbg_config(char *argv[], dav_args *args) +log_dbg_config(dav_args *args) { syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "%s", args->cmdline);