ldb: Fix permissions of group_mapping.ldb.
authorAndrew Tridgell <tridge@samba.org>
Wed, 27 Aug 2008 08:45:43 +0000 (10:45 +0200)
committerKarolin Seeger <kseeger@samba.org>
Wed, 27 Aug 2008 10:08:39 +0000 (12:08 +0200)
This one fixes bug #5715 and CVE-2008-3789.
(cherry picked from commit a94f44c49f668fcf12f4566777a668043326bf97)
(This used to be commit 2eaf4ed62220246bcc1a9702166b0b4f381fdae3)

source3/groupdb/mapping_ldb.c

index 6775f612e79bb419b40f60953852d3d18af52df0..ce65d7c46d571c506329877b2481cdbf3a810295 100644 (file)
@@ -74,7 +74,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;