files_init.c revision 0d6d493f68bb83a046d351cb3035b08ef5456b50
/*
SSSD
files_init.c - Initialization of the files provider
Copyright (C) 2016 Red Hat
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "providers/data_provider/dp.h"
#include "providers/files/files_private.h"
#define DEFAULT_PASSWD_FILE "/etc/passwd"
#define DEFAULT_GROUP_FILE "/etc/group"
const char ***_passwd_files,
const char ***_group_files)
{
char *conf_passwd_files;
char *conf_group_files;
char **passwd_list = NULL;
char **group_list = NULL;
int num_passwd_files = 0;
int num_group_files = 0;
const char **passwd_files = NULL;
const char **group_files = NULL;
const char *dfl_passwd_files = NULL;
const char *env_group_files = NULL;
int i;
goto done;
}
if (dfl_passwd_files) {
"Defaulting to %s for the passwd file, "
"this should only be used for testing!\n",
} else {
}
"Using default passwd file: [%s].\n", dfl_passwd_files);
if (env_group_files) {
"Defaulting to %s for the group file, "
"this should only be used for testing!\n",
} else {
}
"Using default group file: [%s].\n", DEFAULT_GROUP_FILE);
goto done;
}
goto done;
}
"Failed to parse passwd list!\n");
goto done;
}
num_passwd_files + 1);
if (passwd_files == NULL) {
goto done;
}
for (i = 0; i < num_passwd_files; i++) {
"Using passwd file: [%s].\n", passwd_list[i]);
if (passwd_files[i] == NULL) {
goto done;
}
}
/* Retrieve list of group files */
"Failed to parse group files!\n");
goto done;
}
num_group_files + 1);
if (group_files == NULL) {
goto done;
}
for (i = 0; i < num_group_files; i++) {
"Using group file: [%s].\n", group_list[i]);
if (group_files[i] == NULL) {
goto done;
}
}
done:
return ret;
}
struct data_provider *provider,
const char *module_name,
void **_module_data)
{
struct files_id_ctx *ctx;
return ENOMEM;
}
&ctx->passwd_files,
&ctx->group_files);
goto done;
}
ctx);
goto done;
}
*_module_data = ctx;
done:
}
return ret;
}
void *module_data,
struct dp_method *dp_methods)
{
struct files_id_ctx *ctx;
return EINVAL;
}
ctx, struct files_id_ctx,
struct dp_id_data, struct dp_reply_std);
NULL, void,
struct dp_get_acct_domain_data, struct dp_reply_std);
return EOK;
}