Skip to content

Commit 3b9ac44

Browse files
authored
Merge pull request #52 from chchen7/fix/ausf-resync-nil-panic
fix: check context existence in resync
2 parents 7c6b9eb + d415b7c commit 3b9ac44

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

internal/sbi/processor/ue_authentication.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,8 +250,18 @@ func (p *Processor) UeAuthPostRequestProcedure(c *gin.Context, updateAuthenticat
250250
var lastEapID uint8
251251
if updateAuthenticationInfo.ResynchronizationInfo != nil {
252252
logger.UeAuthLog.Warningln("Auts: ", updateAuthenticationInfo.ResynchronizationInfo.Auts)
253+
if !ausf_context.CheckIfSuciSupiPairExists(supiOrSuci) {
254+
logger.UeAuthLog.Warningln("Resync failed: SUCI mapping not found for ", supiOrSuci)
255+
c.JSON(http.StatusNotFound, models.ProblemDetails{Status: 404, Cause: "USER_NOT_FOUND"})
256+
return
257+
}
253258
ausfCurrentSupi := ausf_context.GetSupiFromSuciSupiMap(supiOrSuci)
254259
logger.UeAuthLog.Warningln(ausfCurrentSupi)
260+
if !ausf_context.CheckIfAusfUeContextExists(ausfCurrentSupi) {
261+
logger.UeAuthLog.Warningln("Resync failed: AusfUeContext not found for SUPI: ", ausfCurrentSupi)
262+
c.JSON(http.StatusNotFound, models.ProblemDetails{Status: 404, Cause: "USER_NOT_FOUND"})
263+
return
264+
}
255265
ausfCurrentContext := ausf_context.GetAusfUeContext(ausfCurrentSupi)
256266
logger.UeAuthLog.Warningln(ausfCurrentContext.Rand)
257267
if updateAuthenticationInfo.ResynchronizationInfo.Rand == "" {

0 commit comments

Comments
 (0)