Quellcode durchsuchen

ftp: improved error reporting

Sergey Alirzaev vor 4 Jahren
Ursprung
Commit
705f08431e
1 geänderte Dateien mit 6 neuen und 0 gelöschten Zeilen
  1. 6 0
      modules/ftp.c

+ 6 - 0
modules/ftp.c

@@ -283,6 +283,7 @@ static void lwftp_control_process(lwftp_session_t *s, struct tcp_pcb *tpcb, stru
           lwftp_send_msg(s, PTRNLEN("\n"));
           s->control_state = LWFTP_USER_SENT;
         } else {
+          s->error = "The server doesn't greet us";
           s->control_state = LWFTP_QUIT;
         }
       }
@@ -297,6 +298,7 @@ static void lwftp_control_process(lwftp_session_t *s, struct tcp_pcb *tpcb, stru
         } else if (response==230) {
           goto anonymous;
         } else {
+          s->error = "Wrong user name";
           s->control_state = LWFTP_QUIT;
         }
       }
@@ -308,6 +310,7 @@ anonymous:
           lwftp_send_msg(s, PTRNLEN("TYPE I\n"));
           s->control_state = LWFTP_TYPE_SENT;
         } else {
+          s->error = "Wrong password";
           s->control_state = LWFTP_QUIT;
         }
       }
@@ -318,6 +321,7 @@ anonymous:
           lwftp_send_msg(s, PTRNLEN("PASV\n"));
           s->control_state = LWFTP_PASV_SENT;
         } else {
+          s->error = "The server doesn't support binary files";
           s->control_state = LWFTP_QUIT;
         }
       }
@@ -341,6 +345,7 @@ anonymous:
           lwftp_send_msg(s, PTRNLEN("\n"));
           s->control_state = s->target_state;
         } else {
+          s->error = "The server doesn't support PASV";
           s->control_state = LWFTP_QUIT;
         }
       }
@@ -355,6 +360,7 @@ anonymous:
             LWIP_DEBUGF(LWFTP_WARNING, ("lwftp: %s '%s'\n", error, s->settings->remote_path));
         }
         else {
+          s->error = "The server doesn't start sending the file";
           s->control_state = LWFTP_QUIT;
           LWIP_DEBUGF(LWFTP_WARNING, ("lwftp:expected 150, received %d\n",response));
         }