<x-flowed>
Hello,

>I am willing to set up ftp.proxy (solaris) on a host performing
>authentication via a dedicated program ftpauth, so that users can do:
>
># ftp gwhost 2121
>Name: gwuser:[EMAIL PROTECTED]
>Password: gwpass:remotepass
>
>Where (gwuser,gwpass) is check in program ftpauth, so i used no
>configuration file and ran:
># ./ftp.proxy -D 2121 -a /usr/scripts/ftpauth -B -l -d -e
>
>And to test parameter passing between ftp.proxy and ftpauth:
># cat ftpauth
>#!/bin/sh
>date >>log
>echo "Params: $*">>log
>env >>log
>exit 0
>
>ftpauth is forked but neither $* nor env parameters are passed
>(i expected to see $PROXY_CLIENT PROXY_USERNAME $PROXY_SERVERLOGIN ...)

I took a quick look at ftp.proxy's source code.  It could be a problem 
there.  Unfortunately I don't have access to a Solaris box so I'm just 
guessing.

Under normal Linux there's the function setenv() which is used to add 
variables to the environment.  This does not exist under Solaris (as far as 
I know) and there's a workaround for this in the source.  Take a look at 
the function setvar() in ftp.c, there's an #ifdef for Solaris using the 
putenv() function which is UNIX standard.  Now looking into putenv()'s 
manpage I understand it, that the putenv()'s parameter should not be 
modified after putenv() has been called (this is what my Linux manpage 
says).  Now obviously this is done in ftp.proxy for Solaris which will than 
fail later in some way, e.g. by not providing the environment variables 
which have been set previously.

Now for the practical part.  Change the line

   putenv(varname);

in the Solaris code to

   putenv(strdup(varname));

If I'm right this should do the magic.

Regards

Wolfgang Zekoll

--
http://quietsche-entchen.de/ - schwimmt und quietscht.



--general-l------------------------------------
To unsubscribe please visit:
http://www.ftpproxy.org/html/maillinglists.html

</x-flowed>
From [EMAIL PROTECTED] Wed Jun 30 10:08:55 2004
Return-Path: <[EMAIL PROTECTED]>
Received: from mail.compucation.de (mail.compucation.de [213.185.64.44])
                by um1.pce.de (8.11.3/8.11.3/SuSE Linux 8.11.1-0.5) with ESMTP 
id i5TLagi18788
                (using TLSv1/SSLv3 with cipher RC4-MD5 (128 bits) verified NO)
                for <[EMAIL PROTECTED]>; Tue, 29 Jun 2004 23:36:42 +0200
Received: from postfix3-1.free.fr (postfix3-1.free.fr [213.228.0.44])
                by compucation.de (mail.compucation.de [213.185.64.44])
                (MDaemon.PRO.v7.1.2.R)
                with ESMTP id md50000013614.msg
                for <[EMAIL PROTECTED]>; Tue, 29 Jun 2004 23:36:13 +0200
Message-ID: <[EMAIL PROTECTED]>
Date: Tue, 29 Jun 2004 23:36:07 +0200
From: Gregoire Barbier <[EMAIL PROTECTED]>
To: "general-l List Member"  <[EMAIL PROTECTED]>
Subject: [general-l] External Authenticator {02}
References: <[EMAIL PROTECTED]> <[EMAIL PROTECTED]>
In-Reply-To: <[EMAIL PROTECTED]>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
User-Agent: Internet Messaging Program (IMP) 3.2.1
X-Lookup-Warning: MAIL lookup on [EMAIL PROTECTED] does not match 213.228.0.44
X-MDRemoteIP: 213.228.0.44
Sender: [EMAIL PROTECTED]
X-Return-Path: [EMAIL PROTECTED]
Precedence: bulk
List-Unsubscribe: <mailto:[EMAIL PROTECTED]>
X-MDMailing-List: [EMAIL PROTECTED]
X-MDSend-Notifications-To: [EMAIL PROTECTED]
Reply-To: [EMAIL PROTECTED]
X-MDaemon-Deliver-To: [EMAIL PROTECTED]
X-MDAV-Processed: mail.compucation.de, Tue, 29 Jun 2004 23:36:16 +0200
X-UIDL: L_("!>5l"!kpo!!CVI"!
X-Eudora2Unix: 3905-11-05T08:39:36Z converted

Selon Wolfgang Zekoll <[EMAIL PROTECTED]>:
(...)
> Now for the practical part.  Change the line
> 
>    putenv(varname);
> 
> in the Solaris code to
> 
>    putenv(strdup(varname));
> 
> If I'm right this should do the magic.
> 
> Regards
> 
> Wolfgang Zekoll

I don't know if the this code solves the problem, but I would like to just
remind you both that such code causes a memory leak (the string malloc'ed by
strdup needs to be free'ed), and therefore should neither be integrated in
ftp.proxy mainstream code nor used on a production server as is.
Of course it's certainly a good way to test if the problem comes from putenv.

If it can be of any help to you, I copy the man page of putenv found on a
Solaris 8 box of mine. It seems to give the same warning than the Linux one. Of
course it's hard to say if they are only POSIX standard-related warnings or real
potential problems on either Solaris or Linux.

I did not read the code and did not ever used the -a feature of ftp.proxy.

Good luck to you both.

Thanks to all ftp.proxy community for your job.

--
Gregoire Barbier - gregoire.barbier(at)free.fr - +33 6 21 35 73 49


Standard C Library Functions                           putenv(3C)

NAME
     putenv - change or add value to environment

SYNOPSIS
     #include <stdlib.h>

     int putenv(char *string);

DESCRIPTION
     The putenv() function makes the  value  of  the  environment
     variable  name  equal to value by altering an existing vari-
     able or creating a new  one.  In  either  case,  the  string
     pointed  to  by  string  becomes part of the environment, so
     altering the string will change the environment.

     The  string  argument  points  to  a  string  of  the   form
     name=value.  The space used by string is no longer used once
     a new string-defining name is passed to putenv().

     The  putenv()  function  uses  malloc(3C)  to  enlarge   the
     environment.

     After putenv() is called, environment variables are  not  in
     alphabetical order.

RETURN VALUES
     The putenv() functions returns a non-zero value  if  it  was
     unable  to  obtain  enough  space  using   malloc(3C) for an
     expanded environment. Otherwise, 0 is returned.

ERRORS
     The putenv() function may fail if:

     ENOMEM
           Insufficient memory was available.

USAGE
     The  putenv()  function  can  be  safely  called  from  mul-
     tithreaded  programs.   Caution must be exercised when using
     this function  and  getenv(3C)  in  multithreaded  programs.
     These  functions  examine  and  modify the environment list,
     which is shared by all threads in  a  program.   The  system
     prevents  the list from being accessed simultaneously by two
     different  threads.   It  does  not,  however,  prevent  two
     threads  from  successively  accessing  the environment list
     using putenv() or getenv().

ATTRIBUTES
     See attributes(5) for descriptions of the  following  attri-
     butes:

SunOS 5.8           Last change: 12 Jan 1998                    1

Standard C Library Functions                           putenv(3C)

     ____________________________________________________________
    |       ATTRIBUTE TYPE        |       ATTRIBUTE VALUE       |
    |_____________________________|_____________________________|
    | MT-Level                    | Safe                        |
    |_____________________________|_____________________________|

SEE ALSO
     exec(2), getenv(3C), malloc(3C), attributes(5), environ(5)

WARNINGS
     The string argument should not be an automatic variable.  It
     should  be  declared static if it is declared within a func-
     tion because it cannot be automatically declared.  A  poten-
     tial  error  is  to  call  putenv()  with  a  pointer  to an
     automatic variable as the argument and to then exit the cal-
     ling function while string is still part of the environment.

SunOS 5.8           Last change: 12 Jan 1998                    2



--general-l------------------------------------
To unsubscribe please visit:
http://www.ftpproxy.org/html/maillinglists.html

Reply via email to