configuration.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /**
  2. * Licensed to the Apache Software Foundation (ASF) under one
  3. * or more contributor license agreements. See the NOTICE file
  4. * distributed with this work for additional information
  5. * regarding copyright ownership. The ASF licenses this file
  6. * to you under the Apache License, Version 2.0 (the
  7. * "License"); you may not use this file except in compliance
  8. * with the License. You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an "AS IS" BASIS,
  14. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. */
  18. /**
  19. * Get the full path of the configuration file.
  20. * Use $HADOOP_SECURITY_CONF_DIR for the configuration directory, and if
  21. * it's not set, use the default value in default_conf_dir.
  22. */
  23. void get_config_path(char* conf_file_path, int size,
  24. char* default_conf_dir,
  25. const char* conf_file_name);
  26. /**
  27. * Ensure that the configuration file and all of the containing directories
  28. * are only writable by root. Otherwise, an attacker can change the
  29. * configuration and potentially cause damage.
  30. * returns 0 if permissions are ok
  31. */
  32. int check_configuration_permissions(const char* file_name);
  33. // read the given configuration file
  34. void read_config(const char* config_file);
  35. //method exposed to get the configurations
  36. char *get_value(const char* key);
  37. //function to return array of values pointing to the key. Values are
  38. //comma seperated strings.
  39. char ** get_values(const char* key);
  40. // Extracts array of values from the comma separated list of values.
  41. char ** extract_values(char * value);
  42. // free the memory returned by get_values
  43. void free_values(char** values);
  44. //method to free allocated configuration
  45. void free_configurations();