Lines Matching refs:sshc
240 struct ssh_conn *sshc = &conn->proto.sshc; in mystate() local
307 if(sshc->state != nowstate) { in mystate()
309 (void *) sshc, names[sshc->state], names[nowstate], in mystate()
314 sshc->state = nowstate; in mystate()
331 struct ssh_conn *sshc = &conn->proto.sshc; in myssh_is_known() local
350 rc = ssh_get_server_publickey(sshc->ssh_session, &pubkey); in myssh_is_known()
352 rc = ssh_get_publickey(sshc->ssh_session, &pubkey); in myssh_is_known()
391 vstate = ssh_session_get_known_hosts_entry(sshc->ssh_session, in myssh_is_known()
448 vstate = ssh_is_server_known(sshc->ssh_session); in myssh_is_known()
508 rc = ssh_session_update_known_hosts(sshc->ssh_session); in myssh_is_known()
510 rc = ssh_write_knownhost(sshc->ssh_session); in myssh_is_known()
552 sshc->actualcode = _r; \
558 sshc->actualcode = \
559 sftp_error_to_CURLE(sftp_get_error(sshc->sftp_session)); \
564 if(sshc->auth_methods & SSH_AUTH_METHOD_PASSWORD) { \
574 if(sshc->auth_methods & SSH_AUTH_METHOD_INTERACTIVE) { \
584 if(sshc->auth_methods & SSH_AUTH_METHOD_GSSAPI_MIC) { \
597 struct ssh_conn *sshc = &conn->proto.sshc; in myssh_auth_interactive() local
601 switch(sshc->kbd_state) { in myssh_auth_interactive()
603 rc = ssh_userauth_kbdint(sshc->ssh_session, NULL, NULL); in myssh_auth_interactive()
610 nprompts = ssh_userauth_kbdint_getnprompts(sshc->ssh_session); in myssh_auth_interactive()
614 rc = ssh_userauth_kbdint_setanswer(sshc->ssh_session, 0, conn->passwd); in myssh_auth_interactive()
620 sshc->kbd_state = 1; in myssh_auth_interactive()
622 rc = ssh_userauth_kbdint(sshc->ssh_session, NULL, NULL); in myssh_auth_interactive()
628 nprompts = ssh_userauth_kbdint_getnprompts(sshc->ssh_session); in myssh_auth_interactive()
632 sshc->kbd_state = 2; in myssh_auth_interactive()
639 sshc->kbd_state = 2; in myssh_auth_interactive()
641 rc = ssh_userauth_kbdint(sshc->ssh_session, NULL, NULL); in myssh_auth_interactive()
654 sshc->kbd_state = 0; in myssh_auth_interactive()
669 struct ssh_conn *sshc = &conn->proto.sshc; in myssh_statemach_act() local
678 switch(sshc->state) { in myssh_statemach_act()
680 sshc->secondCreateDirs = 0; in myssh_statemach_act()
681 sshc->nextstate = SSH_NO_STATE; in myssh_statemach_act()
682 sshc->actualcode = CURLE_OK; in myssh_statemach_act()
690 ssh_set_blocking(sshc->ssh_session, 0); in myssh_statemach_act()
696 rc = ssh_connect(sshc->ssh_session); in myssh_statemach_act()
724 sshc->authed = FALSE; in myssh_statemach_act()
726 rc = ssh_userauth_none(sshc->ssh_session, NULL); in myssh_statemach_act()
733 sshc->authed = TRUE; in myssh_statemach_act()
743 sshc->auth_methods = in myssh_statemach_act()
744 (unsigned int)ssh_userauth_list(sshc->ssh_session, NULL); in myssh_statemach_act()
745 if(sshc->auth_methods) in myssh_statemach_act()
747 sshc->auth_methods & SSH_AUTH_METHOD_PUBLICKEY ? in myssh_statemach_act()
749 sshc->auth_methods & SSH_AUTH_METHOD_GSSAPI_MIC ? in myssh_statemach_act()
751 sshc->auth_methods & SSH_AUTH_METHOD_INTERACTIVE ? in myssh_statemach_act()
753 sshc->auth_methods & SSH_AUTH_METHOD_PASSWORD ? in myssh_statemach_act()
755 if(sshc->auth_methods & SSH_AUTH_METHOD_PUBLICKEY) { in myssh_statemach_act()
759 else if(sshc->auth_methods & SSH_AUTH_METHOD_GSSAPI_MIC) { in myssh_statemach_act()
762 else if(sshc->auth_methods & SSH_AUTH_METHOD_INTERACTIVE) { in myssh_statemach_act()
765 else if(sshc->auth_methods & SSH_AUTH_METHOD_PASSWORD) { in myssh_statemach_act()
784 if(sshc->pubkey && !data->set.ssl.key_passwd) { in myssh_statemach_act()
785 rc = ssh_userauth_try_publickey(sshc->ssh_session, NULL, in myssh_statemach_act()
786 sshc->pubkey); in myssh_statemach_act()
801 NULL, &sshc->privkey); in myssh_statemach_act()
814 rc = ssh_userauth_publickey_auto(sshc->ssh_session, NULL, in myssh_statemach_act()
822 sshc->authed = TRUE; in myssh_statemach_act()
832 rc = ssh_userauth_publickey(sshc->ssh_session, NULL, sshc->privkey); in myssh_statemach_act()
839 sshc->authed = TRUE; in myssh_statemach_act()
856 rc = ssh_userauth_gssapi(sshc->ssh_session); in myssh_statemach_act()
864 sshc->authed = TRUE; in myssh_statemach_act()
889 sshc->authed = TRUE; in myssh_statemach_act()
907 rc = ssh_userauth_password(sshc->ssh_session, NULL, conn->passwd); in myssh_statemach_act()
914 sshc->authed = TRUE; in myssh_statemach_act()
924 if(!sshc->authed) { in myssh_statemach_act()
949 ssh_set_blocking(sshc->ssh_session, 1); in myssh_statemach_act()
951 sshc->sftp_session = sftp_new(sshc->ssh_session); in myssh_statemach_act()
952 if(!sshc->sftp_session) { in myssh_statemach_act()
954 ssh_get_error(sshc->ssh_session)); in myssh_statemach_act()
959 rc = sftp_init(sshc->sftp_session); in myssh_statemach_act()
962 ssh_get_error(sshc->ssh_session)); in myssh_statemach_act()
972 sshc->homedir = sftp_canonicalize_path(sshc->sftp_session, "."); in myssh_statemach_act()
973 if(!sshc->homedir) { in myssh_statemach_act()
977 data->state.most_recent_ftp_entrypath = sshc->homedir; in myssh_statemach_act()
988 result = Curl_getworkingpath(data, sshc->homedir, &protop->path); in myssh_statemach_act()
990 sshc->actualcode = result; in myssh_statemach_act()
997 sshc->quote_item = data->set.quote; in myssh_statemach_act()
1008 sshc->quote_item = data->set.postquote; in myssh_statemach_act()
1022 Curl_safefree(sshc->quote_path1); in myssh_statemach_act()
1023 Curl_safefree(sshc->quote_path2); in myssh_statemach_act()
1025 sshc->quote_item = sshc->quote_item->next; in myssh_statemach_act()
1027 if(sshc->quote_item) { in myssh_statemach_act()
1031 if(sshc->nextstate != SSH_NO_STATE) { in myssh_statemach_act()
1032 state(data, sshc->nextstate); in myssh_statemach_act()
1033 sshc->nextstate = SSH_NO_STATE; in myssh_statemach_act()
1046 rc = sftp_setstat(sshc->sftp_session, sshc->quote_path2, in myssh_statemach_act()
1047 sshc->quote_attrs); in myssh_statemach_act()
1048 if(rc && !sshc->acceptfail) { in myssh_statemach_act()
1049 Curl_safefree(sshc->quote_path1); in myssh_statemach_act()
1050 Curl_safefree(sshc->quote_path2); in myssh_statemach_act()
1052 ssh_get_error(sshc->ssh_session)); in myssh_statemach_act()
1054 sshc->nextstate = SSH_NO_STATE; in myssh_statemach_act()
1055 sshc->actualcode = CURLE_QUOTE_ERROR; in myssh_statemach_act()
1065 rc = sftp_symlink(sshc->sftp_session, sshc->quote_path2, in myssh_statemach_act()
1066 sshc->quote_path1); in myssh_statemach_act()
1067 if(rc && !sshc->acceptfail) { in myssh_statemach_act()
1068 Curl_safefree(sshc->quote_path1); in myssh_statemach_act()
1069 Curl_safefree(sshc->quote_path2); in myssh_statemach_act()
1071 ssh_get_error(sshc->ssh_session)); in myssh_statemach_act()
1073 sshc->nextstate = SSH_NO_STATE; in myssh_statemach_act()
1074 sshc->actualcode = CURLE_QUOTE_ERROR; in myssh_statemach_act()
1081 rc = sftp_mkdir(sshc->sftp_session, sshc->quote_path1, in myssh_statemach_act()
1083 if(rc && !sshc->acceptfail) { in myssh_statemach_act()
1084 Curl_safefree(sshc->quote_path1); in myssh_statemach_act()
1086 ssh_get_error(sshc->ssh_session)); in myssh_statemach_act()
1088 sshc->nextstate = SSH_NO_STATE; in myssh_statemach_act()
1089 sshc->actualcode = CURLE_QUOTE_ERROR; in myssh_statemach_act()
1096 rc = sftp_rename(sshc->sftp_session, sshc->quote_path1, in myssh_statemach_act()
1097 sshc->quote_path2); in myssh_statemach_act()
1098 if(rc && !sshc->acceptfail) { in myssh_statemach_act()
1099 Curl_safefree(sshc->quote_path1); in myssh_statemach_act()
1100 Curl_safefree(sshc->quote_path2); in myssh_statemach_act()
1102 ssh_get_error(sshc->ssh_session)); in myssh_statemach_act()
1104 sshc->nextstate = SSH_NO_STATE; in myssh_statemach_act()
1105 sshc->actualcode = CURLE_QUOTE_ERROR; in myssh_statemach_act()
1112 rc = sftp_rmdir(sshc->sftp_session, sshc->quote_path1); in myssh_statemach_act()
1113 if(rc && !sshc->acceptfail) { in myssh_statemach_act()
1114 Curl_safefree(sshc->quote_path1); in myssh_statemach_act()
1116 ssh_get_error(sshc->ssh_session)); in myssh_statemach_act()
1118 sshc->nextstate = SSH_NO_STATE; in myssh_statemach_act()
1119 sshc->actualcode = CURLE_QUOTE_ERROR; in myssh_statemach_act()
1126 rc = sftp_unlink(sshc->sftp_session, sshc->quote_path1); in myssh_statemach_act()
1127 if(rc && !sshc->acceptfail) { in myssh_statemach_act()
1128 Curl_safefree(sshc->quote_path1); in myssh_statemach_act()
1130 ssh_get_error(sshc->ssh_session)); in myssh_statemach_act()
1132 sshc->nextstate = SSH_NO_STATE; in myssh_statemach_act()
1133 sshc->actualcode = CURLE_QUOTE_ERROR; in myssh_statemach_act()
1143 statvfs = sftp_statvfs(sshc->sftp_session, sshc->quote_path1); in myssh_statemach_act()
1144 if(!statvfs && !sshc->acceptfail) { in myssh_statemach_act()
1145 Curl_safefree(sshc->quote_path1); in myssh_statemach_act()
1147 ssh_get_error(sshc->ssh_session)); in myssh_statemach_act()
1149 sshc->nextstate = SSH_NO_STATE; in myssh_statemach_act()
1150 sshc->actualcode = CURLE_QUOTE_ERROR; in myssh_statemach_act()
1182 sshc->nextstate = SSH_NO_STATE; in myssh_statemach_act()
1190 sshc->nextstate = SSH_NO_STATE; in myssh_statemach_act()
1191 sshc->actualcode = result; in myssh_statemach_act()
1211 attrs = sftp_stat(sshc->sftp_session, protop->path); in myssh_statemach_act()
1240 attrs = sftp_stat(sshc->sftp_session, protop->path); in myssh_statemach_act()
1268 if(sshc->sftp_file) in myssh_statemach_act()
1269 sftp_close(sshc->sftp_file); in myssh_statemach_act()
1270 sshc->sftp_file = in myssh_statemach_act()
1271 sftp_open(sshc->sftp_session, protop->path, in myssh_statemach_act()
1273 if(!sshc->sftp_file) { in myssh_statemach_act()
1274 err = sftp_get_error(sshc->sftp_session); in myssh_statemach_act()
1282 sshc->secondCreateDirs = 1; in myssh_statemach_act()
1342 rc = sftp_seek64(sshc->sftp_file, data->state.resume_from); in myssh_statemach_act()
1360 sshc->orig_waitfor = data->req.keepon; in myssh_statemach_act()
1378 sshc->slash_pos = protop->path + 1; /* ignore the leading '/' */ in myssh_statemach_act()
1387 sshc->slash_pos = strchr(sshc->slash_pos, '/'); in myssh_statemach_act()
1388 if(sshc->slash_pos) { in myssh_statemach_act()
1389 *sshc->slash_pos = 0; in myssh_statemach_act()
1400 rc = sftp_mkdir(sshc->sftp_session, protop->path, in myssh_statemach_act()
1402 *sshc->slash_pos = '/'; in myssh_statemach_act()
1403 ++sshc->slash_pos; in myssh_statemach_act()
1410 err = sftp_get_error(sshc->sftp_session); in myssh_statemach_act()
1433 sshc->sftp_dir = sftp_opendir(sshc->sftp_session, in myssh_statemach_act()
1435 if(!sshc->sftp_dir) { in myssh_statemach_act()
1437 ssh_get_error(sshc->ssh_session)); in myssh_statemach_act()
1445 Curl_dyn_reset(&sshc->readdir_buf); in myssh_statemach_act()
1446 if(sshc->readdir_attrs) in myssh_statemach_act()
1447 sftp_attributes_free(sshc->readdir_attrs); in myssh_statemach_act()
1449 sshc->readdir_attrs = sftp_readdir(sshc->sftp_session, sshc->sftp_dir); in myssh_statemach_act()
1450 if(sshc->readdir_attrs) { in myssh_statemach_act()
1451 sshc->readdir_filename = sshc->readdir_attrs->name; in myssh_statemach_act()
1452 sshc->readdir_longentry = sshc->readdir_attrs->longname; in myssh_statemach_act()
1453 sshc->readdir_len = strlen(sshc->readdir_filename); in myssh_statemach_act()
1458 tmpLine = aprintf("%s\n", sshc->readdir_filename); in myssh_statemach_act()
1461 sshc->actualcode = CURLE_OUT_OF_MEMORY; in myssh_statemach_act()
1465 tmpLine, sshc->readdir_len + 1); in myssh_statemach_act()
1475 if(Curl_dyn_add(&sshc->readdir_buf, sshc->readdir_longentry)) { in myssh_statemach_act()
1476 sshc->actualcode = CURLE_OUT_OF_MEMORY; in myssh_statemach_act()
1481 if((sshc->readdir_attrs->flags & SSH_FILEXFER_ATTR_PERMISSIONS) && in myssh_statemach_act()
1482 ((sshc->readdir_attrs->permissions & SSH_S_IFMT) == in myssh_statemach_act()
1484 sshc->readdir_linkPath = aprintf("%s%s", protop->path, in myssh_statemach_act()
1485 sshc->readdir_filename); in myssh_statemach_act()
1487 if(!sshc->readdir_linkPath) { in myssh_statemach_act()
1489 sshc->actualcode = CURLE_OUT_OF_MEMORY; in myssh_statemach_act()
1500 else if(sftp_dir_eof(sshc->sftp_dir)) { in myssh_statemach_act()
1506 ssh_get_error(sshc->ssh_session)); in myssh_statemach_act()
1513 if(sshc->readdir_link_attrs) in myssh_statemach_act()
1514 sftp_attributes_free(sshc->readdir_link_attrs); in myssh_statemach_act()
1516 sshc->readdir_link_attrs = sftp_lstat(sshc->sftp_session, in myssh_statemach_act()
1517 sshc->readdir_linkPath); in myssh_statemach_act()
1518 if(sshc->readdir_link_attrs == 0) { in myssh_statemach_act()
1520 ssh_get_error(sshc->ssh_session)); in myssh_statemach_act()
1525 if(!sshc->readdir_link_attrs->name) { in myssh_statemach_act()
1526 sshc->readdir_tmp = sftp_readlink(sshc->sftp_session, in myssh_statemach_act()
1527 sshc->readdir_linkPath); in myssh_statemach_act()
1528 if(!sshc->readdir_filename) in myssh_statemach_act()
1529 sshc->readdir_len = 0; in myssh_statemach_act()
1531 sshc->readdir_len = strlen(sshc->readdir_tmp); in myssh_statemach_act()
1532 sshc->readdir_longentry = NULL; in myssh_statemach_act()
1533 sshc->readdir_filename = sshc->readdir_tmp; in myssh_statemach_act()
1536 sshc->readdir_len = strlen(sshc->readdir_link_attrs->name); in myssh_statemach_act()
1537 sshc->readdir_filename = sshc->readdir_link_attrs->name; in myssh_statemach_act()
1538 sshc->readdir_longentry = sshc->readdir_link_attrs->longname; in myssh_statemach_act()
1541 Curl_safefree(sshc->readdir_linkPath); in myssh_statemach_act()
1543 if(Curl_dyn_addf(&sshc->readdir_buf, " -> %s", in myssh_statemach_act()
1544 sshc->readdir_filename)) { in myssh_statemach_act()
1545 sshc->actualcode = CURLE_OUT_OF_MEMORY; in myssh_statemach_act()
1549 sftp_attributes_free(sshc->readdir_link_attrs); in myssh_statemach_act()
1550 sshc->readdir_link_attrs = NULL; in myssh_statemach_act()
1551 sshc->readdir_filename = NULL; in myssh_statemach_act()
1552 sshc->readdir_longentry = NULL; in myssh_statemach_act()
1557 if(Curl_dyn_addn(&sshc->readdir_buf, "\n", 1)) in myssh_statemach_act()
1561 Curl_dyn_ptr(&sshc->readdir_buf), in myssh_statemach_act()
1562 Curl_dyn_len(&sshc->readdir_buf)); in myssh_statemach_act()
1564 ssh_string_free_char(sshc->readdir_tmp); in myssh_statemach_act()
1565 sshc->readdir_tmp = NULL; in myssh_statemach_act()
1575 sftp_closedir(sshc->sftp_dir); in myssh_statemach_act()
1576 sshc->sftp_dir = NULL; in myssh_statemach_act()
1587 if(sshc->sftp_file) in myssh_statemach_act()
1588 sftp_close(sshc->sftp_file); in myssh_statemach_act()
1590 sshc->sftp_file = sftp_open(sshc->sftp_session, protop->path, in myssh_statemach_act()
1592 if(!sshc->sftp_file) { in myssh_statemach_act()
1594 ssh_get_error(sshc->ssh_session)); in myssh_statemach_act()
1599 sftp_file_set_nonblocking(sshc->sftp_file); in myssh_statemach_act()
1608 attrs = sftp_fstat(sshc->sftp_file); in myssh_statemach_act()
1673 rc = sftp_seek64(sshc->sftp_file, from); in myssh_statemach_act()
1710 rc = sftp_seek64(sshc->sftp_file, data->state.resume_from); in myssh_statemach_act()
1740 sshc->actualcode = result; in myssh_statemach_act()
1743 sshc->sftp_recv_state = 0; in myssh_statemach_act()
1749 if(sshc->sftp_file) { in myssh_statemach_act()
1750 sftp_close(sshc->sftp_file); in myssh_statemach_act()
1751 sshc->sftp_file = NULL; in myssh_statemach_act()
1760 if(sshc->nextstate != SSH_NO_STATE && in myssh_statemach_act()
1761 sshc->nextstate != SSH_SFTP_CLOSE) { in myssh_statemach_act()
1762 state(data, sshc->nextstate); in myssh_statemach_act()
1763 sshc->nextstate = SSH_SFTP_CLOSE; in myssh_statemach_act()
1767 result = sshc->actualcode; in myssh_statemach_act()
1776 if(sshc->sftp_file) { in myssh_statemach_act()
1777 sftp_close(sshc->sftp_file); in myssh_statemach_act()
1778 sshc->sftp_file = NULL; in myssh_statemach_act()
1781 if(sshc->sftp_session) { in myssh_statemach_act()
1782 sftp_free(sshc->sftp_session); in myssh_statemach_act()
1783 sshc->sftp_session = NULL; in myssh_statemach_act()
1786 SSH_STRING_FREE_CHAR(sshc->homedir); in myssh_statemach_act()
1793 result = Curl_getworkingpath(data, sshc->homedir, &protop->path); in myssh_statemach_act()
1795 sshc->actualcode = result; in myssh_statemach_act()
1801 ssh_set_blocking(sshc->ssh_session, 1); in myssh_statemach_act()
1806 sshc->actualcode = CURLE_UPLOAD_FAILED; in myssh_statemach_act()
1811 sshc->scp_session = in myssh_statemach_act()
1812 ssh_scp_new(sshc->ssh_session, SSH_SCP_WRITE, protop->path); in myssh_statemach_act()
1816 sshc->scp_session = in myssh_statemach_act()
1817 ssh_scp_new(sshc->ssh_session, SSH_SCP_READ, protop->path); in myssh_statemach_act()
1821 if(!sshc->scp_session) { in myssh_statemach_act()
1822 err_msg = ssh_get_error(sshc->ssh_session); in myssh_statemach_act()
1831 rc = ssh_scp_init(sshc->scp_session); in myssh_statemach_act()
1833 err_msg = ssh_get_error(sshc->ssh_session); in myssh_statemach_act()
1839 rc = ssh_scp_push_file(sshc->scp_session, protop->path, in myssh_statemach_act()
1843 err_msg = ssh_get_error(sshc->ssh_session); in myssh_statemach_act()
1857 sshc->orig_waitfor = data->req.keepon; in myssh_statemach_act()
1870 rc = ssh_scp_init(sshc->scp_session); in myssh_statemach_act()
1872 err_msg = ssh_get_error(sshc->ssh_session); in myssh_statemach_act()
1883 rc = ssh_scp_pull_request(sshc->scp_session); in myssh_statemach_act()
1885 err_msg = ssh_get_error(sshc->ssh_session); in myssh_statemach_act()
1892 bytecount = ssh_scp_request_get_size(sshc->scp_session); in myssh_statemach_act()
1915 if(sshc->scp_session) { in myssh_statemach_act()
1916 rc = ssh_scp_close(sshc->scp_session); in myssh_statemach_act()
1925 ssh_get_error(sshc->ssh_session)); in myssh_statemach_act()
1933 if(sshc->scp_session) { in myssh_statemach_act()
1934 ssh_scp_free(sshc->scp_session); in myssh_statemach_act()
1935 sshc->scp_session = NULL; in myssh_statemach_act()
1939 ssh_set_blocking(sshc->ssh_session, 0); in myssh_statemach_act()
1948 if(sshc->scp_session) { in myssh_statemach_act()
1949 ssh_scp_free(sshc->scp_session); in myssh_statemach_act()
1950 sshc->scp_session = NULL; in myssh_statemach_act()
1953 ssh_disconnect(sshc->ssh_session); in myssh_statemach_act()
1961 SSH_STRING_FREE_CHAR(sshc->homedir); in myssh_statemach_act()
1967 if(sshc->ssh_session) { in myssh_statemach_act()
1968 ssh_free(sshc->ssh_session); in myssh_statemach_act()
1969 sshc->ssh_session = NULL; in myssh_statemach_act()
1974 DEBUGASSERT(sshc->ssh_session == NULL); in myssh_statemach_act()
1975 DEBUGASSERT(sshc->scp_session == NULL); in myssh_statemach_act()
1977 if(sshc->readdir_tmp) { in myssh_statemach_act()
1978 ssh_string_free_char(sshc->readdir_tmp); in myssh_statemach_act()
1979 sshc->readdir_tmp = NULL; in myssh_statemach_act()
1982 if(sshc->quote_attrs) in myssh_statemach_act()
1983 sftp_attributes_free(sshc->quote_attrs); in myssh_statemach_act()
1985 if(sshc->readdir_attrs) in myssh_statemach_act()
1986 sftp_attributes_free(sshc->readdir_attrs); in myssh_statemach_act()
1988 if(sshc->readdir_link_attrs) in myssh_statemach_act()
1989 sftp_attributes_free(sshc->readdir_link_attrs); in myssh_statemach_act()
1991 if(sshc->privkey) in myssh_statemach_act()
1992 ssh_key_free(sshc->privkey); in myssh_statemach_act()
1993 if(sshc->pubkey) in myssh_statemach_act()
1994 ssh_key_free(sshc->pubkey); in myssh_statemach_act()
1996 Curl_safefree(sshc->rsa_pub); in myssh_statemach_act()
1997 Curl_safefree(sshc->rsa); in myssh_statemach_act()
1998 Curl_safefree(sshc->quote_path1); in myssh_statemach_act()
1999 Curl_safefree(sshc->quote_path2); in myssh_statemach_act()
2000 Curl_dyn_free(&sshc->readdir_buf); in myssh_statemach_act()
2001 Curl_safefree(sshc->readdir_linkPath); in myssh_statemach_act()
2002 SSH_STRING_FREE_CHAR(sshc->homedir); in myssh_statemach_act()
2005 result = sshc->actualcode; in myssh_statemach_act()
2007 memset(sshc, 0, sizeof(struct ssh_conn)); in myssh_statemach_act()
2010 sshc->state = SSH_SESSION_FREE; /* current */ in myssh_statemach_act()
2011 sshc->nextstate = SSH_NO_STATE; in myssh_statemach_act()
2018 sshc->nextstate = SSH_NO_STATE; in myssh_statemach_act()
2023 } while(!rc && (sshc->state != SSH_STOP)); in myssh_statemach_act()
2061 struct ssh_conn *sshc = &conn->proto.sshc; in myssh_block2waitfor() local
2065 conn->waitfor = sshc->orig_waitfor; in myssh_block2waitfor()
2068 int dir = ssh_get_poll_flags(sshc->ssh_session); in myssh_block2waitfor()
2083 struct ssh_conn *sshc = &conn->proto.sshc; in myssh_multi_statemach() local
2088 *done = (sshc->state == SSH_STOP); in myssh_multi_statemach()
2098 struct ssh_conn *sshc = &conn->proto.sshc; in myssh_block_statemach() local
2101 while((sshc->state != SSH_STOP) && !result) { in myssh_block_statemach()
2144 struct ssh_conn *sshc = &conn->proto.sshc; in myssh_setup_connection() local
2149 Curl_dyn_init(&sshc->readdir_buf, CURL_PATH_MAX * 2); in myssh_setup_connection()
2186 ssh = &conn->proto.sshc; in myssh_connect()
2329 struct ssh_conn *sshc = &conn->proto.sshc; in myssh_do_it() local
2335 sshc->actualcode = CURLE_OK; /* reset error code */ in myssh_do_it()
2336 sshc->secondCreateDirs = 0; /* reset the create dir attempt state in myssh_do_it()
2360 struct ssh_conn *ssh = &conn->proto.sshc; in scp_disconnect()
2419 rc = ssh_scp_write(conn->proto.sshc.scp_session, mem, len); in scp_send()
2450 nread = ssh_scp_read(conn->proto.sshc.scp_session, mem, len); in scp_recv()
2529 if(conn->proto.sshc.ssh_session) { in sftp_disconnect()
2545 struct ssh_conn *sshc = &conn->proto.sshc; in sftp_done() local
2552 sshc->nextstate = SSH_SFTP_POSTQUOTE_INIT; in sftp_done()
2574 nwrite = sftp_write(conn->proto.sshc.sftp_file, mem, len); in sftp_send()
2606 switch(conn->proto.sshc.sftp_recv_state) { in sftp_recv()
2608 conn->proto.sshc.sftp_file_index = in sftp_recv()
2609 sftp_async_read_begin(conn->proto.sshc.sftp_file, in sftp_recv()
2611 if(conn->proto.sshc.sftp_file_index < 0) { in sftp_recv()
2618 conn->proto.sshc.sftp_recv_state = 1; in sftp_recv()
2620 nread = sftp_async_read(conn->proto.sshc.sftp_file, in sftp_recv()
2622 (uint32_t)conn->proto.sshc.sftp_file_index); in sftp_recv()
2635 conn->proto.sshc.sftp_recv_state = 0; in sftp_recv()
2649 struct ssh_conn *sshc = &conn->proto.sshc; in sftp_quote() local
2655 char *cmd = sshc->quote_item->data; in sftp_quote()
2656 sshc->acceptfail = FALSE; in sftp_quote()
2665 sshc->acceptfail = TRUE; in sftp_quote()
2673 sshc->actualcode = CURLE_OUT_OF_MEMORY; in sftp_quote()
2675 sshc->nextstate = SSH_NO_STATE; in sftp_quote()
2688 sshc->nextstate = SSH_NO_STATE; in sftp_quote()
2689 sshc->actualcode = result; in sftp_quote()
2704 sshc->nextstate = SSH_NO_STATE; in sftp_quote()
2705 sshc->actualcode = CURLE_QUOTE_ERROR; in sftp_quote()
2713 result = Curl_get_pathname(&cp, &sshc->quote_path1, sshc->homedir); in sftp_quote()
2720 sshc->nextstate = SSH_NO_STATE; in sftp_quote()
2721 sshc->actualcode = result; in sftp_quote()
2740 result = Curl_get_pathname(&cp, &sshc->quote_path2, sshc->homedir); in sftp_quote()
2747 Curl_safefree(sshc->quote_path1); in sftp_quote()
2749 sshc->nextstate = SSH_NO_STATE; in sftp_quote()
2750 sshc->actualcode = result; in sftp_quote()
2753 sshc->quote_attrs = NULL; in sftp_quote()
2762 result = Curl_get_pathname(&cp, &sshc->quote_path2, sshc->homedir); in sftp_quote()
2768 Curl_safefree(sshc->quote_path1); in sftp_quote()
2770 sshc->nextstate = SSH_NO_STATE; in sftp_quote()
2771 sshc->actualcode = result; in sftp_quote()
2786 result = Curl_get_pathname(&cp, &sshc->quote_path2, sshc->homedir); in sftp_quote()
2792 Curl_safefree(sshc->quote_path1); in sftp_quote()
2794 sshc->nextstate = SSH_NO_STATE; in sftp_quote()
2795 sshc->actualcode = result; in sftp_quote()
2818 Curl_safefree(sshc->quote_path1); in sftp_quote()
2819 Curl_safefree(sshc->quote_path2); in sftp_quote()
2821 sshc->nextstate = SSH_NO_STATE; in sftp_quote()
2822 sshc->actualcode = CURLE_QUOTE_ERROR; in sftp_quote()
2828 struct ssh_conn *sshc = &conn->proto.sshc; in sftp_quote_stat() local
2829 char *cmd = sshc->quote_item->data; in sftp_quote_stat()
2830 sshc->acceptfail = FALSE; in sftp_quote_stat()
2839 sshc->acceptfail = TRUE; in sftp_quote_stat()
2847 if(sshc->quote_attrs) in sftp_quote_stat()
2848 sftp_attributes_free(sshc->quote_attrs); in sftp_quote_stat()
2849 sshc->quote_attrs = sftp_stat(sshc->sftp_session, sshc->quote_path2); in sftp_quote_stat()
2850 if(!sshc->quote_attrs) { in sftp_quote_stat()
2851 Curl_safefree(sshc->quote_path1); in sftp_quote_stat()
2852 Curl_safefree(sshc->quote_path2); in sftp_quote_stat()
2854 sftp_get_error(sshc->sftp_session)); in sftp_quote_stat()
2856 sshc->nextstate = SSH_NO_STATE; in sftp_quote_stat()
2857 sshc->actualcode = CURLE_QUOTE_ERROR; in sftp_quote_stat()
2863 sshc->quote_attrs->gid = (uint32_t)strtoul(sshc->quote_path1, NULL, 10); in sftp_quote_stat()
2864 if(sshc->quote_attrs->gid == 0 && !ISDIGIT(sshc->quote_path1[0]) && in sftp_quote_stat()
2865 !sshc->acceptfail) { in sftp_quote_stat()
2866 Curl_safefree(sshc->quote_path1); in sftp_quote_stat()
2867 Curl_safefree(sshc->quote_path2); in sftp_quote_stat()
2870 sshc->nextstate = SSH_NO_STATE; in sftp_quote_stat()
2871 sshc->actualcode = CURLE_QUOTE_ERROR; in sftp_quote_stat()
2874 sshc->quote_attrs->flags |= SSH_FILEXFER_ATTR_UIDGID; in sftp_quote_stat()
2878 perms = (mode_t)strtoul(sshc->quote_path1, NULL, 8); in sftp_quote_stat()
2880 if(perms == 0 && !ISDIGIT(sshc->quote_path1[0])) { in sftp_quote_stat()
2881 Curl_safefree(sshc->quote_path1); in sftp_quote_stat()
2882 Curl_safefree(sshc->quote_path2); in sftp_quote_stat()
2885 sshc->nextstate = SSH_NO_STATE; in sftp_quote_stat()
2886 sshc->actualcode = CURLE_QUOTE_ERROR; in sftp_quote_stat()
2889 sshc->quote_attrs->permissions = perms; in sftp_quote_stat()
2890 sshc->quote_attrs->flags |= SSH_FILEXFER_ATTR_PERMISSIONS; in sftp_quote_stat()
2893 sshc->quote_attrs->uid = (uint32_t)strtoul(sshc->quote_path1, NULL, 10); in sftp_quote_stat()
2894 if(sshc->quote_attrs->uid == 0 && !ISDIGIT(sshc->quote_path1[0]) && in sftp_quote_stat()
2895 !sshc->acceptfail) { in sftp_quote_stat()
2896 Curl_safefree(sshc->quote_path1); in sftp_quote_stat()
2897 Curl_safefree(sshc->quote_path2); in sftp_quote_stat()
2900 sshc->nextstate = SSH_NO_STATE; in sftp_quote_stat()
2901 sshc->actualcode = CURLE_QUOTE_ERROR; in sftp_quote_stat()
2904 sshc->quote_attrs->flags |= SSH_FILEXFER_ATTR_UIDGID; in sftp_quote_stat()
2908 time_t date = Curl_getdate_capped(sshc->quote_path1); in sftp_quote_stat()
2921 Curl_safefree(sshc->quote_path1); in sftp_quote_stat()
2922 Curl_safefree(sshc->quote_path2); in sftp_quote_stat()
2924 sshc->nextstate = SSH_NO_STATE; in sftp_quote_stat()
2925 sshc->actualcode = CURLE_QUOTE_ERROR; in sftp_quote_stat()
2929 sshc->quote_attrs->atime = (uint32_t)date; in sftp_quote_stat()
2931 sshc->quote_attrs->mtime = (uint32_t)date; in sftp_quote_stat()
2933 sshc->quote_attrs->flags |= SSH_FILEXFER_ATTR_ACMODTIME; in sftp_quote_stat()