troglobit/uftpd

Doesn't seem to compile

rgpublic opened this issue · 10 comments

checking for getsubopt... yes
checking for gettimeofday... yes
checking for uint8_t... yes
checking for uint16_t... yes
checking for uint32_t... yes
./configure: line 4351: syntax error near unexpected token `uev,'
./configure: line 4351: `PKG_CHECK_MODULES(uev,  libuev >= 2.2.0)'

I did a clone of all 3 projects and then did this:

#!/bin/bash

cd libuev
./autogen.sh
./configure
make
make install
cd ..

cd libite
./autogen.sh
./configure
make
make install
cd ..

cd uftpd
./autogen.sh
./configure
make
make install
cd ..

What system did you try to build it on? There are some caveats for non-Debian/Ubuntu Linux based systems.

Update: I just pushed a minor update to the README, detailing the requirement on the pkg-config tool. Hopefully that's the root cause of your problems.

Ubuntu Disco. I'm compiling inside a docker container. My ultimate goal BTW is to create a static build which I can then transfer to our real server and use there without creating a mess there with all the build packages.

Ah. Hooray. Brilliant. Your pkg-config tip was the right one. I hadn't installed this package. Thanks a lot!

Great! I'll add a check + warning to the configure script :-)

Wow, this is really cool. I'm so happy I discovered this tool. If anyone else is interested: You can very simply create a static build with (perhaps you'd also want to mention this in the README, @troglobit):
./configure --LDFLAGS=-static
This flag is only needed for uftpd, not for the libuev/libite libraries. Voilà, an only 1.4 MB sized complete FTP server you can take anywhere you want. Amazing! No more terrible VSFTPd confusing you with hundreds of crazy options.

Ah, unfortunately, there's still some remaining problem: Everything seems to work but I just cannot authenticate. No matter which credentials (user/password) I try, uftpd always says: "Guest login OK" and then I'm in an empty folder. I wonder if it's due to these messages here during static build:

/usr/bin/ld: uftpd-common.o: in function `new_session':
/usr/src/uftpd/src/common.c:252: warning: Using 'initgroups' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/bin/ld: uftpd-uftpd.o: in function `init':
/usr/src/uftpd/src/uftpd.c:171: warning: Using 'getpwnam' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/bin/ld: uftpd-uftpd.o: in function `find_port':
/usr/src/uftpd/src/uftpd.c:131: warning: Using 'getservbyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking

Although all shared libraries should be available, because it's the same distro... Hmmm. Scratches head. And I wonder why any credentials are accepted. Shouldn't only the user "ftp" and corresponding UNIX password be allowed?

Suddenly it works. I can list files. But even worse: Any password is accepted. Is this normal?

Yup, there is no user or password handling at all. That is one of the things that make uftpd really small.

uftpd/src/ftpcmd.c

Lines 257 to 266 in 04ea51c

static int check_user_pass(ctrl_t *ctrl)
{
if (!ctrl->name[0])
return -1;
if (!strcmp("anonymous", ctrl->name))
return 1;
return 0;
}

Patches welcome ;-)

Ah, I see. I thought at least the FTP user's password is checked. A bit sad, because I think it rules out a lot of use-cases like mine where I just wanted to give someone temporary access to our server to fix some specific problem. Although I'm not only a C novice and this language always frightens me a bit, I tried to be brave and add this feature. I thought I got pretty close, but now it just hangs after receiving the username. Hmmm :-(

rgpublic@936f1fc

Any hints on what may be wrong are very welcome :-)

Yeah C can be a bit frightening, but I think you made a good job of it! :)

I posted a comment in the patch, I hope I'm not completely off base. For an official feature it needs a bit more work, but otherwise it looks good.