supply user with cifs; try guest first

This commit is contained in:
IgnorantGuru 2012-07-20 14:30:05 -06:00
parent f1740fdbbc
commit a2d30ac20c
2 changed files with 20 additions and 14 deletions

View File

@ -5,6 +5,7 @@
added default_options_ntfs to udevil.conf
[devmon 1.1.2] udevil clean on remove device #6
sshfs uses current user is none specified
supply user with cifs; try guest first
0.3.0 2012-07-13:
cifs,ftpfs dont quote username, double quote password #3
default udevil.conf: allow option flush

View File

@ -3339,19 +3339,8 @@ _get_type:
}
else if ( !strcmp( fstype, "smbfs" ) || !strcmp( fstype, "cifs" ) )
{
net_opts = g_strdup( "" );
if ( netmount->user )
{
str = net_opts;
net_opts = g_strdup_printf( "%s,user=%s", str, netmount->user );
g_free( str );
}
else
{
str = net_opts;
net_opts = g_strdup_printf( "%s,guest", str );
g_free( str );
}
net_opts = g_strdup_printf( "%s,user=%s", str,
netmount->user ? netmount->user : g_get_user_name() );
if ( netmount->pass )
{
str = net_opts;
@ -3753,7 +3742,23 @@ _get_type:
// mount
if ( type == MOUNT_NET )
ret = mount_device( netmount->url, fstype, options, point, TRUE );
{
ret = -1;
if ( ( !strcmp( fstype, "smbfs" ) || !strcmp( fstype, "cifs" ) )
&& !netmount->pass
&& validate_in_list( "allowed_options", fstype, "guest" ) )
{
// try cifs as guest first
wlog( "udevil: trying %s as guest\n", fstype, 1 );
str = g_strdup_printf( "%s,guest", options ? options : "" );
ret = mount_device( netmount->url, fstype, str, point, TRUE );
g_free( str );
if ( ret != 0 )
wlog( "udevil: trying %s as non-guest\n", fstype, 1 );
}
if ( ret != 0 )
ret = mount_device( netmount->url, fstype, options, point, TRUE );
}
else
ret = mount_device( data->device_file,
g_strcmp0( fstype, "file" ) ? fstype : NULL,