Changeset 46dfe9d6f368
Legend:
- Unmodified
- Added
- Removed
-
shelldap
r5 r6 2 2 # vim: set nosta noet ts=4 sw=4: 3 3 # 4 # Copyright (c) 2006 , Mahlon E. Smith <mahlon@martini.nu>4 # Copyright (c) 2006-2011, Mahlon E. Smith <mahlon@martini.nu> 5 5 # All rights reserved. 6 6 # Redistribution and use in source and binary forms, with or without … … 9 9 # * Redistributions of source code must retain the above copyright 10 10 # notice, this list of conditions and the following disclaimer. 11 # 11 12 # * Redistributions in binary form must reproduce the above copyright 12 13 # notice, this list of conditions and the following disclaimer in the 13 14 # documentation and/or other materials provided with the distribution. 15 # 14 16 # * Neither the name of Mahlon E. Smith nor the names of his 15 17 # contributors may be used to endorse or promote products derived … … 346 348 =head1 BUGS / LIMITATIONS 347 349 348 There is currently no attribute multiline support - attribute values 349 that span over one line will be ignored if modified. (Thankfully, they 350 are generally rare.) 351 352 There is no support for editing binary data. This is actually related 353 to the lack of multiline support - if you just base64 encode data and 354 paste it in, it will be ignored for the same reasons. 350 There is no support for editing binary data. If you need to edit base64 351 stuff, just feed it to the regular ldapmodify/ldapadd/etc tools. 355 352 356 353 =head1 AUTHOR … … 868 865 } 869 866 867 868 # Given an $arrayref, remove LDIF continuation wrapping, 869 # effectively making each entry a single line. 870 # 870 871 sub unwrap { 871 872 my $array = shift; 872 873 873 my $iter = 1; 874 while ($iter < $#$array) { 875 if (@$array[$iter] =~ m/^\W/) { 876 @$array[$iter - 1] =~ s/\n$//; 877 @$array[$iter] =~ s/^\W//; 878 splice(@$array, $iter - 1, 2, @$array[$iter - 1] . @$array[$iter]); 879 } else { 880 $iter++; 881 } 882 } 883 } 874 my $i = 1; 875 while ( $i < scalar(@$array) ) { 876 if ( $array->[$i] =~ /^\s/ ) { 877 $array->[ $i - 1 ] =~ s/\n$//; 878 $array->[ $i ] =~ s/^\s//; 879 splice( @$array, $i - 1, 2, $array->[$i - 1] . $array->[$i] ); 880 } 881 else { 882 $i++; 883 } 884 } 885 } 886 884 887 885 888 ############################################################### … … 1159 1162 return; 1160 1163 } 1161 my $filter; 1162 unless ( $DNs[0] eq '*' ) { 1163 $filter = $self->make_filter( \@DNs ) or return; 1164 } 1165 1164 1165 my $filter; 1166 unless ( $DNs[0] eq '*' ) { 1167 $filter = $self->make_filter( \@DNs ) or return; 1168 } 1166 1169 1167 1170 my $s = $self->search({ scope => 'one', filter => $filter }); … … 1213 1216 1214 1217 # load it into an array for potential comparison 1215 my @orig_ldif;1216 1218 open LDIF, "$self->{'ldif_fname'}" or return; 1217 @orig_ldif = <LDIF>;1219 my @orig_ldif = <LDIF>; 1218 1220 close LDIF; 1219 1221 … … 1240 1242 1241 1243 # load changes into a new array for comparison 1242 my @new_ldif;1243 1244 open LDIF, "$self->{'ldif_fname'}" or return; 1244 @new_ldif = <LDIF>;1245 my @new_ldif = <LDIF>; 1245 1246 close LDIF; 1246 1247 … … 1251 1252 return if $line =~ /^\#/; # ignore comments 1252 1253 my ( $attr, $val ) = ( $1, $2 ) if $line =~ /^(.+?): (.*)$/; 1254 return unless $attr; 1253 1255 return if index($attr, ':') != -1; # ignore base64 1254 1256 return ( $attr, $val ); 1255 1257 }; 1256 1258 1257 unwrap( \@orig_ldif);1258 unwrap( \@new_ldif);1259 unwrap( \@orig_ldif ); 1260 unwrap( \@new_ldif ); 1259 1261 1260 1262 my $diff = Algorithm::Diff->new( \@orig_ldif, \@new_ldif ); … … 1663 1665 1664 1666 $0 = 'shelldap'; 1665 my $VERSION = '0. 2';1667 my $VERSION = '0.3'; 1666 1668 1667 1669 use Getopt::Long;
Note: See TracChangeset
for help on using the changeset viewer.
