[Nagiosplug-devel] spopenenv (Was: no subject)

Andreas Ericsson ae at op5.se
Thu Oct 13 05:57:38 CEST 2005


John P. Rouillard wrote:
> In message <02F3F455-47E6-453A-A6F3-B9DABFE654B2 at mac.com>,
> Ton Voon writes:
> 
>>On 12 Oct 2005, at 18:59, John P. Rouillard wrote:
>>
>>>I have been trying to use check_by_ssh with an ssh-agent to allow
>>>encrypted keys to be kept on the system.
>>>
>>>While using spopen in the plugin is a great idea, it breaks using the
>>>ssh-agent to manage keys since the required environment variable:
>>>SSH_AUTH_SOCK isn't present in the child environment.
>>>
>>>I had patched this once (at another job, code unavailable) by
>>>duplicating spopen to spopenenv and adding a second argument that was
>>>a list of the environment strings (retrieved with getenv) that should
>>>be added to the child environment.
>>>
>>>So does adding support to check_by_ssh to use an ssh-agent sound
>>>reasonable?
>>
>>I think this sounds like a good idea.
>>
>>Is it possible to have the 2nd argument to spopen be the optional  
>>array of variables? That way we're not trying to maintain a spopen  
>>and an spopenenv.
> 
> 
> You could use a varargs list I suppose.


varargs are obsoleted in favor of stdarg, which is ANSI X3.159-1989 
(C89) compliant.


> Another way to do it might be
> with a macro that maps:
> 
>    spopen(a) -> spopenenv (a, NULL)
> 

Good idea. ;)

> and then you just have spopenenv. But it's been a long time since I have
> done C programming (almost 20 years sigh).
> 

27, if standards ratification dates are anything to go by. :)

-- 
Andreas Ericsson                   andreas.ericsson at op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231




More information about the Devel mailing list