|
@@ -140,6 +140,7 @@ public:
|
|
|
CHostManager()
|
|
|
{
|
|
|
m_populated = false;
|
|
|
+ m_curHostIdx = 0;
|
|
|
}
|
|
|
|
|
|
void populateHosts(const char* addrlist)
|
|
@@ -773,7 +774,7 @@ public:
|
|
|
m_useSSL = (0 == stricmp(proto, "ldaps") ? true : false);
|
|
|
}
|
|
|
|
|
|
- int rc;
|
|
|
+ int rc = LDAP_SERVER_DOWN;//assume bad things
|
|
|
StringBuffer hostbuf;
|
|
|
for (int numHosts=0; numHosts < m_ldapconfig->getHostCount(); numHosts++)
|
|
|
{
|
|
@@ -1400,6 +1401,7 @@ public:
|
|
|
m_pp = NULL;
|
|
|
//m_defaultFileScopePermission = -2;
|
|
|
//m_defaultWorkunitScopePermission = -2;
|
|
|
+ m_domainPwdsNeverExpire = false;
|
|
|
}
|
|
|
|
|
|
virtual void init(IPermissionProcessor* pp)
|
|
@@ -1935,6 +1937,10 @@ public:
|
|
|
if(infotype && stricmp(infotype, "sudoers") == 0)
|
|
|
{
|
|
|
CLdapSecUser* ldapuser = dynamic_cast<CLdapSecUser*>(&user);
|
|
|
+ if (ldapuser == nullptr)
|
|
|
+ {
|
|
|
+ throw MakeStringException(-1, "Unable to cast user %s to CLdapSecUser", username);
|
|
|
+ }
|
|
|
|
|
|
TIMEVAL timeOut = {m_ldapconfig->getLdapTimeout(),0};
|
|
|
Owned<ILdapConnection> lconn = m_connections->getConnection();
|
|
@@ -2185,12 +2191,13 @@ public:
|
|
|
// Since we've got the SID for the user, cache it for later uses.
|
|
|
MemoryBuffer mb;
|
|
|
if(m_pp != NULL)
|
|
|
- m_pp->getCachedSid(ldapuser->getName(), mb);
|
|
|
- if(mb.length() == 0)
|
|
|
{
|
|
|
- m_pp->cacheSid(ldapuser->getName(), usersidbuf.length(), usersidbuf.toByteArray());
|
|
|
+ m_pp->getCachedSid(ldapuser->getName(), mb);
|
|
|
+ if(mb.length() == 0)
|
|
|
+ {
|
|
|
+ m_pp->cacheSid(ldapuser->getName(), usersidbuf.length(), usersidbuf.toByteArray());
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
return ldapuser;
|
|
|
}
|
|
|
|
|
@@ -2736,6 +2743,10 @@ public:
|
|
|
throw MakeStringException(-1, "posixAccount isn't applicable to Active Directory");
|
|
|
|
|
|
CLdapSecUser* ldapuser = dynamic_cast<CLdapSecUser*>(&user);
|
|
|
+ if (ldapuser == nullptr)
|
|
|
+ {
|
|
|
+ throw MakeStringException(-1, "Unable to cast user %s to CLdapSecUser", username);
|
|
|
+ }
|
|
|
|
|
|
char* oc_values[] = {"posixAccount", NULL};
|
|
|
LDAPMod oc_attr = {
|
|
@@ -2825,9 +2836,6 @@ public:
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
-
|
|
|
- CLdapSecUser* ldapuser = dynamic_cast<CLdapSecUser*>(&user);
|
|
|
-
|
|
|
char* oc_values[] = {"posixAccount", NULL};
|
|
|
LDAPMod oc_attr = {
|
|
|
LDAP_MOD_DELETE,
|
|
@@ -2889,6 +2897,10 @@ public:
|
|
|
else if(stricmp(type, "sudoersadd") == 0)
|
|
|
{
|
|
|
CLdapSecUser* ldapuser = dynamic_cast<CLdapSecUser*>(&user);
|
|
|
+ if (ldapuser == nullptr)
|
|
|
+ {
|
|
|
+ throw MakeStringException(-1, "Unable to cast user %s to CLdapSecUser", username);
|
|
|
+ }
|
|
|
|
|
|
char *cn_values[] = {(char*)username, NULL };
|
|
|
LDAPMod cn_attr =
|
|
@@ -2991,6 +3003,10 @@ public:
|
|
|
else if(stricmp(type, "sudoersupdate") == 0)
|
|
|
{
|
|
|
CLdapSecUser* ldapuser = dynamic_cast<CLdapSecUser*>(&user);
|
|
|
+ if (ldapuser == nullptr)
|
|
|
+ {
|
|
|
+ throw MakeStringException(-1, "Unable to cast user %s to CLdapSecUser", username);
|
|
|
+ }
|
|
|
|
|
|
char* sudoHost = (char*)ldapuser->getSudoHost();
|
|
|
char* sudoCommand = (char*)ldapuser->getSudoCommand();
|
|
@@ -5356,7 +5372,7 @@ private:
|
|
|
prevptr = nextptr + 2;
|
|
|
nextptr = strstr(prevptr, "::");
|
|
|
}
|
|
|
- if(prevptr != NULL && *prevptr != '\0')
|
|
|
+ if(*prevptr != '\0')
|
|
|
ldapname.append(prevptr);
|
|
|
}
|
|
|
|