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

No Such Object on modify with latin characters #940

Closed
Magander86 opened this issue Aug 27, 2023 · 2 comments
Closed

No Such Object on modify with latin characters #940

Magander86 opened this issue Aug 27, 2023 · 2 comments

Comments

@Magander86
Copy link

Magander86 commented Aug 27, 2023

When I search for an user with latin characters such as "ç", "ã", etc... the ldap returns the entry just fine, but when I try to do modifications it gives me a [no such object error], even if the distinguished name is correct. Here follows an example code:

const username = process.env.LDAP_USER;
const password = process.env.LDAP_PASS;
const ldapAddress = `ldap://${process.env.LDAP_IP}:${process.env.LDAP_PORT}`;

const client = ldap.createClient({
  url: ldapAddress,
});

function bindLdap(username, password) {
  return new Promise((resolve, reject) => {
    client.bind(username, password, (err) => {
      if (err) {
        console.error("Bind error:", err);
        reject(err);
      }
      console.log("Bind successful");
      resolve();
    });
  });
}

async function runLdapChange() {
  await bindLdap(username, password).catch((err) => console.log(err)); 

  const changeEmail = new ldap.Change({
    operation: "replace",
    modification: new ldap.Attribute({
      type: "mail",
      values: ["test@test.com"],
    }),
  });

  client.modify(
    "CN=Mendonça,OU=users,DC=test,DC=com",
    changeEmail,
    (err) => {
      if (err) {
        console.error("Modification error:", err);

        client.unbind();
        return;
      }
      console.log("Modification successful");
      client.unbind();
    }
  );
}

runLdapChange();

The correct DN is "CN=Mendonça,OU=users,DC=test,DC=com", but if I replace "ç" for "c" the modification is applied with success

@jsumners
Copy link
Member

I do not see this issue in the test added by #941

@jsumners
Copy link
Member

Due to lack of response, I'm merging #941 and closing this as not reproducible.

Please provide a minimal reproducible example if you think this is inaccurate. Doing so will help us diagnose your issue. It should be the bare minimum code needed to trigger the issue, and easily runnable without any changes or extra code.

You may use a GitHub repository to host the code if it is too much to fit in a code block (or two).

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

2 participants