Intranet/Hosting Toolkit [table of contents]
[CFX_Users]
v2.11 November 30th 2001
CFX_Users
OPEN-SOURCE
NT DLL for Cold Fusion 4.0.1 and up
Lewis A. Sellers
http://www.intrafoundation.com/ihtk.asp
products@intrafoundation.com

FOREWORD

This is an Allaire Cold Fusion Extension Tag (CFX). It is for use with Allaire Cold Fusion Servers 4.0.1 (and up) running on Microsoft NT. It was written by Lewis A. Sellers of Intrafoundation Software.

CFX_Users provides a functionality similar to NT4's administrative tool "User Manager for Domains" or W2K's "Active Directory for Users and Computers". With it you can create, delete, modify or copy any NT user account. You can also modify the groups they are members of.

Please read the version history for current tag status before emailing questions.

C O N T E N T S

Foreword

General
Users

Version History

top

G E N E R A L

ABOUT

<CFX_Users ACTION="ABOUT">

The tag itself returns a couple variables back no matter what you do (UsersDescription, UsersVersion and UsersError). These are always available unless there is a catastrophic failure of the tag.

Additionally you can use the ABOUT function to return more detailed information on the tag. The fields returned are mostly only of interest for curiosity or in debugging a situation.

Note below that though the tag returns it's SerialNumber, it's not used currently, and hasn't been for a very long time, but probably will be again soon.

For the curious, it also proves the total number of lines of c/c++ that the current build was using. This includes the scant comments in the source code. For instance, this build of the tag has 2732 lines of code.

Description
The general product description.
Version
The version number of the software, ie 2.0.
Quality

The quality field will be one of the following four: "Alpha", "Beta", "Gamma" or "Omega". Quality relates the quality control status of the version of the tag you're currently using.

Alpha code is highly unstable and shouldn't be trusted for anything. Do not use on production machines.

Beta code is close to being finish and it is in a debugging phase. Do not use on production machines.

Gamma code is for use on production machines. As far as the beta testers have determined it works as it should.

When a product goes Omega that generally means it is long used Gamma code that is now no longer being maintained.

SubVersion
The subversion number of the software, ie 4 for "2.0beta4".
SerialNumber
Currently unused.
Lines
The total lines of c/c++ code in the software.
BuildDate
The ODBC DATETIME when the tag was last compiled (built).
Evaluation
Boolean field (0 or 1). 1 indicates the version of the tag you're using is a time-limited evaluation version. 0 is full commercial.
ExpirationDate
The ODBC DATETIME date when the tag will stop working.



top

U S E R S

Managing users is what this software is all about. What that in mind it should probably be mentioned that, if you didn't know already the NT User Account name consists of up to 20 printable ANSI characters (case sensitive) except: " / \ [ ] : ; | = . + ? <>

USERS

<CFX_Users ACTION="USERS">

FIELDS
Userstring
FullNamestring
Descriptionstring
SIDstring
OPTIONAL
Computerstring
Querystring
REQUIRED
ActionUSERS

The additional fields that are available are the users' full human-readable name, any comments the administrators may have regarding the users, comments or a description by the users about themselves and their SIDs.

A SID? What's that? It's a Security Descriptor. It's the way NT makes sure all user accounts across domains are unique. Each time a user account is created a new SID assigned to it.

If you were wondering (and you know you were), the SID for the Administrator account of this machine is S-1-5-21-1177238915-688789844-1343024091-500. The Guest account has a SID of S-1-5-21-1177238915-688789844-1343024091-501.

If Computer is not supplied then the local machine is assumed.





CURRENTUSERS

<CFX_Users ACTION="CURRENTUSERS">

FIELDS
Userstring
Domainstring
Computerstring
Domainsstring
OPTIONAL
Computerstring
Querystring
REQUIRED
ActionCURRENTUSERS

