diff options
-rw-r--r-- | source4/dsdb/samdb/cracknames.c | 36 | ||||
-rw-r--r-- | source4/rpc_server/common/common.h | 8 | ||||
-rw-r--r-- | source4/rpc_server/drsuapi/dcesrv_drsuapi.c | 8 | ||||
-rw-r--r-- | source4/rpc_server/lsa/dcesrv_lsa.c | 8 |
4 files changed, 26 insertions, 34 deletions
diff --git a/source4/dsdb/samdb/cracknames.c b/source4/dsdb/samdb/cracknames.c index 2b9e7e31f7..7d6fe70248 100644 --- a/source4/dsdb/samdb/cracknames.c +++ b/source4/dsdb/samdb/cracknames.c @@ -303,7 +303,7 @@ WERROR DsCrackNameOneName(struct ldb_context *sam_ctx, TALLOC_CTX *mem_ctx, char *str; str = talloc_strdup(mem_ctx, name); - WERR_TALLOC_CHECK(str); + W_ERROR_HAVE_NO_MEMORY(str); if (strlen(str) == 0 || str[strlen(str)-1] != '/') { info1->status = DRSUAPI_DS_NAME_STATUS_RESOLVE_ERROR; @@ -315,7 +315,7 @@ WERROR DsCrackNameOneName(struct ldb_context *sam_ctx, TALLOC_CTX *mem_ctx, domain_filter = talloc_asprintf(mem_ctx, "(&(&(&(dnsRoot=%s)(objectclass=crossRef)))(nETBIOSName=*)(ncName=*))", ldb_binary_encode_string(mem_ctx, str)); - WERR_TALLOC_CHECK(domain_filter); + W_ERROR_HAVE_NO_MEMORY(domain_filter); break; } @@ -325,7 +325,7 @@ WERROR DsCrackNameOneName(struct ldb_context *sam_ctx, TALLOC_CTX *mem_ctx, const char *account = NULL; domain = talloc_strdup(mem_ctx, name); - WERR_TALLOC_CHECK(domain); + W_ERROR_HAVE_NO_MEMORY(domain); p = strchr(domain, '\\'); if (!p) { @@ -342,11 +342,11 @@ WERROR DsCrackNameOneName(struct ldb_context *sam_ctx, TALLOC_CTX *mem_ctx, domain_filter = talloc_asprintf(mem_ctx, "(&(&(nETBIOSName=%s)(objectclass=crossRef))(ncName=*))", ldb_binary_encode_string(mem_ctx, domain)); - WERR_TALLOC_CHECK(domain_filter); + W_ERROR_HAVE_NO_MEMORY(domain_filter); if (account) { result_filter = talloc_asprintf(mem_ctx, "(sAMAccountName=%s)", ldb_binary_encode_string(mem_ctx, account)); - WERR_TALLOC_CHECK(result_filter); + W_ERROR_HAVE_NO_MEMORY(result_filter); } talloc_free(domain); @@ -383,7 +383,7 @@ WERROR DsCrackNameOneName(struct ldb_context *sam_ctx, TALLOC_CTX *mem_ctx, } result_filter = talloc_asprintf(mem_ctx, "(objectGUID=%s)", ldap_guid); - WERR_TALLOC_CHECK(result_filter); + W_ERROR_HAVE_NO_MEMORY(result_filter); break; } case DRSUAPI_DS_NAME_FORMAT_DISPLAY: { @@ -392,7 +392,7 @@ WERROR DsCrackNameOneName(struct ldb_context *sam_ctx, TALLOC_CTX *mem_ctx, result_filter = talloc_asprintf(mem_ctx, "(|(displayName=%s)(samAccountName=%s))", ldb_binary_encode_string(mem_ctx, name), ldb_binary_encode_string(mem_ctx, name)); - WERR_TALLOC_CHECK(result_filter); + W_ERROR_HAVE_NO_MEMORY(result_filter); break; } @@ -413,7 +413,7 @@ WERROR DsCrackNameOneName(struct ldb_context *sam_ctx, TALLOC_CTX *mem_ctx, } result_filter = talloc_asprintf(mem_ctx, "(objectSid=%s)", ldap_sid); - WERR_TALLOC_CHECK(result_filter); + W_ERROR_HAVE_NO_MEMORY(result_filter); break; } case DRSUAPI_DS_NAME_FORMAT_USER_PRINCIPAL: { @@ -438,7 +438,7 @@ WERROR DsCrackNameOneName(struct ldb_context *sam_ctx, TALLOC_CTX *mem_ctx, ldb_binary_encode_string(mem_ctx, unparsed_name)); free(unparsed_name); - WERR_TALLOC_CHECK(result_filter); + W_ERROR_HAVE_NO_MEMORY(result_filter); break; } case DRSUAPI_DS_NAME_FORMAT_SERVICE_PRINCIPAL: { @@ -461,7 +461,7 @@ WERROR DsCrackNameOneName(struct ldb_context *sam_ctx, TALLOC_CTX *mem_ctx, info1->dns_domain_name = talloc_strdup(info1, *realm); krb5_free_principal(smb_krb5_context->krb5_context, principal); - WERR_TALLOC_CHECK(info1->dns_domain_name); + W_ERROR_HAVE_NO_MEMORY(info1->dns_domain_name); info1->status = DRSUAPI_DS_NAME_STATUS_DOMAIN_ONLY; return WERR_OK; @@ -498,7 +498,7 @@ WERROR DsCrackNameOneName(struct ldb_context *sam_ctx, TALLOC_CTX *mem_ctx, } krb5_free_principal(smb_krb5_context->krb5_context, principal); free(unparsed_name_short); - WERR_TALLOC_CHECK(result_filter); + W_ERROR_HAVE_NO_MEMORY(result_filter); break; } @@ -644,7 +644,7 @@ static WERROR DsCrackNameOneFilter(struct ldb_context *sam_ctx, TALLOC_CTX *mem_ } info1->dns_domain_name = samdb_result_string(domain_res[0], "dnsRoot", NULL); - WERR_TALLOC_CHECK(info1->dns_domain_name); + W_ERROR_HAVE_NO_MEMORY(info1->dns_domain_name); info1->status = DRSUAPI_DS_NAME_STATUS_DOMAIN_ONLY; if (result_filter) { @@ -691,7 +691,7 @@ static WERROR DsCrackNameOneFilter(struct ldb_context *sam_ctx, TALLOC_CTX *mem_ switch (format_desired) { case DRSUAPI_DS_NAME_FORMAT_FQDN_1779: { info1->result_name = ldb_dn_linearize(mem_ctx, result_res[0]->dn); - WERR_TALLOC_CHECK(info1->result_name); + W_ERROR_HAVE_NO_MEMORY(info1->result_name); info1->status = DRSUAPI_DS_NAME_STATUS_OK; return WERR_OK; @@ -725,7 +725,7 @@ static WERROR DsCrackNameOneFilter(struct ldb_context *sam_ctx, TALLOC_CTX *mem_ return WERR_OK; } _dom = samdb_result_string(domain_res[0], "nETBIOSName", NULL); - WERR_TALLOC_CHECK(_dom); + W_ERROR_HAVE_NO_MEMORY(_dom); } else if (sid->num_auths == 5) { const char *attrs[] = { NULL }; @@ -749,14 +749,14 @@ static WERROR DsCrackNameOneFilter(struct ldb_context *sam_ctx, TALLOC_CTX *mem_ } _dom = samdb_result_string(domain_res2[0], "nETBIOSName", NULL); - WERR_TALLOC_CHECK(_dom); + W_ERROR_HAVE_NO_MEMORY(_dom); _acc = samdb_result_string(result_res[0], "sAMAccountName", NULL); - WERR_TALLOC_CHECK(_acc); + W_ERROR_HAVE_NO_MEMORY(_acc); } info1->result_name = talloc_asprintf(mem_ctx, "%s\\%s", _dom, _acc); - WERR_TALLOC_CHECK(info1->result_name); + W_ERROR_HAVE_NO_MEMORY(info1->result_name); info1->status = DRSUAPI_DS_NAME_STATUS_OK; return WERR_OK; @@ -767,7 +767,7 @@ static WERROR DsCrackNameOneFilter(struct ldb_context *sam_ctx, TALLOC_CTX *mem_ guid = samdb_result_guid(result_res[0], "objectGUID"); info1->result_name = GUID_string2(mem_ctx, &guid); - WERR_TALLOC_CHECK(info1->result_name); + W_ERROR_HAVE_NO_MEMORY(info1->result_name); info1->status = DRSUAPI_DS_NAME_STATUS_OK; return WERR_OK; diff --git a/source4/rpc_server/common/common.h b/source4/rpc_server/common/common.h index 5f0dd9127e..0dc3814c71 100644 --- a/source4/rpc_server/common/common.h +++ b/source4/rpc_server/common/common.h @@ -21,14 +21,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#define NTSTATUS_TALLOC_CHECK(x) do {\ - if (!(x)) return NT_STATUS_NO_MEMORY;\ -} while (0) - -#define WERR_TALLOC_CHECK(x) do {\ - if (!(x)) return WERR_NOMEM;\ -} while (0) - /* a useful macro for generating a RPC fault in the backend code */ #define DCESRV_FAULT(code) do { \ dce_call->fault_code = code; \ diff --git a/source4/rpc_server/drsuapi/dcesrv_drsuapi.c b/source4/rpc_server/drsuapi/dcesrv_drsuapi.c index 6bfcfb2017..11ad149044 100644 --- a/source4/rpc_server/drsuapi/dcesrv_drsuapi.c +++ b/source4/rpc_server/drsuapi/dcesrv_drsuapi.c @@ -42,7 +42,7 @@ static WERROR drsuapi_DsBind(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem ZERO_STRUCTP(r->out.bind_handle); b_state = talloc(dce_call->conn, struct drsuapi_bind_state); - WERR_TALLOC_CHECK(b_state); + W_ERROR_HAVE_NO_MEMORY(b_state); b_state->sam_ctx = samdb_connect(b_state, dce_call->conn->auth_state.session_info); if (!b_state->sam_ctx) { @@ -59,7 +59,7 @@ static WERROR drsuapi_DsBind(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem handle->data = talloc_steal(handle, b_state); bind_info = talloc(mem_ctx, struct drsuapi_DsBindInfoCtr); - WERR_TALLOC_CHECK(bind_info); + W_ERROR_HAVE_NO_MEMORY(bind_info); ZERO_STRUCT(site_guid); @@ -224,11 +224,11 @@ WERROR drsuapi_DsCrackNames(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ int i; ctr1 = talloc(mem_ctx, struct drsuapi_DsNameCtr1); - WERR_TALLOC_CHECK(ctr1); + W_ERROR_HAVE_NO_MEMORY(ctr1); count = r->in.req.req1.count; names = talloc_array(mem_ctx, struct drsuapi_DsNameInfo1, count); - WERR_TALLOC_CHECK(names); + W_ERROR_HAVE_NO_MEMORY(names); for (i=0; i < count; i++) { status = DsCrackNameOneName(b_state->sam_ctx, mem_ctx, diff --git a/source4/rpc_server/lsa/dcesrv_lsa.c b/source4/rpc_server/lsa/dcesrv_lsa.c index 9d3b55c9e6..ff819985a8 100644 --- a/source4/rpc_server/lsa/dcesrv_lsa.c +++ b/source4/rpc_server/lsa/dcesrv_lsa.c @@ -1088,7 +1088,7 @@ static NTSTATUS lsa_lookup_sid(struct lsa_policy_state *state, TALLOC_CTX *mem_c *name = ldb_msg_find_string(res[0], "name", NULL); if (!*name) { *name = talloc_strdup(mem_ctx, sid_str); - NTSTATUS_TALLOC_CHECK(*name); + NT_STATUS_HAVE_NO_MEMORY(*name); } } @@ -2425,14 +2425,14 @@ static NTSTATUS lsa_GetUserName(struct dcesrv_call_state *dce_call, TALLOC_CTX * authority_name = talloc_reference(mem_ctx, dce_call->conn->auth_state.session_info->server_info->domain_name); _account_name = talloc(mem_ctx, struct lsa_String); - NTSTATUS_TALLOC_CHECK(_account_name); + NT_STATUS_HAVE_NO_MEMORY(_account_name); _account_name->string = account_name; if (r->in.authority_name) { _authority_name = talloc(mem_ctx, struct lsa_StringPointer); - NTSTATUS_TALLOC_CHECK(_authority_name); + NT_STATUS_HAVE_NO_MEMORY(_authority_name); _authority_name->string = talloc(mem_ctx, struct lsa_String); - NTSTATUS_TALLOC_CHECK(_authority_name->string); + NT_STATUS_HAVE_NO_MEMORY(_authority_name->string); _authority_name->string->string = authority_name; } |