public override Session getSession(string user, string pass, string host, int port) { OpenSshConfig.Host hc = getConfig().lookup(host); host = hc.getHostName(); if (port <= 0) { port = hc.getPort(); } if (user == null) { user = hc.getUser(); } Session session = createSession(hc, user, host, port); if (pass != null) { session.setPassword(pass); } string strictHostKeyCheckingPolicy = hc.getStrictHostKeyChecking(); //if (strictHostKeyCheckingPolicy != null) // session.setConfig(); configure(hc, session); return(session); }
public override Session getSession(string user, string pass, string host, int port) { OpenSshConfig.Host hc = getConfig().lookup(host); host = hc.getHostName(); if (port <= 0) { port = hc.getPort(); } if (user == null) { user = hc.getUser(); } Session session = createSession(hc, user, host, port); if (pass != null) { session.setPassword(pass); } string strictHostKeyCheckingPolicy = hc.getStrictHostKeyChecking(); if (strictHostKeyCheckingPolicy != null) { var ht = new Hashtable(); ht.put("StrictHostKeyChecking", strictHostKeyCheckingPolicy); session.setConfig(ht); } string pauth = hc.getPreferredAuthentications(); if (pauth != null) { var ht = new Hashtable(); ht.put("PreferredAuthentications", pauth); session.setConfig(ht); } configure(hc, session); return(session); }