listConfigAttrs.pl 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. #
  2. # BEGIN COPYRIGHT BLOCK
  3. # Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
  4. # Copyright (C) 2005 Red Hat, Inc.
  5. # All rights reserved.
  6. #
  7. # License: GPL (version 3 or any later version).
  8. # See LICENSE for details.
  9. # END COPYRIGHT BLOCK
  10. #
  11. # give several files on the command line
  12. # from the first file will be extracted the following mappings:
  13. # directive #define name to "real" name and vice versa
  14. # attr #define name to "real" name and vice versa
  15. # directive name to attr name and vice versa
  16. # this file will typically be slap.h
  17. #
  18. # from the second file will be extracted
  19. # the list of config var members of the slapd frontend config structure
  20. # this file will also usually be slap.h
  21. #
  22. # from the third file will be extracted
  23. # the mapping of directive #define name to the function which sets its value
  24. # this file will typically be config.c
  25. %DIRECTIVEDEF2NAME = ();
  26. %DIRECTIVENAME2DEF = ();
  27. %ATTRDEF2NAME = ();
  28. %ATTRNAME2DEF = ();
  29. %DIRECTIVE2ATTR = ();
  30. %ATTR2DIRECTIVE = ();
  31. %SETFUNC2VAR = ();
  32. # these are the ldbm specific attributes
  33. %LDBMATTRS = ();
  34. $filename = 'slap.h';
  35. open(F, $filename) or die "Error: could not open $filename: $!";
  36. while (<F>) {
  37. if (/(CONFIG_.+?_ATTRIBUTE)\s+[\"](.+?)[\"]/) {
  38. # "
  39. $ATTRDEF2NAME{$1} = $2;
  40. $ATTRNAME2DEF{$2} = $1;
  41. }
  42. }
  43. close F;
  44. $filename = 'libglobs.c';
  45. open(F, $filename) or die "Error: could not open $filename: $!";
  46. while (<F>) {
  47. if (/^\s*\{(CONFIG_.+?_ATTRIBUTE),/) {
  48. $attrdef = $1;
  49. $def = $_;
  50. do {
  51. $_ = <F>;
  52. $def .= $_;
  53. } until ($def =~ /\}[,]?\s*$/);
  54. ($ignore, $setfunc, $logsetfunc, $whichlog, $varname, $type, $getfunc) =
  55. split(/\s*\,\s*/, $def);
  56. # print "attrdef = $attrdef\n";
  57. # print "attrname = $ATTRDEF2NAME{$attrdef}\n";
  58. # print "type = $type\n";
  59. # print "setfunc = $setfunc\n";
  60. print "$ATTRDEF2NAME{$attrdef} $type";
  61. if ((($setfunc =~ /0/) || ($setfunc =~ /NULL/)) &&
  62. (($logsetfunc =~ /0/) || ($logsetfunc =~ /NULL/))) {
  63. print " is read only";
  64. }
  65. print "\n";
  66. }
  67. }
  68. print "\nTypes:\n";
  69. print "\tCONFIG_INT\t\tan integer\n";
  70. print "\tCONFIG_LONG\t\tan integer\n";
  71. print "\tCONFIG_STRING\t\ta string\n";
  72. print "\tCONFIG_CHARRAY\t\ta list of strings\n";
  73. print "\tCONFIG_ON_OFF\t\tthe string \"on\" or \"off\"\n";
  74. print "\tCONFIG_STRING_OR_OFF\ta string or \"off\" if not applicable\n";
  75. print "\tCONFIG_STRING_OR_UNKNOWN\ta string or \"unknown\" if not applicable\n";
  76. print "\tCONFIG_CONSTANT_INT\tan integer\n";
  77. print "\tCONFIG_CONSTANT_STRING\ta string\n";
  78. print "\tCONFIG_SPECIAL_REFERRALLIST\ta list of strings\n";
  79. print "\tCONFIG_SPECIAL_STORESTATEINFO\tan integer\n";
  80. print "\tCONFIG_SPECIAL_SSLCLIENTAUTH\t\"off\" or \"allowed\" or \"required\"\n";
  81. print "\tCONFIG_SPECIAL_ERRORLOGLEVEL\tan integer\n";
  82. # get a list of ldbm attributes and directives
  83. $filename = 'back-ldbm/backldbm_configdse.c';
  84. open(F, $filename) or die "Error: could not open $filename: $!";
  85. while (<F>) {
  86. if (/attr_replace[^"]+["]([^"]+)["]/) {
  87. $LDBMATTRS{$1} = "\n";
  88. }
  89. if (/sprintf[^"]+["](\w+)\\t/) {
  90. $LDBMDIRECTIVES{$1} = "\n";
  91. }
  92. }
  93. close F;
  94. $filename = 'back-ldbm/dblayer.c';
  95. open(F, $filename) or die "Error: could not open $filename: $!";
  96. while (<F>) {
  97. if (/dblayer_config_type_[^"]+["]([^"]+)["]/) {
  98. $LDBMDIRECTIVES{$1} = "\n";
  99. }
  100. }
  101. close F;