- while (1) {
- uint32_t cmdval = cmdio_get_cmd_and_arg();
- if (cmdval == const_USER) {
- if (anon_opt && strcmp(G.ftp_arg, "anonymous") == 0) {
- pw = getpwnam(anon_opt);
- if (pw)
- break; /* does not even ask for password */
- }
- pw = getpwnam(G.ftp_arg);
- cmdio_write_raw(STR(FTP_GIVEPWORD)" Please specify password\r\n");
- } else if (cmdval == const_PASS) {
- if (check_password(pw, G.ftp_arg) > 0) {
- break; /* login success */
+ if (!(opts & OPT_A)) {
+ while (1) {
+ uint32_t cmdval = cmdio_get_cmd_and_arg();
+ if (cmdval == const_USER) {
+ if (anon_opt && strcmp(G.ftp_arg, "anonymous") == 0) {
+ pw = getpwnam(anon_opt);
+ if (pw)
+ break; /* does not even ask for password */
+ }
+ pw = getpwnam(G.ftp_arg);
+ cmdio_write_raw(STR(FTP_GIVEPWORD)" Specify password\r\n");
+ } else if (cmdval == const_PASS) {
+ if (check_password(pw, G.ftp_arg) > 0) {
+ break; /* login success */
+ }
+ cmdio_write_raw(STR(FTP_LOGINERR)" Login failed\r\n");
+ pw = NULL;
+ } else if (cmdval == const_QUIT) {
+ WRITE_OK(FTP_GOODBYE);
+ return 0;
+ } else {
+ cmdio_write_raw(STR(FTP_LOGINERR)" Login with USER+PASS\r\n");