2 #####################################################################
4 # Ganymede Password Changer
6 # This script is used to process the form in
9 # This script accepts a username, old password, new
10 # password and verified new password, then passes them
11 # to xmlclient, which attempts to change the Ganymede
12 # password for user from the old_pass to new_pass
14 #####################################################################
17 # add this for errors!!!
18 use CGI
::Carp qw
/fatalsToBrowser/;
20 #####################################################################
25 $pass_advice = "<table><td>
26 <p>Characteristics of good passwords:</p>
29 <li>easy to remember</li>
30 <li>$minlength characters long</li>
31 <li>not easily generated from a dictionary</li>
32 <li>contain at least one numeric, whitespace, or punctuation character</li>
33 <li>contain both uppercase and lowercase letters</li>
37 # create the query with whatever CGI info we get from our environment
40 $my_url = $query->url();
41 $xml_path = "<#XMLPATH#>";
42 $xmlclient = $xml_path . "/xmlclient";
44 # Yes, the software is smarter than you, if you didn't include bin
45 # when installWeb asked you for the location of the client utils.
48 $xmlclient = $xml_path . "/bin/xmlclient";
51 # If this script is run from a different location from where the
52 # image files for the HTML result pages are located, the variable
53 # $web_loc must be changed to an HTTP path to the image files
57 # write out the CGI header
64 <title>Ganymede Password Changer</title>
67 # Print Javascript basic form checker
73 <body bgcolor="#FFFFFF">
77 print "<center><p>Error, can't find xmlclient</p></center>\n";
79 print $query->end_html;
84 $user = $query->param('user');
85 $old_pass = $query->param('old_pass');
86 $new_pass = $query->param('new_pass');
87 $verify = $query->param('verify');
89 if ($new_pass eq $verify) {
91 $xml_output = `$xmlclient $filename 2>&1`;
92 $xml_status = $?
>> 8;
93 if (($xml_status == 0)) {
97 # we need to make an error message more clear
98 if ($xml_output =~ /It is based on the dictionary word ([^.]*)/) {
101 if ($word eq $user) {
102 $xml_output = "The new password you proposed was based on your username. You must choose a password that can not be easily guessed from your account's name.";
104 $xml_output = "The new password you proposed can be derived from the word '$1', so is too easily guessable by password cracking programs.\n\nPlease choose again.";
108 } elsif ($xml_output =~ /is too short/) {
109 $xml_output = "The new password you proposed is too short.\nPick a password that is at least 6 characters long.";
112 } elsif ($xml_output =~ /simplistic/) {
113 $xml_output = "The new password you proposed follows too predictable a pattern.\n\nPlease try to pick a more random password.";
116 } elsif ($xml_output =~ /DIFFERENT/) {
117 $xml_output = "The new password you proposed does not contain enough different characters.\n\nPlease try to pick a more complex password.";
120 } elsif ($xml_output =~ /used too recently/ && $xml_output =~ /last used with this account at ([^.]*)/) {
121 $xml_output = "The new password you proposed was used for this account at $1.\n\nYou must choose a password that has not been used in conjunction with this account recently.";
124 } elsif ($xml_output =~ /It is based on your username/) {
125 $xml_output = "The new password you proposed was based on your username.\n\nYou must choose a password that can not be easily guessed from your account's name.";
128 } elsif ($xml_output =~ /punctuation/) {
129 $xml_output = "Passwords must have at least one numeric, whitespace, or punctuation character.";
132 } elsif ($xml_output =~ /It needs to be mixed case/) {
133 $xml_output = "Passwords must have at least one upper case and at least one lower case letter.";
136 } elsif ($xml_output =~ /contains an unacceptable character \('([^'])'\)/) {
137 $xml_output = "The new password you proposed contains an unacceptable character: $1\n\nPlease try again.";
140 } elsif ($xml_output =~ /semaphore disabled/) {
141 # Couldn't login to server... the server is going down for some reason?
142 # Can't login to the Ganymede server.. semaphore disabled: schema edit
143 # Error, couldn't log in to server.. bad username or password?
145 # XML submission failed.
147 $xml_output = "The Ganymede server is not currently accepting logins.\nPlease try again later.";
148 } elsif ($xml_output =~ /bad username/) {
149 # Couldn't login to server... bad username/password?
150 # Error, couldn't log in to server.. bad username or password?
151 # XML submission failed.
153 $xml_output = "You did not enter your current username and/or password correctly.\n\nPlease try again.";
156 print_failure
($xml_output);
162 unlink $filename; #remove temp xml file
168 print $query->end_html;
171 ######################################################################
175 ######################################################################
178 # we want a really random filename
180 $randnum = int(rand 4096);
182 $filename = "$tmpdir/ganypass.$randnum.$$.xml"; #give temp xml file random name
184 $old_pass =~ s/&/&/g; #parse passwords for " and &, replace with xml equivalents
185 $new_pass =~ s/&/&/g;
186 $old_pass =~ s/\"/"/g;
187 $new_pass =~ s/\"/"/g;
188 $old_pass =~ s/</</g;
189 $new_pass =~ s/</</g;
190 $old_pass =~ s/>/>/g;
191 $new_pass =~ s/>/>/g;
194 die "Error, $filename already exists!";
197 open(XMLF
, ">$filename") || die "Couldn't write to $filename";
198 chmod 0600, $filename;
202 <ganymede major="1" minor="0" persona="$user" password="$old_pass">
204 <object type="User" id="$user">
205 <Password><password plaintext="$new_pass"/></Password>
212 chmod 0600, $filename;
216 ######################################################################
220 ######################################################################
228 <a href="http://www.arlut.utexas.edu/gash2/"><img src="$web_loc/ganymede_title2_sm.gif" border="0"></a>
230 <td width="100%" align="center">
231 <h1>Ganymede Password Changing Utility</h1>
235 If you want a link to your home page, uncomment this and tweak
239 <a href="/"><img src="$web_loc/arlbw.jpg" border="0"></a>
247 <a href="http://www.arlut.utexas.edu/gash2/"><small>[Ganymede Home]</small></a>
249 <td width="100%" align="center">
250 <small>[Click <a href="$web_loc/index.html" target="_top">here</a>
251 to go directly to the Ganymede login page]</small>
256 If you want a link to your home page, uncomment this and tweak
260 <a href="http://www.arlut.utexas.edu/"><small>[ARL:UT Home]</small></a>
269 <table border="0" width="60%">
276 You need to change this as well, of course
280 <p>This form changes your user password for Ganymede and all network
281 services managed by Ganymede at ARL:UT.</p>
285 <p>All use of this form is logged, and you will receive email from Ganymede
286 notifying you of the success of your password change request.</p>
299 ######################################################################
303 ######################################################################
307 $minstrlen = length("$minlength");
308 $semispaces = " " . (" " x
$minstrlen);
309 $spaces = (" " x
$minstrlen) . $semispaces;
312 <script type="text/javascript">
313 var minlen = $minlength;
315 function create_limiteron(formName, elementName) {
318 var len1 = document.getElementById(formName).value.length;
321 document.getElementById(elementName).innerHTML = len1 + "$semispaces";
324 if (len1 < 10 && minlen >= 10) {
325 document.getElementById(elementName).innerHTML = " " + len1 + " / " + minlen;
327 document.getElementById(elementName).innerHTML = len1 + " / " + minlen;
333 function create_limiteroff(elementName) {
336 document.getElementById(elementName).innerHTML = "$spaces";
340 var limiter = create_limiteron("new_pass", "counter");
341 var limiterOff = create_limiteroff("counter");
342 var limiter2 = create_limiteron("verify", "counter2");
343 var limiterOff2 = create_limiteroff("counter2");
348 <form method="post" action="$my_url" name="former">
349 <table width="60%" bgcolor="#ccffcc" border="1" cellpadding="2">
350 <tr bgcolor="#663366">
351 <td colspan="2" align="center">
352 <big><font color="ffffcc">Ganymede Password Changer</font></big>
357 <td align="right"><b>Username?</b></td>
358 <td><input type="text" name="user"></td>
362 <td align=right><b>Old Password?</b></td>
363 <td><input type="password" name="old_pass"></td>
367 <td align=right><b>New Password?</b> </td>
368 <td><input type="password" id="new_pass" name="new_pass" onKeyDown=limiter() onKeyUp=limiter() onFocus=limiter() onBlur=limiterOff()>
369 <pre style="display:inline"><div id="counter" style=display:inline>$spaces</div></pre> </td>
373 <td align=right><b>Verify New Password</b></td>
374 <td><input type="password" id="verify" name="verify" onKeyDown=limiter2() onKeyUp=limiter2() onFocus=limiter2() onBlur=limiterOff2()>
375 <pre style="display:inline"><div id="counter2" style=display:inline>$spaces</div></pre> </td>
379 <td colspan="2" align="center"><input type="button" value="submit" onClick="VerifyForm(document.former)"></td>
382 <tr bgcolor="#663366">
383 <td colspan="2"> </td>
393 ######################################################################
397 ######################################################################
404 <a href="http://www.arlut.utexas.edu/gash2/"><img src="$web_loc/ganymede_title2_sm.gif" border="0"></a>
406 <td width="100%" align="center">
407 <h1>Password Changed Successfully</h1>
410 <a href="/"><img src="/graphics/arlbw.jpg" border="0"></a>
416 <a href="http://www.arlut.utexas.edu/gash2/"><small>[Ganymede Home]</small></a>
418 <td width="100%" align="center">
419 <small>[Click <a href="$web_loc/index.html" target="_top">here</a> to go directly to the Ganymede login page]</small>
422 <a href="/"><small>[ARL:UT Home]</small></a>
427 <hr noshade="noshade"/>
430 <table border="0" width="60%">
433 <p>Ganymede has accepted your password change
434 request, and is currently working to propagate your changed password
435 information into the network. It may take a few minutes for your new
436 password to take effect everywhere.</p>
438 <p>As additional confirmation, in a few moments you will receive a
439 mail message from Ganymede describing the change to your
449 <table width="60%" bgcolor="#ccffcc" border="1" cellpadding="2">
450 <tr bgcolor="#663366">
451 <td colspan="2" align="center">
452 <big><font color="ffffcc">Ganymede Password Changer</font></big>
456 <tr><td colspan="2"><br/></td></tr>
458 <tr><td colspan="2" align="center">Time: $time</td></tr>
460 <tr><td colspan="2"><br/></td></tr>
462 <tr><td colspan="2" align="center">Password change request processed for user $user</td></tr>
464 <tr><td colspan="2"><br/></td></tr>
466 <tr bgcolor="663366">
467 <td colspan="2"> </td>
475 ######################################################################
479 ######################################################################
484 $failure =~ s/</</g;
485 $failure =~ s/>/>/g;
488 $about_mess = "<p>If your current password was not entered properly, you may receive
489 mail from Ganymede reporting a failure to login. This is normal, and
490 is simply letting you know that someone unsuccessfully attempted to
491 make a change in Ganymede on your behalf.</p>";
493 $about_mess = $pass_advice;
500 <a href="http://www.arlut.utexas.edu/gash2/"><img src="$web_loc/ganymede_title2_sm.gif" border="0"/></a>
502 <td width="100%" align="center">
503 <h1>Password not changed<br/>Check username and password</h1>
506 <a href="/"><img src="$web_loc/graphics/arlbw.jpg" border="0"></a>
512 <a href="http://www.arlut.utexas.edu/gash2/"><small>[Ganymede Home]</small></a>
514 <td width="100%" align="center">
515 <small>[Click <a href="$web_loc/index.html" target="_top">here</a> to go directly to the Ganymede login page]</small>
518 <a href="/"><small>[ARL:UT Home]</small></a>
523 <hr noshade="noshade"/>
527 <table border="0" width="60%">
530 <p>Ganymede was not able to accept your
531 password change request. The following error message was
534 <font color="red"><pre>$failure</pre></font>
540 <form method="POST" action="$my_url">
541 <table width="60%" bgcolor="#ccffcc" border="1" cellpadding="2">
542 <tr bgcolor="#663366">
543 <td colspan="2" align="center">
544 <big><font color="ffffcc">Ganymede Password Changer</font></big>
549 <td align="right"><b>Username?</b></td>
550 <td><input type="text" name="user" value="$user"></td>
554 <td align="right"><b>Old Password?</b></td>
555 <td><input type="password" name="old_pass"></td>
559 <td align="right"><b>New Password?</b></td>
560 <td><input type="password" name="new_pass"></td>
564 <td align="right"><b>Verify New Password</b></td>
565 <td><input type="password" name="verify"></td>
569 <td colspan="2" align="center"><input type="submit" value="SUBMIT"></td>
572 <tr bgcolor="663366">
573 <td colspan="2"> </td>
582 ######################################################################
586 ######################################################################
593 <a href="http://www.arlut.utexas.edu/gash2/"><img src="$web_loc/ganymede_title2_sm.gif" border="0"/></a>
595 <td width="100%" align="center">
596 <h1>Password not changed<br/>password verification failed</h1>
599 <a href="/"><img src="$web_loc/arlbw.jpg" border="0"></a>
605 <a href="http://www.arlut.utexas.edu/gash2/"><small>[Ganymede Home]</small></A>
607 <td width="100%" align="center">
608 <small>[Click <a href="$web_loc/index.html" target="_top">here</a> to go directly to the Ganymede login page]</small>
611 <a href="/"><small>[ARL:UT Home]</small></a>
616 <hr noshade="noshade"/>
619 <table border="0" width="60%">
622 <p>Ganymede was not able to accept your
623 password change request. You did not enter your new password
624 consistently. Please try again.</p>
629 <form method="POST" action="$my_url">
630 <table width="60%" bgcolor="#ccffcc" border="1" cellpadding="2">
631 <tr bgcolor="#663366">
632 <td colspan="2" align="center">
633 <big><font color="ffffcc">Ganymede Password Changer</font></big>
638 <td align="right"><b>Username?</b></td>
639 <td><input type="text" name="user" value="$user"></td>
643 <td align="right"><b>Old Password?</b></td>
644 <td><input type="password" name="old_pass"></td>
648 <td align="right"><b>New Password?</b></td>
649 <td><input type="password" name="new_pass"></td>
653 <td align="right"><b>Verify New Password</b></td>
654 <td><input type="password" name="verify"></td>
658 <td colspan="2" align="center"><input type="submit" value="SUBMIT"></td>
661 <tr bgcolor="663366">
662 <td colspan="2"> </td>
671 ######################################################################
675 ######################################################################
680 <a href="mailto:webmaster\@arlut.utexas.edu">webmaster\@arlut.utexas.edu</a><P>
684 ######################################################################
688 # Javascript basic form checker
689 ######################################################################
694 // Verify All Users in the form
695 function VerifyForm(former)
697 if (former.user.value == '') { alert('Please fill in the Username item before submitting'); former.user.focus(); return 0; }
698 if (former.old_pass.value == '') { alert('Please fill in the Old Password item before submitting'); former.old_pass.focus(); return 0; }
699 if (former.new_pass.value == '') { alert('Please fill in the New Password item before submitting'); former.new_pass.focus(); return 0; }
700 if (former.new_pass.value != former.verify.value) { alert('The new and verify passwords do not match, please update before submitting'); former.new_pass.focus(); return 0; }