Fix up the addition/modification of users in the sysadm/users class.

This commit is contained in:
Ken Moore
2016-08-25 11:13:25 -04:00
parent 9ed043f0f5
commit 9f06fbb03c

View File

@@ -100,7 +100,7 @@ bool UserManager::addUser(QJsonObject* out, QJsonObject obj){
pwfile.close(); //closed but still exists - will go out of scope and get removed in a moment
args << "-h" << "0"; //read from std input
args << "-m"; //automatically create users home dir
ok = (0== system("cat "+pwfile.fileName().toUtf8()+" | pw "+args.join(" ").toUtf8()) );
ok = (0== system("cat "+pwfile.fileName().toUtf8()+" | pw \""+args.join("\" \"").toUtf8()+"\"") );
usercreated = ok;
}else{
out->insert("error","Could not open temporary file for password"); //should never happen
@@ -187,7 +187,7 @@ bool UserManager::modifyUser(QJsonObject* out, QJsonObject obj){
pwfile.write( obj.value("password").toString().toUtf8().data() );
pwfile.close(); //closed but still exists - will go out of scope and get removed in a moment
args << "-h" << "0"; //read from std input
ok = (0== system("cat "+pwfile.fileName().toUtf8()+" | pw "+args.join(" ").toUtf8()) );
ok = (0== system("cat "+pwfile.fileName().toUtf8()+" | pw \""+args.join("\" \"").toUtf8()+"\"") );
}else{
out->insert("error","Could not open temporary file for password"); //should never happen
}