nerdexam
CompTIA

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)).

Shells, Scripting and Data Management

Question

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" "_______"

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)
  • A
    3% (1)
  • B
    78% (31)
  • C
    5% (2)
  • D
    3% (1)
  • E
    13% (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))`.

A( (cn=ldapamin)|(ou=BR) )

`((cn=ldapamin)|(ou=BR))` incorrectly places the `|` operator within the parentheses after the first condition, violating the required prefix notation.

B( |(cn=ldapamin) (ou=BR) )Correct

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`.

C( (cn=ldapamin) (ou=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.

D( (cn=ldapamin) (ou=BR)| )

`((cn=ldapamin) (ou=BR)|)` places the `|` operator at the end, which is syntactically incorrect for an LDAP filter.

E( (cn=ldapamin)||(ou=BR) )

`((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

#LDAP search#ldapsearch command#LDAP filter syntax

Community Discussion

No community discussion yet for this question.

Full LX0-104 Practice