1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-08 05:57:51 +03:00

s4:dsdb: Remove trailing whitespaces from util.c

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
This commit is contained in:
Andreas Schneider 2022-07-26 11:31:35 +02:00 committed by Andreas Schneider
parent fd4368797e
commit 56297449f9

View File

@ -1,4 +1,4 @@
/*
/*
Unix SMB/CIFS implementation.
Samba utility functions
@ -67,7 +67,7 @@
objectSid being in domain_sid.
*/
int samdb_search_domain(struct ldb_context *sam_ldb,
TALLOC_CTX *mem_ctx,
TALLOC_CTX *mem_ctx,
struct ldb_dn *basedn,
struct ldb_message ***res,
const char * const *attrs,
@ -120,8 +120,8 @@ const char *samdb_search_string_v(struct ldb_context *sam_ldb,
attrs[0] = attr_name;
count = gendb_search_v(sam_ldb, mem_ctx, basedn, &res, attrs, format, ap);
if (count > 1) {
DEBUG(1,("samdb: search for %s %s not single valued (count=%d)\n",
if (count > 1) {
DEBUG(1,("samdb: search for %s %s not single valued (count=%d)\n",
attr_name, format, count));
}
if (count != 1) {
@ -193,8 +193,8 @@ struct dom_sid *samdb_search_dom_sid(struct ldb_context *sam_ldb,
va_start(ap, format);
count = gendb_search_v(sam_ldb, mem_ctx, basedn, &res, attrs, format, ap);
va_end(ap);
if (count > 1) {
DEBUG(1,("samdb: search for %s %s not single valued (count=%d)\n",
if (count > 1) {
DEBUG(1,("samdb: search for %s %s not single valued (count=%d)\n",
attr_name, format, count));
}
if (count != 1) {
@ -203,7 +203,7 @@ struct dom_sid *samdb_search_dom_sid(struct ldb_context *sam_ldb,
}
sid = samdb_result_dom_sid(mem_ctx, res[0], attr_name);
talloc_free(res);
return sid;
return sid;
}
/*
@ -291,7 +291,7 @@ int samdb_search_string_multiple(struct ldb_context *sam_ldb,
/* make sure its single valued */
for (i=0;i<count;i++) {
if (res[i]->num_elements != 1) {
DEBUG(1,("samdb: search for %s %s not single valued\n",
DEBUG(1,("samdb: search for %s %s not single valued\n",
attr_name, format));
talloc_free(res);
return -1;
@ -323,9 +323,9 @@ struct ldb_dn *samdb_result_dn(struct ldb_context *ldb, TALLOC_CTX *mem_ctx, con
}
/*
pull a rid from a objectSid in a result set.
pull a rid from a objectSid in a result set.
*/
uint32_t samdb_result_rid_from_sid(TALLOC_CTX *mem_ctx, const struct ldb_message *msg,
uint32_t samdb_result_rid_from_sid(TALLOC_CTX *mem_ctx, const struct ldb_message *msg,
const char *attr, uint32_t default_value)
{
struct dom_sid *sid;
@ -341,9 +341,9 @@ uint32_t samdb_result_rid_from_sid(TALLOC_CTX *mem_ctx, const struct ldb_message
}
/*
pull a dom_sid structure from a objectSid in a result set.
pull a dom_sid structure from a objectSid in a result set.
*/
struct dom_sid *samdb_result_dom_sid(TALLOC_CTX *mem_ctx, const struct ldb_message *msg,
struct dom_sid *samdb_result_dom_sid(TALLOC_CTX *mem_ctx, const struct ldb_message *msg,
const char *attr)
{
ssize_t ret;
@ -366,7 +366,7 @@ struct dom_sid *samdb_result_dom_sid(TALLOC_CTX *mem_ctx, const struct ldb_messa
}
/*
pull a guid structure from a objectGUID in a result set.
pull a guid structure from a objectGUID in a result set.
*/
struct GUID samdb_result_guid(const struct ldb_message *msg, const char *attr)
{
@ -386,10 +386,10 @@ struct GUID samdb_result_guid(const struct ldb_message *msg, const char *attr)
}
/*
pull a sid prefix from a objectSid in a result set.
pull a sid prefix from a objectSid in a result set.
this is used to find the domain sid for a user
*/
struct dom_sid *samdb_result_sid_prefix(TALLOC_CTX *mem_ctx, const struct ldb_message *msg,
struct dom_sid *samdb_result_sid_prefix(TALLOC_CTX *mem_ctx, const struct ldb_message *msg,
const char *attr)
{
struct dom_sid *sid = samdb_result_dom_sid(mem_ctx, msg, attr);
@ -399,7 +399,7 @@ struct dom_sid *samdb_result_sid_prefix(TALLOC_CTX *mem_ctx, const struct ldb_me
}
/*
pull a NTTIME in a result set.
pull a NTTIME in a result set.
*/
NTTIME samdb_result_nttime(const struct ldb_message *msg, const char *attr,
NTTIME default_value)
@ -447,13 +447,13 @@ NTTIME samdb_result_account_expires(const struct ldb_message *msg)
}
/*
construct the allow_password_change field from the PwdLastSet attribute and the
construct the allow_password_change field from the PwdLastSet attribute and the
domain password settings
*/
NTTIME samdb_result_allow_password_change(struct ldb_context *sam_ldb,
TALLOC_CTX *mem_ctx,
struct ldb_dn *domain_dn,
struct ldb_message *msg,
NTTIME samdb_result_allow_password_change(struct ldb_context *sam_ldb,
TALLOC_CTX *mem_ctx,
struct ldb_dn *domain_dn,
struct ldb_message *msg,
const char *attr)
{
uint64_t attr_time = ldb_msg_find_attr_as_uint64(msg, attr, 0);
@ -473,7 +473,7 @@ NTTIME samdb_result_allow_password_change(struct ldb_context *sam_ldb,
}
/*
pull a samr_Password structutre from a result set.
pull a samr_Password structutre from a result set.
*/
struct samr_Password *samdb_result_hash(TALLOC_CTX *mem_ctx, const struct ldb_message *msg, const char *attr)
{
@ -595,7 +595,7 @@ NTSTATUS samdb_result_passwords(TALLOC_CTX *mem_ctx,
}
/*
pull a samr_LogonHours structutre from a result set.
pull a samr_LogonHours structutre from a result set.
*/
struct samr_LogonHours samdb_result_logon_hours(TALLOC_CTX *mem_ctx, struct ldb_message *msg, const char *attr)
{
@ -623,7 +623,7 @@ struct samr_LogonHours samdb_result_logon_hours(TALLOC_CTX *mem_ctx, struct ldb_
}
/*
pull a set of account_flags from a result set.
pull a set of account_flags from a result set.
Naturally, this requires that userAccountControl and
(if not null) the attributes 'attr' be already
@ -690,8 +690,8 @@ NTSTATUS samdb_result_parameters(TALLOC_CTX *mem_ctx,
* behaviour: In particular, objectClass subclass equivalence is not
* wanted. This means that we should not lookup the schema for the
* comparison function */
struct ldb_message_element *samdb_find_attribute(struct ldb_context *ldb,
const struct ldb_message *msg,
struct ldb_message_element *samdb_find_attribute(struct ldb_context *ldb,
const struct ldb_message *msg,
const char *name, const char *value)
{
unsigned int i;
@ -765,7 +765,7 @@ int samdb_msg_add_dom_sid(struct ldb_context *sam_ldb, TALLOC_CTX *mem_ctx, stru
struct ldb_val v;
enum ndr_err_code ndr_err;
ndr_err = ndr_push_struct_blob(&v, mem_ctx,
ndr_err = ndr_push_struct_blob(&v, mem_ctx,
sid,
(ndr_push_flags_fn_t)ndr_push_dom_sid);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
@ -781,7 +781,7 @@ int samdb_msg_add_dom_sid(struct ldb_context *sam_ldb, TALLOC_CTX *mem_ctx, stru
int samdb_msg_add_delete(struct ldb_context *sam_ldb, TALLOC_CTX *mem_ctx, struct ldb_message *msg,
const char *attr_name)
{
/* we use an empty replace rather than a delete, as it allows for
/* we use an empty replace rather than a delete, as it allows for
dsdb_replace() to be used everywhere */
return ldb_msg_add_empty(msg, attr_name, LDB_FLAG_MOD_REPLACE, NULL);
}
@ -1178,7 +1178,7 @@ struct security_descriptor *samdb_default_security_descriptor(TALLOC_CTX *mem_ct
return sd;
}
struct ldb_dn *samdb_aggregate_schema_dn(struct ldb_context *sam_ctx, TALLOC_CTX *mem_ctx)
struct ldb_dn *samdb_aggregate_schema_dn(struct ldb_context *sam_ctx, TALLOC_CTX *mem_ctx)
{
struct ldb_dn *schema_dn = ldb_get_schema_basedn(sam_ctx);
struct ldb_dn *aggregate_dn;
@ -1313,7 +1313,7 @@ bool samdb_set_domain_sid(struct ldb_context *ldb, const struct dom_sid *dom_sid
struct dom_sid *dom_sid_old;
/* see if we have a cached copy */
dom_sid_old = talloc_get_type(ldb_get_opaque(ldb,
dom_sid_old = talloc_get_type(ldb_get_opaque(ldb,
"cache.domain_sid"), struct dom_sid);
tmp_ctx = talloc_new(ldb);
@ -1405,7 +1405,7 @@ bool samdb_set_ntds_settings_dn(struct ldb_context *ldb, struct ldb_dn *ntds_set
struct ldb_dn *ntds_settings_dn_old;
/* see if we have a forced copy from provision */
ntds_settings_dn_old = talloc_get_type(ldb_get_opaque(ldb,
ntds_settings_dn_old = talloc_get_type(ldb_get_opaque(ldb,
"forced.ntds_settings_dn"), struct ldb_dn);
tmp_ctx = talloc_new(ldb);
@ -1459,7 +1459,7 @@ struct ldb_dn *samdb_ntds_settings_dn(struct ldb_context *ldb, TALLOC_CTX *mem_c
ret = ldb_search(ldb, tmp_ctx, &root_res, ldb_dn_new(tmp_ctx, ldb, ""), LDB_SCOPE_BASE, root_attrs, NULL);
if (ret != LDB_SUCCESS) {
DEBUG(1,("Searching for dsServiceName in rootDSE failed: %s\n",
DEBUG(1,("Searching for dsServiceName in rootDSE failed: %s\n",
ldb_errstring(ldb)));
goto failed;
}
@ -1650,7 +1650,7 @@ struct ldb_dn *samdb_server_dn(struct ldb_context *ldb, TALLOC_CTX *mem_ctx)
dn = ldb_dn_get_parent(mem_ctx, samdb_ntds_settings_dn(ldb, tmp_ctx));
talloc_free(tmp_ctx);
return dn;
}
/*
@ -1818,7 +1818,7 @@ int samdb_reference_dn_is_our_ntdsa(struct ldb_context *ldb, struct ldb_dn *base
}
ret = samdb_dn_is_our_ntdsa(ldb, referenced_dn, is_ntdsa);
talloc_free(tmp_ctx);
return ret;
}
@ -2005,11 +2005,11 @@ bool samdb_is_pdc(struct ldb_context *ldb)
int ret;
bool is_pdc;
ret = samdb_reference_dn_is_our_ntdsa(ldb, ldb_get_default_basedn(ldb), "fsmoRoleOwner",
ret = samdb_reference_dn_is_our_ntdsa(ldb, ldb_get_default_basedn(ldb), "fsmoRoleOwner",
&is_pdc);
if (ret != LDB_SUCCESS) {
DEBUG(1,("Failed to find if we are the PDC for this ldb: Searching for fSMORoleOwner in %s failed: %s\n",
ldb_dn_get_linearized(ldb_get_default_basedn(ldb)),
DEBUG(1,("Failed to find if we are the PDC for this ldb: Searching for fSMORoleOwner in %s failed: %s\n",
ldb_dn_get_linearized(ldb_get_default_basedn(ldb)),
ldb_errstring(ldb)));
return false;
}
@ -2531,7 +2531,7 @@ NTSTATUS samdb_set_password_sid(struct ldb_context *ldb, TALLOC_CTX *mem_ctx,
const struct samr_Password *ntNewHash,
enum dsdb_password_checked old_password_checked,
enum samPwdChangeReason *reject_reason,
struct samr_DomInfo1 **_dominfo)
struct samr_DomInfo1 **_dominfo)
{
TALLOC_CTX *frame = talloc_stackframe();
NTSTATUS nt_status;
@ -2911,8 +2911,8 @@ NTSTATUS samdb_set_password_sid(struct ldb_context *ldb, TALLOC_CTX *mem_ctx,
}
NTSTATUS samdb_create_foreign_security_principal(struct ldb_context *sam_ctx, TALLOC_CTX *mem_ctx,
struct dom_sid *sid, struct ldb_dn **ret_dn)
NTSTATUS samdb_create_foreign_security_principal(struct ldb_context *sam_ctx, TALLOC_CTX *mem_ctx,
struct dom_sid *sid, struct ldb_dn **ret_dn)
{
struct ldb_message *msg;
struct ldb_dn *basedn = NULL;
@ -2960,7 +2960,7 @@ NTSTATUS samdb_create_foreign_security_principal(struct ldb_context *sam_ctx, TA
ret = ldb_add(sam_ctx, msg);
if (ret != LDB_SUCCESS) {
DEBUG(0,("Failed to create foreignSecurityPrincipal "
"record %s: %s\n",
"record %s: %s\n",
ldb_dn_get_linearized(msg->dn),
ldb_errstring(sam_ctx)));
talloc_free(sidstr);
@ -2978,7 +2978,7 @@ NTSTATUS samdb_create_foreign_security_principal(struct ldb_context *sam_ctx, TA
Find the DN of a domain, assuming it to be a dotted.dns name
*/
struct ldb_dn *samdb_dns_domain_to_dn(struct ldb_context *ldb, TALLOC_CTX *mem_ctx, const char *dns_domain)
struct ldb_dn *samdb_dns_domain_to_dn(struct ldb_context *ldb, TALLOC_CTX *mem_ctx, const char *dns_domain)
{
unsigned int i;
TALLOC_CTX *tmp_ctx = talloc_new(mem_ctx);
@ -3087,10 +3087,10 @@ char *samdb_ntds_msdcs_dns_name(struct ldb_context *samdb,
/*
Find the DN of a domain, be it the netbios or DNS name
Find the DN of a domain, be it the netbios or DNS name
*/
struct ldb_dn *samdb_domain_to_dn(struct ldb_context *ldb, TALLOC_CTX *mem_ctx,
const char *domain_name)
struct ldb_dn *samdb_domain_to_dn(struct ldb_context *ldb, TALLOC_CTX *mem_ctx,
const char *domain_name)
{
const char * const domain_ref_attrs[] = {
"ncName", NULL
@ -3102,11 +3102,11 @@ struct ldb_dn *samdb_domain_to_dn(struct ldb_context *ldb, TALLOC_CTX *mem_ctx,
char *escaped_domain = ldb_binary_encode_string(mem_ctx, domain_name);
/* find the domain's DN */
int ret_domain = ldb_search(ldb, mem_ctx,
&res_domain_ref,
samdb_partitions_dn(ldb, mem_ctx),
LDB_SCOPE_ONELEVEL,
&res_domain_ref,
samdb_partitions_dn(ldb, mem_ctx),
LDB_SCOPE_ONELEVEL,
domain_ref_attrs,
"(&(nETBIOSName=%s)(objectclass=crossRef))",
"(&(nETBIOSName=%s)(objectclass=crossRef))",
escaped_domain);
if (ret_domain != LDB_SUCCESS) {
return NULL;
@ -3114,7 +3114,7 @@ struct ldb_dn *samdb_domain_to_dn(struct ldb_context *ldb, TALLOC_CTX *mem_ctx,
if (res_domain_ref->count == 0) {
ret_domain = ldb_search(ldb, mem_ctx,
&res_domain_ref,
&res_domain_ref,
samdb_dns_domain_to_dn(ldb, mem_ctx, domain_name),
LDB_SCOPE_BASE,
domain_ref2_attrs,
@ -3130,7 +3130,7 @@ struct ldb_dn *samdb_domain_to_dn(struct ldb_context *ldb, TALLOC_CTX *mem_ctx,
}
if (res_domain_ref->count > 1) {
DEBUG(0,("Found %d records matching domain [%s]\n",
DEBUG(0,("Found %d records matching domain [%s]\n",
ret_domain, domain_name));
return NULL;
}
@ -3143,7 +3143,7 @@ struct ldb_dn *samdb_domain_to_dn(struct ldb_context *ldb, TALLOC_CTX *mem_ctx,
/*
use a GUID to find a DN
*/
int dsdb_find_dn_by_guid(struct ldb_context *ldb,
int dsdb_find_dn_by_guid(struct ldb_context *ldb,
TALLOC_CTX *mem_ctx,
const struct GUID *guid,
uint32_t dsdb_flags,
@ -3260,7 +3260,7 @@ done:
/*
use a DN to find a SID
*/
int dsdb_find_sid_by_dn(struct ldb_context *ldb,
int dsdb_find_sid_by_dn(struct ldb_context *ldb,
struct ldb_dn *dn, struct dom_sid *sid)
{
int ret;
@ -3377,9 +3377,9 @@ WERROR dsdb_loadreps(struct ldb_context *sam_ctx, TALLOC_CTX *mem_ctx, struct ld
for (i=0; i<(*count); i++) {
enum ndr_err_code ndr_err;
ndr_err = ndr_pull_struct_blob(&el->values[i],
mem_ctx,
&(*r)[i],
ndr_err = ndr_pull_struct_blob(&el->values[i],
mem_ctx,
&(*r)[i],
(ndr_pull_flags_fn_t)ndr_pull_repsFromToBlob);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
talloc_free(tmp_ctx);
@ -3388,7 +3388,7 @@ WERROR dsdb_loadreps(struct ldb_context *sam_ctx, TALLOC_CTX *mem_ctx, struct ld
}
talloc_free(tmp_ctx);
return WERR_OK;
}
@ -3419,8 +3419,8 @@ WERROR dsdb_savereps(struct ldb_context *sam_ctx, TALLOC_CTX *mem_ctx, struct ld
struct ldb_val v;
enum ndr_err_code ndr_err;
ndr_err = ndr_push_struct_blob(&v, tmp_ctx,
&r[i],
ndr_err = ndr_push_struct_blob(&v, tmp_ctx,
&r[i],
(ndr_push_flags_fn_t)ndr_push_repsFromToBlob);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
goto failed;
@ -3436,7 +3436,7 @@ WERROR dsdb_savereps(struct ldb_context *sam_ctx, TALLOC_CTX *mem_ctx, struct ld
}
talloc_free(tmp_ctx);
return WERR_OK;
failed:
@ -3483,7 +3483,7 @@ int dsdb_load_partition_usn(struct ldb_context *ldb, struct ldb_dn *dn,
}
p_ctrl->version = DSDB_CONTROL_CURRENT_PARTITION_VERSION;
p_ctrl->dn = dn;
ret = ldb_request_add_control(req,
DSDB_CONTROL_CURRENT_PARTITION_OID,
false, p_ctrl);
@ -3491,10 +3491,10 @@ int dsdb_load_partition_usn(struct ldb_context *ldb, struct ldb_dn *dn,
talloc_free(tmp_ctx);
return ret;
}
/* Run the new request */
ret = ldb_request(ldb, req);
if (ret == LDB_SUCCESS) {
ret = ldb_wait(req->handle, LDB_WAIT_ALL);
}
@ -3526,7 +3526,7 @@ int dsdb_load_partition_usn(struct ldb_context *ldb, struct ldb_dn *dn,
talloc_free(tmp_ctx);
return LDB_SUCCESS;
return LDB_SUCCESS;
}
int drsuapi_DsReplicaCursor2_compare(const struct drsuapi_DsReplicaCursor2 *c1,
@ -3756,7 +3756,7 @@ failed:
}
/*
return NTDS options flags. See MS-ADTS 7.1.1.2.2.1.2.1.1
return NTDS options flags. See MS-ADTS 7.1.1.2.2.1.2.1.1
flags are DS_NTDS_OPTION_*
*/
@ -4512,7 +4512,7 @@ int dsdb_request_add_controls(struct ldb_request *req, uint32_t dsdb_flags)
}
if (dsdb_flags & DSDB_PASSWORD_BYPASS_LAST_SET) {
/*
/*
* This must not be critical, as it will only be
* handled (and need to be handled) if the other
* attributes in the request bring password_hash into