⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ftp_parser.c

📁 功能强大的ftp服务器源代码
💻 C
📖 第 1 页 / 共 2 页
字号:
            }            goto wayout;        } else if (!strcmp(cmd, "pbsz")) {            addreply_noformat(tls_cnx == NULL ? 503 : 200, "PBSZ=0");        } else if (!strcmp(cmd, "prot")) {            if (tls_cnx == NULL) {                addreply_noformat(503, "PBSZ?");                goto wayout;            }            switch (*arg) {            case 0:                addreply_noformat(503, MSG_MISSING_ARG);                break;            case 'C':                if (arg[1] == 0) {                    addreply_noformat(200, "OK");                    break;                }            default:                addreply_noformat(534, "Fallback to [C]");                break;            }#endif        } else if (!strcmp(cmd, "auth") || !strcmp(cmd, "adat")) {            addreply_noformat(500, MSG_AUTH_UNIMPLEMENTED);        } else if (!strcmp(cmd, "type")) {            antiidle();            dotype(arg);            goto wayout;        } else if (!strcmp(cmd, "mode")) {            antiidle();                            domode(arg);            goto wayout;#ifndef MINIMAL        } else if (!strcmp(cmd, "feat")) {            dofeat();            goto wayout;#endif        } else if (!strcmp(cmd, "stru")) {            dostru(arg);            goto wayout;#ifndef MINIMAL        } else if (!strcmp(cmd, "help")) {            goto help_site;#endif#ifdef DEBUG        } else if (!strcmp(cmd, "xdbg")) {            debug++;            addreply(200, MSG_XDBG_OK, debug);            goto wayout;#endif                    } else if (loggedin == 0) {                        /* from this point, all commands need authentication */            addreply_noformat(530, MSG_NOT_LOGGED_IN);            goto wayout;        } else {            if (!strcmp(cmd, "cwd") || !strcmp(cmd, "xcwd")) {                antiidle();                docwd(arg);                goto wayout;            } else if (!strcmp(cmd, "port")) {                doport(arg);#ifndef MINIMAL            } else if (!strcmp(cmd, "eprt")) {                doeprt(arg);	    } else if (!strcmp(cmd, "esta") &&		       disallow_passive == 0 &&		       STORAGE_FAMILY(force_passive_ip) == 0) {		doesta();	    } else if (!strcmp(cmd, "estp")) {		doestp();#endif            } else if (disallow_passive == 0 &&                        (!strcmp(cmd, "pasv") || !strcmp(cmd, "p@sw"))) {                dopasv(0);            } else if (disallow_passive == 0 &&                        (!strcmp(cmd, "epsv") &&                        (broken_client_compat == 0 ||                        STORAGE_FAMILY(ctrlconn) == AF_INET6))) {                if (!strcasecmp(arg, "all")) {                    epsv_all = 1;                    addreply_noformat(220, MSG_ACTIVE_DISABLED);                } else if (!strcmp(arg, "2") && !v6ready) {                    addreply_noformat(522, MSG_ONLY_IPV4);                } else {                    dopasv(1);                }#ifndef MINIMAL                        } else if (disallow_passive == 0 && !strcmp(cmd, "spsv")) {                dopasv(2);#endif            } else if (!strcmp(cmd, "pwd") || !strcmp(cmd, "xpwd")) {                antiidle();                addreply(257, "\"%s\" " MSG_IS_YOUR_CURRENT_LOCATION, wd);                goto wayout;                            } else if (!strcmp(cmd, "cdup") || !strcmp(cmd, "xcup")) {                docwd("..");            } else if (!strcmp(cmd, "retr")) {                if (*arg != 0) {                    doretr(arg);                } else {                    addreply_noformat(501, MSG_NO_FILE_NAME);                }            } else if (!strcmp(cmd, "rest")) {                antiidle();                if (*arg != 0) {                    dorest(arg);                } else {                    addreply_noformat(501, MSG_NO_RESTART_POINT);                    restartat = (off_t) 0;                }                goto wayout;            } else if (!strcmp(cmd, "dele")) {                if (*arg != 0) {                    dodele(arg);                } else {                    addreply_noformat(501, MSG_NO_FILE_NAME);                }            } else if (!strcmp(cmd, "stor")) {                arg = revealextraspc(arg);                if (*arg != 0) {                    dostor(arg, 0, autorename);                } else {                    addreply_noformat(501, MSG_NO_FILE_NAME);                }            } else if (!strcmp(cmd, "appe")) {                arg = revealextraspc(arg);                if (*arg != 0) {                    dostor(arg, 1, 0);                } else {                    addreply_noformat(501, MSG_NO_FILE_NAME);                }#ifndef MINIMAL            } else if (!strcmp(cmd, "stou")) {                dostou();#endif#ifndef DISABLE_MKD_RMD            } else if (!strcmp(cmd, "mkd") || !strcmp(cmd, "xmkd")) {                arg = revealextraspc(arg);                if (*arg != 0) {                    domkd(arg);                } else {                    addreply_noformat(501, MSG_NO_DIRECTORY_NAME);                }            } else if (!strcmp(cmd, "rmd") || !strcmp(cmd, "xrmd")) {                if (*arg != 0) {                    dormd(arg);                } else {                    addreply_noformat(550, MSG_NO_DIRECTORY_NAME);                }#endif#ifndef MINIMAL            } else if (!strcmp(cmd, "stat")) {                if (*arg != 0) {# ifdef WITH_TLS                    if (tls_cnx != NULL) {                        addreply_noformat(500, MSG_UNKNOWN_COMMAND);                    } else# endif                    {                        modern_listings = 0;                        donlist(arg, 1, 1, 1);                    }                } else {                    addreply_noformat(211, "http://www.pureftpd.org/");                }#endif            } else if (!strcmp(cmd, "list")) {#ifndef MINIMAL                modern_listings = 0;#endif                donlist(arg, 0, 1, 1);            } else if (!strcmp(cmd, "nlst")) {#ifndef MINIMAL                                modern_listings = 0;#endif                donlist(arg, 0, 0, broken_client_compat);#ifndef MINIMAL            } else if (!strcmp(cmd, "mlst")) {                domlst(*arg != 0 ? arg : ".");            } else if (!strcmp(cmd, "mlsd")) {                modern_listings = 1;                donlist(arg, 0, 1, 0);#endif            } else if (!strcmp(cmd, "abor")) {                addreply_noformat(226, MSG_ABOR_SUCCESS);#ifndef MINIMAL            } else if (!strcmp(cmd, "site")) {                if ((sitearg = arg) != NULL) {                    while (*sitearg != 0 && !isspace((unsigned char) *sitearg)) {                        sitearg++;                    }                    if (*sitearg != 0) {                        *sitearg++ = 0;                    }                }                if (!strcasecmp(arg, "idle")) {                    if (sitearg == NULL || *sitearg == 0) {                        addreply_noformat(501, "SITE IDLE: " MSG_MISSING_ARG);                    } else {                        unsigned long int i = 0;                        i = strtoul(sitearg, &sitearg, 10);                        if (sitearg && *sitearg)                            addreply(501, MSG_GARBAGE_FOUND " : %s", sitearg);                        else if (i > MAX_SITE_IDLE)                            addreply_noformat(501, MSG_VALUE_TOO_LARGE);                        else {                            idletime = i;                            addreply(200, MSG_IDLE_TIME, idletime);                            idletime_noop = (double) idletime * 2.0;                        }                    }                } else if (!strcasecmp(arg, "time")) {                    dositetime();                } else if (!strcasecmp(arg, "help")) {                    help_site:                                        addreply_noformat(214, MSG_SITE_HELP CRLF# ifdef WITH_DIRALIASES                                      " ALIAS" CRLF# endif                                      " CHMOD" CRLF " IDLE");                    addreply_noformat(214, "Pure-FTPd - http://pureftpd.org/");                } else if (!strcasecmp(arg, "chmod")) {                    char *sitearg2;                    mode_t mode;                                        parsechmod:                    if (sitearg == NULL || *sitearg == 0) {                        addreply_noformat(501, "SITE CHMOD: " MSG_MISSING_ARG);                        goto chmod_wayout;                    }                    sitearg2 = sitearg;                    while (*sitearg2 != 0 && !isspace((unsigned char) *sitearg2)) {                        sitearg2++;                    }                                        while (*sitearg2 != 0 && isspace((unsigned char) *sitearg2)) {                        sitearg2++;                    }                                        if (*sitearg2 == 0) {                        addreply_noformat(550, "SITE CHMOD: " MSG_NO_FILE_NAME);                        goto chmod_wayout;                    }                    mode = (mode_t) strtoul(sitearg, NULL, 8);                    if (mode > (mode_t) 07777) {                        addreply_noformat(501, "SITE CHMOD: " MSG_BAD_CHMOD);                        goto chmod_wayout;                    }                    dochmod(sitearg2, mode);                  chmod_wayout:                    (void) 0;# ifdef WITH_DIRALIASES                } else if (!strcasecmp(arg, "alias")) {                    if (sitearg == NULL || *sitearg == 0) {                        print_aliases();                    } else {                        register const char *alias;                                                if ((alias = lookup_alias(sitearg)) != NULL) {                            addreply(214, MSG_ALIASES_ALIAS, sitearg, alias);                        } else {                            addreply(502, MSG_ALIASES_UNKNOWN, sitearg);                        }                    }# endif                } else if (*arg != 0) {                    addreply(500, "SITE %s " MSG_UNKNOWN_EXTENSION, arg);                } else {                    addreply_noformat(500, "SITE: " MSG_MISSING_ARG);                }#endif            } else if (!strcmp(cmd, "mdtm")) {                domdtm(arg);            } else if (!strcmp(cmd, "size")) {                dosize(arg);#ifndef MINIMAL            } else if (!strcmp(cmd, "chmod")) {                sitearg = arg;                goto parsechmod;#endif            } else if (!strcmp(cmd, "rnfr")) {                if (*arg != 0) {                    dornfr(arg);                } else {                    addreply_noformat(550, MSG_NO_FILE_NAME);                }            } else if (!strcmp(cmd, "rnto")) {                arg = revealextraspc(arg);                if (*arg != 0) {                    dornto(arg);                } else {                    addreply_noformat(550, MSG_NO_FILE_NAME);                }            } else {                addreply_noformat(500, MSG_UNKNOWN_COMMAND);            }        }        noopidle = (time_t) -1;      wayout:#ifdef THROTTLING        if (throttling_delay != 0UL) {            usleep2(throttling_delay);        }#else        (void) 0;#endif    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -