WordPress.org

Make WordPress Core

Ticket #10081: ssh-fix.diff

File ssh-fix.diff, 933 bytes (added by cjcollier, 5 years ago)

password is optional when connection_type is ssh

  • wp-admin/includes/file.php

     
    682682        else if ( !isset($credentials['connection_type']) || (isset($_POST['connection_type']) && 'ftp' == $_POST['connection_type']) ) 
    683683                $credentials['connection_type'] = 'ftp'; 
    684684 
    685         if ( ! $error && !empty($credentials['password']) && !empty($credentials['username']) && !empty($credentials['hostname']) ) { 
     685        if ( ! $error && 
     686             ( $credentials['connection_type'] == 'ssh' || !empty($credentials['password'])  )&& 
     687             !empty($credentials['username']) && 
     688             !empty($credentials['hostname']) ) { 
    686689                $stored_credentials = $credentials; 
    687690                if ( !empty($stored_credentials['port']) ) //save port as part of hostname to simplify above code. 
    688691                        $stored_credentials['hostname'] .= ':' . $stored_credentials['port'];