| Intranet/Hosting Toolkit | [table of contents] |
|
v2.10 January 3rd 2001 |
CFX_Users
COMMERCIAL NT DLL for Cold Fusion 4.0.1 and up Lewis A. Sellers http://www.intrafoundation.com/intranethostingtoolkit.html ihtk@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 |
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 2735 lines of code.
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.
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: " / \ [ ] : ; | = . + ? <>
| FIELDS | |
|---|---|
| User | string |
| FullName | string |
| Description | string |
| SID | string |
| OPTIONAL | |
|---|---|
| Computer | string |
| Query | string |
| REQUIRED | |
|---|---|
| Action | USERS |
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-1292428093-854245398-842925246-500. The Guest account has a SID of S-1-5-21-1292428093-854245398-842925246-501.
If Computer is not supplied then the local machine is assumed.
| FIELDS | |
|---|---|
| User | string |
| Domain | string |
| Computer | string |
| Domains | string |
| OPTIONAL | |
|---|---|
| Computer | string |
| Query | string |
| REQUIRED | |
|---|---|
| Action | CURRENTUSERS |
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.
| OPTIONAL | |
|---|---|
| Computer | string |
| Password | string |
| MustChangePasword | boolean |
| CannotChangePassword | boolean |
| PasswordNeverExpires | boolean |
| AccountDisabled | boolean |
| REQUIRED | |
|---|---|
| Action | ADD |
| User | string |
| Fullname | string |
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.
| OPTIONAL | |
|---|---|
| Computer | string |
| REQUIRED | |
|---|---|
| Action | DELETE |
| User | string |
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.
| OPTIONAL | |
|---|---|
| Computer | string |
| Description | string |
| REQUIRED | |
|---|---|
| Action | COPY |
| TemplateUser | string |
| User | string |
| Password | string |
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.
| FIELDS | |
|---|---|
| User | string |
| FullName | string |
| Description | string |
| SID | string |
| RID | string |
| PrimaryGroup | string |
| AccountType | string |
| LastLogon | {ts yyyy-mm-dd hh:mm:ss}|-1 |
| LastLogoff | {ts yyyy-mm-dd hh:mm:ss}|-1 |
| CountryCode | number |
| CodePage | number |
| Logons | number |
| LogonFailures | number |
| PrivilegeLevel | string |
| LogonHours | boolean string(168) |
| AuthorizedComputers | csv string |
| AccountExpires | {ts yyyy-mm-dd hh:mm:ss}|-1 |
| MaxStorage | number |
| PasswordAge | dd:mm:hh:ss |
| ProfilePath | path string |
| LogonScript | file path string |
| LocalPath | file path string |
| Connect | drive string |
| To | path string |
| Disabled | boolean |
| MustChangePassword | boolean |
| UserCannotChangePassword | boolean |
| PasswordNeverExpires | boolean |
| StorePasswordUsingReversibleEncryption | boolean |
| SmartcardRequired | boolean |
| PasswordNotRequired | boolean |
| Locked | boolean |
| OPTIONAL | |
|---|---|
| Domain | string |
| Query | string |
| REQUIRED | |
|---|---|
| Action | PROPERTIES |
| User | string |
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.
| OPTIONAL | |
|---|---|
| Computer | string |
| FullName | string |
| Description | string |
| PrimaryGroup | string |
| LastLogon | {ts yyyy-mm-dd hh:mm:ss}|-1 |
| LastLogoff | {ts yyyy-mm-dd hh:mm:ss}|-1 |
| CountryCode | number |
| CodePage | number |
| LogonHours | boolean string(168) |
| AuthorizedComputers | csv string |
| AccountExpires | {ts yyyy-mm-dd hh:mm:ss}|-1 |
| MaxStorage | number |
| ProfilePath | path string |
| LogonScript | file path string |
| LocalPath | file path string |
| Connect | drive string |
| To | path string |
| MustChangePassword | boolean |
| UserCannotChangePassword | boolean |
| PasswordNeverExpires | boolean |
| StorePasswordUsingReversibleEncryption | boolean |
| SmartcardRequired | boolean |
| PasswordNotRequired | boolean |
| Locked | boolean |
| REQUIRED | |
|---|---|
| Action | CHANGEPROPERTIES |
| User | string |
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.
| OPTIONAL | |
|---|---|
| Computer | string |
| REQUIRED | |
|---|---|
| Action | CHANGEPASSWORD |
| User | string |
| OldPassword | string |
| NewPassword | string |
Changes a user account password from OLDPASSWORD to NEWPASSWORD. If you do not specify the the Computer then the local one is assumed.
| OPTIONAL | |
|---|---|
| Computer | string |
| REQUIRED | |
|---|---|
| Action | RESETPASSWORD |
| User | string |
| Password | string |
Changes a user password without having to know the old one. Dangerous when used around Administrative accounts.
| OPTIONAL | |
|---|---|
| Computer | string |
| REQUIRED | |
|---|---|
| Action | BLANKPASSWORD |
| User | string |
| Password | string |
Makes a user account have a blank password. Required to interact with some system.
| REQUIRED | |
|---|---|
| Action | ENABLE |
| User | string |
| Computer | string |
Enables a user account.
| REQUIRED | |
|---|---|
| Action | UNLOCK |
| User | string |
| Computer | string |
Unlocks a system locked account.
| REQUIRED | |
|---|---|
| Action | DISABLE |
| User | string |
| Computer | string |
Disables the specified user account.
| FIELDS | |
|---|---|
| User | string |
| IsLoggedIn | boolean |
| OPTIONAL | |
|---|---|
| Domain | string |
| REQUIRED | |
|---|---|
| Action | ISLOGGEDIN |
| User | string |
Checks if specified user is currently logged into the system. Look at the IsLoggedIn field.
| FIELDS | |
|---|---|
| User | string |
| IsUser | boolean |
| OPTIONAL | |
|---|---|
| Domain | string |
| REQUIRED | |
|---|---|
| Action | ISUSER |
| User | string |
Checks if specified user exists. Look at the IsLoggedIn field.
| FIELDS | |
|---|---|
| User | string |
| IsValid | boolean |
| OPTIONAL | |
|---|---|
| Domain | string |
| REQUIRED | |
|---|---|
| Action | ISVALID |
| User | string |
| Password | string |
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.
| FIELDS | |
|---|---|
| Group | string |
| Mandatory | boolean |
| Default | boolean |
| OPTIONAL | |
|---|---|
| Scope | string |
| Domain | string |
| Query | string |
| REQUIRED | |
|---|---|
| Action | GROUPS |
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.
| OPTIONAL | |
|---|---|
| Scope | string |
| Domain | string |
| Query | string |
| REQUIRED | |
|---|---|
| Action | ADDGROUPS |
| User | string |
| Scope | string |
| Groups | string |
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".
| OPTIONAL | |
|---|---|
| Scope | string |
| Domain | string |
| Query | string |
| REQUIRED | |
|---|---|
| Action | REMOVEGROUPS |
| User | string |
| Scope | string |
| Groups | string |
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".
| REQUIRED | |
|---|---|
| Action | AUTHENTICATE |
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.
| FIELDS | |
|---|---|
| User | string |
| IsValid | boolean |
| OPTIONAL | |
|---|---|
| Domain | string |
| REQUIRED | |
|---|---|
| Action | ISVALID |
| User | string |
| Password | string |
This function is an alias for "IsValid". It is included simply to compliment the "authentication" terminology.
Added IHTKPASSWORD. Upgraded reporting code.
Upgraded error reporting code to v1.2.
NEW TAG: CFX_Users. CFX_UserManager is obsoleted. Split it into two. User functions are moved here (group functions move into CFX_Groups and rest is taken over by CFX_NetworkTopology ). This tag is rather different than the older CFX_UserManager, though it takes freely from it's old code base.
Be aware that this new tag hasn't had a chance to settle in the field. Triple-check your results if you're doing anything 'exotic'.
If there's something that been forgotten or misdocumented, email and then check the next release.
No doubt there will be a 2.1 in a few weeks to squash any remaining bugs. Should have spent another week or two debugging, but been working on this off and on for a couple months and just wanted to get it done and out of the way at the moment. If there's a problem -- just tell me.
There have been many additional changes, including, but not limited to:
Yes if you bought a copy back with version 1.x you get free 2.x upgrades (whether you want them or not).
Sorry about the long delay between 1.12 and 2.0. The work was a lot more involved than anticpiated.
Big thanks to Felix Kasza at mvps.org for all the useful reference material (I was going back to their site so much this week I finally just said "what the hell" and had a program make a mirror copy of their website which I then burned to cdr). The Microsoft API docs straight-out lie in many places and there seem to be very few places or people who know how to work around these API issues.
NOTE: 2.0beta brought to you a THINK! power bar. Better than heroin. :-) There have been several betas (2.0beta1, 2.0beta2, 2.0beta3 and 2.0beta4, etc). Beta3 and up were public. Beta4 was the first wide-beta. Beta5 was the last beta before the final (almost). Beta6 actually was the last.