diff options
Diffstat (limited to 'Source/Kernel/UserManager/Usr.ns.cpp')
-rw-r--r-- | Source/Kernel/UserManager/Usr.ns.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/Source/Kernel/UserManager/Usr.ns.cpp b/Source/Kernel/UserManager/Usr.ns.cpp index db371ae..ecf9bae 100644 --- a/Source/Kernel/UserManager/Usr.ns.cpp +++ b/Source/Kernel/UserManager/Usr.ns.cpp @@ -5,10 +5,11 @@ #include <SimpleList.class.h> #include <TaskManager/Task.ns.h> #include <TextFile.class.h> +#include <VFS/VFS.ns.h> /* * Syntax for Users and Groups configuration files : one entry per line - * syntax for Users : <uid>:<username>:<basegroup>:<extragroup>,<extragroup>:<completename> + * syntax for Users : <uid>:<username>:<basegroup>:<extragroup>,<extragroup>:<completename>:<password> * syntax for Groups : <gid>:<name> */ @@ -22,6 +23,8 @@ void load() { if (m_groups != 0) delete m_groups; m_users = 0, m_groups = 0; + if (VFS::find("/System/Configuration/Groups")) VFS::find("/System/Configuration/Groups")->setPermissions(0600); + if (VFS::find("/System/Configuration/Users")) VFS::find("/System/Configuration/Users")->setPermissions(0600); TextFile groups("/System/Configuration/Groups", FM_READ); while (!groups.eof()) { String s = groups.readLine(); @@ -38,13 +41,14 @@ void load() { TextFile users("/System/Configuration/Users", FM_READ); while (!users.eof()) { String s = users.readLine(); + if (s == "" or s[0] == WChar("#")) continue; Vector<String> data = s.split(":"); - if (data.size() == 5 and !(s[0] == WChar("#"))) { - m_users = m_users->cons(User(data[1], data[4], group(data[2].toInt()), data[3], data[0].toInt())); + if (data.size() == 6) { + m_users = m_users->cons(User(data[1], data[4], data[5], group(data[2].toInt()), data[3], data[0].toInt())); } } if (m_users == 0) { - m_users = m_users->cons(User("melon", "MelOS", group(0), "", 0)); + m_users = m_users->cons(User("melon", "MelOS", "", group(0), "", 0)); Log::log(KL_WARNING, "Usr.ns : users file invalid, had to add default users."); } } @@ -58,7 +62,8 @@ void save() { for (SimpleList<User> *iter = m_users; iter != 0; iter = iter->next()) { users.write(String::number(iter->v().getUid()) + ":" + iter->v().getUserName() + ":" + String::number(iter->v().getGroup()->getGid()) + ":" - + iter->v().getGroups() + ":" + iter->v().getCompleteName(), true); + + iter->v().getGroups() + ":" + iter->v().getCompleteName() + ":" + + iter->v().getPassword(), true); } } |