[PATCH] "Include" option for ssh configs

Gavin Beatty gavinbeatty at gmail.com
Wed Mar 25 04:07:12 EST 2009


Hello,

Attached is a patch to add support for an "include" file in ssh configs. It is
written against openssh-5.2p1.

## ~/.ssh/config
Include ~/.ssh/config.contrib
## end

- Leading ~/ expands to $HOME according to getpwuid_r¹.

- Leading ~username expands to $HOME for username according to getpwnam_r.

- Fallbacks to /home/$USER are implemented for when struct passwd.pw_dir is
  NULL² after these calls.

Files are parsed immediately in place and bad option counts are unique to each
file. In this implementation, files that cannot be opened are error()d and ssh
exits.

There is rough documentation added to ssh_config.5. I haven't tested if the
markup is correct as I don't know nroff.

¹ Note that I have used FOO_r functions. I will rewrite the patch if this does
  not fit your portability requirements or threads are not an issue or some
  such.

² I've never heard of this happening...

-- 
Gavin Beatty

SEMPER UBI SUB UBI
-------------- next part --------------
A non-text attachment was scrubbed...
Name: openssh-include.patch
Type: text/x-patch
Size: 5916 bytes
Desc: not available
Url : http://lists.mindrot.org/pipermail/openssh-unix-dev/attachments/20090324/d3fed9d9/attachment.bin 


More information about the openssh-unix-dev mailing list