]> git.sesse.net Git - vlc/blobdiff - modules/access/ftp.c
D3D11: use defines for DXGI
[vlc] / modules / access / ftp.c
index bee388e61dae5244c204afc4dd733231c7bc82a1..e0dc37124f12714a628ea2e897deef2a8d9691dd 100644 (file)
@@ -62,12 +62,12 @@ static int  OutOpen ( vlc_object_t * );
 static void OutClose( vlc_object_t * );
 #endif
 
-#define USER_TEXT N_("FTP user name")
-#define USER_LONGTEXT N_("User name that will " \
-    "be used for the connection.")
-#define PASS_TEXT N_("FTP password")
-#define PASS_LONGTEXT N_("Password that will be " \
-    "used for the connection.")
+#define USER_TEXT N_("Username")
+#define USER_LONGTEXT N_("Username that will be used for the connection, " \
+        "if no username is set in the URL.")
+#define PASS_TEXT N_("Password")
+#define PASS_LONGTEXT N_("Password that will be used for the connection, " \
+        "if no username or password are set in URL.")
 #define ACCOUNT_TEXT N_("FTP account")
 #define ACCOUNT_LONGTEXT N_("Account that will be " \
     "used for the connection.")
@@ -286,7 +286,8 @@ static int createCmdTLS( vlc_object_t *p_access, access_sys_t *p_sys, int fd,
     /* TLS/SSL handshake */
     p_sys->cmd.p_tls = vlc_tls_ClientSessionCreate( p_sys->p_creds, fd,
                                                     p_sys->url.psz_host,
-                                                    psz_session_name );
+                                                    psz_session_name,
+                                                    NULL, NULL );
     if( p_sys->cmd.p_tls == NULL )
     {
         msg_Err( p_access, "cannot establish FTP/TLS session on command channel" );
@@ -309,7 +310,6 @@ static void clearCmdTLS( access_sys_t *p_sys )
 static int Login( vlc_object_t *p_access, access_sys_t *p_sys )
 {
     int i_answer;
-    char *psz;
 
     /* *** Open a TCP connection with server *** */
     int fd = p_sys->cmd.fd = net_ConnectTCP( p_access, p_sys->url.psz_host,
@@ -340,13 +340,6 @@ static int Login( vlc_object_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_InheritString( p_access, "ftp-user" );
-    if( !psz )
-        return -1;
-
     /* Features check first */
     if( ftp_SendCommand( p_access, p_sys, "FEAT" ) < 0
      || ftp_RecvAnswer( p_access, p_sys, NULL, NULL,
@@ -387,7 +380,6 @@ static int Login( vlc_object_t *p_access, access_sys_t *p_sys )
             i_answer != 200 )
         {
             msg_Err( p_access, "Can't truncate Protection buffer size for TLS" );
-            free( psz );
             goto error;
         }
 
@@ -396,12 +388,20 @@ static int Login( vlc_object_t *p_access, access_sys_t *p_sys )
             i_answer != 200 )
         {
             msg_Err( p_access, "Can't set Data channel protection" );
-            free( psz );
             goto error;
         }
     }
 
     /* Send credentials over channel */
+    char *psz;
+
+    if( p_sys->url.psz_username && *p_sys->url.psz_username )
+        psz = strdup( p_sys->url.psz_username );
+    else
+        psz = var_InheritString( p_access, "ftp-user" );
+    if( !psz )
+        goto error;
+
     if( ftp_SendCommand( p_access, p_sys, "USER %s", psz ) < 0 ||
         ftp_RecvCommand( p_access, p_sys, &i_answer, NULL ) < 0 )
     {
@@ -874,7 +874,6 @@ static int Control( access_t *p_access, int i_query, va_list args )
 
     switch( i_query )
     {
-        /* */
         case ACCESS_CAN_SEEK:
             pb_bool = (bool*)va_arg( args, bool* );
             *pb_bool = !p_access->p_sys->directory;
@@ -895,30 +894,19 @@ static int Control( access_t *p_access, int i_query, va_list args )
             *va_arg( args, uint64_t * ) = p_access->p_sys->size;
             break;
 
-        /* */
         case ACCESS_GET_PTS_DELAY:
             pi_64 = (int64_t*)va_arg( args, int64_t * );
             *pi_64 = INT64_C(1000)
                    * var_InheritInteger( p_access, "network-caching" );
             break;
 
-        /* */
         case ACCESS_SET_PAUSE_STATE:
             pb_bool = (bool*)va_arg( args, bool* );
             if ( !pb_bool )
               return Seek( p_access, p_access->info.i_pos );
             break;
 
-        case ACCESS_GET_TITLE_INFO:
-        case ACCESS_SET_TITLE:
-        case ACCESS_SET_SEEKPOINT:
-        case ACCESS_SET_PRIVATE_ID_STATE:
-        case ACCESS_GET_CONTENT_TYPE:
-        case ACCESS_GET_META:
-            return VLC_EGENERIC;
-
         default:
-            msg_Warn( p_access, "unimplemented query in control: %d", i_query);
             return VLC_EGENERIC;
 
     }
@@ -1040,7 +1028,8 @@ static int ftp_StartStream( vlc_object_t *p_access, access_sys_t *p_sys,
         p_sys->data.p_tls = vlc_tls_ClientSessionCreate( p_sys->p_creds,
                             p_sys->data.fd, p_sys->url.psz_host,
                             ( p_sys->tlsmode == EXPLICIT ) ? "ftpes-data"
-                                                           : "ftps-data" );
+                                                           : "ftps-data",
+                                                         NULL, NULL );
         if( p_sys->data.p_tls == NULL )
         {
             msg_Err( p_access, "cannot establish FTP/TLS session for data" \