mirror of
https://github.com/samba-team/samba.git
synced 2025-08-03 04:22:09 +03:00
allow posix locking database to be opened read-only (for smbstatus)
This commit is contained in:
@ -233,7 +233,7 @@ BOOL locking_init(int read_only)
|
|||||||
return False;
|
return False;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!posix_locking_init())
|
if (!posix_locking_init(read_only))
|
||||||
return False;
|
return False;
|
||||||
|
|
||||||
return True;
|
return True;
|
||||||
|
@ -1346,25 +1346,25 @@ void posix_locking_close_file(files_struct *fsp)
|
|||||||
Create the in-memory POSIX lock databases.
|
Create the in-memory POSIX lock databases.
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
|
|
||||||
BOOL posix_locking_init(void)
|
BOOL posix_locking_init(int read_only)
|
||||||
{
|
{
|
||||||
if (posix_lock_tdb && posix_pending_close_tdb)
|
if (posix_lock_tdb && posix_pending_close_tdb)
|
||||||
return True;
|
return True;
|
||||||
|
|
||||||
if (!posix_lock_tdb)
|
if (!posix_lock_tdb)
|
||||||
posix_lock_tdb = tdb_open(NULL, 0, TDB_INTERNAL,
|
posix_lock_tdb = tdb_open(NULL, 0, TDB_INTERNAL,
|
||||||
O_RDWR|O_CREAT, 0644);
|
read_only?O_RDONLY:(O_RDWR|O_CREAT), 0644);
|
||||||
if (!posix_lock_tdb) {
|
if (!posix_lock_tdb) {
|
||||||
DEBUG(0,("Failed to open POSIX byte range locking database.\n"));
|
DEBUG(0,("Failed to open POSIX byte range locking database.\n"));
|
||||||
return False;
|
return False;
|
||||||
}
|
}
|
||||||
if (!posix_pending_close_tdb)
|
if (!posix_pending_close_tdb)
|
||||||
posix_pending_close_tdb = tdb_open(NULL, 0, TDB_INTERNAL,
|
posix_pending_close_tdb = tdb_open(NULL, 0, TDB_INTERNAL,
|
||||||
O_RDWR|O_CREAT, 0644);
|
read_only?O_RDONLY:(O_RDWR|O_CREAT), 0644);
|
||||||
if (!posix_pending_close_tdb) {
|
if (!posix_pending_close_tdb) {
|
||||||
DEBUG(0,("Failed to open POSIX pending close database.\n"));
|
DEBUG(0,("Failed to open POSIX pending close database.\n"));
|
||||||
return False;
|
return False;
|
||||||
}
|
}
|
||||||
|
|
||||||
return True;
|
return True;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user