On Feb 5, 2008 10:57 AM, Dan Nicholson <[EMAIL PROTECTED]> wrote:
> On Feb 5, 2008 10:19 AM, Alessandro Corbelli <[EMAIL PROTECTED]> wrote:
> >
> > Il giorno mar, 05/02/2008 alle 10.10 -0800, Dan Nicholson ha scritto:
> > > So, is the problem that it's not asking you to enter the password
> > > again if it's a weak password?
> >
> > It doesn't ask also the first passwd.
>
> This is normal when you're running passwd as root, I think. If you add
> a user then run passwd as that user, I think you will be prompted for
> the current password.
>
> # useradd foo
> # su -c "passwd" foo
>
> I had a look at the shadow source, and it seems that the messages for
> "New password: " and "Re-enter new password: " are not making it to
> the screen. These should be printed when calling the function
> getpass(). Reading the getpass(3) manpage, it seems that /dev/tty is
> used for sending the messages and receiving the password. Do you have
> the /dev/tty device? Can you show the permissions?

Here's a testcase to try out:

# cat > getpass.c << "EOF"
#include <stdio.h>
#include <unistd.h>
#include <errno.h>

int main()
{
        char *password = getpass("Enter your password: ");

        if (errno) {
                perror("getpass");
                return 1;
        }

        return 0;
}
EOF
# gcc -o getpass getpass.c
# ./getpass
# echo $?

Does it let you enter a password? Does it return an error? I suspect
you'll get a permission denied error.

--
Dan
-- 
http://linuxfromscratch.org/mailman/listinfo/lfs-support
FAQ: http://www.linuxfromscratch.org/lfs/faq.html
Unsubscribe: See the above information page

Reply via email to