common.cc 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. // Copyright (C) 2009-2011 Internet Systems Consortium, Inc. ("ISC")
  2. //
  3. // Permission to use, copy, modify, and/or distribute this software for any
  4. // purpose with or without fee is hereby granted, provided that the above
  5. // copyright notice and this permission notice appear in all copies.
  6. //
  7. // THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
  8. // REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  9. // AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
  10. // INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  11. // LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
  12. // OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  13. // PERFORMANCE OF THIS SOFTWARE.
  14. #include <string>
  15. #include <auth/common.h>
  16. #include <auth/spec_config.h>
  17. #include <stdlib.h>
  18. using std::string;
  19. string
  20. getXfroutSocketPath() {
  21. if (getenv("B10_FROM_BUILD") != NULL) {
  22. if (getenv("B10_FROM_SOURCE_LOCALSTATEDIR") != NULL) {
  23. return (string(getenv("B10_FROM_SOURCE_LOCALSTATEDIR")) +
  24. "/auth_xfrout_conn");
  25. } else {
  26. return (string(getenv("B10_FROM_BUILD")) + "/auth_xfrout_conn");
  27. }
  28. } else {
  29. if (getenv("BIND10_XFROUT_SOCKET_FILE") != NULL) {
  30. return (getenv("BIND10_XFROUT_SOCKET_FILE"));
  31. } else {
  32. return (UNIX_XFROUT_SOCKET_FILE);
  33. }
  34. }
  35. }
  36. string
  37. getDDNSSocketPath() {
  38. if (getenv("B10_FROM_BUILD") != NULL) {
  39. if (getenv("B10_FROM_SOURCE_LOCALSTATEDIR") != NULL) {
  40. return (string(getenv("B10_FROM_SOURCE_LOCALSTATEDIR")) +
  41. "/ddns_socket");
  42. } else {
  43. return (string(getenv("B10_FROM_BUILD")) + "/ddns_socket");
  44. }
  45. } else {
  46. if (getenv("BIND10_DDNS_SOCKET_FILE") != NULL) {
  47. return (getenv("BIND10_DDNS_SOCKET_FILE"));
  48. } else {
  49. return (UNIX_DDNS_SOCKET_FILE);
  50. }
  51. }
  52. }
  53. const char* const AUTH_NAME = "b10-auth";