Skip to content

Commit 19927e0

Browse files
committed
Fixed bug introduced by PR #969 and found in #990 that mishandles null password and causes access denied in ctor.
1 parent 37b4826 commit 19927e0

File tree

57 files changed

+75
-70
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+75
-70
lines changed

TaskService/TaskService.cs

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -404,26 +404,29 @@ public string UserPassword
404404
}
405405

406406
/// <summary>Gets the user password in plain text from either userPassword or userSecurePassword.</summary>
407+
[CanBeNull]
407408
internal string UserPasswordPlainText
408409
{
409410
get
410411
{
411-
if (!string.IsNullOrEmpty(userPassword))
412-
return userPassword;
412+
if (!userPasswordSet)
413+
return null;
413414

414-
if (userSecurePassword == null)
415-
return string.Empty;
416-
417-
IntPtr valuePtr = IntPtr.Zero;
418-
try
419-
{
420-
valuePtr = Marshal.SecureStringToGlobalAllocUnicode(userSecurePassword);
421-
return Marshal.PtrToStringUni(valuePtr);
422-
}
423-
finally
415+
if (userSecurePassword != null)
424416
{
425-
Marshal.ZeroFreeGlobalAllocUnicode(valuePtr);
417+
IntPtr valuePtr = IntPtr.Zero;
418+
try
419+
{
420+
valuePtr = Marshal.SecureStringToGlobalAllocUnicode(userSecurePassword);
421+
return Marshal.PtrToStringUni(valuePtr);
422+
}
423+
finally
424+
{
425+
Marshal.ZeroFreeGlobalAllocUnicode(valuePtr);
426+
}
426427
}
428+
429+
return userPassword;
427430
}
428431
}
429432

docs/Microsoft.Win32.TaskScheduler.xml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4820,9 +4820,11 @@
48204820
This section borrows liberally from the site http://www.nncron.ru/help/EN/working/cron-format.htm. The cron format consists of five fields separated
48214821
by white spaces:
48224822
</para>
4823-
<code language="cs">&lt;Minute&gt; &lt;Hour&gt; &lt;Day_of_the_Month&gt; &lt;Month_of_the_Year&gt; &lt;Day_of_the_Week&gt;</code>
4824-
<para>Each item has bounds as defined by the following:</para>
48254823
<code language="cs">
4824+
&lt;Minute&gt; &lt;Hour&gt; &lt;Day_of_the_Month&gt; &lt;Month_of_the_Year&gt; &lt;Day_of_the_Week&gt;
4825+
</code>
4826+
<para>Each item has bounds as defined by the following:</para>
4827+
<code>
48264828
* * * * *
48274829
| | | | |
48284830
| | | | +---- Day of the Week (range: 1-7, 1 standing for Monday)

docs/fti/FTI_100.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

docs/fti/FTI_101.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

docs/fti/FTI_102.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

docs/fti/FTI_103.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

docs/fti/FTI_104.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

docs/fti/FTI_105.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

docs/fti/FTI_106.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"jobregistered":[101842945],"jobstartfailed":[101842945],"june":[100728834],"january":[57475073,100728835],"jobstart":[101842945],"jobfailure":[101842945],"jobnostartwithoutnetwork":[101842945],"jobtermination":[101842945],"jobsuccess":[101842945],"just":[99090433,100466689,105447425],"joe":[100073474],"job":[57475073,98041857,100532225,101842945],"july":[100728834]}
1+
{"jobregistered":[103219201],"jobstartfailed":[103219201],"june":[101187586],"january":[56819713,101187587],"jobstart":[103219201],"jobfailure":[103219201],"jobnostartwithoutnetwork":[103219201],"jobtermination":[103219201],"jobsuccess":[103219201],"just":[98762753,101908481,102760449],"joe":[101318658],"job":[56819713,93388801,100794369,103219201],"july":[101187586]}

docs/fti/FTI_107.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"keywords":[6750210,9109507,100335618],"keyboard":[10551297,17367041,19791873,20709377,93323265,97255425,98238465],"kind":[57475073,61800449,76152833,96206853,97386504,99876866,100073473,102629377],"kept":[100270081],"key":[11403265,29818881,32505857,47185923,61865985,62455809,62980097,71434241,95223809,95944705,96468993,100990977,105119745],"know":[81068033,102694913],"keepexisting":[21495810,21954562],"kvp":[32505858],"kinds":[32047105],"keyvaluepair":[32505859,55377921,101384193],"known":[51052545,57475073,101974017,102039553]}
1+
{"keywords":[6029314,9240579,100466690],"keyboard":[10420225,12976129,14221313,20774913,94961665,97517569,102891521],"kind":[56819713,60686337,84410369,89063432,92471297,95617029,101318657,101384194],"kept":[105316353],"key":[15925249,28639233,34144257,52232195,65273857,66191361,67239937,83755009,90243073,91881473,101711873,101777409,102825985],"know":[80412673,102694913],"keepexisting":[20578306,21495810],"kvp":[34144258],"kinds":[37289985],"keyvaluepair":[34144259,59899905,102170625],"known":[52822017,56819713,101580801,105775105]}

0 commit comments

Comments
 (0)