summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source4/auth/sam.c20
-rw-r--r--source4/dsdb/common/util.c53
-rw-r--r--source4/dsdb/common/util_samr.c2
-rw-r--r--source4/dsdb/kcc/kcc_deleted.c2
-rw-r--r--source4/dsdb/kcc/kcc_topology.c38
-rw-r--r--source4/dsdb/samdb/cracknames.c14
-rw-r--r--source4/dsdb/samdb/ldb_modules/password_hash.c24
-rw-r--r--source4/dsdb/samdb/ldb_modules/samldb.c6
-rw-r--r--source4/dsdb/schema/schema_init.c6
-rw-r--r--source4/libnet/libnet_become_dc.c20
-rw-r--r--source4/libnet/libnet_unbecome_dc.c4
-rw-r--r--source4/ntptr/simple_ldb/ntptr_simple_ldb.c118
-rw-r--r--source4/rpc_server/drsuapi/dcesrv_drsuapi.c3
-rw-r--r--source4/rpc_server/drsuapi/getncchanges.c3
-rw-r--r--source4/rpc_server/lsa/dcesrv_lsa.c15
-rw-r--r--source4/rpc_server/lsa/lsa_lookup.c4
-rw-r--r--source4/rpc_server/netlogon/dcerpc_netlogon.c18
-rw-r--r--source4/rpc_server/samr/dcesrv_samr.c54
-rw-r--r--source4/torture/ldap/uptodatevector.c4
-rw-r--r--source4/utils/net/drs/net_drs_showrepl.c16
20 files changed, 199 insertions, 225 deletions
diff --git a/source4/auth/sam.c b/source4/auth/sam.c
index de794cc090..c83a7d478f 100644
--- a/source4/auth/sam.c
+++ b/source4/auth/sam.c
@@ -175,7 +175,7 @@ _PUBLIC_ NTSTATUS authsam_account_ok(TALLOC_CTX *mem_ctx,
must_change_time = samdb_result_force_password_change(sam_ctx, mem_ctx,
domain_dn, msg);
- workstation_list = samdb_result_string(msg, "userWorkstations", NULL);
+ workstation_list = ldb_msg_find_attr_as_string(msg, "userWorkstations", NULL);
/* Quit if the account was disabled. */
if (acct_flags & ACB_DISABLED) {
@@ -439,7 +439,7 @@ _PUBLIC_ NTSTATUS authsam_make_server_info(TALLOC_CTX *mem_ctx,
primary_group_sid = dom_sid_add_rid(server_info,
domain_sid,
- samdb_result_uint(msg, "primaryGroupID", ~0));
+ ldb_msg_find_attr_as_uint(msg, "primaryGroupID", ~0));
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(primary_group_sid, server_info);
/* Filter out builtin groups from this token. We will search
@@ -493,32 +493,32 @@ _PUBLIC_ NTSTATUS authsam_make_server_info(TALLOC_CTX *mem_ctx,
server_info->n_domain_groups = num_groupSIDs;
server_info->account_name = talloc_steal(server_info,
- samdb_result_string(msg, "sAMAccountName", NULL));
+ ldb_msg_find_attr_as_string(msg, "sAMAccountName", NULL));
server_info->domain_name = talloc_strdup(server_info, domain_name);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(server_info->domain_name,
server_info);
- str = samdb_result_string(msg, "displayName", "");
+ str = ldb_msg_find_attr_as_string(msg, "displayName", "");
server_info->full_name = talloc_strdup(server_info, str);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(server_info->full_name, server_info);
- str = samdb_result_string(msg, "scriptPath", "");
+ str = ldb_msg_find_attr_as_string(msg, "scriptPath", "");
server_info->logon_script = talloc_strdup(server_info, str);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(server_info->logon_script,
server_info);
- str = samdb_result_string(msg, "profilePath", "");
+ str = ldb_msg_find_attr_as_string(msg, "profilePath", "");
server_info->profile_path = talloc_strdup(server_info, str);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(server_info->profile_path,
server_info);
- str = samdb_result_string(msg, "homeDirectory", "");
+ str = ldb_msg_find_attr_as_string(msg, "homeDirectory", "");
server_info->home_directory = talloc_strdup(server_info, str);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(server_info->home_directory,
server_info);
- str = samdb_result_string(msg, "homeDrive", "");
+ str = ldb_msg_find_attr_as_string(msg, "homeDrive", "");
server_info->home_drive = talloc_strdup(server_info, str);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(server_info->home_drive, server_info);
@@ -537,8 +537,8 @@ _PUBLIC_ NTSTATUS authsam_make_server_info(TALLOC_CTX *mem_ctx,
server_info->force_password_change
= samdb_result_force_password_change(sam_ctx, mem_ctx,
domain_dn, msg);
- server_info->logon_count = samdb_result_uint(msg, "logonCount", 0);
- server_info->bad_password_count = samdb_result_uint(msg, "badPwdCount",
+ server_info->logon_count = ldb_msg_find_attr_as_uint(msg, "logonCount", 0);
+ server_info->bad_password_count = ldb_msg_find_attr_as_uint(msg, "badPwdCount",
0);
server_info->acct_flags = samdb_result_acct_flags(sam_ctx, mem_ctx,
diff --git a/source4/dsdb/common/util.c b/source4/dsdb/common/util.c
index 0a002197f5..1b732c2a33 100644
--- a/source4/dsdb/common/util.c
+++ b/source4/dsdb/common/util.c
@@ -111,7 +111,7 @@ const char *samdb_search_string_v(struct ldb_context *sam_ldb,
return NULL;
}
- return samdb_result_string(res[0], attr_name, NULL);
+ return ldb_msg_find_attr_as_string(res[0], attr_name, NULL);
}
/*
@@ -235,7 +235,7 @@ unsigned int samdb_search_uint(struct ldb_context *sam_ldb,
return default_value;
}
- return samdb_result_uint(res[0], attr_name, default_value);
+ return ldb_msg_find_attr_as_uint(res[0], attr_name, default_value);
}
/*
@@ -263,7 +263,7 @@ int64_t samdb_search_int64(struct ldb_context *sam_ldb,
return default_value;
}
- return samdb_result_int64(res[0], attr_name, default_value);
+ return ldb_msg_find_attr_as_int64(res[0], attr_name, default_value);
}
/*
@@ -309,38 +309,13 @@ int samdb_search_string_multiple(struct ldb_context *sam_ldb,
}
for (i=0;i<count;i++) {
- (*strs)[i] = samdb_result_string(res[i], attr_name, NULL);
+ (*strs)[i] = ldb_msg_find_attr_as_string(res[i], attr_name, NULL);
}
(*strs)[count] = NULL;
return count;
}
-/*
- pull a uint from a result set.
-*/
-unsigned int samdb_result_uint(const struct ldb_message *msg, const char *attr, unsigned int default_value)
-{
- return ldb_msg_find_attr_as_uint(msg, attr, default_value);
-}
-
-/*
- pull a (signed) int64 from a result set.
-*/
-int64_t samdb_result_int64(const struct ldb_message *msg, const char *attr, int64_t default_value)
-{
- return ldb_msg_find_attr_as_int64(msg, attr, default_value);
-}
-
-/*
- pull a string from a result set.
-*/
-const char *samdb_result_string(const struct ldb_message *msg, const char *attr,
- const char *default_value)
-{
- return ldb_msg_find_attr_as_string(msg, attr, default_value);
-}
-
struct ldb_dn *samdb_result_dn(struct ldb_context *ldb, TALLOC_CTX *mem_ctx, const struct ldb_message *msg,
const char *attr, struct ldb_dn *default_value)
{
@@ -477,16 +452,6 @@ NTTIME samdb_result_account_expires(const struct ldb_message *msg)
}
/*
- pull a uint64_t from a result set.
-*/
-uint64_t samdb_result_uint64(const struct ldb_message *msg, const char *attr,
- uint64_t default_value)
-{
- return ldb_msg_find_attr_as_uint64(msg, attr, default_value);
-}
-
-
-/*
construct the allow_password_change field from the PwdLastSet attribute and the
domain password settings
*/
@@ -496,7 +461,7 @@ NTTIME samdb_result_allow_password_change(struct ldb_context *sam_ldb,
struct ldb_message *msg,
const char *attr)
{
- uint64_t attr_time = samdb_result_uint64(msg, attr, 0);
+ uint64_t attr_time = ldb_msg_find_attr_as_uint64(msg, attr, 0);
int64_t minPwdAge;
if (attr_time == 0) {
@@ -521,7 +486,7 @@ NTTIME samdb_result_force_password_change(struct ldb_context *sam_ldb,
struct ldb_dn *domain_dn,
struct ldb_message *msg)
{
- int64_t attr_time = samdb_result_int64(msg, "pwdLastSet", 0);
+ int64_t attr_time = ldb_msg_find_attr_as_int64(msg, "pwdLastSet", 0);
uint32_t userAccountControl = ldb_msg_find_attr_as_uint(msg,
"userAccountControl",
0);
@@ -3024,7 +2989,7 @@ int samdb_ntds_options(struct ldb_context *ldb, uint32_t *options)
goto failed;
}
- *options = samdb_result_uint(res->msgs[0], "options", 0);
+ *options = ldb_msg_find_attr_as_uint(res->msgs[0], "options", 0);
talloc_free(tmp_ctx);
@@ -3051,7 +3016,7 @@ const char* samdb_ntds_object_category(TALLOC_CTX *tmp_ctx, struct ldb_context *
goto failed;
}
- return samdb_result_string(res->msgs[0], "objectCategory", NULL);
+ return ldb_msg_find_attr_as_string(res->msgs[0], "objectCategory", NULL);
failed:
DEBUG(1,("Failed to find our own NTDS Settings objectCategory in the ldb!\n"));
@@ -4204,7 +4169,7 @@ const char *samdb_dn_to_dnshostname(struct ldb_context *ldb,
return NULL;
}
- return samdb_result_string(res->msgs[0], "dNSHostName", NULL);
+ return ldb_msg_find_attr_as_string(res->msgs[0], "dNSHostName", NULL);
}
/*
diff --git a/source4/dsdb/common/util_samr.c b/source4/dsdb/common/util_samr.c
index c50b33c58a..72d42cbf8e 100644
--- a/source4/dsdb/common/util_samr.c
+++ b/source4/dsdb/common/util_samr.c
@@ -196,7 +196,7 @@ NTSTATUS dsdb_add_user(struct ldb_context *ldb,
/* Change the account control to be the correct account type.
* The default is for a workstation account */
- user_account_control = samdb_result_uint(msg, "userAccountControl", 0);
+ user_account_control = ldb_msg_find_attr_as_uint(msg, "userAccountControl", 0);
user_account_control = (user_account_control &
~(UF_NORMAL_ACCOUNT |
UF_INTERDOMAIN_TRUST_ACCOUNT |
diff --git a/source4/dsdb/kcc/kcc_deleted.c b/source4/dsdb/kcc/kcc_deleted.c
index 1726fa4f31..3ff4a0a3fd 100644
--- a/source4/dsdb/kcc/kcc_deleted.c
+++ b/source4/dsdb/kcc/kcc_deleted.c
@@ -84,7 +84,7 @@ NTSTATUS kccsrv_check_deleted(struct kccsrv_service *s, TALLOC_CTX *mem_ctx)
const char *tstring;
time_t whenChanged = 0;
- tstring = samdb_result_string(res->msgs[i], "whenChanged", NULL);
+ tstring = ldb_msg_find_attr_as_string(res->msgs[i], "whenChanged", NULL);
if (tstring) {
whenChanged = ldb_string_to_time(tstring);
}
diff --git a/source4/dsdb/kcc/kcc_topology.c b/source4/dsdb/kcc/kcc_topology.c
index 94ed7a81a1..51c09fd62f 100644
--- a/source4/dsdb/kcc/kcc_topology.c
+++ b/source4/dsdb/kcc/kcc_topology.c
@@ -262,8 +262,8 @@ static int kcctpl_sort_bridgeheads(const void *bridgehead1,
bh1 = (const struct ldb_message *) bridgehead1;
bh2 = (const struct ldb_message *) bridgehead2;
- bh1_opts = samdb_result_int64(bh1, "options", 0);
- bh2_opts = samdb_result_int64(bh2, "options", 0);
+ bh1_opts = ldb_msg_find_attr_as_int64(bh1, "options", 0);
+ bh2_opts = ldb_msg_find_attr_as_int64(bh2, "options", 0);
cmp_gc = (bh1_opts & NTDSDSA_OPT_IS_GC) -
(bh2_opts & NTDSDSA_OPT_IS_GC);
@@ -618,9 +618,9 @@ static NTSTATUS kcctpl_create_edge(struct ldb_context *ldb, TALLOC_CTX *mem_ctx,
edge->vertex_ids.data[i] = guid;
}
- edge->repl_info.cost = samdb_result_int64(site_link, "cost", 0);
- edge->repl_info.options = samdb_result_int64(site_link, "options", 0);
- edge->repl_info.interval = samdb_result_int64(site_link,
+ edge->repl_info.cost = ldb_msg_find_attr_as_int64(site_link, "cost", 0);
+ edge->repl_info.options = ldb_msg_find_attr_as_int64(site_link, "options", 0);
+ edge->repl_info.interval = ldb_msg_find_attr_as_int64(site_link,
"replInterval", 0);
/* TODO: edge->repl_info.schedule = site_link!schedule */
edge->type = type;
@@ -850,7 +850,7 @@ static NTSTATUS kcctpl_setup_graph(struct ldb_context *ldb, TALLOC_CTX *mem_ctx,
talloc_free(tmp_ctx);
return NT_STATUS_INTERNAL_DB_CORRUPTION;
}
- site_opts = samdb_result_int64(site, "options", 0);
+ site_opts = ldb_msg_find_attr_as_int64(site, "options", 0);
transports_dn = kcctpl_transports_dn(ldb, tmp_ctx);
if (!transports_dn) {
@@ -918,7 +918,7 @@ static NTSTATUS kcctpl_setup_graph(struct ldb_context *ldb, TALLOC_CTX *mem_ctx,
graph->edges.count++;
}
- transport_opts = samdb_result_int64(transport, "options", 0);
+ transport_opts = ldb_msg_find_attr_as_int64(transport, "options", 0);
if (!(transport_opts & NTDSTRANSPORT_OPT_BRIDGES_REQUIRED) &&
!(site_opts & NTDSSETTINGS_OPT_W2K3_BRIDGES_REQUIRED)) {
struct kcctpl_multi_edge_set *edge_set, *new_data;
@@ -1040,7 +1040,7 @@ static NTSTATUS kcctpl_bridgehead_dc_failed(struct ldb_context *ldb,
settings = res->msgs[0];
- settings_opts = samdb_result_int64(settings, "options", 0);
+ settings_opts = ldb_msg_find_attr_as_int64(settings, "options", 0);
if (settings_opts & NTDSSETTINGS_OPT_IS_TOPL_DETECT_STALE_DISABLED) {
failed = false;
} else if (true) { /* TODO: how to get kCCFailedLinks and
@@ -1155,7 +1155,7 @@ static NTSTATUS kcctpl_get_all_bridgehead_dcs(struct kccsrv_service *service,
el = ldb_msg_find_element(transport, "bridgeheadServerListBL");
- transport_name = samdb_result_string(transport, "name", NULL);
+ transport_name = ldb_msg_find_attr_as_string(transport, "name", NULL);
if (!transport_name) {
DEBUG(1, (__location__ ": failed to find name attribute of "
"object %s\n", ldb_dn_get_linearized(transport->dn)));
@@ -1164,7 +1164,7 @@ static NTSTATUS kcctpl_get_all_bridgehead_dcs(struct kccsrv_service *service,
return NT_STATUS_INTERNAL_DB_CORRUPTION;
}
- transport_address_attr = samdb_result_string(transport,
+ transport_address_attr = ldb_msg_find_attr_as_string(transport,
"transportAddressAttribute",
NULL);
if (!transport_address_attr) {
@@ -1176,7 +1176,7 @@ static NTSTATUS kcctpl_get_all_bridgehead_dcs(struct kccsrv_service *service,
return NT_STATUS_INTERNAL_DB_CORRUPTION;
}
- site_opts = samdb_result_int64(site, "options", 0);
+ site_opts = ldb_msg_find_attr_as_int64(site, "options", 0);
for (i = 0; i < res->count; i++) {
struct ldb_message *dc, *new_data;
@@ -1252,7 +1252,7 @@ static NTSTATUS kcctpl_get_all_bridgehead_dcs(struct kccsrv_service *service,
}
}
- behavior_version = samdb_result_int64(dc,
+ behavior_version = ldb_msg_find_attr_as_int64(dc,
"msDS-Behavior-Version", 0);
/* TODO: cr!nCName corresponds to default NC */
if (service->am_rodc && true && behavior_version < DS_BEHAVIOR_WIN2008) {
@@ -1262,7 +1262,7 @@ static NTSTATUS kcctpl_get_all_bridgehead_dcs(struct kccsrv_service *service,
ret = ldb_search(service->samdb, tmp_ctx, &parent_res, parent_dn,
LDB_SCOPE_BASE, parent_attrs , NULL);
- dc_transport_address = samdb_result_string(parent_res->msgs[0],
+ dc_transport_address = ldb_msg_find_attr_as_string(parent_res->msgs[0],
transport_address_attr,
NULL);
@@ -1444,7 +1444,7 @@ static NTSTATUS kcctpl_color_vertices(struct kccsrv_service *service,
partial_replica_okay = (site_vertex->color == BLACK);
- cr_flags = samdb_result_int64(cross_ref, "systemFlags", 0);
+ cr_flags = ldb_msg_find_attr_as_int64(cross_ref, "systemFlags", 0);
for (i = 0; i < graph->vertices.count; i++) {
struct kcctpl_vertex *vertex;
@@ -1486,7 +1486,7 @@ static NTSTATUS kcctpl_color_vertices(struct kccsrv_service *service,
transport = res->msgs[j];
- transport_name = samdb_result_string(transport,
+ transport_name = ldb_msg_find_attr_as_string(transport,
"name", NULL);
if (!transport_name) {
DEBUG(1, (__location__ ": failed to find name "
@@ -2873,7 +2873,7 @@ static NTSTATUS kcctpl_create_connection(struct kccsrv_service *service,
uint8_t conn_schedule[84];
struct ldb_dn *conn_transport_type;
- conn_opts = samdb_result_int64(connection,
+ conn_opts = ldb_msg_find_attr_as_int64(connection,
"options", 0);
conn_transport_type = samdb_result_dn(service->samdb, tmp_ctx,
@@ -2984,7 +2984,7 @@ static NTSTATUS kcctpl_create_connection(struct kccsrv_service *service,
uint64_t conn_opts;
struct ldb_dn *conn_transport_type;
- conn_opts = samdb_result_int64(connection,
+ conn_opts = ldb_msg_find_attr_as_int64(connection,
"options", 0);
conn_transport_type = samdb_result_dn(service->samdb, tmp_ctx,
@@ -3396,8 +3396,8 @@ static NTSTATUS kcctpl_create_intersite_connections(struct kccsrv_service *servi
NTSTATUS status;
cross_ref = res->msgs[i];
- cr_enabled = samdb_result_uint(cross_ref, "enabled", -1);
- cr_flags = samdb_result_int64(cross_ref, "systemFlags", 0);
+ cr_enabled = ldb_msg_find_attr_as_uint(cross_ref, "enabled", -1);
+ cr_flags = ldb_msg_find_attr_as_int64(cross_ref, "systemFlags", 0);
if ((cr_enabled == 0) || !(cr_flags & FLAG_CR_NTDS_NC)) {
continue;
}
diff --git a/source4/dsdb/samdb/cracknames.c b/source4/dsdb/samdb/cracknames.c
index 3fac49fe54..6df140fed3 100644
--- a/source4/dsdb/samdb/cracknames.c
+++ b/source4/dsdb/samdb/cracknames.c
@@ -811,7 +811,7 @@ static WERROR DsCrackNameOneFilter(struct ldb_context *sam_ctx, TALLOC_CTX *mem_
return WERR_OK;
}
- info1->dns_domain_name = samdb_result_string(domain_res->msgs[0], "dnsRoot", NULL);
+ info1->dns_domain_name = ldb_msg_find_attr_as_string(domain_res->msgs[0], "dnsRoot", NULL);
W_ERROR_HAVE_NO_MEMORY(info1->dns_domain_name);
info1->status = DRSUAPI_DS_NAME_STATUS_DOMAIN_ONLY;
} else {
@@ -939,7 +939,7 @@ static WERROR DsCrackNameOneFilter(struct ldb_context *sam_ctx, TALLOC_CTX *mem_
return WERR_OK;
}
case DRSUAPI_DS_NAME_FORMAT_CANONICAL: {
- info1->result_name = samdb_result_string(result, "canonicalName", NULL);
+ info1->result_name = ldb_msg_find_attr_as_string(result, "canonicalName", NULL);
info1->status = DRSUAPI_DS_NAME_STATUS_OK;
return WERR_OK;
}
@@ -979,10 +979,10 @@ static WERROR DsCrackNameOneFilter(struct ldb_context *sam_ctx, TALLOC_CTX *mem_
info1->status = DRSUAPI_DS_NAME_STATUS_NOT_UNIQUE;
return WERR_OK;
}
- _dom = samdb_result_string(domain_res->msgs[0], "nETBIOSName", NULL);
+ _dom = ldb_msg_find_attr_as_string(domain_res->msgs[0], "nETBIOSName", NULL);
W_ERROR_HAVE_NO_MEMORY(_dom);
} else {
- _acc = samdb_result_string(result, "sAMAccountName", NULL);
+ _acc = ldb_msg_find_attr_as_string(result, "sAMAccountName", NULL);
if (!_acc) {
info1->status = DRSUAPI_DS_NAME_STATUS_NO_MAPPING;
return WERR_OK;
@@ -1043,7 +1043,7 @@ static WERROR DsCrackNameOneFilter(struct ldb_context *sam_ctx, TALLOC_CTX *mem_
info1->status = DRSUAPI_DS_NAME_STATUS_NOT_UNIQUE;
return WERR_OK;
}
- _dom = samdb_result_string(domain_res2->msgs[0], "nETBIOSName", NULL);
+ _dom = ldb_msg_find_attr_as_string(domain_res2->msgs[0], "nETBIOSName", NULL);
W_ERROR_HAVE_NO_MEMORY(_dom);
}
}
@@ -1066,9 +1066,9 @@ static WERROR DsCrackNameOneFilter(struct ldb_context *sam_ctx, TALLOC_CTX *mem_
return WERR_OK;
}
case DRSUAPI_DS_NAME_FORMAT_DISPLAY: {
- info1->result_name = samdb_result_string(result, "displayName", NULL);
+ info1->result_name = ldb_msg_find_attr_as_string(result, "displayName", NULL);
if (!info1->result_name) {
- info1->result_name = samdb_result_string(result, "sAMAccountName", NULL);
+ info1->result_name = ldb_msg_find_attr_as_string(result, "sAMAccountName", NULL);
}
if (!info1->result_name) {
info1->status = DRSUAPI_DS_NAME_STATUS_NOT_FOUND;
diff --git a/source4/dsdb/samdb/ldb_modules/password_hash.c b/source4/dsdb/samdb/ldb_modules/password_hash.c
index 488b8b7d33..c9748af698 100644
--- a/source4/dsdb/samdb/ldb_modules/password_hash.c
+++ b/source4/dsdb/samdb/ldb_modules/password_hash.c
@@ -1658,10 +1658,13 @@ static int setup_io(struct ph_context *ac,
io->ac = ac;
- io->u.userAccountControl = samdb_result_uint(searched_msg, "userAccountControl", 0);
+ io->u.userAccountControl = ldb_msg_find_attr_as_uint(searched_msg,
+ "userAccountControl", 0);
io->u.pwdLastSet = samdb_result_nttime(searched_msg, "pwdLastSet", 0);
- io->u.sAMAccountName = samdb_result_string(searched_msg, "sAMAccountName", NULL);
- io->u.user_principal_name = samdb_result_string(searched_msg, "userPrincipalName", NULL);
+ io->u.sAMAccountName = ldb_msg_find_attr_as_string(searched_msg,
+ "sAMAccountName", NULL);
+ io->u.user_principal_name = ldb_msg_find_attr_as_string(searched_msg,
+ "userPrincipalName", NULL);
io->u.is_computer = ldb_msg_check_string_attribute(searched_msg, "objectClass", "computer");
if (io->u.sAMAccountName == NULL) {
@@ -2091,11 +2094,16 @@ static int get_domain_data_callback(struct ldb_request *req,
}
/* Setup the "domain data" structure */
- ac->status->domain_data.pwdProperties = samdb_result_uint(ares->message, "pwdProperties", -1);
- ac->status->domain_data.pwdHistoryLength = samdb_result_uint(ares->message, "pwdHistoryLength", -1);
- ac->status->domain_data.maxPwdAge = samdb_result_int64(ares->message, "maxPwdAge", -1);
- ac->status->domain_data.minPwdAge = samdb_result_int64(ares->message, "minPwdAge", -1);
- ac->status->domain_data.minPwdLength = samdb_result_uint(ares->message, "minPwdLength", -1);
+ ac->status->domain_data.pwdProperties =
+ ldb_msg_find_attr_as_uint(ares->message, "pwdProperties", -1);
+ ac->status->domain_data.pwdHistoryLength =
+ ldb_msg_find_attr_as_uint(ares->message, "pwdHistoryLength", -1);
+ ac->status->domain_data.maxPwdAge =
+ ldb_msg_find_attr_as_int64(ares->message, "maxPwdAge", -1);
+ ac->status->domain_data.minPwdAge =
+ ldb_msg_find_attr_as_int64(ares->message, "minPwdAge", -1);
+ ac->status->domain_data.minPwdLength =
+ ldb_msg_find_attr_as_uint(ares->message, "minPwdLength", -1);
ac->status->domain_data.store_cleartext =
ac->status->domain_data.pwdProperties & DOMAIN_PASSWORD_STORE_CLEARTEXT;
diff --git a/source4/dsdb/samdb/ldb_modules/samldb.c b/source4/dsdb/samdb/ldb_modules/samldb.c
index 385be493b3..3f1dd49072 100644
--- a/source4/dsdb/samdb/ldb_modules/samldb.c
+++ b/source4/dsdb/samdb/ldb_modules/samldb.c
@@ -950,7 +950,7 @@ static int samldb_prim_group_set(struct samldb_ctx *ac)
uint32_t rid;
struct dom_sid *sid;
- rid = samdb_result_uint(ac->msg, "primaryGroupID", (uint32_t) -1);
+ rid = ldb_msg_find_attr_as_uint(ac->msg, "primaryGroupID", (uint32_t) -1);
if (rid == (uint32_t) -1) {
/* we aren't affected of any primary group set */
return LDB_SUCCESS;
@@ -1000,7 +1000,7 @@ static int samldb_prim_group_change(struct samldb_ctx *ac)
/* Finds out the DN of the old primary group */
- rid = samdb_result_uint(res->msgs[0], "primaryGroupID", (uint32_t) -1);
+ rid = ldb_msg_find_attr_as_uint(res->msgs[0], "primaryGroupID", (uint32_t) -1);
if (rid == (uint32_t) -1) {
/* User objects do always have a mandatory "primaryGroupID"
* attribute. If this doesn't exist then the object is of the
@@ -1021,7 +1021,7 @@ static int samldb_prim_group_change(struct samldb_ctx *ac)
/* Finds out the DN of the new primary group */
- rid = samdb_result_uint(ac->msg, "primaryGroupID", (uint32_t) -1);
+ rid = ldb_msg_find_attr_as_uint(ac->msg, "primaryGroupID", (uint32_t) -1);
if (rid == (uint32_t) -1) {
/* we aren't affected of any primary group change */
return LDB_SUCCESS;
diff --git a/source4/dsdb/schema/schema_init.c b/source4/dsdb/schema/schema_init.c
index ba12f523e8..54fc6b840b 100644
--- a/source4/dsdb/schema/schema_init.c
+++ b/source4/dsdb/schema/schema_init.c
@@ -493,7 +493,7 @@ static int dsdb_schema_setup_ldb_schema_attribute(struct ldb_context *ldb,
#define GET_BOOL_LDB(msg, attr, p, elem, strict) do { \
const char *str; \
- str = samdb_result_string(msg, attr, NULL);\
+ str = ldb_msg_find_attr_as_string(msg, attr, NULL);\
if (str == NULL) { \
if (strict) { \
d_printf("%s: %s == NULL\n", __location__, attr); \
@@ -512,11 +512,11 @@ static int dsdb_schema_setup_ldb_schema_attribute(struct ldb_context *ldb,
} while (0)
#define GET_UINT32_LDB(msg, attr, p, elem) do { \
- (p)->elem = samdb_result_uint(msg, attr, 0);\
+ (p)->elem = ldb_msg_find_attr_as_uint(msg, attr, 0);\
} while (0)
#define GET_UINT32_PTR_LDB(msg, attr, mem_ctx, p, elem) do { \
- uint64_t _v = samdb_result_uint64(msg, attr, UINT64_MAX);\
+ uint64_t _v = ldb_msg_find_attr_as_uint64(msg, attr, UINT64_MAX);\
if (_v == UINT64_MAX) { \
(p)->elem = NULL; \
} else if (_v > UINT32_MAX) { \
diff --git a/source4/libnet/libnet_become_dc.c b/source4/libnet/libnet_become_dc.c
index fc7faa4948..9da2515134 100644
--- a/source4/libnet/libnet_become_dc.c
+++ b/source4/libnet/libnet_become_dc.c
@@ -1073,7 +1073,7 @@ static NTSTATUS becomeDC_ldap1_infrastructure_fsmo(struct libnet_BecomeDC_state
return NT_STATUS_INVALID_NETWORK_RESPONSE;
}
- s->infrastructure_fsmo.dns_name = samdb_result_string(r->msgs[0], "dnsHostName", NULL);
+ s->infrastructure_fsmo.dns_name = ldb_msg_find_attr_as_string(r->msgs[0], "dnsHostName", NULL);
if (!s->infrastructure_fsmo.dns_name) return NT_STATUS_INVALID_NETWORK_RESPONSE;
talloc_steal(s, s->infrastructure_fsmo.dns_name);
@@ -1133,7 +1133,7 @@ static NTSTATUS becomeDC_ldap1_rid_manager_fsmo(struct libnet_BecomeDC_state *s)
return NT_STATUS_INVALID_NETWORK_RESPONSE;
}
- reference_dn_str = samdb_result_string(r->msgs[0], "rIDManagerReference", NULL);
+ reference_dn_str = ldb_msg_find_attr_as_string(r->msgs[0], "rIDManagerReference", NULL);
if (!reference_dn_str) return NT_STATUS_INVALID_NETWORK_RESPONSE;
basedn = ldb_dn_new(s, s->ldap1.ldb, reference_dn_str);
@@ -1151,7 +1151,7 @@ static NTSTATUS becomeDC_ldap1_rid_manager_fsmo(struct libnet_BecomeDC_state *s)
return NT_STATUS_INVALID_NETWORK_RESPONSE;
}
- s->rid_manager_fsmo.ntds_dn_str = samdb_result_string(r->msgs[0], "fSMORoleOwner", NULL);
+ s->rid_manager_fsmo.ntds_dn_str = ldb_msg_find_attr_as_string(r->msgs[0], "fSMORoleOwner", NULL);
if (!s->rid_manager_fsmo.ntds_dn_str) return NT_STATUS_INVALID_NETWORK_RESPONSE;
talloc_steal(s, s->rid_manager_fsmo.ntds_dn_str);
@@ -1175,7 +1175,7 @@ static NTSTATUS becomeDC_ldap1_rid_manager_fsmo(struct libnet_BecomeDC_state *s)
return NT_STATUS_INVALID_NETWORK_RESPONSE;
}
- s->rid_manager_fsmo.dns_name = samdb_result_string(r->msgs[0], "dnsHostName", NULL);
+ s->rid_manager_fsmo.dns_name = ldb_msg_find_attr_as_string(r->msgs[0], "dnsHostName", NULL);
if (!s->rid_manager_fsmo.dns_name) return NT_STATUS_INVALID_NETWORK_RESPONSE;
talloc_steal(s, s->rid_manager_fsmo.dns_name);
@@ -1260,11 +1260,11 @@ static NTSTATUS becomeDC_ldap1_computer_object(struct libnet_BecomeDC_state *s)
return NT_STATUS_INVALID_NETWORK_RESPONSE;
}
- s->dest_dsa.computer_dn_str = samdb_result_string(r->msgs[0], "distinguishedName", NULL);
+ s->dest_dsa.computer_dn_str = ldb_msg_find_attr_as_string(r->msgs[0], "distinguishedName", NULL);
if (!s->dest_dsa.computer_dn_str) return NT_STATUS_INVALID_NETWORK_RESPONSE;
talloc_steal(s, s->dest_dsa.computer_dn_str);
- s->dest_dsa.user_account_control = samdb_result_uint(r->msgs[0], "userAccountControl", 0);
+ s->dest_dsa.user_account_control = ldb_msg_find_attr_as_uint(r->msgs[0], "userAccountControl", 0);
talloc_free(r);
return NT_STATUS_OK;
@@ -1298,7 +1298,7 @@ static NTSTATUS becomeDC_ldap1_server_object_1(struct libnet_BecomeDC_state *s)
return NT_STATUS_INVALID_NETWORK_RESPONSE;
}
- server_reference_dn_str = samdb_result_string(r->msgs[0], "serverReference", NULL);
+ server_reference_dn_str = ldb_msg_find_attr_as_string(r->msgs[0], "serverReference", NULL);
if (server_reference_dn_str) {
server_reference_dn = ldb_dn_new(r, s->ldap1.ldb, server_reference_dn_str);
NT_STATUS_HAVE_NO_MEMORY(server_reference_dn);
@@ -1317,7 +1317,7 @@ static NTSTATUS becomeDC_ldap1_server_object_1(struct libnet_BecomeDC_state *s)
}
/* if the server object is already for the dest_dsa, then we don't need to create it */
- s->dest_dsa.server_dn_str = samdb_result_string(r->msgs[0], "distinguishedName", NULL);
+ s->dest_dsa.server_dn_str = ldb_msg_find_attr_as_string(r->msgs[0], "distinguishedName", NULL);
if (!s->dest_dsa.server_dn_str) return NT_STATUS_INVALID_NETWORK_RESPONSE;
talloc_steal(s, s->dest_dsa.server_dn_str);
@@ -1352,7 +1352,7 @@ static NTSTATUS becomeDC_ldap1_server_object_2(struct libnet_BecomeDC_state *s)
return NT_STATUS_INVALID_NETWORK_RESPONSE;
}
- server_reference_bl_dn_str = samdb_result_string(r->msgs[0], "serverReferenceBL", NULL);
+ server_reference_bl_dn_str = ldb_msg_find_attr_as_string(r->msgs[0], "serverReferenceBL", NULL);
if (!server_reference_bl_dn_str) {
/* if no back link is present, we're done for this function */
talloc_free(r);
@@ -1360,7 +1360,7 @@ static NTSTATUS becomeDC_ldap1_server_object_2(struct libnet_BecomeDC_state *s)
}
/* if the server object is already for the dest_dsa, then we don't need to create it */
- s->dest_dsa.server_dn_str = samdb_result_string(r->msgs[0], "serverReferenceBL", NULL);
+ s->dest_dsa.server_dn_str = ldb_msg_find_attr_as_string(r->msgs[0], "serverReferenceBL", NULL);
if (s->dest_dsa.server_dn_str) {
/* if a back link is present, we know that the server object is present */
talloc_steal(s, s->dest_dsa.server_dn_str);
diff --git a/source4/libnet/libnet_unbecome_dc.c b/source4/libnet/libnet_unbecome_dc.c
index cf0142da86..d66c4be093 100644
--- a/source4/libnet/libnet_unbecome_dc.c
+++ b/source4/libnet/libnet_unbecome_dc.c
@@ -403,11 +403,11 @@ static NTSTATUS unbecomeDC_ldap_computer_object(struct libnet_UnbecomeDC_state *
return NT_STATUS_INVALID_NETWORK_RESPONSE;
}
- s->dest_dsa.computer_dn_str = samdb_result_string(r->msgs[0], "distinguishedName", NULL);
+ s->dest_dsa.computer_dn_str = ldb_msg_find_attr_as_string(r->msgs[0], "distinguishedName", NULL);
if (!s->dest_dsa.computer_dn_str) return NT_STATUS_INVALID_NETWORK_RESPONSE;
talloc_steal(s, s->dest_dsa.computer_dn_str);
- s->dest_dsa.user_account_control = samdb_result_uint(r->msgs[0], "userAccountControl", 0);
+ s->dest_dsa.user_account_control = ldb_msg_find_attr_as_uint(r->msgs[0], "userAccountControl", 0);
talloc_free(r);
return NT_STATUS_OK;
diff --git a/source4/ntptr/simple_ldb/ntptr_simple_ldb.c b/source4/ntptr/simple_ldb/ntptr_simple_ldb.c
index 7197af8bfc..755c1baa7e 100644
--- a/source4/ntptr/simple_ldb/ntptr_simple_ldb.c
+++ b/source4/ntptr/simple_ldb/ntptr_simple_ldb.c
@@ -278,18 +278,18 @@ static WERROR sptr_EnumPrintServerForms(struct ntptr_GenericHandle *server, TALL
switch (r->in.level) {
case 1:
for (i=0; i < count; i++) {
- info[i].info1.flags = samdb_result_uint(msgs[i], "flags", SPOOLSS_FORM_BUILTIN);
+ info[i].info1.flags = ldb_msg_find_attr_as_uint(msgs[i], "flags", SPOOLSS_FORM_BUILTIN);
- info[i].info1.form_name = samdb_result_string(msgs[i], "form-name", NULL);
+ info[i].info1.form_name = ldb_msg_find_attr_as_string(msgs[i], "form-name", NULL);
W_ERROR_HAVE_NO_MEMORY(info[i].info1.form_name);
- info[i].info1.size.width = samdb_result_uint(msgs[i], "size-width", 0);
- info[i].info1.size.height = samdb_result_uint(msgs[i], "size-height", 0);
+ info[i].info1.size.width = ldb_msg_find_attr_as_uint(msgs[i], "size-width", 0);
+ info[i].info1.size.height = ldb_msg_find_attr_as_uint(msgs[i], "size-height", 0);
- info[i].info1.area.left = samdb_result_uint(msgs[i], "area-left", 0);
- info[i].info1.area.top = samdb_result_uint(msgs[i], "area-top", 0);
- info[i].info1.area.right = samdb_result_uint(msgs[i], "area-right", 0);
- info[i].info1.area.bottom = samdb_result_uint(msgs[i], "area-bottom", 0);
+ info[i].info1.area.left = ldb_msg_find_attr_as_uint(msgs[i], "area-left", 0);
+ info[i].info1.area.top = ldb_msg_find_attr_as_uint(msgs[i], "area-top", 0);
+ info[i].info1.area.right = ldb_msg_find_attr_as_uint(msgs[i], "area-right", 0);
+ info[i].info1.area.bottom = ldb_msg_find_attr_as_uint(msgs[i], "area-bottom", 0);
}
break;
default:
@@ -394,7 +394,7 @@ static WERROR sptr_SetPrintServerForm(struct ntptr_GenericHandle *server, TALLOC
if (count > 1) return WERR_FOOBAR;
if (count < 0) return WERR_GENERAL_FAILURE;
- flags = samdb_result_uint(msgs[0], "flags", SPOOLSS_FORM_BUILTIN);
+ flags = ldb_msg_find_attr_as_uint(msgs[0], "flags", SPOOLSS_FORM_BUILTIN);
if (flags != SPOOLSS_FORM_USER) {
return WERR_FOOBAR;
}
@@ -457,7 +457,7 @@ static WERROR sptr_DeletePrintServerForm(struct ntptr_GenericHandle *server, TAL
if (count > 1) return WERR_FOOBAR;
if (count < 0) return WERR_GENERAL_FAILURE;
- flags = samdb_result_uint(msgs[0], "flags", SPOOLSS_FORM_BUILTIN);
+ flags = ldb_msg_find_attr_as_uint(msgs[0], "flags", SPOOLSS_FORM_BUILTIN);
if (flags != SPOOLSS_FORM_USER) {
return WERR_FOOBAR;
}
@@ -540,84 +540,84 @@ static WERROR sptr_EnumPrinters(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx
switch(r->in.level) {
case 1:
for (i = 0; i < count; i++) {
- info[i].info1.flags = samdb_result_uint(msgs[i], "flags", 0);
+ info[i].info1.flags = ldb_msg_find_attr_as_uint(msgs[i], "flags", 0);
- info[i].info1.name = samdb_result_string(msgs[i], "name", "");
+ info[i].info1.name = ldb_msg_find_attr_as_string(msgs[i], "name", "");
W_ERROR_HAVE_NO_MEMORY(info[i].info1.name);
- info[i].info1.description = samdb_result_string(msgs[i], "description", "");
+ info[i].info1.description = ldb_msg_find_attr_as_string(msgs[i], "description", "");
W_ERROR_HAVE_NO_MEMORY(info[i].info1.description);
- info[i].info1.comment = samdb_result_string(msgs[i], "comment", NULL);
+ info[i].info1.comment = ldb_msg_find_attr_as_string(msgs[i], "comment", NULL);
}
break;
case 2:
for (i = 0; i < count; i++) {
- info[i].info2.servername = samdb_result_string(msgs[i], "servername", "");
+ info[i].info2.servername = ldb_msg_find_attr_as_string(msgs[i], "servername", "");
W_ERROR_HAVE_NO_MEMORY(info[i].info2.servername);
- info[i].info2.printername = samdb_result_string(msgs[i], "printername", "");
+ info[i].info2.printername = ldb_msg_find_attr_as_string(msgs[i], "printername", "");
W_ERROR_HAVE_NO_MEMORY(info[i].info2.printername);
- info[i].info2.sharename = samdb_result_string(msgs[i], "sharename", "");
+ info[i].info2.sharename = ldb_msg_find_attr_as_string(msgs[i], "sharename", "");
W_ERROR_HAVE_NO_MEMORY(info[i].info2.sharename);
- info[i].info2.portname = samdb_result_string(msgs[i], "portname", "");
+ info[i].info2.portname = ldb_msg_find_attr_as_string(msgs[i], "portname", "");
W_ERROR_HAVE_NO_MEMORY(info[i].info2.portname);
- info[i].info2.drivername = samdb_result_string(msgs[i], "drivername", "");
+ info[i].info2.drivername = ldb_msg_find_attr_as_string(msgs[i], "drivername", "");
W_ERROR_HAVE_NO_MEMORY(info[i].info2.drivername);
- info[i].info2.comment = samdb_result_string(msgs[i], "comment", NULL);
+ info[i].info2.comment = ldb_msg_find_attr_as_string(msgs[i], "comment", NULL);
- info[i].info2.location = samdb_result_string(msgs[i], "location", NULL);
+ info[i].info2.location = ldb_msg_find_attr_as_string(msgs[i], "location", NULL);
info[i].info2.devmode = NULL;
- info[i].info2.sepfile = samdb_result_string(msgs[i], "sepfile", NULL);
+ info[i].info2.sepfile = ldb_msg_find_attr_as_string(msgs[i], "sepfile", NULL);
- info[i].info2.printprocessor = samdb_result_string(msgs[i], "printprocessor", "");
+ info[i].info2.printprocessor = ldb_msg_find_attr_as_string(msgs[i], "printprocessor", "");
W_ERROR_HAVE_NO_MEMORY(info[i].info2.printprocessor);
- info[i].info2.datatype = samdb_result_string(msgs[i], "datatype", "");
+ info[i].info2.datatype = ldb_msg_find_attr_as_string(msgs[i], "datatype", "");
W_ERROR_HAVE_NO_MEMORY(info[i].info2.datatype);
- info[i].info2.parameters = samdb_result_string(msgs[i], "parameters", NULL);
+ info[i].info2.parameters = ldb_msg_find_attr_as_string(msgs[i], "parameters", NULL);
info[i].info2.secdesc = NULL;
- info[i].info2.attributes = samdb_result_uint(msgs[i], "attributes", 0);
- info[i].info2.priority = samdb_result_uint(msgs[i], "priority", 0);
- info[i].info2.defaultpriority = samdb_result_uint(msgs[i], "defaultpriority", 0);
- info[i].info2.starttime = samdb_result_uint(msgs[i], "starttime", 0);
- info[i].info2.untiltime = samdb_result_uint(msgs[i], "untiltime", 0);
- info[i].info2.status = samdb_result_uint(msgs[i], "status", 0);
- info[i].info2.cjobs = samdb_result_uint(msgs[i], "cjobs", 0);
- info[i].info2.averageppm = samdb_result_uint(msgs[i], "averageppm", 0);
+ info[i].info2.attributes = ldb_msg_find_attr_as_uint(msgs[i], "attributes", 0);
+ info[i].info2.priority = ldb_msg_find_attr_as_uint(msgs[i], "priority", 0);
+ info[i].info2.defaultpriority = ldb_msg_find_attr_as_uint(msgs[i], "defaultpriority", 0);
+ info[i].info2.starttime = ldb_msg_find_attr_as_uint(msgs[i], "starttime", 0);
+ info[i].info2.untiltime = ldb_msg_find_attr_as_uint(msgs[i], "untiltime", 0);
+ info[i].info2.status = ldb_msg_find_attr_as_uint(msgs[i], "status", 0);
+ info[i].info2.cjobs = ldb_msg_find_attr_as_uint(msgs[i], "cjobs", 0);
+ info[i].info2.averageppm = ldb_msg_find_attr_as_uint(msgs[i], "averageppm", 0);
}
break;
case 4:
for (i = 0; i < count; i++) {
- info[i].info4.printername = samdb_result_string(msgs[i], "printername", "");
+ info[i].info4.printername = ldb_msg_find_attr_as_string(msgs[i], "printername", "");
W_ERROR_HAVE_NO_MEMORY(info[i].info2.printername);
- info[i].info4.servername = samdb_result_string(msgs[i], "servername", "");
+ info[i].info4.servername = ldb_msg_find_attr_as_string(msgs[i], "servername", "");
W_ERROR_HAVE_NO_MEMORY(info[i].info2.servername);
- info[i].info4.attributes = samdb_result_uint(msgs[i], "attributes", 0);
+ info[i].info4.attributes = ldb_msg_find_attr_as_uint(msgs[i], "attributes", 0);
}
break;
case 5:
for (i = 0; i < count; i++) {
- info[i].info5.printername = samdb_result_string(msgs[i], "name", "");
+ info[i].info5.printername = ldb_msg_find_attr_as_string(msgs[i], "name", "");
W_ERROR_HAVE_NO_MEMORY(info[i].info5.printername);
- info[i].info5.portname = samdb_result_string(msgs[i], "port", "");
+ info[i].info5.portname = ldb_msg_find_attr_as_string(msgs[i], "port", "");
W_ERROR_HAVE_NO_MEMORY(info[i].info5.portname);
- info[i].info5.attributes = samdb_result_uint(msgs[i], "attributes", 0);
- info[i].info5.device_not_selected_timeout = samdb_result_uint(msgs[i], "device_not_selected_timeout", 0);
- info[i].info5.transmission_retry_timeout = samdb_result_uint(msgs[i], "transmission_retry_timeout", 0);
+ info[i].info5.attributes = ldb_msg_find_attr_as_uint(msgs[i], "attributes", 0);
+ info[i].info5.device_not_selected_timeout = ldb_msg_find_attr_as_uint(msgs[i], "device_not_selected_timeout", 0);
+ info[i].info5.transmission_retry_timeout = ldb_msg_find_attr_as_uint(msgs[i], "transmission_retry_timeout", 0);
}
break;
default:
@@ -659,23 +659,23 @@ static WERROR sptr_EnumPorts(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
switch (r->in.level) {
case 1:
for (i = 0; i < count; i++) {
- info[i].info1.port_name = samdb_result_string(msgs[i], "port-name", "");
+ info[i].info1.port_name = ldb_msg_find_attr_as_string(msgs[i], "port-name", "");
W_ERROR_HAVE_NO_MEMORY(info[i].info1.port_name);
}
break;
case 2:
for (i=0; i < count; i++) {
- info[i].info2.port_name = samdb_result_string(msgs[i], "port-name", "");
+ info[i].info2.port_name = ldb_msg_find_attr_as_string(msgs[i], "port-name", "");
W_ERROR_HAVE_NO_MEMORY(info[i].info2.port_name);
- info[i].info2.monitor_name = samdb_result_string(msgs[i], "monitor-name", "");
+ info[i].info2.monitor_name = ldb_msg_find_attr_as_string(msgs[i], "monitor-name", "");
W_ERROR_HAVE_NO_MEMORY(info[i].info2.monitor_name);
- info[i].info2.description = samdb_result_string(msgs[i], "description", "");
+ info[i].info2.description = ldb_msg_find_attr_as_string(msgs[i], "description", "");
W_ERROR_HAVE_NO_MEMORY(info[i].info2.description);
- info[i].info2.port_type = samdb_result_uint(msgs[i], "port-type", SPOOLSS_PORT_TYPE_WRITE);
- info[i].info2.reserved = samdb_result_uint(msgs[i], "reserved", 0);
+ info[i].info2.port_type = ldb_msg_find_attr_as_uint(msgs[i], "port-type", SPOOLSS_PORT_TYPE_WRITE);
+ info[i].info2.reserved = ldb_msg_find_attr_as_uint(msgs[i], "reserved", 0);
}
break;
default:
@@ -709,19 +709,19 @@ static WERROR sptr_EnumMonitors(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx
switch (r->in.level) {
case 1:
for (i = 0; i < count; i++) {
- info[i].info1.monitor_name = samdb_result_string(msgs[i], "monitor-name", "");
+ info[i].info1.monitor_name = ldb_msg_find_attr_as_string(msgs[i], "monitor-name", "");
W_ERROR_HAVE_NO_MEMORY(info[i].info1.monitor_name);
}
break;
case 2:
for (i=0; i < count; i++) {
- info[i].info2.monitor_name = samdb_result_string(msgs[i], "monitor-name", "");
+ info[i].info2.monitor_name = ldb_msg_find_attr_as_string(msgs[i], "monitor-name", "");
W_ERROR_HAVE_NO_MEMORY(info[i].info2.monitor_name);
- info[i].info2.environment = samdb_result_string(msgs[i], "environment", "");
+ info[i].info2.environment = ldb_msg_find_attr_as_string(msgs[i], "environment", "");
W_ERROR_HAVE_NO_MEMORY(info[i].info2.environment);
- info[i].info2.dll_name = samdb_result_string(msgs[i], "dll-name", "");
+ info[i].info2.dll_name = ldb_msg_find_attr_as_string(msgs[i], "dll-name", "");
W_ERROR_HAVE_NO_MEMORY(info[i].info2.dll_name);
}
break;
@@ -766,18 +766,18 @@ static WERROR sptr_GetPrinterForm(struct ntptr_GenericHandle *printer, TALLOC_CT
switch (r->in.level) {
case 1:
- info->info1.flags = samdb_result_uint(msgs[0], "flags", SPOOLSS_FORM_BUILTIN);
+ info->info1.flags = ldb_msg_find_attr_as_uint(msgs[0], "flags", SPOOLSS_FORM_BUILTIN);
- info->info1.form_name = samdb_result_string(msgs[0], "form-name", NULL);
+ info->info1.form_name = ldb_msg_find_attr_as_string(msgs[0], "form-name", NULL);
W_ERROR_HAVE_NO_MEMORY(info->info1.form_name);
- info->info1.size.width = samdb_result_uint(msgs[0], "size-width", 0);
- info->info1.size.height = samdb_result_uint(msgs[0], "size-height", 0);
+ info->info1.size.width = ldb_msg_find_attr_as_uint(msgs[0], "size-width", 0);
+ info->info1.size.height = ldb_msg_find_attr_as_uint(msgs[0], "size-height", 0);
- info->info1.area.left = samdb_result_uint(msgs[0], "area-left", 0);
- info->info1.area.top = samdb_result_uint(msgs[0], "area-top", 0);
- info->info1.area.right = samdb_result_uint(msgs[0], "area-right", 0);
- info->info1.area.bottom = samdb_result_uint(msgs[0], "area-bottom", 0);
+ info->info1.area.left = ldb_msg_find_attr_as_uint(msgs[0], "area-left", 0);
+ info->info1.area.top = ldb_msg_find_attr_as_uint(msgs[0], "area-top", 0);
+ info->info1.area.right = ldb_msg_find_attr_as_uint(msgs[0], "area-right", 0);
+ info->info1.area.bottom = ldb_msg_find_attr_as_uint(msgs[0], "area-bottom", 0);
break;
default:
return WERR_UNKNOWN_LEVEL;
diff --git a/source4/rpc_server/drsuapi/dcesrv_drsuapi.c b/source4/rpc_server/drsuapi/dcesrv_drsuapi.c
index c6faf75ad5..f4dad09335 100644
--- a/source4/rpc_server/drsuapi/dcesrv_drsuapi.c
+++ b/source4/rpc_server/drsuapi/dcesrv_drsuapi.c
@@ -135,7 +135,8 @@ static WERROR dcesrv_drsuapi_DsBind(struct dcesrv_call_state *dce_call, TALLOC_C
if (ntds_res->count != 1) {
return WERR_DS_DRA_INTERNAL_ERROR;
}
- repl_epoch = samdb_result_uint(ntds_res->msgs[0], "ms-DS-ReplicationEpoch", 0);
+ repl_epoch = ldb_msg_find_attr_as_uint(ntds_res->msgs[0],
+ "ms-DS-ReplicationEpoch", 0);
/*
* The "process identifier" of the client.
diff --git a/source4/rpc_server/drsuapi/getncchanges.c b/source4/rpc_server/drsuapi/getncchanges.c
index 0f6c08d6e2..1ad95babf9 100644
--- a/source4/rpc_server/drsuapi/getncchanges.c
+++ b/source4/rpc_server/drsuapi/getncchanges.c
@@ -865,7 +865,8 @@ static WERROR getncchanges_repl_secret(struct drsuapi_bind_state *b_state,
goto denied;
}
- if (samdb_result_uint(obj_res->msgs[0], "UserAccountControl", 0) &
+ if (ldb_msg_find_attr_as_uint(obj_res->msgs[0],
+ "userAccountControl", 0) &
UF_INTERDOMAIN_TRUST_ACCOUNT) {
goto denied;
}
diff --git a/source4/rpc_server/lsa/dcesrv_lsa.c b/source4/rpc_server/lsa/dcesrv_lsa.c
index 2e4373471c..ac048ee63b 100644
--- a/source4/rpc_server/lsa/dcesrv_lsa.c
+++ b/source4/rpc_server/lsa/dcesrv_lsa.c
@@ -2008,11 +2008,11 @@ static NTSTATUS dcesrv_lsa_QueryTrustedDomainInfo(struct dcesrv_call_state *dce_
switch (r->in.level) {
case LSA_TRUSTED_DOMAIN_INFO_NAME:
info->name.netbios_name.string
- = samdb_result_string(msg, "flatname", NULL);
+ = ldb_msg_find_attr_as_string(msg, "flatname", NULL);
break;
case LSA_TRUSTED_DOMAIN_INFO_POSIX_OFFSET:
info->posix_offset.posix_offset
- = samdb_result_uint(msg, "posixOffset", 0);
+ = ldb_msg_find_attr_as_uint(msg, "posixOffset", 0);
break;
#if 0 /* Win2k3 doesn't implement this */
case LSA_TRUSTED_DOMAIN_INFO_BASIC:
@@ -2028,16 +2028,15 @@ static NTSTATUS dcesrv_lsa_QueryTrustedDomainInfo(struct dcesrv_call_state *dce_
case LSA_TRUSTED_DOMAIN_INFO_FULL_INFO:
ZERO_STRUCT(info->full_info);
return fill_trust_domain_ex(mem_ctx, msg, &info->full_info.info_ex);
-
case LSA_TRUSTED_DOMAIN_INFO_FULL_INFO_2_INTERNAL:
ZERO_STRUCT(info->full_info2_internal);
info->full_info2_internal.posix_offset.posix_offset
- = samdb_result_uint(msg, "posixOffset", 0);
+ = ldb_msg_find_attr_as_uint(msg, "posixOffset", 0);
return fill_trust_domain_ex(mem_ctx, msg, &info->full_info2_internal.info.info_ex);
case LSA_TRUSTED_DOMAIN_SUPPORTED_ENCRYPTION_TYPES:
info->enc_types.enc_types
- = samdb_result_uint(msg, "msDs-supportedEncryptionTypes", KERB_ENCTYPE_RC4_HMAC_MD5);
+ = ldb_msg_find_attr_as_uint(msg, "msDs-supportedEncryptionTypes", KERB_ENCTYPE_RC4_HMAC_MD5);
break;
case LSA_TRUSTED_DOMAIN_INFO_CONTROLLERS:
@@ -2232,7 +2231,7 @@ static NTSTATUS dcesrv_lsa_EnumTrustDom(struct dcesrv_call_state *dce_call, TALL
}
for (i=0;i<count;i++) {
entries[i].sid = samdb_result_dom_sid(mem_ctx, domains[i], "securityIdentifier");
- entries[i].name.string = samdb_result_string(domains[i], "flatname", NULL);
+ entries[i].name.string = ldb_msg_find_attr_as_string(domains[i], "flatname", NULL);
}
/* sort the results by name */
@@ -4286,8 +4285,8 @@ static NTSTATUS dcesrv_lsa_lsaRSetForestTrustInformation(struct dcesrv_call_stat
tdo_dn = dom_res[i]->dn;
- trust_attributes = samdb_result_uint(dom_res[i],
- "trustAttributes", 0);
+ trust_attributes = ldb_msg_find_attr_as_uint(dom_res[i],
+ "trustAttributes", 0);
if (!(trust_attributes & NETR_TRUST_ATTRIBUTE_FOREST_TRANSITIVE)) {
return NT_STATUS_INVALID_PARAMETER;
}
diff --git a/source4/rpc_server/lsa/lsa_lookup.c b/source4/rpc_server/lsa/lsa_lookup.c
index d024ea0dd2..73ea72ca6a 100644
--- a/source4/rpc_server/lsa/lsa_lookup.c
+++ b/source4/rpc_server/lsa/lsa_lookup.c
@@ -412,7 +412,7 @@ static NTSTATUS dcesrv_lsa_lookup_name(struct tevent_context *ev_ctx,
continue;
}
- atype = samdb_result_uint(res[i], "sAMAccountType", 0);
+ atype = ldb_msg_find_attr_as_uint(res[i], "sAMAccountType", 0);
*rtype = ds_atype_map(atype);
if (*rtype == SID_NAME_UNKNOWN) {
@@ -530,7 +530,7 @@ static NTSTATUS dcesrv_lsa_lookup_sid(struct lsa_policy_state *state, TALLOC_CTX
}
}
- atype = samdb_result_uint(res[0], "sAMAccountType", 0);
+ atype = ldb_msg_find_attr_as_uint(res[0], "sAMAccountType", 0);
*rtype = ds_atype_map(atype);
return NT_STATUS_OK;
diff --git a/source4/rpc_server/netlogon/dcerpc_netlogon.c b/source4/rpc_server/netlogon/dcerpc_netlogon.c
index 0ddd098897..b4fe5dca88 100644
--- a/source4/rpc_server/netlogon/dcerpc_netlogon.c
+++ b/source4/rpc_server/netlogon/dcerpc_netlogon.c
@@ -1240,8 +1240,8 @@ static NTSTATUS fill_one_domain_info(TALLOC_CTX *mem_ctx,
info->domain_guid = samdb_result_guid(res, "objectGUID");
info->domain_sid = samdb_result_dom_sid(mem_ctx, res, "objectSid");
} else {
- info->domainname.string = samdb_result_string(res, "flatName", NULL);
- info->dns_domainname.string = samdb_result_string(res, "trustPartner", NULL);
+ info->domainname.string = ldb_msg_find_attr_as_string(res, "flatName", NULL);
+ info->dns_domainname.string = ldb_msg_find_attr_as_string(res, "trustPartner", NULL);
info->domain_guid = samdb_result_guid(res, "objectGUID");
info->domain_sid = samdb_result_dom_sid(mem_ctx, res, "securityIdentifier");
}
@@ -1335,7 +1335,7 @@ static NTSTATUS dcesrv_netr_LogonGetDomainInfo(struct dcesrv_call_state *dce_cal
}
/* Gets the old DNS hostname */
- old_dns_hostname = samdb_result_string(res1[0], "dNSHostName",
+ old_dns_hostname = ldb_msg_find_attr_as_string(res1[0], "dNSHostName",
NULL);
/*
@@ -1472,7 +1472,7 @@ static NTSTATUS dcesrv_netr_LogonGetDomainInfo(struct dcesrv_call_state *dce_cal
NT_STATUS_NOT_OK_RETURN(status);
/* Sets the supported encryption types */
- domain_info->supported_enc_types = samdb_result_uint(res1[0],
+ domain_info->supported_enc_types = ldb_msg_find_attr_as_uint(res1[0],
"msDS-SupportedEncryptionTypes",
default_supported_enc_types);
@@ -1848,7 +1848,7 @@ static WERROR dcesrv_netr_DsrGetDcSiteCoverageW(struct dcesrv_call_state *dce_ca
#define GET_CHECK_STR(dest, mem, msg, attr) \
do {\
const char *s; \
- s = samdb_result_string(msg, attr, NULL); \
+ s = ldb_msg_find_attr_as_string(msg, attr, NULL); \
if (!s) { \
DEBUG(0, ("DB Error, TustedDomain entry (%s) " \
"without flatname\n", \
@@ -1894,8 +1894,8 @@ static WERROR fill_trusted_domains_array(TALLOC_CTX *mem_ctx,
unsigned int trust_dir;
uint32_t flags = 0;
- trust_dir = samdb_result_uint(dom_res[i],
- "trustDirection", 0);
+ trust_dir = ldb_msg_find_attr_as_uint(dom_res[i],
+ "trustDirection", 0);
if (trust_dir & LSA_TRUST_DIRECTION_INBOUND) {
flags |= NETR_TRUST_FLAG_INBOUND;
@@ -1928,10 +1928,10 @@ static WERROR fill_trusted_domains_array(TALLOC_CTX *mem_ctx,
}
trusts->array[n].trust_type =
- samdb_result_uint(dom_res[i],
+ ldb_msg_find_attr_as_uint(dom_res[i],
"trustType", 0);
trusts->array[n].trust_attributes =
- samdb_result_uint(dom_res[i],
+ ldb_msg_find_attr_as_uint(dom_res[i],
"trustAttributes", 0);
if ((trusts->array[n].trust_type == NETR_TRUST_TYPE_MIT) ||
diff --git a/source4/rpc_server/samr/dcesrv_samr.c b/source4/rpc_server/samr/dcesrv_samr.c
index 0069d4feaa..ac75b417f9 100644
--- a/source4/rpc_server/samr/dcesrv_samr.c
+++ b/source4/rpc_server/samr/dcesrv_samr.c
@@ -43,13 +43,13 @@
/* these query macros make samr_Query[User|Group|Alias]Info a bit easier to read */
#define QUERY_STRING(msg, field, attr) \
- info->field.string = samdb_result_string(msg, attr, "");
+ info->field.string = ldb_msg_find_attr_as_string(msg, attr, "");
#define QUERY_UINT(msg, field, attr) \
- info->field = samdb_result_uint(msg, attr, 0);
+ info->field = ldb_msg_find_attr_as_uint(msg, attr, 0);
#define QUERY_RID(msg, field, attr) \
info->field = samdb_result_rid_from_sid(mem_ctx, msg, attr, 0);
#define QUERY_UINT64(msg, field, attr) \
- info->field = samdb_result_uint64(msg, attr, 0);
+ info->field = ldb_msg_find_attr_as_uint64(msg, attr, 0);
#define QUERY_APASSC(msg, field, attr) \
info->field = samdb_result_allow_password_change(sam_ctx, mem_ctx, \
a_state->domain_state->domain_dn, msg, attr);
@@ -462,15 +462,15 @@ static NTSTATUS dcesrv_samr_info_DomInfo1(struct samr_domain_state *state,
struct samr_DomInfo1 *info)
{
info->min_password_length =
- samdb_result_uint(dom_msgs[0], "minPwdLength", 0);
+ ldb_msg_find_attr_as_uint(dom_msgs[0], "minPwdLength", 0);
info->password_history_length =
- samdb_result_uint(dom_msgs[0], "pwdHistoryLength", 0);
+ ldb_msg_find_attr_as_uint(dom_msgs[0], "pwdHistoryLength", 0);
info->password_properties =
- samdb_result_uint(dom_msgs[0], "pwdProperties", 0);
+ ldb_msg_find_attr_as_uint(dom_msgs[0], "pwdProperties", 0);
info->max_password_age =
- samdb_result_int64(dom_msgs[0], "maxPwdAge", 0);
+ ldb_msg_find_attr_as_int64(dom_msgs[0], "maxPwdAge", 0);
info->min_password_age =
- samdb_result_int64(dom_msgs[0], "minPwdAge", 0);
+ ldb_msg_find_attr_as_int64(dom_msgs[0], "minPwdAge", 0);
return NT_STATUS_OK;
}
@@ -495,7 +495,7 @@ static NTSTATUS dcesrv_samr_info_DomGeneralInformation(struct samr_domain_state
info->force_logoff_time = ldb_msg_find_attr_as_uint64(dom_msgs[0], "forceLogoff",
0x8000000000000000LL);
- info->oem_information.string = samdb_result_string(dom_msgs[0], "oEMInformation", NULL);
+ info->oem_information.string = ldb_msg_find_attr_as_string(dom_msgs[0], "oEMInformation", NULL);
info->domain_name.string = state->domain_name;
info->sequence_num = ldb_msg_find_attr_as_uint64(dom_msgs[0], "modifiedCount",
@@ -554,7 +554,7 @@ static NTSTATUS dcesrv_samr_info_DomOEMInformation(struct samr_domain_state *sta
struct ldb_message **dom_msgs,
struct samr_DomOEMInformation *info)
{
- info->oem_information.string = samdb_result_string(dom_msgs[0], "oEMInformation", NULL);
+ info->oem_information.string = ldb_msg_find_attr_as_string(dom_msgs[0], "oEMInformation", NULL);
return NT_STATUS_OK;
}
@@ -1119,7 +1119,7 @@ static NTSTATUS dcesrv_samr_EnumDomainGroups(struct dcesrv_call_state *dce_call,
entries[count].idx =
group_sid->sub_auths[group_sid->num_auths-1];
entries[count].name.string =
- samdb_result_string(res[i], "sAMAccountName", "");
+ ldb_msg_find_attr_as_string(res[i], "sAMAccountName", "");
count += 1;
}
@@ -1310,7 +1310,7 @@ static NTSTATUS dcesrv_samr_EnumDomainUsers(struct dcesrv_call_state *dce_call,
}
entries[count].idx = samdb_result_rid_from_sid(mem_ctx, res[i],
"objectSid", 0);
- entries[count].name.string = samdb_result_string(res[i],
+ entries[count].name.string = ldb_msg_find_attr_as_string(res[i],
"sAMAccountName", "");
count += 1;
}
@@ -1474,7 +1474,7 @@ static NTSTATUS dcesrv_samr_EnumDomainAliases(struct dcesrv_call_state *dce_call
entries[count].idx =
alias_sid->sub_auths[alias_sid->num_auths-1];
entries[count].name.string =
- samdb_result_string(res[i], "sAMAccountName", "");
+ ldb_msg_find_attr_as_string(res[i], "sAMAccountName", "");
count += 1;
}
@@ -1651,7 +1651,7 @@ static NTSTATUS dcesrv_samr_LookupNames(struct dcesrv_call_state *dce_call, TALL
continue;
}
- atype = samdb_result_uint(res[0], "sAMAccountType", 0);
+ atype = ldb_msg_find_attr_as_uint(res[0], "sAMAccountType", 0);
if (atype == 0) {
status = STATUS_SOME_UNMAPPED;
continue;
@@ -1769,7 +1769,7 @@ static NTSTATUS dcesrv_samr_OpenGroup(struct dcesrv_call_state *dce_call, TALLOC
return NT_STATUS_INTERNAL_DB_CORRUPTION;
}
- groupname = samdb_result_string(msgs[0], "sAMAccountName", NULL);
+ groupname = ldb_msg_find_attr_as_string(msgs[0], "sAMAccountName", NULL);
if (groupname == NULL) {
DEBUG(0,("sAMAccountName field missing for sid %s\n",
dom_sid_string(mem_ctx, sid)));
@@ -2233,7 +2233,7 @@ static NTSTATUS dcesrv_samr_OpenAlias(struct dcesrv_call_state *dce_call, TALLOC
return NT_STATUS_INTERNAL_DB_CORRUPTION;
}
- alias_name = samdb_result_string(msgs[0], "sAMAccountName", NULL);
+ alias_name = ldb_msg_find_attr_as_string(msgs[0], "sAMAccountName", NULL);
if (alias_name == NULL) {
DEBUG(0,("sAMAccountName field missing for sid %s\n",
dom_sid_string(mem_ctx, sid)));
@@ -2620,7 +2620,7 @@ static NTSTATUS dcesrv_samr_OpenUser(struct dcesrv_call_state *dce_call, TALLOC_
return NT_STATUS_INTERNAL_DB_CORRUPTION;
}
- account_name = samdb_result_string(msgs[0], "sAMAccountName", NULL);
+ account_name = ldb_msg_find_attr_as_string(msgs[0], "sAMAccountName", NULL);
if (account_name == NULL) {
DEBUG(0,("sAMAccountName field missing for sid %s\n",
dom_sid_string(mem_ctx, sid)));
@@ -3723,12 +3723,12 @@ static NTSTATUS dcesrv_samr_QueryDisplayInfo(struct dcesrv_call_state *dce_call,
res[i],
d_state->domain_dn);
entriesGeneral[count].account_name.string =
- samdb_result_string(res[i],
+ ldb_msg_find_attr_as_string(res[i],
"sAMAccountName", "");
entriesGeneral[count].full_name.string =
- samdb_result_string(res[i], "displayName", "");
+ ldb_msg_find_attr_as_string(res[i], "displayName", "");
entriesGeneral[count].description.string =
- samdb_result_string(res[i], "description", "");
+ ldb_msg_find_attr_as_string(res[i], "description", "");
break;
case 2:
entriesFull[count].idx = count + 1;
@@ -3741,10 +3741,10 @@ static NTSTATUS dcesrv_samr_QueryDisplayInfo(struct dcesrv_call_state *dce_call,
res[i],
d_state->domain_dn) | ACB_NORMAL;
entriesFull[count].account_name.string =
- samdb_result_string(res[i], "sAMAccountName",
+ ldb_msg_find_attr_as_string(res[i], "sAMAccountName",
"");
entriesFull[count].description.string =
- samdb_result_string(res[i], "description", "");
+ ldb_msg_find_attr_as_string(res[i], "description", "");
break;
case 3:
entriesFullGroup[count].idx = count + 1;
@@ -3754,16 +3754,16 @@ static NTSTATUS dcesrv_samr_QueryDisplayInfo(struct dcesrv_call_state *dce_call,
entriesFullGroup[count].acct_flags
= SE_GROUP_MANDATORY | SE_GROUP_ENABLED_BY_DEFAULT | SE_GROUP_ENABLED;
entriesFullGroup[count].account_name.string =
- samdb_result_string(res[i], "sAMAccountName",
+ ldb_msg_find_attr_as_string(res[i], "sAMAccountName",
"");
entriesFullGroup[count].description.string =
- samdb_result_string(res[i], "description", "");
+ ldb_msg_find_attr_as_string(res[i], "description", "");
break;
case 4:
case 5:
entriesAscii[count].idx = count + 1;
entriesAscii[count].account_name.string =
- samdb_result_string(res[i], "sAMAccountName",
+ ldb_msg_find_attr_as_string(res[i], "sAMAccountName",
"");
break;
}
@@ -4118,9 +4118,9 @@ static NTSTATUS dcesrv_samr_GetDomPwInfo(struct dcesrv_call_state *dce_call, TAL
return NT_STATUS_INTERNAL_DB_CORRUPTION;
}
- r->out.info->min_password_length = samdb_result_uint(msgs[0],
+ r->out.info->min_password_length = ldb_msg_find_attr_as_uint(msgs[0],
"minPwdLength", 0);
- r->out.info->password_properties = samdb_result_uint(msgs[0],
+ r->out.info->password_properties = ldb_msg_find_attr_as_uint(msgs[0],
"pwdProperties", 1);
talloc_free(msgs);
diff --git a/source4/torture/ldap/uptodatevector.c b/source4/torture/ldap/uptodatevector.c
index 76eb45c5c1..5a03cacfbe 100644
--- a/source4/torture/ldap/uptodatevector.c
+++ b/source4/torture/ldap/uptodatevector.c
@@ -130,8 +130,8 @@ static bool test_check_uptodatevector(struct torture_context *torture,
}
torture_comment(torture, "[%u]: uSNChanged[%llu] description[%s] replUpToDateVector[%s]\n", i,
- (unsigned long long)samdb_result_uint64(r->msgs[0], "uSNChanged", 0),
- samdb_result_string(r->msgs[0], "description", NULL),
+ (unsigned long long)ldb_msg_find_attr_as_uint64(r->msgs[0], "uSNChanged", 0),
+ ldb_msg_find_attr_as_string(r->msgs[0], "description", NULL),
(no_match ? "changed!: not ok" : "not changed: ok"));
if (no_match) {
diff --git a/source4/utils/net/drs/net_drs_showrepl.c b/source4/utils/net/drs/net_drs_showrepl.c
index d429df4abf..584c294707 100644
--- a/source4/utils/net/drs/net_drs_showrepl.c
+++ b/source4/utils/net/drs/net_drs_showrepl.c
@@ -161,7 +161,7 @@ static bool net_drs_showrepl_print_dc_info(struct net_drs_context *drs_ctx)
/* Site-name\DC-name */
d_printf("%s\\%s\n", site_name, dc_name);
/* DSA Options */
- options = samdb_result_uint(ntds_msgs[0], "options", 0);
+ options = ldb_msg_find_attr_as_uint(ntds_msgs[0], "options", 0);
if (options) {
/* TODO: Print options as string in IS_GC... etc form */
d_printf("DSA Options: 0x%08X\n", options);
@@ -169,7 +169,7 @@ static bool net_drs_showrepl_print_dc_info(struct net_drs_context *drs_ctx)
d_printf("DSA Options: (none)\n");
}
/* Site Options */
- options = samdb_result_uint(site_msgs[0], "options", 0);
+ options = ldb_msg_find_attr_as_uint(site_msgs[0], "options", 0);
if (options) {
/* TODO: Print options in string */
d_printf("DSA Options: 0x%08X\n", options);
@@ -383,7 +383,7 @@ static bool net_drs_showrepl_print_connection_objects(struct net_drs_context *dr
NET_DRS_CHECK_GOTO(dn, failed, "No dsServiceName value in RootDSE!\n");
/* DNS host name for target DC */
- dc_dns_name = samdb_result_string(drs_ctx->ldap.rootdse , "dnsHostName", NULL);
+ dc_dns_name = ldb_msg_find_attr_as_string(drs_ctx->ldap.rootdse , "dnsHostName", NULL);
NET_DRS_CHECK_GOTO(dc_dns_name, failed, "No dsServiceName value in dnsHostName!\n");
/* Enum. Connection objects under NTDS Settings */
@@ -404,17 +404,17 @@ static bool net_drs_showrepl_print_connection_objects(struct net_drs_context *dr
d_printf("Connection --\n");
d_printf("\tConnection name : %s\n",
- samdb_result_string(conn_msg, "name", NULL));
+ ldb_msg_find_attr_as_string(conn_msg, "name", NULL));
d_printf("\tEnabled : %s\n",
- samdb_result_string(conn_msg, "enabledConnection", "TRUE"));
+ ldb_msg_find_attr_as_string(conn_msg, "enabledConnection", "TRUE"));
d_printf("\tServer DNS name : %s\n", dc_dns_name);
d_printf("\tServer DN name : %s\n",
- samdb_result_string(conn_msg, "fromServer", NULL));
- transport_type = samdb_result_string(conn_msg, "transportType", NULL);
+ ldb_msg_find_attr_as_string(conn_msg, "fromServer", NULL));
+ transport_type = ldb_msg_find_attr_as_string(conn_msg, "transportType", NULL);
d_printf("\t\tTransportType: %s\n",
net_drs_transport_type_str(drs_ctx, transport_type));
/* TODO: print Connection options in friendly format */
- options = samdb_result_uint(conn_msg, "options", 0);
+ options = ldb_msg_find_attr_as_uint(conn_msg, "options", 0);
d_printf("\t\toptions: 0x%08X\n", options);
/* print replicated NCs for this connection */