Check for relative mount point

This commit is contained in:
wbaumann 2011-06-29 18:48:26 +00:00
parent cf9f09619b
commit 0d5eee4626
3 changed files with 10 additions and 2 deletions

View File

@ -1,6 +1,10 @@
ChangeLog for davfs2 ChangeLog for davfs2
-------------------- --------------------


2011-06-29 Werner Baumann (werner.baumann@onlinehome.de)
* mount_davfs.c, mount_davfs.h:
Check for relative mount point.

2011-06-25 Werner Baumann (werner.baumann@onlinehome.de) 2011-06-25 Werner Baumann (werner.baumann@onlinehome.de)
* umount_davfs.c: * umount_davfs.c:
Quote mpoint in umount_command. Quote mpoint in umount_command.

View File

@ -756,9 +756,8 @@ check_mountpoint(dav_args *args)
{ {


struct passwd *pw; struct passwd *pw;
int relative = (*mpoint != '/');


if (relative && getuid() != 0) { if (args->relative_mpoint && getuid() != 0) {
pw = getpwuid(getuid()); pw = getpwuid(getuid());
if (!pw || !pw->pw_dir) if (!pw || !pw->pw_dir)
error(EXIT_FAILURE, 0, error(EXIT_FAILURE, 0,
@ -967,6 +966,7 @@ parse_commandline(int argc, char *argv[])
if (!mpoint) if (!mpoint)
error(EXIT_FAILURE, 0, error(EXIT_FAILURE, 0,
_("can't evaluate path of mount point %s"), mpoint); _("can't evaluate path of mount point %s"), mpoint);
args->relative_mpoint = (*argv[i] != '/');
break; break;
default: default:
error(0, 0, _("too many arguments")); error(0, 0, _("too many arguments"));
@ -1692,6 +1692,7 @@ new_args(void)
dav_args *args = ne_malloc(sizeof(*args)); dav_args *args = ne_malloc(sizeof(*args));


args->cmdline = NULL; args->cmdline = NULL;
args->relative_mpoint = 0;
args->dav_user = ne_strdup(DAV_USER); args->dav_user = ne_strdup(DAV_USER);
args->dav_group = ne_strdup(DAV_GROUP); args->dav_group = ne_strdup(DAV_GROUP);


@ -1793,6 +1794,8 @@ log_dbg_config(char *argv[], dav_args *args)
" url: %s", url); " url: %s", url);
syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG),
" mount point: %s", mpoint); " mount point: %s", mpoint);
syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG),
" relative_mpoint: %i", args->relative_mpoint);
syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG),
" dav_user: %s", args->dav_user); " dav_user: %s", args->dav_user);
syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG),

View File

@ -32,6 +32,7 @@
daemon mode. The rest will be freed when forking into daemon mode. */ daemon mode. The rest will be freed when forking into daemon mode. */
typedef struct { typedef struct {
char *cmdline; char *cmdline;
int relative_mpoint;
char *dav_user; /* System config file */ char *dav_user; /* System config file */
char *dav_group; /* System config file */ char *dav_group; /* System config file */
char *conf; /* Command line */ char *conf; /* Command line */