In the immortal words of Jerome Walter:

> I have already the SSL working, but i cannot find how to encode the
> password for the update to work. M$ tells it is unicode then
> base64-encoded, but i cannot find an unicode format for the base64 to
> gives me correct results (i test with stringconverter.exe command).

Maybe this should go in a FAQ somewhere....

----cut----
  # done; now, if there's still a unicodePwd, then UTF-16(?) it
  # and base64 encode it and make sure it gets sent that way.
  my $opw = $entry->get_value('unicodePwd');
  if (defined $opw) {
    my $upw = pack "v*", unpack "C*", qq("$opw");
    &change_changes($entry, 'replace', 'unicodePwd', $upw);
  }

sub change_changes {
  my ($entry, $op, $attr, @values) = @_;
  
  # add/delete entry operations don't have this problem
  # so just use the regular method to update them
  unless ($entry->changetype eq 'modify') {
    $entry->$op($attr, [EMAIL PROTECTED]);
    return;
  }

  # ok, this is a modify, do it the hard way
  $attr = lc $attr;
  my $changes = $entry->{changes};
  for (my $i = 0; $i < @$changes; $i += 2) {
    my ($oldop, $oldargs)   = @{$changes}[$i, $i+1];
    my ($oldattr, $oldvals) = @$oldargs;
    if ($oldattr eq $attr) {
      $changes->[$i] = $op;
      $oldargs->[1] = [EMAIL PROTECTED];
      last;
    }
  }
}
----cut----

%%  Christopher A. Bongaarts  %%  [EMAIL PROTECTED]       %%
%%  Internet Services         %%  http://umn.edu/~cab  %%
%%  University of Minnesota   %%  +1 (612) 625-1809    %%

Reply via email to