aboutsummaryrefslogtreecommitdiff
path: root/src/ext/Util/wixext
diff options
context:
space:
mode:
authorRon Martin <cpuwzd@comcast.net>2022-08-29 18:38:07 -0400
committerRob Mensching <rob@firegiant.com>2022-10-21 19:08:08 -0700
commit08cdc6aa2b9dd0e273a3c3a22893616d26342a0e (patch)
tree1d0b9f7e21cec02abfda50b1a3c6d0c24308998b /src/ext/Util/wixext
parent40bd65379768f99ec28bffe2691ba43c78c9e9c4 (diff)
downloadwix-08cdc6aa2b9dd0e273a3c3a22893616d26342a0e.tar.gz
wix-08cdc6aa2b9dd0e273a3c3a22893616d26342a0e.tar.bz2
wix-08cdc6aa2b9dd0e273a3c3a22893616d26342a0e.zip
Support add, modify and remove comments on user accounts
Fixes 5371
Diffstat (limited to 'src/ext/Util/wixext')
-rw-r--r--src/ext/Util/wixext/Symbols/UserSymbol.cs10
-rw-r--r--src/ext/Util/wixext/UtilCompiler.cs22
-rw-r--r--src/ext/Util/wixext/UtilDecompiler.cs6
-rw-r--r--src/ext/Util/wixext/UtilTableDefinitions.cs1
4 files changed, 36 insertions, 3 deletions
diff --git a/src/ext/Util/wixext/Symbols/UserSymbol.cs b/src/ext/Util/wixext/Symbols/UserSymbol.cs
index 5f00064b..6ea810de 100644
--- a/src/ext/Util/wixext/Symbols/UserSymbol.cs
+++ b/src/ext/Util/wixext/Symbols/UserSymbol.cs
@@ -15,6 +15,7 @@ namespace WixToolset.Util
15 new IntermediateFieldDefinition(nameof(UserSymbolFields.Name), IntermediateFieldType.String), 15 new IntermediateFieldDefinition(nameof(UserSymbolFields.Name), IntermediateFieldType.String),
16 new IntermediateFieldDefinition(nameof(UserSymbolFields.Domain), IntermediateFieldType.String), 16 new IntermediateFieldDefinition(nameof(UserSymbolFields.Domain), IntermediateFieldType.String),
17 new IntermediateFieldDefinition(nameof(UserSymbolFields.Password), IntermediateFieldType.String), 17 new IntermediateFieldDefinition(nameof(UserSymbolFields.Password), IntermediateFieldType.String),
18 new IntermediateFieldDefinition(nameof(UserSymbolFields.Comment), IntermediateFieldType.String),
18 new IntermediateFieldDefinition(nameof(UserSymbolFields.Attributes), IntermediateFieldType.Number), 19 new IntermediateFieldDefinition(nameof(UserSymbolFields.Attributes), IntermediateFieldType.Number),
19 }, 20 },
20 typeof(UserSymbol)); 21 typeof(UserSymbol));
@@ -31,6 +32,7 @@ namespace WixToolset.Util.Symbols
31 Name, 32 Name,
32 Domain, 33 Domain,
33 Password, 34 Password,
35 Comment,
34 Attributes, 36 Attributes,
35 } 37 }
36 38
@@ -70,10 +72,16 @@ namespace WixToolset.Util.Symbols
70 set => this.Set((int)UserSymbolFields.Password, value); 72 set => this.Set((int)UserSymbolFields.Password, value);
71 } 73 }
72 74
75 public string Comment
76 {
77 get => this.Fields[(int)UserSymbolFields.Comment].AsString();
78 set => this.Set((int)UserSymbolFields.Comment, value);
79 }
80
73 public int Attributes 81 public int Attributes
74 { 82 {
75 get => this.Fields[(int)UserSymbolFields.Attributes].AsNumber(); 83 get => this.Fields[(int)UserSymbolFields.Attributes].AsNumber();
76 set => this.Set((int)UserSymbolFields.Attributes, value); 84 set => this.Set((int)UserSymbolFields.Attributes, value);
77 } 85 }
78 } 86 }
79} \ No newline at end of file 87}
diff --git a/src/ext/Util/wixext/UtilCompiler.cs b/src/ext/Util/wixext/UtilCompiler.cs
index a6e4b835..d937b4f1 100644
--- a/src/ext/Util/wixext/UtilCompiler.cs
+++ b/src/ext/Util/wixext/UtilCompiler.cs
@@ -34,6 +34,7 @@ namespace WixToolset.Util
34 internal const int UserDontRemoveOnUninstall = 0x00000100; 34 internal const int UserDontRemoveOnUninstall = 0x00000100;
35 internal const int UserDontCreateUser = 0x00000200; 35 internal const int UserDontCreateUser = 0x00000200;
36 internal const int UserNonVital = 0x00000400; 36 internal const int UserNonVital = 0x00000400;
37 internal const int UserRemoveComment = 0x00000800;
37 38
38 private static readonly Regex FindPropertyBrackets = new Regex(@"\[(?!\\|\])|(?<!\[\\\]|\[\\|\\\[)\]", RegexOptions.ExplicitCapture | RegexOptions.Compiled); 39 private static readonly Regex FindPropertyBrackets = new Regex(@"\[(?!\\|\])|(?<!\[\\\]|\[\\|\\\[)\]", RegexOptions.ExplicitCapture | RegexOptions.Compiled);
39 40
@@ -3251,6 +3252,7 @@ namespace WixToolset.Util
3251 int attributes = 0; 3252 int attributes = 0;
3252 string domain = null; 3253 string domain = null;
3253 string name = null; 3254 string name = null;
3255 string comment = null;
3254 string password = null; 3256 string password = null;
3255 3257
3256 foreach (var attrib in element.Attributes()) 3258 foreach (var attrib in element.Attributes())
@@ -3273,6 +3275,14 @@ namespace WixToolset.Util
3273 attributes |= UserPasswdCantChange; 3275 attributes |= UserPasswdCantChange;
3274 } 3276 }
3275 break; 3277 break;
3278 case "Comment":
3279 if (null == componentId)
3280 {
3281 this.Messaging.Write(UtilErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, element.Name.LocalName, attrib.Name.LocalName));
3282 }
3283
3284 comment = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib);
3285 break;
3276 case "CreateUser": 3286 case "CreateUser":
3277 if (null == componentId) 3287 if (null == componentId)
3278 { 3288 {
@@ -3357,6 +3367,12 @@ namespace WixToolset.Util
3357 attributes |= UserDontExpirePasswrd; 3367 attributes |= UserDontExpirePasswrd;
3358 } 3368 }
3359 break; 3369 break;
3370 case "RemoveComment":
3371 if (YesNoType.Yes == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib))
3372 {
3373 attributes |= UserRemoveComment;
3374 }
3375 break;
3360 case "RemoveOnUninstall": 3376 case "RemoveOnUninstall":
3361 if (null == componentId) 3377 if (null == componentId)
3362 { 3378 {
@@ -3411,6 +3427,11 @@ namespace WixToolset.Util
3411 this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, element.Name.LocalName, "Name")); 3427 this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, element.Name.LocalName, "Name"));
3412 } 3428 }
3413 3429
3430 if (null != comment && (UserRemoveComment & attributes) != 0)
3431 {
3432 this.Messaging.Write(ErrorMessages.IllegalAttributeWithOtherAttribute(sourceLineNumbers, element.Name.LocalName, "Comment", "RemoveComment"));
3433 }
3434
3414 foreach (var child in element.Elements()) 3435 foreach (var child in element.Elements())
3415 { 3436 {
3416 if (this.Namespace == child.Name.Namespace) 3437 if (this.Namespace == child.Name.Namespace)
@@ -3450,6 +3471,7 @@ namespace WixToolset.Util
3450 Name = name, 3471 Name = name,
3451 Domain = domain, 3472 Domain = domain,
3452 Password = password, 3473 Password = password,
3474 Comment = comment,
3453 Attributes = attributes, 3475 Attributes = attributes,
3454 }); 3476 });
3455 } 3477 }
diff --git a/src/ext/Util/wixext/UtilDecompiler.cs b/src/ext/Util/wixext/UtilDecompiler.cs
index 7d95fcef..1201fdd5 100644
--- a/src/ext/Util/wixext/UtilDecompiler.cs
+++ b/src/ext/Util/wixext/UtilDecompiler.cs
@@ -559,13 +559,14 @@ namespace WixToolset.Util
559 { 559 {
560 foreach (var row in table.Rows) 560 foreach (var row in table.Rows)
561 { 561 {
562 var attributes = row.FieldAsNullableInteger(5) ?? 0; 562 var attributes = row.FieldAsNullableInteger(6) ?? 0;
563 563
564 var user = new XElement(UtilConstants.UserName, 564 var user = new XElement(UtilConstants.UserName,
565 new XAttribute("Id", row.FieldAsString(0)), 565 new XAttribute("Id", row.FieldAsString(0)),
566 new XAttribute("Name", row.FieldAsString(2)), 566 new XAttribute("Name", row.FieldAsString(2)),
567 AttributeIfNotNull("Domain", row, 3), 567 AttributeIfNotNull("Domain", row, 3),
568 AttributeIfNotNull("Password", row, 4), 568 AttributeIfNotNull("Password", row, 4),
569 AttributeIfNotNull("Comment", row, 5),
569 AttributeIfTrue("PasswordNeverExpires", UtilCompiler.UserDontExpirePasswrd == (attributes & UtilCompiler.UserDontExpirePasswrd)), 570 AttributeIfTrue("PasswordNeverExpires", UtilCompiler.UserDontExpirePasswrd == (attributes & UtilCompiler.UserDontExpirePasswrd)),
570 AttributeIfTrue("CanNotChangePassword", UtilCompiler.UserPasswdCantChange == (attributes & UtilCompiler.UserPasswdCantChange)), 571 AttributeIfTrue("CanNotChangePassword", UtilCompiler.UserPasswdCantChange == (attributes & UtilCompiler.UserPasswdCantChange)),
571 AttributeIfTrue("PasswordExpired", UtilCompiler.UserPasswdChangeReqdOnLogin == (attributes & UtilCompiler.UserPasswdChangeReqdOnLogin)), 572 AttributeIfTrue("PasswordExpired", UtilCompiler.UserPasswdChangeReqdOnLogin == (attributes & UtilCompiler.UserPasswdChangeReqdOnLogin)),
@@ -573,7 +574,8 @@ namespace WixToolset.Util
573 AttributeIfTrue("FailIfExists", UtilCompiler.UserFailIfExists == (attributes & UtilCompiler.UserFailIfExists)), 574 AttributeIfTrue("FailIfExists", UtilCompiler.UserFailIfExists == (attributes & UtilCompiler.UserFailIfExists)),
574 AttributeIfTrue("UpdateIfExists", UtilCompiler.UserUpdateIfExists == (attributes & UtilCompiler.UserUpdateIfExists)), 575 AttributeIfTrue("UpdateIfExists", UtilCompiler.UserUpdateIfExists == (attributes & UtilCompiler.UserUpdateIfExists)),
575 AttributeIfTrue("LogonAsService", UtilCompiler.UserLogonAsService == (attributes & UtilCompiler.UserLogonAsService)), 576 AttributeIfTrue("LogonAsService", UtilCompiler.UserLogonAsService == (attributes & UtilCompiler.UserLogonAsService)),
576 AttributeIfTrue("LogonAsService", UtilCompiler.UserLogonAsService == (attributes & UtilCompiler.UserLogonAsService)) 577 AttributeIfTrue("LogonAsBatchJob", UtilCompiler.UserLogonAsBatchJob == (attributes & UtilCompiler.UserLogonAsBatchJob)),
578 AttributeIfTrue("RemoveComment", UtilCompiler.UserRemoveComment == (attributes & UtilCompiler.UserRemoveComment))
577 ); 579 );
578 580
579 if (UtilCompiler.UserDontRemoveOnUninstall == (attributes & UtilCompiler.UserDontRemoveOnUninstall)) 581 if (UtilCompiler.UserDontRemoveOnUninstall == (attributes & UtilCompiler.UserDontRemoveOnUninstall))
diff --git a/src/ext/Util/wixext/UtilTableDefinitions.cs b/src/ext/Util/wixext/UtilTableDefinitions.cs
index 57c18b6c..33e6d3d1 100644
--- a/src/ext/Util/wixext/UtilTableDefinitions.cs
+++ b/src/ext/Util/wixext/UtilTableDefinitions.cs
@@ -229,6 +229,7 @@ namespace WixToolset.Util
229 new ColumnDefinition("Name", ColumnType.String, 255, primaryKey: false, nullable: false, ColumnCategory.Formatted, description: "User name", modularizeType: ColumnModularizeType.Property), 229 new ColumnDefinition("Name", ColumnType.String, 255, primaryKey: false, nullable: false, ColumnCategory.Formatted, description: "User name", modularizeType: ColumnModularizeType.Property),
230 new ColumnDefinition("Domain", ColumnType.String, 255, primaryKey: false, nullable: true, ColumnCategory.Formatted, description: "User domain", modularizeType: ColumnModularizeType.Property), 230 new ColumnDefinition("Domain", ColumnType.String, 255, primaryKey: false, nullable: true, ColumnCategory.Formatted, description: "User domain", modularizeType: ColumnModularizeType.Property),
231 new ColumnDefinition("Password", ColumnType.String, 255, primaryKey: false, nullable: true, ColumnCategory.Formatted, description: "User password", modularizeType: ColumnModularizeType.Property), 231 new ColumnDefinition("Password", ColumnType.String, 255, primaryKey: false, nullable: true, ColumnCategory.Formatted, description: "User password", modularizeType: ColumnModularizeType.Property),
232 new ColumnDefinition("Comment", ColumnType.String, 255, primaryKey: false, nullable: true, ColumnCategory.Formatted, description: "User comment", modularizeType: ColumnModularizeType.Property),
232 new ColumnDefinition("Attributes", ColumnType.Number, 4, primaryKey: false, nullable: true, ColumnCategory.Unknown, minValue: 0, maxValue: 65535, description: "Attributes describing how to create the user"), 233 new ColumnDefinition("Attributes", ColumnType.Number, 4, primaryKey: false, nullable: true, ColumnCategory.Unknown, minValue: 0, maxValue: 65535, description: "Attributes describing how to create the user"),
233 }, 234 },
234 symbolIdIsPrimaryKey: true 235 symbolIdIsPrimaryKey: true