[libvirt] [PATCH] phyp: ssh authentication with pub keys fixed

Eduardo Otubo otubo at linux.vnet.ibm.com
Sat Nov 7 18:14:46 UTC 2009


Matthias Bolte wrote:
> 2009/11/6 Eduardo Otubo <otubo at linux.vnet.ibm.com>:
>> +    char *pubkey = NULL;
>> +    char *pvtkey = NULL;
>> +
>> +    if (virAsprintf(&pubkey, "%s/.ssh/id_rsa.pub", getenv("HOME")) < 0) {
>> +        virReportOOMError(conn);
>> +        goto err;
>> +    }
>> +
>> +    if (virAsprintf(&pvtkey, "%s/.ssh/id_rsa", getenv("HOME")) < 0) {
>> +        virReportOOMError(conn);
>> +        goto err;
>> +    }
> 
> You should use virGetUserDirectory() instead of getenv("HOME"):
> 
>     char *userdir = virGetUserDirectory(NULL, geteuid());
> 
>     if (userdir == NULL)
>         goto err;
> 
> Matthias

Here it is.
Thanks again.

[]'s

-- 
Eduardo Otubo
Software Engineer
Linux Technology Center
IBM Systems & Technology Group
Mobile: +55 19 8135 0885
eotubo at linux.vnet.ibm.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: phyp_sshkeys.patch
Type: text/x-patch
Size: 4049 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20091107/5be909a3/attachment-0001.bin>


More information about the libvir-list mailing list