bbs.chinaunix/thread-391839-1-1.html
如何在Linux下通过ldapsearch查询活动目录的内容
非常感谢gnap大虾,还有一个问题是关于中文的
ldapsearch -x -W -D "cn=administrator,cn=users,dc=insigma,dc=org" -b "dc=insigma,dc=org" -h ADHost -s one  dn -LLL
返回的数据是:
dn: CN=Builtin,DC=insigma,DC=org
dn: CN=Computers,DC=insigma,DC=org
dn: OU=Domain Controllers,DC=insigma,DC=org
dn: CN=ForeignSecurityPrincipals,DC=insigma,DC=org
dn: CN=Infrastructure,DC=insigma,DC=org
dn: CN=LostAndFound,DC=insigma,DC=org
dn: CN=System,DC=insigma,DC=org
dn: CN=Users,DC=insigma,DC=org
dn:: T1U955a+5o6n5Lit5b+DLERDPWluc2lnbWEsREM9b3Jn
# refldap:///CN=Configuration,DC=insigma,DC=org??base
最后的一个DN是乱码,实际上应该为OU=疾控中心等字样,
下面是通过windows的工具访问AD的结果:
>;>; Dn: CN=Infrastructure,DC=insigma,DC=org
1>; canonicalName: /Infrastructure;
1>; cn: Infrastructure;
1>; distinguishedName: CN=Infrastructure,DC=insigma,DC=org;
2>; objectClass: top; infrastructureUpdate;
1>; name: Infrastructure;
>;>; Dn: CN=LostAndFound,DC=insigma,DC=org
1>; canonicalName: /LostAndFound;
1>; cn: LostAndFound;
1>; description: Default container for orphaned objects;
1>; distinguishedName: CN=LostAndFound,DC=insigma,DC=org;
2>; objectClass: top; lostAndFound;
1>; name: LostAndFound;
>;>; Dn: CN=System,DC=insigma,DC=org
1>; canonicalName: /System;
1>; cn: System;
1>; description: Builtin system settings;
1>; distinguishedName: CN=System,DC=insigma,DC=org;
2>; objectClass: top; container;
1>; name: System;
>;>; Dn: CN=Users,DC=insigma,DC=org
1>; canonicalName: /Users;
1>; cn: Users;
1>; description: Default container for upgraded user accounts;
1>; distinguishedName: CN=Users,DC=insigma,DC=org;
2>; objectClass: top; container;
1>; name: Users;
>;>; Dn: OU=疾控中心,DC=insigma,DC=org
1>; canonicalName: <ldp: Binary blob>;;
1>; distinguishedName: <ldp: Binary blob>;;
2>; objectClass: top; organizationalUnit;
1>; ou: <ldp: Binary blob>;;
1>; name: <ldp: Binary blob>;;
为什么ldapsearch返回结果不支持中文,是由于RedHat9的缘故还是openldap不支持或者需要在编译的时候加参数?
楼上的那个 T1U955a+5o6n5Lit5b+DLERDPWluc2lnbWEsREM9b3Jn 是中文
你把它保存到文件a中,执行下面的代码:
perl -MMIME::Base64 -ne 'print decode_base64($_)' < a | iconv -f utf8
就可以看到结果:OU=疾控中心,DC=insigma,DC=org
perl怎么下载
我的意思是"OU=疾控中心,DC=insigma,DC=org"转换成utf8,再作Base64编码就是:T1U955a+5o6n5Lit5b+DLERDPWluc2lnbWEsREM9b3Jn
检查MIME::Base64
模块、iconv装上没有
perl -MMIME::Base64 -ne 'print decode_base64($_)' < | iconv -f utf8
perl -MMIME::Base64 -ne 'print decode_base64($_)' < | iconv -f utf8
Q0496LW15q2m5pifLE9VPW1haWx1c2VyLERDPW8tZmlsbSxEQz1jb20=
yum install openldap-devel-2.3.43-25.el5.x86*

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。