summaryrefslogtreecommitdiff
path: root/source4/dsdb/samdb
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2006-08-13 08:00:36 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:15:31 -0500
commita23b63a8e54db7d0ec98ad95cdca11dd4d039e17 (patch)
treeb5a38a7ca5dd1347097fe14b9f80df25fa3e4594 /source4/dsdb/samdb
parent8492a45f8a936943c9ddd0fd400871b78308a23d (diff)
downloadsamba-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/dsdb/samdb')
-rw-r--r--source4/dsdb/samdb/ldb_modules/password_hash.c22
-rw-r--r--source4/dsdb/samdb/ldb_modules/proxy.c14
-rw-r--r--source4/dsdb/samdb/ldb_modules/samba3sam.c4
-rw-r--r--source4/dsdb/samdb/ldb_modules/samldb.c2
-rw-r--r--source4/dsdb/samdb/samdb.c14
5 files changed, 28 insertions, 28 deletions
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;
}