Skip to content

Commit

Permalink
auth_aka: make count per algorithm, rather than for all
Browse files Browse the repository at this point in the history
  • Loading branch information
razvancrainea authored and bogdan-iancu committed Apr 18, 2024
1 parent aaa49ac commit 2907002
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
14 changes: 10 additions & 4 deletions modules/auth_aka/aka_av_mgm.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,17 @@

#define AKA_AV_MGM_PREFIX "load_aka_av_"

struct aka_av_async_ctx {
};

struct aka_av_binds {
int (*fetch)(str *realm, str *impu, str *impi, int alg, str *resync, int no, struct aka_av_async_ctx *ctx);
/*
* realm - the Realm of the authentication vector
* impu - Public identity of the user
* impi - Private identity of the user
* resync - Resync/auts token, or NULL if not a resync request
* algmask - Masks of algorithms to request
* no - number of AVs for each algorithm
* async - indicates whether the request is asynchronous or not
*/
int (*fetch)(str *realm, str *impu, str *impi, str *resync, int algmask, int no, int async);
};

struct aka_av_mgm {
Expand Down
4 changes: 2 additions & 2 deletions modules/auth_aka/auth_aka.c
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,7 @@ static int aka_challenge(struct sip_msg *_msg, struct aka_av_mgm *mgm, str *_rea
/* if we need more, fetch them remotely */
if (new_count != count) {
if (mgm->binds.fetch(&realm, &user->public->impu, &user->impi,
algmask, (auts.len?&auts:NULL), count - new_count, NULL) != 0) {
(auts.len?&auts:NULL), algmask, 1, 0) != 0) {
LM_INFO("Could not fetch %d authentication vector(s)!\n", count);
ret = -2;
goto release;
Expand Down Expand Up @@ -1063,7 +1063,7 @@ static int aka_challenge_async(struct sip_msg *_msg, async_ctx *ctx,

/* now that we finished preparing, go fetch the vectors */
if (mgm->binds.fetch(&realm, &user->public->impu, &user->impi,
algmask, (sync.len?&sync:NULL), count - c, NULL) != 0) {
(sync.len?&sync:NULL), algmask, 1, 1) != 0) {
LM_INFO("Could not fetch %d authentication vector(s)!\n", count);
ret = -2;
goto error;
Expand Down

0 comments on commit 2907002

Please sign in to comment.