summaryrefslogtreecommitdiff
path: root/source4/rpc_server
diff options
context:
space:
mode:
authorMatthias Dieter Wallnöfer <mdw@samba.org>2010-10-14 09:41:42 +0200
committerAndrew Bartlett <abartlet@samba.org>2010-10-15 08:36:01 +1100
commita0e9814c0d50ee822188e2bd6be8c4879aaebacc (patch)
tree79670d9c58f88ae6007b17ab240a1e64ed33c05e /source4/rpc_server
parentc2533f94b561e9b22d621b7515c6606d39ffec89 (diff)
downloadsamba-a0e9814c0d50ee822188e2bd6be8c4879aaebacc.tar.gz
samba-a0e9814c0d50ee822188e2bd6be8c4879aaebacc.tar.bz2
samba-a0e9814c0d50ee822188e2bd6be8c4879aaebacc.zip
s4:dsdb - remove "samdb_result_uint", "samdb_result_int64", "samdb_result_uint64" and "samdb_result_string"
We have ldb_msg_find_attr_as_* calls which do exactly the same. Therefore this reduces only code redundancies. Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source4/rpc_server')
-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
6 files changed, 49 insertions, 48 deletions
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);