1.busybox 的ftp功能,校驗密碼 始下面的函式嗎?
2.代碼中 case 230 case331 是什么意思?
static int ftpcmd(const char *s1, const char *s2)
{
unsigned n;
if (verbose_flag) {
bb_error_msg("cmd %s %s", s1, s2);
}
if (s1) {
fprintf(control_stream, (s2 ? "%s %s\r\n" : "%s %s\r\n"+3),
s1, s2);
fflush(control_stream);
}
do {
strcpy(buf, "EOF");
if (fgets(buf, BUFSZ - 2, control_stream) == NULL) {
ftp_die(NULL);
}
} while (!isdigit(buf[0]) || buf[3] != ' ');
buf[3] = '\0';
n = xatou(buf);
buf[3] = ' ';
return n;
}
static void ftp_login(void)
{
/* Connect to the command socket */
control_stream = fdopen(xconnect_stream(lsa), "r+");
if (control_stream == NULL) {
/* fdopen failed - extremely unlikely */
bb_perror_nomsg_and_die();
}
if (ftpcmd(NULL, NULL) != 220) {
ftp_die(NULL);
}
/* Login to the server */
switch (ftpcmd("USER", user)) {
case 230:
break;
case 331:
if (ftpcmd("PASS", password) != 230) {
ftp_die("PASS");
}
break;
default:
ftp_die("USER");
}
ftpcmd("TYPE I", NULL);
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/56715.html
標籤:內核源代碼研究區
