I found that gSTM has a hardcoded “-o ConnectTimeout=5” inside it, and changing ~/.ssh/config or /etc/ssh/ssh_config doesn’t override it, so I decided to remove it as sometimes my tunnel takes longer than 5secs to start:

diff -uNr gstm-1.2.orig/src/fnssht.c gstm-1.2/src/fnssht.c
--- gstm-1.2.orig/src/fnssht.c	2006-08-03 10:36:35.000000000 +0200
+++ gstm-1.2/src/fnssht.c	2010-07-22 17:56:15.016430000 +0200
@@ -213,8 +213,6 @@
 			free(tmp);
 		}
 		hargs->sshargs = gstm_ssht_addssharg(hargs->sshargs, "-o");
-		hargs->sshargs = gstm_ssht_addssharg(hargs->sshargs, "ConnectTimeout=5");
-		hargs->sshargs = gstm_ssht_addssharg(hargs->sshargs, "-o");
 		hargs->sshargs = gstm_ssht_addssharg(hargs->sshargs, "NumberOfPasswordPrompts=1");
 		hargs->sshargs = gstm_ssht_addssharg(hargs->sshargs, NULL); //end list

Also it won’t build cleanly on 64-Bit Fedora 13 as the XML2 and X11 libraries cannot be found by the linker. A quick fix is to set the LIBS environment variable to “-lX11 -lxml2” before running configure, or just edit the LIBS line in the configure file itself (snipped below):

-          glib_save_LIBS="$LIBS"
+          glib_save_LIBS="$LIBS -lX11 -lxml2"

So I editted the two files and created a patch, but that conflicted with the enclosed autoconf patch from the Fedora11 SRPM I was working from. So then I had to apply the autoconf patch and re-edit the two files and create a big patch with the three modifications.

So first we have to extract the source from the SRPM:

rpm -ivh gstm-1.2-10.fc11.src.rpm
mkdir ~/rpmbuild/BUILD/

Then I extracted the tarball twice (original, and patch) into the BUILD directory, so we end up with a directory structure like this (only listed the files we’re interested in):

~/rpmbuild/
  SPECS/gstm.spec
  SOURCES/gstm-1.2.tar.gz
  BUILD/
    gstm-1.2/
      configure
        src/
          fnssht.c
    gstm-1.2.orig/
      configure
        src/
          fnssht.c

First we apply the autoconf patch:

cd ~/rpmbuild/BUILD/gstm-1.2/
cat ~/rpmbuild/SOURCES/gstm-1.2-autoconf.patch | /usr/bin/patch -s -p1  --fuzz=0

Then apply my changes to fnssht.c and the patched configure file. Then create a big patch:

cd ~/rpmbuild/BUILD/
diff -uNr gstm-1.2.orig gstm-1.2/ > ../SOURCES/gstm-1.2-autoconf-connecttimeout5-x11xml2libs.patch
rm -rf gstm-1.2*

Next we have to change the SPEC file to use the big patch instead of the old autoconf patch, I also upped the release version and added a little to the changelog:

Patch0:         gstm-1.2-autoconf-connecttimeout5-x11xml2libs.patch
Release:        11%{?dist}

Then rebuild the RPM and SRPM with the patches applied:

cd ~/rpmbuild/SPECS/
rpmbuild -ba gstm.spec 

Finally we end up with a set of new RPM’s, downloadable from here:

gaskpass-1.2-11.fc13.x86_64.rpm
gstm-1.2-11.fc13.src.rpm
gstm-1.2-11.fc13.x86_64.rpm
gstm-debuginfo-1.2-11.fc13.x86_64.rpm

Some of the commands were based on this tutorial.

Update 1: I did the same with GIP – applied a libsigcpp patch, edited SPEC and rebuilt RPM’s for F13 x86_64. Download from here.

Update 2: I’ve also patched/rebuilt cx_Freeze and knockd RPM’s for Fedora 13 x86_64.