MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / libssh_create_ssh_session

Function libssh_create_ssh_session

libavformat/libssh.c:45–71  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43} LIBSSHContext;
44
45static av_cold int libssh_create_ssh_session(LIBSSHContext *libssh, const char* hostname, unsigned int port)
46{
47 static const int verbosity = SSH_LOG_NOLOG;
48
49 if (!(libssh->session = ssh_new())) {
50 av_log(libssh, AV_LOG_ERROR, "SSH session creation failed: %s\n", ssh_get_error(libssh->session));
51 return AVERROR(ENOMEM);
52 }
53 ssh_options_set(libssh->session, SSH_OPTIONS_HOST, hostname);
54 ssh_options_set(libssh->session, SSH_OPTIONS_PORT, &port);
55 ssh_options_set(libssh->session, SSH_OPTIONS_LOG_VERBOSITY, &verbosity);
56 if (libssh->rw_timeout > 0) {
57 long timeout = libssh->rw_timeout * 1000;
58 ssh_options_set(libssh->session, SSH_OPTIONS_TIMEOUT_USEC, &timeout);
59 }
60
61 if (ssh_options_parse_config(libssh->session, NULL) < 0) {
62 av_log(libssh, AV_LOG_WARNING, "Could not parse the config file.\n");
63 }
64
65 if (ssh_connect(libssh->session) != SSH_OK) {
66 av_log(libssh, AV_LOG_ERROR, "Connection failed: %s\n", ssh_get_error(libssh->session));
67 return AVERROR(EIO);
68 }
69
70 return 0;
71}
72
73static av_cold int libssh_authentication(LIBSSHContext *libssh, const char *user, const char *password)
74{

Callers 1

libssh_connectFunction · 0.85

Calls 1

av_logFunction · 0.85

Tested by

no test coverage detected