1
0
mirror of https://github.com/samba-team/samba.git synced 2025-10-12 23:33:18 +03:00

r17516: Change helper function names to make more clear what they are meant to do

(This used to be commit ad75cf8695)
This commit is contained in:
Simo Sorce
2006-08-13 08:00:36 +00:00
committed by Gerald (Jerry) Carter
parent 8492a45f8a
commit a23b63a8e5
23 changed files with 149 additions and 149 deletions

View File

@@ -238,10 +238,10 @@ NTSTATUS cli_credentials_set_secrets(struct cli_credentials *cred,
return NT_STATUS_CANT_ACCESS_DOMAIN_INFO; return NT_STATUS_CANT_ACCESS_DOMAIN_INFO;
} }
password = ldb_msg_find_string(msgs[0], "secret", NULL); password = ldb_msg_find_attr_as_string(msgs[0], "secret", NULL);
old_password = ldb_msg_find_string(msgs[0], "priorSecret", 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) { if (!machine_account) {
DEBUG(1, ("Could not find 'samAccountName' in join record to domain: %s\n", 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; 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); 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) { if (sct) {
cli_credentials_set_secure_channel_type(cred, 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) { if (domain) {
cli_credentials_set_domain(cred, domain, CRED_SPECIFIED); 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) { if (realm) {
cli_credentials_set_realm(cred, realm, CRED_SPECIFIED); cli_credentials_set_realm(cred, realm, CRED_SPECIFIED);
} }
cli_credentials_set_username(cred, machine_account, 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 /* If there was an external keytab specified by reference in
* the LDB, then use this. Otherwise we will make one up * the LDB, then use this. Otherwise we will make one up
* (chewing CPU time) from the password */ * (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) { if (keytab) {
cli_credentials_set_keytab_name(cred, keytab, CRED_SPECIFIED); cli_credentials_set_keytab_name(cred, keytab, CRED_SPECIFIED);
} else { } else {
keytab = ldb_msg_find_string(msgs[0], "privateKeytab", NULL); keytab = ldb_msg_find_attr_as_string(msgs[0], "privateKeytab", NULL);
if (keytab) { if (keytab) {
keytab = talloc_asprintf(mem_ctx, "FILE:%s", private_path(mem_ctx, keytab)); keytab = talloc_asprintf(mem_ctx, "FILE:%s", private_path(mem_ctx, keytab));
if (keytab) { if (keytab) {

View File

@@ -231,15 +231,15 @@ NTSTATUS schannel_fetch_session_key_ldb(TALLOC_CTX *mem_ctx,
} }
memcpy((*creds)->server.data, val->data, 8); 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"); (*creds)->sid = samdb_result_dom_sid(*creds, res->msgs[0], "objectSid");

View File

@@ -99,7 +99,7 @@ static int add_password_hashes(struct ldb_module *module, struct ldb_message *ms
const char *sambaPassword; const char *sambaPassword;
struct samr_Password tmp_hash; 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 ?! */ if (sambaPassword == NULL) { /* impossible, what happened ?! */
return LDB_ERR_OPERATIONS_ERROR; 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 * algorithm, described in his Nov 10 2004 mail to
* samba-technical@samba.org */ * 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 ?! */ if (sambaPassword == NULL) { /* impossible, what happened ?! */
return LDB_ERR_OPERATIONS_ERROR; 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->pwdProperties = samdb_result_uint(res->message, "pwdProperties", 0);
data->pwdHistoryLength = samdb_result_uint(res->message, "pwdHistoryLength", 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) { if (tmp != NULL) {
data->dnsDomain = talloc_strdup(data, tmp); 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 */ /* now add krb5 keys based on unicode password */
ret = add_krb5_keys_from_password(ac->module, msg, smb_krb5_context, domain, ret = add_krb5_keys_from_password(ac->module, msg, smb_krb5_context, domain,
ldb_msg_find_string(msg, "samAccountName", NULL), ldb_msg_find_attr_as_string(msg, "samAccountName", NULL),
ldb_msg_find_string(msg, "userPrincipalName", NULL), ldb_msg_find_attr_as_string(msg, "userPrincipalName", NULL),
ldb_msg_check_string_attribute(msg, "objectClass", "computer")); ldb_msg_check_string_attribute(msg, "objectClass", "computer"));
if (ret != LDB_SUCCESS) { if (ret != LDB_SUCCESS) {
return ret; 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 /* if both the domain properties and the user account controls do not permit
* clear text passwords then wipe out the sambaPassword */ * clear text passwords then wipe out the sambaPassword */
if ((!(domain->pwdProperties & DOMAIN_PASSWORD_STORE_CLEARTEXT)) || 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"); ldb_msg_remove_attr(msg, "sambaPassword");
} }
} }
/* don't touch it if a value is set. It could be an incoming samsync */ /* 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) { if (set_pwdLastSet(ac->module, msg, 0) != LDB_SUCCESS) {
return LDB_ERR_OPERATIONS_ERROR; 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 */ /* now add krb5 keys based on unicode password */
ret = add_krb5_keys_from_password(ac->module, msg, smb_krb5_context, domain, 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_attr_as_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, "userPrincipalName", NULL),
ldb_msg_check_string_attribute(ac->search_res->message, "objectClass", "computer")); ldb_msg_check_string_attribute(ac->search_res->message, "objectClass", "computer"));
if (ret != LDB_SUCCESS) { 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 /* if the domain properties or the user account controls do not permit
* clear text passwords then wipe out the sambaPassword */ * clear text passwords then wipe out the sambaPassword */
if ((!(domain->pwdProperties & DOMAIN_PASSWORD_STORE_CLEARTEXT)) || 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"); 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, if (!ldb_msg_find_element(ac->orig_req->op.mod.message,
"msDS-KeyVersionNumber")) { "msDS-KeyVersionNumber")) {
if (add_keyVersionNumber(ac->module, msg, 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) "msDS-KeyVersionNumber", 0)
) != LDB_SUCCESS) { ) != LDB_SUCCESS) {
return LDB_ERR_OPERATIONS_ERROR; return LDB_ERR_OPERATIONS_ERROR;

View File

@@ -81,13 +81,13 @@ static int load_proxy_info(struct ldb_module *module)
goto failed; goto failed;
} }
url = ldb_msg_find_string(res->msgs[0], "url", NULL); url = ldb_msg_find_attr_as_string(res->msgs[0], "url", NULL);
olddn = ldb_msg_find_string(res->msgs[0], "olddn", NULL); olddn = ldb_msg_find_attr_as_string(res->msgs[0], "olddn", NULL);
newdn = ldb_msg_find_string(res->msgs[0], "newdn", NULL); newdn = ldb_msg_find_attr_as_string(res->msgs[0], "newdn", NULL);
username = ldb_msg_find_string(res->msgs[0], "username", NULL); username = ldb_msg_find_attr_as_string(res->msgs[0], "username", NULL);
password = ldb_msg_find_string(res->msgs[0], "password", NULL); password = ldb_msg_find_attr_as_string(res->msgs[0], "password", NULL);
oldstr = ldb_msg_find_string(res->msgs[0], "oldstr", NULL); oldstr = ldb_msg_find_attr_as_string(res->msgs[0], "oldstr", NULL);
newstr = ldb_msg_find_string(res->msgs[0], "newstr", NULL); newstr = ldb_msg_find_attr_as_string(res->msgs[0], "newstr", NULL);
if (url == NULL || olddn == NULL || newdn == NULL || username == NULL || password == 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"); ldb_debug(module->ldb, LDB_DEBUG_FATAL, "Need url, olddn, newdn, oldstr, newstr, username and password in @PROXYINFO\n");

View 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) 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; 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) if (!sid)
return NULL; return NULL;
@@ -96,7 +96,7 @@ static void generate_sambaPrimaryGroupSID(struct ldb_module *module, const char
sidstring = dom_sid_string(remote_mp, sid); sidstring = dom_sid_string(remote_mp, sid);
talloc_free(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); talloc_free(sidstring);
} }

View File

@@ -136,7 +136,7 @@ static int samldb_find_next_rid(struct ldb_module *module, TALLOC_CTX *mem_ctx,
return LDB_ERR_OPERATIONS_ERROR; 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) { if (str == NULL) {
ldb_asprintf_errstring(module->ldb, ldb_asprintf_errstring(module->ldb,
"attribute nextRid not found in %s\n", "attribute nextRid not found in %s\n",

View 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) 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) 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 *samdb_result_string(const struct ldb_message *msg, const char *attr,
const char *default_value) 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, 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) 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; if (!str) return default_value;
return nttime_from_string(str); 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) 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) 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); return samdb_uf2acb(userAccountControl);
} }
@@ -1090,7 +1090,7 @@ const struct dom_sid *samdb_domain_sid(struct ldb_context *ldb)
goto failed; 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) { if (basedn_s == NULL) {
goto failed; goto failed;
} }

View File

@@ -82,7 +82,7 @@ static KerberosTime ldb_msg_find_krb5time_ldap_time(struct ldb_message *msg, con
const char *gentime; const char *gentime;
struct tm tm; struct tm tm;
gentime = ldb_msg_find_string(msg, attr, NULL); gentime = ldb_msg_find_attr_as_string(msg, attr, NULL);
if (!gentime) if (!gentime)
return default_val; return default_val;
@@ -208,7 +208,7 @@ static krb5_error_code LDB_message2entry(krb5_context context, HDB *db,
int i; int i;
krb5_error_code ret = 0; krb5_error_code ret = 0;
krb5_boolean is_computer = FALSE; 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); 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)); 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->ctx = private;
entry_ex->free_entry = hdb_ldb_free_entry; 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))); entry_ex->entry.principal = malloc(sizeof(*(entry_ex->entry.principal)));
if (ent_type == HDB_LDB_ENT_TYPE_ANY && principal == NULL) { 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) { if (!samAccountName) {
krb5_set_error_string(context, "LDB_message2entry: no samAccountName present"); krb5_set_error_string(context, "LDB_message2entry: no samAccountName present");
ret = ENOENT; ret = ENOENT;
goto out; 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); krb5_make_principal(context, &entry_ex->entry.principal, realm, samAccountName, NULL);
} else { } else {
char *strdup_realm; 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); 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); 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 (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; 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 * is in our db, then direct the caller at our primary
* krgtgt */ * 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); char *realm_fixed = strupper_talloc(mem_ctx, dnsdomain);
if (!realm_fixed) { if (!realm_fixed) {
krb5_set_error_string(context, "strupper_talloc: out of memory"); krb5_set_error_string(context, "strupper_talloc: out of memory");

View 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); 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 */ /* 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) { if (userAccountControl & UF_NO_AUTH_DATA_REQUIRED) {
*out = NULL; *out = NULL;
return 0; 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; TALLOC_CTX *mem_ctx;
/* The service account may be set not to want the PAC */ /* 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) { if (userAccountControl & UF_NO_AUTH_DATA_REQUIRED) {
*out = NULL; *out = NULL;
return 0; return 0;

View File

@@ -248,7 +248,7 @@ static int ldapsrv_load_limits(struct ldapsrv_connection *conn)
goto failed; 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) { if (conf_dn_s == NULL) {
goto failed; goto failed;
} }

View File

@@ -311,9 +311,9 @@ const struct ldb_val *ldb_msg_find_ldb_val(const struct ldb_message *msg, const
return &el->values[0]; return &el->values[0];
} }
int ldb_msg_find_int(const struct ldb_message *msg, int ldb_msg_find_attr_as_int(const struct ldb_message *msg,
const char *attr_name, const char *attr_name,
int default_value) int default_value)
{ {
const struct ldb_val *v = ldb_msg_find_ldb_val(msg, attr_name); const struct ldb_val *v = ldb_msg_find_ldb_val(msg, attr_name);
if (!v || !v->data) { 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); return strtol((const char *)v->data, NULL, 0);
} }
unsigned int ldb_msg_find_uint(const struct ldb_message *msg, unsigned int ldb_msg_find_attr_as_uint(const struct ldb_message *msg,
const char *attr_name, const char *attr_name,
unsigned int default_value) unsigned int default_value)
{ {
const struct ldb_val *v = ldb_msg_find_ldb_val(msg, attr_name); const struct ldb_val *v = ldb_msg_find_ldb_val(msg, attr_name);
if (!v || !v->data) { 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); return strtoul((const char *)v->data, NULL, 0);
} }
int64_t ldb_msg_find_int64(const struct ldb_message *msg, int64_t ldb_msg_find_attr_as_int64(const struct ldb_message *msg,
const char *attr_name, const char *attr_name,
int64_t default_value) int64_t default_value)
{ {
const struct ldb_val *v = ldb_msg_find_ldb_val(msg, attr_name); const struct ldb_val *v = ldb_msg_find_ldb_val(msg, attr_name);
if (!v || !v->data) { 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); return strtoll((const char *)v->data, NULL, 0);
} }
uint64_t ldb_msg_find_uint64(const struct ldb_message *msg, uint64_t ldb_msg_find_attr_as_uint64(const struct ldb_message *msg,
const char *attr_name, const char *attr_name,
uint64_t default_value) uint64_t default_value)
{ {
const struct ldb_val *v = ldb_msg_find_ldb_val(msg, attr_name); const struct ldb_val *v = ldb_msg_find_ldb_val(msg, attr_name);
if (!v || !v->data) { 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); return strtoull((const char *)v->data, NULL, 0);
} }
double ldb_msg_find_double(const struct ldb_message *msg, double ldb_msg_find_attr_as_double(const struct ldb_message *msg,
const char *attr_name, const char *attr_name,
double default_value) double default_value)
{ {
const struct ldb_val *v = ldb_msg_find_ldb_val(msg, attr_name); const struct ldb_val *v = ldb_msg_find_ldb_val(msg, attr_name);
if (!v || !v->data) { 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); return strtod((const char *)v->data, NULL);
} }
const char *ldb_msg_find_string(const struct ldb_message *msg, const char *ldb_msg_find_attr_as_string(const struct ldb_message *msg,
const char *attr_name, const char *attr_name,
const char *default_value) const char *default_value)
{ {
const struct ldb_val *v = ldb_msg_find_ldb_val(msg, attr_name); const struct ldb_val *v = ldb_msg_find_ldb_val(msg, attr_name);
if (!v || !v->data) { if (!v || !v->data) {
@@ -377,9 +377,9 @@ const char *ldb_msg_find_string(const struct ldb_message *msg,
return (const char *)v->data; return (const char *)v->data;
} }
struct ldb_dn *ldb_msg_find_dn(void *mem_ctx, struct ldb_dn *ldb_msg_find_attr_as_dn(void *mem_ctx,
const struct ldb_message *msg, const struct ldb_message *msg,
const char *attr_name) const char *attr_name)
{ {
const struct ldb_val *v; const struct ldb_val *v;

View File

@@ -1250,28 +1250,28 @@ int ldb_msg_element_compare(struct ldb_message_element *el1,
single valued. single valued.
*/ */
const struct ldb_val *ldb_msg_find_ldb_val(const struct ldb_message *msg, const char *attr_name); 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, int ldb_msg_find_attr_as_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,
const char *attr_name, const char *attr_name,
uint64_t default_value); int default_value);
double ldb_msg_find_double(const struct ldb_message *msg, unsigned int ldb_msg_find_attr_as_uint(const struct ldb_message *msg,
const char *attr_name, const char *attr_name,
double default_value); unsigned int default_value);
const char *ldb_msg_find_string(const struct ldb_message *msg, int64_t ldb_msg_find_attr_as_int64(const struct ldb_message *msg,
const char *attr_name, const char *attr_name,
const char *default_value); 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_dn(void *mem_ctx, struct ldb_dn *ldb_msg_find_attr_as_dn(void *mem_ctx,
const struct ldb_message *msg, const struct ldb_message *msg,
const char *attr_name); const char *attr_name);
void ldb_msg_sort_elements(struct ldb_message *msg); void ldb_msg_sort_elements(struct ldb_message *msg);

View File

@@ -455,7 +455,7 @@ static int ildb_search(struct ldb_module *module, struct ldb_request *req)
if (req->op.search.base == NULL) { if (req->op.search.base == NULL) {
if (ildb->rootDSE != NULL) { if (ildb->rootDSE != NULL) {
msg->r.SearchRequest.basedn = 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 { } else {
msg->r.SearchRequest.basedn = talloc_strdup(msg, ""); msg->r.SearchRequest.basedn = talloc_strdup(msg, "");
} }

View 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 /* if the current internal sequence number is the same as the one
in the database then assume the rest of the cache is OK */ 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) { if (seq == ltdb->sequence_number) {
goto done; goto done;
} }

View File

@@ -953,7 +953,7 @@ static int ltdb_sequence_number(struct ldb_module *module, struct ldb_request *r
return LDB_SUCCESS; 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); talloc_free(tmp_ctx);
return LDB_SUCCESS; return LDB_SUCCESS;
} }

View 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) 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; const struct ldb_val *val;
*name = talloc_strdup(mem_ctx, ldb_msg_find_string(msg, "value", NULL)); *name = talloc_strdup(mem_ctx, ldb_msg_find_attr_as_string(msg, "value", NULL));
*type = ldb_msg_find_uint(msg, "type", 0); *type = ldb_msg_find_attr_as_uint(msg, "type", 0);
val = ldb_msg_find_ldb_val(msg, "data"); val = ldb_msg_find_ldb_val(msg, "data");
switch (*type) switch (*type)

