libvirt/src/util/virauth.h
Peter Krempa c7dba5d695 virAuth: Don't require virConnectPtr to retrieve authentication creds
Previously a connection object was required to retrieve the auth
credentials. This patch adds the option to call the retrieval functions
only using the connection URI or path to the configuration file. This
will allow to use this toolkit to request passwords for ssh
authentication in the libssh2 connection driver.

Changes:
*virAuthGetConfigFilePathURI(): use URI to retrieve the config file path
*virAuthGetCredential(): Remove the need to propagate conn object

virAuthGetPasswordPath():
*virAuthGetUsernamePath(): New functions, that use config file path
                           instead of conn object
2013-07-12 09:22:38 +02:00

57 lines
2.1 KiB
C

/*
* virauth.h: authentication related utility functions
*
* Copyright (C) 2013 Red Hat, Inc.
* Copyright (C) 2010 Matthias Bolte <matthias.bolte@googlemail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see
* <http://www.gnu.org/licenses/>.
*
*/
#ifndef __VIR_AUTH_H__
# define __VIR_AUTH_H__
# include "internal.h"
# include "viruri.h"
int virAuthGetConfigFilePath(virConnectPtr conn,
char **path);
int virAuthGetConfigFilePathURI(virURIPtr uri,
char **path);
char *virAuthGetUsername(virConnectPtr conn,
virConnectAuthPtr auth,
const char *servicename,
const char *defaultUsername,
const char *hostname);
char *virAuthGetPassword(virConnectPtr conn,
virConnectAuthPtr auth,
const char *servicename,
const char *username,
const char *hostname);
char * virAuthGetUsernamePath(const char *path,
virConnectAuthPtr auth,
const char *servicename,
const char *defaultUsername,
const char *hostname);
char * virAuthGetPasswordPath(const char *path,
virConnectAuthPtr auth,
const char *servicename,
const char *username,
const char *hostname);
#endif /* __VIR_AUTH_H__ */