Subject: Magic cookie in message file fails sometimes

From: [email-masked]
Date: Mon, 21 Jun 1999 15:50:04 +0000

Hello,

first of all thanks for the help with the variables. Now I have a problem
with message files. It seems the magic cookie %C could not be resolved
at all levels. At the cd command the ftp user gets:
Current directory: ftpd[29470]: syslog: fopen on /dev/null failed, errno 2
and the same message is logged in the system syslog file.

In ftpaccess I defined:
message .ftpint.msg          cwd=*   ftpint

The .ftpint.msg file is:
 Current directory: %C
 ...

We have the following directory structure under ftp-home:
drwxr-sr-x   4 root     sys          512 Jun 11 12:47 pub
pub:
total 32
-rw-r--r--   1 root     sys          199 Jun 17 10:18 .ftpext.msg
-rw-r--r--   1 root     sys          194 Jun 17 10:19 .ftpint.msg
----------   1 root     sys            0 Jun 11 12:47 .notar
drwx-wsr-t   3 root     ftpext       512 Jun 11 12:47 inbound
drwx-wsr-t   3 root     ftpint       512 Jun 21 14:56 outbound
inbound and outbound are mounted filesystems.

cd pub works. %C is replaced by /pub
cd inbound and cd outbound gave error messages.

Any idea?

-- 
Mit freundlichen Gruessen
Ulrike Schmidt

+----------------------------------------------------------------------+
| Ulrike Schmidt                                                       |
| Zentralinstitut fuer Angewandte Mathematik                           |
| Forschungszentrum Juelich GmbH                                       |
| D-52425 Juelich                                                      |
|                                           Phone: +49 02461 61-6577   |
| Email: [email-masked]            Fax:   +49 02461 61-6656   |
+----------------------------------------------------------------------+

---

From: Gregory A Lundberg <[email-masked]>
Date: Mon, 21 Jun 1999 10:23:58 -0400 (EDT)

On Mon, 21 Jun 1999 [email-masked] wrote:

> first of all thanks for the help with the variables. Now I have a
> problem with message files. It seems the magic cookie %C could not be
> resolved at all levels. At the cd command the ftp user gets: Current
> directory: ftpd[29470]: syslog: fopen on /dev/null failed, errno 2 and
> the same message is logged in the system syslog file.

Two things I can think of.  First, you probably should create /dev/null in
the ~ftp area.  Second, did you start the daemon as root?  It should have
permission to grab the cwd; since it does not my first guess is it wasn't
root.

-- 

Gregory A Lundberg              Senior Partner, VRnet Company
1441 Elmdale Drive              [email-masked]
Kettering, OH 45409-1615 USA    1-800-809-2195

---

From: [email-masked]
Date: Mon, 21 Jun 1999 17:40:56 +0000

On Jun 21, 10:23am, Gregory A Lundberg wrote:
> Subject: Re: Magic cookie in message file fails sometimes
> the ~ftp area.

I did it. The message changes to:
ftp> cd outbound
250- Current directory: ftpd[31386]: CWD outbound

> Second, did you start the daemon as root?  It should have

As far as I know, I do. The inetd.conf entry is:
 wuftp stream tcp nowait root /usr/local/wu-ftp/LOCALbin/in.ftpd in.ftpd -Llioa
but the process is shown as:
 ftp 31386  6450   0 17:22:46      -  0:00 ftpd: zam107. ...
If it should be root who switches the identity?
Perhaps should I mention my system is AIX 4.3.2.

---

From: Gregory A Lundberg <[email-masked]>
Date: Mon, 21 Jun 1999 12:00:49 -0400 (EDT)

> 250- Current directory: ftpd[31386]: CWD outbound

This looks like a syslog message is apearing on your screen mixed in with
the ftp output.  If this was from a client on a machine _other_ than the
FTP server, it may indicate there's a problem with the setup of the ~ftp
area.  Run through the FAQ and any how-to docs for anonymous FTP for your
system (some systems include such with the OS).

> If it should be root who switches the identity?

OK.  you're running as root.

> Perhaps should I mention my system is AIX 4.3.2.

AIX, eh?

ISTM AIX is one of those systems which has a broken runtime for the
getcwd() function, at least on some systems.

Try this:

in support/makefiles/Makefile.aix, change the lines reading
                 authuser.c
and
                 authuser.o
to read as
                 authuser.c getcwd.c
and
                 authuser.c getcwd.o
respectively.  Do a `./build clean` then rebuild the daemon.

Another choice is to change src/config/config.aix from reading
#define HAVE_GETCWD
to reading
#undef HAVE_GETCWD
which will cause a compile-time error because the system is lame, so we
need to remove the error be deleting the line reading
#error     wu-ftpd on this platform has security deficiencies!!!
from src/extensions.c.  Clean up and rebuild the daemon.

--

---

From: [email-masked]
Date: Wed, 23 Jun 1999 10:35:13 +0000

> system (some systems include such with the OS).

Yes, that was it. The directories are mounted filesystems and I missed the
execute rights on the overlayed mountpoints. Sorry!

> respectively.  Do a `./build clean` then rebuild the daemon.

With AIX 4.3.2 this gives a compile error:

cc -O2 -D_NO_PROTO   -c getcwd.c
"getcwd.c", line 139.20: 1506-068 (W) Operation between types "struct direct*"
and "struct
 dirent*" is not allowed.
"getcwd.c", line 139.48: 1506-068 (W) Operation between types "struct direct*"
and "struct
 dirent*" is not allowed.
"getcwd.c", line 144.24: 1506-022 (S) "d_fileno" is not a member of "struct
direct".
"getcwd.c", line 154.20: 1506-068 (W) Operation between types "struct direct*"
and "struct
 dirent*" is not allowed.
"getcwd.c", line 154.48: 1506-068 (W) Operation between types "struct direct*"
and "struct
 dirent*" is not allowed.
make: 1254-004 The error code from the last command is 1.

Thanks for all help.

---

From: Gregory A Lundberg <[email-masked]>
Date: Wed, 23 Jun 1999 09:03:26 -0400 (EDT)

On Wed, 23 Jun 1999 [email-masked] wrote:

> "getcwd.c", line 139.20: 1506-068 (W) Operation between types "struct direct*" and "struct dirent*" is not allowed.
> "getcwd.c", line 139.48: 1506-068 (W) Operation between types "struct direct*" and "struct dirent*" is not allowed.
> "getcwd.c", line 144.24: 1506-022 (S) "d_fileno" is not a member of "struct direct".
> "getcwd.c", line 154.20: 1506-068 (W) Operation between types "struct direct*" and "struct dirent*" is not allowed.
> "getcwd.c", line 154.48: 1506-068 (W) Operation between types "struct direct*" and "struct dirent*" is not allowed.

Jacques:  This way your puppy.  Wanna take a look at it and see if it's
not quite as portable as it should be?  While it's probably not required
on AIX, it would probably be nice if it compiled in case it ever is
needed.

--