Source code pulled from OpenBSD for OpenNTPD. The place to contribute to this code is via the OpenBSD CVS tree.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
1004 B

  1. #!/usr/bin/awk -f
  2. #
  3. # Generates a login.conf file from login.conf.in and an optional
  4. # file containing overrides.
  5. #
  6. # Usage: mklogin.conf [overrides_file] < login.conf.in > login.conf.out
  7. #
  8. # $OpenBSD: mklogin.conf,v 1.7 2012/06/20 18:32:04 deraadt Exp $
  9. BEGIN {
  10. # Default substitutions
  11. values["DEF_DATASIZE_MAX"]="512M"
  12. values["DEF_DATASIZE_CUR"]="512M"
  13. values["DEF_MAXPROC_MAX"]="256"
  14. values["DEF_MAXPROC_CUR"]="128"
  15. values["DEF_OPENFILES_CUR"]="512"
  16. values["STAFF_DATASIZE_MAX"]="infinity"
  17. values["STAFF_DATASIZE_CUR"]="512M"
  18. values["STAFF_MAXPROC_MAX"]="512"
  19. values["STAFF_MAXPROC_CUR"]="128"
  20. values["STAFF_OPENFILES_CUR"]="512"
  21. values["DEF_BLOWFISH_RNDS"]="6"
  22. values["ROOT_BLOWFISH_RNDS"]="8"
  23. # Optional overrides
  24. if (ARGC > 1) {
  25. while (getline override < ARGV[1]) {
  26. split(override, ov)
  27. values[ov[1] ""]=ov[2] ""
  28. }
  29. ARGC--
  30. }
  31. }
  32. # Read in login.conf template, do substitutions and output the result
  33. {
  34. for (key in values)
  35. gsub("@" key "@", values[key], $0)
  36. print $0
  37. }