s3-talloc Change TALLOC_ARRAY() to talloc_array()
[samba.git] / source3 / rpc_server / lsa / srv_lsa_nt.c
index ca05a1ae70f095d868ba8e23966dbc134d45cc8e..a120c6e7fe9c5c2e563c44aee7db27ab43192d93 100644 (file)
@@ -30,6 +30,7 @@
 /* This is the implementation of the lsa server code. */
 
 #include "includes.h"
+#include "ntdomain.h"
 #include "../librpc/gen_ndr/srv_lsa.h"
 #include "secrets.h"
 #include "../librpc/gen_ndr/netlogon.h"
@@ -43,8 +44,8 @@
 #include "../librpc/gen_ndr/ndr_security.h"
 #include "passdb.h"
 #include "auth.h"
-#include "ntdomain.h"
 #include "lib/privileges.h"
+#include "rpc_server/srv_access_check.h"
 
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_RPC_SRV
@@ -121,7 +122,7 @@ static int init_lsa_ref_domain_list(TALLOC_CTX *mem_ctx,
        ref->count = num + 1;
        ref->max_size = LSA_REF_DOMAIN_LIST_MULTIPLIER;
 
-       ref->domains = TALLOC_REALLOC_ARRAY(mem_ctx, ref->domains,
+       ref->domains = talloc_realloc(mem_ctx, ref->domains,
                                            struct lsa_DomainInfo, ref->count);
        if (!ref->domains) {
                return -1;
@@ -857,7 +858,7 @@ static NTSTATUS _lsa_lookup_sids_internal(struct pipes_struct *p,
                return NT_STATUS_OK;
        }
 
-       sids = TALLOC_ARRAY(p->mem_ctx, const struct dom_sid *, num_sids);
+       sids = talloc_array(p->mem_ctx, const struct dom_sid *, num_sids);
        ref = TALLOC_ZERO_P(p->mem_ctx, struct lsa_RefDomainList);
 
        if (sids == NULL || ref == NULL) {
@@ -875,7 +876,7 @@ static NTSTATUS _lsa_lookup_sids_internal(struct pipes_struct *p,
                return status;
        }
 
-       names = TALLOC_ARRAY(p->mem_ctx, struct lsa_TranslatedName2, num_sids);
+       names = talloc_array(p->mem_ctx, struct lsa_TranslatedName2, num_sids);
        if (names == NULL) {
                return NT_STATUS_NO_MEMORY;
        }
@@ -997,7 +998,7 @@ NTSTATUS _lsa_LookupSids(struct pipes_struct *p,
        }
 
        /* Convert from lsa_TranslatedName2 to lsa_TranslatedName */
-       names_out = TALLOC_ARRAY(p->mem_ctx, struct lsa_TranslatedName,
+       names_out = talloc_array(p->mem_ctx, struct lsa_TranslatedName,
                                 num_sids);
        if (!names_out) {
                return NT_STATUS_NO_MEMORY;
@@ -1256,7 +1257,7 @@ NTSTATUS _lsa_LookupNames2(struct pipes_struct *p,
        status = _lsa_LookupNames(p, &q);
 
        sid_array2->count = sid_array->count;
-       sid_array2->sids = TALLOC_ARRAY(p->mem_ctx, struct lsa_TranslatedSid2, sid_array->count);
+       sid_array2->sids = talloc_array(p->mem_ctx, struct lsa_TranslatedSid2, sid_array->count);
        if (!sid_array2->sids) {
                return NT_STATUS_NO_MEMORY;
        }
@@ -1750,7 +1751,7 @@ NTSTATUS _lsa_CreateTrustedDomainEx2(struct pipes_struct *p,
                auth_blob.data = r->in.auth_info->auth_blob.data;
 
                arcfour_crypt_blob(auth_blob.data, auth_blob.length,
-                                  &p->session_info->user_session_key);
+                                  &p->session_info->session_key);
 
                ndr_err = ndr_pull_struct_blob(&auth_blob, p->mem_ctx,
                                               &auth_struct,
@@ -3487,7 +3488,7 @@ static int dns_cmp(const char *s1, size_t l1,
        int cret;
 
        if (l1 == l2) {
-               if (StrCaseCmp(s1, s2) == 0) {
+               if (strcasecmp_m(s1, s2) == 0) {
                        return DNS_CMP_MATCH;
                }
                return DNS_CMP_NO_MATCH;
@@ -3511,7 +3512,7 @@ static int dns_cmp(const char *s1, size_t l1,
                return DNS_CMP_NO_MATCH;
        }
 
-       if (StrCaseCmp(&p1[t1 - t2], p2) == 0) {
+       if (strcasecmp_m(&p1[t1 - t2], p2) == 0) {
                return cret;
        }
 
@@ -3663,6 +3664,7 @@ static NTSTATUS check_ft_info(TALLOC_CTX *mem_ctx,
                                ex_rule = false;
                                tname = trec->data.info.dns_name.string;
                                tlen = trec->data.info.dns_name.size;
+                               break;
                        default:
                                return NT_STATUS_INVALID_PARAMETER;
                        }
@@ -3699,7 +3701,7 @@ static NTSTATUS check_ft_info(TALLOC_CTX *mem_ctx,
                                sid_conflict = true;
                        }
                        if (!(trec->flags & LSA_NB_DISABLED_ADMIN) &&
-                           StrCaseCmp(trec->data.info.netbios_name.string,
+                           strcasecmp_m(trec->data.info.netbios_name.string,
                                       nb_name) == 0) {
                                nb_conflict = true;
                        }
@@ -3874,7 +3876,7 @@ NTSTATUS _lsa_lsaRSetForestTrustInformation(struct pipes_struct *p,
                if (domains[i]->domain_name == NULL) {
                        return NT_STATUS_INVALID_DOMAIN_STATE;
                }
-               if (StrCaseCmp(domains[i]->domain_name,
+               if (strcasecmp_m(domains[i]->domain_name,
                               r->in.trusted_domain_name->string) == 0) {
                        break;
                }