SUMMARY wu-ftpd/Dunix/log commands

From: Kai Grunau <kgrunau_at_ifm.uni-kiel.de>
Date: Wed, 8 Jan 1997 11:43:11 +0100 (MET)

Hi,

thanks to all who sent an answer of my question !

Here is the solution.
Kai
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Kai Grunau
Institut fuer Meereskunde | email kgrunau_at_ifm.uni-kiel.de
an der Universitaet Kiel | Phone ++49 +431 597-4017
Duesternbrooker Weg 20 | Fax ++49 +431 565876
D-24105 Kiel/Germany | URL http://www.ifm.uni-kiel.de
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Hello,

I forward you herewith the solution I've found and posted in the wu-ftpd
mailing-list.

Daniel

-------------------------------------


My initial posting was :

>It seems to me that there is some bug in Digital Unix 3.2c when using some
>system calls.
>
>I'm currently using WU FTPD and I was surprised not to see some messages in the
>daemon.log file.
>
>In fact all the messages are in it just before the following sequence :
>
> if (anonymous || guest) {
> /* We MUST do a chdir() after the chroot. Otherwise the old current
> * directory will be accessible as "." outside the new root! */
> if (anonymous) {
>/* the following line is added by me */
> syslog(LOG_INFO,"PW->PW_DIR %s", pw->pw_dir);
> if (chroot(pw->pw_dir) < 0 || chdir("/") < 0) {
> reply(550, "Can't set guest privileges.");
> goto bad;
> }
>/* the following two lines are added by me */
> reply(220, "after chroot and chdir.");
> syslog(LOG_INFO,"AFTER CHDIR ANONYMOUS %d GUEST %d", anonymous, guest);
>
>
>So what happens ?
>
>The first syslog works correctly and the PW->PW_DIR message is sent in the
>daemon.log file. But, if the "after chroot and chdir." is correctly sent to the
>user, the "AFTER CHDIR ANONYMOUS" is absolutely not sent to the daemon.log file.
>
>When the chdir,chroot is not executed, for an identified user, there is
>absolutely no problem.
>
>So for me the syslog doesn't work any more after the chroot,chdir.
>
>Bug (or feature) ?

Some of you answered that it was a feature because all the syslog related system
calls send message to /dev/log and after the chroot the /dev/log file is no more
there.

The standard Digital ftpd does log the commands after the chroot and Benoit
Maillard (maillard_at_fgt.dec.com) told me that it was because they don't use
the standard system calls.

While looking at the distribution files, I've found a syslog.c file in support
directory and I've modified the Makefile.osf in support/makefiles to include
it in the library.
There were 2 compilation errors on this file, in fact one warning and one error.

The warning is on

if ((p = malloc(strlen(ident) + 1)) == NULL)

and to suppress it, modify in

if ((p = (char *)malloc(strlen(ident) + 1)) == NULL)

The error was on the redefinition of openlog (or closelog). It comes from the
fact that these calls are redefined in <syslog.h>
extern int openlog __((const char *, int, int));
extern int syslog __((int, const char *, ...));
extern void closelog __((void));
extern int setlogmask __((int));

So I've copied /usr/include/syslog.h in the support directory and I've modified
it in suppressing these lines. Then I've modified syslog.c in replacing

#include <syslog.h> by #include "syslog.h"

So now all is working fine and even for anonymous users the commands are logged
correctly as for real users in the daemon.log file.


For the next version of wu-ftpd, it could be wise to add a definition about the
fact that the daemon is compiled with standard syslog calls or with included
syslog calls. The syslog.h problem has not yet been cleanly resolved in my
solution.

Daniel


o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o
| Daniel Clar e-mail : Daniel.Clar_at_supelec.fr |
| Computer Operations Manager : dc_at_supelec.fr |
| Service Informatique Supelec and |
| Plateau de Moulon DECUSF::CLAR_D or clar_d_at_decus.fr |
| 91192 Gif sur Yvette Cedex - France |
| Tel : (33 1) 69 85 14 87 Fax : (33 1) 69 85 12 34 |
o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o
Received on Wed Jan 08 1997 - 12:04:59 NZDT

This archive was generated by hypermail 2.4.0 : Wed Nov 08 2023 - 11:53:47 NZDT