On Fri, Feb 15, 2008 at 1:27 AM, TiagoCruz <[EMAIL PROTECTED]> wrote:
> Public bug reported:
>
>  During tests of FAUS application
>  (http://faus.sourceforge.net), release 1.4.5, an issue was found by using 
> getpwnam function from Perl. This
>  release was already tested against Mandriva, Debian and Oracle Linux without 
> showing the same bug.
>
>  The bug happens when executing the script addsmb by using the web 
> application. Executing the script in a
>  shell as root does not shows the same behaviour, working as expected.
>
>  The script addsmb is a Perl script that execute the following tasks:
>
>  1 - Add an user in /etc/passwd and /etc/shadow by using the Perl module 
> Passwd::Linux.
>  2 - Adds the user in the Samba database by using IPC::Open3 Perl module, 
> smbpasswd and pdbedit
>  programs.
>
>  The Passwd::Linux uses libc functions to manipulate the Linux user 
> databases. During step one of addsmb
>  Perl script, the user is added using Passwd::Linux module exported functions 
> and then calls getpwnam to
>  retrieve the ID created for the user.
>
>  When executed by the web application, the ID is not returned by getpwnam(), 
> that returns undef, making the
>  application to fail to create the user correctly.
>
>  The script addsmb is not suid: it's executed by faus.cgi by using Sudo 
> features. The CGI executes Sudo
>  with IPC::Open3, capturing STDOUT and STDERR. Sudo then invokes addsmb with 
> the given parameters.
>
>  We were unable to detect where the failure may be happening (libc and/or 
> getpwnam from Perl is our guess
>  because some advisory file locking should be published and respected) but we 
> could provide an workaround by
>  using "sleep 3" inside addsmb script, after calling Passwd::Linux and before 
> executing getpwnam().
>
>  Possible related packages:
>  1 - Perl core (includes IPC::Open3 and getpwnam())
>  2 - Sudo
>  3 - Apache
>  4 - Passwd::Linux
>
>  Please let me know what we could test to identify where is the cause of
>  the bug.
>
>  Thank you in advance.
>

My suggestion is to run the cgi file from a command line with Perl.
Also, are you checking $! after calling getpwnam() for any error
messages?

Steve Peters
[EMAIL PROTECTED]

-- 
Failure when using getpwnam core function from perl
https://bugs.launchpad.net/bugs/192055
You received this bug notification because you are a member of Ubuntu
Bugs, which is the bug contact for Ubuntu.

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to