Fixing “percent_expand: NULL replacement” SSH bug on OS X Leopard
Apple decided to fix up some of their UNIX functions to operate more like the standard, but they didn’t test very thoroughly because they broke the SSH client Update: Actually, this is a problem with MacPorts, Apple’s SSH still works (if you see “percent_expand: NULL replacement”, you’ve hit the bug). They’ll probably fix this, but if you need a quicker solution, here it is.
- Download the latest OpenSSH and untar it to the desktop (Link)
- Go into this directory and open up “ssh.c”
- Make the following patch near line 1252 (Leave out the ‘+’):
#endif /* SMARTCARD */
if ((pw = getpwuid(original_real_uid)) == NULL)
fatal("load_public_identity_files: getpwuid failed");
+ pw = pwcopy(pw);
if (gethostname(thishost, sizeof(thishost)) == -1)
fatal("load_public_identity_files: gethostname: %s",
strerror(errno)); - Open up the terminal, and run the following commands:
cd ~/Desktop/openssh-4.7p1
./configure –exec-prefix=/usr/local –prefix=/
make
sudo make install
