Creating PPP Sever User Accounts
C-25
Point to Point Protocol
C.4 Creating PPP Sever User Accounts
C.4.1 Synopsis
In order to use the PPP or PPPoE protocol in server mode, it advisable to pro-
tect access to the system through the use of a PPP authentication protocol.
The PPP supplied in the stack library allows for the use of either PAP or CHAP
in user authentication. The database of authorized users (name and pass-
word) is stored in the configuration system.
C.4.2 Adding and Reviewing User Accounts
The definition of the user account entry in the configuration system is defined
in 4.4.7. Note in that section that the server “channel” flags PPPFLG_CH1
through PPPFLG_CH4 are duplicated in both the server flags and the client
account flags. This allows the system programmer to allow different classes
of services for different channels.
The methodology of adding, querying, and removing user accounts is the
same for any other tag in the configuration system. Some simple examples fol-
low. More example code can be found in the sample console program.
C.4.3 Adding a PPP User Account
The following code adds a PPP user account for the user supplied in name with
a password supplied in password. Note that we also use the AcctFind() func-
tion to verify the account doesn’t already exists.
void AcctAdd( char *name, char *password )
{
CI_ACCT CA;
HANDLE hAcct;
int rc;
// Check string lengths for name and password
if( strlen( name ) >= CFG_ACCTSTR_MAX ||
strlen( password ) >= CFG_ACCTSTR_MAX )
{
printf(”Name or password too long, %d character max\n\n”,
CFG_ACCTSTR_MAX–1);
return;
}
// See if the account already exists
hAcct = AcctFind( tok2 );
if( hAcct )
{
printf(”Account exits – remove old account first\n\n”);