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

NetBox trimming trailing spaces #378

Open
alabuzhev opened this issue Feb 22, 2024 · 0 comments
Open

NetBox trimming trailing spaces #378

alabuzhev opened this issue Feb 22, 2024 · 0 comments

Comments

@alabuzhev
Copy link
Contributor

FarGroup#5 by @carton-of-mice:

NetBox appears to trim trailing spaces on FTP listings (and in other places).
While at least CFtpListResult::parseAsMlsd() honours RFC 3659 and says it does not trim, that function is fed data from CFtpListResult::GetLine(), that explicitly removes tailing spaces and tabs.
This leads to an invalid directory listing that can't be used for further operations.
Assuming one knows the correct name of a directory, punching in CD "test " in the command line can work around this.
Behaviour reproduced at least with pure-ftpd (over MLSD) and vsftpd (on whatever it emits for LIST) and I imagine it should be similar with any backing filesystem and FTP server allowing trailing spaces in filenames.
While I agree that this is bad practice, more so with a badly defined protocol, this is compatibility problem first.

From the log for MLSD:

. 2020-09-15 19:18:03.395 type=dir;sizd=2;modify=20200915124101;UNIX.mode=0755;UNIX.uid=1001;UNIX.gid=1001;unique=39g45c4e1; test
. 2020-09-15 19:18:03.396 test;D;0;2020-09-15T12:41:01.000Z;3;"1001" [0];"1001" [0];rwxr-xr-x;0

Related trailing spaces issues I did not investigate much

  • with logging disabled, copying a file from local disk to FTP will error out(suggesting the path was trimmed beforehand) with
Can't open file
'C:\Path\test.bin  '.
System Error. Code: 2.
The system cannot find the file specified
  • with logging enabled the same silently fails(and no, the file is not 0 sized), but logs
. 2020-09-15 19:18:02.936 Copying 1 files/directories to remote directory "/path/" - total size: 0
  • creating a directory from the interface(F7) first strips trailing spaces (but not leading ones). an MKD test from the command line properly creates it with trailing space (or underscore, in the case of pure-ftpd, but it does reach the server properly). In both cases the log shows > 2020-09-15 20:14:59.692 mkd test without the trailing space
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

No branches or pull requests

1 participant