summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2010-11-15 08:27:04 +1100
committerAndrew Tridgell <tridge@samba.org>2010-11-15 10:19:34 +1100
commitec590fc9e37c38891bdd10aaae5bac46f5e71f75 (patch)
treeb57127a52a7698e127802d85716d5f6092c4424d
parentf0cdcd940e20bf049ccb19ca68a101a29d2ee8d1 (diff)
downloadsamba-ec590fc9e37c38891bdd10aaae5bac46f5e71f75.tar.gz
samba-ec590fc9e37c38891bdd10aaae5bac46f5e71f75.tar.bz2
samba-ec590fc9e37c38891bdd10aaae5bac46f5e71f75.zip
samba-tool: fixed crash in "samba-tool drs showrepl"
the source_dsa_obj_dn can be NULL Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
-rw-r--r--source4/samba_tool/drs/drs_showrepl.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/source4/samba_tool/drs/drs_showrepl.c b/source4/samba_tool/drs/drs_showrepl.c
index f399097008..5c095a89e6 100644
--- a/source4/samba_tool/drs/drs_showrepl.c
+++ b/source4/samba_tool/drs/drs_showrepl.c
@@ -46,7 +46,9 @@ static bool net_drs_parse_ntds_dn(struct ldb_dn *ntds_dn,
NET_DRS_NOMEM_GOTO(dn, failed);
/* remove NTDS Settings component */
- ldb_dn_remove_child_components(dn, 1);
+ if (!ldb_dn_remove_child_components(dn, 1)) {
+ return false;
+ }
if (_dc_name) {
val = ldb_dn_get_rdn_val(dn);
*_dc_name = talloc_strdup(mem_ctx, (const char *)val->data);
@@ -82,12 +84,16 @@ failed:
return false;
}
-static char * net_drs_dc_canonical_string(struct ldb_dn *ntds_dn, TALLOC_CTX *mem_ctx)
+static const char * net_drs_dc_canonical_string(struct ldb_dn *ntds_dn, TALLOC_CTX *mem_ctx)
{
const char *dc_name;
const char *site_name;
char *canonical_name;
+ if (ldb_dn_is_null(ntds_dn)) {
+ return "(NULL DN)";
+ }
+
if (!net_drs_parse_ntds_dn(ntds_dn, mem_ctx, &dc_name, &site_name, NULL)) {
return NULL;
}
@@ -248,7 +254,7 @@ net_drs_transport_type_str(struct net_drs_context *drs_ctx, const char *transpor
* Prints most of the info we got about
* a replication partner
*/
-static bool net_drs_showrepl_print_heighbor(struct net_drs_context *drs_ctx,
+static bool net_drs_showrepl_print_neighbor(struct net_drs_context *drs_ctx,
struct drsuapi_DsReplicaNeighbour *neighbor)
{
struct ldb_dn *ntds_dn;
@@ -309,7 +315,7 @@ static bool net_drs_showrepl_print_inbound_neihbors(struct net_drs_context *drs_
for (i = 0; i < reps_from->count; i++) {
d_printf("\n");
- net_drs_showrepl_print_heighbor(drs_ctx, &reps_from->array[i]);
+ net_drs_showrepl_print_neighbor(drs_ctx, &reps_from->array[i]);
}
return true;
@@ -338,7 +344,7 @@ static bool net_drs_showrepl_print_outbound_neihbors(struct net_drs_context *drs
for (i = 0; i < reps_to->count; i++) {
d_printf("\n");
- net_drs_showrepl_print_heighbor(drs_ctx, &reps_to->array[i]);
+ net_drs_showrepl_print_neighbor(drs_ctx, &reps_to->array[i]);
}
return true;