I've almost got Radmin adding new users to my shadow password file. My perl is
pretty basic. Following is the function being used to add the users.

My first problem is that useradd is not working. How can I display the error
message from useradd?

The second problem is that chpasswd takes its input on STDIN. Is the code
below (currently commented out) correct to do this?

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}`
             || fatalError("UserAddError");
        # Set up their password, you may need a
        # special program for this so you can send the password
        # on the command line
#        `/usr/sbin/chpasswd` < $obj->{USERNAME} $obj->{PASS_WORD}
#            || fatalError("Could not set new password in Unix");
    }
    &$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