run_cat: convert to using path_to_dn()
authorPeter Marschall <peter@adpm.de>
Sun, 06 Mar 2011 20:31:05 +0100
changeset 31 a3a710f720dd
parent 30 e4b4b0968107
child 32 95dbffcc757b
run_cat: convert to using path_to_dn() run_edit: convert to using path_to_dn() run_copy & run_move: convert to using path_to_dn() run_grep: convert to using path_to_dn() run_passwd: convert to using path_to_dn()
shelldap
--- a/shelldap	Sun Mar 06 20:11:47 2011 +0100
+++ b/shelldap	Sun Mar 06 20:31:05 2011 +0100
@@ -1005,7 +1005,8 @@
 		});
 	}
 	else {
-		$self->rdn_to_dn( \$dn );
+		# convert given path to DN
+		$dn = $self->path_to_dn($dn, relative => 1);
 		$s = $self->search({
 			base   => $dn,
 			vals   => 1,
@@ -1086,8 +1087,9 @@
 		return;
 	}
 
-	my $s_rdn = $s_dn;
-	$self->rdn_to_dn( \$s_dn );
+	# convert given source path to DN
+	$s_dn = $self->path_to_dn($s_dn, relative => 1);
+
 	my $s = $self->search({ base => $s_dn, vals => 1 });
 	unless ( $s->{'code'} == LDAP_SUCCESS ) {
 		print "No such object\n";
@@ -1254,10 +1256,9 @@
 		return;
 	}
 
-	# support '.'
-	$dn = $self->base() if $dn eq '.';
+	# convert given path to DN
+	$dn = $self->path_to_dn($dn, relative => 1);
 
-	$self->rdn_to_dn( \$dn );
 	my $s = $self->search({ base => $dn, vals => 1 });
 
 	if ( $s->{'code'} ) {
@@ -1418,7 +1419,8 @@
 		print "No search base specified.\n";
 		return;
 	}
-	$self->rdn_to_dn( \$base );
+	# convert base path to DN
+	$base = $self->path_to_dn($base, relative => 1);
 
 	$self->debug("Filter parsed as: " . $filter->as_string() . "\n");
 
@@ -1643,8 +1645,9 @@
 		return;
 	}
 
-	my $s_rdn = $s_dn;
-	$self->rdn_to_dn( \$s_dn );
+	# convert given source path to DN
+	$s_dn = $self->path_to_dn($s_dn, relative => 1);
+
 	unless ( $self->is_valid_dn( $s_dn ) ) {
 		print "No such object\n";
 		return;
@@ -1683,10 +1686,9 @@
 		return;
 	}
 
-	# support '.'
-	$dn = $self->base() if $dn eq '.';
+	# convert given path to DN
+	$self->path_to_dn($dn, relative => 1);
 
-	$self->rdn_to_dn( \$dn );
 	my $s = $self->search( { base => $dn, scope => 'base' } );
 	if ( $s->{'code'} ) {
 		print $s->{'message'}, "\n";