/*
SSSD
Files provider operations
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 <dlfcn.h>
#include "config.h"
#include "providers/files/files_private.h"
/* When changing this constant, make sure to also adjust the files integration
* test for reallocation branch
*/
struct files_ctx {
};
struct files_id_ctx *id_ctx,
const char *passwd_file,
{
if (pwd_handle == NULL) {
"Cannot open passwd file %s [%d]\n",
passwd_file, ret);
goto done;
}
goto done;
}
/* FIXME - we might want to support paging of sorts to avoid allocating
* all users atop a memory context or only return users that differ from
* the local storage as a diff to minimize memory spikes
*/
goto done;
}
/* We only check pw_name here on purpose to allow broken
* records to be optionally rejected when saving them
* or fallback values to be used.
*/
goto done;
}
n_users++;
if (n_users % FILES_REALLOC_CHUNK == 0) {
struct passwd *,
goto done;
}
}
}
done:
}
if (pwd_handle) {
if (close_ret != 0) {
"Cannot close passwd file %s [%d]\n",
}
}
return ret;
}
struct files_id_ctx *id_ctx,
const char *group_file,
{
if (grp_handle == NULL) {
"Cannot open group file %s [%d]\n",
group_file, ret);
goto done;
}
goto done;
}
goto done;
}
/* We only check gr_name here on purpose to allow broken
* records to be optionally rejected when saving them
* or fallback values to be used.
*/
goto done;
}
goto done;
}
goto done;
}
}
}
n_groups++;
if (n_groups % FILES_REALLOC_CHUNK == 0) {
struct group *,
goto done;
}
}
}
done:
}
if (grp_handle) {
if (close_ret != 0) {
"Cannot close group file %s [%d]\n",
}
}
return ret;
}
{
return ENOMEM;
}
goto done;
}
goto done;
}
done:
return ret;
}
{
char *fqname;
const char *shell;
const char *gecos;
return EOK;
}
return ENOMEM;
}
goto done;
}
goto done;
}
} else {
}
} else {
}
/* FIXME - optimize later */
NULL, 0, 0);
goto done;
}
done:
return ret;
}
enum sysdb_member_type type)
{
NULL};
size_t c;
int ret;
const char *filter;
return EINVAL;
}
return ENOMEM;
}
type == SYSDB_MEMBER_USER ?
goto done;
}
goto done;
}
} else {
}
goto done;
}
for (c = 0; c < count; c++) {
goto done;
}
continue;
}
if (ret != LDB_SUCCESS) {
continue;
}
if (ret != LDB_SUCCESS) {
continue;
}
if (ret != LDB_SUCCESS) {
"Failed to store override DN: %s(%d)[%s], skipping.\n",
continue;
}
}
done:
return ret;
}
const char *group_file);
const char *passwd_file)
{
return ENOMEM;
}
&users);
goto done;
}
"Cannot save user %s: [%d]: %s\n",
continue;
}
}
"Failed to refresh override attributes, "
"override values might not be available.\n");
}
done:
return ret;
}
struct sss_domain_info *dom)
{
unsigned c = 0;
goto done;
}
if (user_names == NULL) {
goto done;
}
NULL);
if (user_names[c] == NULL) {
continue;
}
c++;
}
done:
/* Don't free res and keep it around to avoid duplicating the names */
return user_names;
}
{
return ENOMEM;
}
goto done;
}
goto done;
}
done:
return ret;
}
const char **cached_users)
{
char *fqname;
char **fq_gr_files_mem;
const char **fq_gr_mem;
unsigned mi = 0;
return EOK;
}
return ENOMEM;
}
goto done;
}
goto done;
}
if (fq_gr_files_mem == NULL) {
goto done;
}
goto done;
}
for (unsigned i=0; fq_gr_files_mem[i] != NULL; i++) {
if (string_in_list(fq_gr_files_mem[i],
true)) {
mi++;
"User %s is cached, will become a member of %s\n",
} else {
fq_gr_files_mem[i]);
"Cannot add ghost %s for group %s\n",
fq_gr_files_mem[i], fqname);
continue;
}
"User %s is not cached, will become a ghost of %s\n",
}
}
(const char *const *) fq_gr_mem);
if (ret) {
goto done;
}
}
}
attrs, 0, 0);
if (ret) {
goto done;
}
done:
return ret;
}
const char *group_file)
{
return ENOMEM;
}
&groups);
goto done;
}
if (cached_users == NULL) {
goto done;
}
continue;
}
}
"Failed to refresh override attributes, "
"override values might not be available.\n");
}
done:
return ret;
}
{
bool in_transaction = false;
goto done;
}
in_transaction = true;
if (flags & SF_UPDATE_PASSWD) {
goto done;
}
/* All users were deleted, therefore we need to enumerate each file again */
"The file %s does not exist (yet), skipping\n",
id_ctx->passwd_files[i]);
continue;
"Cannot enumerate users from %s, aborting\n",
id_ctx->passwd_files[i]);
goto done;
}
}
}
if (flags & SF_UPDATE_GROUP) {
goto done;
}
/* All groups were deleted, therefore we need to enumerate each file again */
"The file %s does not exist (yet), skipping\n",
id_ctx->group_files[i]);
continue;
"Cannot enumerate groups from %s, aborting\n",
id_ctx->group_files[i]);
goto done;
}
}
}
goto done;
}
in_transaction = false;
done:
if (in_transaction) {
"Cannot cancel transaction: %d\n", ret);
}
}
return ret;
}
{
/* Only activate a domain when both callbacks are done */
if (id_ctx->updating_passwd == false
&& id_ctx->updating_groups == false) {
}
}
{
return EINVAL;
}
id_ctx->updating_passwd = true;
* only then edits passwd and adds the user. The reverse is not needed,
*/
"Could not update files: [%d]: %s\n",
goto done;
}
done:
id_ctx->updating_passwd = false;
return ret;
}
{
return EINVAL;
}
id_ctx->updating_groups = true;
"Could not update files: [%d]: %s\n",
goto done;
}
done:
id_ctx->updating_groups = false;
return ret;
}
struct tevent_immediate *imm,
void *pvt)
{
"Could not update files after startup: [%d]: %s\n",
}
}
struct tevent_context *ev,
const char *filename,
struct files_id_ctx *id_ctx)
{
}
struct tevent_context *ev,
const char **passwd_files,
const char **group_files,
struct files_id_ctx *id_ctx)
{
int i;
return NULL;
}
for (i = 0; passwd_files[i]; i++) {
"Cannot set watch for passwd file %s\n", passwd_files[i]);
/* Rather than reporting incomplete or inconsistent information
* in case e.g. group memberships span multiple files, just abort
*/
return NULL;
}
}
for (i = 0; group_files[i]; i++) {
"Cannot set watch for group file %s\n", group_files[i]);
/* Rather than reporting incomplete or inconsistent information
* in case e.g. group memberships span multiple files, just abort
*/
return NULL;
}
}
/* Enumerate users and groups on startup to process any changes when
* sssd was down. We schedule a request here to minimize the time
* we spend in the init function
*/
return NULL;
}
return fctx;
}