Advertisement
Guest User

Untitled

a guest
Sep 30th, 2014
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. ** Initialises SSH Session **/
  2. ssh_session initialise_ssh(char* host, int port) {
  3.  
  4. ssh_session my_ssh_session;
  5. int verbosity = SSH_LOG_PROTOCOL;
  6.  
  7. my_ssh_session = ssh_new();
  8.  
  9. ssh_options_set(my_ssh_session, SSH_OPTIONS_HOST, host);
  10. ssh_options_set(my_ssh_session, SSH_OPTIONS_LOG_VERBOSITY, &verbosity);
  11. ssh_options_set(my_ssh_session, SSH_OPTIONS_PORT, &port);
  12.  
  13. rc = ssh_connect(current_session);
  14. if (rc != SSH_OK)
  15. {
  16. fprintf(stderr, "Error connecting host: %sn",
  17. ssh_get_error(current_session));
  18.  
  19. return my_ssh_session;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement