• Home
  • Raw
  • Download

Lines Matching refs:sshc

242   struct ssh_conn *sshc = &conn->proto.sshc;  in mystate()  local
309 if(sshc->state != nowstate) { in mystate()
311 (void *) sshc, names[sshc->state], names[nowstate], in mystate()
316 sshc->state = nowstate; in mystate()
333 struct ssh_conn *sshc = &conn->proto.sshc; in myssh_is_known() local
352 rc = ssh_get_server_publickey(sshc->ssh_session, &pubkey); in myssh_is_known()
354 rc = ssh_get_publickey(sshc->ssh_session, &pubkey); in myssh_is_known()
393 vstate = ssh_session_get_known_hosts_entry(sshc->ssh_session, in myssh_is_known()
450 vstate = ssh_is_server_known(sshc->ssh_session); in myssh_is_known()
510 rc = ssh_session_update_known_hosts(sshc->ssh_session); in myssh_is_known()
512 rc = ssh_write_knownhost(sshc->ssh_session); in myssh_is_known()
554 sshc->actualcode = _r; \
560 sshc->actualcode = \
561 sftp_error_to_CURLE(sftp_get_error(sshc->sftp_session)); \
566 if(sshc->auth_methods & SSH_AUTH_METHOD_PASSWORD) { \
576 if(sshc->auth_methods & SSH_AUTH_METHOD_INTERACTIVE) { \
586 if(sshc->auth_methods & SSH_AUTH_METHOD_GSSAPI_MIC) { \
599 struct ssh_conn *sshc = &conn->proto.sshc; in myssh_auth_interactive() local
603 switch(sshc->kbd_state) { in myssh_auth_interactive()
605 rc = ssh_userauth_kbdint(sshc->ssh_session, NULL, NULL); in myssh_auth_interactive()
612 nprompts = ssh_userauth_kbdint_getnprompts(sshc->ssh_session); in myssh_auth_interactive()
616 rc = ssh_userauth_kbdint_setanswer(sshc->ssh_session, 0, conn->passwd); in myssh_auth_interactive()
622 sshc->kbd_state = 1; in myssh_auth_interactive()
624 rc = ssh_userauth_kbdint(sshc->ssh_session, NULL, NULL); in myssh_auth_interactive()
630 nprompts = ssh_userauth_kbdint_getnprompts(sshc->ssh_session); in myssh_auth_interactive()
634 sshc->kbd_state = 2; in myssh_auth_interactive()
641 sshc->kbd_state = 2; in myssh_auth_interactive()
643 rc = ssh_userauth_kbdint(sshc->ssh_session, NULL, NULL); in myssh_auth_interactive()
656 sshc->kbd_state = 0; in myssh_auth_interactive()
671 struct ssh_conn *sshc = &conn->proto.sshc; in myssh_statemach_act() local
680 switch(sshc->state) { in myssh_statemach_act()
682 sshc->secondCreateDirs = 0; in myssh_statemach_act()
683 sshc->nextstate = SSH_NO_STATE; in myssh_statemach_act()
684 sshc->actualcode = CURLE_OK; in myssh_statemach_act()
692 ssh_set_blocking(sshc->ssh_session, 0); in myssh_statemach_act()
698 rc = ssh_connect(sshc->ssh_session); in myssh_statemach_act()
726 sshc->authed = FALSE; in myssh_statemach_act()
728 rc = ssh_userauth_none(sshc->ssh_session, NULL); in myssh_statemach_act()
735 sshc->authed = TRUE; in myssh_statemach_act()
745 sshc->auth_methods = in myssh_statemach_act()
746 (unsigned int)ssh_userauth_list(sshc->ssh_session, NULL); in myssh_statemach_act()
747 if(sshc->auth_methods) in myssh_statemach_act()
749 sshc->auth_methods & SSH_AUTH_METHOD_PUBLICKEY ? in myssh_statemach_act()
751 sshc->auth_methods & SSH_AUTH_METHOD_GSSAPI_MIC ? in myssh_statemach_act()
753 sshc->auth_methods & SSH_AUTH_METHOD_INTERACTIVE ? in myssh_statemach_act()
755 sshc->auth_methods & SSH_AUTH_METHOD_PASSWORD ? in myssh_statemach_act()
757 if(sshc->auth_methods & SSH_AUTH_METHOD_PUBLICKEY) { in myssh_statemach_act()
761 else if(sshc->auth_methods & SSH_AUTH_METHOD_GSSAPI_MIC) { in myssh_statemach_act()
764 else if(sshc->auth_methods & SSH_AUTH_METHOD_INTERACTIVE) { in myssh_statemach_act()
767 else if(sshc->auth_methods & SSH_AUTH_METHOD_PASSWORD) { in myssh_statemach_act()
786 if(sshc->pubkey && !data->set.ssl.key_passwd) { in myssh_statemach_act()
787 rc = ssh_userauth_try_publickey(sshc->ssh_session, NULL, in myssh_statemach_act()
788 sshc->pubkey); in myssh_statemach_act()
803 NULL, &sshc->privkey); in myssh_statemach_act()
816 rc = ssh_userauth_publickey_auto(sshc->ssh_session, NULL, in myssh_statemach_act()
824 sshc->authed = TRUE; in myssh_statemach_act()
834 rc = ssh_userauth_publickey(sshc->ssh_session, NULL, sshc->privkey); in myssh_statemach_act()
841 sshc->authed = TRUE; in myssh_statemach_act()
858 rc = ssh_userauth_gssapi(sshc->ssh_session); in myssh_statemach_act()
866 sshc->authed = TRUE; in myssh_statemach_act()
891 sshc->authed = TRUE; in myssh_statemach_act()
909 rc = ssh_userauth_password(sshc->ssh_session, NULL, conn->passwd); in myssh_statemach_act()
916 sshc->authed = TRUE; in myssh_statemach_act()
926 if(!sshc->authed) { in myssh_statemach_act()
951 ssh_set_blocking(sshc->ssh_session, 1); in myssh_statemach_act()
953 sshc->sftp_session = sftp_new(sshc->ssh_session); in myssh_statemach_act()
954 if(!sshc->sftp_session) { in myssh_statemach_act()
956 ssh_get_error(sshc->ssh_session)); in myssh_statemach_act()
961 rc = sftp_init(sshc->sftp_session); in myssh_statemach_act()
964 ssh_get_error(sshc->ssh_session)); in myssh_statemach_act()
974 sshc->homedir = sftp_canonicalize_path(sshc->sftp_session, "."); in myssh_statemach_act()
975 if(!sshc->homedir) { in myssh_statemach_act()
979 data->state.most_recent_ftp_entrypath = sshc->homedir; in myssh_statemach_act()
990 result = Curl_getworkingpath(data, sshc->homedir, &protop->path); in myssh_statemach_act()
992 sshc->actualcode = result; in myssh_statemach_act()
999 sshc->quote_item = data->set.quote; in myssh_statemach_act()
1010 sshc->quote_item = data->set.postquote; in myssh_statemach_act()
1024 Curl_safefree(sshc->quote_path1); in myssh_statemach_act()
1025 Curl_safefree(sshc->quote_path2); in myssh_statemach_act()
1027 sshc->quote_item = sshc->quote_item->next; in myssh_statemach_act()
1029 if(sshc->quote_item) { in myssh_statemach_act()
1033 if(sshc->nextstate != SSH_NO_STATE) { in myssh_statemach_act()
1034 state(data, sshc->nextstate); in myssh_statemach_act()
1035 sshc->nextstate = SSH_NO_STATE; in myssh_statemach_act()
1048 rc = sftp_setstat(sshc->sftp_session, sshc->quote_path2, in myssh_statemach_act()
1049 sshc->quote_attrs); in myssh_statemach_act()
1050 if(rc && !sshc->acceptfail) { in myssh_statemach_act()
1051 Curl_safefree(sshc->quote_path1); in myssh_statemach_act()
1052 Curl_safefree(sshc->quote_path2); in myssh_statemach_act()
1054 ssh_get_error(sshc->ssh_session)); in myssh_statemach_act()
1056 sshc->nextstate = SSH_NO_STATE; in myssh_statemach_act()
1057 sshc->actualcode = CURLE_QUOTE_ERROR; in myssh_statemach_act()
1067 rc = sftp_symlink(sshc->sftp_session, sshc->quote_path2, in myssh_statemach_act()
1068 sshc->quote_path1); in myssh_statemach_act()
1069 if(rc && !sshc->acceptfail) { in myssh_statemach_act()
1070 Curl_safefree(sshc->quote_path1); in myssh_statemach_act()
1071 Curl_safefree(sshc->quote_path2); in myssh_statemach_act()
1073 ssh_get_error(sshc->ssh_session)); in myssh_statemach_act()
1075 sshc->nextstate = SSH_NO_STATE; in myssh_statemach_act()
1076 sshc->actualcode = CURLE_QUOTE_ERROR; in myssh_statemach_act()
1083 rc = sftp_mkdir(sshc->sftp_session, sshc->quote_path1, in myssh_statemach_act()
1085 if(rc && !sshc->acceptfail) { in myssh_statemach_act()
1086 Curl_safefree(sshc->quote_path1); in myssh_statemach_act()
1088 ssh_get_error(sshc->ssh_session)); in myssh_statemach_act()
1090 sshc->nextstate = SSH_NO_STATE; in myssh_statemach_act()
1091 sshc->actualcode = CURLE_QUOTE_ERROR; in myssh_statemach_act()
1098 rc = sftp_rename(sshc->sftp_session, sshc->quote_path1, in myssh_statemach_act()
1099 sshc->quote_path2); in myssh_statemach_act()
1100 if(rc && !sshc->acceptfail) { in myssh_statemach_act()
1101 Curl_safefree(sshc->quote_path1); in myssh_statemach_act()
1102 Curl_safefree(sshc->quote_path2); in myssh_statemach_act()
1104 ssh_get_error(sshc->ssh_session)); in myssh_statemach_act()
1106 sshc->nextstate = SSH_NO_STATE; in myssh_statemach_act()
1107 sshc->actualcode = CURLE_QUOTE_ERROR; in myssh_statemach_act()
1114 rc = sftp_rmdir(sshc->sftp_session, sshc->quote_path1); in myssh_statemach_act()
1115 if(rc && !sshc->acceptfail) { in myssh_statemach_act()
1116 Curl_safefree(sshc->quote_path1); in myssh_statemach_act()
1118 ssh_get_error(sshc->ssh_session)); in myssh_statemach_act()
1120 sshc->nextstate = SSH_NO_STATE; in myssh_statemach_act()
1121 sshc->actualcode = CURLE_QUOTE_ERROR; in myssh_statemach_act()
1128 rc = sftp_unlink(sshc->sftp_session, sshc->quote_path1); in myssh_statemach_act()
1129 if(rc && !sshc->acceptfail) { in myssh_statemach_act()
1130 Curl_safefree(sshc->quote_path1); in myssh_statemach_act()
1132 ssh_get_error(sshc->ssh_session)); in myssh_statemach_act()
1134 sshc->nextstate = SSH_NO_STATE; in myssh_statemach_act()
1135 sshc->actualcode = CURLE_QUOTE_ERROR; in myssh_statemach_act()
1145 statvfs = sftp_statvfs(sshc->sftp_session, sshc->quote_path1); in myssh_statemach_act()
1146 if(!statvfs && !sshc->acceptfail) { in myssh_statemach_act()
1147 Curl_safefree(sshc->quote_path1); in myssh_statemach_act()
1149 ssh_get_error(sshc->ssh_session)); in myssh_statemach_act()
1151 sshc->nextstate = SSH_NO_STATE; in myssh_statemach_act()
1152 sshc->actualcode = CURLE_QUOTE_ERROR; in myssh_statemach_act()
1184 sshc->nextstate = SSH_NO_STATE; in myssh_statemach_act()
1192 sshc->nextstate = SSH_NO_STATE; in myssh_statemach_act()
1193 sshc->actualcode = result; in myssh_statemach_act()
1213 attrs = sftp_stat(sshc->sftp_session, protop->path); in myssh_statemach_act()
1242 attrs = sftp_stat(sshc->sftp_session, protop->path); in myssh_statemach_act()
1270 if(sshc->sftp_file) in myssh_statemach_act()
1271 sftp_close(sshc->sftp_file); in myssh_statemach_act()
1272 sshc->sftp_file = in myssh_statemach_act()
1273 sftp_open(sshc->sftp_session, protop->path, in myssh_statemach_act()
1275 if(!sshc->sftp_file) { in myssh_statemach_act()
1276 err = sftp_get_error(sshc->sftp_session); in myssh_statemach_act()
1284 sshc->secondCreateDirs = 1; in myssh_statemach_act()
1344 rc = sftp_seek64(sshc->sftp_file, data->state.resume_from); in myssh_statemach_act()
1362 sshc->orig_waitfor = data->req.keepon; in myssh_statemach_act()
1374 sshc->sftp_send_state = 0; in myssh_statemach_act()
1382 sshc->slash_pos = protop->path + 1; /* ignore the leading '/' */ in myssh_statemach_act()
1391 sshc->slash_pos = strchr(sshc->slash_pos, '/'); in myssh_statemach_act()
1392 if(sshc->slash_pos) { in myssh_statemach_act()
1393 *sshc->slash_pos = 0; in myssh_statemach_act()
1404 rc = sftp_mkdir(sshc->sftp_session, protop->path, in myssh_statemach_act()
1406 *sshc->slash_pos = '/'; in myssh_statemach_act()
1407 ++sshc->slash_pos; in myssh_statemach_act()
1414 err = sftp_get_error(sshc->sftp_session); in myssh_statemach_act()
1437 sshc->sftp_dir = sftp_opendir(sshc->sftp_session, in myssh_statemach_act()
1439 if(!sshc->sftp_dir) { in myssh_statemach_act()
1441 ssh_get_error(sshc->ssh_session)); in myssh_statemach_act()
1449 Curl_dyn_reset(&sshc->readdir_buf); in myssh_statemach_act()
1450 if(sshc->readdir_attrs) in myssh_statemach_act()
1451 sftp_attributes_free(sshc->readdir_attrs); in myssh_statemach_act()
1453 sshc->readdir_attrs = sftp_readdir(sshc->sftp_session, sshc->sftp_dir); in myssh_statemach_act()
1454 if(sshc->readdir_attrs) { in myssh_statemach_act()
1455 sshc->readdir_filename = sshc->readdir_attrs->name; in myssh_statemach_act()
1456 sshc->readdir_longentry = sshc->readdir_attrs->longname; in myssh_statemach_act()
1457 sshc->readdir_len = strlen(sshc->readdir_filename); in myssh_statemach_act()
1462 tmpLine = aprintf("%s\n", sshc->readdir_filename); in myssh_statemach_act()
1465 sshc->actualcode = CURLE_OUT_OF_MEMORY; in myssh_statemach_act()
1469 tmpLine, sshc->readdir_len + 1); in myssh_statemach_act()
1479 if(Curl_dyn_add(&sshc->readdir_buf, sshc->readdir_longentry)) { in myssh_statemach_act()
1480 sshc->actualcode = CURLE_OUT_OF_MEMORY; in myssh_statemach_act()
1485 if((sshc->readdir_attrs->flags & SSH_FILEXFER_ATTR_PERMISSIONS) && in myssh_statemach_act()
1486 ((sshc->readdir_attrs->permissions & SSH_S_IFMT) == in myssh_statemach_act()
1488 sshc->readdir_linkPath = aprintf("%s%s", protop->path, in myssh_statemach_act()
1489 sshc->readdir_filename); in myssh_statemach_act()
1491 if(!sshc->readdir_linkPath) { in myssh_statemach_act()
1493 sshc->actualcode = CURLE_OUT_OF_MEMORY; in myssh_statemach_act()
1504 else if(sftp_dir_eof(sshc->sftp_dir)) { in myssh_statemach_act()
1510 ssh_get_error(sshc->ssh_session)); in myssh_statemach_act()
1517 if(sshc->readdir_link_attrs) in myssh_statemach_act()
1518 sftp_attributes_free(sshc->readdir_link_attrs); in myssh_statemach_act()
1520 sshc->readdir_link_attrs = sftp_lstat(sshc->sftp_session, in myssh_statemach_act()
1521 sshc->readdir_linkPath); in myssh_statemach_act()
1522 if(sshc->readdir_link_attrs == 0) { in myssh_statemach_act()
1524 ssh_get_error(sshc->ssh_session)); in myssh_statemach_act()
1529 if(!sshc->readdir_link_attrs->name) { in myssh_statemach_act()
1530 sshc->readdir_tmp = sftp_readlink(sshc->sftp_session, in myssh_statemach_act()
1531 sshc->readdir_linkPath); in myssh_statemach_act()
1532 if(!sshc->readdir_filename) in myssh_statemach_act()
1533 sshc->readdir_len = 0; in myssh_statemach_act()
1535 sshc->readdir_len = strlen(sshc->readdir_tmp); in myssh_statemach_act()
1536 sshc->readdir_longentry = NULL; in myssh_statemach_act()
1537 sshc->readdir_filename = sshc->readdir_tmp; in myssh_statemach_act()
1540 sshc->readdir_len = strlen(sshc->readdir_link_attrs->name); in myssh_statemach_act()
1541 sshc->readdir_filename = sshc->readdir_link_attrs->name; in myssh_statemach_act()
1542 sshc->readdir_longentry = sshc->readdir_link_attrs->longname; in myssh_statemach_act()
1545 Curl_safefree(sshc->readdir_linkPath); in myssh_statemach_act()
1547 if(Curl_dyn_addf(&sshc->readdir_buf, " -> %s", in myssh_statemach_act()
1548 sshc->readdir_filename)) { in myssh_statemach_act()
1549 sshc->actualcode = CURLE_OUT_OF_MEMORY; in myssh_statemach_act()
1553 sftp_attributes_free(sshc->readdir_link_attrs); in myssh_statemach_act()
1554 sshc->readdir_link_attrs = NULL; in myssh_statemach_act()
1555 sshc->readdir_filename = NULL; in myssh_statemach_act()
1556 sshc->readdir_longentry = NULL; in myssh_statemach_act()
1561 if(Curl_dyn_addn(&sshc->readdir_buf, "\n", 1)) in myssh_statemach_act()
1565 Curl_dyn_ptr(&sshc->readdir_buf), in myssh_statemach_act()
1566 Curl_dyn_len(&sshc->readdir_buf)); in myssh_statemach_act()
1568 ssh_string_free_char(sshc->readdir_tmp); in myssh_statemach_act()
1569 sshc->readdir_tmp = NULL; in myssh_statemach_act()
1579 sftp_closedir(sshc->sftp_dir); in myssh_statemach_act()
1580 sshc->sftp_dir = NULL; in myssh_statemach_act()
1591 if(sshc->sftp_file) in myssh_statemach_act()
1592 sftp_close(sshc->sftp_file); in myssh_statemach_act()
1594 sshc->sftp_file = sftp_open(sshc->sftp_session, protop->path, in myssh_statemach_act()
1596 if(!sshc->sftp_file) { in myssh_statemach_act()
1598 ssh_get_error(sshc->ssh_session)); in myssh_statemach_act()
1603 sftp_file_set_nonblocking(sshc->sftp_file); in myssh_statemach_act()
1612 attrs = sftp_fstat(sshc->sftp_file); in myssh_statemach_act()
1677 rc = sftp_seek64(sshc->sftp_file, from); in myssh_statemach_act()
1714 rc = sftp_seek64(sshc->sftp_file, data->state.resume_from); in myssh_statemach_act()
1744 sshc->actualcode = result; in myssh_statemach_act()
1747 sshc->sftp_recv_state = 0; in myssh_statemach_act()
1753 if(sshc->sftp_file) { in myssh_statemach_act()
1754 sftp_close(sshc->sftp_file); in myssh_statemach_act()
1755 sshc->sftp_file = NULL; in myssh_statemach_act()
1764 if(sshc->nextstate != SSH_NO_STATE && in myssh_statemach_act()
1765 sshc->nextstate != SSH_SFTP_CLOSE) { in myssh_statemach_act()
1766 state(data, sshc->nextstate); in myssh_statemach_act()
1767 sshc->nextstate = SSH_SFTP_CLOSE; in myssh_statemach_act()
1771 result = sshc->actualcode; in myssh_statemach_act()
1779 ssh_set_blocking(sshc->ssh_session, 0); in myssh_statemach_act()
1781 if(sshc->sftp_aio) { in myssh_statemach_act()
1782 sftp_aio_free(sshc->sftp_aio); in myssh_statemach_act()
1783 sshc->sftp_aio = NULL; in myssh_statemach_act()
1787 if(sshc->sftp_file) { in myssh_statemach_act()
1788 sftp_close(sshc->sftp_file); in myssh_statemach_act()
1789 sshc->sftp_file = NULL; in myssh_statemach_act()
1792 if(sshc->sftp_session) { in myssh_statemach_act()
1793 sftp_free(sshc->sftp_session); in myssh_statemach_act()
1794 sshc->sftp_session = NULL; in myssh_statemach_act()
1797 SSH_STRING_FREE_CHAR(sshc->homedir); in myssh_statemach_act()
1804 result = Curl_getworkingpath(data, sshc->homedir, &protop->path); in myssh_statemach_act()
1806 sshc->actualcode = result; in myssh_statemach_act()
1812 ssh_set_blocking(sshc->ssh_session, 1); in myssh_statemach_act()
1817 sshc->actualcode = CURLE_UPLOAD_FAILED; in myssh_statemach_act()
1822 sshc->scp_session = in myssh_statemach_act()
1823 ssh_scp_new(sshc->ssh_session, SSH_SCP_WRITE, protop->path); in myssh_statemach_act()
1827 sshc->scp_session = in myssh_statemach_act()
1828 ssh_scp_new(sshc->ssh_session, SSH_SCP_READ, protop->path); in myssh_statemach_act()
1832 if(!sshc->scp_session) { in myssh_statemach_act()
1833 err_msg = ssh_get_error(sshc->ssh_session); in myssh_statemach_act()
1842 rc = ssh_scp_init(sshc->scp_session); in myssh_statemach_act()
1844 err_msg = ssh_get_error(sshc->ssh_session); in myssh_statemach_act()
1850 rc = ssh_scp_push_file(sshc->scp_session, protop->path, in myssh_statemach_act()
1854 err_msg = ssh_get_error(sshc->ssh_session); in myssh_statemach_act()
1868 sshc->orig_waitfor = data->req.keepon; in myssh_statemach_act()
1881 rc = ssh_scp_init(sshc->scp_session); in myssh_statemach_act()
1883 err_msg = ssh_get_error(sshc->ssh_session); in myssh_statemach_act()
1894 rc = ssh_scp_pull_request(sshc->scp_session); in myssh_statemach_act()
1896 err_msg = ssh_get_error(sshc->ssh_session); in myssh_statemach_act()
1903 bytecount = ssh_scp_request_get_size(sshc->scp_session); in myssh_statemach_act()
1926 if(sshc->scp_session) { in myssh_statemach_act()
1927 rc = ssh_scp_close(sshc->scp_session); in myssh_statemach_act()
1936 ssh_get_error(sshc->ssh_session)); in myssh_statemach_act()
1944 if(sshc->scp_session) { in myssh_statemach_act()
1945 ssh_scp_free(sshc->scp_session); in myssh_statemach_act()
1946 sshc->scp_session = NULL; in myssh_statemach_act()
1950 ssh_set_blocking(sshc->ssh_session, 0); in myssh_statemach_act()
1959 if(sshc->scp_session) { in myssh_statemach_act()
1960 ssh_scp_free(sshc->scp_session); in myssh_statemach_act()
1961 sshc->scp_session = NULL; in myssh_statemach_act()
1964 ssh_disconnect(sshc->ssh_session); in myssh_statemach_act()
1972 SSH_STRING_FREE_CHAR(sshc->homedir); in myssh_statemach_act()
1978 if(sshc->ssh_session) { in myssh_statemach_act()
1979 ssh_free(sshc->ssh_session); in myssh_statemach_act()
1980 sshc->ssh_session = NULL; in myssh_statemach_act()
1985 DEBUGASSERT(sshc->ssh_session == NULL); in myssh_statemach_act()
1986 DEBUGASSERT(sshc->scp_session == NULL); in myssh_statemach_act()
1988 if(sshc->readdir_tmp) { in myssh_statemach_act()
1989 ssh_string_free_char(sshc->readdir_tmp); in myssh_statemach_act()
1990 sshc->readdir_tmp = NULL; in myssh_statemach_act()
1993 if(sshc->quote_attrs) in myssh_statemach_act()
1994 sftp_attributes_free(sshc->quote_attrs); in myssh_statemach_act()
1996 if(sshc->readdir_attrs) in myssh_statemach_act()
1997 sftp_attributes_free(sshc->readdir_attrs); in myssh_statemach_act()
1999 if(sshc->readdir_link_attrs) in myssh_statemach_act()
2000 sftp_attributes_free(sshc->readdir_link_attrs); in myssh_statemach_act()
2002 if(sshc->privkey) in myssh_statemach_act()
2003 ssh_key_free(sshc->privkey); in myssh_statemach_act()
2004 if(sshc->pubkey) in myssh_statemach_act()
2005 ssh_key_free(sshc->pubkey); in myssh_statemach_act()
2007 Curl_safefree(sshc->rsa_pub); in myssh_statemach_act()
2008 Curl_safefree(sshc->rsa); in myssh_statemach_act()
2009 Curl_safefree(sshc->quote_path1); in myssh_statemach_act()
2010 Curl_safefree(sshc->quote_path2); in myssh_statemach_act()
2011 Curl_dyn_free(&sshc->readdir_buf); in myssh_statemach_act()
2012 Curl_safefree(sshc->readdir_linkPath); in myssh_statemach_act()
2013 SSH_STRING_FREE_CHAR(sshc->homedir); in myssh_statemach_act()
2016 result = sshc->actualcode; in myssh_statemach_act()
2018 memset(sshc, 0, sizeof(struct ssh_conn)); in myssh_statemach_act()
2021 sshc->state = SSH_SESSION_FREE; /* current */ in myssh_statemach_act()
2022 sshc->nextstate = SSH_NO_STATE; in myssh_statemach_act()
2029 sshc->nextstate = SSH_NO_STATE; in myssh_statemach_act()
2034 } while(!rc && (sshc->state != SSH_STOP)); in myssh_statemach_act()
2072 struct ssh_conn *sshc = &conn->proto.sshc; in myssh_block2waitfor() local
2076 conn->waitfor = sshc->orig_waitfor; in myssh_block2waitfor()
2079 int dir = ssh_get_poll_flags(sshc->ssh_session); in myssh_block2waitfor()
2094 struct ssh_conn *sshc = &conn->proto.sshc; in myssh_multi_statemach() local
2099 *done = (sshc->state == SSH_STOP); in myssh_multi_statemach()
2109 struct ssh_conn *sshc = &conn->proto.sshc; in myssh_block_statemach() local
2112 while((sshc->state != SSH_STOP) && !result) { in myssh_block_statemach()
2155 struct ssh_conn *sshc = &conn->proto.sshc; in myssh_setup_connection() local
2160 Curl_dyn_init(&sshc->readdir_buf, CURL_PATH_MAX * 2); in myssh_setup_connection()
2197 ssh = &conn->proto.sshc; in myssh_connect()
2340 struct ssh_conn *sshc = &conn->proto.sshc; in myssh_do_it() local
2346 sshc->actualcode = CURLE_OK; /* reset error code */ in myssh_do_it()
2347 sshc->secondCreateDirs = 0; /* reset the create dir attempt state in myssh_do_it()
2371 struct ssh_conn *ssh = &conn->proto.sshc; in scp_disconnect()
2430 rc = ssh_scp_write(conn->proto.sshc.scp_session, mem, len); in scp_send()
2461 nread = ssh_scp_read(conn->proto.sshc.scp_session, mem, len); in scp_recv()
2540 if(conn->proto.sshc.ssh_session) { in sftp_disconnect()
2556 struct ssh_conn *sshc = &conn->proto.sshc; in sftp_done() local
2563 sshc->nextstate = SSH_SFTP_POSTQUOTE_INIT; in sftp_done()
2585 switch(conn->proto.sshc.sftp_send_state) { in sftp_send()
2587 sftp_file_set_nonblocking(conn->proto.sshc.sftp_file); in sftp_send()
2588 if(sftp_aio_begin_write(conn->proto.sshc.sftp_file, mem, len, in sftp_send()
2589 &conn->proto.sshc.sftp_aio) == SSH_ERROR) { in sftp_send()
2593 conn->proto.sshc.sftp_send_state = 1; in sftp_send()
2596 nwrite = sftp_aio_wait_write(&conn->proto.sshc.sftp_aio); in sftp_send()
2606 if(conn->proto.sshc.sftp_aio) { in sftp_send()
2607 sftp_aio_free(conn->proto.sshc.sftp_aio); in sftp_send()
2608 conn->proto.sshc.sftp_aio = NULL; in sftp_send()
2610 conn->proto.sshc.sftp_send_state = 0; in sftp_send()
2617 nwrite = sftp_write(conn->proto.sshc.sftp_file, mem, len); in sftp_send()
2650 switch(conn->proto.sshc.sftp_recv_state) { in sftp_recv()
2652 conn->proto.sshc.sftp_file_index = in sftp_recv()
2653 sftp_async_read_begin(conn->proto.sshc.sftp_file, in sftp_recv()
2655 if(conn->proto.sshc.sftp_file_index < 0) { in sftp_recv()
2662 conn->proto.sshc.sftp_recv_state = 1; in sftp_recv()
2664 nread = sftp_async_read(conn->proto.sshc.sftp_file, in sftp_recv()
2666 (uint32_t)conn->proto.sshc.sftp_file_index); in sftp_recv()
2679 conn->proto.sshc.sftp_recv_state = 0; in sftp_recv()
2693 struct ssh_conn *sshc = &conn->proto.sshc; in sftp_quote() local
2699 char *cmd = sshc->quote_item->data; in sftp_quote()
2700 sshc->acceptfail = FALSE; in sftp_quote()
2709 sshc->acceptfail = TRUE; in sftp_quote()
2717 sshc->actualcode = CURLE_OUT_OF_MEMORY; in sftp_quote()
2719 sshc->nextstate = SSH_NO_STATE; in sftp_quote()
2732 sshc->nextstate = SSH_NO_STATE; in sftp_quote()
2733 sshc->actualcode = result; in sftp_quote()
2748 sshc->nextstate = SSH_NO_STATE; in sftp_quote()
2749 sshc->actualcode = CURLE_QUOTE_ERROR; in sftp_quote()
2757 result = Curl_get_pathname(&cp, &sshc->quote_path1, sshc->homedir); in sftp_quote()
2764 sshc->nextstate = SSH_NO_STATE; in sftp_quote()
2765 sshc->actualcode = result; in sftp_quote()
2784 result = Curl_get_pathname(&cp, &sshc->quote_path2, sshc->homedir); in sftp_quote()
2791 Curl_safefree(sshc->quote_path1); in sftp_quote()
2793 sshc->nextstate = SSH_NO_STATE; in sftp_quote()
2794 sshc->actualcode = result; in sftp_quote()
2797 sshc->quote_attrs = NULL; in sftp_quote()
2806 result = Curl_get_pathname(&cp, &sshc->quote_path2, sshc->homedir); in sftp_quote()
2812 Curl_safefree(sshc->quote_path1); in sftp_quote()
2814 sshc->nextstate = SSH_NO_STATE; in sftp_quote()
2815 sshc->actualcode = result; in sftp_quote()
2830 result = Curl_get_pathname(&cp, &sshc->quote_path2, sshc->homedir); in sftp_quote()
2836 Curl_safefree(sshc->quote_path1); in sftp_quote()
2838 sshc->nextstate = SSH_NO_STATE; in sftp_quote()
2839 sshc->actualcode = result; in sftp_quote()
2862 Curl_safefree(sshc->quote_path1); in sftp_quote()
2863 Curl_safefree(sshc->quote_path2); in sftp_quote()
2865 sshc->nextstate = SSH_NO_STATE; in sftp_quote()
2866 sshc->actualcode = CURLE_QUOTE_ERROR; in sftp_quote()
2872 struct ssh_conn *sshc = &conn->proto.sshc; in sftp_quote_stat() local
2873 char *cmd = sshc->quote_item->data; in sftp_quote_stat()
2874 sshc->acceptfail = FALSE; in sftp_quote_stat()
2883 sshc->acceptfail = TRUE; in sftp_quote_stat()
2891 if(sshc->quote_attrs) in sftp_quote_stat()
2892 sftp_attributes_free(sshc->quote_attrs); in sftp_quote_stat()
2893 sshc->quote_attrs = sftp_stat(sshc->sftp_session, sshc->quote_path2); in sftp_quote_stat()
2894 if(!sshc->quote_attrs) { in sftp_quote_stat()
2895 Curl_safefree(sshc->quote_path1); in sftp_quote_stat()
2896 Curl_safefree(sshc->quote_path2); in sftp_quote_stat()
2898 sftp_get_error(sshc->sftp_session)); in sftp_quote_stat()
2900 sshc->nextstate = SSH_NO_STATE; in sftp_quote_stat()
2901 sshc->actualcode = CURLE_QUOTE_ERROR; in sftp_quote_stat()
2907 sshc->quote_attrs->gid = (uint32_t)strtoul(sshc->quote_path1, NULL, 10); in sftp_quote_stat()
2908 if(sshc->quote_attrs->gid == 0 && !ISDIGIT(sshc->quote_path1[0]) && in sftp_quote_stat()
2909 !sshc->acceptfail) { in sftp_quote_stat()
2910 Curl_safefree(sshc->quote_path1); in sftp_quote_stat()
2911 Curl_safefree(sshc->quote_path2); in sftp_quote_stat()
2914 sshc->nextstate = SSH_NO_STATE; in sftp_quote_stat()
2915 sshc->actualcode = CURLE_QUOTE_ERROR; in sftp_quote_stat()
2918 sshc->quote_attrs->flags |= SSH_FILEXFER_ATTR_UIDGID; in sftp_quote_stat()
2922 perms = (mode_t)strtoul(sshc->quote_path1, NULL, 8); in sftp_quote_stat()
2924 if(perms == 0 && !ISDIGIT(sshc->quote_path1[0])) { in sftp_quote_stat()
2925 Curl_safefree(sshc->quote_path1); in sftp_quote_stat()
2926 Curl_safefree(sshc->quote_path2); in sftp_quote_stat()
2929 sshc->nextstate = SSH_NO_STATE; in sftp_quote_stat()
2930 sshc->actualcode = CURLE_QUOTE_ERROR; in sftp_quote_stat()
2933 sshc->quote_attrs->permissions = perms; in sftp_quote_stat()
2934 sshc->quote_attrs->flags |= SSH_FILEXFER_ATTR_PERMISSIONS; in sftp_quote_stat()
2937 sshc->quote_attrs->uid = (uint32_t)strtoul(sshc->quote_path1, NULL, 10); in sftp_quote_stat()
2938 if(sshc->quote_attrs->uid == 0 && !ISDIGIT(sshc->quote_path1[0]) && in sftp_quote_stat()
2939 !sshc->acceptfail) { in sftp_quote_stat()
2940 Curl_safefree(sshc->quote_path1); in sftp_quote_stat()
2941 Curl_safefree(sshc->quote_path2); in sftp_quote_stat()
2944 sshc->nextstate = SSH_NO_STATE; in sftp_quote_stat()
2945 sshc->actualcode = CURLE_QUOTE_ERROR; in sftp_quote_stat()
2948 sshc->quote_attrs->flags |= SSH_FILEXFER_ATTR_UIDGID; in sftp_quote_stat()
2952 time_t date = Curl_getdate_capped(sshc->quote_path1); in sftp_quote_stat()
2965 Curl_safefree(sshc->quote_path1); in sftp_quote_stat()
2966 Curl_safefree(sshc->quote_path2); in sftp_quote_stat()
2968 sshc->nextstate = SSH_NO_STATE; in sftp_quote_stat()
2969 sshc->actualcode = CURLE_QUOTE_ERROR; in sftp_quote_stat()
2973 sshc->quote_attrs->atime = (uint32_t)date; in sftp_quote_stat()
2975 sshc->quote_attrs->mtime = (uint32_t)date; in sftp_quote_stat()
2977 sshc->quote_attrs->flags |= SSH_FILEXFER_ATTR_ACMODTIME; in sftp_quote_stat()