From 2eeb5f0535a7e81ff94cf28fe6023589f9a7bece Mon Sep 17 00:00:00 2001 From: IgnorantGuru Date: Fri, 3 Aug 2012 06:35:09 -0600 Subject: [PATCH] accept smb workgroup/user --- ChangeLog | 1 + etc/udevil.conf | 4 ++-- src/udevil.c | 26 ++++++++++++++++++-------- 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 51f9ef0..16c20bb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,6 @@ 0.3.1+ added remove to remove devices safely (under development) + accept smb workgroup/user 0.3.1 2012-07-25: cifs,smbfs use guest option when no user specified sshfs add port as option diff --git a/etc/udevil.conf b/etc/udevil.conf index 162e6c7..d8afbc8 100644 --- a/etc/udevil.conf +++ b/etc/udevil.conf @@ -240,8 +240,8 @@ default_options_ramfs = nosuid, noexec, nodev, noatime, uid=$UID, gid=$GID # WARNING: OPTIONS HERE CAN CAUSE SERIOUS SECURITY PROBLEMS - CHOOSE CAREFULLY allowed_options = nosuid, noexec, nodev, noatime, fmask=0022, dmask=0022, uid=$UID, gid=$GID, ro, rw, sync, flush, remount allowed_options_nfs = nosuid, noexec, nodev, noatime, ro, rw, sync, remount, port=*, rsize=*, wsize=*, hard, proto=*, timeo=*, retrans=* -allowed_options_cifs = nosuid, noexec, nodev, ro, rw, remount, port=*, user=*, username=*, pass=*, password=*, guest, uid=$UID, gid=$GID, credentials=* -allowed_options_smbfs = nosuid, noexec, nodev, ro, rw, remount, port=*, user=*, username=*, pass=*, password=*, guest, uid=$UID, gid=$GID, credentials=* +allowed_options_cifs = nosuid, noexec, nodev, ro, rw, remount, port=*, user=*, username=*, pass=*, password=*, guest, domain=*, uid=$UID, gid=$GID, credentials=* +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 allowed_options_ftpfs = nosuid, noexec, nodev, noatime, ro, rw, port=*, user=*, pass=*, ip=*, root=*, uid=$UID, gid=$GID diff --git a/src/udevil.c b/src/udevil.c index d46379b..487c26f 100644 --- a/src/udevil.c +++ b/src/udevil.c @@ -2366,17 +2366,10 @@ static int parse_network_url( const char* url, const char* fstype, { xurl = str + 1; } - while ( xurl[0] == '/' ) xurl++; char* trim_url = g_strdup( xurl ); - // path - if ( str = strchr( xurl, '/' ) ) - { - nm->path = g_strdup( str ); - str[0] = '\0'; - } // user:pass if ( str = strchr( xurl, '@' ) ) { @@ -2391,6 +2384,12 @@ static int parse_network_url( const char* url, const char* fstype, nm->user = g_strdup( xurl ); xurl = str + 1; } + // path + if ( str = strchr( xurl, '/' ) ) + { + nm->path = g_strdup( str ); + str[0] = '\0'; + } // host:port if ( xurl[0] == '[' ) { @@ -3376,7 +3375,17 @@ _get_type: else if ( !strcmp( fstype, "smbfs" ) || !strcmp( fstype, "cifs" ) ) { if ( netmount->user ) - net_opts = g_strdup_printf( "user=%s", netmount->user ); + { + if ( str = strchr( netmount->user, '/' ) ) + { + // domain included DOMAIN/USER@HOST + str[0] = '\0'; + net_opts = g_strdup_printf( "user=%s,domain=%s", str + 1, netmount->user ); + str[0] = '/'; + } + else + net_opts = g_strdup_printf( "user=%s", netmount->user ); + } else net_opts = g_strdup( "" ); if ( netmount->pass ) @@ -4540,6 +4549,7 @@ static void show_help() printf( " udevil mount sys.domain:/share # %s\n", _("nfs share") ); printf( " udevil mount smb://sys.domain/share # %s\n", _("samba share w/ cifs") ); printf( " udevil mount smb://user:pass@10.0.0.1:50/share # %s\n", _("samba share w/ u/p/port") ); + printf( " udevil mount smb://workgroup/user@sys.domain # %s\n", _("samba share w/ workgroup") ); printf( " udevil mount //sys.domain/share # %s\n", _("samba share w/ cifs") ); printf( " udevil mount //sys.domain/share -t smbfs # %s\n", _("samba share w/ smbfs") ); printf( " udevil mount ssh://user@sys.domain # %s\n", _("sshfs with user - ") );