Lines Matching full:db
51 LDAP_message2entry(krb5_context context, HDB * db, LDAPMessage * msg,
66 #define HDB2LDAP(db) (((struct hdbldapdb *)(db)->hdb_db)->h_lp)
67 #define HDB2MSGID(db) (((struct hdbldapdb *)(db)->hdb_db)->h_msgid)
68 #define HDBSETMSGID(db,msgid) \
69 do { ((struct hdbldapdb *)(db)->hdb_db)->h_msgid = msgid; } while(0)
70 #define HDB2BASE(dn) (((struct hdbldapdb *)(db)->hdb_db)->h_base)
71 #define HDB2URL(dn) (((struct hdbldapdb *)(db)->hdb_db)->h_url)
72 #define HDB2CREATE(db) (((struct hdbldapdb *)(db)->hdb_db)->h_createbase)
134 check_ldap(krb5_context context, HDB *db, int ret)
140 LDAP_close(context, db);
310 LDAP_get_string_value(HDB * db, LDAPMessage * entry,
315 vals = ldap_get_values_len(HDB2LDAP(db), entry, attribute);
336 LDAP_get_integer_value(HDB * db, LDAPMessage * entry,
342 ret = LDAP_get_string_value(db, entry, attribute, &val);
351 LDAP_get_generalized_time_value(HDB * db, LDAPMessage * entry,
360 ret = LDAP_get_string_value(db, entry, attribute, &gentime);
386 LDAP_entry2mods(krb5_context context, HDB * db, hdb_entry_ex * ent,
408 ret = LDAP_message2entry(context, db, msg, 0, &orig);
414 vals = ldap_get_values_len(HDB2LDAP(db), msg, "objectClass");
617 vals = ldap_get_values_len(HDB2LDAP(db), msg, "krb5Key");
637 ret = hdb_unseal_key(context, db, &ent->entry.keys.val[i]);
661 vals = ldap_get_values_len(HDB2LDAP(db), msg, "sambaLMPassword");
696 vals = ldap_get_values_len(HDB2LDAP(db), msg, "krb5EncryptionType");
744 LDAP_dn2principal(krb5_context context, HDB * db, const char *dn,
753 ret = LDAP_no_size_limit(context, HDB2LDAP(db));
757 rc = ldap_search_ext_s(HDB2LDAP(db), dn, LDAP_SCOPE_SUBTREE,
761 if (check_ldap(context, db, rc)) {
769 e = ldap_first_entry(HDB2LDAP(db), res);
775 ret = LDAP_get_string_value(db, e, "krb5PrincipalName", &p);
836 HDB *db,
845 ret = LDAP__connect(context, db);
869 ret = LDAP_no_size_limit(context, HDB2LDAP(db));
873 rc = ldap_search_ext_s(HDB2LDAP(db), HDB2BASE(db),
878 if (check_ldap(context, db, rc)) {
886 if (userid && ldap_count_entries(HDB2LDAP(db), *msg) == 0) {
906 ret = LDAP_no_size_limit(context, HDB2LDAP(db));
910 rc = ldap_search_ext_s(HDB2LDAP(db), HDB2BASE(db), LDAP_SCOPE_SUBTREE,
914 if (check_ldap(context, db, rc)) {
933 LDAP_principal2message(krb5_context context, HDB * db,
964 ret = LDAP__lookup_princ(context, db, name, name_short, msg);
975 LDAP_message2entry(krb5_context context, HDB * db, LDAPMessage * msg,
987 ret = LDAP_get_string_value(db, msg, "krb5PrincipalName", &unparsed_name);
993 ret = LDAP_get_string_value(db, msg, "uid",
1009 ret = LDAP_get_integer_value(db, msg, "krb5KeyVersionNumber",
1017 keys = ldap_get_values_len(HDB2LDAP(db), msg, "krb5Key");
1049 vals = ldap_get_values_len(HDB2LDAP(db), msg, "krb5EncryptionType");
1092 ret = LDAP_get_string_value(db, msg, "sambaNTPassword", &ntPasswordIN);
1151 ret = LDAP_get_generalized_time_value(db, msg, "createTimestamp",
1159 ret = LDAP_get_string_value(db, msg, "creatorsName", &dn);
1161 LDAP_dn2principal(context, db, dn, &ent->entry.created_by.principal);
1172 ret = LDAP_get_generalized_time_value(db, msg, "modifyTimestamp",
1175 ret = LDAP_get_string_value(db, msg, "modifiersName", &dn);
1177 LDAP_dn2principal(context, db, dn, &ent->entry.modified_by->principal);
1192 ret = LDAP_get_generalized_time_value(db, msg, "krb5ValidStart",
1206 ret = LDAP_get_generalized_time_value(db, msg, "krb5ValidEnd",
1214 ret = LDAP_get_integer_value(db, msg, "sambaKickoffTime", &tmp_time);
1233 ret = LDAP_get_generalized_time_value(db, msg, "krb5PasswordEnd",
1241 ret = LDAP_get_integer_value(db, msg, "sambaPwdLastSet", &tmp_time);
1262 ret = LDAP_get_integer_value(db, msg, "sambaPwdMustChange", &tmp_time);
1276 ret = LDAP_get_integer_value(db, msg, "sambaPwdLastSet", &tmp_time);
1289 ret = LDAP_get_integer_value(db, msg, "krb5MaxLife", &max_life);
1306 ret = LDAP_get_integer_value(db, msg, "krb5MaxRenew", &max_renew);
1314 ret = LDAP_get_integer_value(db, msg, "krb5KDCFlags", &tmp);
1321 ret = LDAP_get_string_value(db, msg, "sambaAcctFlags", &samba_acct_flags);
1413 LDAP_close(krb5_context context, HDB * db)
1415 if (HDB2LDAP(db)) {
1416 ldap_unbind_ext(HDB2LDAP(db), NULL, NULL);
1417 ((struct hdbldapdb *)db->hdb_db)->h_lp = NULL;
1424 LDAP_lock(krb5_context context, HDB * db, int operation)
1430 LDAP_unlock(krb5_context context, HDB * db)
1436 LDAP_seq(krb5_context context, HDB * db, unsigned flags, hdb_entry_ex * entry)
1442 msgid = HDB2MSGID(db);
1447 rc = ldap_result(HDB2LDAP(db), msgid, LDAP_MSG_ONE, NULL, &e);
1455 ret = LDAP_message2entry(context, db, e, flags, entry);
1461 ldap_parse_result(HDB2LDAP(db), e, NULL, NULL, NULL,
1468 ldap_abandon_ext(HDB2LDAP(db), msgid, NULL, NULL);
1470 HDBSETMSGID(db, -1);
1474 LDAP_close(context, db);
1475 HDBSETMSGID(db, -1);
1481 ldap_abandon_ext(HDB2LDAP(db), msgid, NULL, NULL);
1483 HDBSETMSGID(db, -1);
1489 if (db->hdb_master_key_set && (flags & HDB_F_DECRYPT)) {
1490 ret = hdb_unseal_keys(context, db, &entry->entry);
1500 LDAP_firstkey(krb5_context context, HDB *db, unsigned flags,
1506 ret = LDAP__connect(context, db);
1510 ret = LDAP_no_size_limit(context, HDB2LDAP(db));
1514 ret = ldap_search_ext(HDB2LDAP(db), HDB2BASE(db),
1522 HDBSETMSGID(db, msgid);
1524 return LDAP_seq(context, db, flags, entry);
1528 LDAP_nextkey(krb5_context context, HDB * db, unsigned flags,
1531 return LDAP_seq(context, db, flags, entry);
1535 LDAP__connect(krb5_context context, HDB * db)
1546 if (HDB2LDAP(db)) {
1552 if (ldap_get_option(HDB2LDAP(db), LDAP_OPT_DESC, &sd) == 0 &&
1555 LDAP_close(context, db);
1559 if (HDB2LDAP(db) != NULL) /* server is UP */
1562 rc = ldap_initialize(&((struct hdbldapdb *)db->hdb_db)->h_lp, HDB2URL(db));
1569 rc = ldap_set_option(HDB2LDAP(db), LDAP_OPT_PROTOCOL_VERSION,
1574 LDAP_close(context, db);
1578 rc = ldap_sasl_bind_s(HDB2LDAP(db), NULL, "EXTERNAL", &bv,
1583 LDAP_close(context, db);
1591 LDAP_open(krb5_context context, HDB * db, int flags, mode_t mode)
1606 return LDAP__connect(context, db);
1610 LDAP_fetch_kvno(krb5_context context, HDB * db, krb5_const_principal principal,
1616 ret = LDAP_principal2message(context, db, principal, &msg);
1620 e = ldap_first_entry(HDB2LDAP(db), msg);
1626 ret = LDAP_message2entry(context, db, e, flags, entry);
1628 if (db->hdb_master_key_set && (flags & HDB_F_DECRYPT)) {
1629 ret = hdb_unseal_keys(context, db, &entry->entry);
1642 LDAP_fetch(krb5_context context, HDB * db, krb5_const_principal principal,
1645 return LDAP_fetch_kvno(context, db, principal,
1650 LDAP_store(krb5_context context, HDB * db, unsigned flags,
1660 ret = LDAP_principal2message(context, db, entry->entry.principal, &msg);
1662 e = ldap_first_entry(HDB2LDAP(db), msg);
1670 ret = hdb_seal_keys(context, db, &entry->entry);
1675 ret = LDAP_entry2mods(context, db, entry, e, &mods);
1680 ret = asprintf(&dn, "krb5PrincipalName=%s,%s", name, HDB2CREATE(db));
1688 dn = ldap_get_dn(HDB2LDAP(db), e);
1698 rc = ldap_add_ext_s(HDB2LDAP(db), dn, mods, NULL, NULL );
1702 rc = ldap_modify_ext_s(HDB2LDAP(db), dn, mods, NULL, NULL );
1706 if (check_ldap(context, db, rc)) {
1708 ldap_get_option(HDB2LDAP(db), LDAP_OPT_ERROR_STRING,
1731 LDAP_remove(krb5_context context, HDB *db, krb5_const_principal principal)
1738 ret = LDAP_principal2message(context, db, principal, &msg);
1742 e = ldap_first_entry(HDB2LDAP(db), msg);
1748 dn = ldap_get_dn(HDB2LDAP(db), e);
1754 rc = ldap_set_option(HDB2LDAP(db), LDAP_OPT_SIZELIMIT, (const void *)&limit);
1762 rc = ldap_delete_ext_s(HDB2LDAP(db), dn, NULL, NULL );
1763 if (check_ldap(context, db, rc)) {
1780 LDAP_destroy(krb5_context context, HDB * db)
1784 LDAP_close(context, db);
1786 ret = hdb_clear_master_key(context, db);
1787 if (HDB2BASE(db))
1788 free(HDB2BASE(db));
1789 if (HDB2CREATE(db))
1790 free(HDB2CREATE(db));
1791 if (HDB2URL(db))
1792 free(HDB2URL(db));
1793 if (db->hdb_name)
1794 free(db->hdb_name);
1795 free(db->hdb_db);
1796 free(db);
1803 HDB ** db,
1833 *db = calloc(1, sizeof(**db));
1834 if (*db == NULL) {
1838 memset(*db, 0, sizeof(**db));
1842 free(*db);
1843 *db = NULL;
1847 (*db)->hdb_db = h;
1850 if (asprintf(&(*db)->hdb_name, "ldap:%s", search_base) == -1) {
1851 LDAP_destroy(context, *db);
1852 *db = NULL;
1860 LDAP_destroy(context, *db);
1861 *db = NULL;
1873 LDAP_destroy(context, *db);
1874 *db = NULL;
1879 (*db)->hdb_master_key_set = 0;
1880 (*db)->hdb_openp = 0;
1881 (*db)->hdb_capability_flags = 0;
1882 (*db)->hdb_open = LDAP_open;
1883 (*db)->hdb_close = LDAP_close;
1884 (*db)->hdb_fetch_kvno = LDAP_fetch_kvno;
1885 (*db)->hdb_store = LDAP_store;
1886 (*db)->hdb_remove = LDAP_remove;
1887 (*db)->hdb_firstkey = LDAP_firstkey;
1888 (*db)->hdb_nextkey = LDAP_nextkey;
1889 (*db)->hdb_lock = LDAP_lock;
1890 (*db)->hdb_unlock = LDAP_unlock;
1891 (*db)->hdb_rename = NULL;
1892 (*db)->hdb__get = NULL;
1893 (*db)->hdb__put = NULL;
1894 (*db)->hdb__del = NULL;
1895 (*db)->hdb_destroy = LDAP_destroy;
1901 hdb_ldap_create(krb5_context context, HDB ** db, const char *arg)
1903 return hdb_ldap_common(context, db, arg, "ldapi:///");
1907 hdb_ldapi_create(krb5_context context, HDB ** db, const char *arg)
1914 *db = NULL;
1920 *db = NULL;
1928 ret = hdb_ldap_common(context, db, search_base, p);