|
From: Todd K. <tod...@gm...> - 2008-06-04 13:53:41
|
Yeah it suppose to be replacing a valid user. I made a few changes to
the script since the other day. Basically I removed all the code for
delete the user from other modules "wasn't needed since I'm not
deleting the user". Now it doesn't add that bogus line in the
/etc/passwd and shadow file but it still is not working.
I'll have to keep digging.
On Tue, Jun 3, 2008 at 4:20 PM, Jamie Cameron <jca...@we...> wrote:
> I was referring to that ::::: line in /etc/passwd. Is it replacing
> some valid user, or just being appended?
>
> - Jamie
>
>
> On Jun 3, 2008, at 12:04 PM, "Todd Kennedy" <tod...@gm...> wrote:
>
>> I'm not sure I'm following you? In the code you mean? What line #?
>>
>> On Tue, Jun 3, 2008 at 2:30 PM, Jamie Cameron <jca...@we...>
>> wrote:
>>> I had a look at your code, and it seems reasonable to me..
>>>
>>> Is that extra bogus line just being added, or is it replacing some
>>> other user?
>>>
>>> - Jamie
>>>
>>> On 03/Jun/2008 06:28 Todd Kennedy wrote ..
>>>> Hi Jamie,
>>>>
>>>> Thanks for replying to my post. I still can't figure out whats going
>>>> on. I've defined %user hash but to no avail I cannot seem to locate
>>>> the issue. I've attached my recycle_users.cgi. If you could briefly
>>>> review it that would be great. I also welcome any pointers and
>>>> constructive criticism.
>>>>
>>>> Thanks
>>>>
>>>> -Todd
>>>>
>>>> On Mon, Jun 2, 2008 at 5:04 PM, Jamie Cameron
>>>> <jca...@we...> wrote:
>>>>> Hi Todd,
>>>>>
>>>>> Make sure that in your code, you aren't calling modify_user with an
>>>>> empty user hash. It looks like that is the case, as this would
>>>>> cause
>>>>> an 'empty' line like that to be inserted into /etc/passwd.
>>>>>
>>>>> I'd have to see all your code to comment further though..
>>>>>
>>>>> - Jamie
>>>>>
>>>>> On 02/Jun/2008 12:11 Todd Kennedy wrote ..
>>>>>> Hello,
>>>>>>
>>>>>> I am new to webmin module development and am trying to extend
>>>>>> the "Users
>>>>>> & Groups" module for internal purposes. What I have done is
>>>>>> create a
>>>>>> "Recycle User" button on the selected users "Edit Users" page that
>>>>>> basically mimics the functionality of the delete_user.cgi (without
>>>>>> actually deleting the user) but also extends it by showing me a
>>>>>> list of
>>>>>> currently selected user processes running. Once I press the
>>>>>> "Recycle
>>>>>> user and home directory button" it goes off and first terminates
>>>>>> those
>>>>>> running processes then removes the users home directory then I
>>>>>> need to
>>>>>> reset the users password back to some default. I am about 90% of
>>>>>> the way
>>>>>> there but seem to be caught up on the saving of the modified
>>>>>> password. I
>>>>>> am using the modify_user function. Whats actually happening is
>>>>>> that it's
>>>>>> leaving an incomplete line in the /etc/password and shadow file
>>>>>> looking
>>>>>> something like this:
>>>>>>
>>>>>> svctag:*LK*:6445::::::
>>>>>> nobody:*LK*:6445::::::
>>>>>> noaccess:*LK*:6445::::::
>>>>>> nobody4:*LK*:6445::::::
>>>>>> ::::::::
>>>>>>
>>>>>> This last line should be the entry that I recycled but it's just
>>>>>> a bunch
>>>>>> of empty GECOS fields. So it seems to me that it's rewriting the
>>>>>> line
>>>>>> but is doing it with empty values.
>>>>>>
>>>>>> So I think I am missing something somewhere but am unsure what
>>>>>> other
>>>>>> functions possibly I need to call in order for it to write out the
>>>>>> password file. I'm assuming the modify_user function takes care
>>>>>> of that, no?
>>>>>>
>>>>>>
>>>>>> This does seem like a strange thing to do but would fit nicely
>>>>>> into
>>>>>> managing test accounts for may lab machines. When the lab
>>>>>> reservation
>>>>>> expires the admin can recycle the user with a press of the
>>>>>> button and
>>>>>> set it back to some default settings.
>>>>>>
>>>>>> Here's the snippet of code that is suppose to be resetting the
>>>>>> password
>>>>>> and saving it.
>>>>>>
>>>>>> %recycleuser = %{$ulist[$in{'num'}]};
>>>>>> $pass = &encrypt_password($config{'recycle_passwd'});
>>>>>> $recycleuser{'pass'} = $pass;
>>>>>>
>>>>>> # Update user details
>>>>>> &modify_user(\%recycleuser, \%user);
>>>>>>
>>>>>> # Run the pre-change command
>>>>>> $merr = &making_changes();
>>>>>> &error(&text('usave_emaking', "<tt>$merr</tt>")) if (defined
>>>>>> ($merr));
>>>>>> &unlock_user_files();
>>>>>> &made_changes();
>>>>>>
>>>>>> So as the code runs the following is displayed in the borwser,
>>>>>> The has
>>>>>> info is there for debugging purposes.
>>>>>>
>>>>>> Deleting from other modules ..
>>>>>> .. done
>>>>>> Killing user processes
>>>>>> .. done
>>>>>>
>>>>>> Deleting home directory ..
>>>>>> .. done
>>>>>>
>>>>>> Creating Home Directory
>>>>>> .. done
>>>>>>
>>>>>> new encrypted passwd=TN4xb4vuWbxc6
>>>>>>
>>>>>> Contents of recycleuser Hash prior to change
>>>>>>
>>>>>> num => 20
>>>>>>
>>>>>> inactive =>
>>>>>>
>>>>>> max =>
>>>>>>
>>>>>> warn =>
>>>>>>
>>>>>> user => testuser
>>>>>>
>>>>>> shell => /bin/sh
>>>>>>
>>>>>> home => /export/home/testuser
>>>>>>
>>>>>> real =>
>>>>>>
>>>>>> line => 20
>>>>>>
>>>>>> pass => NNwEdL/U3qYwU
>>>>>>
>>>>>> sline => 20
>>>>>>
>>>>>> uid => 1000
>>>>>>
>>>>>> change => 14032
>>>>>>
>>>>>> min =>
>>>>>>
>>>>>> expire =>
>>>>>>
>>>>>> gid => 10
>>>>>>
>>>>>>
>>>>>> Contents of User hash after replacing $pass but before saving
>>>>>>
>>>>>> num => 20
>>>>>>
>>>>>> inactive =>
>>>>>>
>>>>>> max =>
>>>>>>
>>>>>> warn =>
>>>>>>
>>>>>> user => testuser
>>>>>>
>>>>>> shell => /bin/sh
>>>>>>
>>>>>> home => /export/home/testuser
>>>>>>
>>>>>> real =>
>>>>>>
>>>>>> line => 20
>>>>>>
>>>>>> pass => TN4xb4vuWbxc6
>>>>>>
>>>>>> sline => 20
>>>>>>
>>>>>> uid => 1000
>>>>>>
>>>>>> change => 14032
>>>>>>
>>>>>> min =>
>>>>>>
>>>>>> expire =>
>>>>>>
>>>>>> gid => 10
>>>>>>
>>>>>>
>>>>>> Reread the %ulist has for the user "Still has the old password"
>>>>>>
>>>>>> num => 20
>>>>>>
>>>>>> inactive =>
>>>>>>
>>>>>> max =>
>>>>>>
>>>>>> warn =>
>>>>>>
>>>>>> user => testuser
>>>>>>
>>>>>> shell => /bin/sh
>>>>>>
>>>>>> home => /export/home/testuser
>>>>>>
>>>>>> real =>
>>>>>>
>>>>>> line => 20
>>>>>>
>>>>>> pass => NNwEdL/U3qYwU
>>>>>>
>>>>>> sline => 20
>>>>>>
>>>>>> uid => 1000
>>>>>>
>>>>>> change => 14032
>>>>>>
>>>>>> min =>
>>>>>>
>>>>>> expire =>
>>>>>>
>>>>>> gid => 10
>>>>>>
>>>>>>
>>>>>> Any help on this would be much appriciated.
>>>>>
>>>>> ---
>>>>> ---
>>>>> -------------------------------------------------------------------
>>>>> This SF.net email is sponsored by: Microsoft
>>>>> Defy all challenges. Microsoft(R) Visual Studio 2008.
>>>>> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
>>>>> -
>>>>> Forwarded by the Webmin development list at web...@we...
>>>>> To remove yourself from this list, go to
>>>>> http://lists.sourceforge.net/lists/listinfo/webadmin-devel
>>>>>
>>>
>>> ---
>>> ---
>>> -------------------------------------------------------------------
>>> This SF.net email is sponsored by: Microsoft
>>> Defy all challenges. Microsoft(R) Visual Studio 2008.
>>> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
>>> -
>>> Forwarded by the Webmin development list at web...@we...
>>> To remove yourself from this list, go to
>>> http://lists.sourceforge.net/lists/listinfo/webadmin-devel
>>>
>>
>> ---
>> ----------------------------------------------------------------------
>> This SF.net email is sponsored by: Microsoft
>> Defy all challenges. Microsoft(R) Visual Studio 2008.
>> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
>> -
>> Forwarded by the Webmin development list at web...@we...
>> To remove yourself from this list, go to
>> http://lists.sourceforge.net/lists/listinfo/webadmin-devel
>>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> -
> Forwarded by the Webmin development list at web...@we...
> To remove yourself from this list, go to
> http://lists.sourceforge.net/lists/listinfo/webadmin-devel
>
|