Re: [PATCH v5 1/3] send-email: implement SMTP bearer authentication

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

 



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?

Regards Julian





[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