X-Recipient: archive-cygwin@delorie.com
X-Spam-Check-By: sourceware.org
Message-ID: <47D39192.2020801@cwilson.fastmail.fm>
Date: Sun, 09 Mar 2008 02:28:18 -0500
From: Charles Wilson <cygwin@cwilson.fastmail.fm>
User-Agent: Thunderbird 2.0.0.12 (Windows/20080213)
MIME-Version: 1.0
To: cygwin@cygwin.com
Subject: Re: csih and sspi with guest accounts
References: <47CE07A2.5030505@cwilson.fastmail.fm> <47CEE4DD.6030608@x-ray.at> <47D2F243.4090309@x-ray.at>
In-Reply-To: <47D2F243.4090309@x-ray.at>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

Reini Urban wrote:
> Reini Urban schrieb:
> I'd need to warn the user on XP about an active
> "net user Guest" account. "Guest" needs to be localized, hmm.
> I have "Gast" in german.

I've uploaded a new version as a 'test' release (csih-0.1.1-1). It 
includes a (binary) utility program:

getAccountName [-hVL] [-g|-a|-n INT]
returns the (possibly localized) name of the requested account

    --help|-h           print this help
    --version|-V        print version information
    --license|-L        print license information
    --guest|-g          print name of Guest account
    --admin|-a          print name of Administrator account
    --number|-n NUM     print name of the account specified by the 

                        supplied integer. This number should be in
                        the range [0,78] inclusive. See
                        WELL_KNOWN_SID_TYPE documentation matching
                        these numbers to specific account types.
Exactly one of the options `-g', `-a', or `-n INT' may be specified.
NOTE: this application works only on Windows XP or above

BTW, this utility is a native program, not a cygwin one. So if you use 
it directly, you'll need to strip \r before passing the result to "net 
user".  Or, use the csih shell function(s) that wraps this utility,
   csih_get_localized_account_name()
   csih_get_guest_account_name()
which does that for you.

> I believe having a global shell function for the postinstaller
> to check for xp and an active Guest account would make sense for the 
> service helper.
>   csih_is_xp()
>   csih_guestaccount_active()
> 
> csih_is_2008() would also be appreciated.

The test release also includes:

* New system id function: csih_is_2k(), csih_is_xp(), csih_is_vista()

note that Vista and Server 2008 both report "CYGWIN_NT-6.0", so I don't 
really have a good way of distinguishing between them.

Also, all of these "system id" functions are "minimum".  That is, if 
your system is Vista, then ALL of the id functions will return true, 
because they each are defined as:

    will return true if the system is XXXX or above

So, to find out if the system is EXACTLY windows XP, you have to check 
csih_is_xp && ! csih_is_vista

* New function: csih_invoke_helper
     invokes utilities in /usr/lib/csih/
* New function: csih_get_localized_account_name
     Given an WELL_KNOWN_SID_TYPE enumeration value, uses getAccountName
     utility to obtain the localized name associated with the account
* New function: csih_get_guest_account_name
     Shortcut using csih_get_localized_account_name for Guest account
* New function: csih_guest_account_active
     returns true (0) if Guest account is active, false (1) otherwise

Let me know what you think...

--
Chuck


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

