Re: Invalid characters for WTSQuerySessionInformation?



Thank you for your response.

I have discovered that Windows XP properly prevents characters such as '\' and '/' from being used in a username.

Characters such as '$' and '@' are problematic, for the reasons that we have discussed. But Windows XP permits these characters to be used in a username. The result is undesirable.

A tester blamed my code because of the effect of a username that had '@' in it. My code didn't check for things like that. My code doesn't create users, it only gets executed by users. I don't even create folders that are named for their username. But some APIs returned undesirable results.

In order to satisfy testers, I have to add some checks in my code. If the username includes a '@' then I have to pop up a message box saying "Sorry, this program won't work because your username contains '@'."

Please, what other characters do I have to check for?

(By the way this is with the Unicode version WTSQuerySessionInformationW. As mentioned, WTSQuerySessionInformationA fails with quite a lot of characters, so I already made a workaround using WTSQuerySessionInformationW and WideCharToMultiByte.)


"Ivan Brugiolo [MSFT]" <ivanbrug@xxxxxxxxxxxxxxxxxxxx> wrote in message news:OVS8x6FmHHA.596@xxxxxxxxxxxxxxxxxxxxxxx
Characters that allows for ambiguity between the `NTLM` fully
qualified names and the SPN-styles names, and the separators of those.
For example, the $ at the end of a name is normally reserved for
the machine domain account (assuming a Kerberos based environment).
`@` separates a name from it's domain.
The `\` is used for NTLM domain, and the `/` can be used
for explicitily registered principal names.
There are a few other restrictions for the last 2 characters of a NTLM name,
caused by the Browser Service implementation in the NTLM days,
and all the compatibilty issues from that onward.

--
--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of any included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm


"Norman Diamond" <ndiamond@xxxxxxxxxxxxxxxx> wrote in message news:%234nXUzBmHHA.3952@xxxxxxxxxxxxxxxxxxxxxxx
Windows XP, probably SP2.

We have been told that in some foreign versions of Windows XP, the Unicode version of WTSQuerySessionInformationW is failing to retrieve a username if the name includes an at sign "@".

I am thinking of preparing a test to find which characters WTSQuerySessionInformationW can't deal with. Intuitively I feel that Unicode characters "$", backslash, forward slash, quotation mark, and a few others might also be troublesome. But first I tried to find if there's any documentation on such restrictions, and couldn't find any.

Also intuitively I think there are probably other APIs that need testing too. We've already abandoned use of WTSQuerySessionInformationA, instead calling WTSQuerySessionInformationW and WideCharToMultiByte instead. (I attempted to describe that workaround twice in postings that have been censored from this newsgroup.) Does anyone know what characters are troublesome for any APIs, whether ANSI or Unicode, that deal with usernames?



.



Relevant Pages

  • Re: What is the maximal length of usernames on Solaris?
    ... > system to accommodate 4096 character user ID's. ... > 8 characters is to short in many circumstances. ... >>People who whine about petty shit such as how long a username can be ... but Windows uses a backward slash. ...
    (comp.sys.sun.admin)
  • Re: Invalid characters for WTSQuerySessionInformation?
    ... code page different from Windows' default code page. ... We don't have to validate the username, ... I have discovered that Windows XP properly prevents characters such as ... WTSQuerySessionInformationW and WideCharToMultiByte.) ...
    (microsoft.public.win32.programmer.kernel)
  • Re: Invalid characters for WTSQuerySessionInformation?
    ... and '/' from being used in a username. ... Characters such as '$' and '@' are problematic, ... (By the way this is with the Unicode version WTSQuerySessionInformationW. ... WTSQuerySessionInformationW and WideCharToMultiByte.) ...
    (microsoft.public.win32.programmer.kernel)
  • Re: Invalid characters for WTSQuerySessionInformation?
    ... Windows Server 2008 prohibits creating a username that contains an at sign "@". ... We have been told that in some foreign versions of Windows XP, the Unicode version of WTSQuerySessionInformationW is failing to retrieve a username if the name includes an at sign "@". ... Intuitively I feel that Unicode characters "$", backslash, forward slash, quotation mark, and a few others might also be troublesome. ...
    (microsoft.public.win32.programmer.kernel)
  • Re: What is the maximal length of usernames on Solaris?
    ... I don't know but 8 characters ... People who whine about petty shit such as how long a username can be ... should just forget all about any *nix system and stick with Windows. ... > reasons that it's been so successful. ...
    (comp.sys.sun.admin)

Loading