ldcltU.c 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. /** BEGIN COPYRIGHT BLOCK
  2. * This Program is free software; you can redistribute it and/or modify it under
  3. * the terms of the GNU General Public License as published by the Free Software
  4. * Foundation; version 2 of the License.
  5. *
  6. * This Program is distributed in the hope that it will be useful, but WITHOUT
  7. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  8. * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  9. *
  10. * You should have received a copy of the GNU General Public License along with
  11. * this Program; if not, write to the Free Software Foundation, Inc., 59 Temple
  12. * Place, Suite 330, Boston, MA 02111-1307 USA.
  13. *
  14. * In addition, as a special exception, Red Hat, Inc. gives You the additional
  15. * right to link the code of this Program with code not covered under the GNU
  16. * General Public License ("Non-GPL Code") and to distribute linked combinations
  17. * including the two, subject to the limitations in this paragraph. Non-GPL Code
  18. * permitted under this exception must only link to the code of this Program
  19. * through those well defined interfaces identified in the file named EXCEPTION
  20. * found in the source code files (the "Approved Interfaces"). The files of
  21. * Non-GPL Code may instantiate templates or use macros or inline functions from
  22. * the Approved Interfaces without causing the resulting work to be covered by
  23. * the GNU General Public License. Only Red Hat, Inc. may make changes or
  24. * additions to the list of Approved Interfaces. You must obey the GNU General
  25. * Public License in all respects for all of the Program code and other code used
  26. * in conjunction with the Program except the Non-GPL Code covered by this
  27. * exception. If you modify this file, you may extend this exception to your
  28. * version of the file, but you are not obligated to do so. If you do not wish to
  29. * provide this exception without modification, you must delete this exception
  30. * statement from your version and license this file solely under the GPL without
  31. * exception.
  32. *
  33. *
  34. * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
  35. * Copyright (C) 2007 Red Hat, Inc.
  36. * All rights reserved.
  37. * END COPYRIGHT BLOCK **/
  38. #ifdef HAVE_CONFIG_H
  39. # include <config.h>
  40. #endif
  41. #include <stdio.h>
  42. /*
  43. * usage: ldclt [-qQvV] [-E <max errors>]
  44. * [-b <base DN>] [-h <host>] [-p <port>] [-t <timeout>]
  45. * [-D <bind DN>] [-w <passwd>] [-o <SASL option>]
  46. * [-e <execParams>] [-a <max pending>]
  47. * [-n <nb threads>] [-i <nb times>] [-N <nb samples>]
  48. * [-I <err number>] [-T <total>]
  49. * [-r <low> -R <high>]
  50. * [-f <filter>] [-s <scope>]
  51. * [-S <slave>] [-P<master port>]
  52. * [-W <waitsec>] [-Z <certfile>]
  53. *
  54. * This tool is a ldap client targetted to validate the reliability of
  55. * the product under test under hard use.
  56. *
  57. * The valid options are:
  58. * -a Asynchronous mode, with max pending operations.
  59. * -b Give the base DN to use. Default "dc=example,dc=com".
  60. * -D Bind DN. See -w
  61. * -E Max errors allowed. Default 1000.
  62. * -e Execution parameters:
  63. * add : ldap_add() entries.
  64. * append : append entries to the genldif file.
  65. * ascii : ascii 7-bits strings.
  66. * attreplace=name:mask : replace attribute of existing entry.
  67. * attrlist=name:name:name : specify list of attribs to retrieve
  68. * attrsonly=0|1 : ldap_search() parameter. Set 0 to read values.
  69. * bindeach : ldap_bind() for each operation.
  70. * bindonly : only bind/unbind, no other operation is performed.
  71. * close : will close() the fd, rather than ldap_unbind().
  72. * cltcertname=name : name of the SSL client certificate
  73. * commoncounter : all threads share the same counter.
  74. * counteach : count each operation not only successful ones.
  75. * delete : ldap_delete() entries.
  76. * dontsleeponserverdown : will loop very fast if server down.
  77. * emailPerson : objectclass=emailPerson (-e add only).
  78. * esearch : exact search.
  79. * genldif=filename : generates a ldif file
  80. * imagesdir=path : specify where are the images.
  81. * incr : incremental values.
  82. * inetOrgPerson : objectclass=inetOrgPerson (-e add only).
  83. * keydbfile=file : filename of the key database
  84. * keydbpin=password : password for accessing the key database
  85. * noglobalstats : don't print periodical global statistics
  86. * noloop : does not loop the incremental numbers.
  87. * object=filename : build object from input file
  88. * person : objectclass=person (-e add only).
  89. * random : random filters, etc...
  90. * randomattrlist=name:name:name : random select attrib in the list
  91. * randombase : random base DN.
  92. * randombaselow=value : low value for random generator.
  93. * randombasehigh=value : high value for random generator.
  94. * randombinddn : random bind DN.
  95. * randombinddnfromfile=fine : retrieve bind DN & passwd from file
  96. * randombinddnlow=value : low value for random generator.
  97. * randombinddnhigh=value : high value for random generator.
  98. * rdn=attrname:value : alternate for -f.
  99. * referral=on|off|rebind : change referral behaviour.
  100. * scalab01 : activates scalab01 scenario.
  101. * scalab01_cnxduration : maximum connection duration.
  102. * scalab01_maxcnxnb : modem pool size.
  103. * scalab01_wait : sleep() between 2 attempts to connect.
  104. * smoothshutdown : main thread waits till the worker threads exit.
  105. * string : create random strings rather than random numbers.
  106. * v2 : ldap v2.
  107. * withnewparent : rename with newparent specified as argument.
  108. * -f Filter for searches.
  109. * -h Host to connect. Default "localhost".
  110. * -i Number of times inactivity allowed. Default 3 (30 seconds)
  111. * -I Ignore errors (cf. -E). Default none.
  112. * -n Number of threads. Default 10.
  113. * -N Number of samples (10 seconds each). Default infinite.
  114. * -o SASL Option.
  115. * -p Server port. Default 389.
  116. * -P Master port (to check replication). Default 16000.
  117. * -q Quiet mode. See option -I.
  118. * -Q Super quiet mode.
  119. * -r Range's low value.
  120. * -R Range's high value.
  121. * -s Scope. May be base, subtree or one. Default subtree.
  122. * -S Slave to check.
  123. * -t LDAP operations timeout. Default 30 seconds.
  124. * -T Total number of operations per thread. Default infinite.
  125. * -v Verbose.
  126. * -V Very verbose.
  127. * -w Bind passwd. See -D.
  128. * -W Wait between two operations. Default 0 seconds.
  129. * -Z certfile. Turn on SSL and use certfile as the certificate DB
  130. */
  131. void usage ()
  132. {
  133. (void) printf ("\n");
  134. (void) printf ("usage: ldclt [-qQvV] [-E <max errors>]\n");
  135. (void) printf (" [-b <base DN>] [-h <host>] [-p <port>] [-t <timeout>]\n");
  136. (void) printf (" [-D <bind DN>] [-w <passwd>] [-o <SASL option>]\n");
  137. (void) printf (" [-e <execParams>] [-a <max pending>]\n");
  138. (void) printf (" [-n <nb threads>] [-i <nb times>] [-N <nb samples>]\n");
  139. (void) printf (" [-I <err number>] [-T <total>]\n");
  140. (void) printf (" [-r <low> -R <high>]\n");
  141. (void) printf (" [-f <filter>] [-s <scope>]\n");
  142. (void) printf (" [-S <slave>] [-P<master port>]\n");
  143. (void) printf (" [-W <waitsec>] [-Z <certfile>]\n");
  144. (void) printf ("\n");
  145. (void) printf (" This tool is a ldap client targetted to validate the reliability of\n");
  146. (void) printf (" the product under test under hard use.\n");
  147. (void) printf ("\n");
  148. (void) printf (" The valid options are:\n");
  149. (void) printf (" -a Asynchronous mode, with max pending operations.\n");
  150. (void) printf (" -b Give the base DN to use. Default \"o=sun,c=us\".\n");
  151. (void) printf (" -D Bind DN. See -w\n");
  152. (void) printf (" -E Max errors allowed. Default 1000.\n");
  153. (void) printf (" -e Execution parameters:\n");
  154. (void) printf (" add : ldap_add() entries.\n");
  155. (void) printf (" append : append entries to the genldif file.\n");
  156. (void) printf (" ascii : ascii 7-bits strings.\n");
  157. (void) printf (" attreplace=name:mask : replace attribute of existing entry.\n");
  158. (void) printf (" attrlist=name:name:name : specify list of attribs to retrieve\n");
  159. (void) printf (" attrsonly=0|1 : ldap_search() parameter. Set 0 to read values.\n");
  160. (void) printf (" bindeach : ldap_bind() for each operation.\n");
  161. (void) printf (" bindonly : only bind/unbind, no other operation is performed.\n");
  162. (void) printf (" close : will close() the fd, rather than ldap_unbind().\n");
  163. (void) printf (" cltcertname=name : name of the SSL client certificate\n");
  164. (void) printf (" commoncounter : all threads share the same counter.\n");
  165. (void) printf (" counteach : count each operation not only successful ones.\n");
  166. (void) printf (" delete : ldap_delete() entries.\n");
  167. (void) printf (" dontsleeponserverdown : will loop very fast if server down.\n");
  168. (void) printf (" emailPerson : objectclass=emailPerson (-e add only).\n");
  169. (void) printf (" esearch : exact search.\n");
  170. (void) printf (" genldif=filename : generates a ldif file\n");
  171. (void) printf (" imagesdir=path : specify where are the images.\n");
  172. (void) printf (" incr : incremental values.\n");
  173. (void) printf (" inetOrgPerson : objectclass=inetOrgPerson (-e add only).\n");
  174. (void) printf (" keydbfile=file : filename of the key database\n");
  175. (void) printf (" keydbpin=password : password for accessing the key database\n");
  176. (void) printf (" noglobalstats : don't print periodical global statistics\n");
  177. (void) printf (" noloop : does not loop the incremental numbers.\n");
  178. (void) printf (" object=filename : build object from input file\n");
  179. (void) printf (" person : objectclass=person (-e add only).\n");
  180. (void) printf (" random : random filters, etc...\n");
  181. (void) printf (" randomattrlist=name:name:name : random select attrib in the list\n");
  182. (void) printf (" randombase : random base DN.\n");
  183. (void) printf (" randombaselow=value : low value for random generator.\n");
  184. (void) printf (" randombasehigh=value : high value for random generator.\n");
  185. (void) printf (" randombinddn : random bind DN.\n");
  186. (void) printf (" randombinddnfromfile=fine : retrieve bind DN & passwd from file\n");
  187. (void) printf (" randombinddnlow=value : low value for random generator.\n");
  188. (void) printf (" randombinddnhigh=value : high value for random generator.\n");
  189. (void) printf (" rdn=attrname:value : alternate for -f.\n");
  190. (void) printf (" referral=on|off|rebind : change referral behaviour.\n");
  191. (void) printf (" scalab01 : activates scalab01 scenario.\n");
  192. (void) printf (" scalab01_cnxduration : maximum connection duration.\n");
  193. (void) printf (" scalab01_maxcnxnb : modem pool size.\n");
  194. (void) printf (" scalab01_wait : sleep() between 2 attempts to connect.\n");
  195. (void) printf (" smoothshutdown : main thread waits till the worker threads exit.\n");
  196. (void) printf (" string : create random strings rather than random numbers.\n");
  197. (void) printf (" v2 : ldap v2.\n");
  198. (void) printf (" withnewparent : rename with newparent specified as argument.\n");
  199. (void) printf (" randomauthid : random SASL Authid.\n");
  200. (void) printf (" randomauthidlow=value : low value for random SASL Authid.\n");
  201. (void) printf (" randomauthidhigh=value : high value for random SASL Authid.\n");
  202. (void) printf (" -f Filter for searches.\n");
  203. (void) printf (" -h Host to connect. Default \"localhost\".\n");
  204. (void) printf (" -i Number of times inactivity allowed. Default 3 (30 seconds)\n");
  205. (void) printf (" -I Ignore errors (cf. -E). Default none.\n");
  206. (void) printf (" -n Number of threads. Default 10.\n");
  207. (void) printf (" -N Number of samples (10 seconds each). Default infinite.\n");
  208. (void) printf (" -o SASL Option.\n");
  209. (void) printf (" -p Server port. Default 389.\n");
  210. (void) printf (" -P Master port (to check replication). Default 16000.\n");
  211. (void) printf (" -q Quiet mode. See option -I.\n");
  212. (void) printf (" -Q Super quiet mode.\n");
  213. (void) printf (" -r Range's low value.\n");
  214. (void) printf (" -R Range's high value.\n");
  215. (void) printf (" -s Scope. May be base, subtree or one. Default subtree.\n");
  216. (void) printf (" -S Slave to check.\n");
  217. (void) printf (" -t LDAP operations timeout. Default 30 seconds.\n");
  218. (void) printf (" -T Total number of operations per thread. Default infinite.\n");
  219. (void) printf (" -v Verbose.\n");
  220. (void) printf (" -V Very verbose.\n");
  221. (void) printf (" -w Bind passwd. See -D.\n");
  222. (void) printf (" -W Wait between two operations. Default 0 seconds.\n");
  223. (void) printf (" -Z certfile. Turn on SSL and use certfile as the certificate DB\n");
  224. (void) printf ("\n");
  225. } /* usage() */
  226. /* End of file */