Shared Library Procedures

lib/uname_test.pl

Procedure Model

Type:    (  )Web Page              (  )CGI Script              (X)Shared Library      (  )System API

Name: lib/uname_test.pl

Assigned to:

Reference:

Description

This script verifies that a username passed as a string to the function would be a good username. The test of goodness requires that the proposed username is unique to the system (i.e. no existing user has this name), and that the username is comprised of only alphabetic characters, numbers, underscores and dots (period), and that the username is between 4 and 16 characters long. For the purpose of the test, uppercase and lowercase characters are equivalent so that if the user has chosen a username of upper-case characters, these characters will be replaced with their lower-case equivalents.

Implementation Skills

PERL

Parameter List

String containing the proposed username

Called By:

user/validate.cgi
user/upgrade.cgi
lib/uname_generate.pl

Can Call:

 

Function Description

Verify the appropriateness and uniqueness of the proposed username by performing the following steps:

  1. Check that the username is between 4 and 16 characters in length and contains only characters, digits, underscores and dots (periods). If it fails this test, exit this function and return an appropriate error description.
  2. Convert the proposed username to all lowercase letters.
  3. Check that the username is unique within the system. If this test fails, exit the function and return an appropriate error description. This test of uniqueness is met if:
  • There is no existing entry in the /etc/password file with the same username
  • There is no existing entry in the /etc/mail/aliases file such that the proposed username was a previous system username that has since been remapped to a new username.
  • There is no other entry in the User table or Member table with this username such that the same username is in a pending state awaiting another user’s agreement or remittance.
  1. Return a null length string if the proposed username is acceptable to the system.

Possible Exit Conditions and Return Values

  1. If the username is not appropriate, a descriptive error message is returned as a scalar variable.
  2. If the username is appropriate, the function returns a null length string.

Sign Off by:

Project Manager.