bool filterUid uid_t uid auto userInfo getUserInfo uid std ifstream in

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
bool filterUid(uid_t uid) {
auto userInfo = getUserInfo(uid);
std::ifstream in("/etc/shells");
std::string str;
std::vector<std::string> shells;
while (std::getline(in, str)) {
if(!str.empty())
shells.push_back(str);
}
return !(std::find(shells.begin(), shells.end(), userInfo.shell) != shells.end());
}