Fix the DN regexp to include dashes. Patch from Mike Hix <m@hix.io>.
authorMahlon E. Smith <mahlon@laika.com>
Tue, 03 Dec 2013 10:13:24 -0800
changeset 60 f90f7ff0b146
parent 59 5b122351067c
child 61 e3bd30b95695
Fix the DN regexp to include dashes. Patch from Mike Hix <m@hix.io>.
shelldap
--- a/shelldap	Wed May 15 12:18:54 2013 -0700
+++ b/shelldap	Tue Dec 03 10:13:24 2013 -0800
@@ -1290,7 +1290,7 @@
 	# see if we're copying the entry to a nonexistent path
 	#
 	my ( $new_dn, $old_dn );
-	( $d_dn, $new_dn ) = ( $1, $2 ) if $d_dn =~ /^([\w=]+),(.*)$/;
+	( $d_dn, $new_dn ) = ( $1, $2 ) if $d_dn =~ /^([\-\w=]+),(.*)$/;
 	if ( $new_dn ) { # absolute
 		unless ( $self->is_valid_dn( $new_dn ) ) {
 			print "Invalid destination.\n";
@@ -1300,7 +1300,7 @@
 	else { # relative
 		$new_dn = $self->base();
 	}
-	$old_dn = $1 if $s_dn =~ /^[\w=]+,(.*)$/;
+	$old_dn = $1 if $s_dn =~ /^[\-\w=]+,(.*)$/;
 
 	# get the source entry object
 	my $e = ${ $s->{'entries'} }[0];
@@ -1314,7 +1314,7 @@
 	# perhaps there is a better way to do this...?
 	#
 	my ( $uniqkey, $uniqval ) = ( $1, $2 )
-	  if $d_dn =~ /^([\.\w\-]+)(?:\s+)?=(?:\s+)?([\.\-\s\w]+),?/;
+	  if $d_dn =~ /^([\-\.\w]+)(?:\s+)?=(?:\s+)?([\-\.\s\w]+),?/;
 	unless ( $uniqkey && $uniqval ) {
 		print "Unable to parse unique values from RDN.\n";
 		return;
@@ -1948,8 +1948,8 @@
 
 	# see if we're moving the entry to a totally new path
 	my ( $new_dn, $old_dn );
-	( $d_dn, $new_dn ) = ( $1, $2 ) if $d_dn =~ /^([\w=]+),(.*)$/;
-	$old_dn = $1 if $s_dn =~ /^[\w=]+,(.*)$/;
+	( $d_dn, $new_dn ) = ( $1, $2 ) if $d_dn =~ /^([\-\w=]+),(.*)$/;
+	$old_dn = $1 if $s_dn =~ /^[\-\w=]+,(.*)$/;
 
 	my $moddn = sub {
 		return $self->ldap()->moddn(