From a6cf89228f2daf5a95284ec57b9c38326e5574dc Mon Sep 17 00:00:00 2001 From: =?utf8?q?Matthias=20Dieter=20Walln=C3=B6fer?= Date: Sat, 21 Nov 2009 19:26:02 +0100 Subject: [PATCH] s4:lsa RPC - Change some counters to be "unsigned" where needed The "count" size specifiers I typed "uint32_t" since they're often returned as an "uint32_t" (consider the IDL file). LDB counters need to be "signed" if they count till a limit of a "gendb*" call or "unsigned" if they count directly the number of objects. --- source4/rpc_server/lsa/dcesrv_lsa.c | 29 ++++++++++++++++------------- source4/rpc_server/lsa/lsa_lookup.c | 16 ++++++++-------- 2 files changed, 24 insertions(+), 21 deletions(-) diff --git a/source4/rpc_server/lsa/dcesrv_lsa.c b/source4/rpc_server/lsa/dcesrv_lsa.c index 6a5a9074b28..937ae70a33b 100644 --- a/source4/rpc_server/lsa/dcesrv_lsa.c +++ b/source4/rpc_server/lsa/dcesrv_lsa.c @@ -286,7 +286,7 @@ static NTSTATUS dcesrv_lsa_EnumPrivs(struct dcesrv_call_state *dce_call, TALLOC_ { struct dcesrv_handle *h; struct lsa_policy_state *state; - int i; + uint32_t i; const char *privname; DCESRV_PULL_HANDLE(h, r->in.handle, LSA_HANDLE_POLICY); @@ -682,10 +682,10 @@ static NTSTATUS dcesrv_lsa_EnumAccounts(struct dcesrv_call_state *dce_call, TALL { struct dcesrv_handle *h; struct lsa_policy_state *state; - int ret, i; + int ret; struct ldb_message **res; const char * const attrs[] = { "objectSid", NULL}; - uint32_t count; + uint32_t count, i; DCESRV_PULL_HANDLE(h, r->in.handle, LSA_HANDLE_POLICY); @@ -823,7 +823,7 @@ static NTSTATUS dcesrv_lsa_CreateTrustedDomain_base(struct dcesrv_call_state *dc } if (auth_struct.incoming.count) { - int i; + uint32_t i; struct trustAuthInOutBlob incoming; incoming.count = auth_struct.incoming.count; @@ -862,7 +862,7 @@ static NTSTATUS dcesrv_lsa_CreateTrustedDomain_base(struct dcesrv_call_state *dc } if (auth_struct.outgoing.count) { - int i; + uint32_t i; struct trustAuthInOutBlob outgoing; outgoing.count = auth_struct.outgoing.count; @@ -1046,7 +1046,7 @@ static NTSTATUS dcesrv_lsa_CreateTrustedDomain_base(struct dcesrv_call_state *dc } if (auth_struct.incoming.count) { - int i; + uint32_t i; for (i=0; i < auth_struct.incoming.count; i++ ) { if (auth_struct.incoming.current[i]->AuthType == TRUST_AUTH_TYPE_NT4OWF) { samdb_msg_add_hash(sam_ldb, @@ -1815,7 +1815,8 @@ static NTSTATUS dcesrv_lsa_EnumPrivsAccount(struct dcesrv_call_state *dce_call, { struct dcesrv_handle *h; struct lsa_account_state *astate; - int ret, i; + int ret; + unsigned int i; struct ldb_message **res; const char * const attrs[] = { "privilege", NULL}; struct ldb_message_element *el; @@ -1882,7 +1883,8 @@ static NTSTATUS dcesrv_lsa_EnumAccountRights(struct dcesrv_call_state *dce_call, { struct dcesrv_handle *h; struct lsa_policy_state *state; - int ret, i; + int ret; + unsigned int i; struct ldb_message **res; const char * const attrs[] = { "privilege", NULL}; const char *sidstr; @@ -1946,7 +1948,8 @@ static NTSTATUS dcesrv_lsa_AddRemoveAccountRights(struct dcesrv_call_state *dce_ const char *sidstr, *sidndrstr; struct ldb_message *msg; struct ldb_message_element *el; - int i, ret; + int ret; + uint32_t i; struct lsa_EnumAccountRights r2; char *dnstr; @@ -1993,7 +1996,7 @@ static NTSTATUS dcesrv_lsa_AddRemoveAccountRights(struct dcesrv_call_state *dce_ } if (ldb_flag == LDB_FLAG_MOD_ADD) { - int j; + uint32_t j; for (j=0;jcount;j++) { if (strcasecmp_m(r2.out.rights->names[j].string, rights->names[i].string) == 0) { @@ -2052,7 +2055,7 @@ static NTSTATUS dcesrv_lsa_AddPrivilegesToAccount(struct dcesrv_call_state *dce_ struct lsa_RightSet rights; struct dcesrv_handle *h; struct lsa_account_state *astate; - int i; + uint32_t i; DCESRV_PULL_HANDLE(h, r->in.handle, LSA_HANDLE_ACCOUNT); @@ -2089,7 +2092,7 @@ static NTSTATUS dcesrv_lsa_RemovePrivilegesFromAccount(struct dcesrv_call_state struct lsa_RightSet *rights; struct dcesrv_handle *h; struct lsa_account_state *astate; - int i; + uint32_t i; DCESRV_PULL_HANDLE(h, r->in.handle, LSA_HANDLE_ACCOUNT); @@ -2168,7 +2171,7 @@ static NTSTATUS dcesrv_lsa_SetQuotasForAccount(struct dcesrv_call_state *dce_cal static NTSTATUS dcesrv_lsa_GetSystemAccessAccount(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct lsa_GetSystemAccessAccount *r) { - int i; + uint32_t i; NTSTATUS status; struct lsa_EnumPrivsAccount enumPrivs; struct lsa_PrivilegeSet *privs; diff --git a/source4/rpc_server/lsa/lsa_lookup.c b/source4/rpc_server/lsa/lsa_lookup.c index b044eea105d..7e13f4e18a1 100644 --- a/source4/rpc_server/lsa/lsa_lookup.c +++ b/source4/rpc_server/lsa/lsa_lookup.c @@ -195,7 +195,7 @@ static NTSTATUS lookup_well_known_names(TALLOC_CTX *mem_ctx, const char *domain, const char *name, const char **authority_name, struct dom_sid **sid, uint32_t *rtype) { - int i; + unsigned int i; for (i=0; well_known[i].sid; i++) { if (domain) { if (strcasecmp_m(domain, well_known[i].domain) == 0 @@ -221,7 +221,7 @@ static NTSTATUS lookup_well_known_sids(TALLOC_CTX *mem_ctx, const char *sid_str, const char **authority_name, const char **name, uint32_t *rtype) { - int i; + unsigned int i; for (i=0; well_known[i].sid; i++) { if (strcasecmp_m(sid_str, well_known[i].sid) == 0) { *authority_name = well_known[i].domain; @@ -441,7 +441,7 @@ static NTSTATUS dcesrv_lsa_authority_list(struct lsa_policy_state *state, TALLOC uint32_t *sid_index) { struct dom_sid *authority_sid; - int i; + uint32_t i; if (rtype != SID_NAME_DOMAIN) { authority_sid = dom_sid_dup(mem_ctx, sid); @@ -545,7 +545,7 @@ NTSTATUS dcesrv_lsa_LookupSids2(struct dcesrv_call_state *dce_call, { struct lsa_policy_state *state; struct lsa_RefDomainList *domains = NULL; - int i; + uint32_t i; NTSTATUS status = NT_STATUS_OK; if (r->in.level < LSA_LOOKUP_NAMES_ALL || @@ -704,7 +704,7 @@ NTSTATUS dcesrv_lsa_LookupSids(struct dcesrv_call_state *dce_call, TALLOC_CTX *m { struct lsa_LookupSids2 r2; NTSTATUS status; - int i; + uint32_t i; ZERO_STRUCT(r2); @@ -758,7 +758,7 @@ NTSTATUS dcesrv_lsa_LookupNames3(struct dcesrv_call_state *dce_call, { struct lsa_policy_state *policy_state; struct dcesrv_handle *policy_handle; - int i; + uint32_t i; struct loadparm_context *lp_ctx = dce_call->conn->dce_ctx->lp_ctx; struct lsa_RefDomainList *domains; @@ -900,7 +900,7 @@ NTSTATUS dcesrv_lsa_LookupNames2(struct dcesrv_call_state *dce_call, { struct lsa_policy_state *state; struct dcesrv_handle *h; - int i; + uint32_t i; struct loadparm_context *lp_ctx = dce_call->conn->dce_ctx->lp_ctx; struct lsa_RefDomainList *domains; @@ -989,7 +989,7 @@ NTSTATUS dcesrv_lsa_LookupNames(struct dcesrv_call_state *dce_call, TALLOC_CTX * { struct lsa_LookupNames2 r2; NTSTATUS status; - int i; + uint32_t i; ZERO_STRUCT(r2); -- 2.11.4.GIT