drsuapi: avoid calling twice drs_ObjectIdentifier_to_dn/drs_ObjectIdentifier_to_string
authorMatthieu Patou <mat@matws.net>
Sun, 14 Oct 2012 08:05:33 +0000 (01:05 -0700)
committerMatthieu Patou <mat@matws.net>
Sun, 18 May 2014 04:51:15 +0000 (21:51 -0700)
Instead we call once and we do the linearization of the dn for the debug
message.

Signed-off-by: Matthieu Patou <mat@matws.net>
source4/rpc_server/drsuapi/updaterefs.c

index ae87117d656f7842670b11956c63cb373b7c024f..e00e119f03874b12cffb31817b7e39330e1b9ae7 100644 (file)
@@ -147,10 +147,13 @@ WERROR drsuapi_UpdateRefs(struct drsuapi_bind_state *b_state, TALLOC_CTX *mem_ct
        struct ldb_dn *nc_root;
        struct ldb_context *sam_ctx = b_state->sam_ctx_system?b_state->sam_ctx_system:b_state->sam_ctx;
 
+       dn = drs_ObjectIdentifier_to_dn(mem_ctx, sam_ctx, req->naming_context);
+       W_ERROR_HAVE_NO_MEMORY(dn);
+
        DEBUG(4,("DsReplicaUpdateRefs for host '%s' with GUID %s options 0x%08x nc=%s\n",
                 req->dest_dsa_dns_name, GUID_string(mem_ctx, &req->dest_dsa_guid),
                 req->options,
-                drs_ObjectIdentifier_to_string(mem_ctx, req->naming_context)));
+                ldb_dn_get_extended_linearized(dn)));
 
        /*
         * 4.1.26.2 Server Behavior of the IDL_DRSUpdateRefs Method
@@ -169,8 +172,6 @@ WERROR drsuapi_UpdateRefs(struct drsuapi_bind_state *b_state, TALLOC_CTX *mem_ct
                return WERR_DS_DRA_INVALID_PARAMETER;
        }
 
-       dn = drs_ObjectIdentifier_to_dn(mem_ctx, sam_ctx, req->naming_context);
-       W_ERROR_HAVE_NO_MEMORY(dn);
        ret = dsdb_find_nc_root(sam_ctx, dn, dn, &nc_root);
        if (ret != LDB_SUCCESS) {
                DEBUG(2, ("Didn't find a nc for %s\n", ldb_dn_get_linearized(dn)));