X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Faccess%2Fftp.c;h=70728ba3fd61f6feab734c2a6a90b0fbd1f8de78;hb=90a4caea90dbbb8c8b6d3a78f1671083b8694637;hp=7a1eeb9c6c6f481137a4394eff83df5fc076bb3e;hpb=7092d93f913fd49e9b34e50f30eb856226b28dfc;p=vlc diff --git a/modules/access/ftp.c b/modules/access/ftp.c index 7a1eeb9c6c..70728ba3fd 100644 --- a/modules/access/ftp.c +++ b/modules/access/ftp.c @@ -41,16 +41,16 @@ static void Close( vlc_object_t * ); #define CACHING_TEXT N_("Caching value in ms") #define CACHING_LONGTEXT N_( \ - "Allows you to modify the default caching value for FTP streams. This " \ - "value should be set in millisecond units." ) + "Caching value for FTP streams. This " \ + "value should be set in milliseconds." ) #define USER_TEXT N_("FTP user name") -#define USER_LONGTEXT N_("Allows you to modify the user name that will " \ +#define USER_LONGTEXT N_("User name that will " \ "be used for the connection.") #define PASS_TEXT N_("FTP password") -#define PASS_LONGTEXT N_("Allows you to modify the password that will be " \ +#define PASS_LONGTEXT N_("Password that will be " \ "used for the connection.") #define ACCOUNT_TEXT N_("FTP account") -#define ACCOUNT_LONGTEXT N_("Allows you to modify the account that will be " \ +#define ACCOUNT_LONGTEXT N_("Account that will be " \ "used for the connection.") vlc_module_begin(); @@ -122,8 +122,12 @@ static int Connect( access_t *p_access, access_sys_t *p_sys ) } msg_Dbg( p_access, "connection accepted (%d)", i_answer ); + + if( p_sys->url.psz_username && *p_sys->url.psz_username ) + psz = strdup( p_sys->url.psz_username ); + else + psz = var_CreateGetString( p_access, "ftp-user" ); - psz = var_CreateGetString( p_access, "ftp-user" ); if( ftp_SendCommand( p_access, "USER %s", psz ) < 0 || ftp_ReadCommand( p_access, &i_answer, NULL ) < 0 ) { @@ -139,7 +143,11 @@ static int Connect( access_t *p_access, access_sys_t *p_sys ) break; case 3: msg_Dbg( p_access, "password needed" ); - psz = var_CreateGetString( p_access, "ftp-pwd" ); + if( p_sys->url.psz_password && *p_sys->url.psz_password ) + psz = strdup( p_sys->url.psz_password ); + else + psz = var_CreateGetString( p_access, "ftp-pwd" ); + if( ftp_SendCommand( p_access, "PASS %s", psz ) < 0 || ftp_ReadCommand( p_access, &i_answer, NULL ) < 0 ) { @@ -199,18 +207,7 @@ static int Open( vlc_object_t *p_this ) char *psz_arg; /* Init p_access */ - p_access->pf_read = Read; - p_access->pf_block = NULL; - p_access->pf_seek = Seek; - p_access->pf_control = Control; - p_access->info.i_update = 0; - p_access->info.i_size = 0; - p_access->info.i_pos = 0; - p_access->info.b_eof = VLC_FALSE; - p_access->info.i_title = 0; - p_access->info.i_seekpoint = 0; - p_access->p_sys = p_sys = malloc( sizeof( access_sys_t ) ); - memset( p_sys, 0, sizeof( access_sys_t ) ); + STANDARD_READ_ACCESS_INIT p_sys->fd_cmd = -1; p_sys->fd_data = -1;