r25026: Move param/param.h out of includes.h
[kai/samba-autobuild/.git] / source4 / kdc / hdb-ldb.c
index b80d9f3bcec2b1551d1c92af08367390d3853808..93f45b8cf7fb3c58698e3ec33dc5b0f531d040b3 100644 (file)
 #include "librpc/ndr/libndr.h"
 #include "librpc/gen_ndr/ndr_drsblobs.h"
 #include "libcli/auth/libcli_auth.h"
+#include "param/param.h"
 
 enum hdb_ldb_ent_type 
 { HDB_LDB_ENT_TYPE_CLIENT, HDB_LDB_ENT_TYPE_SERVER, 
   HDB_LDB_ENT_TYPE_KRBTGT, HDB_LDB_ENT_TYPE_ANY };
 
-static const char * const krb5_attrs[] = {
-       "objectClass",
-       "sAMAccountName",
-
-       "userPrincipalName",
-       "servicePrincipalName",
-
-       "userAccountControl",
-
-       "pwdLastSet",
-       "accountExpires",
-
-       "whenCreated",
-       "whenChanged",
-
-       "msDS-KeyVersionNumber",
-
-       "unicodePwd",
-       "supplementalCredentials",
-
-       NULL
-};
-
 static const char *realm_ref_attrs[] = {
        "nCName", 
        "dnsRoot", 
@@ -615,7 +593,7 @@ static krb5_error_code LDB_lookup_principal(krb5_context context, struct ldb_con
        krb5_error_code ret;
        int lret;
        char *filter = NULL;
-       const char * const *princ_attrs = krb5_attrs;
+       const char * const *princ_attrs = user_attrs;
 
        char *short_princ;
        char *short_princ_talloc;
@@ -886,7 +864,7 @@ static krb5_error_code LDB_fetch_server(krb5_context context, HDB *db,
                }
                
                ldb_ret = gendb_search_dn((struct ldb_context *)db->hdb_db,
-                                         mem_ctx, user_dn, &msg, krb5_attrs);
+                                         mem_ctx, user_dn, &msg, user_attrs);
                
                if (ldb_ret != 1) {
                        return HDB_ERR_NOENTRY;
@@ -988,7 +966,7 @@ struct hdb_ldb_seq {
 static krb5_error_code LDB_seq(krb5_context context, HDB *db, unsigned flags, hdb_entry_ex *entry)
 {
        krb5_error_code ret;
-       struct hdb_ldb_seq *priv = (struct hdb_ldb_seq *)db->hdb_openp;
+       struct hdb_ldb_seq *priv = (struct hdb_ldb_seq *)db->hdb_dbc;
        TALLOC_CTX *mem_ctx;
        hdb_entry_ex entry_ex;
        memset(&entry_ex, '\0', sizeof(entry_ex));
@@ -1015,7 +993,7 @@ static krb5_error_code LDB_seq(krb5_context context, HDB *db, unsigned flags, hd
 
        if (ret != 0) {
                talloc_free(priv);
-               db->hdb_openp = 0;
+               db->hdb_dbc = NULL;
        } else {
                talloc_free(mem_ctx);
        }
@@ -1027,7 +1005,7 @@ static krb5_error_code LDB_firstkey(krb5_context context, HDB *db, unsigned flag
                                        hdb_entry_ex *entry)
 {
        struct ldb_context *ldb_ctx = (struct ldb_context *)db->hdb_db;
-       struct hdb_ldb_seq *priv = (struct hdb_ldb_seq *)db->hdb_openp;
+       struct hdb_ldb_seq *priv = (struct hdb_ldb_seq *)db->hdb_dbc;
        char *realm;
        struct ldb_dn *realm_dn = NULL;
        struct ldb_result *res = NULL;
@@ -1038,7 +1016,7 @@ static krb5_error_code LDB_firstkey(krb5_context context, HDB *db, unsigned flag
 
        if (priv) {
                talloc_free(priv);
-               db->hdb_openp = 0;
+               db->hdb_dbc = NULL;
        }
 
        priv = (struct hdb_ldb_seq *) talloc(db, struct hdb_ldb_seq);
@@ -1083,7 +1061,7 @@ static krb5_error_code LDB_firstkey(krb5_context context, HDB *db, unsigned flag
 
        lret = ldb_search(ldb_ctx, realm_dn,
                                 LDB_SCOPE_SUBTREE, "(objectClass=user)",
-                                krb5_attrs, &res);
+                                user_attrs, &res);
 
        if (lret != LDB_SUCCESS) {
                talloc_free(priv);
@@ -1094,14 +1072,13 @@ static krb5_error_code LDB_firstkey(krb5_context context, HDB *db, unsigned flag
        priv->msgs = talloc_steal(priv, res->msgs);
        talloc_free(res);
 
-       /* why has hdb_openp changed from (void *) to (int) ??? */
-       db->hdb_openp = (int)priv;
+       db->hdb_dbc = priv;
 
        ret = LDB_seq(context, db, flags, entry);
 
        if (ret != 0) {
                talloc_free(priv);
-               db->hdb_openp = 0;
+               db->hdb_dbc = NULL;
        } else {
                talloc_free(mem_ctx);
        }
@@ -1162,7 +1139,7 @@ NTSTATUS kdc_hdb_ldb_create(TALLOC_CTX *mem_ctx,
                return NT_STATUS_CANT_ACCESS_DOMAIN_INFO;
        }
 
-       (*db)->hdb_openp = 0;
+       (*db)->hdb_dbc = NULL;
        (*db)->hdb_open = LDB_open;
        (*db)->hdb_close = LDB_close;
        (*db)->hdb_fetch = LDB_fetch;