avformat/libssh: check the user provided a password before trying to use it
authorJames Almer <jamrial@gmail.com>
Sun, 11 Jun 2017 17:17:30 +0000 (14:17 -0300)
committerJames Almer <jamrial@gmail.com>
Thu, 11 Jan 2018 13:41:31 +0000 (10:41 -0300)
Fixes ticket #6413

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 8ddb6820bd52df6ed616abc3d8be200b126aa8c1)

libavformat/libssh.c

index 3c056f8..4cf7963 100644 (file)
@@ -103,7 +103,7 @@ static av_cold int libssh_authentication(LIBSSHContext *libssh, const char *user
         }
     }
 
-    if (!authorized && (auth_methods & SSH_AUTH_METHOD_PASSWORD)) {
+    if (!authorized && password && (auth_methods & SSH_AUTH_METHOD_PASSWORD)) {
         if (ssh_userauth_password(libssh->session, NULL, password) == SSH_AUTH_SUCCESS) {
             av_log(libssh, AV_LOG_DEBUG, "Authentication successful with password.\n");
             authorized = 1;