Changeset 189
- Timestamp:
- 05/26/09 16:28:27 (15 years ago)
- Location:
- LATMOS-Accounts
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Ad.pm
r181 r189 11 11 use Net::LDAP::Constant qw( LDAP_CONTROL_PAGED ); 12 12 use Net::LDAP::Util qw( escape_filter_value ); 13 use Unicode::Map8; 14 use Unicode::String qw(utf16); 13 15 14 16 our $VERSION = (q$Rev$ =~ /^Rev: (\d+) /)[0]; … … 109 111 } 110 112 111 $ldap or return; # connot connect to any ldap :\ 113 $ldap or do { 114 warn "Cannot to ldap server"; 115 return; # connot connect to any ldap :\ 116 }; 112 117 113 118 my $login = $self->{_login}; … … 145 150 sort { $a->priority <=> $b->priority || $a->weight <=> $b->weight } 146 151 grep { $_->type eq 'SRV' } $query->answer) { 147 push(@urllist, $self->_ldap_url($rr->target , $rr->port));152 push(@urllist, $self->_ldap_url($rr->target)); # $rr->port)); don't use port 148 153 } 149 154 -
LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Ad/User.pm
r188 r189 7 7 use base qw(LATMOS::Accounts::Bases::Ad::objects); 8 8 use Net::LDAP; 9 use Net::LDAPS; 9 10 use Net::LDAP::Entry; 10 11 use Net::LDAP::Control::Paged; … … 70 71 userAccountControl 71 72 locked 73 dSHeuristics 72 74 ), 73 75 ($mode !~ /w/ … … 121 123 $field eq 'directReports' and do { 122 124 my $res = $self->SUPER::get_field($field); 123 return [ map { $self->base->get_value('cn') } @{ ref $res ? $res : [ $res ] } ]; 125 return; 126 #return [ map { $self->base->get_value('cn') } @{ ref $res ? $res : [ $res ] } ]; 124 127 }; 125 128 $field eq 'manager' and do { 126 my $entry = $self->SUPER::get_field($field) or return;127 return $entry->get_value('cn');129 #my $entry = $self->SUPER::get_field($field) or return; 130 #return $entry->get_value('cn'); 128 131 }; 129 132 $self->SUPER::get_field($field); … … 170 173 } 171 174 175 sub set_password { 176 my ($self, $clear_pass) = @_; 177 my $charmap = Unicode::Map8->new('latin1') or die; 178 my $newUniPW = $charmap->tou('"'.$clear_pass.'"')->byteswap()->utf16(); 179 my $mesg = $self->base->ldap->modify( 180 $self->get_c_field('dn'), 181 changes => [ 182 #replace => [ userPassword => $clear_pass ], 183 replace => [ unicodePwd => $newUniPW ], 184 185 ] 186 ); 187 if ($mesg->code && $mesg->code != 82) { 188 warn $mesg->error; 189 return; 190 } else { return 1 } 191 } 192 172 193 1; 173 194
Note: See TracChangeset
for help on using the changeset viewer.