Author: tridge Date: 2006-09-27 05:57:41 +0000 (Wed, 27 Sep 2006) New Revision: 18942
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=18942 Log: add a ldb_set_create_perms() function in ldb. I didn't call it ldb_set_umask() (which is what we had discussed) as it doesn't actually set the umask (in effect it sets the inverse of the umask - the perms to be used for the file) Modified: branches/SAMBA_4_0/source/lib/ldb/common/ldb.c branches/SAMBA_4_0/source/lib/ldb/include/ldb.h branches/SAMBA_4_0/source/lib/ldb/include/ldb_private.h branches/SAMBA_4_0/source/lib/ldb/ldb_tdb/ldb_tdb.c Changeset: Modified: branches/SAMBA_4_0/source/lib/ldb/common/ldb.c =================================================================== --- branches/SAMBA_4_0/source/lib/ldb/common/ldb.c 2006-09-27 04:37:34 UTC (rev 18941) +++ branches/SAMBA_4_0/source/lib/ldb/common/ldb.c 2006-09-27 05:57:41 UTC (rev 18942) @@ -52,6 +52,7 @@ } ldb_set_utf8_default(ldb); + ldb_set_create_perms(ldb, 0666); return ldb; } @@ -455,6 +456,16 @@ return LDB_SUCCESS; } + +/* + set the permissions for new files to be passed to open() in + backends that use local files + */ +void ldb_set_create_perms(struct ldb_context *ldb, unsigned int perms) +{ + ldb->create_perms = perms; +} + /* start an ldb request NOTE: the request must be a talloc context. Modified: branches/SAMBA_4_0/source/lib/ldb/include/ldb.h =================================================================== --- branches/SAMBA_4_0/source/lib/ldb/include/ldb.h 2006-09-27 04:37:34 UTC (rev 18941) +++ branches/SAMBA_4_0/source/lib/ldb/include/ldb.h 2006-09-27 05:57:41 UTC (rev 18942) @@ -781,6 +781,7 @@ int ldb_set_timeout(struct ldb_context *ldb, struct ldb_request *req, int timeout); int ldb_set_timeout_from_prev_req(struct ldb_context *ldb, struct ldb_request *oldreq, struct ldb_request *newreq); +void ldb_set_create_perms(struct ldb_context *ldb, unsigned int perms); /** Initialise ldbs' global information Modified: branches/SAMBA_4_0/source/lib/ldb/include/ldb_private.h =================================================================== --- branches/SAMBA_4_0/source/lib/ldb/include/ldb_private.h 2006-09-27 04:37:34 UTC (rev 18941) +++ branches/SAMBA_4_0/source/lib/ldb/include/ldb_private.h 2006-09-27 05:57:41 UTC (rev 18942) @@ -119,6 +119,8 @@ int default_timeout; unsigned int flags; + + unsigned int create_perms; }; #ifndef ARRAY_SIZE Modified: branches/SAMBA_4_0/source/lib/ldb/ldb_tdb/ldb_tdb.c =================================================================== --- branches/SAMBA_4_0/source/lib/ldb/ldb_tdb/ldb_tdb.c 2006-09-27 04:37:34 UTC (rev 18941) +++ branches/SAMBA_4_0/source/lib/ldb/ldb_tdb/ldb_tdb.c 2006-09-27 05:57:41 UTC (rev 18942) @@ -1036,7 +1036,8 @@ /* note that we use quite a large default hash size */ ltdb->tdb = ltdb_wrap_open(ltdb, path, 10000, - tdb_flags, open_flags, 0644, ldb); + tdb_flags, open_flags, + ldb->create_perms, ldb); if (!ltdb->tdb) { ldb_debug(ldb, LDB_DEBUG_ERROR, "Unable to open tdb '%s'\n", path); talloc_free(ltdb);
