+static int _pam_load_conf_file(pam_handle_t *pamh, const char *config_name
+ , const char *service /* specific file */
+ , int module_type /* specific type */
+#ifdef PAM_READ_BOTH_CONFS
+ , int not_other
+#endif /* PAM_READ_BOTH_CONFS */
+ )
+{
+ FILE *f;
+ char *config_path = NULL;
+ int retval = PAM_ABORT;
+
+ D(("_pam_load_conf_file called"));
+
+ if (config_name == NULL) {
+ D(("no config file supplied"));
+ _pam_system_log(LOG_ERR, "(%s) no config file supplied", service);
+ return PAM_ABORT;
+ }
+
+ if (config_name[0] != '/') {
+ if (asprintf (&config_path, PAM_CONFIG_DF, config_name) < 0) {
+ _pam_system_log(LOG_CRIT, "asprintf failed");
+ return PAM_BUF_ERR;
+ }
+ config_name = config_path;
+ }
+
+ D(("opening %s", config_name));
+ f = fopen(config_name, "r");
+ if (f != NULL) {
+ retval = _pam_parse_conf_file(pamh, f, service, module_type
+#ifdef PAM_READ_BOTH_CONFS
+ , not_other
+#endif /* PAM_READ_BOTH_CONFS */
+ );
+ fclose(f);
+ if (retval != PAM_SUCCESS)
+ _pam_system_log(LOG_ERR,
+ "_pam_load_conf_file: error reading %s: %s",
+ config_name, pam_strerror(pamh, retval));
+ } else {
+ D(("unable to open %s", filename));
+ _pam_system_log(LOG_ERR,
+ "_pam_load_conf_file: unable to open %s",
+ config_name);
+ }
+
+ _pam_drop(config_path);
+ return retval;
+}
+