diff --git a/tests/progs/slapd-addel.c b/tests/progs/slapd-addel.c
index 87e4fdbe99d80a8af994b26b84ae9c435e52391f..f186f670b3380f25a39838613c893cb6a5e9110e 100644
--- a/tests/progs/slapd-addel.c
+++ b/tests/progs/slapd-addel.c
@@ -278,7 +278,10 @@ get_add_entry( char *filename, LDAPMod ***mods )
 
 			if (( nl = strchr( line, '\r' )) || ( nl = strchr( line, '\n' )))
 				*nl = '\0';
-			entry = strdup( line );
+			nl = line;
+			if ( !strncasecmp( nl, "dn: ", 4 ))
+				nl += 4;
+			entry = strdup( nl );
 
 		}