[Libvir] Any sample code to use virConnectOpenAuth() in C binding ?

Daniel P. Berrange berrange at redhat.com
Wed Jan 23 14:40:10 UTC 2008

On Wed, Jan 23, 2008 at 06:07:23PM +0530, Arun Sharma wrote:
> Hello All,
> Can anyone provide me sample code for connecting hypervisor using
> credentials.
> As of now i have implemented using(virConnectOpen(NULL)) , but this function
> does not takes any credential information.
> I saw that there is function (virConnectOpenAuth()) which can be used , but
> i don;t know any way to implement

Take a look at the 'src/virsh.c' code - this uses the open auth method 
providing a callback suitable for any password+username auth scheme. I'll
be adding policykit support to virsh soon to, so long term virsh will serve
as very good example code for authentication from C.

|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-           Perl modules: http://search.cpan.org/~danberr/              -=|
|=-               Projects: http://freshmeat.net/~danielpb/               -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 

More information about the libvir-list mailing list