Returns a query containing a list of all users currently logged onto a machine. Note that there are some instances involving SAMBA, NT3.51 and certain NT4 service patches where the user list is known to be sticky. That is, once a user logs in they may listed as still logged in for a time after they have actually logged out.

The Domains field is a coma-separated list of all domains/servers visited by the user.

Domain is the domain of the user.

Computer is the name of the computer the user is logged in from.





ADD

<CFX_Users ACTION="ADD">

OPTIONAL
Computerstring
Passwordstring
MustChangePaswordboolean
CannotChangePasswordboolean
PasswordNeverExpiresboolean
AccountDisabledboolean
REQUIRED
ActionADD
Userstring
Fullnamestring

ADD, of course, adds a new user. It creates a restricted initial account. To flesh out the account you should use the CHANGEPROPERTIES and ADDGROUPS functions. Then use ENABLE to make the account active, if you initially created the account disabled.

Is it a local or a domain user? That depends on whether the computer you create it on is a domain controller.

Operations are broken up into a few more steps than the old CFX_UserManager, but this makes it a bit more accident tolerant.

You must specify a password of no greater than 14 characters. If your network requires it you may also allow users to be added with no passwords by simply not using the PASSWORD argument.

MustChangePassword forces the user to change their password the next time they log in.

CannotChangePassword denies a user the ability to change their passwords at all.

PasswordNeverExpires, as might be guessed, permits the user to continue on with their current password forever if they want.

AccountDisabled disables the account as it's created. Useful in some situations.





DELETE

<CFX_Users ACTION="DELETE">

OPTIONAL
Computerstring
REQUIRED
ActionDELETE
Userstring

Deletes a user. Note that even if you add a user account later on that has the same username as the old one, thier unique SID and RID identifiers WILL be different. This means file permissions granted to the deleted user can not simply be given back by recreating an account with the same name. You must re-permission all files with the new account.





COPY

<CFX_Users ACTION="COPY">

OPTIONAL
Computerstring
Descriptionstring
REQUIRED
ActionCOPY
TemplateUserstring
Userstring
Passwordstring

Have you ever used "User Manager for Domains" copy feature? Well then you know what this function does. It uses another account as a template in the creation of a new user account.

This is similiar to an ADD function in that it creates new acounts.





PROPERTIES

<CFX_Users ACTION="PROPERTIES">

FIELDS
Userstring
FullNamestring
Descriptionstring
SIDstring
RIDstring
PrimaryGroupstring
AccountTypestring
LastLogon{ts yyyy-mm-dd hh:mm:ss}|-1
LastLogoff{ts yyyy-mm-dd hh:mm:ss}|-1
CountryCodenumber
CodePagenumber
Logonsnumber
LogonFailuresnumber
PrivilegeLevelstring
LogonHoursboolean string(168)
AuthorizedComputerscsv string
AccountExpires{ts yyyy-mm-dd hh:mm:ss}|-1
MaxStoragenumber
PasswordAgedd:mm:hh:ss
ProfilePathpath string
LogonScriptfile path string
LocalPathfile path string
Connectdrive string
Topath string
Disabledboolean
MustChangePasswordboolean
UserCannotChangePasswordboolean
PasswordNeverExpiresboolean
StorePasswordUsingReversibleEncryptionboolean
SmartcardRequiredboolean
PasswordNotRequiredboolean
Lockedboolean
OPTIONAL
Domainstring
Querystring
REQUIRED
ActionPROPERTIES
Userstring

As usual, the functions in this suite try to mimic the layout of the Windows GUI to make things easier to use. The user properties function is not an exception to this little rule-of-thumb.

Some of these fields are in effect read-only, but many can be changed with the CHANGEPROPERTIES function. See below.

User of course is the name of the NT account you requested information on.

PasswordAge is the time that has passed since the password has last changed.

PrivilegeLevel will be either "Guest", "User" or "Administrator".

LogonHomeDir is the home directory of the account.

LogonScript. If present, this script is run when the user logs in. The script may either a BAT, a CMD or a 32-bit EXE.

