#include "rpc_client/util_netlogon.h"
#include "libsmb/dsgetdcname.h"
#include "lib/global_contexts.h"
+#include "libcli/lsarpc/util_lsarpc.h"
NTSTATUS _wbint_Ping(struct pipes_struct *p, struct wbint_Ping *r)
{
}
if (new_fti != NULL) {
- struct lsa_ForestTrustInformation old_fti = {};
+ struct lsa_ForestTrustInformation2 old_fti = {};
+ struct lsa_ForestTrustInformation2 *new_fti2 = NULL;
+ struct lsa_ForestTrustInformation2 *merged_fti2 = NULL;
struct lsa_ForestTrustInformation *merged_fti = NULL;
struct lsa_ForestTrustCollisionInfo *collision_info = NULL;
- status = dsdb_trust_merge_forest_info(frame, local_tdo,
- &old_fti, new_fti,
- &merged_fti);
+ status = trust_forest_info_lsa_1to2(frame,
+ new_fti,
+ &new_fti2);
+ if (!NT_STATUS_IS_OK(status)) {
+ TALLOC_FREE(frame);
+ return ntstatus_to_werror(status);
+ }
+
+ status = dsdb_trust_merge_forest_info(frame,
+ local_tdo,
+ &old_fti,
+ new_fti2,
+ &merged_fti2);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("%s:%s: dsdb_trust_merge_forest_info(%s) failed %s\n",
__location__, __func__,
return ntstatus_to_werror(status);
}
+ status = trust_forest_info_lsa_2to1(frame,
+ merged_fti2,
+ &merged_fti);
+ if (!NT_STATUS_IS_OK(status)) {
+ TALLOC_FREE(frame);
+ return ntstatus_to_werror(status);
+ }
+
status = dcerpc_lsa_lsaRSetForestTrustInformation(local_lsa, frame,
&local_lsa_policy,
&trusted_domain_name_l,
struct lsa_ForestTrustInformation *old_fti = NULL;
struct lsa_ForestTrustInformation *new_fti = NULL;
struct lsa_ForestTrustInformation *merged_fti = NULL;
+ struct lsa_ForestTrustInformation2 *old_fti2 = NULL;
+ struct lsa_ForestTrustInformation2 *new_fti2 = NULL;
+ struct lsa_ForestTrustInformation2 *merged_fti2 = NULL;
struct lsa_ForestTrustCollisionInfo *collision_info = NULL;
bool update_fti = false;
struct rpc_pipe_client *local_lsa_pipe;
goto done;
}
- status = dsdb_trust_merge_forest_info(frame, tdo, old_fti, new_fti,
- &merged_fti);
+ status = trust_forest_info_lsa_1to2(frame,
+ old_fti,
+ &old_fti2);
+ if (!NT_STATUS_IS_OK(status)) {
+ TALLOC_FREE(frame);
+ return ntstatus_to_werror(status);
+ }
+ status = trust_forest_info_lsa_1to2(frame,
+ new_fti,
+ &new_fti2);
+ if (!NT_STATUS_IS_OK(status)) {
+ TALLOC_FREE(frame);
+ return ntstatus_to_werror(status);
+ }
+
+ status = dsdb_trust_merge_forest_info(frame,
+ tdo,
+ old_fti2,
+ new_fti2,
+ &merged_fti2);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("%s:%s: dsdb_trust_merge_forest_info(%s) failed %s\n",
__location__, __func__, domain->name, nt_errstr(status)));
return ntstatus_to_werror(status);
}
+ status = trust_forest_info_lsa_2to1(frame,
+ merged_fti2,
+ &merged_fti);
+ if (!NT_STATUS_IS_OK(status)) {
+ TALLOC_FREE(frame);
+ return ntstatus_to_werror(status);
+ }
+
status = dcerpc_lsa_lsaRSetForestTrustInformation(local_lsa, frame,
&local_lsa_policy,
&trusted_domain_name_l,
#undef strcasecmp
-
-static NTSTATUS dsdb_trust_forest_info_add_record(struct lsa_ForestTrustInformation *fti,
- const struct lsa_ForestTrustRecord *ftr)
+static NTSTATUS dsdb_trust_forest_info_add_record(struct lsa_ForestTrustInformation2 *fti,
+ const struct lsa_ForestTrustRecord2 *ftr)
{
- struct lsa_ForestTrustRecord **es = NULL;
- struct lsa_ForestTrustRecord *e = NULL;
+ struct lsa_ForestTrustRecord2 **es = NULL;
+ struct lsa_ForestTrustRecord2 *e = NULL;
const struct lsa_StringLarge *dns1 = NULL;
struct lsa_StringLarge *dns2 = NULL;
const struct lsa_ForestTrustDomainInfo *d1 = NULL;
size_t len = 0;
es = talloc_realloc(fti, fti->entries,
- struct lsa_ForestTrustRecord *,
+ struct lsa_ForestTrustRecord2 *,
fti->count + 1);
if (!es) {
return NT_STATUS_NO_MEMORY;
}
fti->entries = es;
- e = talloc_zero(es, struct lsa_ForestTrustRecord);
+ e = talloc_zero(es, struct lsa_ForestTrustRecord2);
if (e == NULL) {
return NT_STATUS_NO_MEMORY;
}
NTSTATUS dsdb_trust_xref_forest_info(TALLOC_CTX *mem_ctx,
struct ldb_context *sam_ctx,
- struct lsa_ForestTrustInformation **_info)
+ struct lsa_ForestTrustInformation2 **_info)
{
TALLOC_CTX *frame = talloc_stackframe();
- struct lsa_ForestTrustInformation *info = NULL;
+ struct lsa_ForestTrustInformation2 *info = NULL;
struct ldb_dn *partitions_dn = NULL;
const char * const cross_attrs1[] = {
"uPNSuffixes",
bool restart = false;
*_info = NULL;
- info = talloc_zero(mem_ctx, struct lsa_ForestTrustInformation);
+ info = talloc_zero(mem_ctx, struct lsa_ForestTrustInformation2);
if (info == NULL) {
TALLOC_FREE(frame);
return NT_STATUS_NO_MEMORY;
struct dom_sid sid = {
.num_auths = 0,
};
- struct lsa_ForestTrustRecord e = {
+ struct lsa_ForestTrustRecord2 e = {
.flags = 0,
};
struct lsa_ForestTrustDomainInfo *d = NULL;
/*
* First the TOP_LEVEL_NAME, if required
*/
- e = (struct lsa_ForestTrustRecord) {
+ e = (struct lsa_ForestTrustRecord2) {
.flags = 0,
.type = LSA_FOREST_TRUST_TOP_LEVEL_NAME,
.time = 0, /* so far always 0 in traces. */
/*
* Then the DOMAIN_INFO
*/
- e = (struct lsa_ForestTrustRecord) {
+ e = (struct lsa_ForestTrustRecord2) {
.flags = 0,
.type = LSA_FOREST_TRUST_DOMAIN_INFO,
.time = 0, /* so far always 0 in traces. */
for (i=0; (tln_el != NULL) && i < tln_el->num_values; i++) {
const struct ldb_val *v = &tln_el->values[i];
const char *dns = (const char *)v->data;
- struct lsa_ForestTrustRecord e = {
+ struct lsa_ForestTrustRecord2 e = {
.flags = 0,
};
struct lsa_StringLarge *t = NULL;
/*
* an additional the TOP_LEVEL_NAME
*/
- e = (struct lsa_ForestTrustRecord) {
+ e = (struct lsa_ForestTrustRecord2) {
.flags = 0,
.type = LSA_FOREST_TRUST_TOP_LEVEL_NAME,
.time = 0, /* so far always 0 in traces. */
}
for (i=0; i < info->count; restart ? i=0 : i++) {
- struct lsa_ForestTrustRecord *tr = info->entries[i];
+ struct lsa_ForestTrustRecord2 *tr = info->entries[i];
const struct lsa_StringLarge *ts = NULL;
uint32_t c;
ts = &tr->forest_trust_data.top_level_name;
for (c = i + 1; c < info->count; c++) {
- struct lsa_ForestTrustRecord *cr = info->entries[c];
+ struct lsa_ForestTrustRecord2 *cr = info->entries[c];
const struct lsa_StringLarge *cs = NULL;
uint32_t j;
int cmp;
}
NTSTATUS dsdb_trust_normalize_forest_info_step1(TALLOC_CTX *mem_ctx,
- const struct lsa_ForestTrustInformation *gfti,
- struct lsa_ForestTrustInformation **_nfti)
+ const struct lsa_ForestTrustInformation2 *gfti,
+ struct lsa_ForestTrustInformation2 **_nfti)
{
TALLOC_CTX *frame = talloc_stackframe();
- struct lsa_ForestTrustInformation *nfti;
+ struct lsa_ForestTrustInformation2 *nfti;
uint32_t n;
*_nfti = NULL;
- nfti = talloc_zero(mem_ctx, struct lsa_ForestTrustInformation);
+ nfti = talloc_zero(mem_ctx, struct lsa_ForestTrustInformation2);
if (nfti == NULL) {
TALLOC_FREE(frame);
return NT_STATUS_NO_MEMORY;
* provide the correct index for collision records.
*/
for (n = 0; n < gfti->count; n++) {
- const struct lsa_ForestTrustRecord *gftr = gfti->entries[n];
- struct lsa_ForestTrustRecord *nftr = NULL;
+ const struct lsa_ForestTrustRecord2 *gftr = gfti->entries[n];
+ struct lsa_ForestTrustRecord2 *nftr = NULL;
struct lsa_ForestTrustDomainInfo *ninfo = NULL;
struct lsa_StringLarge *ntln = NULL;
struct lsa_StringLarge *nnb = NULL;
}
for (c = 0; c < n; c++) {
- const struct lsa_ForestTrustRecord *cftr = nfti->entries[c];
+ const struct lsa_ForestTrustRecord2 *cftr = nfti->entries[c];
const struct lsa_ForestTrustDomainInfo *cinfo = NULL;
const struct lsa_StringLarge *ctln = NULL;
const struct lsa_StringLarge *cnb = NULL;
* Now we check that only true top level names are provided
*/
for (n = 0; n < nfti->count; n++) {
- const struct lsa_ForestTrustRecord *nftr = nfti->entries[n];
+ const struct lsa_ForestTrustRecord2 *nftr = nfti->entries[n];
const struct lsa_StringLarge *ntln = NULL;
uint32_t c;
ntln = &nftr->forest_trust_data.top_level_name;
for (c = 0; c < nfti->count; c++) {
- const struct lsa_ForestTrustRecord *cftr = nfti->entries[c];
+ const struct lsa_ForestTrustRecord2 *cftr = nfti->entries[c];
const struct lsa_StringLarge *ctln = NULL;
int cmp;
* Now we check that only true sub level excludes are provided
*/
for (n = 0; n < nfti->count; n++) {
- const struct lsa_ForestTrustRecord *nftr = nfti->entries[n];
+ const struct lsa_ForestTrustRecord2 *nftr = nfti->entries[n];
const struct lsa_StringLarge *ntln = NULL;
uint32_t c;
bool found_tln = false;
ntln = &nftr->forest_trust_data.top_level_name;
for (c = 0; c < nfti->count; c++) {
- const struct lsa_ForestTrustRecord *cftr = nfti->entries[c];
+ const struct lsa_ForestTrustRecord2 *cftr = nfti->entries[c];
const struct lsa_StringLarge *ctln = NULL;
int cmp;
* Now we check that there's a top level name for each domain
*/
for (n = 0; n < nfti->count; n++) {
- const struct lsa_ForestTrustRecord *nftr = nfti->entries[n];
+ const struct lsa_ForestTrustRecord2 *nftr = nfti->entries[n];
const struct lsa_ForestTrustDomainInfo *ninfo = NULL;
const struct lsa_StringLarge *ntln = NULL;
uint32_t c;
ntln = &ninfo->dns_domain_name;
for (c = 0; c < nfti->count; c++) {
- const struct lsa_ForestTrustRecord *cftr = nfti->entries[c];
+ const struct lsa_ForestTrustRecord2 *cftr = nfti->entries[c];
const struct lsa_StringLarge *ctln = NULL;
int cmp;
}
NTSTATUS dsdb_trust_normalize_forest_info_step2(TALLOC_CTX *mem_ctx,
- const struct lsa_ForestTrustInformation *gfti,
- struct lsa_ForestTrustInformation **_nfti)
+ const struct lsa_ForestTrustInformation2 *gfti,
+ struct lsa_ForestTrustInformation2 **_nfti)
{
TALLOC_CTX *frame = talloc_stackframe();
struct timeval tv = timeval_current();
NTTIME now = timeval_to_nttime(&tv);
- struct lsa_ForestTrustInformation *nfti;
+ struct lsa_ForestTrustInformation2 *nfti;
uint32_t g;
*_nfti = NULL;
- nfti = talloc_zero(mem_ctx, struct lsa_ForestTrustInformation);
+ nfti = talloc_zero(mem_ctx, struct lsa_ForestTrustInformation2);
if (nfti == NULL) {
TALLOC_FREE(frame);
return NT_STATUS_NO_MEMORY;
*/
for (g = 0; g < gfti->count; g++) {
- const struct lsa_ForestTrustRecord *gftr = gfti->entries[gfti->count - (g+1)];
- struct lsa_ForestTrustRecord tftr;
+ const struct lsa_ForestTrustRecord2 *gftr = gfti->entries[gfti->count - (g+1)];
+ struct lsa_ForestTrustRecord2 tftr;
bool skip = false;
NTSTATUS status;
}
for (g = 0; g < gfti->count; g++) {
- const struct lsa_ForestTrustRecord *gftr = gfti->entries[gfti->count - (g+1)];
- struct lsa_ForestTrustRecord tftr;
+ const struct lsa_ForestTrustRecord2 *gftr = gfti->entries[gfti->count - (g+1)];
+ struct lsa_ForestTrustRecord2 tftr;
bool skip = false;
NTSTATUS status;
}
NTSTATUS dsdb_trust_verify_forest_info(const struct lsa_TrustDomainInfoInfoEx *ref_tdo,
- const struct lsa_ForestTrustInformation *ref_fti,
+ const struct lsa_ForestTrustInformation2 *ref_fti,
enum lsa_ForestTrustCollisionRecordType collision_type,
struct lsa_ForestTrustCollisionInfo *c_info,
- struct lsa_ForestTrustInformation *new_fti)
+ struct lsa_ForestTrustInformation2 *new_fti)
{
uint32_t n;
for (n = 0; n < new_fti->count; n++) {
- struct lsa_ForestTrustRecord *nftr = new_fti->entries[n];
+ struct lsa_ForestTrustRecord2 *nftr = new_fti->entries[n];
struct lsa_StringLarge *ntln = NULL;
bool ntln_excluded = false;
uint32_t flags = 0;
/* check if this is already taken and not excluded */
for (r = 0; r < ref_fti->count; r++) {
- const struct lsa_ForestTrustRecord *rftr =
+ const struct lsa_ForestTrustRecord2 *rftr =
ref_fti->entries[r];
const struct lsa_StringLarge *rtln = NULL;
int cmp;
}
for (n = 0; n < new_fti->count; n++) {
- struct lsa_ForestTrustRecord *nftr = new_fti->entries[n];
+ struct lsa_ForestTrustRecord2 *nftr = new_fti->entries[n];
struct lsa_ForestTrustDomainInfo *ninfo = NULL;
struct lsa_StringLarge *ntln = NULL;
struct lsa_StringLarge *nnb = NULL;
/* check if this is already taken and not excluded */
for (r = 0; r < ref_fti->count; r++) {
- const struct lsa_ForestTrustRecord *rftr =
+ const struct lsa_ForestTrustRecord2 *rftr =
ref_fti->entries[r];
const struct lsa_ForestTrustDomainInfo *rinfo = NULL;
const struct lsa_StringLarge *rtln = NULL;
NTSTATUS dsdb_trust_merge_forest_info(TALLOC_CTX *mem_ctx,
const struct lsa_TrustDomainInfoInfoEx *tdo,
- const struct lsa_ForestTrustInformation *ofti,
- const struct lsa_ForestTrustInformation *nfti,
- struct lsa_ForestTrustInformation **_mfti)
+ const struct lsa_ForestTrustInformation2 *ofti,
+ const struct lsa_ForestTrustInformation2 *nfti,
+ struct lsa_ForestTrustInformation2 **_mfti)
{
TALLOC_CTX *frame = talloc_stackframe();
- struct lsa_ForestTrustInformation *mfti = NULL;
+ struct lsa_ForestTrustInformation2 *mfti = NULL;
uint32_t ni;
uint32_t oi;
NTSTATUS status;
int cmp;
*_mfti = NULL;
- mfti = talloc_zero(mem_ctx, struct lsa_ForestTrustInformation);
+ mfti = talloc_zero(mem_ctx, struct lsa_ForestTrustInformation2);
if (mfti == NULL) {
TALLOC_FREE(frame);
return NT_STATUS_NO_MEMORY;
* may keep the flags and time values.
*/
for (ni = 0; ni < nfti->count; ni++) {
- const struct lsa_ForestTrustRecord *nftr = nfti->entries[ni];
- struct lsa_ForestTrustRecord tftr = {
+ const struct lsa_ForestTrustRecord2 *nftr = nfti->entries[ni];
+ struct lsa_ForestTrustRecord2 tftr = {
.flags = 0,
};
const char *ndns = NULL;
}
for (mi = 0; mi < mfti->count; mi++) {
- const struct lsa_ForestTrustRecord *mftr =
+ const struct lsa_ForestTrustRecord2 *mftr =
mfti->entries[mi];
const char *mdns = NULL;
tftr = *nftr;
for (oi = 0; oi < ofti->count; oi++) {
- const struct lsa_ForestTrustRecord *oftr =
+ const struct lsa_ForestTrustRecord2 *oftr =
ofti->entries[oi];
const char *odns = NULL;
* and may keep the flags and time values.
*/
for (ni = 0; ni < nfti->count; ni++) {
- const struct lsa_ForestTrustRecord *nftr = nfti->entries[ni];
- struct lsa_ForestTrustRecord tftr = {
+ const struct lsa_ForestTrustRecord2 *nftr = nfti->entries[ni];
+ struct lsa_ForestTrustRecord2 tftr = {
.flags = 0,
};
const struct lsa_ForestTrustDomainInfo *nd = NULL;
}
for (mi = 0; mi < mfti->count; mi++) {
- const struct lsa_ForestTrustRecord *mftr =
+ const struct lsa_ForestTrustRecord2 *mftr =
mfti->entries[mi];
const struct lsa_ForestTrustDomainInfo *md = NULL;
tftr = *nftr;
for (oi = 0; oi < ofti->count; oi++) {
- const struct lsa_ForestTrustRecord *oftr =
+ const struct lsa_ForestTrustRecord2 *oftr =
ofti->entries[oi];
const struct lsa_ForestTrustDomainInfo *od = NULL;
const char *onbt = NULL;
* if not already in the list.
*/
for (oi = 0; oi < ofti->count; oi++) {
- const struct lsa_ForestTrustRecord *oftr =
+ const struct lsa_ForestTrustRecord2 *oftr =
ofti->entries[oi];
const struct lsa_ForestTrustDomainInfo *od = NULL;
const char *odns = NULL;
}
for (mi = 0; mi < mfti->count; mi++) {
- const struct lsa_ForestTrustRecord *mftr =
+ const struct lsa_ForestTrustRecord2 *mftr =
mfti->entries[mi];
const struct lsa_ForestTrustDomainInfo *md = NULL;
* if they still match a top level name.
*/
for (oi = 0; oi < ofti->count; oi++) {
- const struct lsa_ForestTrustRecord *oftr =
+ const struct lsa_ForestTrustRecord2 *oftr =
ofti->entries[oi];
const char *odns = NULL;
bool ignore_old = false;
}
for (mi = 0; mi < mfti->count; mi++) {
- const struct lsa_ForestTrustRecord *mftr =
+ const struct lsa_ForestTrustRecord2 *mftr =
mfti->entries[mi];
const char *mdns = NULL;
struct lsa_ForestTrustDomainInfo di;
- struct lsa_ForestTrustInformation *fti;
+ struct lsa_ForestTrustInformation2 *fti;
};
NTSTATUS dsdb_trust_routing_table_load(struct ldb_context *sam_ctx,
continue;
}
- status = trust_forest_info_to_lsa(d, fti, &d->fti);
+ status = trust_forest_info_to_lsa2(d, fti, &d->fti);
if (!NT_STATUS_IS_OK(status)) {
TALLOC_FREE(frame);
return status;
}
for (i = 0; i < d->fti->count; i++ ) {
- const struct lsa_ForestTrustRecord *f = d->fti->entries[i];
+ const struct lsa_ForestTrustRecord2 *f = d->fti->entries[i];
const struct lsa_ForestTrustDomainInfo *di = NULL;
const char *fti_nbt = NULL;
int cmp;
}
for (i = 0; i < d->fti->count; i++ ) {
- const struct lsa_ForestTrustRecord *f = d->fti->entries[i];
- const union lsa_ForestTrustData *u = NULL;
+ const struct lsa_ForestTrustRecord2 *f = d->fti->entries[i];
+ const union lsa_ForestTrustData2 *u = NULL;
const char *fti_tln = NULL;
int cmp;
}
for (i = 0; i < d->fti->count; i++ ) {
- const struct lsa_ForestTrustRecord *f = d->fti->entries[i];
+ const struct lsa_ForestTrustRecord2 *f = d->fti->entries[i];
const struct lsa_ForestTrustDomainInfo *di = NULL;
const struct dom_sid *fti_sid = NULL;
bool match = false;
}
for (i = 0; i < d->fti->count; i++ ) {
- const struct lsa_ForestTrustRecord *f = d->fti->entries[i];
+ const struct lsa_ForestTrustRecord2 *f = d->fti->entries[i];
const struct lsa_ForestTrustDomainInfo *di = NULL;
bool match = false;