I screwed my OS by doing an APPLY on the top level disk information (command I) as root. Warning - this is extremely dangerous :) and easy if you are root. The apply does a RECURSE, not just apply the change you made, and doesn't warn.
Anyway, there is a Perl script by Larry Prall that reads the BOM, examines the file system and writes a shell script that will correct ownership, protection, and privilege problems.
I haven't run it yet, because an alternate is to just do an Install with the OS X disk (not the Restore CD set, just a regular disk). It will do an upgrade and just correct stuff. It even worked with 10.1.1 against a 10.1.2
This might save your life. Its in PERL, I checked it, but someone might want to do a test run on a scratch installation (I didn't want to risk running it after I managed to get my machine running again!).
[Editor's note: Just for the record, Apple does not recommend running an older-version system CD against a newer installed version; their current advice is that you must reformat and reinstall, which is not really a good choice for many people!]
Mac OS X Hints
http://hints.macworld.com/article.php?story=20020218203649317