Howto use cttyhack with login - job control turned off

Denys Vlasenko vda.linux at googlemail.com
Wed Jul 1 23:11:16 UTC 2009


On Wednesday 01 July 2009 12:27, Manuel Sahm wrote:
> >> After restart I type the correct login data an the this appears:
> >>
> >> 192.168.3.141 login: root
> >> Password:
> >> Login incorrect
> >>
> >> 192.168.3.141 login:
> >>
> >> Any ideas ?
> >
> >Well, it's obvious. You are entering wrong password... of course
> >ogin won't start the shell!
>
> Hello, sorry the problem is still there - I tried the followig sequnce:
>  
> inittab file entry:    ::respawn:/bin/login
>  
> Login starts and I enter my Login data - the problem with job control occurs.
> Then I try on the shell: /bin/cttyhack /bin/login
> and after that I cannot login :
> 192.168.3.141 login: root
> Password:
> Login incorrect
> 192.168.3.141 login:
>  
> I enter the right password....
>  
> This problem occurs too, if the inittab file entry is ::respawn:/bincttyhack/ /bin/login

Please got to login.c, find this fragment:

                pw = getpwnam(username);
                if (!pw) {
                        strcpy(username, "UNKNOWN");
                        goto fake_it;
                }

                if (pw->pw_passwd[0] == '!' || pw->pw_passwd[0] == '*')
                        goto auth_failed;

                if (opt & LOGIN_OPT_f)
                        break; /* -f USER: success without asking passwd */

                if (pw->pw_uid == 0 && !check_securetty())
                        goto auth_failed;

                /* Don't check the password if password entry is empty (!) */
                if (!pw->pw_passwd[0])
                        break;
 fake_it:
                /* authorization takes place here */
                if (correct_password(pw))
                        break;


and change it into:


                pw = getpwnam(username);
                if (!pw) {
                        strcpy(username, "UNKNOWN");
bb_error_msg("BAD USERNAME");
                        goto fake_it;
                }

                if (pw->pw_passwd[0] == '!' || pw->pw_passwd[0] == '*')
{bb_error_msg("BAD pw_passwd");
                        goto auth_failed;
}

                if (opt & LOGIN_OPT_f)
                        break; /* -f USER: success without asking passwd */

                if (pw->pw_uid == 0 && !check_securetty())
{bb_error_msg("BAD pw_uid or !securetty");
                        goto auth_failed;
}

                /* Don't check the password if password entry is empty (!) */
                if (!pw->pw_passwd[0])
                        break;
 fake_it:
                /* authorization takes place here */
                if (correct_password(pw))
{bb_error_msg("correct_password FAILED");
                        break;
}



What do you see now?
--
vda


More information about the busybox mailing list