diff --git a/core/logic/smn_functions.cpp b/core/logic/smn_functions.cpp index 29d22588..0a2f685e 100644 --- a/core/logic/smn_functions.cpp +++ b/core/logic/smn_functions.cpp @@ -187,8 +187,9 @@ static cell_t sm_GetForwardFunctionCount(IPluginContext *pContext, const cell_t Handle_t hndl = static_cast(params[1]); HandleError err; IForward *pForward; + HandleSecurity sec(pContext->GetIdentity(), g_pCoreIdent); - if ((err=handlesys->ReadHandle(hndl, g_GlobalFwdType, NULL, (void **)&pForward)) + if ((err=handlesys->ReadHandle(hndl, g_GlobalFwdType, &sec, (void **)&pForward)) != HandleError_None) { return pContext->ThrowNativeError("Invalid forward handle %x (error %d)", hndl, err); @@ -204,8 +205,9 @@ static cell_t sm_AddToForward(IPluginContext *pContext, const cell_t *params) HandleError err; IChangeableForward *pForward; IPlugin *pPlugin; + HandleSecurity sec(pContext->GetIdentity(), g_pCoreIdent); - if ((err=handlesys->ReadHandle(fwdHandle, g_PrivateFwdType, NULL, (void **)&pForward)) + if ((err=handlesys->ReadHandle(fwdHandle, g_PrivateFwdType, &sec, (void **)&pForward)) != HandleError_None) { return pContext->ThrowNativeError("Invalid private forward handle %x (error %d)", fwdHandle, err); @@ -240,8 +242,9 @@ static cell_t sm_RemoveFromForward(IPluginContext *pContext, const cell_t *param HandleError err; IChangeableForward *pForward; IPlugin *pPlugin; + HandleSecurity sec(pContext->GetIdentity(), g_pCoreIdent); - if ((err=handlesys->ReadHandle(fwdHandle, g_PrivateFwdType, NULL, (void **)&pForward)) + if ((err=handlesys->ReadHandle(fwdHandle, g_PrivateFwdType, &sec, (void **)&pForward)) != HandleError_None) { return pContext->ThrowNativeError("Invalid private forward handle %x (error %d)", fwdHandle, err); @@ -276,8 +279,9 @@ static cell_t sm_RemoveAllFromForward(IPluginContext *pContext, const cell_t *pa HandleError err; IChangeableForward *pForward; IPlugin *pPlugin; + HandleSecurity sec(pContext->GetIdentity(), g_pCoreIdent); - if ((err=handlesys->ReadHandle(fwdHandle, g_PrivateFwdType, NULL, (void **)&pForward)) + if ((err=handlesys->ReadHandle(fwdHandle, g_PrivateFwdType, &sec, (void **)&pForward)) != HandleError_None) { return pContext->ThrowNativeError("Invalid private forward handle %x (error %d)", fwdHandle, err); @@ -339,12 +343,13 @@ static cell_t sm_CallStartForward(IPluginContext *pContext, const cell_t *params Handle_t hndl; HandleError err; IForward *pForward; + HandleSecurity sec(pContext->GetIdentity(), g_pCoreIdent); ResetCall(); hndl = static_cast(params[1]); - if ((err=handlesys->ReadHandle(hndl, g_GlobalFwdType, NULL, (void **)&pForward)) + if ((err=handlesys->ReadHandle(hndl, g_GlobalFwdType, &sec, (void **)&pForward)) != HandleError_None) { return pContext->ThrowNativeError("Invalid forward handle %x (error %d)", hndl, err); diff --git a/core/logic/smn_textparse.cpp b/core/logic/smn_textparse.cpp index 78f043d8..865ea5cd 100644 --- a/core/logic/smn_textparse.cpp +++ b/core/logic/smn_textparse.cpp @@ -202,8 +202,9 @@ static cell_t SMC_SetParseStart(IPluginContext *pContext, const cell_t *params) Handle_t hndl = (Handle_t)params[1]; HandleError err; ParseInfo *parse; + HandleSecurity sec(pContext->GetIdentity(), g_pCoreIdent); - if ((err=handlesys->ReadHandle(hndl, g_TypeSMC, NULL, (void **)&parse)) + if ((err=handlesys->ReadHandle(hndl, g_TypeSMC, &sec, (void **)&parse)) != HandleError_None) { return pContext->ThrowNativeError("Invalid SMC Parse Handle %x (error %d)", hndl, err); @@ -219,8 +220,9 @@ static cell_t SMC_SetParseEnd(IPluginContext *pContext, const cell_t *params) Handle_t hndl = (Handle_t)params[1]; HandleError err; ParseInfo *parse; + HandleSecurity sec(pContext->GetIdentity(), g_pCoreIdent); - if ((err=handlesys->ReadHandle(hndl, g_TypeSMC, NULL, (void **)&parse)) + if ((err=handlesys->ReadHandle(hndl, g_TypeSMC, &sec, (void **)&parse)) != HandleError_None) { return pContext->ThrowNativeError("Invalid SMC Parse Handle %x (error %d)", hndl, err); @@ -236,8 +238,9 @@ static cell_t SMC_SetReaders(IPluginContext *pContext, const cell_t *params) Handle_t hndl = (Handle_t)params[1]; HandleError err; ParseInfo *parse; + HandleSecurity sec(pContext->GetIdentity(), g_pCoreIdent); - if ((err=handlesys->ReadHandle(hndl, g_TypeSMC, NULL, (void **)&parse)) + if ((err=handlesys->ReadHandle(hndl, g_TypeSMC, &sec, (void **)&parse)) != HandleError_None) { return pContext->ThrowNativeError("Invalid SMC Parse Handle %x (error %d)", hndl, err); @@ -255,8 +258,9 @@ static cell_t SMC_SetRawLine(IPluginContext *pContext, const cell_t *params) Handle_t hndl = (Handle_t)params[1]; HandleError err; ParseInfo *parse; + HandleSecurity sec(pContext->GetIdentity(), g_pCoreIdent); - if ((err=handlesys->ReadHandle(hndl, g_TypeSMC, NULL, (void **)&parse)) + if ((err=handlesys->ReadHandle(hndl, g_TypeSMC, &sec, (void **)&parse)) != HandleError_None) { return pContext->ThrowNativeError("Invalid SMC Parse Handle %x (error %d)", hndl, err); @@ -272,8 +276,9 @@ static cell_t SMC_ParseFile(IPluginContext *pContext, const cell_t *params) Handle_t hndl = (Handle_t)params[1]; HandleError err; ParseInfo *parse; + HandleSecurity sec(pContext->GetIdentity(), g_pCoreIdent); - if ((err=handlesys->ReadHandle(hndl, g_TypeSMC, NULL, (void **)&parse)) + if ((err=handlesys->ReadHandle(hndl, g_TypeSMC, &sec, (void **)&parse)) != HandleError_None) { return pContext->ThrowNativeError("Invalid SMC Parse Handle %x (error %d)", hndl, err); diff --git a/core/smn_events.cpp b/core/smn_events.cpp index 61a1f923..2dcf1012 100644 --- a/core/smn_events.cpp +++ b/core/smn_events.cpp @@ -124,8 +124,9 @@ static cell_t sm_FireEvent(IPluginContext *pContext, const cell_t *params) Handle_t hndl = static_cast(params[1]); HandleError err; EventInfo *pInfo; + HandleSecurity sec(pContext->GetIdentity(), g_pCoreIdent); - if ((err=handlesys->ReadHandle(hndl, g_EventManager.GetHandleType(), NULL, (void **)&pInfo)) + if ((err=handlesys->ReadHandle(hndl, g_EventManager.GetHandleType(), &sec, (void **)&pInfo)) != HandleError_None) { return pContext->ThrowNativeError("Invalid game event handle %x (error %d)", hndl, err); @@ -140,7 +141,6 @@ static cell_t sm_FireEvent(IPluginContext *pContext, const cell_t *params) g_EventManager.FireEvent(pInfo, params[2] ? true : false); /* Free handle on game event */ - HandleSecurity sec(pContext->GetIdentity(), g_pCoreIdent); handlesys->FreeHandle(hndl, &sec); return 1; @@ -151,8 +151,9 @@ static cell_t sm_CancelCreatedEvent(IPluginContext *pContext, const cell_t *para Handle_t hndl = static_cast(params[1]); HandleError err; EventInfo *pInfo; + HandleSecurity sec(pContext->GetIdentity(), g_pCoreIdent); - if ((err=handlesys->ReadHandle(hndl, g_EventManager.GetHandleType(), NULL, (void **)&pInfo)) + if ((err=handlesys->ReadHandle(hndl, g_EventManager.GetHandleType(), &sec, (void **)&pInfo)) != HandleError_None) { return pContext->ThrowNativeError("Invalid game event handle %x (error %d)", hndl, err); @@ -167,7 +168,6 @@ static cell_t sm_CancelCreatedEvent(IPluginContext *pContext, const cell_t *para g_EventManager.CancelCreatedEvent(pInfo); /* Free handle on game event */ - HandleSecurity sec(pContext->GetIdentity(), g_pCoreIdent); handlesys->FreeHandle(hndl, &sec); return 1; @@ -178,8 +178,9 @@ static cell_t sm_GetEventName(IPluginContext *pContext, const cell_t *params) Handle_t hndl = static_cast(params[1]); HandleError err; EventInfo *pInfo; + HandleSecurity sec(pContext->GetIdentity(), g_pCoreIdent); - if ((err=handlesys->ReadHandle(hndl, g_EventManager.GetHandleType(), NULL, (void **)&pInfo)) + if ((err=handlesys->ReadHandle(hndl, g_EventManager.GetHandleType(), &sec, (void **)&pInfo)) != HandleError_None) { return pContext->ThrowNativeError("Invalid game event handle %x (error %d)", hndl, err); @@ -195,8 +196,9 @@ static cell_t sm_GetEventBool(IPluginContext *pContext, const cell_t *params) Handle_t hndl = static_cast(params[1]); HandleError err; EventInfo *pInfo; + HandleSecurity sec(pContext->GetIdentity(), g_pCoreIdent); - if ((err=handlesys->ReadHandle(hndl, g_EventManager.GetHandleType(), NULL, (void **)&pInfo)) + if ((err=handlesys->ReadHandle(hndl, g_EventManager.GetHandleType(), &sec, (void **)&pInfo)) != HandleError_None) { return pContext->ThrowNativeError("Invalid game event handle %x (error %d)", hndl, err); @@ -213,8 +215,9 @@ static cell_t sm_GetEventInt(IPluginContext *pContext, const cell_t *params) Handle_t hndl = static_cast(params[1]); HandleError err; EventInfo *pInfo; + HandleSecurity sec(pContext->GetIdentity(), g_pCoreIdent); - if ((err=handlesys->ReadHandle(hndl, g_EventManager.GetHandleType(), NULL, (void **)&pInfo)) + if ((err=handlesys->ReadHandle(hndl, g_EventManager.GetHandleType(), &sec, (void **)&pInfo)) != HandleError_None) { return pContext->ThrowNativeError("Invalid game event handle %x (error %d)", hndl, err); @@ -231,8 +234,9 @@ static cell_t sm_GetEventFloat(IPluginContext *pContext, const cell_t *params) Handle_t hndl = static_cast(params[1]); HandleError err; EventInfo *pInfo; + HandleSecurity sec(pContext->GetIdentity(), g_pCoreIdent); - if ((err=handlesys->ReadHandle(hndl, g_EventManager.GetHandleType(), NULL, (void **)&pInfo)) + if ((err=handlesys->ReadHandle(hndl, g_EventManager.GetHandleType(), &sec, (void **)&pInfo)) != HandleError_None) { return pContext->ThrowNativeError("Invalid game event handle %x (error %d)", hndl, err); @@ -251,8 +255,9 @@ static cell_t sm_GetEventString(IPluginContext *pContext, const cell_t *params) Handle_t hndl = static_cast(params[1]); HandleError err; EventInfo *pInfo; + HandleSecurity sec(pContext->GetIdentity(), g_pCoreIdent); - if ((err=handlesys->ReadHandle(hndl, g_EventManager.GetHandleType(), NULL, (void **)&pInfo)) + if ((err=handlesys->ReadHandle(hndl, g_EventManager.GetHandleType(), &sec, (void **)&pInfo)) != HandleError_None) { return pContext->ThrowNativeError("Invalid game event handle %x (error %d)", hndl, err); @@ -271,8 +276,9 @@ static cell_t sm_SetEventBool(IPluginContext *pContext, const cell_t *params) Handle_t hndl = static_cast(params[1]); HandleError err; EventInfo *pInfo; + HandleSecurity sec(pContext->GetIdentity(), g_pCoreIdent); - if ((err=handlesys->ReadHandle(hndl, g_EventManager.GetHandleType(), NULL, (void **)&pInfo)) + if ((err=handlesys->ReadHandle(hndl, g_EventManager.GetHandleType(), &sec, (void **)&pInfo)) != HandleError_None) { return pContext->ThrowNativeError("Invalid game event handle %x (error %d)", hndl, err); @@ -291,8 +297,9 @@ static cell_t sm_SetEventInt(IPluginContext *pContext, const cell_t *params) Handle_t hndl = static_cast(params[1]); HandleError err; EventInfo *pInfo; + HandleSecurity sec(pContext->GetIdentity(), g_pCoreIdent); - if ((err=handlesys->ReadHandle(hndl, g_EventManager.GetHandleType(), NULL, (void **)&pInfo)) + if ((err=handlesys->ReadHandle(hndl, g_EventManager.GetHandleType(), &sec, (void **)&pInfo)) != HandleError_None) { return pContext->ThrowNativeError("Invalid game event handle %x (error %d)", hndl, err); @@ -311,8 +318,9 @@ static cell_t sm_SetEventFloat(IPluginContext *pContext, const cell_t *params) Handle_t hndl = static_cast(params[1]); HandleError err; EventInfo *pInfo; + HandleSecurity sec(pContext->GetIdentity(), g_pCoreIdent); - if ((err=handlesys->ReadHandle(hndl, g_EventManager.GetHandleType(), NULL, (void **)&pInfo)) + if ((err=handlesys->ReadHandle(hndl, g_EventManager.GetHandleType(), &sec, (void **)&pInfo)) != HandleError_None) { return pContext->ThrowNativeError("Invalid game event handle %x (error %d)", hndl, err); @@ -332,8 +340,9 @@ static cell_t sm_SetEventString(IPluginContext *pContext, const cell_t *params) Handle_t hndl = static_cast(params[1]); HandleError err; EventInfo *pInfo; + HandleSecurity sec(pContext->GetIdentity(), g_pCoreIdent); - if ((err=handlesys->ReadHandle(hndl, g_EventManager.GetHandleType(), NULL, (void **)&pInfo)) + if ((err=handlesys->ReadHandle(hndl, g_EventManager.GetHandleType(), &sec, (void **)&pInfo)) != HandleError_None) { return pContext->ThrowNativeError("Invalid game event handle %x (error %d)", hndl, err); @@ -353,8 +362,9 @@ static cell_t sm_SetEventBroadcast(IPluginContext *pContext, const cell_t *param Handle_t hndl = static_cast(params[1]); HandleError err; EventInfo *pInfo; + HandleSecurity sec(pContext->GetIdentity(), g_pCoreIdent); - if ((err=handlesys->ReadHandle(hndl, g_EventManager.GetHandleType(), NULL, (void **)&pInfo)) + if ((err=handlesys->ReadHandle(hndl, g_EventManager.GetHandleType(), &sec, (void **)&pInfo)) != HandleError_None) { return pContext->ThrowNativeError("Invalid game event handle %x (error %d)", hndl, err);