From: Dobrica Pavlinusic Date: Tue, 13 Jul 2010 14:50:58 +0000 (+0000) Subject: read additional yaml files from yaml/attribute/value.yaml X-Git-Url: http://git.rot13.org/?p=virtual-ldap;a=commitdiff_plain;h=5554ff3c9bd737a7238e342da520643c05805874;hp=9db13acebc545f239943a56a6bd5086b84d95100 read additional yaml files from yaml/attribute/value.yaml --- diff --git a/bin/ldap-rewrite.pl b/bin/ldap-rewrite.pl index f7be5e3..b35822e 100755 --- a/bin/ldap-rewrite.pl +++ b/bin/ldap-rewrite.pl @@ -154,10 +154,21 @@ sub log_response { push @{ $response->{protocolOp}->{searchResEntry}->{attributes} }, $_ foreach @attrs; - my $path = $config->{yaml_dir} . "$uid.yaml"; - if ( -e $path ) { - my $data = LoadFile($path); - warn "# yaml = ",dump($data); + my @additional_yamls = ( $uid ); + foreach my $attr ( @{ $response->{protocolOp}->{searchResEntry}->{attributes} } ) { + foreach my $v ( @{ $attr->{vals} } ) { + push @additional_yamls, $attr->{type} . '/' . $v; + } + } + + #warn "# additional_yamls ",dump( @additional_yamls ); + + foreach my $path ( @additional_yamls ) { + my $full_path = $config->{yaml_dir} . '/' . $path . '.yaml'; + next unless -e $full_path; + + my $data = LoadFile( $full_path ); + warn "# $full_path yaml = ",dump($data); foreach my $type ( keys %$data ) {