From 99d72d1edc325ceb51c4841d83981c4d355a4c0c Mon Sep 17 00:00:00 2001 From: Mike Date: Wed, 24 Jul 2024 22:50:26 -0400 Subject: [PATCH] issue #55 - stub PermitDeny subgroup handlers The AIM 4.0 for macOS was freezing at login because OService reported that the PermitDeny service was available but there were no rate limit entries for the PermitDeny subgroups. This commit adds PermitDeny to the rate limit list and stubs out AddPermListEntries and SetGroupPermitMask to make AIM 4.0 and ICQ 2000b happy. --- foodgroup/oservice.go | 14 +++++++++ foodgroup/oservice_test.go | 44 +++++++++++++++++++++++++++++ server/oscar/handler/permit_deny.go | 9 ++++++ server/oscar/handler/routes.go | 2 ++ 4 files changed, 69 insertions(+) diff --git a/foodgroup/oservice.go b/foodgroup/oservice.go index 4bd5ee3a..ef768f8c 100644 --- a/foodgroup/oservice.go +++ b/foodgroup/oservice.go @@ -326,6 +326,19 @@ func init() { wire.AlertNotifyDisplayCapabilities, wire.AlertUserOnline, }, + wire.PermitDeny: { + wire.PermitDenyErr, + wire.PermitDenyRightsQuery, + wire.PermitDenyRightsReply, + wire.PermitDenySetGroupPermitMask, + wire.PermitDenyAddPermListEntries, + wire.PermitDenyDelPermListEntries, + wire.PermitDenyAddDenyListEntries, + wire.PermitDenyDelDenyListEntries, + wire.PermitDenyBosErr, + wire.PermitDenyAddTempPermitListEntries, + wire.PermitDenyDelTempPermitListEntries, + }, } for _, foodGroup := range []uint16{ @@ -339,6 +352,7 @@ func init() { wire.Feedbag, wire.BUCP, wire.Alert, + wire.PermitDeny, } { subGroups := foodGroupToSubgroup[foodGroup] for _, subGroup := range subGroups { diff --git a/foodgroup/oservice_test.go b/foodgroup/oservice_test.go index 35919f92..43ab92a4 100644 --- a/foodgroup/oservice_test.go +++ b/foodgroup/oservice_test.go @@ -1375,6 +1375,50 @@ func TestOServiceService_RateParamsQuery(t *testing.T) { FoodGroup: wire.Alert, SubGroup: wire.AlertUserOnline, }, + { + FoodGroup: wire.PermitDeny, + SubGroup: wire.PermitDenyErr, + }, + { + FoodGroup: wire.PermitDeny, + SubGroup: wire.PermitDenyRightsQuery, + }, + { + FoodGroup: wire.PermitDeny, + SubGroup: wire.PermitDenyRightsReply, + }, + { + FoodGroup: wire.PermitDeny, + SubGroup: wire.PermitDenySetGroupPermitMask, + }, + { + FoodGroup: wire.PermitDeny, + SubGroup: wire.PermitDenyAddPermListEntries, + }, + { + FoodGroup: wire.PermitDeny, + SubGroup: wire.PermitDenyDelPermListEntries, + }, + { + FoodGroup: wire.PermitDeny, + SubGroup: wire.PermitDenyAddDenyListEntries, + }, + { + FoodGroup: wire.PermitDeny, + SubGroup: wire.PermitDenyDelDenyListEntries, + }, + { + FoodGroup: wire.PermitDeny, + SubGroup: wire.PermitDenyBosErr, + }, + { + FoodGroup: wire.PermitDeny, + SubGroup: wire.PermitDenyAddTempPermitListEntries, + }, + { + FoodGroup: wire.PermitDeny, + SubGroup: wire.PermitDenyDelTempPermitListEntries, + }, }, }, }, diff --git a/server/oscar/handler/permit_deny.go b/server/oscar/handler/permit_deny.go index 1761cc59..749cf3c3 100644 --- a/server/oscar/handler/permit_deny.go +++ b/server/oscar/handler/permit_deny.go @@ -34,3 +34,12 @@ func (rt PermitDenyHandler) RightsQuery(ctx context.Context, _ *state.Session, i rt.LogRequestAndResponse(ctx, inFrame, nil, outSNAC.Frame, outSNAC.Body) return rw.SendSNAC(outSNAC.Frame, outSNAC.Body) } + +func (rt PermitDenyHandler) AddPermListEntries(ctx context.Context, _ *state.Session, inFrame wire.SNACFrame, _ io.Reader, rw oscar.ResponseWriter) error { + rt.Logger.Debug("got a request for AddPermListEntries, but not doing anything about it right now") + return nil +} +func (rt PermitDenyHandler) SetGroupPermitMask(ctx context.Context, _ *state.Session, inFrame wire.SNACFrame, _ io.Reader, rw oscar.ResponseWriter) error { + rt.Logger.Debug("got a request for SetGroupPermitMask, but not doing anything about it right now") + return nil +} diff --git a/server/oscar/handler/routes.go b/server/oscar/handler/routes.go index dc693a20..135d7b0b 100644 --- a/server/oscar/handler/routes.go +++ b/server/oscar/handler/routes.go @@ -69,6 +69,8 @@ func NewBOSRouter(h Handlers) oscar.Router { router.Register(wire.Locate, wire.LocateUserInfoQuery2, h.LocateHandler.UserInfoQuery2) router.Register(wire.PermitDeny, wire.PermitDenyRightsQuery, h.PermitDenyHandler.RightsQuery) + router.Register(wire.PermitDeny, wire.PermitDenyAddPermListEntries, h.PermitDenyHandler.AddPermListEntries) + router.Register(wire.PermitDeny, wire.PermitDenySetGroupPermitMask, h.PermitDenyHandler.SetGroupPermitMask) router.Register(wire.OService, wire.OServiceClientOnline, h.OServiceHandler.ClientOnline) router.Register(wire.OService, wire.OServiceClientVersions, h.OServiceHandler.ClientVersions)