ssh_key ssh_key_dup(const ssh_key key);
Hi,recently i want to use ssh_key_dup() to duplicate a ssh key ,and i found it can not be include it as it not in libssh.h, so i wonder if this funtion can be moved to libssh.h as an SSHAPI
Thanks
ssh_key ssh_key_dup(const ssh_key key);
Hi,recently i want to use ssh_key_dup() to duplicate a ssh key ,and i found it can not be include it as it not in libssh.h, so i wonder if this funtion can be moved to libssh.h as an SSHAPI
Thanks
This issue is relatate to https://bugs.libssh.org/T206
When i use ssh_bind_options_set() with parameter SSH_BIND_OPTIONS_IMPORT_KEY , I found ssh_bind_options_set() does not duplicate the key,if i free ssh_bind ,the key also be freed but key pointer outside not set to null, in this case ,if i use the ssh_key which is freed for another bind, it wil be failed.
So i asked these two questions (T206,T207),wonder if ssh_bind_options_set can duplicate ssh key or can ssh_key_dup() move to libssh.h for API.
To my opinion, even we move ssh_key_dup() to libssh.h ,we also should duplicate ssh_key in function ssh_bind_options_set() , it is better to free memory apply by itself , not free memory applied by others
thanks
This would be changing behavior so for any program written with older libssh, new versions would leak this memory, because they would be expecting it will be freed with the bind. So better solution would really be to use the ssh_key_dup() yourself (easiest by including the pki.h yourself for now as suggested in the other issue).
OK.
But this mean we should move ssh_key_dup() to libssh.h as a api, as applications only can reference to libssh.h , can not see pki.h
Thanks