Check for forbidden characters in users and group identities. It's limited by the...
authorFrantišek Dvořák <valtri@civ.zcu.cz>
Sat, 19 Oct 2013 19:17:29 +0000 (21:17 +0200)
committerFrantišek Dvořák <valtri@civ.zcu.cz>
Fri, 21 Feb 2014 13:36:48 +0000 (14:36 +0100)
src/VfsAuthn.cpp

index 3d65e0a..498b925 100644 (file)
@@ -91,6 +91,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())
@@ -113,6 +116,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())