LX0-104 · Question #143
Which of the following arguments complete the command which will search for cn=ldapadmin OR ou=BR recursively in the directory? ldapsearch -LLL -h server -s sub -b "o=inc" "_______"
The correct answer is B. ( |(cn=ldapamin) (ou=BR) ). The correct LDAP search filter syntax for an OR condition requires the | operator to precede the individual filter conditions in prefix notation: (|(cn=ldapadmin)(ou=BR)).
Question
Options
- A( (cn=ldapamin)|(ou=BR) )
- B( |(cn=ldapamin) (ou=BR) )
- C( (cn=ldapamin) (ou=BR) )
- D( (cn=ldapamin) (ou=BR)| )
- E( (cn=ldapamin)||(ou=BR) )
How the community answered
(40 responses)- A3% (1)
- B78% (31)
- C5% (2)
- D3% (1)
- E13% (5)
Why each option
The correct LDAP search filter syntax for an OR condition requires the `|` operator to precede the individual filter conditions in prefix notation: `(|(cn=ldapadmin)(ou=BR))`.
`((cn=ldapamin)|(ou=BR))` incorrectly places the `|` operator within the parentheses after the first condition, violating the required prefix notation.
LDAP search filters utilize prefix notation for logical operations. The `|` symbol represents the logical OR operator, and it must precede the list of conditions it applies to, such as `(|(cn=ldapadmin)(ou=BR))`, which correctly specifies a search for entries where `cn` is `ldapadmin` OR `ou` is `BR`.
`((cn=ldapamin) (ou=BR))` implies a logical AND operation by default when conditions are listed consecutively without an explicit operator, or it is syntactically incorrect for an OR operation.
`((cn=ldapamin) (ou=BR)|)` places the `|` operator at the end, which is syntactically incorrect for an LDAP filter.
`((cn=ldapamin)||(ou=BR))` uses `||`, which is not the standard LDAP filter syntax for OR; the correct operator is a single `|`.
Concept tested: LDAP search filter syntax
Source: https://www.rfc-editor.org/rfc/rfc4515.html
Topics
Community Discussion
No community discussion yet for this question.