Scritto da
  • email
  • twitter
  • linkedin
  • linkedin

As you should know, each ldapsearch line output is wrapped: the max size of a line output is of 79 characters. By the way, as is so often the case, ldapsearch output is retrieved to be automatically processed by a script or something else: in these cases the line wrapping usually is a big problem.

As you should know, each ldapsearch line output is wrapped: the max size of a line output is of 79 characters.

By the way, as is so often the case, ldapsearch output is retrieved to be automatically processed by a script or something else: in these cases the line wrapping usually is a big problem.

A way to get around this defauld behavior is to provide the option ldif-wrap to ldapsearch.

 

Think about the following query asking for dn and title of the user Fabio Martelli.

              ldapsearch -x
              -h adhost.domain.com
              -p 389
              -D  cn=administrator,cn=users,dc=domain,dc=com
              -w password
              -s sub -b  "DC=domain,DC=com"
              "cn=Fabio Martelli" dn title

The result will be the following

dn: CN=Fabio Martelli,OU=Developers,OU=Identity Connectors,OU=Apache Syncope,DC=tirasa,DC=net
              title: developer

The line corresponding to the dn attribute will be wrapped as shown above.

A specific option can be used to avoid wrapping: ldif-wrap=no.

By changing the query as shown below we will solve our problem.

              ldapsearch -o ldif-wrap=no -x
              -h adhost.domain.com
              -p 389
              -D  cn=administrator,cn=users,dc=domain,dc=com
              -w password
              -s sub -b  "DC=domain,DC=com"
              "cn=Fabio Martelli" dn title
dn: CN=Fabio Martelli,OU=Developers,OU=Identity Connectors,OU=Apache Syncope,DC=tirasa,DC=net
              title: developer
87 VOTIGoodGood
Ti è stato utile questo articolo?
Dal Blog di Tirasa
Quello che facciamo, studiamo e pensiamo tutti i giorni lo condividiamo qui.
Vai al blog >