Skip to content

Commit

Permalink
MONITOR: todo
Browse files Browse the repository at this point in the history
  • Loading branch information
alexey-tikhonov committed Oct 19, 2023
1 parent 386ed5d commit cc0aeb3
Show file tree
Hide file tree
Showing 8 changed files with 139 additions and 195 deletions.
14 changes: 1 addition & 13 deletions src/confdb/confdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -648,8 +648,6 @@ int confdb_init(TALLOC_CTX *mem_ctx,
struct confdb_ctx *cdb;
int ret = EOK;
mode_t old_umask;
uid_t sssd_uid;
gid_t sssd_gid;

cdb = talloc_zero(mem_ctx, struct confdb_ctx);
if (!cdb)
Expand Down Expand Up @@ -682,19 +680,9 @@ int confdb_init(TALLOC_CTX *mem_ctx,
}

old_umask = umask(SSS_DFL_UMASK);
/* file may exists and could be owned by root from previous version */
sss_sssd_user_uid_and_gid(&sssd_uid, &sssd_gid);
ret = chown(confdb_location, sssd_uid, sssd_gid);
if (ret != EOK && errno != ENOENT) {
DEBUG(SSSDBG_MINOR_FAILURE, "Unable to chown config database [%s]: %s\n",
confdb_location, sss_strerror(errno));
}
sss_set_sssd_user_eid();

ret = ldb_connect(cdb->ldb, confdb_location, 0, NULL);

sss_restore_sssd_user_eid();
umask(old_umask);

if (ret != LDB_SUCCESS) {
DEBUG(SSSDBG_FATAL_FAILURE, "Unable to open config database [%s]\n",
confdb_location);
Expand Down
14 changes: 14 additions & 0 deletions src/confdb/confdb_setup.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <talloc.h>

#include "util/util_errors.h"
#include "util/sss_ini.h"

struct confdb_ctx;

Expand All @@ -37,4 +38,17 @@ errno_t confdb_setup(TALLOC_CTX *mem_ctx,
bool allow_missing_file,
struct confdb_ctx **_cdb);

errno_t confdb_read_ini(TALLOC_CTX *mem_ctx,
const char *config_file,
const char *config_dir,
bool allow_missing_config,
struct sss_ini **_ini);

errno_t confdb_write_ini(TALLOC_CTX *mem_ctx,
const struct sss_ini *ini,
const char *cdb_file,
const char *only_section,
bool allow_missing_content,
struct confdb_ctx **_cdb);

#endif /* CONFDB_SETUP_H_ */
2 changes: 1 addition & 1 deletion src/db/sysdb.h
Original file line number Diff line number Diff line change
Expand Up @@ -804,7 +804,7 @@ struct sysdb_upgrade_ctx {
int sysdb_init_ext(TALLOC_CTX *mem_ctx,
struct sss_domain_info *domains,
struct sysdb_upgrade_ctx *upgrade_ctx,
bool chown_dbfile,
bool chown_dbfile, /* revisit: remove */
uid_t uid, gid_t gid);

/* used to initialize only one domain database.
Expand Down
Loading

0 comments on commit cc0aeb3

Please sign in to comment.