AuthorizedComputers. This restricts the user to be able to log in to only the comma-seperated workstations named in this field. As many as eight computers may be specified. If blank then any computer may be used.

LastLogon and LastLogoff are the odbc formatted dates when the user last logged on and when they last logged off. The fields will be -1 if they have never logged in. LastLogoff will be -1 if a user is currently logged in but has not YET logged off.

AccountExpires. Yes, it's the date when the account automatically expires. -1 if the account never expires.

Logonhours is a 168 character string indicating all the hours in a week (7 days times 24 hours equals 168 hours). Each character is a boolean. If it's "0" the user can't log in during that time. If it's "1" they can. Using CHANGEPROPERTIES you can effectively make it so a user can only log in during their scheduled work hours. Very handy for anti-hacking puposes.

LogonFailures is the number of times an incorrect password has been entered for that account. If it's above 2 or 3 (or 5000) that might tend to suggest indicate someone's tying to hack into the account.

Disabled. The user account is disabled. You can use ENABLE and DISABLE to set this at will.

LocalPath, Connect and To. These define where the user's home folder (if any) is located. You can either use LocalPath to access a local hard drive or Connect and To to setup a mapped network drive to a lan share.

AccountType. NORMAL, TEMPDUPLICATE, WORKSTATIONTRUST, SERVERTRUST and INTERDOMAINTRUST. TEMPDUPLICATES are users visiting from other domains. WORKSTATIONTRUST is the account for an actual NT Workstation or NT Server computer in this domain. SERVERTRUST is the account for BDC. INTERDOMAINTRUST allows for trust betwen two domains.

SID. This is an indentifier that is unique across domains (the world). It is matched to a current user name. When that user is deleted, and a new user with the asme name is created they are given a completely new SID however. Windows NT, etc actually uses the SID internally for most security/permissions work, not the username.

RID. Relative ID. It's similiar to a SID but of use within the domain only. It's sort of your (short) SID nickname.





CHANGEPROPERTIES

<CFX_Users ACTION="CHANGEPROPERTIES">

OPTIONAL
Computerstring
FullNamestring
Descriptionstring
PrimaryGroupstring
LastLogon{ts yyyy-mm-dd hh:mm:ss}|-1
LastLogoff{ts yyyy-mm-dd hh:mm:ss}|-1
CountryCodenumber
CodePagenumber
LogonHoursboolean string(168)
AuthorizedComputerscsv string
AccountExpires{ts yyyy-mm-dd hh:mm:ss}|-1
MaxStoragenumber
ProfilePathpath string
LogonScriptfile path string
LocalPathfile path string
Connectdrive string
Topath string
MustChangePasswordboolean
UserCannotChangePasswordboolean
PasswordNeverExpiresboolean
StorePasswordUsingReversibleEncryptionboolean
SmartcardRequiredboolean
PasswordNotRequiredboolean
Lockedboolean
REQUIRED
ActionCHANGEPROPERTIES
Userstring

Changes the properties of an NT user account. Most of these fields have been discussed along with the PROPERTIES function above, so you should refer to that if you haven't already.

Note that just because the function says you can change it, doesn't mean that NT will let you. Certain combinations of fields are non-sensical to Windows and will be rejected. For instance: MustChangePassword and UserCannotChangePassword. You can't do both.





CHANGEPASSWORD

<CFX_Users ACTION="CHANGEPASSWORD">

OPTIONAL
Computerstring
REQUIRED
ActionCHANGEPASSWORD
Userstring
OldPasswordstring
NewPasswordstring

Changes a user account password from OLDPASSWORD to NEWPASSWORD. If you do not specify the the Computer then the local one is assumed.





RESETPASSWORD

<CFX_Users ACTION="RESETPASSWORD">

OPTIONAL
Computerstring
REQUIRED
ActionRESETPASSWORD
Userstring
Passwordstring

Changes a user password without having to know the old one. Dangerous when used around Administrative accounts.





BLANKPASSWORD

