Skip to content
This repository was archived by the owner on May 14, 2024. It is now read-only.

Accentued characters and some currency characters can't be use with the password field (unicodePwd ) #655

Closed
rekscy opened this issue Sep 11, 2020 · 4 comments

Comments

@rekscy
Copy link

rekscy commented Sep 11, 2020

Hi guys,

i'm trying to use accentueted characters in the password field.
It seem's to me that accentuated characters like "éàäü and some currency characters € and £ aren't sent currectly to the active directory (2016) user password.

My code look's like follow

  static encodePassword(password: string) {
    return Buffer.from(`"${password}"`, "utf16le").toString();
  }
    changes.push(
      new Change({
        operation: "replace",
        modification: {
          unicodePwd: LdapUtils.encodePassword(newPassword)
        }
      })
    );

I have tried to use 2 different active directories, and update the project to the last version (2.1.1)

When i reset the user password directly from the active directory, i can use the characters mentionated above successfully. But every time i tried to set a new password from my app(node js code), it doenst work. If i try any password without this characters it work's fine from the app and the active directory.

When it fails any error is reported in the nodejs terminal, every thing seem's to work fine, the only difference is that the final user can't log in anymore. (code 52e)

I have tried too different versions of the encode method (wich none seem's to work)

const iconv   = require('iconv-lite');

...

  static encodePassword(password: string) {
       return  iconv.encode(`"${password}"`, "utf16le")
  }
  static encodePassword(password: string) {
  let convertedPassword = '';
  passwordString = '"' + password + '"';

  for (let i = 0; i < passwordString.length; i++) {
    convertedPassword += String.fromCharCode(
      passwordString.charCodeAt(i) & 0xff,
      (passwordString.charCodeAt(i) >>> 8) & 0xff
    )
  }

  return convertedPassword;
  }

I have found someone with the same kind of problem, it seem's too me to me that the same kind of thing is happeninng here, maybe it gives an idea to someone.
dapphp/radius#5 (comment)

I'm not sure if it's an issue with ldapjs, but i dont really know what i can try more, maybe someone can tell me if he can modify user passwords using ldapjs and confirm if it's or not an ldapjs issue?

Thank you in advance for any help and have a good day

@rekscy rekscy changed the title Accentued characters and some currency characters and can't be use with the password field (unicodePwd ) Accentued characters and some currency characters can't be use with the password field (unicodePwd ) Sep 11, 2020
@rekscy
Copy link
Author

rekscy commented Sep 28, 2020

Hi, nobody have an idea about this issue ?

@jsumners
Copy link
Member

Unfortunately, no. I do not have access to an AD server. If you can provide a reproduction within our integration test suite, that would be helpful. And if you can provide a fix, we'd certainly love to review it and get it integrated.

@gabssnake
Copy link

Hi, also having this issue. Have you tried base64 encoding ?

@jsumners
Copy link
Member

👋

On February 22, 2023, we released version 3 of this library. As a result, we are closing this issue/pull request.

Please see issue #839 for more information, including how to proceed if you feel this closure is in error.

@ldapjs ldapjs locked as resolved and limited conversation to collaborators Feb 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants