r17516: Change helper function names to make more clear what they are meant to do
authorSimo Sorce <idra@samba.org>
Sun, 13 Aug 2006 08:00:36 +0000 (08:00 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 19:15:31 +0000 (14:15 -0500)
(This used to be commit ad75cf869550af66119d0293503024d41d834e02)

23 files changed:
source4/auth/credentials/credentials_files.c
source4/auth/gensec/schannel_state.c
source4/dsdb/samdb/ldb_modules/password_hash.c
source4/dsdb/samdb/ldb_modules/proxy.c
source4/dsdb/samdb/ldb_modules/samba3sam.c
source4/dsdb/samdb/ldb_modules/samldb.c
source4/dsdb/samdb/samdb.c
source4/kdc/hdb-ldb.c
source4/kdc/pac-glue.c
source4/ldap_server/ldap_server.c
source4/lib/ldb/common/ldb_msg.c
source4/lib/ldb/include/ldb.h
source4/lib/ldb/ldb_ildap/ldb_ildap.c
source4/lib/ldb/ldb_tdb/ldb_cache.c
source4/lib/ldb/ldb_tdb/ldb_tdb.c
source4/lib/registry/reg_backend_ldb.c
source4/libnet/libnet_join.c
source4/nbt_server/wins/winsdb.c
source4/param/share_ldb.c
source4/rpc_server/lsa/dcesrv_lsa.c
source4/rpc_server/samr/dcesrv_samr.c
source4/torture/ldap/schema.c
source4/wrepl_server/wrepl_server.c

index a268fe369edd4b7b39c6f0e7d15e7be007189154..c61f8ccb5e6c33e7a4c6831184cbfaf41f7f357b 100644 (file)
@@ -238,10 +238,10 @@ NTSTATUS cli_credentials_set_secrets(struct cli_credentials *cred,
                return NT_STATUS_CANT_ACCESS_DOMAIN_INFO;
        }
        
-       password = ldb_msg_find_string(msgs[0], "secret", NULL);
-       old_password = ldb_msg_find_string(msgs[0], "priorSecret", NULL);
+       password = ldb_msg_find_attr_as_string(msgs[0], "secret", NULL);
+       old_password = ldb_msg_find_attr_as_string(msgs[0], "priorSecret", NULL);
 
-       machine_account = ldb_msg_find_string(msgs[0], "samAccountName", NULL);
+       machine_account = ldb_msg_find_attr_as_string(msgs[0], "samAccountName", NULL);
 
        if (!machine_account) {
                DEBUG(1, ("Could not find 'samAccountName' in join record to domain: %s\n",
@@ -252,10 +252,10 @@ NTSTATUS cli_credentials_set_secrets(struct cli_credentials *cred,
                return NT_STATUS_CANT_ACCESS_DOMAIN_INFO;
        }
 
-       salt_principal = ldb_msg_find_string(msgs[0], "saltPrincipal", NULL);
+       salt_principal = ldb_msg_find_attr_as_string(msgs[0], "saltPrincipal", NULL);
        cli_credentials_set_salt_principal(cred, salt_principal);
        
-       sct = ldb_msg_find_int(msgs[0], "secureChannelType", 0);
+       sct = ldb_msg_find_attr_as_int(msgs[0], "secureChannelType", 0);
        if (sct) { 
                cli_credentials_set_secure_channel_type(cred, sct);
        }
@@ -277,28 +277,28 @@ NTSTATUS cli_credentials_set_secrets(struct cli_credentials *cred,
        }
 
        
-       domain = ldb_msg_find_string(msgs[0], "flatname", NULL);
+       domain = ldb_msg_find_attr_as_string(msgs[0], "flatname", NULL);
        if (domain) {
                cli_credentials_set_domain(cred, domain, CRED_SPECIFIED);
        }
 
-       realm = ldb_msg_find_string(msgs[0], "realm", NULL);
+       realm = ldb_msg_find_attr_as_string(msgs[0], "realm", NULL);
        if (realm) {
                cli_credentials_set_realm(cred, realm, CRED_SPECIFIED);
        }
 
        cli_credentials_set_username(cred, machine_account, CRED_SPECIFIED);
 
-       cli_credentials_set_kvno(cred, ldb_msg_find_int(msgs[0], "msDS-KeyVersionNumber", 0));
+       cli_credentials_set_kvno(cred, ldb_msg_find_attr_as_int(msgs[0], "msDS-KeyVersionNumber", 0));
 
        /* If there was an external keytab specified by reference in
         * the LDB, then use this.  Otherwise we will make one up
         * (chewing CPU time) from the password */
-       keytab = ldb_msg_find_string(msgs[0], "krb5Keytab", NULL);
+       keytab = ldb_msg_find_attr_as_string(msgs[0], "krb5Keytab", NULL);
        if (keytab) {
                cli_credentials_set_keytab_name(cred, keytab, CRED_SPECIFIED);
        } else {
-               keytab = ldb_msg_find_string(msgs[0], "privateKeytab", NULL);
+               keytab = ldb_msg_find_attr_as_string(msgs[0], "privateKeytab", NULL);
                if (keytab) {
                        keytab = talloc_asprintf(mem_ctx, "FILE:%s", private_path(mem_ctx, keytab));
                        if (keytab) {
index 97bcd40d091231ad1e0d0b502bf8ec0093263ce8..e8d0f8388b8b40605fba8d301e86a40ef66dc092 100644 (file)
@@ -231,15 +231,15 @@ NTSTATUS schannel_fetch_session_key_ldb(TALLOC_CTX *mem_ctx,
        }
        memcpy((*creds)->server.data, val->data, 8);
 
-       (*creds)->negotiate_flags = ldb_msg_find_int(res->msgs[0], "negotiateFlags", 0);
+       (*creds)->negotiate_flags = ldb_msg_find_attr_as_int(res->msgs[0], "negotiateFlags", 0);
 
-       (*creds)->secure_channel_type = ldb_msg_find_int(res->msgs[0], "secureChannelType", 0);
+       (*creds)->secure_channel_type = ldb_msg_find_attr_as_int(res->msgs[0], "secureChannelType", 0);
 
-       (*creds)->account_name = talloc_reference(*creds, ldb_msg_find_string(res->msgs[0], "accountName", NULL));
+       (*creds)->account_name = talloc_reference(*creds, ldb_msg_find_attr_as_string(res->msgs[0], "accountName", NULL));
 
-       (*creds)->computer_name = talloc_reference(*creds, ldb_msg_find_string(res->msgs[0], "computerName", NULL));
+       (*creds)->computer_name = talloc_reference(*creds, ldb_msg_find_attr_as_string(res->msgs[0], "computerName", NULL));
 
-       (*creds)->domain = talloc_reference(*creds, ldb_msg_find_string(res->msgs[0], "flatname", NULL));
+       (*creds)->domain = talloc_reference(*creds, ldb_msg_find_attr_as_string(res->msgs[0], "flatname", NULL));
 
        (*creds)->sid = samdb_result_dom_sid(*creds, res->msgs[0], "objectSid");
 
index 93af3ae2600e2d73be52a544dc10d75842596e78..273cc60c303c9747a8db3d99e213c9493b013305 100644 (file)
@@ -99,7 +99,7 @@ static int add_password_hashes(struct ldb_module *module, struct ldb_message *ms
        const char *sambaPassword;
        struct samr_Password tmp_hash;
        
-       sambaPassword = ldb_msg_find_string(msg, "sambaPassword", NULL);
+       sambaPassword = ldb_msg_find_attr_as_string(msg, "sambaPassword", NULL);
        if (sambaPassword == NULL) { /* impossible, what happened ?! */
                return LDB_ERR_OPERATIONS_ERROR;
        }
@@ -146,7 +146,7 @@ static int add_krb5_keys_from_password(struct ldb_module *module, struct ldb_mes
         * algorithm, described in his Nov 10 2004 mail to
         * samba-technical@samba.org */
 
-       sambaPassword = ldb_msg_find_string(msg, "sambaPassword", NULL);
+       sambaPassword = ldb_msg_find_attr_as_string(msg, "sambaPassword", NULL);
        if (sambaPassword == NULL) { /* impossible, what happened ?! */
                return LDB_ERR_OPERATIONS_ERROR;
        }
@@ -536,7 +536,7 @@ static struct domain_data *get_domain_data(struct ldb_module *module, void *ctx,
 
        data->pwdProperties = samdb_result_uint(res->message, "pwdProperties", 0);
        data->pwdHistoryLength = samdb_result_uint(res->message, "pwdHistoryLength", 0);
-       tmp = ldb_msg_find_string(res->message, "dnsDomain", NULL);
+       tmp = ldb_msg_find_attr_as_string(res->message, "dnsDomain", NULL);
 
        if (tmp != NULL) {
                data->dnsDomain = talloc_strdup(data, tmp);
@@ -684,8 +684,8 @@ static int password_hash_add_do_add(struct ldb_handle *h) {
                
                /* now add krb5 keys based on unicode password */
                ret = add_krb5_keys_from_password(ac->module, msg, smb_krb5_context, domain,
-                                                 ldb_msg_find_string(msg, "samAccountName", NULL),
-                                                 ldb_msg_find_string(msg, "userPrincipalName", NULL),
+                                                 ldb_msg_find_attr_as_string(msg, "samAccountName", NULL),
+                                                 ldb_msg_find_attr_as_string(msg, "userPrincipalName", NULL),
                                                  ldb_msg_check_string_attribute(msg, "objectClass", "computer"));
                if (ret != LDB_SUCCESS) {
                        return ret;
@@ -700,13 +700,13 @@ static int password_hash_add_do_add(struct ldb_handle *h) {
                /* if both the domain properties and the user account controls do not permit
                 * clear text passwords then wipe out the sambaPassword */
                if ((!(domain->pwdProperties & DOMAIN_PASSWORD_STORE_CLEARTEXT)) ||
-                   (!(ldb_msg_find_uint(msg, "userAccountControl", 0) & UF_ENCRYPTED_TEXT_PASSWORD_ALLOWED))) {
+                   (!(ldb_msg_find_attr_as_uint(msg, "userAccountControl", 0) & UF_ENCRYPTED_TEXT_PASSWORD_ALLOWED))) {
                        ldb_msg_remove_attr(msg, "sambaPassword");
                }
        }
 
        /* don't touch it if a value is set. It could be an incoming samsync */
-       if (ldb_msg_find_uint64(msg, "pwdLastSet", 0) == 0) {
+       if (ldb_msg_find_attr_as_uint64(msg, "pwdLastSet", 0) == 0) {
                if (set_pwdLastSet(ac->module, msg, 0) != LDB_SUCCESS) {
                        return LDB_ERR_OPERATIONS_ERROR;
                }
@@ -996,8 +996,8 @@ static int password_hash_mod_do_mod(struct ldb_handle *h) {
 
                        /* now add krb5 keys based on unicode password */
                        ret = add_krb5_keys_from_password(ac->module, msg, smb_krb5_context, domain,
-                                                         ldb_msg_find_string(ac->search_res->message, "samAccountName", NULL),
-                                                         ldb_msg_find_string(ac->search_res->message, "userPrincipalName", NULL),
+                                                         ldb_msg_find_attr_as_string(ac->search_res->message, "samAccountName", NULL),
+                                                         ldb_msg_find_attr_as_string(ac->search_res->message, "userPrincipalName", NULL),
                                                          ldb_msg_check_string_attribute(ac->search_res->message, "objectClass", "computer"));
 
                        if (ret != LDB_SUCCESS) {
@@ -1007,7 +1007,7 @@ static int password_hash_mod_do_mod(struct ldb_handle *h) {
                        /* if the domain properties or the user account controls do not permit
                         * clear text passwords then wipe out the sambaPassword */
                        if ((!(domain->pwdProperties & DOMAIN_PASSWORD_STORE_CLEARTEXT)) ||
-                           (!(ldb_msg_find_uint(ac->search_res->message, "userAccountControl", 0) & UF_ENCRYPTED_TEXT_PASSWORD_ALLOWED))) {
+                           (!(ldb_msg_find_attr_as_uint(ac->search_res->message, "userAccountControl", 0) & UF_ENCRYPTED_TEXT_PASSWORD_ALLOWED))) {
                                ldb_msg_remove_attr(msg, "sambaPassword");
                        }
 
@@ -1043,7 +1043,7 @@ static int password_hash_mod_do_mod(struct ldb_handle *h) {
        if (!ldb_msg_find_element(ac->orig_req->op.mod.message, 
                                 "msDS-KeyVersionNumber")) {
                if (add_keyVersionNumber(ac->module, msg,
-                                        ldb_msg_find_uint(ac->search_res->message, 
+                                        ldb_msg_find_attr_as_uint(ac->search_res->message, 
                                                           "msDS-KeyVersionNumber", 0)
                            ) != LDB_SUCCESS) {
                        return LDB_ERR_OPERATIONS_ERROR;
index c8e5a91e587d04c80a1580996efb23e35a6876af..d2628f5d1d05f05ce6076f9da041a551ba759b62 100644 (file)
@@ -81,13 +81,13 @@ static int load_proxy_info(struct ldb_module *module)
                goto failed;
        }
 
-       url      = ldb_msg_find_string(res->msgs[0], "url", NULL);
-       olddn    = ldb_msg_find_string(res->msgs[0], "olddn", NULL);
-       newdn    = ldb_msg_find_string(res->msgs[0], "newdn", NULL);
-       username = ldb_msg_find_string(res->msgs[0], "username", NULL);
-       password = ldb_msg_find_string(res->msgs[0], "password", NULL);
-       oldstr   = ldb_msg_find_string(res->msgs[0], "oldstr", NULL);
-       newstr   = ldb_msg_find_string(res->msgs[0], "newstr", NULL);
+       url      = ldb_msg_find_attr_as_string(res->msgs[0], "url", NULL);
+       olddn    = ldb_msg_find_attr_as_string(res->msgs[0], "olddn", NULL);
+       newdn    = ldb_msg_find_attr_as_string(res->msgs[0], "newdn", NULL);
+       username = ldb_msg_find_attr_as_string(res->msgs[0], "username", NULL);
+       password = ldb_msg_find_attr_as_string(res->msgs[0], "password", NULL);
+       oldstr   = ldb_msg_find_attr_as_string(res->msgs[0], "oldstr", NULL);
+       newstr   = ldb_msg_find_attr_as_string(res->msgs[0], "newstr", NULL);
 
        if (url == NULL || olddn == NULL || newdn == NULL || username == NULL || password == NULL) {
                ldb_debug(module->ldb, LDB_DEBUG_FATAL, "Need url, olddn, newdn, oldstr, newstr, username and password in @PROXYINFO\n");
index 06774780a154e054a8bd4309180798acd4d2c7c0..80cedb7b08f5b9368e011533a986062b9cf8a4d3 100644 (file)
@@ -49,7 +49,7 @@
 static struct ldb_message_element *generate_primaryGroupID(struct ldb_module *module, TALLOC_CTX *ctx, const char *attr, const struct ldb_message *remote)
 {
        struct ldb_message_element *el;
-       const char *sid = ldb_msg_find_string(remote, attr, NULL);
+       const char *sid = ldb_msg_find_attr_as_string(remote, attr, NULL);
 
        if (!sid)
                return NULL;
@@ -96,7 +96,7 @@ static void generate_sambaPrimaryGroupSID(struct ldb_module *module, const char
 
        sidstring = dom_sid_string(remote_mp, sid);
        talloc_free(sid);
-       ldb_msg_add_fmt(remote_mp, "sambaPrimaryGroupSID", "%s-%d", sidstring, ldb_msg_find_uint(local, "primaryGroupID", 0));
+       ldb_msg_add_fmt(remote_mp, "sambaPrimaryGroupSID", "%s-%d", sidstring, ldb_msg_find_attr_as_uint(local, "primaryGroupID", 0));
        talloc_free(sidstring);
 }
 
index 55f545a45aabdbb77a04a4342ec9dbf01cdf6707..67724d56b5b110dab5d61ab42bc7665ace54d54c 100644 (file)
@@ -136,7 +136,7 @@ static int samldb_find_next_rid(struct ldb_module *module, TALLOC_CTX *mem_ctx,
                return LDB_ERR_OPERATIONS_ERROR;
        }
 
-       str = ldb_msg_find_string(res->msgs[0], "nextRid", NULL);
+       str = ldb_msg_find_attr_as_string(res->msgs[0], "nextRid", NULL);
        if (str == NULL) {
                ldb_asprintf_errstring(module->ldb,
                                        "attribute nextRid not found in %s\n",
index 3c2283a47112ce033ab1633c9a952d0559d337d9..a659c66725c54ee21463c78884476fa5afb7bf94 100644 (file)
@@ -331,7 +331,7 @@ int samdb_search_string_multiple(struct ldb_context *sam_ldb,
 */
 uint_t samdb_result_uint(const struct ldb_message *msg, const char *attr, uint_t default_value)
 {
-       return ldb_msg_find_uint(msg, attr, default_value);
+       return ldb_msg_find_attr_as_uint(msg, attr, default_value);
 }
 
 /*
@@ -339,7 +339,7 @@ uint_t samdb_result_uint(const struct ldb_message *msg, const char *attr, uint_t
 */
 int64_t samdb_result_int64(const struct ldb_message *msg, const char *attr, int64_t default_value)
 {
-       return ldb_msg_find_int64(msg, attr, default_value);
+       return ldb_msg_find_attr_as_int64(msg, attr, default_value);
 }
 
 /*
@@ -348,7 +348,7 @@ int64_t samdb_result_int64(const struct ldb_message *msg, const char *attr, int6
 const char *samdb_result_string(const struct ldb_message *msg, const char *attr, 
                                const char *default_value)
 {
-       return ldb_msg_find_string(msg, attr, default_value);
+       return ldb_msg_find_attr_as_string(msg, attr, default_value);
 }
 
 struct ldb_dn *samdb_result_dn(TALLOC_CTX *mem_ctx, const struct ldb_message *msg,
@@ -448,7 +448,7 @@ struct dom_sid *samdb_result_sid_prefix(TALLOC_CTX *mem_ctx, const struct ldb_me
 */
 NTTIME samdb_result_nttime(struct ldb_message *msg, const char *attr, NTTIME default_value)
 {
-       const char *str = ldb_msg_find_string(msg, attr, NULL);
+       const char *str = ldb_msg_find_attr_as_string(msg, attr, NULL);
        if (!str) return default_value;
        return nttime_from_string(str);
 }
@@ -458,7 +458,7 @@ NTTIME samdb_result_nttime(struct ldb_message *msg, const char *attr, NTTIME def
 */
 uint64_t samdb_result_uint64(struct ldb_message *msg, const char *attr, uint64_t default_value)
 {
-       return ldb_msg_find_uint64(msg, attr, default_value);
+       return ldb_msg_find_attr_as_uint64(msg, attr, default_value);
 }
 
 
@@ -619,7 +619,7 @@ struct samr_LogonHours samdb_result_logon_hours(TALLOC_CTX *mem_ctx, struct ldb_
 */
 uint16_t samdb_result_acct_flags(struct ldb_message *msg, const char *attr)
 {
-       uint_t userAccountControl = ldb_msg_find_uint(msg, attr, 0);
+       uint_t userAccountControl = ldb_msg_find_attr_as_uint(msg, attr, 0);
        return samdb_uf2acb(userAccountControl);
 }
 
@@ -1090,7 +1090,7 @@ const struct dom_sid *samdb_domain_sid(struct ldb_context *ldb)
                goto failed;
        }
 
-       basedn_s = ldb_msg_find_string(res->msgs[0], "rootDomainNamingContext", NULL);
+       basedn_s = ldb_msg_find_attr_as_string(res->msgs[0], "rootDomainNamingContext", NULL);
        if (basedn_s == NULL) {
                goto failed;
        }
index 8c4e063a73e3dfe7fe7dc3a645dcfdeedb4bdfa5..e1d7b7a1843ee6d0c41a6401576eea6c38ec2ea1 100644 (file)
@@ -82,7 +82,7 @@ static KerberosTime ldb_msg_find_krb5time_ldap_time(struct ldb_message *msg, con
     const char *gentime;
     struct tm tm;
 
-    gentime = ldb_msg_find_string(msg, attr, NULL);
+    gentime = ldb_msg_find_attr_as_string(msg, attr, NULL);
     if (!gentime)
        return default_val;
 
@@ -208,7 +208,7 @@ static krb5_error_code LDB_message2entry(krb5_context context, HDB *db,
        int i;
        krb5_error_code ret = 0;
        krb5_boolean is_computer = FALSE;
-       const char *dnsdomain = ldb_msg_find_string(realm_ref_msg, "dnsRoot", NULL);
+       const char *dnsdomain = ldb_msg_find_attr_as_string(realm_ref_msg, "dnsRoot", NULL);
        char *realm = strupper_talloc(mem_ctx, dnsdomain);
        struct ldb_dn *domain_dn = samdb_result_dn(mem_ctx, realm_ref_msg, "nCName", ldb_dn_new(mem_ctx));
 
@@ -248,18 +248,18 @@ static krb5_error_code LDB_message2entry(krb5_context context, HDB *db,
        entry_ex->ctx = private;
        entry_ex->free_entry = hdb_ldb_free_entry;
 
-       userAccountControl = ldb_msg_find_uint(msg, "userAccountControl", 0);
+       userAccountControl = ldb_msg_find_attr_as_uint(msg, "userAccountControl", 0);
 
        
        entry_ex->entry.principal = malloc(sizeof(*(entry_ex->entry.principal)));
        if (ent_type == HDB_LDB_ENT_TYPE_ANY && principal == NULL) {
-               const char *samAccountName = ldb_msg_find_string(msg, "samAccountName", NULL);
+               const char *samAccountName = ldb_msg_find_attr_as_string(msg, "samAccountName", NULL);
                if (!samAccountName) {
                        krb5_set_error_string(context, "LDB_message2entry: no samAccountName present");
                        ret = ENOENT;
                        goto out;
                }
-               samAccountName = ldb_msg_find_string(msg, "samAccountName", NULL);
+               samAccountName = ldb_msg_find_attr_as_string(msg, "samAccountName", NULL);
                krb5_make_principal(context, &entry_ex->entry.principal, realm, samAccountName, NULL);
        } else {
                char *strdup_realm;
@@ -286,7 +286,7 @@ static krb5_error_code LDB_message2entry(krb5_context context, HDB *db,
                krb5_princ_set_realm(context, entry_ex->entry.principal, &strdup_realm);
        }
 
-       entry_ex->entry.kvno = ldb_msg_find_int(msg, "msDS-KeyVersionNumber", 0);
+       entry_ex->entry.kvno = ldb_msg_find_attr_as_int(msg, "msDS-KeyVersionNumber", 0);
 
        entry_ex->entry.flags = uf2HDBFlags(context, userAccountControl, ent_type);
 
@@ -298,7 +298,7 @@ static krb5_error_code LDB_message2entry(krb5_context context, HDB *db,
        }
 
        if (lp_parm_bool(-1, "kdc", "require spn for service", True)) {
-               if (!is_computer && !ldb_msg_find_string(msg, "servicePrincipalName", NULL)) {
+               if (!is_computer && !ldb_msg_find_attr_as_string(msg, "servicePrincipalName", NULL)) {
                        entry_ex->entry.flags.server = 0;
                }
        }
@@ -648,7 +648,7 @@ static krb5_error_code LDB_fetch_krbtgt(krb5_context context, HDB *db,
                 * is in our db, then direct the caller at our primary
                 * krgtgt */
                
-               const char *dnsdomain = ldb_msg_find_string(realm_ref_msg[0], "dnsRoot", NULL);
+               const char *dnsdomain = ldb_msg_find_attr_as_string(realm_ref_msg[0], "dnsRoot", NULL);
                char *realm_fixed = strupper_talloc(mem_ctx, dnsdomain);
                if (!realm_fixed) {
                        krb5_set_error_string(context, "strupper_talloc: out of memory");
index 1a7ef29ad1d4cddbc24f3beed3976f1fdfc742db..250c487c7f8484489a571f206e6e588b0976b1f9 100644 (file)
@@ -165,7 +165,7 @@ krb5_error_code hdb_ldb_authz_data_as_req(krb5_context context, struct hdb_entry
        struct hdb_ldb_private *private = talloc_get_type(entry_ex->ctx, struct hdb_ldb_private);
        
        /* The user account may be set not to want the PAC */
-       userAccountControl = ldb_msg_find_uint(private->msg, "userAccountControl", 0);
+       userAccountControl = ldb_msg_find_attr_as_uint(private->msg, "userAccountControl", 0);
        if (userAccountControl & UF_NO_AUTH_DATA_REQUIRED) {
                *out = NULL;
                return 0;
@@ -235,7 +235,7 @@ krb5_error_code hdb_ldb_authz_data_tgs_req(krb5_context context, struct hdb_entr
        TALLOC_CTX *mem_ctx;
        
        /* The service account may be set not to want the PAC */
-       userAccountControl = ldb_msg_find_uint(private->msg, "userAccountControl", 0);
+       userAccountControl = ldb_msg_find_attr_as_uint(private->msg, "userAccountControl", 0);
        if (userAccountControl & UF_NO_AUTH_DATA_REQUIRED) {
                *out = NULL;
                return 0;
index 8aacbb63693927da23e3da98faee63fbead9e823..718e3e07739fc2ff1b77c2e7692e2b347c43eba1 100644 (file)
@@ -248,7 +248,7 @@ static int ldapsrv_load_limits(struct ldapsrv_connection *conn)
                goto failed;
        }
 
-       conf_dn_s = ldb_msg_find_string(res->msgs[0], "configurationNamingContext", NULL);
+       conf_dn_s = ldb_msg_find_attr_as_string(res->msgs[0], "configurationNamingContext", NULL);
        if (conf_dn_s == NULL) {
                goto failed;
        }
index b0dc74bdb57a22f1e25111f1b7b6cfd75e3a57a5..2cbfc2467a84e1631df5c6376758d013f13fb1b2 100644 (file)
@@ -311,9 +311,9 @@ const struct ldb_val *ldb_msg_find_ldb_val(const struct ldb_message *msg, const
        return &el->values[0];
 }
 
-int ldb_msg_find_int(const struct ldb_message *msg, 
-                    const char *attr_name,
-                    int default_value)
+int ldb_msg_find_attr_as_int(const struct ldb_message *msg, 
+                            const char *attr_name,
+                            int default_value)
 {
        const struct ldb_val *v = ldb_msg_find_ldb_val(msg, attr_name);
        if (!v || !v->data) {
@@ -322,9 +322,9 @@ int ldb_msg_find_int(const struct ldb_message *msg,
        return strtol((const char *)v->data, NULL, 0);
 }
 
-unsigned int ldb_msg_find_uint(const struct ldb_message *msg, 
-                              const char *attr_name,
-                              unsigned int default_value)
+unsigned int ldb_msg_find_attr_as_uint(const struct ldb_message *msg, 
+                                      const char *attr_name,
+                                      unsigned int default_value)
 {
        const struct ldb_val *v = ldb_msg_find_ldb_val(msg, attr_name);
        if (!v || !v->data) {
@@ -333,9 +333,9 @@ unsigned int ldb_msg_find_uint(const struct ldb_message *msg,
        return strtoul((const char *)v->data, NULL, 0);
 }
 
-int64_t ldb_msg_find_int64(const struct ldb_message *msg, 
-                          const char *attr_name,
-                          int64_t default_value)
+int64_t ldb_msg_find_attr_as_int64(const struct ldb_message *msg, 
+                                  const char *attr_name,
+                                  int64_t default_value)
 {
        const struct ldb_val *v = ldb_msg_find_ldb_val(msg, attr_name);
        if (!v || !v->data) {
@@ -344,9 +344,9 @@ int64_t ldb_msg_find_int64(const struct ldb_message *msg,
        return strtoll((const char *)v->data, NULL, 0);
 }
 
-uint64_t ldb_msg_find_uint64(const struct ldb_message *msg, 
-                            const char *attr_name,
-                            uint64_t default_value)
+uint64_t ldb_msg_find_attr_as_uint64(const struct ldb_message *msg, 
+                                    const char *attr_name,
+                                    uint64_t default_value)
 {
        const struct ldb_val *v = ldb_msg_find_ldb_val(msg, attr_name);
        if (!v || !v->data) {
@@ -355,9 +355,9 @@ uint64_t ldb_msg_find_uint64(const struct ldb_message *msg,
        return strtoull((const char *)v->data, NULL, 0);
 }
 
-double ldb_msg_find_double(const struct ldb_message *msg, 
-                          const char *attr_name,
-                          double default_value)
+double ldb_msg_find_attr_as_double(const struct ldb_message *msg, 
+                                  const char *attr_name,
+                                  double default_value)
 {
        const struct ldb_val *v = ldb_msg_find_ldb_val(msg, attr_name);
        if (!v || !v->data) {
@@ -366,9 +366,9 @@ double ldb_msg_find_double(const struct ldb_message *msg,
        return strtod((const char *)v->data, NULL);
 }
 
-const char *ldb_msg_find_string(const struct ldb_message *msg, 
-                               const char *attr_name,
-                               const char *default_value)
+const char *ldb_msg_find_attr_as_string(const struct ldb_message *msg, 
+                                       const char *attr_name,
+                                       const char *default_value)
 {
        const struct ldb_val *v = ldb_msg_find_ldb_val(msg, attr_name);
        if (!v || !v->data) {
@@ -377,9 +377,9 @@ const char *ldb_msg_find_string(const struct ldb_message *msg,
        return (const char *)v->data;
 }
 
-struct ldb_dn *ldb_msg_find_dn(void *mem_ctx,
-                               const struct ldb_message *msg,
-                               const char *attr_name)
+struct ldb_dn *ldb_msg_find_attr_as_dn(void *mem_ctx,
+                                      const struct ldb_message *msg,
+                                      const char *attr_name)
 {
        const struct ldb_val *v;
 
index e560068d0cd99372b4868d492b8440253dc6256d..e756a9b00b5b59509befcbf225f7d5c2205cb872 100644 (file)
@@ -1250,28 +1250,28 @@ int ldb_msg_element_compare(struct ldb_message_element *el1,
    single valued.
 */
 const struct ldb_val *ldb_msg_find_ldb_val(const struct ldb_message *msg, const char *attr_name);
-int ldb_msg_find_int(const struct ldb_message *msg, 
-                    const char *attr_name,
-                    int default_value);
-unsigned int ldb_msg_find_uint(const struct ldb_message *msg, 
-                              const char *attr_name,
-                              unsigned int default_value);
-int64_t ldb_msg_find_int64(const struct ldb_message *msg, 
-                          const char *attr_name,
-                          int64_t default_value);
-uint64_t ldb_msg_find_uint64(const struct ldb_message *msg, 
+int ldb_msg_find_attr_as_int(const struct ldb_message *msg, 
                             const char *attr_name,
-                            uint64_t default_value);
-double ldb_msg_find_double(const struct ldb_message *msg, 
-                          const char *attr_name,
-                          double default_value);
-const char *ldb_msg_find_string(const struct ldb_message *msg, 
-                               const char *attr_name,
-                               const char *default_value);
-
-struct ldb_dn *ldb_msg_find_dn(void *mem_ctx,
-                                  const struct ldb_message *msg,
-                                  const char *attr_name);
+                            int default_value);
+unsigned int ldb_msg_find_attr_as_uint(const struct ldb_message *msg, 
+                                      const char *attr_name,
+                                      unsigned int default_value);
+int64_t ldb_msg_find_attr_as_int64(const struct ldb_message *msg, 
+                                  const char *attr_name,
+                                  int64_t default_value);
+uint64_t ldb_msg_find_attr_as_uint64(const struct ldb_message *msg, 
+                                    const char *attr_name,
+                                    uint64_t default_value);
+double ldb_msg_find_attr_as_double(const struct ldb_message *msg, 
+                                  const char *attr_name,
+                                  double default_value);
+const char *ldb_msg_find_attr_as_string(const struct ldb_message *msg, 
+                                       const char *attr_name,
+                                       const char *default_value);
+
+struct ldb_dn *ldb_msg_find_attr_as_dn(void *mem_ctx,
+                                      const struct ldb_message *msg,
+                                       const char *attr_name);
 
 void ldb_msg_sort_elements(struct ldb_message *msg);
 
index c71f1be9ba2225da2ae62bfddcc434446d76d4c3..99e3f3e3222718a68a5a7f1ad8455cf876ad9e63 100644 (file)
@@ -455,7 +455,7 @@ static int ildb_search(struct ldb_module *module, struct ldb_request *req)
        if (req->op.search.base == NULL) {
                if (ildb->rootDSE != NULL) {
                        msg->r.SearchRequest.basedn =
-                               talloc_strdup(msg, ldb_msg_find_string(ildb->rootDSE, "defaultNamingContext", ""));
+                               talloc_strdup(msg, ldb_msg_find_attr_as_string(ildb->rootDSE, "defaultNamingContext", ""));
                } else {
                        msg->r.SearchRequest.basedn = talloc_strdup(msg, "");
                }
index cfbe7b2ab3cd68c33b41634e34ac77fa92b40b17..5634e9ad16328f14ba486bcac33e91ebb7ffe07c 100644 (file)
@@ -356,7 +356,7 @@ int ltdb_cache_load(struct ldb_module *module)
 
        /* if the current internal sequence number is the same as the one
           in the database then assume the rest of the cache is OK */
-       seq = ldb_msg_find_double(ltdb->cache->baseinfo, LTDB_SEQUENCE_NUMBER, 0);
+       seq = ldb_msg_find_attr_as_double(ltdb->cache->baseinfo, LTDB_SEQUENCE_NUMBER, 0);
        if (seq == ltdb->sequence_number) {
                goto done;
        }
index 8f8cb68d9853eb9a7cf362ca3bcf2813d938fee9..97b03a9410032d89426615110dd95f22fa76d9d0 100644 (file)
@@ -953,7 +953,7 @@ static int ltdb_sequence_number(struct ldb_module *module, struct ldb_request *r
                return LDB_SUCCESS;
        }
 
-       req->op.seq_num.seq_num = ldb_msg_find_uint64(msg, LTDB_SEQUENCE_NUMBER, 0);
+       req->op.seq_num.seq_num = ldb_msg_find_attr_as_uint64(msg, LTDB_SEQUENCE_NUMBER, 0);
        talloc_free(tmp_ctx);
        return LDB_SUCCESS;
 }
index a8c054cc165ddef4c78ba2a932d5e73c7cd53a1f..f4ed80fa7bb5ba2b3e4ad650c0007d40d9e927a7 100644 (file)
@@ -42,8 +42,8 @@ static int ldb_free_hive (struct registry_hive *hive)
 static void reg_ldb_unpack_value(TALLOC_CTX *mem_ctx, struct ldb_message *msg, char **name, uint32_t *type, DATA_BLOB *data)
 {
        const struct ldb_val *val;
-       *name = talloc_strdup(mem_ctx, ldb_msg_find_string(msg, "value", NULL));
-       *type = ldb_msg_find_uint(msg, "type", 0);
+       *name = talloc_strdup(mem_ctx, ldb_msg_find_attr_as_string(msg, "value", NULL));
+       *type = ldb_msg_find_attr_as_uint(msg, "type", 0);
        val = ldb_msg_find_ldb_val(msg, "data");
 
        switch (*type)
index 1d64257ca36ca20f222c52ea8c1b708539fffda5..ce6cca9b4946f8249d0837cf151547471dced136 100644 (file)
@@ -249,7 +249,7 @@ static NTSTATUS libnet_JoinADSDomain(struct libnet_context *ctx, struct libnet_J
        }
 
        /* If we have a kvno recorded in AD, we need it locally as well */
-       kvno = ldb_msg_find_uint(res->msgs[0], "msDS-KeyVersionNumber", 0);
+       kvno = ldb_msg_find_attr_as_uint(res->msgs[0], "msDS-KeyVersionNumber", 0);
 
        /* Prepare a new message, for the modify */
        msg = ldb_msg_new(tmp_ctx);
index 53fe71c98539efdefc3ffe41502bd5340d010108..fc4153637733aba11470c84fa2e7b4423cd652d3 100644 (file)
@@ -52,7 +52,7 @@ uint64_t winsdb_get_maxVersion(struct winsdb_handle *h)
        if (res->count > 1) goto failed;
 
        if (res->count == 1) {
-               maxVersion = ldb_msg_find_uint64(res->msgs[0], "maxVersion", 0);
+               maxVersion = ldb_msg_find_attr_as_uint64(res->msgs[0], "maxVersion", 0);
        }
 
 failed:
@@ -90,7 +90,7 @@ uint64_t winsdb_set_maxVersion(struct winsdb_handle *h, uint64_t newMaxVersion)
        talloc_steal(tmp_ctx, res);
 
        if (res->count == 1) {
-               oldMaxVersion = ldb_msg_find_uint64(res->msgs[0], "maxVersion", 0);
+               oldMaxVersion = ldb_msg_find_attr_as_uint64(res->msgs[0], "maxVersion", 0);
        }
 
        if (newMaxVersion == 0) {
@@ -149,7 +149,7 @@ uint64_t winsdb_get_seqnumber(struct winsdb_handle *h)
        if (res->count > 1) goto failed;
 
        if (res->count == 1) {
-               seqnumber = ldb_msg_find_uint64(res->msgs[0], "sequenceNumber", 0);
+               seqnumber = ldb_msg_find_attr_as_uint64(res->msgs[0], "sequenceNumber", 0);
        }
 
 failed:
@@ -639,14 +639,14 @@ NTSTATUS winsdb_record(struct winsdb_handle *h, struct ldb_message *msg, TALLOC_
 
        /* parse it into a more convenient winsdb_record structure */
        rec->name               = name;
-       rec->type               = ldb_msg_find_int(msg, "recordType", WREPL_TYPE_UNIQUE);
-       rec->state              = ldb_msg_find_int(msg, "recordState", WREPL_STATE_RELEASED);
-       rec->node               = ldb_msg_find_int(msg, "nodeType", WREPL_NODE_B);
-       rec->is_static          = ldb_msg_find_int(msg, "isStatic", 0);
-       rec->expire_time        = ldb_string_to_time(ldb_msg_find_string(msg, "expireTime", NULL));
-       rec->version            = ldb_msg_find_uint64(msg, "versionID", 0);
-       rec->wins_owner         = ldb_msg_find_string(msg, "winsOwner", NULL);
-       rec->registered_by      = ldb_msg_find_string(msg, "registeredBy", NULL);
+       rec->type               = ldb_msg_find_attr_as_int(msg, "recordType", WREPL_TYPE_UNIQUE);
+       rec->state              = ldb_msg_find_attr_as_int(msg, "recordState", WREPL_STATE_RELEASED);
+       rec->node               = ldb_msg_find_attr_as_int(msg, "nodeType", WREPL_NODE_B);
+       rec->is_static          = ldb_msg_find_attr_as_int(msg, "isStatic", 0);
+       rec->expire_time        = ldb_string_to_time(ldb_msg_find_attr_as_string(msg, "expireTime", NULL));
+       rec->version            = ldb_msg_find_attr_as_uint64(msg, "versionID", 0);
+       rec->wins_owner         = ldb_msg_find_attr_as_string(msg, "winsOwner", NULL);
+       rec->registered_by      = ldb_msg_find_attr_as_string(msg, "registeredBy", NULL);
        talloc_steal(rec, rec->wins_owner);
        talloc_steal(rec, rec->registered_by);
 
index 58cab91521df5d692f932f816d18b2128dc9a577..8353d6f13272dd0fad6dd7110b514bb08a75240e 100644 (file)
@@ -186,7 +186,7 @@ static NTSTATUS sldb_list_all(TALLOC_CTX *mem_ctx,
        }
 
        for (i = 0, j = 0; i < res->count; i++) {
-               n[j] = talloc_strdup(n, ldb_msg_find_string(res->msgs[i], "name", NULL));
+               n[j] = talloc_strdup(n, ldb_msg_find_attr_as_string(res->msgs[i], "name", NULL));
                if (!n[j]) {
                        DEBUG(0,("WARNING: Malformed share object in share database\n!"));
                        continue;
@@ -241,7 +241,7 @@ static NTSTATUS sldb_get_config(TALLOC_CTX *mem_ctx,
                return NT_STATUS_NO_MEMORY;
        }
 
-       s->name = talloc_strdup(s, ldb_msg_find_string(res->msgs[0], "name", NULL));
+       s->name = talloc_strdup(s, ldb_msg_find_attr_as_string(res->msgs[0], "name", NULL));
        if (!s->name) {
                DEBUG(0,("ERROR: Invalid share object!\n"));
                talloc_free(tmp_ctx);
index 9a76926375196fbc4a937f1c76f0f373be3bbb04..000f4fd8106c22afc8e5d91680c4d5d347c766ff 100644 (file)
@@ -1167,9 +1167,9 @@ static NTSTATUS lsa_lookup_sid(struct lsa_policy_state *state, TALLOC_CTX *mem_c
        ret = gendb_search(state->sam_ldb, mem_ctx, NULL, &res, attrs, 
                           "objectSid=%s", ldap_encode_ndr_dom_sid(mem_ctx, sid));
        if (ret == 1) {
-               *name = ldb_msg_find_string(res[0], "sAMAccountName", NULL);
+               *name = ldb_msg_find_attr_as_string(res[0], "sAMAccountName", NULL);
                if (!*name) {
-                       *name = ldb_msg_find_string(res[0], "name", NULL);
+                       *name = ldb_msg_find_attr_as_string(res[0], "name", NULL);
                        if (!*name) {
                                *name = talloc_strdup(mem_ctx, sid_str);
                                NT_STATUS_HAVE_NO_MEMORY(*name);
@@ -2133,7 +2133,7 @@ static NTSTATUS lsa_SetSecret(struct dcesrv_call_state *dce_call, TALLOC_CTX *me
                        }
 
                        new_val = ldb_msg_find_ldb_val(res[0], "secret");
-                       last_set_time = ldb_msg_find_uint64(res[0], "lastSetTime", 0);
+                       last_set_time = ldb_msg_find_attr_as_uint64(res[0], "lastSetTime", 0);
                        
                        if (new_val) {
                                /* set value */
@@ -2237,7 +2237,7 @@ static NTSTATUS lsa_QuerySecret(struct dcesrv_call_state *dce_call, TALLOC_CTX *
                if (!r->out.old_mtime) {
                        return NT_STATUS_NO_MEMORY;
                }
-               *r->out.old_mtime = ldb_msg_find_uint64(res[0], "priorSetTime", 0);
+               *r->out.old_mtime = ldb_msg_find_attr_as_uint64(res[0], "priorSetTime", 0);
        }
        
        if (r->in.new_val) {
@@ -2273,7 +2273,7 @@ static NTSTATUS lsa_QuerySecret(struct dcesrv_call_state *dce_call, TALLOC_CTX *
                if (!r->out.new_mtime) {
                        return NT_STATUS_NO_MEMORY;
                }
-               *r->out.new_mtime = ldb_msg_find_uint64(res[0], "lastSetTime", 0);
+               *r->out.new_mtime = ldb_msg_find_attr_as_uint64(res[0], "lastSetTime", 0);
        }
        
        return NT_STATUS_OK;
index e36c0e96ea36aa60c0f5efc20ab5467b113348b9..b3dadd14e17dd1f690d5bac11ed60ebbcfbfad37 100644 (file)
@@ -391,13 +391,13 @@ static NTSTATUS samr_OpenDomain(struct dcesrv_call_state *dce_call, TALLOC_CTX *
                                   "(&(&(nETBIOSName=*)(objectclass=crossRef))(ncName=%s))", 
                                   ldb_dn_linearize(mem_ctx, dom_msgs[0]->dn));
                if (ret == 0) {
-                       domain_name = ldb_msg_find_string(dom_msgs[0], "cn", NULL);
+                       domain_name = ldb_msg_find_attr_as_string(dom_msgs[0], "cn", NULL);
                        if (domain_name == NULL) {
                                return NT_STATUS_NO_SUCH_DOMAIN;
                        }
                } else if (ret == 1) {
                
-                       domain_name = ldb_msg_find_string(ref_msgs[0], "nETBIOSName", NULL);
+                       domain_name = ldb_msg_find_attr_as_string(ref_msgs[0], "nETBIOSName", NULL);
                        if (domain_name == NULL) {
                                return NT_STATUS_NO_SUCH_DOMAIN;
                        }
@@ -464,7 +464,7 @@ static NTSTATUS samr_info_DomInfo2(struct samr_domain_state *state, TALLOC_CTX *
                                    struct ldb_message **dom_msgs,
                                   struct samr_DomInfo2 *info)
 {
-       info->force_logoff_time = ldb_msg_find_uint64(dom_msgs[0], "forceLogoff", 
+       info->force_logoff_time = ldb_msg_find_attr_as_uint64(dom_msgs[0], "forceLogoff", 
                                                            0x8000000000000000LL);
 
        info->comment.string = samdb_result_string(dom_msgs[0], "comment", NULL);
@@ -472,7 +472,7 @@ static NTSTATUS samr_info_DomInfo2(struct samr_domain_state *state, TALLOC_CTX *
 
        /* FIXME:  We should find the name of the real PDC emulator */
        info->primary.string = lp_netbios_name();
-       info->sequence_num = ldb_msg_find_uint64(dom_msgs[0], "modifiedCount", 
+       info->sequence_num = ldb_msg_find_attr_as_uint64(dom_msgs[0], "modifiedCount", 
                                                 0);
 
        info->role = lp_server_role();
@@ -498,7 +498,7 @@ static NTSTATUS samr_info_DomInfo3(struct samr_domain_state *state,
                                    struct ldb_message **dom_msgs,
                                   struct samr_DomInfo3 *info)
 {
-       info->force_logoff_time = ldb_msg_find_uint64(dom_msgs[0], "forceLogoff", 
+       info->force_logoff_time = ldb_msg_find_attr_as_uint64(dom_msgs[0], "forceLogoff", 
                                                      0x8000000000000000LL);
 
        return NT_STATUS_OK;
@@ -566,10 +566,10 @@ static NTSTATUS samr_info_DomInfo8(struct samr_domain_state *state,
                                    struct ldb_message **dom_msgs,
                                   struct samr_DomInfo8 *info)
 {
-       info->sequence_num = ldb_msg_find_uint64(dom_msgs[0], "modifiedCount", 
+       info->sequence_num = ldb_msg_find_attr_as_uint64(dom_msgs[0], "modifiedCount", 
                                               time(NULL));
 
-       info->domain_create_time = ldb_msg_find_uint(dom_msgs[0], "creationTime",
+       info->domain_create_time = ldb_msg_find_attr_as_uint(dom_msgs[0], "creationTime",
                                                     0x0LL);
 
        return NT_STATUS_OK;
@@ -602,11 +602,11 @@ static NTSTATUS samr_info_DomInfo11(struct samr_domain_state *state,
                return status;
        }
        
-       info->lockout_duration = ldb_msg_find_int64(dom_msgs[0], "lockoutDuration", 
+       info->lockout_duration = ldb_msg_find_attr_as_int64(dom_msgs[0], "lockoutDuration", 
                                                    -18000000000LL);
-       info->lockout_window = ldb_msg_find_int64(dom_msgs[0], "lockOutObservationWindow",
+       info->lockout_window = ldb_msg_find_attr_as_int64(dom_msgs[0], "lockOutObservationWindow",
                                                    -18000000000LL);
-       info->lockout_threshold = ldb_msg_find_int64(dom_msgs[0], "lockoutThreshold", 0);
+       info->lockout_threshold = ldb_msg_find_attr_as_int64(dom_msgs[0], "lockoutThreshold", 0);
 
        return NT_STATUS_OK;
 }
@@ -619,11 +619,11 @@ static NTSTATUS samr_info_DomInfo12(struct samr_domain_state *state,
                                    struct ldb_message **dom_msgs,
                                   struct samr_DomInfo12 *info)
 {
-       info->lockout_duration = ldb_msg_find_int64(dom_msgs[0], "lockoutDuration", 
+       info->lockout_duration = ldb_msg_find_attr_as_int64(dom_msgs[0], "lockoutDuration", 
                                                    -18000000000LL);
-       info->lockout_window = ldb_msg_find_int64(dom_msgs[0], "lockOutObservationWindow",
+       info->lockout_window = ldb_msg_find_attr_as_int64(dom_msgs[0], "lockOutObservationWindow",
                                                    -18000000000LL);
-       info->lockout_threshold = ldb_msg_find_int64(dom_msgs[0], "lockoutThreshold", 0);
+       info->lockout_threshold = ldb_msg_find_attr_as_int64(dom_msgs[0], "lockoutThreshold", 0);
 
        return NT_STATUS_OK;
 }
@@ -636,10 +636,10 @@ static NTSTATUS samr_info_DomInfo13(struct samr_domain_state *state,
                                    struct ldb_message **dom_msgs,
                                    struct samr_DomInfo13 *info)
 {
-       info->sequence_num = ldb_msg_find_uint64(dom_msgs[0], "modifiedCount", 
+       info->sequence_num = ldb_msg_find_attr_as_uint64(dom_msgs[0], "modifiedCount", 
                                               time(NULL));
 
-       info->domain_create_time = ldb_msg_find_uint(dom_msgs[0], "creationTime",
+       info->domain_create_time = ldb_msg_find_attr_as_uint(dom_msgs[0], "creationTime",
                                                     0x0LL);
 
        info->unknown1 = 0;
index 068888bae9f183419bdb7c9d8d8856cbb30787fc..e7e50105fb23d34e9b5df72d385ddb54ec012bbd 100644 (file)
@@ -129,13 +129,13 @@ static BOOL test_search_rootDSE(struct ldb_context *ldb, struct test_rootDSE *ro
 
        msg = r->msgs[0];
 
-       root->defaultdn = ldb_msg_find_string(msg, "defaultNamingContext", NULL);
+       root->defaultdn = ldb_msg_find_attr_as_string(msg, "defaultNamingContext", NULL);
        talloc_steal(ldb, root->defaultdn);
-       root->rootdn    = ldb_msg_find_string(msg, "rootDomainNamingContext", NULL);
+       root->rootdn    = ldb_msg_find_attr_as_string(msg, "rootDomainNamingContext", NULL);
        talloc_steal(ldb, root->rootdn);
-       root->configdn  = ldb_msg_find_string(msg, "configurationNamingContext", NULL);
+       root->configdn  = ldb_msg_find_attr_as_string(msg, "configurationNamingContext", NULL);
        talloc_steal(ldb, root->configdn);
-       root->schemadn  = ldb_msg_find_string(msg, "schemaNamingContext", NULL);
+       root->schemadn  = ldb_msg_find_attr_as_string(msg, "schemaNamingContext", NULL);
        talloc_steal(ldb, root->schemadn);
 
        talloc_free(r);
index f32c4bb9bfec57594929b74eb03eab30dbe0efdc..d18f7e8517af76cc2b9bfb69efc4b0b6487d0612 100644 (file)
@@ -58,7 +58,7 @@ static uint64_t wins_config_db_get_seqnumber(struct ldb_context *ldb)
        if (res->count > 1) goto failed;
 
        if (res->count == 1) {
-               seqnumber = ldb_msg_find_uint64(res->msgs[0], "sequenceNumber", 0);
+               seqnumber = ldb_msg_find_attr_as_uint64(res->msgs[0], "sequenceNumber", 0);
        }
 
 failed:
@@ -154,7 +154,7 @@ NTSTATUS wreplsrv_load_partners(struct wreplsrv_service *service)
        for (i=0; i < res->count; i++) {
                const char *address;
 
-               address = ldb_msg_find_string(res->msgs[i], "address", NULL);
+               address = ldb_msg_find_attr_as_string(res->msgs[i], "address", NULL);
                if (!address) {
                        goto failed;
                }
@@ -181,19 +181,19 @@ NTSTATUS wreplsrv_load_partners(struct wreplsrv_service *service)
                        DLIST_ADD_END(service->partners, partner, struct wreplsrv_partner *);
                }
 
-               partner->name                   = ldb_msg_find_string(res->msgs[i], "name", partner->address);
+               partner->name                   = ldb_msg_find_attr_as_string(res->msgs[i], "name", partner->address);
                talloc_steal(partner, partner->name);
-               partner->our_address            = ldb_msg_find_string(res->msgs[i], "ourAddress", NULL);
+               partner->our_address            = ldb_msg_find_attr_as_string(res->msgs[i], "ourAddress", NULL);
                talloc_steal(partner, partner->our_address);
 
-               partner->type                   = ldb_msg_find_uint(res->msgs[i], "type", WINSREPL_PARTNER_BOTH);
-               partner->pull.interval          = ldb_msg_find_uint(res->msgs[i], "pullInterval",
+               partner->type                   = ldb_msg_find_attr_as_uint(res->msgs[i], "type", WINSREPL_PARTNER_BOTH);
+               partner->pull.interval          = ldb_msg_find_attr_as_uint(res->msgs[i], "pullInterval",
                                                                    WINSREPL_DEFAULT_PULL_INTERVAL);
-               partner->pull.retry_interval    = ldb_msg_find_uint(res->msgs[i], "pullRetryInterval",
+               partner->pull.retry_interval    = ldb_msg_find_attr_as_uint(res->msgs[i], "pullRetryInterval",
                                                                    WINSREPL_DEFAULT_PULL_RETRY_INTERVAL);
-               partner->push.change_count      = ldb_msg_find_uint(res->msgs[i], "pushChangeCount",
+               partner->push.change_count      = ldb_msg_find_attr_as_uint(res->msgs[i], "pushChangeCount",
                                                                    WINSREPL_DEFAULT_PUSH_CHANGE_COUNT);
-               partner->push.use_inform        = ldb_msg_find_uint(res->msgs[i], "pushUseInform", False);
+               partner->push.use_inform        = ldb_msg_find_attr_as_uint(res->msgs[i], "pushUseInform", False);
 
                DEBUG(3,("wreplsrv_load_partners: found partner: %s type: 0x%X\n",
                        partner->address, partner->type));
@@ -381,8 +381,8 @@ static NTSTATUS wreplsrv_load_table(struct wreplsrv_service *service)
        talloc_steal(tmp_ctx, res);
 
        for (i=0; i < res->count; i++) {
-               wins_owner     = ldb_msg_find_string(res->msgs[i], "winsOwner", NULL);
-               version        = ldb_msg_find_uint64(res->msgs[i], "versionID", 0);
+               wins_owner     = ldb_msg_find_attr_as_string(res->msgs[i], "winsOwner", NULL);
+               version        = ldb_msg_find_attr_as_uint64(res->msgs[i], "versionID", 0);
 
                status = wreplsrv_add_table(service,
                                            service, &service->table,