Patch-O-Matic

Patches For and Against Everything

Well, here is my small collection of patches for and against everything. Some of them are already integrated in the respective software package, however, I have not mention every patch I did so far here.

I hope, some or all patches are usefull to somebody. If you want to comment on any of them, please let me know.

Mozilla - Stored Passwords

Are you using the password manager which is included in the Mozilla web browser? It's handy because you don't have to remember tons of logins and passwords and you don't have to re-type them every now and then.

The drawback is, you'll start to depend on the password manager. What, if you want to access your mail from some other web browser? You don't remember it... because you never needed it so far. Bad.

Well, luckily, I didn't use encryption to store the passwords (since this was broken in some early milestone of Mozilla), so it was rather easy to extract the passwords from my Mozilla profile... just a little hack, nothing special, but perhaps you'll like it.

I nearly forgot: just pipe the stored passwords through this program.

Debugger using ptrace()

Here a little demonstration how to debug a program using ptrace() system calls. So far, I needed this or similar ways to debug two problems. One was to trace port IO, the other to locate a problem with some binary which segfaulted after a few assembler instructions.

OpenSSH over HTTP proxy

Have you ever been behind one of those half-hearted firewalls, that don't allow any traffic but HTTP using some proxy which inspects the content on top? Well, I have been there several times, and so I wrote myself a small program, which tunnels ssh over HTTPS bypassing this kind of firewalls.

The only prerequisite is a sshd running on port 443 (https) somewhere outside the firewall. Compile the rproxy.c file you find in the tarball and place the binary and the shell scripts somewhere in your $PATH.

You can now use rssh and rscp for the host running sshd on port 443 like you are used to do it from the normal commands.

These commands require OpenSSH to work probably, since they use the ProxyCommand hook provided by it.

Mozilla XUL extension for External Biff

Since Mozilla only has the option to play a sound when new mail arrives, I have implemented an XUL application that allows to execute an arbitrary command when new mail arrives. The application is bundlled as biff.xpi, get it from the download area.

The XPI gives you the option to install itself in your local user directory, so you can even use it without installing it as root. Please note that this feature requires a recent Mozilla version.

After installing the XPI, you will find a new settings tab "Biff" from "Advanced Preferences" which allows you to enable this feature and specify the command to execute. The string %s will be replaced by the value "on" or "off" depending on the biff state.

If you are using the Application Panel driver for Fujitsu Lifebooks (and the apanelc tool is installed in /usr/bin) the following command will turn on the "Mail" LED when new mail is available:

        /usr/bin/apanelc led %s
      

Overlay PDF Files

Ok, this time was one time to much. Again I received mail with a PDF file attached and the request to return it with some values filled in.

My usual solution (convert to PostScript, load it in xfig, add text, export to PDF) normally yields sub-optimal results. Basically this is due to the original PDF being converted to PostScript and back to PDF again. If it was possible to overlay the original PDF with a PostScript or PDF file containing only my editings, this solution was close to optimal.

Well, it is possible. With the help of the free PDF Java library iText I created a small Java Application that does this job. It takes three arguments:

        java -classpath iText.jar:. pdfmerge <original.pdf> <overlay.pdf> <new.pdf>
      

If you have just downloaded the iText toolkit and the .java file from my site, you need to compile the class prior to using the program:

        javac -classpath iText.jar pdfmerge.java
      

Only the first page of the original.pdf is read. The resulting file new.pdf will have the same dimensions as the original.

The application only works on one page a time. There is no real obvious way to overlay files with different page count. Use the utilities that come with iText to split and concat PDF files.

Working RHIDE Package

RHIDE is a Turbo-Vision IDE for C/C++ and Pascal. It is commonly used for the Informatics Olympiads (IOI, CEOI, etc..). It is available from http://www.rhide.com.

However, it's quite difficult to compile an up-to-date and working version for Linux. That is why I provide my ebuild (Gentoo source package) I used to compile the RHIDE for the CEOI 2003 in Germany.

You don't have to use Gentoo GNU/Linux to be able to use this ebuild. The ebuild consists of several patches and a script (the ebuild itself) for compiling the package. The structure of such ebuild scripts is described in the Gentoo How-To at http://www.gentoo.org/doc/en/gentoo-howto.xml.

Tele Traffic Taper with Linux pppoe

ttt is yet another descendant of tcpdump but it is capable of real-time, graphical, and remote traffic-monitoring. ttt won't replace tcpdump, rather, it helps you find out what to look into with tcpdump.

This is what ttt's homepage tells you. The current version (ttt 1.8) however lacks support for DLT_LINUX_SLL encapsulated packets, as used by pppd to communicate with pppoe. Since ttt is based on tcpdump, it was easy to patch support for this into it. I also adopted ttt 1.8 to work with libpcap 0.8.1.

strace patch for s/390 architecture

While current 2.4 and 2.6 kernels pass the SCNO (system call number) in a register via the ptrace interface, strace has to guess the number for older kernels. Now for some strange reason, strace tries to figure out this number when the system call starts, and when it ends - which is neither logical nor possible.

Now under certain circumstances this results in a segmentation violation. This is quite easy to fix, just don't guess the SCNO when we are leaving a system call.

The problem is that the current strace maintainer thinks it may break stuff, because the code is "horrible spaghetti", so he decided to fix it only for S/390 architecture. However, the patch he applied was exactly the opposite of what was needed, it avoided guessing the SCNO when entering the syscall...

After pointing out this mistake, he removed his patch again and since then ignores any email about this topic - so the bug still exists. So if you are debugging on SLES8 for example, you might need this patch

Network Interface Statistics on Solaris

ifstat is a small tool I wrote to monitor incoming and outgoing traffic on a network interface. It uses kstat to get the traffic data. Nothing fancy, however it does work without root permission.

OpenSSL RSA Key Converter

Several applications including the IPSec system of Solaris use an alternate RSA key format. If you want to import OpenSSL made X.509 certificates and keys into such applications, you'll need to convert the key first.

The converter is an ugly hack, so be careful when using it. It expects two command line arguments, the filename of the DER encoded OpenSSL RSA key and a filename where the converted key should be stored:

        $ keyconv key.der new-key.der
      

OpenOffice Impress Pen Color

OOo Impress allows you to scribble on your presentations during slide shows. The pen color however is hardwired to light green. The resulting annoatations are hard to read, not mentioning what they look like...

It's pretty simple to change the pen color, once you've found the definition in the source code. I have provided a patch for OOo 1.1.1 changing the pen color to red.

ElsterFormular und Wine

ElsterFormular is a freeware program allowing you to do your (german) tax online. The government promised a linux version of this program long ago, however such a version does not exist yet. There are some vendors that sell a linux frontend running the "Elster" backend under wine, but running ElsterFormular under wine did not work so far.

Update: Meanwhile it is possible to install all required components using WineTools.

Multimedia Keyboard volume control

I got a fancy new Dell multimedia keyboard (SK-8135). Sadly, the volume control wheel did not produce any keystrokes. A little research revealed that the volume control wheel produced some input events, I could observ on /dev/input/event2. Since I could not find a program that interprets these events, I wrote a little program myself. This volumed I wrote listens on the event device (you need the module evdev in your kernel for this device) and adjusts the PCM mixer of the default ALSA device upon input events. Reportedly, the program also works with the Griffin Power Mate.

Because this keyboard uses a strange event mapping, you need to apply a patch to the linux kernel first (see bug #5233).