About a year ago I added a function to the Site.pm file to allow a user to be
added to the shadow password file when the user was added using the Radmin
interface (which adds the users details to a MySQL DB). The problem is,
sometime in the last few months, the function to add the user to ther shadow
password file has stopped working. As far as I can see the code is not being
executed. I'd appreciated some guidance on how to sort this pronlem out.
Following is the function to add the user to the shadow password file:

# You can add or override Radmin functions here like this
# sub Radmin::Util::formatDateTime {
# Your stuff here
# }

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

sub Radmin::DBSQL::insert
{
    my ($self, $obj) = @_;

    `/usr/bin/logger \"Radmin Insert Called\"`;
    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);
}

1;


===
Archive at http://www.starport.net/~radiator/
Announcements on [EMAIL PROTECTED]
To unsubscribe, email '[EMAIL PROTECTED]' with
'unsubscribe radiator' in the body of the message.

Reply via email to