diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2012-12-03 16:19:19 +0100 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2012-12-06 20:30:32 +0100 |
commit | 345d1015b63135b94969f02144ac2bba48d7506c (patch) | |
tree | acc722bf1c27ce209b4114fd484c29b1917410fd /libmsi | |
parent | cae89a6a821afa54e50614f05ef704c516459dfb (diff) | |
download | msitools-345d1015b63135b94969f02144ac2bba48d7506c.tar.gz msitools-345d1015b63135b94969f02144ac2bba48d7506c.tar.xz msitools-345d1015b63135b94969f02144ac2bba48d7506c.zip |
block writes to databases that were open as read-only
Diffstat (limited to 'libmsi')
-rw-r--r-- | libmsi/database.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libmsi/database.c b/libmsi/database.c index 1ba8bf6..31419ee 100644 --- a/libmsi/database.c +++ b/libmsi/database.c @@ -175,6 +175,9 @@ unsigned msi_create_storage( LibmsiDatabase *db, const WCHAR *stname, IStream *s HRESULT hr; unsigned r; + if ( db->mode == LIBMSI_DB_OPEN_READONLY ) + return LIBMSI_RESULT_ACCESS_DENIED; + LIST_FOR_EACH_ENTRY( storage, &db->storages, LibmsiStorage, entry ) { if( !strcmpW( stname, storage->name ) ) @@ -348,6 +351,9 @@ unsigned msi_create_stream( LibmsiDatabase *db, const WCHAR *stname, IStream *st unsigned count; uint8_t *data; + if ( db->mode == LIBMSI_DB_OPEN_READONLY ) + return LIBMSI_RESULT_ACCESS_DENIED; + encname = encode_streamname(false, stname); LIST_FOR_EACH_ENTRY( stream, &db->streams, LibmsiStream, entry ) { |