• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-WNDR4500-V1.0.1.40_1.0.68/ap/gpl/curl-7.23.1/lib/

Lines Matching defs:ftpc

278 static void freedirs(struct ftp_conn *ftpc)
281 if(ftpc->dirs) {
282 for(i=0; i < ftpc->dirdepth; i++) {
283 if(ftpc->dirs[i]) {
284 free(ftpc->dirs[i]);
285 ftpc->dirs[i]=NULL;
288 free(ftpc->dirs);
289 ftpc->dirs = NULL;
290 ftpc->dirdepth = 0;
292 if(ftpc->file) {
293 free(ftpc->file);
294 ftpc->file = NULL;
470 struct ftp_conn *ftpc = &conn->proto.ftpc;
471 struct pingpong *pp = &ftpc->pp;
601 struct ftp_conn *ftpc = &conn->proto.ftpc;
603 if(ftpc->state != newstate)
605 ftpc, names[ftpc->state], names[newstate]);
607 ftpc->state = newstate;
615 PPSENDF(&conn->proto.ftpc.pp, "USER %s", ftp->user?ftp->user:"");
628 PPSENDF(&conn->proto.ftpc.pp, "PWD", NULL);
639 return Curl_pp_getsock(&conn->proto.ftpc.pp, socks, numsocks);
646 struct ftp_conn *ftpc = &conn->proto.ftpc;
661 switch(ftpc->state) {
665 return Curl_pp_getsock(&conn->proto.ftpc.pp, socks, numsocks);
682 struct ftp_conn *ftpc = &conn->proto.ftpc;
684 if(ftpc->cwddone)
688 ftpc->count2 = 0; /* count2 counts failed CWDs */
693 ftpc->count3 = (conn->data->set.ftp_create_missing_dirs==2)?1:0;
695 if(conn->bits.reuse && ftpc->entrypath) {
699 ftpc->count1 = 0; /* we count this as the first path, then we add one
701 PPSENDF(&conn->proto.ftpc.pp, "CWD %s", ftpc->entrypath);
705 if(ftpc->dirdepth) {
706 ftpc->count1 = 1;
709 PPSENDF(&conn->proto.ftpc.pp, "CWD %s", ftpc->dirs[ftpc->count1 -1]);
732 struct ftp_conn *ftpc = &conn->proto.ftpc;
1039 result = Curl_pp_sendf(&ftpc->pp, "%s |%d|%s|%hu|", mode[fcmd],
1047 ftpc->count1 = PORT;
1070 result = Curl_pp_sendf(&ftpc->pp, "%s %s", mode[fcmd], tmp);
1084 ftpc->count1 = fcmd;
1108 struct ftp_conn *ftpc = &conn->proto.ftpc;
1136 PPSENDF(&ftpc->pp, "%s", mode[modeoff]);
1138 ftpc->count1 = modeoff;
1170 if(!conn->proto.ftpc.file) {
1171 PPSENDF(&conn->proto.ftpc.pp, "PRET %s",
1177 PPSENDF(&conn->proto.ftpc.pp, "PRET STOR %s", conn->proto.ftpc.file);
1180 PPSENDF(&conn->proto.ftpc.pp, "PRET RETR %s", conn->proto.ftpc.file);
1195 struct ftp_conn *ftpc = &conn->proto.ftpc;
1197 if((ftp->transfer != FTPTRANSFER_BODY) && ftpc->file) {
1202 PPSENDF(&conn->proto.ftpc.pp, "REST %d", 0);
1216 struct ftp_conn *ftpc = &conn->proto.ftpc;
1218 if((ftp->transfer == FTPTRANSFER_INFO) && ftpc->file) {
1221 /* we know ftpc->file is a valid pointer to a file name */
1222 PPSENDF(&ftpc->pp, "SIZE %s", ftpc->file);
1286 result = Curl_pp_sendf(&conn->proto.ftpc.pp, "%s", cmd);
1328 struct ftp_conn *ftpc = &conn->proto.ftpc;
1333 if(data->set.opt_no_body && ftpc->file &&
1360 struct ftp_conn *ftpc = &conn->proto.ftpc;
1363 if((data->set.get_filetime || data->set.timecondition) && ftpc->file) {
1367 PPSENDF(&ftpc->pp, "MDTM %s", ftpc->file);
1385 struct ftp_conn *ftpc = &conn->proto.ftpc;
1405 PPSENDF(&ftpc->pp, "SIZE %s", ftpc->file);
1467 PPSENDF(&ftpc->pp, data->set.ftp_append?"APPE %s":"STOR %s",
1468 ftpc->file);
1482 struct ftp_conn *ftpc = &conn->proto.ftpc;
1507 ftpc->count1 = 0;
1509 ftpc->count1++;
1515 while((i< ftpc->count1) && item) {
1523 ftpc->count2 = 1; /* the sent command is allowed to fail */
1526 ftpc->count2 = 0; /* failure means cancel operation */
1528 PPSENDF(&ftpc->pp, "%s", cmd);
1545 if(ftpc->known_filesize != -1) {
1546 Curl_pgrsSetDownloadSize(data, ftpc->known_filesize);
1547 result = ftp_state_post_retr_size(conn, ftpc->known_filesize);
1550 PPSENDF(&ftpc->pp, "SIZE %s", ftpc->file);
1569 struct ftp_conn *ftpc = &conn->proto.ftpc;
1585 if((ftpc->count1 == 0) &&
1634 else if((ftpc->count1 == 1) &&
1685 else if(ftpc->count1 == 0) {
1692 PPSENDF(&ftpc->pp, "PASV", NULL);
1693 ftpc->count1++;
1748 if(result && ftpc->count1 == 0 && ftpcode == 229) {
1754 PPSENDF(&ftpc->pp, "PASV", NULL);
1755 ftpc->count1++;
1841 struct ftp_conn *ftpc = &conn->proto.ftpc;
1842 ftpport fcmd = (ftpport)ftpc->count1;
1876 struct ftp_conn *ftpc = &conn->proto.ftpc;
1902 ftpc->file &&
2010 struct ftp_conn *ftpc = &conn->proto.ftpc;
2072 PPSENDF(&ftpc->pp, "REST %" FORMAT_OFF_T, data->state.resume_from);
2079 PPSENDF(&ftpc->pp, "RETR %s", ftpc->file);
2128 struct ftp_conn *ftpc = &conn->proto.ftpc;
2150 PPSENDF(&ftpc->pp, "RETR %s", ftpc->file);
2204 conn->proto.ftpc.pp.pending_resp = TRUE; /* expect a server response */
2317 conn->proto.ftpc.pp.pending_resp = TRUE; /* expect server response */
2370 PPSENDF(&conn->proto.ftpc.pp, "PBSZ %d", 0);
2387 struct ftp_conn *ftpc = &conn->proto.ftpc;
2391 if((ftpcode == 331) && (ftpc->state == FTP_USER)) {
2394 PPSENDF(&ftpc->pp, "PASS %s", ftp->passwd?ftp->passwd:"");
2404 PPSENDF(&ftpc->pp, "ACCT %s", data->set.str[STRING_FTP_ACCOUNT]);
2421 PPSENDF(&conn->proto.ftpc.pp, "%s",
2458 struct ftp_conn *ftpc = &conn->proto.ftpc;
2459 struct pingpong *pp = &ftpc->pp;
2473 switch(ftpc->state) {
2503 ftpc->count3=0;
2507 ftpc->count2 = 1; /* add one to get next */
2508 ftpc->count1 = 0;
2511 ftpc->count2 = -1; /* subtract one to get next */
2512 ftpc->count1 = 1;
2519 PPSENDF(&ftpc->pp, "AUTH %s", ftpauth[ftpc->count1]);
2548 else if(ftpc->count3 < 1) {
2549 ftpc->count3++;
2550 ftpc->count1 += ftpc->count2; /* get next attempt */
2551 result = Curl_pp_sendf(&ftpc->pp, "AUTH %s", ftpauth[ftpc->count1]);
2569 result = ftp_state_user_resp(conn, ftpcode, ftpc->state);
2577 PPSENDF(&ftpc->pp, "PROT %c",
2597 PPSENDF(&ftpc->pp, "CCC", NULL);
2676 if(!ftpc->server_os && dir[0] != '/') {
2678 result = Curl_pp_sendf(&ftpc->pp, "SYST", NULL);
2683 Curl_safefree(ftpc->entrypath);
2684 ftpc->entrypath = dir; /* remember this */
2685 infof(data, "Entry path is '%s'\n", ftpc->entrypath);
2687 data->state.most_recent_ftp_entrypath = ftpc->entrypath;
2692 Curl_safefree(ftpc->entrypath);
2693 ftpc->entrypath = dir; /* remember this */
2694 infof(data, "Entry path is '%s'\n", ftpc->entrypath);
2696 data->state.most_recent_ftp_entrypath = ftpc->entrypath;
2731 result = Curl_pp_sendf(&ftpc->pp, "SITE NAMEFMT 1", NULL);
2737 Curl_safefree(ftpc->server_os);
2738 ftpc->server_os = os;
2745 Curl_safefree(ftpc->server_os);
2746 ftpc->server_os = os;
2772 if((ftpcode >= 400) && !ftpc->count2) {
2777 result = ftp_state_quote(conn, FALSE, ftpc->state);
2787 ftpc->count1 && !ftpc->count2) {
2789 ftpc->count2++; /* counter to prevent CWD-MKD loops */
2790 PPSENDF(&ftpc->pp, "MKD %s", ftpc->dirs[ftpc->count1 - 1]);
2796 ftpc->cwdfail = TRUE; /* don't remember this path as we failed
2803 ftpc->count2=0;
2804 if(++ftpc->count1 <= ftpc->dirdepth) {
2806 PPSENDF(&ftpc->pp, "CWD %s", ftpc->dirs[ftpc->count1 - 1]);
2817 if((ftpcode/100 != 2) && !ftpc->count3--) {
2824 PPSENDF(&ftpc->pp, "CWD %s", ftpc->dirs[ftpc->count1 - 1]);
2835 result = ftp_state_type_resp(conn, ftpcode, ftpc->state);
2841 result = ftp_state_size_resp(conn, ftpcode, ftpc->state);
2846 result = ftp_state_rest_resp(conn, ftpcode, ftpc->state);
2868 result = ftp_state_get_resp(conn, ftpcode, ftpc->state);
2892 struct ftp_conn *ftpc = &conn->proto.ftpc;
2893 CURLcode result = Curl_pp_multi_statemach(&ftpc->pp);
2898 *done = (ftpc->state == FTP_STOP) ? TRUE : FALSE;
2905 struct ftp_conn *ftpc = &conn->proto.ftpc;
2906 struct pingpong *pp = &ftpc->pp;
2909 while(ftpc->state != FTP_STOP) {
2957 conn->proto.ftpc.known_filesize = -1; /* unknown size for now */
2980 struct ftp_conn *ftpc = &conn->proto.ftpc;
2982 struct pingpong *pp = &ftpc->pp;
3067 struct ftp_conn *ftpc = &conn->proto.ftpc;
3068 struct pingpong *pp = &ftpc->pp;
3072 bool was_ctl_valid = ftpc->ctl_valid;
3099 ftpc->ctl_valid = was_ctl_valid;
3106 ftpc->ctl_valid = FALSE;
3107 ftpc->cwdfail = TRUE; /* set this TRUE to prevent us to remember the
3115 if(ftpc->prevpath)
3116 free(ftpc->prevpath);
3119 if(data->set.chunk_end && ftpc->file) {
3122 ftpc->known_filesize = -1;
3132 ftpc->ctl_valid = FALSE; /* mark control connection as bad */
3134 ftpc->prevpath = NULL; /* no path remembering */
3137 size_t flen = ftpc->file?strlen(ftpc->file):0; /* file is "raw" already */
3139 if(!ftpc->cwdfail) {
3141 ftpc->prevpath = path;
3144 ftpc->prevpath[dlen]=0; /* terminate */
3148 ftpc->prevpath=strdup("");
3151 if(ftpc->prevpath)
3152 infof(data, "Remembering we are in dir \"%s\"\n", ftpc->prevpath);
3155 ftpc->prevpath = NULL; /* no path */
3160 freedirs(ftpc);
3169 if(!result && ftpc->dont_check && data->req.maxdownload > 0)
3175 ftpc->ctl_valid = FALSE; /* mark control connection as bad */
3194 if(!result && (ftp->transfer == FTPTRANSFER_BODY) && ftpc->ctl_valid &&
3213 ftpc->ctl_valid = FALSE; /* mark control connection as bad */
3220 if(ftpc->dont_check && data->req.maxdownload > 0) {
3228 if(!ftpc->dont_check) {
3268 else if(!ftpc->dont_check &&
3278 ftpc->dont_check = FALSE;
3304 struct ftp_conn *ftpc = &conn->proto.ftpc;
3305 struct pingpong *pp = &ftpc->pp;
3352 return conn->proto.ftpc.transfertype != (ascii_wanted?'A':'I');
3366 struct ftp_conn *ftpc = &conn->proto.ftpc;
3370 if(ftpc->transfertype == want) {
3375 PPSENDF(&ftpc->pp, "TYPE %c", want);
3379 ftpc->transfertype = want;
3416 struct ftp_conn *ftpc = &conn->proto.ftpc;
3451 ftpc->dont_check = TRUE; /* dont check for successful transfer */
3469 struct ftp_conn *ftpc = &conn->proto.ftpc;
3493 else if(data->set.ftp_list_only || !ftpc->file) {
3706 struct ftp_conn *ftpc = &conn->proto.ftpc;
3745 ftpc->known_filesize = finfo->size;
3908 if(conn->proto.ftpc.ctl_valid) {
3909 result = Curl_pp_sendf(&conn->proto.ftpc.pp, "QUIT", NULL);
3913 conn->proto.ftpc.ctl_valid = FALSE; /* mark control connection as bad */
3936 struct ftp_conn *ftpc= &conn->proto.ftpc;
3937 struct pingpong *pp = &ftpc->pp;
3947 ftpc->ctl_valid = FALSE;
3952 if(ftpc->entrypath) {
3954 if(data->state.most_recent_ftp_entrypath == ftpc->entrypath) {
3957 free(ftpc->entrypath);
3958 ftpc->entrypath = NULL;
3961 freedirs(ftpc);
3962 if(ftpc->prevpath) {
3963 free(ftpc->prevpath);
3964 ftpc->prevpath = NULL;
3966 if(ftpc->server_os) {
3967 free(ftpc->server_os);
3968 ftpc->server_os = NULL;
3993 struct ftp_conn *ftpc = &conn->proto.ftpc;
4002 ftpc->ctl_valid = FALSE;
4003 ftpc->cwdfail = FALSE;
4021 ftpc->file is not used anywhere other than for operations on a file.
4032 ftpc->dirdepth = 0;
4037 ftpc->dirs = calloc(1, sizeof(ftpc->dirs[0]));
4038 if(!ftpc->dirs)
4041 ftpc->dirs[0] = curl_easy_unescape(conn->data, slash_pos ? cur_pos : "/",
4044 if(!ftpc->dirs[0]) {
4045 freedirs(ftpc);
4048 ftpc->dirdepth = 1; /* we consider it to be a single dir */
4057 ftpc->dirdepth = 0;
4058 ftpc->diralloc = 5; /* default dir depth to allocate */
4059 ftpc->dirs = calloc(ftpc->diralloc, sizeof(ftpc->dirs[0]));
4060 if(!ftpc->dirs)
4066 ftpc->dirs[0] = strdup("/");
4067 ftpc->dirdepth++;
4074 (ftpc->dirdepth == 0))?1:0;
4082 ftpc->dirs[ftpc->dirdepth] =
4084 if(!ftpc->dirs[ftpc->dirdepth]) { /* run out of memory ... */
4086 freedirs(ftpc);
4089 if(isBadFtpString(ftpc->dirs[ftpc->dirdepth])) {
4090 free(ftpc->dirs[ftpc->dirdepth]);
4091 freedirs(ftpc);
4101 if(++ftpc->dirdepth >= ftpc->diralloc) {
4104 ftpc->diralloc *= 2; /* double the size each time */
4105 bigger = realloc(ftpc->dirs, ftpc->diralloc * sizeof(ftpc->dirs[0]));
4107 freedirs(ftpc);
4110 ftpc->dirs = bigger;
4119 ftpc->file = curl_easy_unescape(conn->data, filename, 0, NULL);
4120 if(NULL == ftpc->file) {
4121 freedirs(ftpc);
4125 if(isBadFtpString(ftpc->file)) {
4126 freedirs(ftpc);
4131 ftpc->file=NULL; /* instead of point to a zero byte, we make it a NULL
4134 if(data->set.upload && !ftpc->file && (ftp->transfer == FTPTRANSFER_BODY)) {
4140 ftpc->cwddone = FALSE; /* default to not done */
4142 if(ftpc->prevpath) {
4148 freedirs(ftpc);
4152 dlen -= ftpc->file?(int)strlen(ftpc->file):0;
4153 if((dlen == (int)strlen(ftpc->prevpath)) &&
4154 strnequal(path, ftpc->prevpath, dlen)) {
4156 ftpc->cwddone = TRUE;
4170 struct ftp_conn *ftpc = &conn->proto.ftpc;
4189 ftpc->ctl_valid = TRUE; /* seems good */
4229 struct ftp_conn *ftpc = &conn->proto.ftpc;
4237 ftpc->ctl_valid = TRUE; /* starts good */
4254 freedirs(ftpc);