Procedure Model
Type: ( )Web Page ( )CGI Script ( )Shared Library (X)System API
Name: sys/add_alias
Assigned to:
Reference:
|
Description
|
This system configuration function reads the system /etc/mail/aliases file, checks that no current entry matching old_address exists and if one does exist, deletes it. It then adds a new entry mapping old_address to new_address and rebuilds the newaliases database. The function must NOT be allowed to alter any of the system aliases. Because editing the aliases file and rebuilding new alias databases are protected procedures, this function will need suid permissions.
|
Implementation Skills
|
PERL, C
|
Parameter List
|
old_address and new_address where old_address is the address to which mail is sent and new_address is the address to which mail is delivered.
|
Called By:
|
vol/listapps.cgi
vol/listupgrades.cgi
|
Can Call:
|
/usr/bin/newaliases
/etc/aliases
log/csuite
|
Function Description
|
-
Open the /etc/aliases file for reading and check whether any existing mapping from old_address exists. If this mapping exists, verify whether it exists above the lines marked:
##############################################
## Lines below this line are managed by the ##
## /usr/local/csuite/sys/add_alias command. ##
## Do NOT edit aliases below this line. ##
-
If the mapping exists above this section, return a –1 error. The mapping is a system mapping and cannot be altered by this script.
-
If the mapping exists below the commented section, delete the entry from the /etc/aliases file. Enter the details of this deletion in the csuite log file.
-
Add a new entry to the /etc/aliases file, inserting the entry alphabetically after the above comment section. The new entry should have the form:
<old_address>: <tab><new_address>
-
Enter the details of this insertion in the csuite log file.
-
Run the /usr/bin/newaliases command to recompile a new aliases database.
|
Possible Exit Conditions and Return Values
|
-
If the user or system is attempting to create or replace a system alias, the function returns a –1.
-
If the alias is successfully created or replaced, the function returns a 0.
|
Sign Off by:
|
Project Manager
|