I was fiddling around innocently in the terminal earlier, trying to customise MacVim. I was doing pretty standard things: ls, rm, mv, etc. No sudo, so I can't have accidentally deleted anything important. I was also switching back and forth between showing hidden files and hiding them (therefore restarting Finder all the time as well).
At one point I moved a few harmless vim configuration files to either the HD or home folder - can't remember which - and got asked for my password, which I thought was a bit odd, but it worked nevertheless. I did that in Finder, not the terminal, incidentally.
Anyway, after closing and reopening MacVim several times, editing the .vimrc, moving vim files around a bit, switching AppleShowAllFiles on and off a few times, etc, I went to use sudo (to install something), and this happened:
sudo: can't mkdir /var/db/sudo: No such file or directory
I've used sudo without any trouble in the past, and nothing changed that I can think of between me being asked for my password in Finder and this attempt. Yet now, if I try to do anything that requires a password - regardless of whether in the terminal or not - it gets rejected EVERY TIME. At first I wondered if somehow I'd forgotten my password or had caps lock on but no, it's as if the OS has forgotten my password. I wasn't even able to change my passowrd cause it rejected the 'old password' field, and I can't make a new user cause I can't unlock the accounts settings.
The truly bizarre thing about all this is about half an hour ago it accepted my password, and nothing that I've done since then could have caused this to happen, afaik. My account is an admin account, btw.