X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fpart_export%2Fldap.pm;h=823d99dbf1ad57d065fd760d2bc1f5a7f52d85a6;hb=7b125e587a4d1ee0aca692e23ea7897f671855ae;hp=fd7f11d90d81b488a2401a34f9ca5187b02ef81a;hpb=3ac3bd76d4716016ba3a51f51a83a02732d9d2de;p=freeside.git diff --git a/FS/FS/part_export/ldap.pm b/FS/FS/part_export/ldap.pm index fd7f11d90..823d99dbf 100644 --- a/FS/FS/part_export/ldap.pm +++ b/FS/FS/part_export/ldap.pm @@ -1,11 +1,50 @@ package FS::part_export::ldap; -use vars qw(@ISA @saltset); +use vars qw(@ISA %info @saltset); +use Tie::IxHash; use FS::Record qw( dbh ); use FS::part_export; @ISA = qw(FS::part_export); +tie my %options, 'Tie::IxHash', + 'dn' => { label=>'Root DN' }, + 'password' => { label=>'Root DN password' }, + 'userdn' => { label=>'User DN' }, + 'attributes' => { label=>'Attributes', + type=>'textarea', + default=>join("\n", + 'uid $username', + 'mail $username\@$domain', + 'uidno $uid', + 'gidno $gid', + 'cn $first', + 'sn $last', + 'mailquota $quota', + 'vmail', + 'location', + 'mailtag', + 'mailhost', + 'mailmessagestore $dir', + 'userpassword $crypt_password', + 'hint', + 'answer $sec_phrase', + 'objectclass top,person,inetOrgPerson', + ), + }, + 'radius' => { label=>'Export RADIUS attributes', type=>'checkbox', }, +; + +%info = ( + 'svc' => 'svc_acct', + 'desc' => 'Real-time export to LDAP', + 'options' => \%options, + 'notes' => <<'END' +Real-time export to arbitrary LDAP attributes. Requires installation of +Net::LDAP from CPAN. +END +); + @saltset = ( 'a'..'z' , 'A'..'Z' , '0'..'9' , '.' , '/' ); sub rebless { shift; } @@ -25,7 +64,7 @@ sub _export_insert { } } $crypt_password = ''; #surpress "used only once" warnings - $crypt_password = crypt( $svc_acct->_password, + $crypt_password = '{crypt}'. crypt( $svc_acct->_password, $saltset[int(rand(64))].$saltset[int(rand(64))] ); my $username_attrib; @@ -251,3 +290,5 @@ sub ldap_connect { $ldap; } +1; +