From 58f2e0ad049a9e3168ade2c057006877fdae5046 Mon Sep 17 00:00:00 2001 From: IgnorantGuru Date: Mon, 11 Feb 2013 06:51:31 -0700 Subject: [PATCH] fix -t with net fstype without protocol --- ChangeLog | 1 + src/udevil.c | 23 ++++++++++++++++------- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index c47eb7d..24ffde5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,7 @@ debian package add XXXXXXXX to mktemp template [dist] [devmon] get pmount mount point after mount #20 move debian/ to distros/debian/ and update README + fix -t with net fstype without protocol 0.3.6 2012-12-16: file mount prevent race conditions disallow remount of file due to potential race conditions diff --git a/src/udevil.c b/src/udevil.c index f3fbda7..6730e53 100644 --- a/src/udevil.c +++ b/src/udevil.c @@ -2425,11 +2425,6 @@ static int parse_network_url( const char* url, const char* fstype, nm->pass = NULL; nm->path = NULL; - if ( fstype && ( !strcmp( fstype, "nfs" ) || !strcmp( fstype, "smbfs" ) - || !strcmp( fstype, "cifs" ) || !strcmp( fstype, "sshfs" ) - || !strcmp( fstype, "nfs4" ) ) ) - ret = 2; //invalid as default response - char* orig_url = strdup( url ); char* xurl = orig_url; gboolean is_colon = FALSE; @@ -2556,6 +2551,18 @@ static int parse_network_url( const char* url, const char* fstype, } str[0] = ':'; } + else if ( fstype && ( !strcmp( fstype, "nfs" ) || + !strcmp( fstype, "nfs4" ) || + !strcmp( fstype, "smbfs" ) || + !strcmp( fstype, "cifs" ) || + !strcmp( fstype, "sshfs" ) || + !strcmp( fstype, "curlftpfs" ) || + !strcmp( fstype, "ftpfs" ) ) ) + { + // no protocol but user specified a valid network fstype + ret = 2; + nm->fstype = g_strdup( fstype ); + } if ( ret != 2 ) goto _net_free; @@ -2588,12 +2595,14 @@ 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] == '[' ) { @@ -2621,9 +2630,9 @@ static int parse_network_url( const char* url, const char* fstype, // url if ( nm->host ) { - if ( !strcmp( nm->fstype, "cifs" ) || !strcmp( nm->fstype, "smbfs" ) ) + if ( !g_strcmp0( nm->fstype, "cifs" ) || !g_strcmp0( nm->fstype, "smbfs" ) ) nm->url = g_strdup_printf( "//%s%s", nm->host, nm->path ? nm->path : "/" ); - else if ( !strcmp( nm->fstype, "nfs" ) ) + else if ( !g_strcmp0( nm->fstype, "nfs" ) ) nm->url = g_strdup_printf( "%s:%s", nm->host, nm->path ? nm->path : "/" ); else if ( !g_strcmp0( nm->fstype, "curlftpfs" ) ) nm->url = g_strdup_printf( "curlftpfs#ftp://%s%s%s%s",