Re: [PATCH v5 1/3] send-email: implement SMTP bearer authentication
- From
Aditya Garg <gargaditya08@live.com>
- Date
- Apr 25, 2025, 06:25 UTC
- Message-ID
- <PN3PR01MB95978F0006C7F99AC4560973B8842@PN3PR01MB9597.INDPRD01.PROD.OUTLOOK.COM>
- In-Reply-To
- <D9FI2S0NSC40.28VZMYOR6M8DO@swagemakers.org>
Hi Julian
Show 45 quoted lines
> On 25 Apr 2025, at 11:49 AM, Julian Swagemakers <julian@swagemakers.org> wrote:
>
> On Thu Apr 24, 2025 at 8:22 PM CEST, Aditya Garg wrote:
>> I saw the code of perl-authen-sasl and I miserably failed in porting
>> the logic used here to the repo.
>>
>> Perl is not something I am very strong at, so not really feasible for
>> me to work ahead. I do was able to return the formatted base64 encoded
>> string as per the logic, but still I got authentication issues.
>> Currently I aim to have git-send-email working, and a review from an
>> experienced person is needed.
>>
>> I would be happy to be able to test any proposed patch though.
>>
>> Julian, you might be interested here?
>
> I fear I'm also a rookie when it comes to perl, but with your code and
> the comment from Erik I managed to get it working. client_start and
> client_step have to look like this:
>
> sub client_start {
> my $self = shift;
> $self->{stage} = 0;
> # Generate the XOAUTH2 authentication string
> my $username = $self->_call('user');
> my $token = $self->_call('pass'); # OAuth 2.0 access token
> my $auth_string = "user=$username\001auth=Bearer $token\001\001";
> return $auth_string
> }
>
> sub client_step {
> my ($self, $challenge) = @_;
>
> my $stage = ++$self->{stage};
>
> if ($stage == 1) {
> # Handle authentication failure by sending a dummy request
> return "\001"
> } else {
> return $self->set_error("Invalid sequence");
> }
> }
>
> Aditya, do you want to create a pull request on perl-authen-sasl, or
> should I?I'll do some tests on my end then I can open a PR. If I face issues, I'll ping you again!
Thanks Aditya