From ec1b3d68f36f463875a5a302db7a67d14375ff7b Mon Sep 17 00:00:00 2001 From: IgnorantGuru Date: Sun, 26 Apr 2015 12:33:21 -0600 Subject: [PATCH] udevil.conf allowed_options_ftpfs remove ip=*; add ip= after test #46 --- ChangeLog | 1 + etc/udevil.conf | 2 +- src/udevil.c | 22 ++++++++++++++++++---- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2f5eecc..e1264a0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,7 @@ [devmon 1.1.8] improve --exec-on-unmount for mounted during startup [devmon 1.1.8] unset %d %l for --exec-on-unmount #56 special handling for cifs mount ipv6 literal #46; retain literal host + udevil.conf allowed_options_ftpfs remove ip=*; add ip= after test #46 0.4.3 2013-12-09: fix default udevil.conf allowed_options missing fmask=0133 #35 0.4.2 2013-12-04: diff --git a/etc/udevil.conf b/etc/udevil.conf index c2e799a..7be75ee 100644 --- a/etc/udevil.conf +++ b/etc/udevil.conf @@ -248,7 +248,7 @@ allowed_options_cifs = nosuid, noexec, nodev, ro, rw, remount, port=*, user allowed_options_smbfs = nosuid, noexec, nodev, ro, rw, remount, port=*, user=*, username=*, pass=*, password=*, guest, domain=*, uid=$UID, gid=$GID, credentials=* allowed_options_sshfs = nosuid, noexec, nodev, noatime, ro, rw, uid=$UID, gid=$GID, nonempty, allow_other, idmap=user, BatchMode=yes, port=* allowed_options_curlftpfs = nosuid, noexec, nodev, noatime, ro, rw, uid=$UID, gid=$GID, nonempty, allow_other, user=* -allowed_options_ftpfs = nosuid, noexec, nodev, noatime, ro, rw, port=*, user=*, pass=*, ip=*, root=*, uid=$UID, gid=$GID +allowed_options_ftpfs = nosuid, noexec, nodev, noatime, ro, rw, port=*, user=*, pass=*, root=*, uid=$UID, gid=$GID # mount_point_mode, if present and set to a non-empty value, will cause udevil diff --git a/src/udevil.c b/src/udevil.c index 4e10491..1ef4275 100644 --- a/src/udevil.c +++ b/src/udevil.c @@ -3617,7 +3617,7 @@ _get_type: { // ftpfs // eg mount -n -t ftpfs none /mnt/ftpfs -o ip=192.168.1.100 user=jim pass=123abc port=21 root=/pub/updates - net_opts = g_strdup_printf( "ip=%s", netmount->ip ); + net_opts = g_strdup( "" ); if ( netmount->user ) { str = net_opts; @@ -3782,6 +3782,8 @@ _get_type: } // add option ip= for cifs ipv6 literal + // This is done after valid options test since ip= should not be + // an allowed option if ( type == MOUNT_NET && ( !strcmp( fstype, "smbfs" ) || !strcmp( fstype, "cifs" ) ) ) { @@ -3790,13 +3792,25 @@ _get_type: g_str_has_suffix( netmount->host, "]" ) ) { // ipv6 literal as host - cifs requires special ip= option - // This is done after valid options test since ip= should not be - // an allowed option str = options; - options = g_strdup_printf( "%s,ip=%s", str, netmount->ip ); + options = g_strdup_printf( "%s%sip=%s", str && str[0] ? str : "", + str && str[0] ? "," : "", + netmount->ip ); g_free( str ); } } + + // add option ip= for ftpfs + // This is done after valid options test since ip= should not be + // an allowed option + if ( type == MOUNT_NET && !strcmp( fstype, "ftpfs" ) ) + { + str = options; + options = g_strdup_printf( "%s%sip=%s", str && str[0] ? str : "", + str && str[0] ? "," : "", + netmount->ip ); + g_free( str ); + } // no point and not remount if ( !data->point && !remount )