2001-08-17 05:46:24 +00:00
|
|
|
/*****************************************************************************
|
|
|
|
*
|
|
|
|
* File ..................: mbsebbs/newuser.c
|
|
|
|
* Purpose ...............: New User login under Unix, creates both
|
|
|
|
* BBS and unix accounts.
|
2001-11-02 22:34:32 +00:00
|
|
|
* Last modification date : 27-Oct-2001
|
2001-08-17 05:46:24 +00:00
|
|
|
*
|
|
|
|
*****************************************************************************
|
|
|
|
* Copyright (C) 1997-2001
|
|
|
|
*
|
|
|
|
* Michiel Broek FIDO: 2:280/2802
|
|
|
|
* Beekmansbos 10
|
|
|
|
* 1971 BV IJmuiden
|
|
|
|
* the Netherlands
|
|
|
|
*
|
|
|
|
* This file is part of MBSE BBS.
|
|
|
|
*
|
|
|
|
* This BBS is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License as published by the
|
|
|
|
* Free Software Foundation; either version 2, or (at your option) any
|
|
|
|
* later version.
|
|
|
|
*
|
|
|
|
* MBSE BBS is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with MBSE BBS; see the file COPYING. If not, write to the Free
|
|
|
|
* Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
#include "../lib/libs.h"
|
|
|
|
#include "../lib/mbse.h"
|
|
|
|
#include "../lib/structs.h"
|
|
|
|
#include "../lib/records.h"
|
|
|
|
#include "../lib/clcomm.h"
|
|
|
|
#include "../lib/common.h"
|
|
|
|
#include "funcs4.h"
|
|
|
|
#include "pwcheck.h"
|
|
|
|
#include "newuser.h"
|
|
|
|
#include "language.h"
|
|
|
|
#include "timeout.h"
|
|
|
|
#include "change.h"
|
|
|
|
#include "bye.h"
|
|
|
|
|
|
|
|
|
|
|
|
extern int do_quiet; /* No logging to the screen */
|
|
|
|
extern pid_t mypid; /* Pid of this program */
|
|
|
|
char UnixName[9]; /* Unix Name */
|
|
|
|
extern int ieLogin; /* IEMSI Login Successfull */
|
|
|
|
extern int ieRows; /* Rows on screen */
|
|
|
|
extern int ieHOT; /* Use Hotkeys */
|
|
|
|
extern char *ieHandle; /* Users Handle */
|
|
|
|
extern char *ieLocation; /* Users Location */
|
|
|
|
extern char *Passwd; /* Plain password */
|
|
|
|
|
|
|
|
|
|
|
|
int newuser(char *FullName)
|
|
|
|
{
|
|
|
|
FILE *pUsrConfig;
|
|
|
|
int i, x, Found, iLang, recno = 0;
|
|
|
|
unsigned long crc;
|
|
|
|
char temp[PATH_MAX];
|
|
|
|
char *temp1, *temp2;
|
|
|
|
char *Phone1, *Phone2;
|
|
|
|
long offset;
|
|
|
|
struct userrec us;
|
|
|
|
|
|
|
|
IsDoing("New user login");
|
|
|
|
Syslog('+', "Newuser registration");
|
|
|
|
clear();
|
|
|
|
iLang = Chg_Language(TRUE);
|
|
|
|
|
|
|
|
Enter(1);
|
|
|
|
/* MBSE BBS - NEW USER REGISTRATION */
|
2001-11-02 22:34:32 +00:00
|
|
|
language(CYAN, BLACK, 37);
|
2001-08-17 05:46:24 +00:00
|
|
|
Enter(2);
|
|
|
|
|
|
|
|
Syslog('+', "Name entered: %s", FullName);
|
|
|
|
|
|
|
|
memset(&usrconfig, 0, sizeof(usrconfig));
|
|
|
|
memset(&exitinfo, 0, sizeof(exitinfo));
|
|
|
|
|
|
|
|
temp1 = calloc(81, sizeof(char));
|
|
|
|
temp2 = calloc(81, sizeof(char));
|
|
|
|
Phone1 = calloc(81, sizeof(char));
|
|
|
|
Phone2 = calloc(81, sizeof(char));
|
|
|
|
|
|
|
|
usrconfig.iLanguage = iLang;
|
|
|
|
usrconfig.FsMsged = TRUE;
|
|
|
|
|
|
|
|
while (TRUE) {
|
|
|
|
do {
|
|
|
|
alarm_on();
|
|
|
|
Enter(1);
|
|
|
|
/* Use this name: */
|
2001-11-02 22:34:32 +00:00
|
|
|
language(YELLOW, BLACK, 38);
|
2001-08-17 05:46:24 +00:00
|
|
|
printf("%s [Y/n]? ", FullName);
|
|
|
|
fflush(stdout);
|
|
|
|
fflush(stdin);
|
|
|
|
GetstrC(temp, 80);
|
|
|
|
|
|
|
|
if ((strcasecmp(temp, "y") == 0) || (strcmp(temp, "") == 0))
|
|
|
|
sprintf(temp, "%s", FullName);
|
|
|
|
else {
|
|
|
|
do {
|
|
|
|
Syslog('+', "User chose to use a different name");
|
|
|
|
Enter(1);
|
|
|
|
/* Please enter your First and Last name: */
|
2001-11-02 22:34:32 +00:00
|
|
|
language(CYAN, BLACK, 0);
|
2001-08-17 05:46:24 +00:00
|
|
|
fflush(stdout);
|
|
|
|
alarm_on();
|
|
|
|
Getname(temp, 35);
|
|
|
|
if (CheckName(temp))
|
|
|
|
printf("\n%s\n", (char *) Language(149));
|
|
|
|
/*
|
|
|
|
* Do a check to see if name exists
|
|
|
|
*/
|
|
|
|
} while ((CheckName(temp) || strchr(temp, ' ') == NULL));
|
|
|
|
}
|
|
|
|
} while (BadNames(temp) || *(temp) == '\n');
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Used to get users full name for other functions
|
|
|
|
*/
|
|
|
|
strcpy(FullName, tlcap(temp));
|
|
|
|
UserCity(mypid, FullName, (char *)"Unknown");
|
|
|
|
|
|
|
|
while (1) {
|
|
|
|
Enter(1);
|
|
|
|
/* Please enter your BBS password, this can be the same as the unix password */
|
|
|
|
printf("%s\n\n", (char *) Language(388));
|
|
|
|
/* Please enter new password : */
|
2001-11-02 22:34:32 +00:00
|
|
|
language(LIGHTCYAN, BLACK, 39);
|
2001-08-17 05:46:24 +00:00
|
|
|
fflush(stdout);
|
|
|
|
alarm_on();
|
|
|
|
Getpass(temp1);
|
|
|
|
if((x = strlen(temp1)) >= CFG.password_length) {
|
|
|
|
Enter(1);
|
|
|
|
/* Please enter password again : */
|
2001-11-02 22:34:32 +00:00
|
|
|
language(LIGHTCYAN, BLACK, 40);
|
2001-08-17 05:46:24 +00:00
|
|
|
fflush(stdout);
|
|
|
|
alarm_on();
|
|
|
|
Getpass(temp2);
|
|
|
|
if((i = strcmp(temp1,temp2)) != 0) {
|
|
|
|
Enter(2);
|
|
|
|
/* Your passwords do not match! Try again. */
|
2001-11-02 22:34:32 +00:00
|
|
|
language(LIGHTRED, BLACK, 41);
|
2001-08-17 05:46:24 +00:00
|
|
|
Enter(1);
|
|
|
|
} else {
|
|
|
|
crc = StringCRC32(tu(temp1));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
Enter(2);
|
|
|
|
/* Your password must contain at least */
|
2001-11-02 22:34:32 +00:00
|
|
|
language(LIGHTRED, BLACK, 42);
|
2001-08-17 05:46:24 +00:00
|
|
|
printf("%d ", CFG.password_length);
|
|
|
|
/* characters! Try again. */
|
2001-11-02 22:34:32 +00:00
|
|
|
language(WHITE, BLACK, 43);
|
2001-08-17 05:46:24 +00:00
|
|
|
Enter(1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
memset(Passwd, 0, 16);
|
|
|
|
sprintf(Passwd, "%s", temp2);
|
|
|
|
memset(&usrconfig.Password, 0, sizeof(usrconfig.Password));
|
|
|
|
sprintf(usrconfig.Password, "%s", temp2);
|
|
|
|
usrconfig.iPassword = crc;
|
|
|
|
alarm_on();
|
|
|
|
sprintf(UnixName, "%s", (char *) NameCreate(NameGen(FullName), FullName, temp2));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
strcpy(usrconfig.sUserName, FullName);
|
|
|
|
strcpy(usrconfig.Name, UnixName);
|
|
|
|
Time_Now = time(NULL);
|
|
|
|
l_date = localtime(&Time_Now);
|
|
|
|
ltime = time(NULL);
|
|
|
|
|
|
|
|
if(CFG.iAnsi) {
|
|
|
|
Enter(2);
|
|
|
|
/* Do you want ANSI and graphics mode [Y/n]: */
|
2001-11-02 22:34:32 +00:00
|
|
|
language(LIGHTGRAY, BLACK, 44);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
|
|
alarm_on();
|
|
|
|
i = toupper(getchar());
|
|
|
|
|
|
|
|
if (i == Keystroke(44, 0) || i == '\n')
|
|
|
|
usrconfig.GraphMode = TRUE;
|
|
|
|
else
|
|
|
|
usrconfig.GraphMode = FALSE;
|
|
|
|
} else {
|
|
|
|
usrconfig.GraphMode = TRUE; /* Default set it to ANSI */
|
|
|
|
Enter(1);
|
|
|
|
}
|
|
|
|
exitinfo.GraphMode = usrconfig.GraphMode;
|
|
|
|
TermInit(exitinfo.GraphMode);
|
|
|
|
|
|
|
|
if (CFG.iVoicePhone) {
|
|
|
|
while (1) {
|
|
|
|
Enter(1);
|
|
|
|
/* Please enter you Voice Number */
|
2001-11-02 22:34:32 +00:00
|
|
|
language(LIGHTGREEN, BLACK, 45);
|
2001-08-17 05:46:24 +00:00
|
|
|
Enter(1);
|
|
|
|
|
2001-11-02 22:34:32 +00:00
|
|
|
pout(LIGHTGREEN, BLACK, (char *)": ");
|
2001-08-17 05:46:24 +00:00
|
|
|
colour(CFG.InputColourF, CFG.InputColourB);
|
|
|
|
fflush(stdout);
|
|
|
|
alarm_on();
|
|
|
|
GetPhone(temp, 16);
|
|
|
|
|
|
|
|
if (strlen(temp) < 6) {
|
|
|
|
Enter(1);
|
2001-11-02 22:34:32 +00:00
|
|
|
/* Please enter a proper phone number */
|
|
|
|
language(LIGHTRED, BLACK, 47);
|
2001-08-17 05:46:24 +00:00
|
|
|
Enter(1);
|
|
|
|
} else {
|
|
|
|
strcpy(usrconfig.sVoicePhone, temp);
|
|
|
|
strcpy(Phone1, temp);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} /* End of first if statement */
|
|
|
|
|
|
|
|
if (CFG.iDataPhone) {
|
|
|
|
while (TRUE) {
|
|
|
|
Enter(1);
|
|
|
|
/* Please enter you Data Number */
|
2001-11-02 22:34:32 +00:00
|
|
|
language(LIGHTGREEN, BLACK, 48);
|
2001-08-17 05:46:24 +00:00
|
|
|
Enter(1);
|
|
|
|
|
2001-11-02 22:34:32 +00:00
|
|
|
pout(LIGHTGREEN, BLACK, (char *)": ");
|
2001-08-17 05:46:24 +00:00
|
|
|
colour(CFG.InputColourF, CFG.InputColourB);
|
|
|
|
alarm_on();
|
|
|
|
GetPhone(temp, 16);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* If no dataphone, copy voicephone.
|
|
|
|
*/
|
|
|
|
if (strcmp(temp, "") == 0) {
|
|
|
|
strcpy(usrconfig.sDataPhone, usrconfig.sVoicePhone);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( strlen(temp) < 6) {
|
|
|
|
Enter(1);
|
|
|
|
/* Please enter a proper phone number */
|
2001-11-02 22:34:32 +00:00
|
|
|
language(LIGHTRED, BLACK, 47);
|
2001-08-17 05:46:24 +00:00
|
|
|
Enter(1);
|
|
|
|
} else {
|
|
|
|
strcpy(usrconfig.sDataPhone, temp);
|
|
|
|
strcpy(Phone2, temp);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} /* End of if Statement */
|
|
|
|
|
|
|
|
if(!CFG.iDataPhone)
|
|
|
|
printf("\n");
|
|
|
|
|
|
|
|
if (ieLogin && (strlen(ieLocation) >= CFG.CityLen) && (strlen(ieLocation) < 24)) {
|
|
|
|
strcpy(usrconfig.sLocation, ieLocation);
|
|
|
|
} else {
|
2001-11-02 22:34:32 +00:00
|
|
|
if (CFG.iLocation) {
|
2001-08-17 05:46:24 +00:00
|
|
|
while (TRUE) {
|
|
|
|
Enter(1);
|
|
|
|
/* Enter your location */
|
2001-11-02 22:34:32 +00:00
|
|
|
pout(YELLOW, BLACK, (char *) Language(49));
|
2001-08-17 05:46:24 +00:00
|
|
|
colour(CFG.InputColourF, CFG.InputColourB);
|
|
|
|
alarm_on();
|
|
|
|
if (CFG.iCapLocation) { /* Cap Location is turn on, Capitalise first letter */
|
|
|
|
fflush(stdout);
|
|
|
|
GetnameNE(temp, 24);
|
|
|
|
} else
|
|
|
|
GetstrC(temp, 80);
|
|
|
|
|
|
|
|
if( strlen(temp) < CFG.CityLen) {
|
|
|
|
Enter(1);
|
|
|
|
/* Please enter a longer location */
|
2001-11-02 22:34:32 +00:00
|
|
|
language(LIGHTRED, BLACK, 50);
|
2001-08-17 05:46:24 +00:00
|
|
|
Enter(1);
|
|
|
|
printf("%s%d)", (char *) Language(74), CFG.CityLen);
|
|
|
|
Enter(1);
|
|
|
|
} else {
|
|
|
|
strcpy(usrconfig.sLocation, temp);
|
|
|
|
UserCity(mypid, FullName, temp);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2001-11-02 22:34:32 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (CFG.AskAddress) {
|
|
|
|
while (TRUE) {
|
|
|
|
Enter(1);
|
|
|
|
/* Your address, maximum 3 lines (only visible for the sysop): */
|
|
|
|
pout(LIGHTMAGENTA, BLACK, (char *)Language(474));
|
|
|
|
Enter(1);
|
|
|
|
for (i = 0; i < 3; i++) {
|
|
|
|
colour(YELLOW, BLACK);
|
|
|
|
printf("%d: ", i+1);
|
|
|
|
colour(CFG.InputColourF, CFG.InputColourB);
|
|
|
|
fflush(stdout);
|
|
|
|
alarm_on();
|
|
|
|
GetstrC(usrconfig.address[i], 40);
|
|
|
|
}
|
|
|
|
if (strlen(usrconfig.address[0]) || strlen(usrconfig.address[1]) || strlen(usrconfig.address[2]))
|
|
|
|
break;
|
|
|
|
Enter(1);
|
|
|
|
/* You need to enter your address here */
|
|
|
|
pout(LIGHTRED, BLACK, (char *)Language(475));
|
|
|
|
Enter(1);
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
}
|
|
|
|
|
2001-11-02 22:34:32 +00:00
|
|
|
if (CFG.iHandle) {
|
2001-08-17 05:46:24 +00:00
|
|
|
Enter(1);
|
|
|
|
/* Enter a handle (Enter to Quit): */
|
2001-11-02 22:34:32 +00:00
|
|
|
pout(LIGHTRED, BLACK, (char *) Language(412));
|
2001-08-17 05:46:24 +00:00
|
|
|
colour(CFG.InputColourF, CFG.InputColourB);
|
|
|
|
fflush(stdout);
|
|
|
|
alarm_on();
|
|
|
|
Getname(temp, 34);
|
|
|
|
|
|
|
|
if(strcmp(temp, "") == 0)
|
|
|
|
strcpy(usrconfig.sHandle, "");
|
|
|
|
else
|
|
|
|
strcpy(usrconfig.sHandle, temp);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Note, the users database always contains the english sex
|
|
|
|
*/
|
|
|
|
if(CFG.iSex) {
|
|
|
|
while (TRUE) {
|
|
|
|
Enter(1);
|
|
|
|
/* What is your sex? (M)ale or (F)emale: */
|
2001-11-02 22:34:32 +00:00
|
|
|
language(LIGHTBLUE, BLACK, 51);
|
2001-08-17 05:46:24 +00:00
|
|
|
colour(CFG.InputColourF, CFG.InputColourB);
|
|
|
|
fflush(stdout);
|
|
|
|
alarm_on();
|
|
|
|
i = toupper(Getone());
|
|
|
|
|
|
|
|
if (i == Keystroke(51, 0)) {
|
|
|
|
/* Male */
|
|
|
|
sprintf(usrconfig.sSex, "Male");
|
|
|
|
pout(CFG.InputColourF, CFG.InputColourB, (char *) Language(52));
|
|
|
|
Enter(1);
|
|
|
|
break;
|
|
|
|
} else
|
|
|
|
if (i == Keystroke(51, 1)) {
|
|
|
|
/* Female */
|
|
|
|
sprintf(usrconfig.sSex, "Female");
|
|
|
|
pout(CFG.InputColourF, CFG.InputColourB, (char *) Language(53));
|
|
|
|
Enter(1);
|
|
|
|
break;
|
|
|
|
} else {
|
|
|
|
Enter(2);
|
|
|
|
/* Please answer M or F */
|
2001-11-02 22:34:32 +00:00
|
|
|
language(LIGHTRED, BLACK, 54);
|
2001-08-17 05:46:24 +00:00
|
|
|
Enter(1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else /* End of if Statement */
|
|
|
|
sprintf(usrconfig.sSex, "Unknown"); /* If set off, set to Unknown */
|
|
|
|
|
|
|
|
while (TRUE) {
|
|
|
|
Enter(1);
|
|
|
|
/* Please enter your Date of Birth DD-MM-YYYY: */
|
2001-11-02 22:34:32 +00:00
|
|
|
pout(CYAN, BLACK, (char *) Language(56));
|
2001-08-17 05:46:24 +00:00
|
|
|
colour(CFG.InputColourF, CFG.InputColourB);
|
|
|
|
fflush(stdout);
|
|
|
|
alarm_on();
|
|
|
|
GetDate(temp, 10);
|
|
|
|
|
|
|
|
sprintf(temp1, "%c%c%c%c", temp[6], temp[7], temp[8], temp[9]);
|
|
|
|
sprintf(temp2, "%02d", l_date->tm_year);
|
|
|
|
iLang = atoi(temp2) + 1900;
|
|
|
|
sprintf(temp2, "%04d", iLang);
|
|
|
|
|
|
|
|
Syslog('-', "DOB: test %s %s", temp1, temp2);
|
|
|
|
|
|
|
|
if ((strcmp(temp1,temp2)) == 0) {
|
|
|
|
Enter(1);
|
|
|
|
/* Sorry you entered this year by mistake. */
|
2001-11-02 22:34:32 +00:00
|
|
|
pout(LIGHTRED, BLACK, (char *) Language(57));
|
2001-08-17 05:46:24 +00:00
|
|
|
Enter(1);
|
|
|
|
} else
|
|
|
|
if((strlen(temp)) != 10) {
|
|
|
|
Enter(1);
|
|
|
|
/* Please enter the correct date format */
|
2001-11-02 22:34:32 +00:00
|
|
|
pout(LIGHTRED, BLACK, (char *) Language(58));
|
2001-08-17 05:46:24 +00:00
|
|
|
Enter(1);
|
|
|
|
} else {
|
|
|
|
strcpy(usrconfig.sDateOfBirth,temp);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
usrconfig.tFirstLoginDate = ltime; /* Set first login date to current date */
|
|
|
|
usrconfig.tLastLoginDate = (time_t)0; /* To force setting new limits */
|
|
|
|
strcpy(usrconfig.sExpiryDate,"00-00-0000");
|
|
|
|
usrconfig.ExpirySec = CFG.newuser_access;
|
|
|
|
usrconfig.Security = CFG.newuser_access;
|
|
|
|
usrconfig.Email = CFG.GiveEmail;
|
|
|
|
|
|
|
|
if (ieLogin)
|
|
|
|
usrconfig.HotKeys = ieHOT;
|
|
|
|
else {
|
|
|
|
if (CFG.iHotkeys) {
|
|
|
|
while (TRUE) {
|
|
|
|
Enter(1);
|
|
|
|
/* Would you like hot-keyed menus [Y/n]: */
|
2001-11-02 22:34:32 +00:00
|
|
|
pout(LIGHTRED, BLACK, (char *) Language(62));
|
2001-08-17 05:46:24 +00:00
|
|
|
colour(CFG.InputColourF, CFG.InputColourB);
|
|
|
|
alarm_on();
|
|
|
|
GetstrC(temp, 8);
|
|
|
|
|
|
|
|
if ((toupper(temp[0]) == Keystroke(62, 0)) || (strcmp(temp,"") == 0)) {
|
|
|
|
usrconfig.HotKeys = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (toupper(temp[0]) == Keystroke(62, 1)) {
|
|
|
|
usrconfig.HotKeys = FALSE;
|
|
|
|
break;
|
|
|
|
} else {
|
|
|
|
/* Please answer Y or N */
|
2001-11-02 22:34:32 +00:00
|
|
|
pout(WHITE, BLACK, (char *) Language(63));
|
2001-08-17 05:46:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} /* End of if Statement */
|
|
|
|
else
|
|
|
|
usrconfig.HotKeys = TRUE; /* Default set it to Hotkeys */
|
|
|
|
}
|
|
|
|
|
|
|
|
usrconfig.iTimeLeft = 20; /* Set Timeleft in users file to 20 */
|
|
|
|
|
|
|
|
Enter(1);
|
|
|
|
if (ieLogin)
|
|
|
|
usrconfig.iScreenLen = ieRows;
|
|
|
|
else {
|
|
|
|
/* Please enter your Screen Length [24]: */
|
2001-11-02 22:34:32 +00:00
|
|
|
pout(LIGHTMAGENTA, BLACK, (char *) Language(64));
|
2001-08-17 05:46:24 +00:00
|
|
|
colour(CFG.InputColourF, CFG.InputColourB);
|
|
|
|
fflush(stdout);
|
|
|
|
alarm_on();
|
|
|
|
Getnum(temp, 3);
|
|
|
|
|
|
|
|
if(strlen(temp) == 0)
|
|
|
|
usrconfig.iScreenLen = 24;
|
|
|
|
else
|
|
|
|
usrconfig.iScreenLen = atoi(temp);
|
|
|
|
}
|
|
|
|
|
|
|
|
alarm_on();
|
|
|
|
|
|
|
|
usrconfig.tLastPwdChange = ltime; /* Days Since Last Password Change */
|
|
|
|
usrconfig.iLastFileArea = 1;
|
|
|
|
|
|
|
|
sprintf(usrconfig.sProtocol, "%s", (char *) Language(65));
|
|
|
|
usrconfig.DoNotDisturb = FALSE;
|
|
|
|
usrconfig.MailScan = TRUE;
|
|
|
|
usrconfig.ieFILE = TRUE;
|
|
|
|
usrconfig.ieNEWS = TRUE;
|
|
|
|
usrconfig.Cls = TRUE;
|
|
|
|
usrconfig.More = TRUE;
|
|
|
|
usrconfig.ieASCII8 = TRUE;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Search a free slot in the users datafile
|
|
|
|
*/
|
|
|
|
sprintf(temp, "%s/etc/users.data", getenv("MBSE_ROOT"));
|
|
|
|
if ((pUsrConfig = fopen(temp, "r+")) == NULL) {
|
|
|
|
WriteError("Can't open file: %s", temp);
|
|
|
|
ExitClient(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
fread(&usrconfighdr, sizeof(usrconfighdr), 1, pUsrConfig);
|
|
|
|
offset = ftell(pUsrConfig);
|
|
|
|
Found = FALSE;
|
|
|
|
|
|
|
|
while ((fread(&us, usrconfighdr.recsize, 1, pUsrConfig) == 1) && (!Found)) {
|
|
|
|
if (us.sUserName[0] == '\0') {
|
|
|
|
Found = TRUE;
|
|
|
|
} else {
|
|
|
|
offset = ftell(pUsrConfig);
|
|
|
|
recno++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Found)
|
|
|
|
fseek(pUsrConfig, offset, SEEK_SET);
|
|
|
|
else
|
|
|
|
fseek(pUsrConfig, 0, SEEK_END);
|
|
|
|
|
|
|
|
fwrite(&usrconfig, sizeof(usrconfig), 1, pUsrConfig);
|
|
|
|
fclose(pUsrConfig);
|
|
|
|
|
|
|
|
Enter(2);
|
|
|
|
/* Your user account has been created: */
|
2001-11-02 22:34:32 +00:00
|
|
|
pout(YELLOW, BLACK, (char *) Language(67));
|
2001-08-17 05:46:24 +00:00
|
|
|
Enter(2);
|
|
|
|
|
|
|
|
/* Login Name : */
|
2001-11-02 22:34:32 +00:00
|
|
|
pout(LIGHTBLUE, BLACK, (char *) Language(68));
|
|
|
|
colour(CYAN, BLACK);
|
2001-08-17 05:46:24 +00:00
|
|
|
printf("%s (%s)\n", FullName, UnixName);
|
|
|
|
/* Password : */
|
2001-11-02 22:34:32 +00:00
|
|
|
pout(LIGHTBLUE, BLACK, (char *) Language(69));
|
|
|
|
pout(CYAN, BLACK, (char *)"<");
|
2001-08-17 05:46:24 +00:00
|
|
|
/* not displayed */
|
2001-11-02 22:34:32 +00:00
|
|
|
pout(WHITE, BLACK, (char *) Language(70));
|
|
|
|
pout(CYAN, BLACK, (char *)">\n\n");
|
2001-08-17 05:46:24 +00:00
|
|
|
fflush(stdout);
|
|
|
|
fflush(stdin);
|
|
|
|
|
|
|
|
if(CFG.iVoicePhone) {
|
|
|
|
if(TelephoneScan(Phone1, FullName))
|
|
|
|
Syslog('!', "Duplicate phone numbers found");
|
|
|
|
}
|
|
|
|
|
|
|
|
if(CFG.iDataPhone) {
|
|
|
|
if(TelephoneScan(Phone2, FullName))
|
|
|
|
Syslog('!', "Duplicate phone numbers found");
|
|
|
|
}
|
|
|
|
|
|
|
|
free(temp1);
|
|
|
|
free(temp2);
|
|
|
|
free(Phone1);
|
|
|
|
free(Phone2);
|
|
|
|
|
|
|
|
Syslog('+', "Completed new-user procedure");
|
|
|
|
/* New user registration completed. */
|
2001-11-02 22:34:32 +00:00
|
|
|
pout(LIGHTGREEN, BLACK, (char *) Language(71));
|
2001-08-17 05:46:24 +00:00
|
|
|
Enter(2);
|
|
|
|
alarm_on();
|
|
|
|
Pause();
|
|
|
|
alarm_off();
|
|
|
|
printf("\n");
|
|
|
|
return recno;
|
|
|
|
}
|
|
|
|
|
|
|
|
|