From 9f06fbb03c8061c9e59479a3101e4e0e7656cac1 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Thu, 25 Aug 2016 11:13:25 -0400 Subject: [PATCH] Fix up the addition/modification of users in the sysadm/users class. --- src/server/library/sysadm-users.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/server/library/sysadm-users.cpp b/src/server/library/sysadm-users.cpp index 05bd8bd..618ac11 100644 --- a/src/server/library/sysadm-users.cpp +++ b/src/server/library/sysadm-users.cpp @@ -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 }