summaryrefslogtreecommitdiff
path: root/source3/groupdb/mapping_ldb.c
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2008-09-03 11:52:54 -0400
committerSimo Sorce <idra@samba.org>2008-09-03 11:52:54 -0400
commitc5894e14771562bccd153a98610722632ca3956a (patch)
tree5ea00141df4ffa12bad3475fdafc525ffa4d92af /source3/groupdb/mapping_ldb.c
parenta1de4e988d7780f687bb7ed2288faf3dfbb9da71 (diff)
parent84fca380f2040c53d20fff41972d2f4102183766 (diff)
downloadsamba-c5894e14771562bccd153a98610722632ca3956a.tar.gz
samba-c5894e14771562bccd153a98610722632ca3956a.tar.bz2
samba-c5894e14771562bccd153a98610722632ca3956a.zip
Merge branch 'v3-devel' of ssh://git.samba.org/data/git/samba into v3-devel
(This used to be commit 8e4dca3b9416d9b5e535bda5e4befc073bfc1641)
Diffstat (limited to 'source3/groupdb/mapping_ldb.c')
-rw-r--r--source3/groupdb/mapping_ldb.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/source3/groupdb/mapping_ldb.c b/source3/groupdb/mapping_ldb.c
index 6775f612e7..7ce879fb6e 100644
--- a/source3/groupdb/mapping_ldb.c
+++ b/source3/groupdb/mapping_ldb.c
@@ -60,6 +60,9 @@ static bool init_group_mapping(void)
ldb = ldb_init(NULL);
if (ldb == NULL) goto failed;
+ /* Ensure this db is created read/write for root only. */
+ ldb_set_create_perms(ldb, 0600);
+
existed = file_exist(db_path, NULL);
if (lp_parm_bool(-1, "groupmap", "nosync", False)) {
@@ -74,7 +77,13 @@ static bool init_group_mapping(void)
if (ret != LDB_SUCCESS) {
goto failed;
}
-
+
+ /* force the permissions on the ldb to 0600 - this will fix
+ existing databases as well as new ones */
+ if (chmod(db_path, 0600) != 0) {
+ goto failed;
+ }
+
if (!existed) {
/* initialise the ldb with an index */
struct ldb_ldif *ldif;