Re: [PATCH v4 2/3] git-core: Support retrieving passwords with GIT_ASKPASS

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

 



Frank Li <lznuaa@xxxxxxxxx> writes:

> imap-send and authority http connect reads passwords from an interactive
> terminal. This behavious cause GUIs to hang waiting for git complete.
>
> Fix this problem by allowing a password-retrieving command
> to be specified in GIT_ASKPASS
>
> Signed-off-by: Frank Li <lznuaa@xxxxxxxxx>
> ---

It appears that between v3 and v4 you incorporated all the changes J6t
suggested.  I would have preferred to see you Cc him, so that he can
simply respond with "Acked-by:" (or another round of review cycle).

> +char *git_getpass(const char *prompt)
> +{
> ...
> +	memset(&pass, 0, sizeof(pass));
> +	pass.argv = args;
> +	pass.out = -1;
> +
> +	if (start_command(&pass))
> +		exit(1);

I understand that you exit silently here because start-command would have
given diagnostic messages already.

> +	if (strbuf_read(&buffer, pass.out, 20) < 0)
> +		exit(1);

What about this one?  Running out of memory inside strbuf_grow() may have
died with message but other error conditions that do give control back to
the caller seem pretty quiet to my cursory look...

> +	close(pass.out);
> +
> +	if (finish_command(&pass))
> +		exit(1);

This silent exit is correct, I think; wait_or_whine() called by
finish_command() would have reported errors.

> +	strbuf_setlen(&buffer, strcspn(buffer.buf, "\r\n"));
> +
> +	/*it maybe memory leak because getpass return a static buffer*/
> +	return strbuf_detach(&buffer, NULL);

Perhaps keep this value in a "static char *" in the function and free it
upon entry on the second call?
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[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]