diff options
author | Simo Sorce <idra@samba.org> | 2006-08-13 08:00:36 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:15:31 -0500 |
commit | a23b63a8e54db7d0ec98ad95cdca11dd4d039e17 (patch) | |
tree | b5a38a7ca5dd1347097fe14b9f80df25fa3e4594 /source4 | |
parent | 8492a45f8a936943c9ddd0fd400871b78308a23d (diff) | |
download | samba-a23b63a8e54db7d0ec98ad95cdca11dd4d039e17.tar.gz samba-a23b63a8e54db7d0ec98ad95cdca11dd4d039e17.tar.bz2 samba-a23b63a8e54db7d0ec98ad95cdca11dd4d039e17.zip |
r17516: Change helper function names to make more clear what they are meant to do
(This used to be commit ad75cf869550af66119d0293503024d41d834e02)
Diffstat (limited to 'source4')
23 files changed, 150 insertions, 150 deletions
diff --git a/source4/auth/credentials/credentials_files.c b/source4/auth/credentials/credentials_files.c index a268fe369e..c61f8ccb5e 100644 --- a/source4/auth/credentials/credentials_files.c +++ b/source4/auth/credentials/credentials_files.c @@ -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) { diff --git a/source4/auth/gensec/schannel_state.c b/source4/auth/gensec/schannel_state.c index 97bcd40d09..e8d0f8388b 100644 --- a/source4/auth/gensec/schannel_state.c +++ b/source4/auth/gensec/schannel_state.c @@ -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"); diff --git a/source4/dsdb/samdb/ldb_modules/password_hash.c b/source4/dsdb/samdb/ldb_modules/password_hash.c index 93af3ae260..273cc60c30 100644 --- a/source4/dsdb/samdb/ldb_modules/password_hash.c +++ b/source4/dsdb/samdb/ldb_modules/password_hash.c @@ -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; diff --git a/source4/dsdb/samdb/ldb_modules/proxy.c b/source4/dsdb/samdb/ldb_modules/proxy.c index c8e5a91e58..d2628f5d1d 100644 --- a/source4/dsdb/samdb/ldb_modules/proxy.c +++ b/source4/dsdb/samdb/ldb_modules/proxy.c @@ -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"); diff --git a/source4/dsdb/samdb/ldb_modules/samba3sam.c b/source4/dsdb/samdb/ldb_modules/samba3sam.c index 06774780a1..80cedb7b08 100644 --- a/source4/dsdb/samdb/ldb_modules/samba3sam.c +++ b/source4/dsdb/samdb/ldb_modules/samba3sam.c @@ -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); } diff --git a/source4/dsdb/samdb/ldb_modules/samldb.c b/source4/dsdb/samdb/ldb_modules/samldb.c index 55f545a45a..67724d56b5 100644 --- a/source4/dsdb/samdb/ldb_modules/samldb.c +++ b/source4/dsdb/samdb/ldb_modules/samldb.c @@ -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", diff --git a/source4/dsdb/samdb/samdb.c b/source4/dsdb/samdb/samdb.c index 3c2283a471..a659c66725 100644 --- a/source4/dsdb/samdb/samdb.c +++ b/source4/dsdb/samdb/samdb.c @@ -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; } diff --git a/source4/kdc/hdb-ldb.c b/source4/kdc/hdb-ldb.c index 8c4e063a73..e1d7b7a184 100644 --- a/source4/kdc/hdb-ldb.c +++ b/source4/kdc/hdb-ldb.c @@ -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"); diff --git a/source4/kdc/pac-glue.c b/source4/kdc/pac-glue.c index 1a7ef29ad1..250c487c7f 100644 --- a/source4/kdc/pac-glue.c +++ b/source4/kdc/pac-glue.c @@ -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; diff --git a/source4/ldap_server/ldap_server.c b/source4/ldap_server/ldap_server.c index 8aacbb6369..718e3e0773 100644 --- a/source4/ldap_server/ldap_server.c +++ b/source4/ldap_server/ldap_server.c @@ -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; } diff --git a/source4/lib/ldb/common/ldb_msg.c b/source4/lib/ldb/common/ldb_msg.c index b0dc74bdb5..2cbfc2467a 100644 --- a/source4/lib/ldb/common/ldb_msg.c +++ b/source4/lib/ldb/common/ldb_msg.c @@ -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; diff --git a/source4/lib/ldb/include/ldb.h b/source4/lib/ldb/include/ldb.h index e560068d0c..e756a9b00b 100644 --- a/source4/lib/ldb/include/ldb.h +++ b/source4/lib/ldb/include/ldb.h @@ -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); diff --git a/source4/lib/ldb/ldb_ildap/ldb_ildap.c b/source4/lib/ldb/ldb_ildap/ldb_ildap.c index c71f1be9ba..99e3f3e322 100644 --- a/source4/lib/ldb/ldb_ildap/ldb_ildap.c +++ b/source4/lib/ldb/ldb_ildap/ldb_ildap.c @@ -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, ""); } diff --git a/source4/lib/ldb/ldb_tdb/ldb_cache.c b/source4/lib/ldb/ldb_tdb/ldb_cache.c index cfbe7b2ab3..5634e9ad16 100644 --- a/source4/lib/ldb/ldb_tdb/ldb_cache.c +++ b/source4/lib/ldb/ldb_tdb/ldb_cache.c @@ -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; } diff --git a/source4/lib/ldb/ldb_tdb/ldb_tdb.c b/source4/lib/ldb/ldb_tdb/ldb_tdb.c index 8f8cb68d98..97b03a9410 100644 --- a/source4/lib/ldb/ldb_tdb/ldb_tdb.c +++ b/source4/lib/ldb/ldb_tdb/ldb_tdb.c @@ -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; } diff --git a/source4/lib/registry/reg_backend_ldb.c b/source4/lib/registry/reg_backend_ldb.c index a8c054cc16..f4ed80fa7b 100644 --- a/source4/lib/registry/reg_backend_ldb.c +++ b/source4/lib/registry/reg_backend_ldb.c @@ -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) diff --git a/source4/libnet/libnet_join.c b/source4/libnet/libnet_join.c index 1d64257ca3..ce6cca9b49 100644 --- a/source4/libnet/libnet_join.c +++ b/source4/libnet/libnet_join.c @@ -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); diff --git a/source4/nbt_server/wins/winsdb.c b/source4/nbt_server/wins/winsdb.c index 53fe71c985..fc41536377 100644 --- a/source4/nbt_server/wins/winsdb.c +++ b/source4/nbt_server/wins/winsdb.c @@ -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); diff --git a/source4/param/share_ldb.c b/source4/param/share_ldb.c index 58cab91521..8353d6f132 100644 --- a/source4/param/share_ldb.c +++ b/source4/param/share_ldb.c @@ -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); diff --git a/source4/rpc_server/lsa/dcesrv_lsa.c b/source4/rpc_server/lsa/dcesrv_lsa.c index 9a76926375..000f4fd810 100644 --- a/source4/rpc_server/lsa/dcesrv_lsa.c +++ b/source4/rpc_server/lsa/dcesrv_lsa.c @@ -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; diff --git a/source4/rpc_server/samr/dcesrv_samr.c b/source4/rpc_server/samr/dcesrv_samr.c index e36c0e96ea..b3dadd14e1 100644 --- a/source4/rpc_server/samr/dcesrv_samr.c +++ b/source4/rpc_server/samr/dcesrv_samr.c @@ -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; diff --git a/source4/torture/ldap/schema.c b/source4/torture/ldap/schema.c index 068888bae9..e7e50105fb 100644 --- a/source4/torture/ldap/schema.c +++ b/source4/torture/ldap/schema.c @@ -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); diff --git a/source4/wrepl_server/wrepl_server.c b/source4/wrepl_server/wrepl_server.c index f32c4bb9bf..d18f7e8517 100644 --- a/source4/wrepl_server/wrepl_server.c +++ b/source4/wrepl_server/wrepl_server.c @@ -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, |