Tuesday, February 23, 2010

Thunderbird, LDAP address books, borked

So we use an LDAP server to provide (among other things) a company-wide address book. And it's really useful. Yay for the good guys! People using Thunderbird point to it, people using webmail point to it, and we all are one big happy family.

Of course, then I got thinking it'd be really neat if people's personal address books could also go into LDAP, you know, so that the same addresses were accessible regardless of them using Thunderbird, webmail, whatever. For me, it'd be super-handy, since I use lots of different computers - I could just add my contacts from wherever I am, and there they are!

Squirrelmail can do this: this is on the list to try soon.

So obviously Thunderbird can too, right? Right? Guys??

Actually, it seems that it cannot, or if it could, you would not be able to edit the entries from Thunderbird's Address Book. Um, well surely I'm not the first person to want to do this... and if you read the bug report for this item, you can read the almost-decade-long history of how OSS projects can just... not quite deliver on the promise, sometimes. I mean, c'mon guys, a DECADE?

The obvious response to this whinge is: if you want it so much, start coding!

Maybe I can live without it :-)

Sunday, February 14, 2010

bash and floating point numbers

In short: bash does not do arithmetic on floating point numbers. If I was doing anything serious with these numbers, I guess it'd be time to re-do this in perl.

But in this case, all I want to do is see if someone is using more than 90% of their quota, so I'm happy to round down to the nearest integer. Witness my hack (where PC is the percentage of quota used with 2 decimal places, and IPC is the integer representation of this after rounding down):

IPC=$(echo "$PC /1" | bc)
if (( IPC > WARN_THRESH ))
echo "WARN $USER they are using $PC % of their $QUOTA quota"

Ugly, but it works.

Thursday, February 11, 2010

SquirrelMail LDAP address books

Another day, another interesting bug. A user noticed that in the SquirrelMail LDAP address book, when he listed all users, one person was missing. When you search for the person by name, they do appear. Strange...

ldapsearch shows that person in the list, so it was clearly a SquirrelMail issue. In fact, it turned out that only 250 people were listed by "List All" - a curiously precise limitation. So I grepped for 250 in config.php - nothing! Then I grepped for 250 in SquirrelMail source code, and found this:

functions/abook_ldap_server.php: var $maxrows = 250;

If you don't define maxrows for an LDAP server, it gets this default. Easy solution: edit config.php and add this line:

'maxrows' => 400,

And hey presto, there he is when you list all.

I guess this is one way to know when your company is growing.

Tuesday, February 9, 2010

Dell PowerConnect MIBs

Hey, who doesn't like polling Dell switches for useful information? Amiright?

Anyway, here's where the MIBs are:

Useful-looking MIBs are:

The one I was after was the temperature for a 3448, which is

Wednesday, February 3, 2010


X2X is a nifty tool that allows the mouse and keyboard on one computer to control the X display of another (presumably nearby) computer... for example, my desktop (with nice logitech keyboard and my favourite mouse) controlling the X display on my laptop (a nice enough machine, but would anyone with human-sized hands voluntarily use a laptop keyboard and a glidepad?) In effect, I get two displays controlled by one keyboard and mouse - as I mouse off the right side of my desktop display, the mouse pointer pops onto the laptop.

Problem is, I keep forgetting the magical incantation. So for the following setup:

Desktop, on left
Laptop, on right, IP address

I do this:

ssh -X x2x -to :0 -east

There are other options out there for controlling multiple displays with the one keyboard and mouse... for example, Synergy can do more than 2 screens, and works on Windows and Mac as well as Unix. It's quite good, and I've used it in the past, but it needs to be installed, and you have to set up the config files, so it takes a bit more doing.

Tuesday, February 2, 2010

Chown and symlinks

Had a persistent problem with an rsync backup job trying to set file attributes on some symlink files, and failing, as it did not own the files. But I'd done a chown -R to recursively set ownsership on every file in that directory. Anyway, it turns out that chown operates on the target of the link, not the link itself, unless you use -h

chown -h username:usergroup some_symlink_file

Or, for bonus points:

find . -type l -exec chown -h foo:bar {} \;