Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow specifying NON-PRINT format control #391

Merged
merged 1 commit into from
Jan 24, 2023

Conversation

siminn-arnorgj
Copy link
Contributor

According to RFC 959 section 3.1.1.5. Non-print format must be accepted by all FTP implementations. It's currently accepted if the format parameter is omitted as it is the default format control but if the second parameter is sent the current implementation breaks.

@drakkan
Copy link
Collaborator

drakkan commented Jan 20, 2023

Hello,

just for validation, do you have a client that sends A N? I looked at the profpd code and it seems to support A/L 7 and I/L 8 as ftpserverlib. Thanks

@codecov
Copy link

codecov bot commented Jan 20, 2023

Codecov Report

Base: 86.25% // Head: 86.25% // No change to project coverage 👍

Coverage data is based on head (3c47833) compared to base (4c78a0b).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #391   +/-   ##
=======================================
  Coverage   86.25%   86.25%           
=======================================
  Files          11       11           
  Lines        1601     1601           
=======================================
  Hits         1381     1381           
  Misses        152      152           
  Partials       68       68           
Impacted Files Coverage Δ
handle_misc.go 95.43% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@siminn-arnorgj
Copy link
Contributor Author

Hello,

just for validation, do you have a client that sends A N? I looked at the profpd code and it seems to support A/L 7 and I/L 8 as ftpserverlib. Thanks

Yes we have a legacy client that sends "TYPE A N". We encountered this when trying out SFTPgo 🙂 to replace an existing system.

@drakkan
Copy link
Collaborator

drakkan commented Jan 20, 2023

This legacy client will also have issues with proftpd 😄

I see that vsftpd handles A N

static void
handle_type(struct vsf_session* p_sess)
{
  str_upper(&p_sess->ftp_arg_str);
  if (str_equal_text(&p_sess->ftp_arg_str, "I") ||
      str_equal_text(&p_sess->ftp_arg_str, "L8") ||
      str_equal_text(&p_sess->ftp_arg_str, "L 8"))
  {
    p_sess->is_ascii = 0;
    vsf_cmdio_write(p_sess, FTP_TYPEOK, "Switching to Binary mode.");
  }
  else if (str_equal_text(&p_sess->ftp_arg_str, "A") ||
           str_equal_text(&p_sess->ftp_arg_str, "A N"))
  {
    p_sess->is_ascii = 1;
    vsf_cmdio_write(p_sess, FTP_TYPEOK, "Switching to ASCII mode.");
  }
  else
  {
    vsf_cmdio_write(p_sess, FTP_BADCMD, "Unrecognised TYPE command.");
  }
}

LGTM

@fclairamb fclairamb merged commit 57c858f into fclairamb:main Jan 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants