Skip to content

Commit

Permalink
scripting plugin fix notification logon bug
Browse files Browse the repository at this point in the history
  • Loading branch information
MutonUfoAI committed Mar 15, 2018
1 parent 3da7a20 commit 88d3b8c
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions Plugins/scripting/scripting/PluginImpl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ internal bool ParseSettings(string[] setting, ref List<notify> lines)
return Convert.ToBoolean(lines.Count);
}

internal bool Run(int sessionId, string cmd, UserInformation userInfo, bool pwd, bool sys, string authentication, string authorization, string gateway)
internal bool Run(int sessionId, string cmd, UserInformation userInfo, bool pwd, bool? sys, string authentication, string authorization, string gateway)
{
string expand_cmd = "";
string expand_cmd_out = "";
Expand Down Expand Up @@ -279,11 +279,15 @@ internal bool Run(int sessionId, string cmd, UserInformation userInfo, bool pwd,
expand_cmd_out = expand_cmd_out.Trim();
m_logger.InfoFormat("execute {0}", expand_cmd_out);

if (sys)
if (sys == true)
{
return (Abstractions.WindowsApi.pInvokes.CProcess(null, expand_cmd) == 0) ? true : false;
}
else
else if (sys == false)
{
return Abstractions.WindowsApi.pInvokes.StartUserProcessInSessionWait(sessionId, expand_cmd);
}
else //null while logoff
{
return Abstractions.WindowsApi.pInvokes.StartProcessAsUserWait(userInfo.Username, Environment.MachineName, userInfo.Password, expand_cmd);
}
Expand Down Expand Up @@ -590,7 +594,7 @@ private void cleanup(UserInformation userInfo, int sessionID, SessionProperties
{
if (line.logoff)
{
if (!Run(userInfo.SessionID, line.script, userInfo, line.pwd, false, authentication, authorization, gateway))
if (!Run(userInfo.SessionID, line.script, userInfo, line.pwd, null, authentication, authorization, gateway))
m_logger.InfoFormat("failed to run:{0}", line.script);
}
}
Expand Down

0 comments on commit 88d3b8c

Please sign in to comment.