I have written a bit of perl code to allow Radmin to add new users to my
shadow password file when a new user is added using Radmin. Now I need to
write a bit of code to allow the shadow password to be changed when a password
is changed using Radmin. Could anyone tell me how to go about this?

The code to allow users to be added to the shadow password file as well as the
Radmin database follows.

Regards.  Paul

# Heres an example of how to override the database insertion function
# so that when you add a new user, it automatically
# adds them to your Unix system too:

BEGIN

    # Remember pointers to functions we are going to override
    $Radmin::Site::original_insert = \&Radmin::DBSQL::insert;


sub Radmin::DBSQL::insert

    my ($self, $obj) = @_;

    if ($obj->{Type} eq 'RADUSERS')
    {
        # Adding a new entry to the user list
        `/usr/sbin/useradd -c \"$obj->{FULLNAME}\" $obj->{USERNAME}`
             ;
        #
        # Set up the new users password
        #
        open(CHANGEPASSWORD,"|/usr/sbin/chpasswd");
        print CHANGEPASSWORD "$obj->{USERNAME}:$obj->{PASS_WORD}\n";
        close(CHANGEPASSWORD);

        #
        # Set the user to trial group and no login shell
        #
        `/usr/sbin/usermod -g trial -s /usr/local/bin/noshell
$obj->{USERNAME}`
    }
    &$Radmin::Site::original_insert($self, $obj);

===
Archive at http://www.thesite.com.au/~radiator/
To unsubscribe, email '[EMAIL PROTECTED]' with
'unsubscribe radiator' in the body of the message.

Reply via email to