1 // Copyright 2015 The Chromium OS Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef LIBBRILLO_BRILLO_USERDB_UTILS_H_ 6 #define LIBBRILLO_BRILLO_USERDB_UTILS_H_ 7 8 #include <sys/types.h> 9 10 #include <string> 11 12 #include <base/compiler_specific.h> 13 #include <base/macros.h> 14 #include <brillo/brillo_export.h> 15 16 namespace brillo { 17 namespace userdb { 18 19 // Looks up the UID and GID corresponding to |user|. Returns true on success. 20 // Passing nullptr for |uid| or |gid| causes them to be ignored. 21 BRILLO_EXPORT bool GetUserInfo( 22 const std::string& user, uid_t* uid, gid_t* gid) WARN_UNUSED_RESULT; 23 24 // Looks up the GID corresponding to |group|. Returns true on success. 25 // Passing nullptr for |gid| causes it to be ignored. 26 BRILLO_EXPORT bool GetGroupInfo( 27 const std::string& group, gid_t* gid) WARN_UNUSED_RESULT; 28 29 } // namespace userdb 30 } // namespace brillo 31 32 #endif // LIBBRILLO_BRILLO_USERDB_UTILS_H_ 33