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

Matthias Bolte matthias.bolte at googlemail.com
Sat Nov 7 01:28:02 UTC 2009


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




More information about the libvir-list mailing list