View 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 */ /* 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 */ /* Prepare a new message, for the modify */
msg = ldb_msg_new(tmp_ctx); msg = ldb_msg_new(tmp_ctx);

View File

@@ -52,7 +52,7 @@ uint64_t winsdb_get_maxVersion(struct winsdb_handle *h)
if (res->count > 1) goto failed; if (res->count > 1) goto failed;
if (res->count == 1) { 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: failed:
@@ -90,7 +90,7 @@ uint64_t winsdb_set_maxVersion(struct winsdb_handle *h, uint64_t newMaxVersion)
talloc_steal(tmp_ctx, res); talloc_steal(tmp_ctx, res);
if (res->count == 1) { 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) { 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) goto failed;
if (res->count == 1) { 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: 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 */ /* parse it into a more convenient winsdb_record structure */
rec->name = name; rec->name = name;
rec->type = ldb_msg_find_int(msg, "recordType", WREPL_TYPE_UNIQUE); rec->type = ldb_msg_find_attr_as_int(msg, "recordType", WREPL_TYPE_UNIQUE);
rec->state = ldb_msg_find_int(msg, "recordState", WREPL_STATE_RELEASED); rec->state = ldb_msg_find_attr_as_int(msg, "recordState", WREPL_STATE_RELEASED);
rec->node = ldb_msg_find_int(msg, "nodeType", WREPL_NODE_B); rec->node = ldb_msg_find_attr_as_int(msg, "nodeType", WREPL_NODE_B);
rec->is_static = ldb_msg_find_int(msg, "isStatic", 0); rec->is_static = ldb_msg_find_attr_as_int(msg, "isStatic", 0);
rec->expire_time = ldb_string_to_time(ldb_msg_find_string(msg, "expireTime", NULL)); rec->expire_time = ldb_string_to_time(ldb_msg_find_attr_as_string(msg, "expireTime", NULL));
rec->version = ldb_msg_find_uint64(msg, "versionID", 0); rec->version = ldb_msg_find_attr_as_uint64(msg, "versionID", 0);
rec->wins_owner = ldb_msg_find_string(msg, "winsOwner", NULL); rec->wins_owner = ldb_msg_find_attr_as_string(msg, "winsOwner", NULL);
rec->registered_by = ldb_msg_find_string(msg, "registeredBy", NULL); rec->registered_by = ldb_msg_find_attr_as_string(msg, "registeredBy", NULL);
talloc_steal(rec, rec->wins_owner); talloc_steal(rec, rec->wins_owner);
talloc_steal(rec, rec->registered_by); talloc_steal(rec, rec->registered_by);

View File

@@ -186,7 +186,7 @@ static NTSTATUS sldb_list_all(TALLOC_CTX *mem_ctx,
} }
for (i = 0, j = 0; i < res->count; i++) { 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]) { if (!n[j]) {
DEBUG(0,("WARNING: Malformed share object in share database\n!")); DEBUG(0,("WARNING: Malformed share object in share database\n!"));
continue; continue;
@@ -241,7 +241,7 @@ static NTSTATUS sldb_get_config(TALLOC_CTX *mem_ctx,
return NT_STATUS_NO_MEMORY; 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) { if (!s->name) {
DEBUG(0,("ERROR: Invalid share object!\n")); DEBUG(0,("ERROR: Invalid share object!\n"));
talloc_free(tmp_ctx); talloc_free(tmp_ctx);

View 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, ret = gendb_search(state->sam_ldb, mem_ctx, NULL, &res, attrs,
"objectSid=%s", ldap_encode_ndr_dom_sid(mem_ctx, sid)); "objectSid=%s", ldap_encode_ndr_dom_sid(mem_ctx, sid));
if (ret == 1) { 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) { if (!*name) {
*name = ldb_msg_find_string(res[0], "name", NULL); *name = ldb_msg_find_attr_as_string(res[0], "name", NULL);
if (!*name) { if (!*name) {
*name = talloc_strdup(mem_ctx, sid_str); *name = talloc_strdup(mem_ctx, sid_str);
NT_STATUS_HAVE_NO_MEMORY(*name); 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"); 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) { if (new_val) {
/* set value */ /* set value */
@@ -2237,7 +2237,7 @@ static NTSTATUS lsa_QuerySecret(struct dcesrv_call_state *dce_call, TALLOC_CTX *
if (!r->out.old_mtime) { if (!r->out.old_mtime) {
return NT_STATUS_NO_MEMORY; 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) { 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) { if (!r->out.new_mtime) {
return NT_STATUS_NO_MEMORY; 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; return NT_STATUS_OK;

View File

@@ -391,13 +391,13 @@ static NTSTATUS samr_OpenDomain(struct dcesrv_call_state *dce_call, TALLOC_CTX *
"(&(&(nETBIOSName=*)(objectclass=crossRef))(ncName=%s))", "(&(&(nETBIOSName=*)(objectclass=crossRef))(ncName=%s))",
ldb_dn_linearize(mem_ctx, dom_msgs[0]->dn)); ldb_dn_linearize(mem_ctx, dom_msgs[0]->dn));
if (ret == 0) { 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) { if (domain_name == NULL) {
return NT_STATUS_NO_SUCH_DOMAIN; return NT_STATUS_NO_SUCH_DOMAIN;
} }
} else if (ret == 1) { } 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) { if (domain_name == NULL) {
return NT_STATUS_NO_SUCH_DOMAIN; 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 ldb_message **dom_msgs,
struct samr_DomInfo2 *info) 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); 0x8000000000000000LL);
info->comment.string = samdb_result_string(dom_msgs[0], "comment", NULL); 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 */ /* FIXME: We should find the name of the real PDC emulator */
info->primary.string = lp_netbios_name(); 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); 0);
info->role = lp_server_role(); 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 ldb_message **dom_msgs,
struct samr_DomInfo3 *info) 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); 0x8000000000000000LL);
return NT_STATUS_OK; return NT_STATUS_OK;
@@ -566,10 +566,10 @@ static NTSTATUS samr_info_DomInfo8(struct samr_domain_state *state,
struct ldb_message **dom_msgs, struct ldb_message **dom_msgs,
struct samr_DomInfo8 *info) 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)); 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); 0x0LL);
return NT_STATUS_OK; return NT_STATUS_OK;
@@ -602,11 +602,11 @@ static NTSTATUS samr_info_DomInfo11(struct samr_domain_state *state,
return status; 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); -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); -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; return NT_STATUS_OK;
} }
@@ -619,11 +619,11 @@ static NTSTATUS samr_info_DomInfo12(struct samr_domain_state *state,
struct ldb_message **dom_msgs, struct ldb_message **dom_msgs,
struct samr_DomInfo12 *info) 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); -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); -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; return NT_STATUS_OK;
} }
@@ -636,10 +636,10 @@ static NTSTATUS samr_info_DomInfo13(struct samr_domain_state *state,
struct ldb_message **dom_msgs, struct ldb_message **dom_msgs,
struct samr_DomInfo13 *info) 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)); 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); 0x0LL);
info->unknown1 = 0; info->unknown1 = 0;

