Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

auth_ephemeral: fix authentication with secrets added at runtime #3390

Merged
merged 2 commits into from
Mar 10, 2023
Merged

auth_ephemeral: fix authentication with secrets added at runtime #3390

merged 2 commits into from
Mar 10, 2023

Conversation

Den4t
Copy link
Contributor

@Den4t Den4t commented Mar 9, 2023

  • proper way to work with shm pointer to secret list

Pre-Submission Checklist

  • Commit message has the format required by CONTRIBUTING guide
  • Commits are split per component (core, individual modules, libs, utils, ...)
  • Each component has a single commit (if not, squash them into one commit)
  • No commits to README files for modules (changes must be done to docbook files
    in doc/ subfolder, the README file is autogenerated)

Type Of Change

  • Small bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds new functionality)
  • Breaking change (fix or feature that would change existing functionality)

Checklist:

  • PR should be backported to stable branches
  • Tested changes locally
  • Related to issue #XXXX (replace XXXX with an open issue number)

Description

In case of adding secrets at runtime with autheph.add_secret rpc, authentication with new secrets not work,
this is because rpc process modify local pointer to secret list, instead shm.

- proper way to work with shm pointer to secret list
Copy link
Contributor

@henningw henningw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR. I just added one remark related to the freeing of the previous allocated memory in an error condition. Maybe others like to comment as well, as I do not use this module a lot.

if (secret_list == NULL)
{
LM_ERR("unable to allocate shared memory\n");
return -1;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You probably want to free the previously allocated secret_struct

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, Henning!

You're right, i missed this, will fix.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

Free shm secret_struct in case the allocation error of secret_list pointer.
@miconda
Copy link
Member

miconda commented Mar 10, 2023

Thanks!

@miconda miconda merged commit 6fa5a8f into kamailio:master Mar 10, 2023
miconda pushed a commit that referenced this pull request Jul 17, 2023
* auth_ephemeral: fix authentication with secrets added at runtime

- proper way to work with shm pointer to secret list

* fix: free secret_struct shm

Free shm secret_struct in case the allocation error of secret_list pointer.

(cherry picked from commit 6fa5a8f)
miconda pushed a commit that referenced this pull request Jul 17, 2023
* auth_ephemeral: fix authentication with secrets added at runtime

- proper way to work with shm pointer to secret list

* fix: free secret_struct shm

Free shm secret_struct in case the allocation error of secret_list pointer.

(cherry picked from commit 6fa5a8f)
(cherry picked from commit ca13a33)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants