Re: [PATCH v3 2/4] imap-send: add wrapper to get server credentials if needed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




Le 23/08/2017 à 22:13, Junio C Hamano a écrit :
> Nicolas Morey-Chaisemartin <nicolas@xxxxxxxxxxxxxxxxxxxxxx> writes:
>
>> Signed-off-by: Nicolas Morey-Chaisemartin <nicolas@xxxxxxxxxxxxxxxxxxxxxx>
>> ---
>>  imap-send.c | 34 ++++++++++++++++++++--------------
>>  1 file changed, 20 insertions(+), 14 deletions(-)
>>
>> diff --git a/imap-send.c b/imap-send.c
>> index 09f29ea95..448a4a0b3 100644
>> --- a/imap-send.c
>> +++ b/imap-send.c
>> @@ -926,6 +926,25 @@ static int auth_cram_md5(struct imap_store *ctx, struct imap_cmd *cmd, const cha
>>  	return 0;
>>  }
>>  
>> +static void server_fill_credential(struct imap_server_conf *srvc, struct credential *cred)
>> +{
>> +	if (srvc->user && srvc->pass)
>> +		return;
>> +
>> +	cred->protocol = xstrdup(srvc->use_ssl ? "imaps" : "imap");
>> +	cred->host = xstrdup(srvc->host);
>> +
>> +	cred->username = xstrdup_or_null(srvc->user);
>> +	cred->password = xstrdup_or_null(srvc->pass);
>> +
>> +	credential_fill(cred);
>> +
>> +	if (!srvc->user)
>> +		srvc->user = xstrdup(cred->username);
>> +	if (!srvc->pass)
>> +		srvc->pass = xstrdup(cred->password);
>> +}
>> +
> This looks straight-forward code movement.  The only thing that
> makes me wonder is if this is "server".  The existing naming of the
> variables screams at me that this is not "server" but is "service".

I read srvc as server conf not service.
But I can change the name if you prefer

Nicolas




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux