• Home
  • History
  • Annotate
  • Raw
  • Download

Lines Matching refs:sshc

230   struct ssh_conn *sshc = &conn->proto.sshc;  in mystate()  local
297 if(sshc->state != nowstate) { in mystate()
299 (void *) sshc, names[sshc->state], names[nowstate], in mystate()
304 sshc->state = nowstate; in mystate()
321 struct ssh_conn *sshc = &conn->proto.sshc; in myssh_is_known() local
332 rc = ssh_get_publickey(sshc->ssh_session, &pubkey); in myssh_is_known()
357 vstate = ssh_is_server_known(sshc->ssh_session); in myssh_is_known()
411 rc = ssh_write_knownhost(sshc->ssh_session); in myssh_is_known()
440 sshc->actualcode = _r; \
447 sshc->actualcode = sftp_error_to_CURLE(sftp_get_error(sshc->sftp_session)); \
453 if(sshc->auth_methods & SSH_AUTH_METHOD_PASSWORD) { \
463 if(sshc->auth_methods & SSH_AUTH_METHOD_INTERACTIVE) { \
473 if(sshc->auth_methods & SSH_AUTH_METHOD_GSSAPI_MIC) { \
486 struct ssh_conn *sshc = &conn->proto.sshc; in myssh_auth_interactive() local
490 switch(sshc->kbd_state) { in myssh_auth_interactive()
492 rc = ssh_userauth_kbdint(sshc->ssh_session, NULL, NULL); in myssh_auth_interactive()
499 nprompts = ssh_userauth_kbdint_getnprompts(sshc->ssh_session); in myssh_auth_interactive()
503 rc = ssh_userauth_kbdint_setanswer(sshc->ssh_session, 0, conn->passwd); in myssh_auth_interactive()
509 sshc->kbd_state = 1; in myssh_auth_interactive()
511 rc = ssh_userauth_kbdint(sshc->ssh_session, NULL, NULL); in myssh_auth_interactive()
517 nprompts = ssh_userauth_kbdint_getnprompts(sshc->ssh_session); in myssh_auth_interactive()
521 sshc->kbd_state = 2; in myssh_auth_interactive()
528 sshc->kbd_state = 2; in myssh_auth_interactive()
530 rc = ssh_userauth_kbdint(sshc->ssh_session, NULL, NULL); in myssh_auth_interactive()
543 sshc->kbd_state = 0; in myssh_auth_interactive()
558 struct ssh_conn *sshc = &conn->proto.sshc; in myssh_statemach_act() local
568 switch(sshc->state) { in myssh_statemach_act()
570 sshc->secondCreateDirs = 0; in myssh_statemach_act()
571 sshc->nextstate = SSH_NO_STATE; in myssh_statemach_act()
572 sshc->actualcode = CURLE_OK; in myssh_statemach_act()
580 ssh_set_blocking(sshc->ssh_session, 0); in myssh_statemach_act()
586 rc = ssh_connect(sshc->ssh_session); in myssh_statemach_act()
608 sshc->authed = FALSE; in myssh_statemach_act()
610 rc = ssh_userauth_none(sshc->ssh_session, NULL); in myssh_statemach_act()
617 sshc->authed = TRUE; in myssh_statemach_act()
626 sshc->auth_methods = ssh_userauth_list(sshc->ssh_session, NULL); in myssh_statemach_act()
627 if(sshc->auth_methods & SSH_AUTH_METHOD_PUBLICKEY) { in myssh_statemach_act()
631 else if(sshc->auth_methods & SSH_AUTH_METHOD_GSSAPI_MIC) { in myssh_statemach_act()
634 else if(sshc->auth_methods & SSH_AUTH_METHOD_INTERACTIVE) { in myssh_statemach_act()
637 else if(sshc->auth_methods & SSH_AUTH_METHOD_PASSWORD) { in myssh_statemach_act()
654 if(sshc->pubkey && !data->set.ssl.key_passwd) { in myssh_statemach_act()
655 rc = ssh_userauth_try_publickey(sshc->ssh_session, NULL, in myssh_statemach_act()
656 sshc->pubkey); in myssh_statemach_act()
670 NULL, &sshc->privkey); in myssh_statemach_act()
683 rc = ssh_userauth_publickey_auto(sshc->ssh_session, NULL, in myssh_statemach_act()
691 sshc->authed = TRUE; in myssh_statemach_act()
701 rc = ssh_userauth_publickey(sshc->ssh_session, NULL, sshc->privkey); in myssh_statemach_act()
708 sshc->authed = TRUE; in myssh_statemach_act()
724 rc = ssh_userauth_gssapi(sshc->ssh_session); in myssh_statemach_act()
732 sshc->authed = TRUE; in myssh_statemach_act()
758 sshc->authed = TRUE; in myssh_statemach_act()
773 rc = ssh_userauth_password(sshc->ssh_session, NULL, conn->passwd); in myssh_statemach_act()
780 sshc->authed = TRUE; in myssh_statemach_act()
790 if(!sshc->authed) { in myssh_statemach_act()
815 ssh_set_blocking(sshc->ssh_session, 1); in myssh_statemach_act()
817 sshc->sftp_session = sftp_new(sshc->ssh_session); in myssh_statemach_act()
818 if(!sshc->sftp_session) { in myssh_statemach_act()
820 ssh_get_error(sshc->ssh_session)); in myssh_statemach_act()
825 rc = sftp_init(sshc->sftp_session); in myssh_statemach_act()
827 rc = sftp_get_error(sshc->sftp_session); in myssh_statemach_act()
829 ssh_get_error(sshc->ssh_session)); in myssh_statemach_act()
839 sshc->homedir = sftp_canonicalize_path(sshc->sftp_session, "."); in myssh_statemach_act()
840 if(sshc->homedir == NULL) { in myssh_statemach_act()
843 conn->data->state.most_recent_ftp_entrypath = sshc->homedir; in myssh_statemach_act()
855 result = Curl_getworkingpath(conn, sshc->homedir, &protop->path); in myssh_statemach_act()
857 sshc->actualcode = result; in myssh_statemach_act()
864 sshc->quote_item = data->set.quote; in myssh_statemach_act()
875 sshc->quote_item = data->set.postquote; in myssh_statemach_act()
889 Curl_safefree(sshc->quote_path1); in myssh_statemach_act()
890 Curl_safefree(sshc->quote_path2); in myssh_statemach_act()
892 sshc->quote_item = sshc->quote_item->next; in myssh_statemach_act()
894 if(sshc->quote_item) { in myssh_statemach_act()
898 if(sshc->nextstate != SSH_NO_STATE) { in myssh_statemach_act()
899 state(conn, sshc->nextstate); in myssh_statemach_act()
900 sshc->nextstate = SSH_NO_STATE; in myssh_statemach_act()
913 rc = sftp_setstat(sshc->sftp_session, sshc->quote_path2, in myssh_statemach_act()
914 sshc->quote_attrs); in myssh_statemach_act()
915 if(rc != 0 && !sshc->acceptfail) { in myssh_statemach_act()
916 Curl_safefree(sshc->quote_path1); in myssh_statemach_act()
917 Curl_safefree(sshc->quote_path2); in myssh_statemach_act()
919 ssh_get_error(sshc->ssh_session)); in myssh_statemach_act()
921 sshc->nextstate = SSH_NO_STATE; in myssh_statemach_act()
922 sshc->actualcode = CURLE_QUOTE_ERROR; in myssh_statemach_act()
932 rc = sftp_symlink(sshc->sftp_session, sshc->quote_path2, in myssh_statemach_act()
933 sshc->quote_path1); in myssh_statemach_act()
934 if(rc != 0 && !sshc->acceptfail) { in myssh_statemach_act()
935 Curl_safefree(sshc->quote_path1); in myssh_statemach_act()
936 Curl_safefree(sshc->quote_path2); in myssh_statemach_act()
938 ssh_get_error(sshc->ssh_session)); in myssh_statemach_act()
940 sshc->nextstate = SSH_NO_STATE; in myssh_statemach_act()
941 sshc->actualcode = CURLE_QUOTE_ERROR; in myssh_statemach_act()
948 rc = sftp_mkdir(sshc->sftp_session, sshc->quote_path1, in myssh_statemach_act()
950 if(rc != 0 && !sshc->acceptfail) { in myssh_statemach_act()
951 Curl_safefree(sshc->quote_path1); in myssh_statemach_act()
953 ssh_get_error(sshc->ssh_session)); in myssh_statemach_act()
955 sshc->nextstate = SSH_NO_STATE; in myssh_statemach_act()
956 sshc->actualcode = CURLE_QUOTE_ERROR; in myssh_statemach_act()
963 rc = sftp_rename(sshc->sftp_session, sshc->quote_path1, in myssh_statemach_act()
964 sshc->quote_path2); in myssh_statemach_act()
965 if(rc != 0 && !sshc->acceptfail) { in myssh_statemach_act()
966 Curl_safefree(sshc->quote_path1); in myssh_statemach_act()
967 Curl_safefree(sshc->quote_path2); in myssh_statemach_act()
969 ssh_get_error(sshc->ssh_session)); in myssh_statemach_act()
971 sshc->nextstate = SSH_NO_STATE; in myssh_statemach_act()
972 sshc->actualcode = CURLE_QUOTE_ERROR; in myssh_statemach_act()
979 rc = sftp_rmdir(sshc->sftp_session, sshc->quote_path1); in myssh_statemach_act()
980 if(rc != 0 && !sshc->acceptfail) { in myssh_statemach_act()
981 Curl_safefree(sshc->quote_path1); in myssh_statemach_act()
983 ssh_get_error(sshc->ssh_session)); in myssh_statemach_act()
985 sshc->nextstate = SSH_NO_STATE; in myssh_statemach_act()
986 sshc->actualcode = CURLE_QUOTE_ERROR; in myssh_statemach_act()
993 rc = sftp_unlink(sshc->sftp_session, sshc->quote_path1); in myssh_statemach_act()
994 if(rc != 0 && !sshc->acceptfail) { in myssh_statemach_act()
995 Curl_safefree(sshc->quote_path1); in myssh_statemach_act()
997 ssh_get_error(sshc->ssh_session)); in myssh_statemach_act()
999 sshc->nextstate = SSH_NO_STATE; in myssh_statemach_act()
1000 sshc->actualcode = CURLE_QUOTE_ERROR; in myssh_statemach_act()
1010 statvfs = sftp_statvfs(sshc->sftp_session, sshc->quote_path1); in myssh_statemach_act()
1011 if(!statvfs && !sshc->acceptfail) { in myssh_statemach_act()
1012 Curl_safefree(sshc->quote_path1); in myssh_statemach_act()
1014 ssh_get_error(sshc->ssh_session)); in myssh_statemach_act()
1016 sshc->nextstate = SSH_NO_STATE; in myssh_statemach_act()
1017 sshc->actualcode = CURLE_QUOTE_ERROR; in myssh_statemach_act()
1039 sshc->nextstate = SSH_NO_STATE; in myssh_statemach_act()
1047 sshc->nextstate = SSH_NO_STATE; in myssh_statemach_act()
1048 sshc->actualcode = result; in myssh_statemach_act()
1068 attrs = sftp_stat(sshc->sftp_session, protop->path); in myssh_statemach_act()
1097 attrs = sftp_stat(sshc->sftp_session, protop->path); in myssh_statemach_act()
1124 if(sshc->sftp_file) in myssh_statemach_act()
1125 sftp_close(sshc->sftp_file); in myssh_statemach_act()
1126 sshc->sftp_file = in myssh_statemach_act()
1127 sftp_open(sshc->sftp_session, protop->path, in myssh_statemach_act()
1129 if(!sshc->sftp_file) { in myssh_statemach_act()
1130 err = sftp_get_error(sshc->sftp_session); in myssh_statemach_act()
1138 sshc->secondCreateDirs = 1; in myssh_statemach_act()
1193 rc = sftp_seek64(sshc->sftp_file, data->state.resume_from); in myssh_statemach_act()
1210 sshc->orig_waitfor = data->req.keepon; in myssh_statemach_act()
1228 sshc->slash_pos = protop->path + 1; /* ignore the leading '/' */ in myssh_statemach_act()
1237 sshc->slash_pos = strchr(sshc->slash_pos, '/'); in myssh_statemach_act()
1238 if(sshc->slash_pos) { in myssh_statemach_act()
1239 *sshc->slash_pos = 0; in myssh_statemach_act()
1250 rc = sftp_mkdir(sshc->sftp_session, protop->path, in myssh_statemach_act()
1252 *sshc->slash_pos = '/'; in myssh_statemach_act()
1253 ++sshc->slash_pos; in myssh_statemach_act()
1260 err = sftp_get_error(sshc->sftp_session); in myssh_statemach_act()
1282 sshc->sftp_dir = sftp_opendir(sshc->sftp_session, in myssh_statemach_act()
1284 if(!sshc->sftp_dir) { in myssh_statemach_act()
1286 ssh_get_error(sshc->ssh_session)); in myssh_statemach_act()
1294 if(sshc->readdir_attrs) in myssh_statemach_act()
1295 sftp_attributes_free(sshc->readdir_attrs); in myssh_statemach_act()
1297 sshc->readdir_attrs = sftp_readdir(sshc->sftp_session, sshc->sftp_dir); in myssh_statemach_act()
1298 if(sshc->readdir_attrs) { in myssh_statemach_act()
1299 sshc->readdir_filename = sshc->readdir_attrs->name; in myssh_statemach_act()
1300 sshc->readdir_longentry = sshc->readdir_attrs->longname; in myssh_statemach_act()
1301 sshc->readdir_len = strlen(sshc->readdir_filename); in myssh_statemach_act()
1306 tmpLine = aprintf("%s\n", sshc->readdir_filename); in myssh_statemach_act()
1309 sshc->actualcode = CURLE_OUT_OF_MEMORY; in myssh_statemach_act()
1313 tmpLine, sshc->readdir_len + 1); in myssh_statemach_act()
1322 data->req.bytecount += sshc->readdir_len + 1; in myssh_statemach_act()
1327 (char *)sshc->readdir_filename, in myssh_statemach_act()
1328 sshc->readdir_len); in myssh_statemach_act()
1332 sshc->readdir_currLen = strlen(sshc->readdir_longentry); in myssh_statemach_act()
1333 sshc->readdir_totalLen = 80 + sshc->readdir_currLen; in myssh_statemach_act()
1334 sshc->readdir_line = calloc(sshc->readdir_totalLen, 1); in myssh_statemach_act()
1335 if(!sshc->readdir_line) { in myssh_statemach_act()
1337 sshc->actualcode = CURLE_OUT_OF_MEMORY; in myssh_statemach_act()
1341 memcpy(sshc->readdir_line, sshc->readdir_longentry, in myssh_statemach_act()
1342 sshc->readdir_currLen); in myssh_statemach_act()
1343 if((sshc->readdir_attrs->flags & SSH_FILEXFER_ATTR_PERMISSIONS) && in myssh_statemach_act()
1344 ((sshc->readdir_attrs->permissions & S_IFMT) == in myssh_statemach_act()
1346 sshc->readdir_linkPath = malloc(PATH_MAX + 1); in myssh_statemach_act()
1347 if(sshc->readdir_linkPath == NULL) { in myssh_statemach_act()
1349 sshc->actualcode = CURLE_OUT_OF_MEMORY; in myssh_statemach_act()
1353 msnprintf(sshc->readdir_linkPath, PATH_MAX, "%s%s", protop->path, in myssh_statemach_act()
1354 sshc->readdir_filename); in myssh_statemach_act()
1363 else if(sshc->readdir_attrs == NULL && sftp_dir_eof(sshc->sftp_dir)) { in myssh_statemach_act()
1369 ssh_get_error(sshc->ssh_session)); in myssh_statemach_act()
1376 if(sshc->readdir_link_attrs) in myssh_statemach_act()
1377 sftp_attributes_free(sshc->readdir_link_attrs); in myssh_statemach_act()
1379 sshc->readdir_link_attrs = sftp_lstat(sshc->sftp_session, in myssh_statemach_act()
1380 sshc->readdir_linkPath); in myssh_statemach_act()
1381 if(sshc->readdir_link_attrs == 0) { in myssh_statemach_act()
1383 ssh_get_error(sshc->ssh_session)); in myssh_statemach_act()
1387 if(sshc->readdir_link_attrs->name == NULL) { in myssh_statemach_act()
1388 sshc->readdir_tmp = sftp_readlink(sshc->sftp_session, in myssh_statemach_act()
1389 sshc->readdir_linkPath); in myssh_statemach_act()
1390 if(sshc->readdir_filename == NULL) in myssh_statemach_act()
1391 sshc->readdir_len = 0; in myssh_statemach_act()
1393 sshc->readdir_len = strlen(sshc->readdir_tmp); in myssh_statemach_act()
1394 sshc->readdir_longentry = NULL; in myssh_statemach_act()
1395 sshc->readdir_filename = sshc->readdir_tmp; in myssh_statemach_act()
1398 sshc->readdir_len = strlen(sshc->readdir_link_attrs->name); in myssh_statemach_act()
1399 sshc->readdir_filename = sshc->readdir_link_attrs->name; in myssh_statemach_act()
1400 sshc->readdir_longentry = sshc->readdir_link_attrs->longname; in myssh_statemach_act()
1403 Curl_safefree(sshc->readdir_linkPath); in myssh_statemach_act()
1406 sshc->readdir_totalLen += 4 + sshc->readdir_len; in myssh_statemach_act()
1407 new_readdir_line = Curl_saferealloc(sshc->readdir_line, in myssh_statemach_act()
1408 sshc->readdir_totalLen); in myssh_statemach_act()
1410 sshc->readdir_line = NULL; in myssh_statemach_act()
1412 sshc->actualcode = CURLE_OUT_OF_MEMORY; in myssh_statemach_act()
1415 sshc->readdir_line = new_readdir_line; in myssh_statemach_act()
1417 sshc->readdir_currLen += msnprintf(sshc->readdir_line + in myssh_statemach_act()
1418 sshc->readdir_currLen, in myssh_statemach_act()
1419 sshc->readdir_totalLen - in myssh_statemach_act()
1420 sshc->readdir_currLen, in myssh_statemach_act()
1422 sshc->readdir_filename); in myssh_statemach_act()
1424 sftp_attributes_free(sshc->readdir_link_attrs); in myssh_statemach_act()
1425 sshc->readdir_link_attrs = NULL; in myssh_statemach_act()
1426 sshc->readdir_filename = NULL; in myssh_statemach_act()
1427 sshc->readdir_longentry = NULL; in myssh_statemach_act()
1432 sshc->readdir_currLen += msnprintf(sshc->readdir_line + in myssh_statemach_act()
1433 sshc->readdir_currLen, in myssh_statemach_act()
1434 sshc->readdir_totalLen - in myssh_statemach_act()
1435 sshc->readdir_currLen, "\n"); in myssh_statemach_act()
1437 sshc->readdir_line, in myssh_statemach_act()
1438 sshc->readdir_currLen); in myssh_statemach_act()
1444 Curl_debug(data, CURLINFO_DATA_OUT, sshc->readdir_line, in myssh_statemach_act()
1445 sshc->readdir_currLen); in myssh_statemach_act()
1447 data->req.bytecount += sshc->readdir_currLen; in myssh_statemach_act()
1449 Curl_safefree(sshc->readdir_line); in myssh_statemach_act()
1450 ssh_string_free_char(sshc->readdir_tmp); in myssh_statemach_act()
1451 sshc->readdir_tmp = NULL; in myssh_statemach_act()
1461 sftp_closedir(sshc->sftp_dir); in myssh_statemach_act()
1462 sshc->sftp_dir = NULL; in myssh_statemach_act()
1473 if(sshc->sftp_file) in myssh_statemach_act()
1474 sftp_close(sshc->sftp_file); in myssh_statemach_act()
1476 sshc->sftp_file = sftp_open(sshc->sftp_session, protop->path, in myssh_statemach_act()
1478 if(!sshc->sftp_file) { in myssh_statemach_act()
1480 ssh_get_error(sshc->ssh_session)); in myssh_statemach_act()
1493 attrs = sftp_fstat(sshc->sftp_file); in myssh_statemach_act()
1557 rc = sftp_seek64(sshc->sftp_file, from); in myssh_statemach_act()
1596 rc = sftp_seek64(sshc->sftp_file, data->state.resume_from); in myssh_statemach_act()
1625 sshc->actualcode = result; in myssh_statemach_act()
1628 sshc->sftp_recv_state = 0; in myssh_statemach_act()
1634 if(sshc->sftp_file) { in myssh_statemach_act()
1635 sftp_close(sshc->sftp_file); in myssh_statemach_act()
1636 sshc->sftp_file = NULL; in myssh_statemach_act()
1645 if(sshc->nextstate != SSH_NO_STATE && in myssh_statemach_act()
1646 sshc->nextstate != SSH_SFTP_CLOSE) { in myssh_statemach_act()
1647 state(conn, sshc->nextstate); in myssh_statemach_act()
1648 sshc->nextstate = SSH_SFTP_CLOSE; in myssh_statemach_act()
1652 result = sshc->actualcode; in myssh_statemach_act()
1661 if(sshc->sftp_file) { in myssh_statemach_act()
1662 sftp_close(sshc->sftp_file); in myssh_statemach_act()
1663 sshc->sftp_file = NULL; in myssh_statemach_act()
1666 if(sshc->sftp_session) { in myssh_statemach_act()
1667 sftp_free(sshc->sftp_session); in myssh_statemach_act()
1668 sshc->sftp_session = NULL; in myssh_statemach_act()
1671 SSH_STRING_FREE_CHAR(sshc->homedir); in myssh_statemach_act()
1679 result = Curl_getworkingpath(conn, sshc->homedir, &protop->path); in myssh_statemach_act()
1681 sshc->actualcode = result; in myssh_statemach_act()
1687 ssh_set_blocking(sshc->ssh_session, 1); in myssh_statemach_act()
1692 sshc->actualcode = CURLE_UPLOAD_FAILED; in myssh_statemach_act()
1696 sshc->scp_session = in myssh_statemach_act()
1697 ssh_scp_new(sshc->ssh_session, SSH_SCP_WRITE, protop->path); in myssh_statemach_act()
1701 sshc->scp_session = in myssh_statemach_act()
1702 ssh_scp_new(sshc->ssh_session, SSH_SCP_READ, protop->path); in myssh_statemach_act()
1706 if(!sshc->scp_session) { in myssh_statemach_act()
1707 err_msg = ssh_get_error(sshc->ssh_session); in myssh_statemach_act()
1716 rc = ssh_scp_init(sshc->scp_session); in myssh_statemach_act()
1718 err_msg = ssh_get_error(sshc->ssh_session); in myssh_statemach_act()
1723 rc = ssh_scp_push_file(sshc->scp_session, protop->path, in myssh_statemach_act()
1727 err_msg = ssh_get_error(sshc->ssh_session); in myssh_statemach_act()
1740 sshc->orig_waitfor = data->req.keepon; in myssh_statemach_act()
1753 rc = ssh_scp_init(sshc->scp_session); in myssh_statemach_act()
1755 err_msg = ssh_get_error(sshc->ssh_session); in myssh_statemach_act()
1765 rc = ssh_scp_pull_request(sshc->scp_session); in myssh_statemach_act()
1767 err_msg = ssh_get_error(sshc->ssh_session); in myssh_statemach_act()
1774 bytecount = ssh_scp_request_get_size(sshc->scp_session); in myssh_statemach_act()
1797 if(sshc->scp_session) { in myssh_statemach_act()
1798 rc = ssh_scp_close(sshc->scp_session); in myssh_statemach_act()
1807 ssh_get_error(sshc->ssh_session)); in myssh_statemach_act()
1815 if(sshc->scp_session) { in myssh_statemach_act()
1816 ssh_scp_free(sshc->scp_session); in myssh_statemach_act()
1817 sshc->scp_session = NULL; in myssh_statemach_act()
1821 ssh_set_blocking(sshc->ssh_session, 0); in myssh_statemach_act()
1830 if(sshc->scp_session) { in myssh_statemach_act()
1831 ssh_scp_free(sshc->scp_session); in myssh_statemach_act()
1832 sshc->scp_session = NULL; in myssh_statemach_act()
1835 ssh_disconnect(sshc->ssh_session); in myssh_statemach_act()
1837 SSH_STRING_FREE_CHAR(sshc->homedir); in myssh_statemach_act()
1843 if(sshc->ssh_session) { in myssh_statemach_act()
1844 ssh_free(sshc->ssh_session); in myssh_statemach_act()
1845 sshc->ssh_session = NULL; in myssh_statemach_act()
1850 DEBUGASSERT(sshc->ssh_session == NULL); in myssh_statemach_act()
1851 DEBUGASSERT(sshc->scp_session == NULL); in myssh_statemach_act()
1853 if(sshc->readdir_tmp) { in myssh_statemach_act()
1854 ssh_string_free_char(sshc->readdir_tmp); in myssh_statemach_act()
1855 sshc->readdir_tmp = NULL; in myssh_statemach_act()
1858 if(sshc->quote_attrs) in myssh_statemach_act()
1859 sftp_attributes_free(sshc->quote_attrs); in myssh_statemach_act()
1861 if(sshc->readdir_attrs) in myssh_statemach_act()
1862 sftp_attributes_free(sshc->readdir_attrs); in myssh_statemach_act()
1864 if(sshc->readdir_link_attrs) in myssh_statemach_act()
1865 sftp_attributes_free(sshc->readdir_link_attrs); in myssh_statemach_act()
1867 if(sshc->privkey) in myssh_statemach_act()
1868 ssh_key_free(sshc->privkey); in myssh_statemach_act()
1869 if(sshc->pubkey) in myssh_statemach_act()
1870 ssh_key_free(sshc->pubkey); in myssh_statemach_act()
1872 Curl_safefree(sshc->rsa_pub); in myssh_statemach_act()
1873 Curl_safefree(sshc->rsa); in myssh_statemach_act()
1874 Curl_safefree(sshc->quote_path1); in myssh_statemach_act()
1875 Curl_safefree(sshc->quote_path2); in myssh_statemach_act()
1876 Curl_safefree(sshc->readdir_line); in myssh_statemach_act()
1877 Curl_safefree(sshc->readdir_linkPath); in myssh_statemach_act()
1878 SSH_STRING_FREE_CHAR(sshc->homedir); in myssh_statemach_act()
1881 result = sshc->actualcode; in myssh_statemach_act()
1883 memset(sshc, 0, sizeof(struct ssh_conn)); in myssh_statemach_act()
1886 sshc->state = SSH_SESSION_FREE; /* current */ in myssh_statemach_act()
1887 sshc->nextstate = SSH_NO_STATE; in myssh_statemach_act()
1895 sshc->nextstate = SSH_NO_STATE; in myssh_statemach_act()
1900 } while(!rc && (sshc->state != SSH_STOP)); in myssh_statemach_act()
1948 struct ssh_conn *sshc = &conn->proto.sshc; in myssh_block2waitfor() local
1953 conn->waitfor = sshc->orig_waitfor; in myssh_block2waitfor()
1956 dir = ssh_get_poll_flags(sshc->ssh_session); in myssh_block2waitfor()
1971 struct ssh_conn *sshc = &conn->proto.sshc; in myssh_multi_statemach() local
1977 *done = (sshc->state == SSH_STOP) ? TRUE : FALSE; in myssh_multi_statemach()
1986 struct ssh_conn *sshc = &conn->proto.sshc; in myssh_block_statemach() local
1990 while((sshc->state != SSH_STOP) && !result) { in myssh_block_statemach()
2074 ssh = &conn->proto.sshc; in myssh_connect()
2178 struct ssh_conn *sshc = &conn->proto.sshc; in myssh_do_it() local
2184 sshc->actualcode = CURLE_OK; /* reset error code */ in myssh_do_it()
2185 sshc->secondCreateDirs = 0; /* reset the create dir attempt state in myssh_do_it()
2208 struct ssh_conn *ssh = &conn->proto.sshc; in scp_disconnect()
2270 rc = ssh_scp_write(conn->proto.sshc.scp_session, mem, len); in scp_send()
2300 nread = ssh_scp_read(conn->proto.sshc.scp_session, mem, len); in scp_recv()
2377 if(conn->proto.sshc.ssh_session) { in sftp_disconnect()
2392 struct ssh_conn *sshc = &conn->proto.sshc; in sftp_done() local
2399 sshc->nextstate = SSH_SFTP_POSTQUOTE_INIT; in sftp_done()
2412 nwrite = sftp_write(conn->proto.sshc.sftp_file, mem, len); in sftp_send()
2443 switch(conn->proto.sshc.sftp_recv_state) { in sftp_recv()
2445 conn->proto.sshc.sftp_file_index = in sftp_recv()
2446 sftp_async_read_begin(conn->proto.sshc.sftp_file, in sftp_recv()
2448 if(conn->proto.sshc.sftp_file_index < 0) { in sftp_recv()
2455 conn->proto.sshc.sftp_recv_state = 1; in sftp_recv()
2457 nread = sftp_async_read(conn->proto.sshc.sftp_file, in sftp_recv()
2459 conn->proto.sshc.sftp_file_index); in sftp_recv()
2472 conn->proto.sshc.sftp_recv_state = 0; in sftp_recv()
2486 struct ssh_conn *sshc = &conn->proto.sshc; in sftp_quote() local
2492 char *cmd = sshc->quote_item->data; in sftp_quote()
2493 sshc->acceptfail = FALSE; in sftp_quote()
2502 sshc->acceptfail = TRUE; in sftp_quote()
2510 sshc->actualcode = CURLE_OUT_OF_MEMORY; in sftp_quote()
2512 sshc->nextstate = SSH_NO_STATE; in sftp_quote()
2526 sshc->nextstate = SSH_NO_STATE; in sftp_quote()
2527 sshc->actualcode = result; in sftp_quote()
2542 sshc->nextstate = SSH_NO_STATE; in sftp_quote()
2543 sshc->actualcode = CURLE_QUOTE_ERROR; in sftp_quote()
2551 result = Curl_get_pathname(&cp, &sshc->quote_path1, sshc->homedir); in sftp_quote()
2558 sshc->nextstate = SSH_NO_STATE; in sftp_quote()
2559 sshc->actualcode = result; in sftp_quote()
2576 result = Curl_get_pathname(&cp, &sshc->quote_path2, sshc->homedir); in sftp_quote()
2583 Curl_safefree(sshc->quote_path1); in sftp_quote()
2585 sshc->nextstate = SSH_NO_STATE; in sftp_quote()
2586 sshc->actualcode = result; in sftp_quote()
2589 sshc->quote_attrs = NULL; in sftp_quote()
2598 result = Curl_get_pathname(&cp, &sshc->quote_path2, sshc->homedir); in sftp_quote()
2604 Curl_safefree(sshc->quote_path1); in sftp_quote()
2606 sshc->nextstate = SSH_NO_STATE; in sftp_quote()
2607 sshc->actualcode = result; in sftp_quote()
2622 result = Curl_get_pathname(&cp, &sshc->quote_path2, sshc->homedir); in sftp_quote()
2628 Curl_safefree(sshc->quote_path1); in sftp_quote()
2630 sshc->nextstate = SSH_NO_STATE; in sftp_quote()
2631 sshc->actualcode = result; in sftp_quote()
2654 Curl_safefree(sshc->quote_path1); in sftp_quote()
2655 Curl_safefree(sshc->quote_path2); in sftp_quote()
2657 sshc->nextstate = SSH_NO_STATE; in sftp_quote()
2658 sshc->actualcode = CURLE_QUOTE_ERROR; in sftp_quote()
2664 struct ssh_conn *sshc = &conn->proto.sshc; in sftp_quote_stat() local
2665 char *cmd = sshc->quote_item->data; in sftp_quote_stat()
2666 sshc->acceptfail = FALSE; in sftp_quote_stat()
2675 sshc->acceptfail = TRUE; in sftp_quote_stat()
2683 if(sshc->quote_attrs) in sftp_quote_stat()
2684 sftp_attributes_free(sshc->quote_attrs); in sftp_quote_stat()
2685 sshc->quote_attrs = sftp_stat(sshc->sftp_session, sshc->quote_path2); in sftp_quote_stat()
2686 if(sshc->quote_attrs == NULL) { in sftp_quote_stat()
2687 Curl_safefree(sshc->quote_path1); in sftp_quote_stat()
2688 Curl_safefree(sshc->quote_path2); in sftp_quote_stat()
2690 sftp_get_error(sshc->sftp_session)); in sftp_quote_stat()
2692 sshc->nextstate = SSH_NO_STATE; in sftp_quote_stat()
2693 sshc->actualcode = CURLE_QUOTE_ERROR; in sftp_quote_stat()
2699 sshc->quote_attrs->gid = (uint32_t)strtoul(sshc->quote_path1, NULL, 10); in sftp_quote_stat()
2700 if(sshc->quote_attrs->gid == 0 && !ISDIGIT(sshc->quote_path1[0]) && in sftp_quote_stat()
2701 !sshc->acceptfail) { in sftp_quote_stat()
2702 Curl_safefree(sshc->quote_path1); in sftp_quote_stat()
2703 Curl_safefree(sshc->quote_path2); in sftp_quote_stat()
2706 sshc->nextstate = SSH_NO_STATE; in sftp_quote_stat()
2707 sshc->actualcode = CURLE_QUOTE_ERROR; in sftp_quote_stat()
2710 sshc->quote_attrs->flags |= SSH_FILEXFER_ATTR_UIDGID; in sftp_quote_stat()
2714 perms = (mode_t)strtoul(sshc->quote_path1, NULL, 8); in sftp_quote_stat()
2716 if(perms == 0 && !ISDIGIT(sshc->quote_path1[0])) { in sftp_quote_stat()
2717 Curl_safefree(sshc->quote_path1); in sftp_quote_stat()
2718 Curl_safefree(sshc->quote_path2); in sftp_quote_stat()
2721 sshc->nextstate = SSH_NO_STATE; in sftp_quote_stat()
2722 sshc->actualcode = CURLE_QUOTE_ERROR; in sftp_quote_stat()
2725 sshc->quote_attrs->permissions = perms; in sftp_quote_stat()
2726 sshc->quote_attrs->flags |= SSH_FILEXFER_ATTR_PERMISSIONS; in sftp_quote_stat()
2729 sshc->quote_attrs->uid = (uint32_t)strtoul(sshc->quote_path1, NULL, 10); in sftp_quote_stat()
2730 if(sshc->quote_attrs->uid == 0 && !ISDIGIT(sshc->quote_path1[0]) && in sftp_quote_stat()
2731 !sshc->acceptfail) { in sftp_quote_stat()
2732 Curl_safefree(sshc->quote_path1); in sftp_quote_stat()
2733 Curl_safefree(sshc->quote_path2); in sftp_quote_stat()
2736 sshc->nextstate = SSH_NO_STATE; in sftp_quote_stat()
2737 sshc->actualcode = CURLE_QUOTE_ERROR; in sftp_quote_stat()
2740 sshc->quote_attrs->flags |= SSH_FILEXFER_ATTR_UIDGID; in sftp_quote_stat()