1

Our application connects to a Lotus Domino server and works on its databases. Once we saw a corrupt database in one of our client's server which could not be opened with the Lotus Notes client. Unfortunately the client's staff have deleted it before we could ask a copy but we would like to test the error handling of the application with this kind of corrupt databases too.

We have also tried to modify some random bytes in a good database with a hex editor to make it corrupt without success. We're looking for a way to create a corrupt database or a freely downloadable one.

palacsint
  • 28,416
  • 10
  • 82
  • 109

2 Answers2

4

IBM has not documented the detailed internal structure of the NSF file, so there's really no good guide to simulating corrupted databases.

If you modify all the bytes to zero, however, that will surely give you a very corrupt database. It won't be particularly useful to test your application's behavior, and this most likely won't be the same type of corruption that you saw on your client's sever.

There are many ways an NSF could be corrupted. Some are automatically fixed by the server. Some will prevent the database from being opened. Some will allow you to open the database but prevent reads or updates from occurring. Some may cause data returned by API calls to be lost or mangled. Some will crash the Notes API core DLLs. I don't really think it's possible to test your code's behavior for all possible types of corruption. Not in a reasonable number of test cases, anyhow. (I.e., I'm guessing about 1,000 cases of randomly zeroing out one of the individual non-zero bytes in a minimal-sized NSF would have a good probability of inflicting most of the different kinds of damage that are possible.)

palacsint
  • 28,416
  • 10
  • 82
  • 109
Richard Schwartz
  • 14,463
  • 2
  • 23
  • 41
2

The internal structure of a Lotus Notes/ Domino database is best described as a container model, to get at the data inside you need to access the database container which is protected by its ACL (Access Control List). Once your inside pretty much everything is a 'Document', a unique record identified by its UNID. Some of these 'documents' are design elements like forms, agents, views (and even its ACL) etc while others are actual data records. A corruption involves one or more of these breaking, depending on what it is and how broken it is depends on what you will experience when you try to open the database or access it via the web, notes client or a third party piece of software.

Given the above, I can't see much benefit in trying to create a 'corrupt' database for testing since for this to be effective you need to know what bit you are breaking. IBM protect this, and will always protect this propriatory information as they don't want anyone building an alternative Notes client.

The last thing I'll add is that in almost fifteen years of Notes development work I have encountered corruptions so rarely that there isn't much of a business case to writing code to analyse corruptions that happen so rarely, good error handling in your code will be more than enough in the vast majority of situations.

AndrewB
  • 323
  • 2
  • 17