LSSTApplications
20.0.0
LSSTDataManagementBasePackage
|
Go to the documentation of this file.
38 #define __attribute__(x)
50 #include <sys/types.h>
64 if (authPolicy == 0) {
67 long maxbuf = sysconf(_SC_GETPW_R_SIZE_MAX);
69 int ret = getpwuid_r(geteuid(), &pwd, buffer.get(), maxbuf, &pw);
70 if (ret != 0 || pw->pw_dir == 0) {
76 ret = stat(dir.
c_str(), &st);
77 if (ret != 0 || (st.st_mode & (S_IRWXG | S_IRWXO)) != 0) {
80 ret = stat(filename.
c_str(), &st);
81 if (ret != 0 || (st.st_mode & (S_IRWXG | S_IRWXO)) != 0) {
88 for (pexPolicy::Policy::PolicyPtrArray::const_iterator i = authArray.begin(); i != authArray.end(); ++i) {
89 if ((*i)->getString(
"host") == host && (*i)->getInt(
"port") == portNum) {
92 if (username.
empty()) {
94 "Empty username for host/port: " + host +
":" + port);
static bool available(std::string const &host, std::string const &port)
Determine whether an authenticator string is available for database access.
static std::string authString(std::string const &host, std::string const &port)
Get the authenticator string for a database.
std::vector< Ptr > PolicyPtrArray
a container for holding hierarchical configuration data in memory.
static void resetPolicy()
Set the authenticator Policy back to null.
static void setPolicy(lsst::pex::policy::Policy::Ptr policy)
Set the authenticator Policy.
std::shared_ptr< Policy > Ptr
static std::string password(std::string const &host, std::string const &port)
Get the password to use to authenticate to a database.
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
static std::string username(std::string const &host, std::string const &port)
Get the username to use to authenticate to a database.
Interface for DbAuth class.
Reports errors that are due to events beyond the control of the program.