<CFX_Users ACTION="BLANKPASSWORD">

OPTIONAL
Computerstring
REQUIRED
ActionBLANKPASSWORD
Userstring
Passwordstring

Makes a user account have a blank password. Required to interact with some system.





ENABLE

<CFX_Users ACTION="ENABLE">

REQUIRED
ActionENABLE
Userstring
Computerstring

Enables a user account.





UNLOCK

<CFX_Users ACTION="UNLOCK">

REQUIRED
ActionUNLOCK
Userstring
Computerstring

Unlocks a system locked account.





DISABLE

<CFX_Users ACTION="DISABLE">

REQUIRED
ActionDISABLE
Userstring
Computerstring

Disables the specified user account.





ISLOGGEDIN

<CFX_Users ACTION="ISLOGGEDIN">

FIELDS
Userstring
IsLoggedInboolean
OPTIONAL
Domainstring
REQUIRED
ActionISLOGGEDIN
Userstring

Checks if specified user is currently logged into the system. Look at the IsLoggedIn field.





ISUSER

<CFX_Users ACTION="ISUSER">

FIELDS
Userstring
IsUserboolean
OPTIONAL
Domainstring
REQUIRED
ActionISUSER
Userstring

Checks if specified user exists. Look at the IsLoggedIn field.





ISVALID

<CFX_Users ACTION="ISVALID">

FIELDS
Userstring
IsValidboolean
OPTIONAL
Domainstring
REQUIRED
ActionISVALID
Userstring
Passwordstring

If you supply a user name and a password, this function will attempt to determine if the combination is valid. In other words, could someone log into the system using this username/password pair?

When the accounts are locked out or disabled, etc this will be reported as invalid.





GROUPS

<CFX_Users ACTION="GROUPS">

FIELDS
Groupstring
Mandatoryboolean
Defaultboolean
OPTIONAL
Scopestring
Domainstring
Querystring
REQUIRED
ActionGROUPS

Lists the groups the user is a member of. By default global domain groups are listed. Use SCOPE to see the other: SCOPE can be: Global or Local.





ADDGROUPS

<CFX_Users ACTION="ADDGROUPS">

OPTIONAL
Scopestring
Domainstring
Querystring
REQUIRED
ActionADDGROUPS
Userstring
Scopestring
Groupsstring

Adds a group or list of groups to a user account. The GROUPS field can be a single group or multiple groups seperated by a comma. Use SCOPE to specify if the group is "Global" or "Local".





REMOVEGROUPS

<CFX_Users ACTION="REMOVEGROUPS">

OPTIONAL
Scopestring
Domainstring
Querystring
REQUIRED
ActionREMOVEGROUPS
Userstring
Scopestring
Groupsstring

Remove a group or list of groups from a user account. The GROUPS field can be a single group or multiple groups seperated by a comma. Use SCOPE to specify if the group is "Global" or "Local".





AUTHENTICATE

<CFX_Users ACTION="AUTHENTICATE">

REQUIRED
ActionAUTHENTICATE

The term "authenticate" (or "authentication") has effectively taken on the meaning of sending your credentials (username and password) and then logging in under that account and performing some action on that user's behalf. This tag can not do authentication under that definition. It CAN however take a username and password and validate that a said username exists and whether the password is valid. This function is called "IsValid" or "Validate"

This function does nothing. So why is it included? Because people keep asking where the authentication function can be found in the documentation.

Usually what they're really wanting is the "IsValid" or "Validate" function.





VALIDATE

<CFX_Users ACTION="VALIDATE">

FIELDS
Userstring
IsValidboolean
OPTIONAL
Domainstring
REQUIRED
ActionISVALID
Userstring
Passwordstring

This function is an alias for "IsValid". It is included simply to compliment the "authentication" terminology.





top

VERSION HISTORY

[The grassy field]





top
f i n i
-{ts '2001-12-03 03:35:33'} /ihtkdocs/Users/index.cfm-