View File

@@ -129,13 +129,13 @@ static BOOL test_search_rootDSE(struct ldb_context *ldb, struct test_rootDSE *ro
msg = r->msgs[0]; 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); 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); 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); 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_steal(ldb, root->schemadn);
talloc_free(r); talloc_free(r);

View 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) goto failed;
if (res->count == 1) { 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: failed:
@@ -154,7 +154,7 @@ NTSTATUS wreplsrv_load_partners(struct wreplsrv_service *service)
for (i=0; i < res->count; i++) { for (i=0; i < res->count; i++) {
const char *address; 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) { if (!address) {
goto failed; goto failed;
} }
@@ -181,19 +181,19 @@ NTSTATUS wreplsrv_load_partners(struct wreplsrv_service *service)
DLIST_ADD_END(service->partners, partner, struct wreplsrv_partner *); 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); 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); talloc_steal(partner, partner->our_address);
partner->type = ldb_msg_find_uint(res->msgs[i], "type", WINSREPL_PARTNER_BOTH); partner->type = ldb_msg_find_attr_as_uint(res->msgs[i], "type", WINSREPL_PARTNER_BOTH);
partner->pull.interval = ldb_msg_find_uint(res->msgs[i], "pullInterval", partner->pull.interval = ldb_msg_find_attr_as_uint(res->msgs[i], "pullInterval",
WINSREPL_DEFAULT_PULL_INTERVAL); 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); 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); 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", DEBUG(3,("wreplsrv_load_partners: found partner: %s type: 0x%X\n",
partner->address, partner->type)); partner->address, partner->type));
@@ -381,8 +381,8 @@ static NTSTATUS wreplsrv_load_table(struct wreplsrv_service *service)
talloc_steal(tmp_ctx, res); talloc_steal(tmp_ctx, res);
for (i=0; i < res->count; i++) { for (i=0; i < res->count; i++) {
wins_owner = ldb_msg_find_string(res->msgs[i], "winsOwner", NULL); wins_owner = ldb_msg_find_attr_as_string(res->msgs[i], "winsOwner", NULL);
version = ldb_msg_find_uint64(res->msgs[i], "versionID", 0); version = ldb_msg_find_attr_as_uint64(res->msgs[i], "versionID", 0);
status = wreplsrv_add_table(service, status = wreplsrv_add_table(service,
service, &service->table, service, &service->table,