Make sure to disable the root password if setRootPassword is false.

CAL-442 #comment This should be fixed now, please test and report back.
This commit is contained in:
Teo Mrnjavac 2017-01-12 13:44:11 +01:00
parent a59a79a816
commit c09a28919e
2 changed files with 22 additions and 2 deletions

View File

@ -1,6 +1,6 @@
/* === This file is part of Calamares - <http://github.com/calamares> === /* === This file is part of Calamares - <http://github.com/calamares> ===
* *
* Copyright 2014-2015, Teo Mrnjavac <teo@kde.org> * Copyright 2014-2017, Teo Mrnjavac <teo@kde.org>
* *
* Calamares is free software: you can redistribute it and/or modify * Calamares is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -59,6 +59,20 @@ SetPasswordJob::exec()
return Calamares::JobResult::error( tr( "Bad destination system path." ), return Calamares::JobResult::error( tr( "Bad destination system path." ),
tr( "rootMountPoint is %1" ).arg( destDir.absolutePath() ) ); tr( "rootMountPoint is %1" ).arg( destDir.absolutePath() ) );
if ( m_userName == "root" &&
m_newPassword.isEmpty() ) //special case for disabling root account
{
int ec = CalamaresUtils::System::instance()->
targetEnvCall( { "passwd",
"-dl",
m_userName } );
if ( ec )
return Calamares::JobResult::error( tr( "Cannot disable root account." ),
tr( "passwd terminated with error code %1." )
.arg( ec ) );
return Calamares::JobResult::ok();
}
QString encrypted = QString::fromLatin1( QString encrypted = QString::fromLatin1(
crypt( m_newPassword.toLatin1(), crypt( m_newPassword.toLatin1(),
QString( "$6$%1$" ) QString( "$6$%1$" )

View File

@ -1,6 +1,6 @@
/* === This file is part of Calamares - <http://github.com/calamares> === /* === This file is part of Calamares - <http://github.com/calamares> ===
* *
* Copyright 2014-2015, Teo Mrnjavac <teo@kde.org> * Copyright 2014-2017, Teo Mrnjavac <teo@kde.org>
* *
* Portions from the Manjaro Installation Framework * Portions from the Manjaro Installation Framework
* by Roland Singer <roland@manjaro.org> * by Roland Singer <roland@manjaro.org>
@ -138,6 +138,12 @@ UsersPage::createJobs( const QStringList& defaultGroupsList )
ui->textBoxRootPassword->text() ); ui->textBoxRootPassword->text() );
list.append( Calamares::job_ptr( j ) ); list.append( Calamares::job_ptr( j ) );
} }
else
{
j = new SetPasswordJob( "root",
"" ); //explicitly disable root password
list.append( Calamares::job_ptr( j ) );
}
j = new SetHostNameJob( ui->textBoxHostname->text() ); j = new SetHostNameJob( ui->textBoxHostname->text() );
list.append( Calamares::job_ptr( j ) ); list.append( Calamares::job_ptr( j ) );