{"action":"opened","issue":{"url":"https://api.github.com/repos/saltstack/salt/issues/42279","repository_url":"https://api.github.com/repos/saltstack/salt","labels_url":"https://api.github.com/repos/saltstack/salt/issues/42279/labels{/name}","comments_url":"https://api.github.com/repos/saltstack/salt/issues/42279/comments","events_url":"https://api.github.com/repos/saltstack/salt/issues/42279/events","html_url":"https://github.com/saltstack/salt/issues/42279","id":242463405,"number":42279,"title":"win_lgpo matches multiple policies due to startswith()","user":{"login":"dafyddj","id":4195158,"avatar_url":"https://avatars1.githubusercontent.com/u/4195158?v=3","gravatar_id":"","url":"https://api.github.com/users/dafyddj","html_url":"https://github.com/dafyddj","followers_url":"https://api.github.com/users/dafyddj/followers","following_url":"https://api.github.com/users/dafyddj/following{/other_user}","gists_url":"https://api.github.com/users/dafyddj/gists{/gist_id}","starred_url":"https://api.github.com/users/dafyddj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dafyddj/subscriptions","organizations_url":"https://api.github.com/users/dafyddj/orgs","repos_url":"https://api.github.com/users/dafyddj/repos","events_url":"https://api.github.com/users/dafyddj/events{/privacy}","received_events_url":"https://api.github.com/users/dafyddj/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-07-12T17:53:04Z","updated_at":"2017-07-12T17:53:04Z","closed_at":null,"body":"### Description of Issue/Question\r\nI'm working with the Administrative Templates for Office 2016 (available [here](https://www.microsoft.com/en-us/download/details.aspx?id=49030)) and I'm unable to set a particular policy and receive what I believe is an erroneous message.\r\n```\r\n----------\r\n          ID: lgpo_macros\r\n    Function: lgpo.set\r\n      Result: False\r\n     Comment: ADML policy name \"Trusted Location #1\" is used as the display name for multiple policies.  These policies\r\nmatched: Microsoft Office 2016\\Security Settings\\Trust Center\\Trusted Location #1, Microsoft Word 2016\\Word Options\\Secu\r\nrity\\Trust Center\\Trusted Locations\\Trusted Location #1, Microsoft Office 2016\\Security Settings\\Trust Center\\Trusted Lo\r\ncation #1, Microsoft Word 2016\\Word Options\\Security\\Trust Center\\Trusted Locations\\Trusted Location #1, Microsoft Offic\r\ne 2016\\Security Settings\\Trust Center\\Trusted Location #1, Microsoft Word 2016\\Word Options\\Security\\Trust Center\\Truste\r\nd Locations\\Trusted Location #1, Microsoft Office 2016\\Security Settings\\Trust Center\\Trusted Location #1, Microsoft Wor\r\nd 2016\\Word Options\\Security\\Trust Center\\Trusted Locations\\Trusted Location #1, Microsoft Office 2016\\Security Settings\r\n\\Trust Center\\Trusted Location #1, Microsoft Word 2016\\Word Options\\Security\\Trust Center\\Trusted Locations\\Trusted Loca\r\ntion #1, Microsoft Office 2016\\Security Settings\\Trust Center\\Trusted Location #1, Microsoft Word 2016\\Word Options\\Secu\r\nrity\\Trust Center\\Trusted Locations\\Trusted Location #1, Microsoft Office 2016\\Security Settings\\Trust Center\\Trusted Lo\r\ncation #1, Microsoft Word 2016\\Word Options\\Security\\Trust Center\\Trusted Locations\\Trusted Location #1, Microsoft Offic\r\ne 2016\\Security Settings\\Trust Center\\Trusted Location #1, Microsoft Word 2016\\Word Options\\Security\\Trust Center\\Truste\r\nd Locations\\Trusted Location #1, Microsoft Office 2016\\Security Settings\\Trust Center\\Trusted Location #1, Microsoft Wor\r\nd 2016\\Word Options\\Security\\Trust Center\\Trusted Locations\\Trusted Location #1, Microsoft Office 2016\\Security Settings\r\n\\Trust Center\\Trusted Location #1, Microsoft Word 2016\\Word Options\\Security\\Trust Center\\Trusted Locations\\Trusted Loca\r\ntion #1, Microsoft Office 2016\\Security Settings\\Trust Center\\Trusted Location #1, Microsoft Word 2016\\Word Options\\Secu\r\nrity\\Trust Center\\Trusted Locations\\Trusted Location #1, Microsoft Office 2016\\Security Settings\\Trust Center\\Trusted Lo\r\ncation #1, Microsoft Word 2016\\Word Options\\Security\\Trust Center\\Trusted Locations\\Trusted Location #1.  You can utiliz\r\ne these long names to specify the correct policy\r\n```\r\nThe bottom of the message says `You can utilize these long names to specify the correct policy` but I already am using a long name, as can be seen from my sls file.\r\n\r\nThe debug log shows more detail about the multiple matches:\r\n```\r\n[DEBUG   ] found an ADML entry matching the string! {word16.Office.Microsoft.Policies.Windows}string -- {'id': 'L_Truste\r\ndLoc01'}\r\n[DEBUG   ] searching for displayName == $(string.L_TrustedLoc01)\r\n[DEBUG   ] found an ADML entry matching the string! {word16.Office.Microsoft.Policies.Windows}string -- {'id': 'L_Truste\r\ndLoc11'}\r\n[DEBUG   ] searching for displayName == $(string.L_TrustedLoc11)\r\n[DEBUG   ] found an ADML entry matching the string! {word16.Office.Microsoft.Policies.Windows}string -- {'id': 'L_Truste\r\ndLoc13'}\r\n[DEBUG   ] searching for displayName == $(string.L_TrustedLoc13)\r\n[DEBUG   ] found an ADML entry matching the string! {word16.Office.Microsoft.Policies.Windows}string -- {'id': 'L_Truste\r\ndLoc15'}\r\n[DEBUG   ] searching for displayName == $(string.L_TrustedLoc15)\r\n[DEBUG   ] found an ADML entry matching the string! {word16.Office.Microsoft.Policies.Windows}string -- {'id': 'L_Truste\r\ndLoc17'}\r\n[DEBUG   ] searching for displayName == $(string.L_TrustedLoc17)\r\n[DEBUG   ] found an ADML entry matching the string! {word16.Office.Microsoft.Policies.Windows}string -- {'id': 'L_Truste\r\ndLoc19'}\r\n[DEBUG   ] searching for displayName == $(string.L_TrustedLoc19)\r\n```\r\nIt appears to be matching \"`Trusted Location #11`\" and others (no idea why only odd numbers) the same as \"`Trusted Location #1`\" i.e. matching the start of the string. \r\nOn further investigation, this behaviour was introduced in #38783.\r\n\r\n### Setup\r\n```\r\n# policy.sls\r\nlgpo_macros:                                                                                                                                                                     \r\n  lgpo.set:\r\n    - user_policy:\r\n        \"Microsoft Word 2016\\\\Word Options\\\\Security\\\\Trust Center\\\\Trusted Locations\\\\Trusted Location #1\":                                                                     \r\n          L_Pathcolon: C:\\Program Files (x86)\\                                                                                             \r\n          L_Descriptioncolon: Allow something\r\n          L_Allowsubfolders: False\r\n```\r\n\r\n### Steps to Reproduce Issue\r\n\r\n1. Copy word16.admx and word16.adml from the downloaded administrative templates to **C:\\Windows\\PolicyDefinitions** and **C:\\Windows\\PolicyDefinitions\\en-US** respectively\r\n2. Run `salt-call.bat -l debug state.apply policy`\r\n\r\nIt's also possible to show the problem from a Linux/Mac command line:\r\n```\r\n$ xmllint --xpath '//*[starts-with(text(), \"Trusted Location #1\") and @*[local-name() = \"id\"]]' word16.adml \r\n<string id=\"L_TrustedLoc01\">Trusted Location #1</string><string id=\"L_TrustedLoc10\">Trusted Location #10</string><string id=\"L_TrustedLoc11\">Trusted Location #11</string><string id=\"L_TrustedLoc12\">Trusted Location #12</string><string id=\"L_TrustedLoc13\">Trusted Location #13</string><string id=\"L_TrustedLoc14\">Trusted Location #14</string><string id=\"L_TrustedLoc15\">Trusted Location #15</string><string id=\"L_TrustedLoc16\">Trusted Location #16</string><string id=\"L_TrustedLoc17\">Trusted Location #17</string><string id=\"L_TrustedLoc18\">Trusted Location #18</string><string id=\"L_TrustedLoc19\">Trusted Location #19</string>\r\n$ xmllint --xpath '//*[starts-with(text(), \"Trusted Location #3\") and @*[local-name() = \"id\"]]' word16.adml \r\n<string id=\"L_TrustedLoc03\">Trusted Location #3</string>\r\n```\r\n\r\n### Versions Report\r\n```\r\nPS C:\\Users\\vagrant> C:\\salt\\salt.bat --versions-report\r\nSalt Version:\r\n           Salt: 2016.11.6\r\n\r\nDependency Versions:\r\n           cffi: 1.10.0\r\n       cherrypy: unknown\r\n       dateutil: 2.5.3\r\n      docker-py: Not Installed\r\n          gitdb: 0.6.4\r\n      gitpython: 2.0.8\r\n          ioflo: 1.5.5\r\n         Jinja2: 2.9.4\r\n        libgit2: Not Installed\r\n        libnacl: 1.4.5\r\n       M2Crypto: Not Installed\r\n           Mako: 1.0.4\r\n   msgpack-pure: Not Installed\r\n msgpack-python: 0.4.8\r\n   mysql-python: Not Installed\r\n      pycparser: 2.17\r\n       pycrypto: 2.6.1\r\n   pycryptodome: Not Installed\r\n         pygit2: Not Installed\r\n         Python: 2.7.12 (v2.7.12:d33e0cf91556, Jun 27 2016, 15:24:40) [MSC v.1500 64 bit (AMD64)]\r\n   python-gnupg: 0.3.8\r\n         PyYAML: 3.11\r\n          PyZMQ: 16.0.1\r\n           RAET: Not Installed\r\n          smmap: 0.9.0\r\n        timelib: 0.2.4\r\n        Tornado: 4.4.1\r\n            ZMQ: 4.1.6\r\n\r\nSystem Versions:\r\n           dist:\r\n        machine: AMD64\r\n        release: 8.1\r\n         system: Windows\r\n        version: 8.1 6.3.9600  Multiprocessor Free\r\n```"}}
{"actor":{"display_login":"dafyddj"}}