解释 ldap 字符串“LDAP://DC=amrs,DC=win,DC=ml,dc=COM”的各个部分
有人可以解释 ldap 字符串部分的组成吗?
我拥有的是:
string strSQL = "SELECT mail FROM 'LDAP://DC=amrs,DC=win,DC=ml,dc=COM' WHERE samaccountname = '" + UserName.Replace(@"AMRS\", "") + "'";
这会收到一封特定用户名的电子邮件。现在我需要从 LDAP 查询中获取其他信息,但无法正确设置设置,而且我也不知道 LDAP 设置中的值是什么。 “LDAP://DC=amrs,DC=win,DC=ml,dc=COM”
谁能给我解释一下吗?
can someone explain the makeup of the ldap string parts.
the one i have is:
string strSQL = "SELECT mail FROM 'LDAP://DC=amrs,DC=win,DC=ml,dc=COM' WHERE samaccountname = '" + UserName.Replace(@"AMRS\", "") + "'";
this gets an email for a particular username. now i need to get other info from an ldap query and fail to get the setting correct and also i have no clue what the values are in the ldap settings. "LDAP://DC=amrs,DC=win,DC=ml,dc=COM"
can anyone explain this to me please?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
LDAP 字符串中的
DC=
前缀代表域组件 (dc)。这些是构成 LDAP 服务器域的部分。这些是固定的,需要用于该服务器上的任何对象。在“DNS 样式”中,这将显示为:
(something).amrs.win.ml.com
(例如服务器名称、计算机名称等)Richard Mueller 有一个 很棒的帖子 解释了 LDAP 绑定字符串中最常见的前缀 - 例如
dc=
、ou=
(组织单位)或cn=
(通用名称)。The
DC=
prefix in the LDAP string stands for domain component (dc). These are the parts that make up the domain of your LDAP server. Those are fixed and need to be used for any object on that server.In "DNS style", this would read:
(something).amrs.win.ml.com
(e.g. a server name, machine name etc.)Richard Mueller has a great post explaining the most commonly found prefixes in LDAP bind strings - stuff like
dc=
,ou=
(organizational unit) orcn=
(common name).这取决于您特定的 LDAP 架构。尝试使用 JXplorer 等 LDAP 浏览器来了解您的架构的结构。它也非常适合尝试这样的查询。
DC 是域组件的缩写。 LDAP: URL 描述了特定服务器上的子树。您的 where 子句查询该匹配项的属性 samaccountname 的条目。
It depends on your particular LDAP schema. Try an LDAP browser like JXplorer to find out how your Schema is structured. It's also great for trying out queries like this.
DC is short for Domain Component. The LDAP: URL describes a subtree on your particular server. Your where clause queries the entries for the attribute samaccountname for that match.
您只需向 LDAP 服务器发出查询即可。与其他任何东西一样,它有自己的查询格式。我不会称其为语言,但它的格式肯定必须正确。您需要找到有关 LDAP 的基本教程以及可以在 LDAP 目录中查找的组件,例如 Windows。您还可以查看如下项目:
Active Directory LDAP Query by sAMAccountName 和域,
了解事情是如何完成的并通过示例进行学习。对我来说,它有点像正则表达式,虽然不那么神秘,如果我需要某些东西,我每次都必须查找它,但至少当我看到它时我可以识别部分,就像在 DC 上一样,我可能有 dc=mydomain, dc=组织。通过查看我知道这是我开始查询的顶层。从那里我必须查找它。
You are simply issuing a query to the LDAP server. Like anything else out there it has its own format for querying it. I wouldn't call it a language but it certainly must be formatted correctly. You need to find a basic tutorial on LDAP and the components that can be looked up in your LDAP directory, like for Windows. You can also look at items like this:
Active Directory LDAP Query by sAMAccountName and Domain
to see how things are done and learn by example. For me, it's a little like regular expressions though not near as cryptic, I have to look it up every time if I need something but at least I can recognize parts when I see it, like on DC, I may have dc=mydomain,dc=org. I know by looking that is my top level where I start my query. From there I have to look it up.