【问题标题】:Is it possible to create entry into LDAP server without RDN with only attributes?是否可以在没有 RDN 的情况下仅使用属性创建 LDAP 服务器条目?
【发布时间】:2020-04-09 05:12:42
【问题描述】:

我们正在使用 ldapjs 节点模块与 Microsoft Active Directory、Apache DS 和 Open LDAP 等 LDAP 服务器进行通信。根据我们对here的理解:

DN 可以由零个或多个组件组成,这意味着拥有一个完全没有任何组件的 DN 是合法的。

是否可以在我的 Base DN 中创建只有属性而没有任何 RDN 的 LDAP 服务器条目?

例如,如果我想在没有 RDN 的 LDAP 服务器中创建 inetOrgPerson 条目,则创建条目如下:

var ldap = require('ldapjs');
var client = ldap.createClient({  
  url: 'ldap://xxxxxxxx:389'
});
client.bind('xxxxxxxx', 'xxxxxxxxx', function(err) {
  if(err){
      console.log('error',err);
  }else{
      console.log('bind is success');
  }
});

var newDN = "ou=testou,dc=xxxx,dc=com";
var newUser = {    
    objectClass: 'inetOrgPerson',
    sn: 'test'
  }

client.add(newDN, newUser, function(err) {  
  if(err){
      console.log('error',err);
  }else{     
      client.unbind(function(err) {
          if(err){
              console.log('error unbind : ',err);
          }else{
              console.log('unbind is success');
          }
        });
  }
})

执行上述代码后,OU testou 中应该有条目,sntest。任何输入都会有所帮助。谢谢你们。

【问题讨论】:

  • “没有 RDN”是什么意思?当您使用 RDN 'ou=testou,dc=xxxx,dc=com' 时?
  • 根据 RFC4514,RDN 将具有以下任何一项: CN - commonName (2.5.4.3) L - localityName (2.5.4.7) ST - stateOrProvinceName (2.5.4.8) O - organizationName (2.5. 4.10) OU - organizationsUnitName (2.5.4.11) C - countryName (2.5.4.6) STREET - streetAddress (2.5.4.9) DC - domainComponent (0.9.2342.19200300.100.1.25) UID - userId (0.9.2342.19200300.100.1.1)现在当我说没有 RDN 时,DN 中没有任何属性类型。谢谢。

标签: active-directory ldap openldap apacheds ldapjs


【解决方案1】:

虽然具有零组件的 DN 是合法的,但它是为 rootDSE 保留的。 任何条目都必须具有非空 DN,因此必须具有非空 RDN。

【讨论】:

    猜你喜欢
    • 2013-08-21
    • 2018-05-21
    • 1970-01-01
    • 2013-01-03
    • 2018-09-15
    • 1970-01-01
    • 2017-06-25
    • 1970-01-01
    • 2016-11-11
    相关资源
    最近更新 更多