Lines Matching defs:sshc
331 struct ssh_conn *sshc = &conn->proto.sshc;
392 if(sshc->state != nowstate) {
394 (void *)sshc, names[sshc->state], names[nowstate]);
398 sshc->state = nowstate;
520 struct ssh_conn *sshc = &conn->proto.sshc;
524 const char *remotekey = libssh2_session_hostkey(sshc->ssh_session,
546 keycheck = libssh2_knownhost_check(sshc->kh,
595 result = sshc->actualcode = CURLE_PEER_FAILED_VERIFICATION;
603 int addrc = libssh2_knownhost_add(sshc->kh,
616 libssh2_knownhost_writefile(sshc->kh,
636 struct ssh_conn *sshc = &conn->proto.sshc;
642 const char *fingerprint = libssh2_hostkey_hash(sshc->ssh_session,
665 sshc->actualcode = CURLE_PEER_FAILED_VERIFICATION;
666 return sshc->actualcode;
690 struct ssh_conn *sshc = &conn->proto.sshc;
700 switch(sshc->state) {
702 sshc->secondCreateDirs = 0;
703 sshc->nextstate = SSH_NO_STATE;
704 sshc->actualcode = CURLE_OK;
708 libssh2_session_set_blocking(sshc->ssh_session, 0);
714 rc = libssh2_session_startup(sshc->ssh_session, (int)sock);
721 sshc->actualcode = CURLE_FAILED_INIT;
751 sshc->authlist = libssh2_userauth_list(sshc->ssh_session,
755 if(!sshc->authlist) {
756 if(libssh2_userauth_authenticated(sshc->ssh_session)) {
757 sshc->authed = TRUE;
762 else if((err = libssh2_session_last_errno(sshc->ssh_session)) ==
769 sshc->actualcode = libssh2_session_error_to_CURLE(err);
774 sshc->authlist);
784 sshc->authed = FALSE;
787 (strstr(sshc->authlist, "publickey") != NULL)) {
791 sshc->rsa_pub = sshc->rsa = NULL;
801 sshc->rsa_pub = aprintf("%s", data->set.str[STRING_SSH_PUBLIC_KEY]);
803 sshc->rsa_pub = aprintf("%s/.ssh/id_dsa.pub", home);
806 sshc->rsa_pub = strdup("id_dsa.pub");
808 if(!rsa_pub_empty_but_ok && (sshc->rsa_pub == NULL)) {
811 sshc->actualcode = CURLE_OUT_OF_MEMORY;
816 sshc->rsa = aprintf("%s", data->set.str[STRING_SSH_PRIVATE_KEY]);
818 sshc->rsa = aprintf("%s/.ssh/id_dsa", home);
821 sshc->rsa = strdup("id_dsa");
823 if(sshc->rsa == NULL) {
825 Curl_safefree(sshc->rsa_pub);
827 sshc->actualcode = CURLE_OUT_OF_MEMORY;
831 sshc->passphrase = data->set.str[STRING_KEY_PASSWD];
832 if(!sshc->passphrase)
833 sshc->passphrase = "";
837 infof(data, "Using ssh public key file %s\n", sshc->rsa_pub);
838 infof(data, "Using ssh private key file %s\n", sshc->rsa);
850 rc = libssh2_userauth_publickey_fromfile_ex(sshc->ssh_session,
854 sshc->rsa_pub,
855 sshc->rsa, sshc->passphrase);
860 Curl_safefree(sshc->rsa_pub);
861 Curl_safefree(sshc->rsa);
864 sshc->authed = TRUE;
870 (void)libssh2_session_last_error(sshc->ssh_session,
879 (strstr(sshc->authlist, "password") != NULL)) {
888 rc = libssh2_userauth_password_ex(sshc->ssh_session, conn->user,
897 sshc->authed = TRUE;
908 (strstr(sshc->authlist, "hostbased") != NULL)) {
923 && (strstr(sshc->authlist, "publickey") != NULL)) {
928 if(!sshc->ssh_agent) {
929 sshc->ssh_agent = libssh2_agent_init(sshc->ssh_session);
930 if(!sshc->ssh_agent) {
938 rc = libssh2_agent_connect(sshc->ssh_agent);
956 rc = libssh2_agent_list_identities(sshc->ssh_agent);
966 sshc->sshagent_prev_identity = NULL;
976 rc = libssh2_agent_get_identity(sshc->ssh_agent,
977 &sshc->sshagent_identity,
978 sshc->sshagent_prev_identity);
983 rc = libssh2_agent_userauth(sshc->ssh_agent, conn->user,
984 sshc->sshagent_identity);
989 sshc->sshagent_prev_identity = sshc->sshagent_identity;
1001 sshc->authed = TRUE;
1012 && (strstr(sshc->authlist, "keyboard-interactive") != NULL)) {
1022 rc = libssh2_userauth_keyboard_interactive_ex(sshc->ssh_session,
1031 sshc->authed = TRUE;
1038 if(!sshc->authed) {
1041 sshc->actualcode = CURLE_LOGIN_DENIED;
1067 sshc->sftp_session = libssh2_sftp_init(sshc->ssh_session);
1068 if(!sshc->sftp_session) {
1069 if(libssh2_session_last_errno(sshc->ssh_session) ==
1077 (void)libssh2_session_last_error(sshc->ssh_session,
1081 sshc->actualcode = CURLE_FAILED_INIT;
1095 rc = sftp_libssh2_realpath(sshc->sftp_session, ".",
1103 sshc->homedir = strdup(tempHome);
1104 if(!sshc->homedir) {
1106 sshc->actualcode = CURLE_OUT_OF_MEMORY;
1109 conn->data->state.most_recent_ftp_entrypath = sshc->homedir;
1113 err = sftp_libssh2_last_error(sshc->sftp_session);
1115 sshc->actualcode = result?result:CURLE_SSH;
1132 result = ssh_getworkingpath(conn, sshc->homedir, &sftp_scp->path);
1134 sshc->actualcode = result;
1141 sshc->quote_item = data->set.quote;
1152 sshc->quote_item = data->set.postquote;
1168 char *cmd = sshc->quote_item->data;
1169 sshc->acceptfail = FALSE;
1178 sshc->acceptfail = TRUE;
1188 sshc->nextstate = SSH_NO_STATE;
1202 sshc->nextstate = SSH_NO_STATE;
1203 sshc->actualcode = result;
1218 sshc->nextstate = SSH_NO_STATE;
1219 sshc->actualcode = CURLE_QUOTE_ERROR;
1227 result = get_pathname(&cp, &sshc->quote_path1);
1234 sshc->nextstate = SSH_NO_STATE;
1235 sshc->actualcode = result;
1250 /* sshc->quote_path1 contains the mode to set */
1252 result = get_pathname(&cp, &sshc->quote_path2);
1259 Curl_safefree(sshc->quote_path1);
1261 sshc->nextstate = SSH_NO_STATE;
1262 sshc->actualcode = result;
1265 memset(&sshc->quote_attrs, 0, sizeof(LIBSSH2_SFTP_ATTRIBUTES));
1272 /* sshc->quote_path1 is the source */
1274 result = get_pathname(&cp, &sshc->quote_path2);
1281 Curl_safefree(sshc->quote_path1);
1283 sshc->nextstate = SSH_NO_STATE;
1284 sshc->actualcode = result;
1299 result = get_pathname(&cp, &sshc->quote_path2);
1305 Curl_safefree(sshc->quote_path1);
1307 sshc->nextstate = SSH_NO_STATE;
1308 sshc->actualcode = result;
1325 Curl_safefree(sshc->quote_path1);
1326 Curl_safefree(sshc->quote_path2);
1328 sshc->nextstate = SSH_NO_STATE;
1329 sshc->actualcode = CURLE_QUOTE_ERROR;
1333 if(!sshc->quote_item) {
1339 Curl_safefree(sshc->quote_path1);
1340 Curl_safefree(sshc->quote_path2);
1342 sshc->quote_item = sshc->quote_item->next;
1344 if(sshc->quote_item) {
1348 if(sshc->nextstate != SSH_NO_STATE) {
1349 state(conn, sshc->nextstate);
1350 sshc->nextstate = SSH_NO_STATE;
1360 char *cmd = sshc->quote_item->data;
1361 sshc->acceptfail = FALSE;
1370 sshc->acceptfail = TRUE;
1378 rc = libssh2_sftp_stat_ex(sshc->sftp_session, sshc->quote_path2,
1379 curlx_uztoui(strlen(sshc->quote_path2)),
1381 &sshc->quote_attrs);
1385 else if(rc != 0 && !sshc->acceptfail) { /* get those attributes */
1386 err = sftp_libssh2_last_error(sshc->sftp_session);
1387 Curl_safefree(sshc->quote_path1);
1388 Curl_safefree(sshc->quote_path2);
1392 sshc->nextstate = SSH_NO_STATE;
1393 sshc->actualcode = CURLE_QUOTE_ERROR;
1400 sshc->quote_attrs.gid = strtoul(sshc->quote_path1, NULL, 10);
1401 sshc->quote_attrs.flags = LIBSSH2_SFTP_ATTR_UIDGID;
1402 if(sshc->quote_attrs.gid == 0 && !ISDIGIT(sshc->quote_path1[0]) &&
1403 !sshc->acceptfail) {
1404 Curl_safefree(sshc->quote_path1);
1405 Curl_safefree(sshc->quote_path2);
1408 sshc->nextstate = SSH_NO_STATE;
1409 sshc->actualcode = CURLE_QUOTE_ERROR;
1414 sshc->quote_attrs.permissions = strtoul(sshc->quote_path1, NULL, 8);
1415 sshc->quote_attrs.flags = LIBSSH2_SFTP_ATTR_PERMISSIONS;
1417 if(sshc->quote_attrs.permissions == 0 &&
1418 !ISDIGIT(sshc->quote_path1[0])) {
1419 Curl_safefree(sshc->quote_path1);
1420 Curl_safefree(sshc->quote_path2);
1423 sshc->nextstate = SSH_NO_STATE;
1424 sshc->actualcode = CURLE_QUOTE_ERROR;
1429 sshc->quote_attrs.uid = strtoul(sshc->quote_path1, NULL, 10);
1430 sshc->quote_attrs.flags = LIBSSH2_SFTP_ATTR_UIDGID;
1431 if(sshc->quote_attrs.uid == 0 && !ISDIGIT(sshc->quote_path1[0]) &&
1432 !sshc->acceptfail) {
1433 Curl_safefree(sshc->quote_path1);
1434 Curl_safefree(sshc->quote_path2);
1437 sshc->nextstate = SSH_NO_STATE;
1438 sshc->actualcode = CURLE_QUOTE_ERROR;
1449 rc = libssh2_sftp_stat_ex(sshc->sftp_session, sshc->quote_path2,
1450 curlx_uztoui(strlen(sshc->quote_path2)),
1452 &sshc->quote_attrs);
1456 else if(rc != 0 && !sshc->acceptfail) {
1457 err = sftp_libssh2_last_error(sshc->sftp_session);
1458 Curl_safefree(sshc->quote_path1);
1459 Curl_safefree(sshc->quote_path2);
1463 sshc->nextstate = SSH_NO_STATE;
1464 sshc->actualcode = CURLE_QUOTE_ERROR;
1471 rc = libssh2_sftp_symlink_ex(sshc->sftp_session, sshc->quote_path1,
1472 curlx_uztoui(strlen(sshc->quote_path1)),
1473 sshc->quote_path2,
1474 curlx_uztoui(strlen(sshc->quote_path2)),
1479 else if(rc != 0 && !sshc->acceptfail) {
1480 err = sftp_libssh2_last_error(sshc->sftp_session);
1481 Curl_safefree(sshc->quote_path1);
1482 Curl_safefree(sshc->quote_path2);
1486 sshc->nextstate = SSH_NO_STATE;
1487 sshc->actualcode = CURLE_QUOTE_ERROR;
1494 rc = libssh2_sftp_mkdir_ex(sshc->sftp_session, sshc->quote_path1,
1495 curlx_uztoui(strlen(sshc->quote_path1)),
1500 else if(rc != 0 && !sshc->acceptfail) {
1501 err = sftp_libssh2_last_error(sshc->sftp_session);
1502 Curl_safefree(sshc->quote_path1);
1505 sshc->nextstate = SSH_NO_STATE;
1506 sshc->actualcode = CURLE_QUOTE_ERROR;
1513 rc = libssh2_sftp_rename_ex(sshc->sftp_session, sshc->quote_path1,
1514 curlx_uztoui(strlen(sshc->quote_path1)),
1515 sshc->quote_path2,
1516 curlx_uztoui(strlen(sshc->quote_path2)),
1524 else if(rc != 0 && !sshc->acceptfail) {
1525 err = sftp_libssh2_last_error(sshc->sftp_session);
1526 Curl_safefree(sshc->quote_path1);
1527 Curl_safefree(sshc->quote_path2);
1530 sshc->nextstate = SSH_NO_STATE;
1531 sshc->actualcode = CURLE_QUOTE_ERROR;
1538 rc = libssh2_sftp_rmdir_ex(sshc->sftp_session, sshc->quote_path1,
1539 curlx_uztoui(strlen(sshc->quote_path1)));
1543 else if(rc != 0 && !sshc->acceptfail) {
1544 err = sftp_libssh2_last_error(sshc->sftp_session);
1545 Curl_safefree(sshc->quote_path1);
1548 sshc->nextstate = SSH_NO_STATE;
1549 sshc->actualcode = CURLE_QUOTE_ERROR;
1556 rc = libssh2_sftp_unlink_ex(sshc->sftp_session, sshc->quote_path1,
1557 curlx_uztoui(strlen(sshc->quote_path1)));
1561 else if(rc != 0 && !sshc->acceptfail) {
1562 err = sftp_libssh2_last_error(sshc->sftp_session);
1563 Curl_safefree(sshc->quote_path1);
1566 sshc->nextstate = SSH_NO_STATE;
1567 sshc->actualcode = CURLE_QUOTE_ERROR;
1597 rc = libssh2_sftp_stat_ex(sshc->sftp_session, sftp_scp->path,
1627 sshc->sftp_handle =
1628 libssh2_sftp_open_ex(sshc->sftp_session, sftp_scp->path,
1633 if(!sshc->sftp_handle) {
1634 rc = libssh2_session_last_errno(sshc->ssh_session);
1642 err = sftp_libssh2_last_error(sshc->sftp_session);
1646 if(sshc->secondCreateDirs) {
1648 sshc->actualcode = err>= LIBSSH2_FX_OK?
1660 sshc->secondCreateDirs = 1;
1665 sshc->actualcode = err>= LIBSSH2_FX_OK?
1667 if(!sshc->actualcode) {
1671 sshc->actualcode = CURLE_SSH;
1726 SFTP_SEEK(sshc->sftp_handle, data->state.resume_from);
1740 sshc->actualcode = result;
1745 sshc->orig_waitfor = data->req.keepon;
1764 sshc->slash_pos = sftp_scp->path + 1; /* ignore the leading '/' */
1773 if((sshc->slash_pos = strchr(sshc->slash_pos, '/')) != NULL) {
1774 *sshc->slash_pos = 0;
1787 rc = libssh2_sftp_mkdir_ex(sshc->sftp_session, sftp_scp->path,
1793 *sshc->slash_pos = '/';
1794 ++sshc->slash_pos;
1801 err = sftp_libssh2_last_error(sshc->sftp_session);
1807 sshc->actualcode = result?result:CURLE_SSH;
1825 sshc->sftp_handle = libssh2_sftp_open_ex(sshc->sftp_session,
1830 if(!sshc->sftp_handle) {
1831 if(libssh2_session_last_errno(sshc->ssh_session) ==
1837 err = sftp_libssh2_last_error(sshc->sftp_session);
1842 sshc->actualcode = result?result:CURLE_SSH;
1846 if((sshc->readdir_filename = malloc(PATH_MAX+1)) == NULL) {
1848 sshc->actualcode = CURLE_OUT_OF_MEMORY;
1851 if((sshc->readdir_longentry = malloc(PATH_MAX+1)) == NULL) {
1852 Curl_safefree(sshc->readdir_filename);
1854 sshc->actualcode = CURLE_OUT_OF_MEMORY;
1861 sshc->readdir_len = libssh2_sftp_readdir_ex(sshc->sftp_handle,
1862 sshc->readdir_filename,
1864 sshc->readdir_longentry,
1866 &sshc->readdir_attrs);
1867 if(sshc->readdir_len == LIBSSH2_ERROR_EAGAIN) {
1871 if(sshc->readdir_len > 0) {
1872 sshc->readdir_filename[sshc->readdir_len] = '\0';
1877 tmpLine = aprintf("%s\n", sshc->readdir_filename);
1880 sshc->actualcode = CURLE_OUT_OF_MEMORY;
1884 tmpLine, sshc->readdir_len+1);
1893 data->req.bytecount += sshc->readdir_len+1;
1897 Curl_debug(data, CURLINFO_DATA_OUT, sshc->readdir_filename,
1898 sshc->readdir_len, conn);
1902 sshc->readdir_currLen = (int)strlen(sshc->readdir_longentry);
1903 sshc->readdir_totalLen = 80 + sshc->readdir_currLen;
1904 sshc->readdir_line = calloc(sshc->readdir_totalLen, 1);
1905 if(!sshc->readdir_line) {
1906 Curl_safefree(sshc->readdir_filename);
1907 Curl_safefree(sshc->readdir_longentry);
1909 sshc->actualcode = CURLE_OUT_OF_MEMORY;
1913 memcpy(sshc->readdir_line, sshc->readdir_longentry,
1914 sshc->readdir_currLen);
1915 if((sshc->readdir_attrs.flags & LIBSSH2_SFTP_ATTR_PERMISSIONS) &&
1916 ((sshc->readdir_attrs.permissions & LIBSSH2_SFTP_S_IFMT) ==
1918 sshc->readdir_linkPath = malloc(PATH_MAX + 1);
1919 if(sshc->readdir_linkPath == NULL) {
1920 Curl_safefree(sshc->readdir_filename);
1921 Curl_safefree(sshc->readdir_longentry);
1923 sshc->actualcode = CURLE_OUT_OF_MEMORY;
1927 snprintf(sshc->readdir_linkPath, PATH_MAX, "%s%s", sftp_scp->path,
1928 sshc->readdir_filename);
1936 else if(sshc->readdir_len == 0) {
1937 Curl_safefree(sshc->readdir_filename);
1938 Curl_safefree(sshc->readdir_longentry);
1942 else if(sshc->readdir_len <= 0) {
1943 err = sftp_libssh2_last_error(sshc->sftp_session);
1945 sshc->actualcode = result?result:CURLE_SSH;
1948 libssh2_session_last_errno(sshc->ssh_session));
1949 Curl_safefree(sshc->readdir_filename);
1950 Curl_safefree(sshc->readdir_longentry);
1957 sshc->readdir_len =
1958 libssh2_sftp_symlink_ex(sshc->sftp_session,
1959 sshc->readdir_linkPath,
1960 curlx_uztoui(strlen(sshc->readdir_linkPath)),
1961 sshc->readdir_filename,
1963 if(sshc->readdir_len == LIBSSH2_ERROR_EAGAIN) {
1967 Curl_safefree(sshc->readdir_linkPath);
1970 sshc->readdir_totalLen += 4 + sshc->readdir_len;
1971 new_readdir_line = realloc(sshc->readdir_line, sshc->readdir_totalLen);
1973 Curl_safefree(sshc->readdir_line);
1974 Curl_safefree(sshc->readdir_filename);
1975 Curl_safefree(sshc->readdir_longentry);
1977 sshc->actualcode = CURLE_OUT_OF_MEMORY;
1980 sshc->readdir_line = new_readdir_line;
1982 sshc->readdir_currLen += snprintf(sshc->readdir_line +
1983 sshc->readdir_currLen,
1984 sshc->readdir_totalLen -
1985 sshc->readdir_currLen,
1987 sshc->readdir_filename);
1993 sshc->readdir_currLen += snprintf(sshc->readdir_line +
1994 sshc->readdir_currLen,
1995 sshc->readdir_totalLen -
1996 sshc->readdir_currLen, "\n");
1998 sshc->readdir_line,
1999 sshc->readdir_currLen);
2005 Curl_debug(data, CURLINFO_DATA_OUT, sshc->readdir_line,
2006 sshc->readdir_currLen, conn);
2008 data->req.bytecount += sshc->readdir_currLen;
2010 Curl_safefree(sshc->readdir_line);
2019 if(libssh2_sftp_closedir(sshc->sftp_handle) ==
2024 sshc->sftp_handle = NULL;
2025 Curl_safefree(sshc->readdir_filename);
2026 Curl_safefree(sshc->readdir_longentry);
2037 sshc->sftp_handle =
2038 libssh2_sftp_open_ex(sshc->sftp_session, sftp_scp->path,
2042 if(!sshc->sftp_handle) {
2043 if(libssh2_session_last_errno(sshc->ssh_session) ==
2049 err = sftp_libssh2_last_error(sshc->sftp_session);
2054 sshc->actualcode = result?result:CURLE_SSH;
2065 rc = libssh2_sftp_stat_ex(sshc->sftp_session, sftp_scp->path,
2118 SFTP_SEEK(conn->proto.sshc.sftp_handle, from);
2153 SFTP_SEEK(sshc->sftp_handle, data->state.resume_from);
2181 sshc->actualcode = result;
2189 if(sshc->sftp_handle) {
2190 rc = libssh2_sftp_close(sshc->sftp_handle);
2197 sshc->sftp_handle = NULL;
2207 if(sshc->nextstate != SSH_NO_STATE &&
2208 sshc->nextstate != SSH_SFTP_CLOSE) {
2209 state(conn, sshc->nextstate);
2210 sshc->nextstate = SSH_SFTP_CLOSE;
2214 result = sshc->actualcode;
2223 if(sshc->sftp_handle) {
2224 rc = libssh2_sftp_close(sshc->sftp_handle);
2231 sshc->sftp_handle = NULL;
2233 if(sshc->sftp_session) {
2234 rc = libssh2_sftp_shutdown(sshc->sftp_session);
2241 sshc->sftp_session = NULL;
2244 Curl_safefree(sshc->homedir);
2251 result = ssh_getworkingpath(conn, sshc->homedir, &sftp_scp->path);
2253 sshc->actualcode = result;
2261 sshc->actualcode = CURLE_UPLOAD_FAILED;
2279 sshc->ssh_channel =
2280 SCP_SEND(sshc->ssh_session, sftp_scp->path, data->set.new_file_perms,
2282 if(!sshc->ssh_channel) {
2283 if(libssh2_session_last_errno(sshc->ssh_session) ==
2292 ssh_err = (int)(libssh2_session_last_error(sshc->ssh_session,
2296 sshc->actualcode = libssh2_session_error_to_CURLE(ssh_err);
2310 sshc->actualcode = result;
2315 sshc->orig_waitfor = data->req.keepon;
2339 sshc->ssh_channel = libssh2_scp_recv(sshc->ssh_session,
2341 if(!sshc->ssh_channel) {
2342 if(libssh2_session_last_errno(sshc->ssh_session) ==
2351 ssh_err = (int)(libssh2_session_last_error(sshc->ssh_session,
2355 sshc->actualcode = libssh2_session_error_to_CURLE(ssh_err);
2375 sshc->actualcode = result;
2390 if(sshc->ssh_channel) {
2391 rc = libssh2_channel_send_eof(sshc->ssh_channel);
2403 if(sshc->ssh_channel) {
2404 rc = libssh2_channel_wait_eof(sshc->ssh_channel);
2416 if(sshc->ssh_channel) {
2417 rc = libssh2_channel_wait_closed(sshc->ssh_channel);
2429 if(sshc->ssh_channel) {
2430 rc = libssh2_channel_free(sshc->ssh_channel);
2437 sshc->ssh_channel = NULL;
2444 result = sshc->actualcode;
2451 if(sshc->ssh_channel) {
2452 rc = libssh2_channel_free(sshc->ssh_channel);
2459 sshc->ssh_channel = NULL;
2462 if(sshc->ssh_session) {
2463 rc = libssh2_session_disconnect(sshc->ssh_session, "Shutdown");
2472 Curl_safefree(sshc->homedir);
2480 if(sshc->kh) {
2481 libssh2_knownhost_free(sshc->kh);
2482 sshc->kh = NULL;
2487 if(sshc->ssh_agent) {
2488 rc = libssh2_agent_disconnect(sshc->ssh_agent);
2495 libssh2_agent_free (sshc->ssh_agent);
2496 sshc->ssh_agent = NULL;
2500 sshc->sshagent_identity = NULL;
2501 sshc->sshagent_prev_identity = NULL;
2505 if(sshc->ssh_session) {
2506 rc = libssh2_session_free(sshc->ssh_session);
2513 sshc->ssh_session = NULL;
2518 DEBUGASSERT(sshc->ssh_session == NULL);
2519 DEBUGASSERT(sshc->ssh_channel == NULL);
2520 DEBUGASSERT(sshc->sftp_session == NULL);
2521 DEBUGASSERT(sshc->sftp_handle == NULL);
2523 DEBUGASSERT(sshc->kh == NULL);
2526 DEBUGASSERT(sshc->ssh_agent == NULL);
2529 Curl_safefree(sshc->rsa_pub);
2530 Curl_safefree(sshc->rsa);
2532 Curl_safefree(sshc->quote_path1);
2533 Curl_safefree(sshc->quote_path2);
2535 Curl_safefree(sshc->homedir);
2537 Curl_safefree(sshc->readdir_filename);
2538 Curl_safefree(sshc->readdir_longentry);
2539 Curl_safefree(sshc->readdir_line);
2540 Curl_safefree(sshc->readdir_linkPath);
2543 result = sshc->actualcode;
2545 memset(sshc, 0, sizeof(struct ssh_conn));
2548 sshc->state = SSH_SESSION_FREE; /* current */
2549 sshc->nextstate = SSH_NO_STATE;
2557 sshc->nextstate = SSH_NO_STATE;
2562 } while(!rc && (sshc->state != SSH_STOP));
2631 struct ssh_conn *sshc = &conn->proto.sshc;
2633 if(block && (dir = libssh2_session_block_directions(sshc->ssh_session))) {
2641 conn->waitfor = sshc->orig_waitfor;
2651 struct ssh_conn *sshc = &conn->proto.sshc;
2657 *done = (sshc->state == SSH_STOP) ? TRUE : FALSE;
2666 struct ssh_conn *sshc = &conn->proto.sshc;
2670 while((sshc->state != SSH_STOP) && !result) {
2695 int dir = libssh2_session_block_directions(sshc->ssh_session);
2760 ssh = &conn->proto.sshc;
2869 struct ssh_conn *sshc = &conn->proto.sshc;
2875 sshc->actualcode = CURLE_OK; /* reset error code */
2876 sshc->secondCreateDirs =0; /* reset the create dir attempt state
2898 struct ssh_conn *ssh = &conn->proto.sshc;
2965 libssh2_channel_write(conn->proto.sshc.ssh_channel, mem, len);
2993 libssh2_channel_read(conn->proto.sshc.ssh_channel, mem, len);
3068 if(conn->proto.sshc.ssh_session) {
3083 struct ssh_conn *sshc = &conn->proto.sshc;
3090 sshc->nextstate = SSH_SFTP_POSTQUOTE_INIT;
3108 nwrite = libssh2_sftp_write(conn->proto.sshc.sftp_handle, mem, len);
3134 nread = libssh2_sftp_read(conn->proto.sshc.sftp_handle, mem, len);