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 ))
then
echo "WARN $USER they are using $PC % of their $QUOTA quota"
fi


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:
ftp://ftp.dell.com/network

Useful-looking MIBs are:
PC_3024-3048-5012_v604_MIBs.zip
PC_3324_MIBs.zip
PC_3348_MIBs.zip
PC_6024FMIBs_v2001.zip
PC_6024F_MIBs.zip
PC_6024MIBs_v2001.zip
PC_6024_MIBs.zip
PC_62xxMIBS_v10027.zip
PC_62xxMIBS_v20012.zip
PowerConncect5324_MIBs.zip
PowerConnect34xx_MIBs_A01.zip
PowerConnect54xx_MIBs_A00.zip
PowerConnect_35XX_MIBs_A00.zip

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

Wednesday, February 3, 2010

X2X

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 192.168.12.205

I do this:


ssh -X 192.168.12.205 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 {} \;