X-Git-Url: https://git.deb.at/?a=blobdiff_plain;f=contrib%2Fldap-abook%2Fldap2abook;h=58b793624ce7b5cec11740431d75e17dde712717;hb=addc54efb596b39b0e4e6ce219ee0f1506337475;hp=c86de4f85beca354426dea903f6f1eb2b0e58c0d;hpb=c5d8ef5198f2bfd02f678b7a709b6538ef83cd44;p=pkg%2Fabook.git diff --git a/contrib/ldap-abook/ldap2abook b/contrib/ldap-abook/ldap2abook index c86de4f..58b7936 100644 --- a/contrib/ldap-abook/ldap2abook +++ b/contrib/ldap-abook/ldap2abook @@ -11,6 +11,7 @@ # # Author: Mariusz Balewski # 03.06.2004 +# 29.08.2005 Tried to fix insecure tempfile handling (untested) # # GPL licensed # Feel free to send me your comments @@ -55,12 +56,16 @@ ############################### ############################### +use File::Temp qw/ :mktemp /; +$file = mktemp("/tmp/tmpfileXXXXXXX"); + + require 'comms.pl'; -system("ldapsearch -h $HOST $SIMPLEAUTH $AUTHDN $PASS \"$FINDDN=*\" $BASEDN -LLL > /tmp/ldap2abook.tmp"); +system("ldapsearch -h $HOST $SIMPLEAUTH $AUTHDN $PASS \"$FINDDN=*\" $BASEDN -LLL > $file"); $i=0; -open(F1,"$DESTFILE") || die "$DESTFILEERR"; flock(F1,8); flock(F2,8); @@ -82,7 +87,7 @@ open(F2,">$DESTFILE") || die "$DESTFILEERR"; close(F2); close(F1); -system("rm /tmp/ldap2abook.tmp"); +unlink($file); print "\n$i "; print "$REPORT\n\n";