From: Todd K. <tod...@or...> - 2008-06-02 19:13:19
|
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. |
From: Jamie C. <jca...@we...> - 2008-06-02 21:04:10
|
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. |
From: Todd K. <tod...@gm...> - 2008-06-03 13:28:54
Attachments:
recycle_user.cgi.txt
|
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 > |
From: Jamie C. <jca...@we...> - 2008-06-03 18:30:11
|
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 > > |
From: Todd K. <tod...@gm...> - 2008-06-03 19:04:09
|
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 > |
From: Jamie C. <jca...@we...> - 2008-06-03 20:20:56
|
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 > |
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 > |
From: Todd K. <tod...@gm...> - 2008-06-13 17:01:29
|
Hi Jamie, One question. If I am resetting the password and I am encrypting it like so: $pass = &encrypt_password($config{'recycle_passwd'}); $recycleuser{'pass'} = $pass; and then I am calling modify_user like so &modify_user(\%recycleuser, \%user); Is the hash key 'pass' what I should be using to reset the password if I'm doing the encryption outside of the modify_user function or should I be using something else? 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 > |
From: Jamie C. <jca...@we...> - 2008-06-13 17:13:48
|
That code looks fine to me - is it doing what you expect? - Jamie On Jun 13, 2008, at 10:01 AM, "Todd Kennedy" <tod...@gm...> wrote: > Hi Jamie, > > One question. If I am resetting the password and I am encrypting it > like so: > > $pass = &encrypt_password($config{'recycle_passwd'}); > $recycleuser{'pass'} = $pass; > > and then I am calling modify_user like so > > &modify_user(\%recycleuser, \%user); > > Is the hash key 'pass' what I should be using to reset the password if > I'm doing the encryption outside of the modify_user function or should > I be using something else? > > > 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 >> > > --- > ---------------------------------------------------------------------- > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > http://sourceforge.net/services/buy/index.php > - > 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 > |
From: Todd K. <tod...@gm...> - 2008-06-13 17:26:17
|
I figured it out. I was passing the hashes in the wrong order. I had this: &modify_user(\%recycleuser, \%user); but it should be this: >> &modify_user(\%user, \%recycleuser); A small over site on my part. Thats for taking the time to look at it. Now that I have some Webmin coding under my belt I might try some other stuff like writing a module for Solaris Jumpstart "JET" Thanks for the help. On Fri, Jun 13, 2008 at 1:13 PM, Jamie Cameron <jca...@we...> wrote: > That code looks fine to me - is it doing what you expect? > > - Jamie > > > On Jun 13, 2008, at 10:01 AM, "Todd Kennedy" <tod...@gm...> wrote: > >> Hi Jamie, >> >> One question. If I am resetting the password and I am encrypting it >> like so: >> >> $pass = &encrypt_password($config{'recycle_passwd'}); >> $recycleuser{'pass'} = $pass; >> >> and then I am calling modify_user like so >> >> &modify_user(\%recycleuser, \%user); >> >> Is the hash key 'pass' what I should be using to reset the password if >> I'm doing the encryption outside of the modify_user function or should >> I be using something else? >> >> >> 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 >>> >> >> --- >> ---------------------------------------------------------------------- >> Check out the new SourceForge.net Marketplace. >> It's the best place to buy or sell services for >> just about anything Open Source. >> http://sourceforge.net/services/buy/index.php >> - >> 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 >> > > ------------------------------------------------------------------------- > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > http://sourceforge.net/services/buy/index.php > - > 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 > |