$MAIL surprise

Lewandowsky, Matt mattl at livecapital.com
Sat Apr 7 06:19:22 EST 2001


Is there anyway for it to evaluate, at runtime, say $HOME? As your
mailspools are under each users's home directory, if I read correctly...

Unfortunately I have no machines which I can test this on easily at the
moment. (At least not with greatly upsetting a few people...)

Just a thought.

--Matt

> -----Original Message-----
> From: Steve VanDevender [mailto:stevev at darkwing.uoregon.edu]
> Sent: Friday, April 06, 2001 1:15 PM
> To: David Terrell
> Cc: openssh-unix-dev at mindrot.org
> Subject: Re: $MAIL surprise
> 
> 
> David Terrell writes:
>  > Are you sure the real problem isn't that sshd is started with your 
>  > environment at runtime?  I recently had a similar problem 
> with inetd.
>  > Try starting it like this:
>  > 
>  > env -i PATH=/some:/reasonable:/subset /usr/local/sbin/sshd
> 
> That was my first thought too, and I restarted sshd with "env -i" on
> that host and it didn't change anything.  I looked and here's 
> what's in
> config.h:
> 
> /* Set this to your mail directory if you don't have maillock.h */
> #define MAIL_DIRECTORY "/home/staff/stevev"
> 
> So then in defines.h this happens:
> 
> #ifndef MAIL_DIRECTORY
> # define MAIL_DIRECTORY "/var/spool/mail"
> #endif
> 
> #ifndef MAILDIR
> # define MAILDIR MAIL_DIRECTORY
> #endif
> 
> #if !defined(_PATH_MAILDIR) && defined(MAILDIR)
> # define _PATH_MAILDIR MAILDIR
> #endif /* !defined(_PATH_MAILDIR) && defined(MAILDIR) */
> 
> And finally in session.c this environment variable setting is created:
> 
>                 snprintf(buf, sizeof buf, "%.200s/%.50s",
>                          _PATH_MAILDIR, pw->pw_name);
>                 child_set_env(&env, &envsize, "MAIL", buf);
> 
> And this is what is in configure that gets it all started:
> 
> # Check for mail directory (last resort if we cannot get it 
> from headers)
> if test ! -z "$MAIL" ; then
>         maildir=`dirname $MAIL`
>         cat >> confdefs.h <<EOF
> #define MAIL_DIRECTORY "$maildir"
> EOF
> 
> The code in defines.h should use _PATH_MAILDIR if it's defined in the
> system headers, but at least in the case of the Solaris and SunOS
> systems where I'm seeing this happen, there is no setting for
> _PATH_MAILDIR in the system include files.
> 
> Like I said before, though, I'm not really arguing that this code or
> this approach to finding $MAIL is wrong, but it is surprising.
> 



More information about the openssh-unix-dev mailing list