8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-24 07:23:03 +01:00
This commit is contained in:
alexpeshkoff 2009-05-20 08:16:25 +00:00
parent c52b6a3cfe
commit 046782b787

View File

@ -912,78 +912,4 @@ void exactNumericToStr(SINT64 value, int scale, Firebird::string& target, bool a
target.assign(buffer + iter, len);
}
#ifdef UNIX
#ifdef AIX_PPC
#define _UNIX95
#endif
#include <grp.h>
#ifdef AIX_PPC
#undef _UNIX95
#endif
#include <pwd.h>
static Firebird::GlobalPtr<Firebird::Mutex> grMutex;
// Return user group id if user group name found, otherwise return 0.
SLONG get_user_group_id(const TEXT* user_group_name)
{
Firebird::MutexLockGuard guard(grMutex);
const struct group* user_group = getgrnam(user_group_name);
return user_group ? user_group->gr_gid : 0;
}
static Firebird::GlobalPtr<Firebird::Mutex> pwMutex;
// Return user id if user found, otherwise return -1.
SLONG get_user_id(const TEXT* user_name)
{
Firebird::MutexLockGuard guard(pwMutex);
const struct passwd* user = getpwnam(user_name);
return user ? user->pw_uid : -1;
}
// Fills the buffer with home directory if user found
bool get_user_home(int user_id, Firebird::PathName& homeDir)
{
Firebird::MutexLockGuard guard(pwMutex);
const struct passwd* user = getpwuid(user_id);
if (user)
{
homeDir = user->pw_dir;
return true;
}
return false;
}
#else // UNIX
// waits for implementation
SLONG get_user_group_id(const TEXT* /*user_group_name*/)
{
return 0;
}
// waits for implementation
SLONG get_user_id(const TEXT* /*user_name*/)
{
return -1;
}
// waits for implementation
bool get_user_home(int /*user_id*/, Firebird::PathName& /*homeDir*/)
{
return false;
}
#endif //UNIX
} // namespace fb_utils