Activate new user attributes

pull/1/head
Timothy Pearson 13 years ago
parent 45427285f4
commit c330f85be8

@ -317,6 +317,9 @@ printf("[RAJA DEBUG 100.3] %s: %s\n\r", attr, vals[i]->bv_val);
else if (ldap_field == "gidNumber") { else if (ldap_field == "gidNumber") {
userinfo.primary_gid = atoi(vals[i]->bv_val); userinfo.primary_gid = atoi(vals[i]->bv_val);
} }
else if (ldap_field == "tdeBuiltinAccount") {
userinfo.tde_builtin_account = (TQString(vals[i]->bv_val).upper() == "TRUE")?true:false;
}
else if (ldap_field == "krb5KDCFlags") { else if (ldap_field == "krb5KDCFlags") {
userinfo.status = (LDAPKRB5Flags)(atoi(vals[i]->bv_val)); userinfo.status = (LDAPKRB5Flags)(atoi(vals[i]->bv_val));
} }
@ -404,9 +407,9 @@ printf("[RAJA DEBUG 100.3] %s: %s\n\r", attr, vals[i]->bv_val);
else if (ldap_field == "pager") { else if (ldap_field == "pager") {
userinfo.pagerNumber = vals[i]->bv_val; userinfo.pagerNumber = vals[i]->bv_val;
} }
// FIXME else if (ldap_field == "websiteURL") {
// This attribute is not present in my current LDAP schema userinfo.website = vals[i]->bv_val;
// userinfo.website = vals[i]->bv_val; }
else if (ldap_field == "postOfficeBox") { else if (ldap_field == "postOfficeBox") {
userinfo.poBox = vals[i]->bv_val; userinfo.poBox = vals[i]->bv_val;
} }
@ -446,22 +449,24 @@ printf("[RAJA DEBUG 100.3] %s: %s\n\r", attr, vals[i]->bv_val);
else if (ldap_field == "employeeNumber") { else if (ldap_field == "employeeNumber") {
userinfo.employeeNumber = vals[i]->bv_val; userinfo.employeeNumber = vals[i]->bv_val;
} }
// FIXME else if (ldap_field == "managerName") {
// These two attributes are not present in my current LDAP schema userinfo.manager = vals[i]->bv_val;
// userinfo.manager = vals[i]->bv_val; }
// userinfo.secretary = vals[i]->bv_val; else if (ldap_field == "secretaryName") {
userinfo.secretary = vals[i]->bv_val;
}
else if (ldap_field == "internationaliSDNNumber") { else if (ldap_field == "internationaliSDNNumber") {
userinfo.isdnNumber = vals[i]->bv_val; userinfo.isdnNumber = vals[i]->bv_val;
} }
// FIXME else if (ldap_field == "teletexId") {
// This attribute is not present in my current LDAP schema userinfo.teletexID = vals[i]->bv_val;
// userinfo.teletexID = vals[i]->bv_val; }
else if (ldap_field == "telexNumber") { else if (ldap_field == "telexNumber") {
userinfo.telexNumber = vals[i]->bv_val; userinfo.telexNumber = vals[i]->bv_val;
} }
// FIXME else if (ldap_field == "preferredDelivery") {
// This attribute is not present in my current LDAP schema userinfo.preferredDelivery = vals[i]->bv_val;
// userinfo.preferredDelivery = vals[i]->bv_val; }
else if (ldap_field == "destinationIndicator") { else if (ldap_field == "destinationIndicator") {
userinfo.destinationIndicator = vals[i]->bv_val; userinfo.destinationIndicator = vals[i]->bv_val;
} }
@ -474,18 +479,18 @@ printf("[RAJA DEBUG 100.3] %s: %s\n\r", attr, vals[i]->bv_val);
else if (ldap_field == "preferredLanguage") { else if (ldap_field == "preferredLanguage") {
userinfo.preferredLanguage = vals[i]->bv_val; userinfo.preferredLanguage = vals[i]->bv_val;
} }
// FIXME else if (ldap_field == "locallyUniqueID") {
// This attribute is not present in my current LDAP schema userinfo.uniqueIdentifier = vals[i]->bv_val;
// userinfo.uniqueIdentifier = vals[i]->bv_val; }
else if (ldap_field == "businessCategory") { else if (ldap_field == "businessCategory") {
userinfo.businessCategory = vals[i]->bv_val; userinfo.businessCategory = vals[i]->bv_val;
} }
else if (ldap_field == "carLicense") { else if (ldap_field == "carLicense") {
userinfo.carLicense = vals[i]->bv_val; userinfo.carLicense = vals[i]->bv_val;
} }
// FIXME else if (ldap_field == "notes") {
// This attribute is not present in my current LDAP schema userinfo.notes = vals[i]->bv_val;
// userinfo.notes = vals[i]->bv_val; }
ldap_value_free_len(vals); ldap_value_free_len(vals);
} }
ldap_memfree(attr); ldap_memfree(attr);
@ -710,7 +715,7 @@ int LDAPManager::updateUserInfo(LDAPUserInfo user) {
add_single_attribute_operation(mods, &i, "homePhone", user.homePhone); add_single_attribute_operation(mods, &i, "homePhone", user.homePhone);
add_single_attribute_operation(mods, &i, "mobile", user.mobilePhone); add_single_attribute_operation(mods, &i, "mobile", user.mobilePhone);
add_single_attribute_operation(mods, &i, "pager", user.pagerNumber); add_single_attribute_operation(mods, &i, "pager", user.pagerNumber);
// add_single_attribute_operation(mods, &i, "", user.website); add_single_attribute_operation(mods, &i, "websiteURL", user.website);
add_single_attribute_operation(mods, &i, "postOfficeBox", user.poBox); add_single_attribute_operation(mods, &i, "postOfficeBox", user.poBox);
add_single_attribute_operation(mods, &i, "street", user.street); add_single_attribute_operation(mods, &i, "street", user.street);
add_single_attribute_operation(mods, &i, "postalAddress", user.address); add_single_attribute_operation(mods, &i, "postalAddress", user.address);
@ -724,20 +729,20 @@ int LDAPManager::updateUserInfo(LDAPUserInfo user) {
add_single_attribute_operation(mods, &i, "roomNumber", user.roomNumber); add_single_attribute_operation(mods, &i, "roomNumber", user.roomNumber);
add_single_attribute_operation(mods, &i, "employeeType", user.employeeType); add_single_attribute_operation(mods, &i, "employeeType", user.employeeType);
add_single_attribute_operation(mods, &i, "employeeNumber", user.employeeNumber); add_single_attribute_operation(mods, &i, "employeeNumber", user.employeeNumber);
// add_single_attribute_operation(mods, &i, "", user.manager); add_single_attribute_operation(mods, &i, "managerName", user.manager);
// add_single_attribute_operation(mods, &i, "", user.secretary); add_single_attribute_operation(mods, &i, "secretaryName", user.secretary);
add_single_attribute_operation(mods, &i, "internationaliSDNNumber", user.isdnNumber); add_single_attribute_operation(mods, &i, "internationaliSDNNumber", user.isdnNumber);
// add_single_attribute_operation(mods, &i, "", user.teletexID); add_single_attribute_operation(mods, &i, "teletexId", user.teletexID);
add_single_attribute_operation(mods, &i, "telexNumber", user.telexNumber); add_single_attribute_operation(mods, &i, "telexNumber", user.telexNumber);
// add_single_attribute_operation(mods, &i, "", user.preferredDelivery); add_single_attribute_operation(mods, &i, "preferredDelivery", user.preferredDelivery);
add_single_attribute_operation(mods, &i, "destinationIndicator", user.destinationIndicator); add_single_attribute_operation(mods, &i, "destinationIndicator", user.destinationIndicator);
add_single_attribute_operation(mods, &i, "x121Address", user.x121Address); add_single_attribute_operation(mods, &i, "x121Address", user.x121Address);
add_single_attribute_operation(mods, &i, "displayName", user.displayName); add_single_attribute_operation(mods, &i, "displayName", user.displayName);
add_single_attribute_operation(mods, &i, "preferredLanguage", user.preferredLanguage); add_single_attribute_operation(mods, &i, "preferredLanguage", user.preferredLanguage);
// add_single_attribute_operation(mods, &i, "", user.uniqueIdentifier); add_single_attribute_operation(mods, &i, "locallyUniqueID", user.uniqueIdentifier);
add_single_attribute_operation(mods, &i, "businessCategory", user.businessCategory); add_single_attribute_operation(mods, &i, "businessCategory", user.businessCategory);
add_single_attribute_operation(mods, &i, "carLicense", user.carLicense); add_single_attribute_operation(mods, &i, "carLicense", user.carLicense);
// add_single_attribute_operation(mods, &i, "", user.notes); add_single_attribute_operation(mods, &i, "notes", user.notes);
LDAPMod *prevterm = mods[i]; LDAPMod *prevterm = mods[i];
mods[i] = NULL; mods[i] = NULL;
@ -1084,6 +1089,9 @@ for(i = 0; vals[i] != NULL; i++) {
else if (ldap_field == "gidNumber") { else if (ldap_field == "gidNumber") {
groupinfo.gid = atoi(vals[i]->bv_val); groupinfo.gid = atoi(vals[i]->bv_val);
} }
else if (ldap_field == "tdeBuiltinAccount") {
groupinfo.tde_builtin_account = (TQString(vals[i]->bv_val).upper() == "TRUE")?true:false;
}
ldap_value_free_len(vals); ldap_value_free_len(vals);
} }
ldap_memfree(attr); ldap_memfree(attr);
@ -1131,6 +1139,9 @@ for(i = 0; vals[i] != NULL; i++) {
if (ldap_field == "creatorsName") { if (ldap_field == "creatorsName") {
machineinfo.creatorsName = vals[i]->bv_val; machineinfo.creatorsName = vals[i]->bv_val;
} }
else if (ldap_field == "tdeBuiltinAccount") {
machineinfo.tde_builtin_account = (TQString(vals[i]->bv_val).upper() == "TRUE")?true:false;
}
else if (ldap_field == "krb5KDCFlags") { else if (ldap_field == "krb5KDCFlags") {
machineinfo.status = (LDAPKRB5Flags)(atoi(vals[i]->bv_val)); machineinfo.status = (LDAPKRB5Flags)(atoi(vals[i]->bv_val));
} }
@ -1162,7 +1173,6 @@ printf("[RAJA DEBUG 110.1] In LDAPManager::groups() bind was OK\n\r"); fflush(st
LDAPMessage* msg; LDAPMessage* msg;
TQString ldap_base_dn = m_basedc; TQString ldap_base_dn = m_basedc;
TQString ldap_filter = "(objectClass=posixGroup)"; TQString ldap_filter = "(objectClass=posixGroup)";
struct timeval timeout;
retcode = ldap_search_ext_s(m_ldap, ldap_base_dn.ascii(), LDAP_SCOPE_SUBTREE, ldap_filter.ascii(), ldap_user_and_operational_attributes, 0, NULL, NULL, NULL, 0, &msg); retcode = ldap_search_ext_s(m_ldap, ldap_base_dn.ascii(), LDAP_SCOPE_SUBTREE, ldap_filter.ascii(), ldap_user_and_operational_attributes, 0, NULL, NULL, NULL, 0, &msg);
if (retcode != LDAP_SUCCESS) { if (retcode != LDAP_SUCCESS) {
KMessageBox::error(0, i18n("<qt>LDAP search failure<p>Reason: [%3] %4</qt>").arg(retcode).arg(ldap_err2string(retcode)), i18n("LDAP Error")); KMessageBox::error(0, i18n("<qt>LDAP search failure<p>Reason: [%3] %4</qt>").arg(retcode).arg(ldap_err2string(retcode)), i18n("LDAP Error"));
@ -1261,7 +1271,7 @@ printf("[RAJA DEBUG 140.2] The number of entries returned was %d\n\n", ldap_coun
TQStringList dnParts = TQStringList::split(",", dn); TQStringList dnParts = TQStringList::split(",", dn);
TQString id = dnParts[0]; TQString id = dnParts[0];
int equalsPos = id.find("="); int equalsPos = id.find("=");
id.remove(0,id+1); id.remove(0,equalsPos+1);
printf("[RAJA DEBUG 140.3] Moving %s to relative DN %s and parent %s", dn, id.ascii(), newSuffix.ascii()); fflush(stdout); printf("[RAJA DEBUG 140.3] Moving %s to relative DN %s and parent %s", dn, id.ascii(), newSuffix.ascii()); fflush(stdout);
retcode = ldap_rename_s(m_ldap, dn, id, newSuffix, 0, NULL, NULL); retcode = ldap_rename_s(m_ldap, dn, id, newSuffix, 0, NULL, NULL);
if (retcode != LDAP_SUCCESS) { if (retcode != LDAP_SUCCESS) {
@ -1402,6 +1412,7 @@ LDAPUserInfo::LDAPUserInfo() {
uid = -1; uid = -1;
primary_gid = -1; primary_gid = -1;
tde_builtin_account = false;
status = (LDAPKRB5Flags)0; status = (LDAPKRB5Flags)0;
account_created = TQDateTime::fromString("1970-01-01T00:00:00", TQt::ISODate); account_created = TQDateTime::fromString("1970-01-01T00:00:00", TQt::ISODate);
account_modified = TQDateTime::fromString("1970-01-01T00:00:00", TQt::ISODate); account_modified = TQDateTime::fromString("1970-01-01T00:00:00", TQt::ISODate);
@ -1426,6 +1437,7 @@ LDAPGroupInfo::LDAPGroupInfo() {
informationValid = false; informationValid = false;
gid = -1; gid = -1;
tde_builtin_account = false;
} }
LDAPGroupInfo::~LDAPGroupInfo() { LDAPGroupInfo::~LDAPGroupInfo() {
@ -1436,6 +1448,7 @@ LDAPMachineInfo::LDAPMachineInfo() {
// TQStrings are always initialized to TQString::null, so they don't need initialization here... // TQStrings are always initialized to TQString::null, so they don't need initialization here...
informationValid = false; informationValid = false;
tde_builtin_account = false;
status = (LDAPKRB5Flags)0; status = (LDAPKRB5Flags)0;
} }

@ -108,6 +108,7 @@ class LDAPUserInfo
TQString shell; TQString shell;
TQString homedir; TQString homedir;
gid_t primary_gid; gid_t primary_gid;
bool tde_builtin_account;
LDAPKRB5Flags status; // Default active user is 586 [KRB5_ACTIVE_DEFAULT] and locked out user is 7586 [KRB5_DISABLED_ACCOUNT] LDAPKRB5Flags status; // Default active user is 586 [KRB5_ACTIVE_DEFAULT] and locked out user is 7586 [KRB5_DISABLED_ACCOUNT]
TQCString new_password; TQCString new_password;
TQDateTime account_created; TQDateTime account_created;
@ -184,6 +185,7 @@ class LDAPGroupInfo
TQString name; TQString name;
gid_t gid; gid_t gid;
bool tde_builtin_account;
TQStringList userlist; TQStringList userlist;
}; };
@ -199,6 +201,7 @@ class LDAPMachineInfo
TQString creatorsName; TQString creatorsName;
TQString name; TQString name;
bool tde_builtin_account;
LDAPKRB5Flags status; LDAPKRB5Flags status;
}; };

Loading…
Cancel
Save