Posted by nick @ 16:06 on December 22nd 2011

Security Bulletin: DB2 Escalation of Privilege Vulnerability

A vulnerability has been found in the Tivoli Monitoring Agent (ITMA) that ships with DB2 9.5 and 9.7. It allows a local user to run arbitrary code with elevated (root) privileges.

If you are using ITMA, take a note of how to apply the workaround: http://www.ibm.com/support/docview.wss?uid=swg21576372&myns=swgimgmt&mynp=OCSSEPGG&mync=E

Apparently, the Response File Generator utility, db2rspgn, is also affected: http://osvdb.org/show/osvdb/76456

Posted by nick @ 11:04 on April 21st 2011

New DB2 fixpaks

New DB2 fixpaks have just come out: DB2 9.1.10; DB2 9.5.7; DB2 9.7.4

Get them from here: https://www-304.ibm.com/support/docview.wss?uid=swg27007053

Posted by nick @ 11:00 on April 21st 2011

Determine group of a directory (current directory in this case)

perl -e 'print getgrgid((stat($ARGV[0]))[5]) . "\n";' $PWD

I’m not sure why I needed that, but I did need it once.

Posted by nick @ 23:48 on June 25th 2009

A perl one-liner to extract all URLs from an HTML document

Just in case I ever forget how I did it… I was trying to download some 40 page PDF brochure from a government web site – I wanted to print it out and read it off-line. However, it was cleverly split into 20 different PDFs – no doubt for convenience. Instead of spending 20 minutes clicking on those various links and printing 20 document fragments, I chose to spend twice that time trying to automate the process. And here it is, in all its glory:

curl -s "http://www.datori.org" \
| perl -n -e 'chomp;s/.*?(?:(?i)href)="([^"]+)".*?(?:$|(?=(?i)href))/$1\n/xg and print'

The “thing” downloads the specified page and extracts all linked URLs from it, as indicated by the “href” tags. You’ve got to appreciate the enormity of perl…

Posted by nick @ 16:55 on December 19th 2008

Unix time from DB2

Here’s one way to obtain the Unix time value (the number of seconds since midnight on January 1, 1970) from a DB2 timestamp:

values(
  (days(current_timestamp-current_timezone) - days('1970-01-01') )*86400 +
  midnight_seconds(current_timestamp - current_timezone)
)

This can be used in a query directly or wrapped into a simple SQL user-defined function.

Next Page »