[libvirt] [PATCH 13/14] Refactor code prompting for SASL credentials

Osier Yang jyang at redhat.com
Thu Mar 22 09:05:05 UTC 2012


On 2012年03月21日 01:33, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange"<berrange at redhat.com>
>
> SASL may prompt for credentials after either a 'start' or 'step'
> invocation. In both cases the code to handle this is the same.
> Refactor this code into a separate method to reduce the duplication,
> since the complexity is about to grow
>
> * src/remote/remote_driver.c: Refactor interaction with SASL
> ---
>   src/remote/remote_driver.c |  135 +++++++++++++++++++++++++------------------
>   1 files changed, 78 insertions(+), 57 deletions(-)
>
> diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
> index bc6fea2..1faaf9e 100644
> --- a/src/remote/remote_driver.c
> +++ b/src/remote/remote_driver.c
> @@ -2863,7 +2863,8 @@ static sasl_callback_t *remoteAuthMakeCallbacks(int *credtype, int ncredtype)
>    * are basically a 1-to-1 copy of each other.
>    */
>   static int remoteAuthMakeCredentials(sasl_interact_t *interact,
> -                                     virConnectCredentialPtr *cred)
> +                                     virConnectCredentialPtr *cred,
> +                                     size_t *ncred)
>   {
>       int ninteract;
>       if (!cred)
> @@ -2889,16 +2890,8 @@ static int remoteAuthMakeCredentials(sasl_interact_t *interact,
>           (*cred)[ninteract].result = NULL;
>       }
>
> -    return ninteract;
> -}
> -
> -static void remoteAuthFreeCredentials(virConnectCredentialPtr cred,
> -                                      int ncred)
> -{
> -    int i;
> -    for (i = 0 ; i<  ncred ; i++)
> -        VIR_FREE(cred[i].result);
> -    VIR_FREE(cred);
> +    *ncred = ninteract;
> +    return 0;

Better to change the comments for remoteAuthFreeCredentials.

ACK.




More information about the libvir-list mailing list