git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Nicolas Morey-Chaisemartin <nicolas@morey-chaisemartin.com>
Date
Aug 24, 2017, 06:08 UTC
Message-ID
<d1c39912-a847-1831-60ae-18b15359092f@morey-chaisemartin.com>
In-Reply-To
<xmqqtw0yxcsk.fsf@gitster.mtv.corp.google.com>
Le 23/08/2017 à 22:13, Junio C Hamano a écrit :
Show 37 quoted lines
> Nicolas Morey-Chaisemartin <nicolas@morey-chaisemartin.com> writes:
>
>> Signed-off-by: Nicolas Morey-Chaisemartin <nicolas@morey-chaisemartin.com>
>> ---
>>  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
Previous: Junio C HamanoNext: Junio C Hamano
Message 8 of 13 in “imap-send: Fix and enable curl by default”
  1. 0/4 imap-send: Fix and enable curl by defaultNicolas Morey-Chaisemartin, Aug 22, 2017
  2. 1/4 imap-send: return with error if curl failedNicolas Morey-Chaisemartin, Aug 22, 2017
  3. Junio C HamanoAug 23, 2017
  4. Junio C HamanoAug 23, 2017
  5. Nicolas Morey-ChaisemartinAug 24, 2017
  6. 2/4 imap-send: add wrapper to get server credentials if neededNicolas Morey-Chaisemartin, Aug 22, 2017
  7. Junio C HamanoAug 23, 2017
  8. Nicolas Morey-ChaisemartinAug 24, 2017
  9. Junio C HamanoAug 24, 2017
  10. 3/4 imap_send: setup_curl: retreive credentials if not set in config fileNicolas Morey-Chaisemartin, Aug 22, 2017
  11. 4/4 imap-send: use curl by defaultNicolas Morey-Chaisemartin, Aug 22, 2017
  12. Junio C HamanoAug 23, 2017
  13. Nicolas Morey-ChaisemartinAug 24, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.