register int reencrypt;
char line[100];
int status;
+ char tmpfirst[100], tmplast[100], tmpmid[100];
status = ureg_init();
if (status) {
signal(SIGHUP, fix_display);
do {
+
setjmp(redo);
reset();
ntimes = 0;
gfirst();
gmi();
glast();
+ strcpy(tmpfirst, user.u_first);
+ strcpy(tmplast, user.u_last);
+ FixName(tmplast, tmpfirst, user.u_last, user.u_first, tmpmid);
+ redisp();
+
gmitid();
-
+
while (dolook()) {
ntimes++;
if (ntimes > 3) {
display_text_line(line);
if (askyn("Do you want to change it? ") == YES) {
gfirst();
+ strcpy(tmpfirst, user.u_first);
+ strcpy(tmplast, user.u_last);
+ FixName(tmplast, tmpfirst, user.u_last, user.u_first, tmpmid);
+ redisp();
reencrypt = 1;
}
display_text_line(0);
display_text_line(line);
if (askyn("Do you want to change it? ") == YES) {
glast();
+ strcpy(tmpfirst, user.u_first);
+ strcpy(tmplast, user.u_last);
+ FixName(tmplast, tmpfirst, user.u_last, user.u_first, tmpmid);
+ redisp();
reencrypt = 1;
}
display_text_line(0);
user.u_login);
display_text_line(line);
display_text_line("you typed in earlier.");
+ display_text_line("");
+ display_text_line("Your account should be created within about 12 hours\n");
+
display_text_line("");
display_text_line("You are now finished. Thank you!");
sleep(5);
display_text_line(
"Looking you up in the database.... This may take a few minutes.");
+ timer_off();
result = verify_user(user.u_first, user.u_last,
typed_mit_id, user.u_mit_id, db_user.u_login);
+ timer_on();
switch(result) {
case 0:
display_text_line("You have been located in the user registration database.");
return (0);
case UREG_USER_NOT_FOUND:
return (1);
+
case ECONNREFUSED:
+ case ETIMEDOUT:
display_text(NETWORK_DOWN);
return (0);
char old_login[LOGIN_SIZE];
char old_password[PASSWORD_SIZE];
int i;
+ char *cp;
display_text(USERNAME_BLURB);
- user.u_login[0] = user.u_first[0];
- user.u_login[1] = user.u_mid_init[0];
- strncpy(user.u_login+2, user.u_last, 6);
+ cp = user.u_login;
+ if (isalpha(user.u_first[0]))
+ *cp++ = user.u_first[0];
+ if (isalpha(user.u_mid_init[0]))
+ *cp++ = user.u_mid_init[0];
+
+ for (i = 0; user.u_last[i] && cp - user.u_login < 8; i++) {
+ if (isalpha(user.u_last[i])) *cp++ = user.u_last[i];
+ }
+
for (i=0; user.u_login[i]; i++)
if (isupper(user.u_login[i]))
user.u_login[i]=tolower(user.u_login[i]);
display_text_line(0);
display_text_line("Looking up that username in the database... This may take a few minutes.");
+ timer_off();
/*
* Rather than bother SMS with a bunch of different
* usernames, all in use, we first try and see if this
* guy is known to Kerberos.
*/
result = get_in_tkt(user.u_login, "", "ATHENA.MIT.EDU", "krbtgt", "ATHENA.MIT.EDU", "");
+ timer_on();
if (result != KDC_PR_UNKNOWN) {
in_use:
strcpy(user.u_login, old_login);
display_text_line("I'm sorry, but that username is already taken. Please try again with a different username");
continue;
}
+
/*
* If he isn't, let's try through SMS.
*/
+ timer_off();
result = grab_login(user.u_first, user.u_last,
typed_mit_id, user.u_mit_id,
user.u_login);
+ timer_on();
if (result != 0) {
if (result == UREG_LOGIN_USED) goto in_use;
display_text(NETWORK_DOWN);
char new_password[PASSWORD_SIZE];
char new_password_again[PASSWORD_SIZE];
- if (already_registered) { /* we have to ask for his old
- * password */
- signal(SIGALRM, restart);
- input_no_echo("Enter old Password:", old_password,
- PASSWORD_SIZE, OLD_PASSWORD_TIMEOUT);
- if (strcmp(user.u_password, crypt(old_password,
- user.u_password))) {
- display_text_line("Sorry, that does not match your old password.");
- display_text_line("In order to get a new one, you have to know the old one.");
- return (1);
- }
- }
do_input:
signal(SIGALRM, restart);
input_no_echo("Enter password:", new_password,
display_text_line("Please try again.");
goto do_input;
}
- /*
- * give him a new password. It looks funny because we are trying to
- * get a semi_random key without a lot of hair by using the login
- * name as a seed
- */
strcpy(user.u_password, new_password);
redisp();
if (i != 0) {
user.u_login[i] = '\0';
}
- if (strlen(user.u_login) < 2) {
+ if (strlen(user.u_login) < 3) {
+ display_text_line("Your username must be 3 or more characters long.\n");
goto input_login;
}
#ifdef notdef
* replaces a user in the database. If there is an error, it informs
* the user and calls qexit(); It returns only if is is successful
*/
+ timer_off();
status = set_password(user.u_first, user.u_last, typed_mit_id,
- user.u_mit_id, user.u_password);
+ user.u_mit_id, user.u_password);
+ timer_on();
if (status) {
display_text (NETWORK_DOWN);
return (-1);