From 7cf6144b58dd66e611fb3bec94cb87a0c26a2801 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Franti=C5=A1ek=20Dvo=C5=99=C3=A1k?= Date: Sat, 19 Oct 2013 19:12:31 +0200 Subject: [PATCH] Check for forbidden characters in users and group identities. It's limited by the file format used for storing the information. --- src/VfsAuthn.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/VfsAuthn.cpp b/src/VfsAuthn.cpp index a72356d..cddf1f3 100644 --- a/src/VfsAuthn.cpp +++ b/src/VfsAuthn.cpp @@ -89,6 +89,9 @@ void VfsAuthn::vfsNewGroup(const std::string& groupName) throw (DmException) { unsigned int gid; GroupInfo gi; + if (groupName.find_first_of("\t\n\r") != std::string::npos) + vfsThrow(DMLITE_SYSERR(EINVAL), "group name can't contain tabelators or newline characters"); + // new gid gid = this->nextGid_; while (this->gids_.find(gid) != this->gids_.end()) @@ -111,6 +114,9 @@ void VfsAuthn::vfsNewUser(const std::string& userName) throw (DmException) { unsigned int uid; UserInfo ui; + if (userName.find_first_of("\t\r\n") != std::string::npos) + vfsThrow(DMLITE_SYSERR(EINVAL), "user name can't contain tabelators or newline characters"); + // new uid uid = this->nextUid_; while (this->uids_.find(uid) != this->uids_.end()) -- 1.8.2.3