2002-02-27 Ilya Alexeev <ilya@continuum.ru>

* net/if_ppp.c, pppd/auth.c, pppd/chat.c, pppd/pppd.h,
	pppd/sys-rtems.c: Add server with pap-authorization
	capabilities as well as eliminate some warnings.
This commit is contained in:
Joel Sherrill
2002-02-27 22:43:31 +00:00
parent c52f1c7cbb
commit cb1e8a4644
14 changed files with 110 additions and 24 deletions

View File

@@ -1,3 +1,9 @@
2002-02-27 Ilya Alexeev <ilya@continuum.ru>
* net/if_ppp.c, pppd/auth.c, pppd/chat.c, pppd/pppd.h,
pppd/sys-rtems.c: Add server with pap-authorization
capabilities as well as eliminate some warnings.
2002-02-27 Eric Norum <eric.norum@usask.ca> 2002-02-27 Eric Norum <eric.norum@usask.ca>
* net/radix.c: Properly handle fetching the default route when there * net/radix.c: Properly handle fetching the default route when there

View File

@@ -624,7 +624,7 @@ pppioctl(sc, cmd, data, flag, p)
if (sc->sc_flags & SC_CCP_OPEN && !(flags & SC_CCP_OPEN)) if (sc->sc_flags & SC_CCP_OPEN && !(flags & SC_CCP_OPEN))
ppp_ccp_closed(sc); ppp_ccp_closed(sc);
#endif #endif
splimp(); s = splimp();
sc->sc_flags = (sc->sc_flags & ~SC_MASK) | flags; sc->sc_flags = (sc->sc_flags & ~SC_MASK) | flags;
splx(s); splx(s);
break; break;
@@ -1136,7 +1136,10 @@ struct mbuf *
ppp_dequeue(sc) ppp_dequeue(sc)
struct ppp_softc *sc; struct ppp_softc *sc;
{ {
struct mbuf *m, *mp; struct mbuf *m;
#ifdef VJC
struct mbuf *mp;
#endif
u_char *cp; u_char *cp;
int address, control, protocol; int address, control, protocol;
@@ -1400,14 +1403,17 @@ ppp_inproc(sc, m)
struct mbuf *mf = (struct mbuf *)0; struct mbuf *mf = (struct mbuf *)0;
struct ifnet *ifp = &sc->sc_if; struct ifnet *ifp = &sc->sc_if;
struct ifqueue *inq; struct ifqueue *inq;
int s, ilen, xlen, proto, rv; int s, ilen, proto, rv;
u_char *cp, adrs, ctrl; u_char *cp, adrs, ctrl;
struct mbuf *mp; struct mbuf *mp;
#ifdef PPP_COMPRESS #ifdef PPP_COMPRESS
struct mbuf *dmp = NULL; struct mbuf *dmp = NULL;
#endif #endif
#ifdef VJC
u_char *iphdr; u_char *iphdr;
u_int hlen; u_int hlen;
int xlen;
#endif
sc->sc_stats.ppp_ipackets++; sc->sc_stats.ppp_ipackets++;

View File

@@ -1,3 +1,9 @@
2002-02-27 Ilya Alexeev <ilya@continuum.ru>
* net/if_ppp.c, pppd/auth.c, pppd/chat.c, pppd/pppd.h,
pppd/sys-rtems.c: Add server with pap-authorization
capabilities as well as eliminate some warnings.
2002-02-27 Eric Norum <eric.norum@usask.ca> 2002-02-27 Eric Norum <eric.norum@usask.ca>
* net/radix.c: Properly handle fetching the default route when there * net/radix.c: Properly handle fetching the default route when there

View File

@@ -624,7 +624,7 @@ pppioctl(sc, cmd, data, flag, p)
if (sc->sc_flags & SC_CCP_OPEN && !(flags & SC_CCP_OPEN)) if (sc->sc_flags & SC_CCP_OPEN && !(flags & SC_CCP_OPEN))
ppp_ccp_closed(sc); ppp_ccp_closed(sc);
#endif #endif
splimp(); s = splimp();
sc->sc_flags = (sc->sc_flags & ~SC_MASK) | flags; sc->sc_flags = (sc->sc_flags & ~SC_MASK) | flags;
splx(s); splx(s);
break; break;
@@ -1136,7 +1136,10 @@ struct mbuf *
ppp_dequeue(sc) ppp_dequeue(sc)
struct ppp_softc *sc; struct ppp_softc *sc;
{ {
struct mbuf *m, *mp; struct mbuf *m;
#ifdef VJC
struct mbuf *mp;
#endif
u_char *cp; u_char *cp;
int address, control, protocol; int address, control, protocol;
@@ -1400,14 +1403,17 @@ ppp_inproc(sc, m)
struct mbuf *mf = (struct mbuf *)0; struct mbuf *mf = (struct mbuf *)0;
struct ifnet *ifp = &sc->sc_if; struct ifnet *ifp = &sc->sc_if;
struct ifqueue *inq; struct ifqueue *inq;
int s, ilen, xlen, proto, rv; int s, ilen, proto, rv;
u_char *cp, adrs, ctrl; u_char *cp, adrs, ctrl;
struct mbuf *mp; struct mbuf *mp;
#ifdef PPP_COMPRESS #ifdef PPP_COMPRESS
struct mbuf *dmp = NULL; struct mbuf *dmp = NULL;
#endif #endif
#ifdef VJC
u_char *iphdr; u_char *iphdr;
u_int hlen; u_int hlen;
int xlen;
#endif
sc->sc_stats.ppp_ipackets++; sc->sc_stats.ppp_ipackets++;

View File

@@ -116,9 +116,9 @@ int (*idle_time_hook) __P((struct ppp_idle *)) = NULL;
int (*pap_check_hook) __P((void)) = NULL; int (*pap_check_hook) __P((void)) = NULL;
/* Hook for a plugin to check the PAP user and password */ /* Hook for a plugin to check the PAP user and password */
int (*pap_auth_hook) __P((char *user, char *passwd, char **msgp, int (*pap_auth_hook) __P((char *user, char *passwd/*, char **msgp,
struct wordlist **paddrs, struct wordlist **paddrs,
struct wordlist **popts)) = NULL; struct wordlist **popts*/)) = NULL;
/* Hook for a plugin to know about the PAP user logout */ /* Hook for a plugin to know about the PAP user logout */
void (*pap_logout_hook) __P((void)) = NULL; void (*pap_logout_hook) __P((void)) = NULL;
@@ -739,6 +739,20 @@ check_passwd(unit, auser, userlen, apasswd, passwdlen, msg)
int passwdlen; int passwdlen;
char **msg; char **msg;
{ {
char passwd[64], user[64];
if (pap_auth_hook)
{
slprintf(passwd, sizeof(passwd), "%.*v", passwdlen, apasswd);
slprintf(user, sizeof(user), "%.*v", userlen, auser);
return (*pap_auth_hook)(user, passwd/*, NULL, NULL, NULL*/) ?
UPAP_AUTHACK : UPAP_AUTHNAK;
}
return UPAP_AUTHACK;
#if 0
int ret = (int)UPAP_AUTHNAK; int ret = (int)UPAP_AUTHNAK;
if (( userlen == 0 ) && ( passwdlen == 0 )) { if (( userlen == 0 ) && ( passwdlen == 0 )) {
@@ -747,6 +761,7 @@ check_passwd(unit, auser, userlen, apasswd, passwdlen, msg)
printf("check_passwd: %d\n", ret); printf("check_passwd: %d\n", ret);
return ret; return ret;
#endif
} }
/* /*
@@ -793,6 +808,9 @@ static int
have_pap_secret(lacks_ipp) have_pap_secret(lacks_ipp)
int *lacks_ipp; int *lacks_ipp;
{ {
return 1;
#if 0
int ret = (int)0; int ret = (int)0;
/* let the plugin decide, if there is one */ /* let the plugin decide, if there is one */
@@ -802,6 +820,7 @@ have_pap_secret(lacks_ipp)
} }
return ( ret ); return ( ret );
#endif
} }
@@ -1011,12 +1030,17 @@ auth_ip_addr(unit, addr)
int unit; int unit;
u_int32_t addr; u_int32_t addr;
{ {
#if 0
int ok; int ok;
#endif
/* don't allow loopback or multicast address */ /* don't allow loopback or multicast address */
if (bad_ip_adrs(addr)) if (bad_ip_adrs(addr))
return 0; return 0;
return 1;
#if 0
if (addresses[unit] != NULL) { if (addresses[unit] != NULL) {
ok = ip_addr_check(addr, addresses[unit]); ok = ip_addr_check(addr, addresses[unit]);
if (ok >= 0) if (ok >= 0)
@@ -1025,6 +1049,7 @@ auth_ip_addr(unit, addr)
if (auth_required) if (auth_required)
return 0; /* no addresses authorized */ return 0; /* no addresses authorized */
return allow_any_ip || !have_route_to(addr); return allow_any_ip || !have_route_to(addr);
#endif
} }
static int static int

View File

@@ -598,7 +598,7 @@ int c;
void chat_send (s) void chat_send (s)
register char *s; register char *s;
{ {
char file_data[STR_LEN]; /* char file_data[STR_LEN]; */
if (say_next) { if (say_next) {
say_next = 0; say_next = 0;

View File

@@ -480,9 +480,9 @@ extern int (*new_phase_hook) __P((int));
extern int (*idle_time_hook) __P((struct ppp_idle *)); extern int (*idle_time_hook) __P((struct ppp_idle *));
extern int (*holdoff_hook) __P((void)); extern int (*holdoff_hook) __P((void));
extern int (*pap_check_hook) __P((void)); extern int (*pap_check_hook) __P((void));
extern int (*pap_auth_hook) __P((char *user, char *passwd, char **msgp, extern int (*pap_auth_hook) __P((char *user, char *passwd/*, char **msgp,
struct wordlist **paddrs, struct wordlist **paddrs,
struct wordlist **popts)); struct wordlist **popts*/));
extern void (*pap_logout_hook) __P((void)); extern void (*pap_logout_hook) __P((void));
extern int (*pap_passwd_hook) __P((char *user, char *passwd)); extern int (*pap_passwd_hook) __P((char *user, char *passwd));
extern void (*ip_up_hook) __P((void)); extern void (*ip_up_hook) __P((void));

View File

@@ -955,7 +955,7 @@ dodefaultroute(g, cmd)
u_int32_t g; u_int32_t g;
int cmd; int cmd;
{ {
int status; /* int status; */
struct sockaddr_in address; struct sockaddr_in address;
struct sockaddr_in netmask; struct sockaddr_in netmask;
struct sockaddr_in gateway; struct sockaddr_in gateway;

View File

@@ -1,3 +1,9 @@
2002-02-27 Ilya Alexeev <ilya@continuum.ru>
* net/if_ppp.c, pppd/auth.c, pppd/chat.c, pppd/pppd.h,
pppd/sys-rtems.c: Add server with pap-authorization
capabilities as well as eliminate some warnings.
2002-02-27 Eric Norum <eric.norum@usask.ca> 2002-02-27 Eric Norum <eric.norum@usask.ca>
* net/radix.c: Properly handle fetching the default route when there * net/radix.c: Properly handle fetching the default route when there

View File

@@ -624,7 +624,7 @@ pppioctl(sc, cmd, data, flag, p)
if (sc->sc_flags & SC_CCP_OPEN && !(flags & SC_CCP_OPEN)) if (sc->sc_flags & SC_CCP_OPEN && !(flags & SC_CCP_OPEN))
ppp_ccp_closed(sc); ppp_ccp_closed(sc);
#endif #endif
splimp(); s = splimp();
sc->sc_flags = (sc->sc_flags & ~SC_MASK) | flags; sc->sc_flags = (sc->sc_flags & ~SC_MASK) | flags;
splx(s); splx(s);
break; break;
@@ -1136,7 +1136,10 @@ struct mbuf *
ppp_dequeue(sc) ppp_dequeue(sc)
struct ppp_softc *sc; struct ppp_softc *sc;
{ {
struct mbuf *m, *mp; struct mbuf *m;
#ifdef VJC
struct mbuf *mp;
#endif
u_char *cp; u_char *cp;
int address, control, protocol; int address, control, protocol;
@@ -1400,14 +1403,17 @@ ppp_inproc(sc, m)
struct mbuf *mf = (struct mbuf *)0; struct mbuf *mf = (struct mbuf *)0;
struct ifnet *ifp = &sc->sc_if; struct ifnet *ifp = &sc->sc_if;
struct ifqueue *inq; struct ifqueue *inq;
int s, ilen, xlen, proto, rv; int s, ilen, proto, rv;
u_char *cp, adrs, ctrl; u_char *cp, adrs, ctrl;
struct mbuf *mp; struct mbuf *mp;
#ifdef PPP_COMPRESS #ifdef PPP_COMPRESS
struct mbuf *dmp = NULL; struct mbuf *dmp = NULL;
#endif #endif
#ifdef VJC
u_char *iphdr; u_char *iphdr;
u_int hlen; u_int hlen;
int xlen;
#endif
sc->sc_stats.ppp_ipackets++; sc->sc_stats.ppp_ipackets++;

View File

@@ -116,9 +116,9 @@ int (*idle_time_hook) __P((struct ppp_idle *)) = NULL;
int (*pap_check_hook) __P((void)) = NULL; int (*pap_check_hook) __P((void)) = NULL;
/* Hook for a plugin to check the PAP user and password */ /* Hook for a plugin to check the PAP user and password */
int (*pap_auth_hook) __P((char *user, char *passwd, char **msgp, int (*pap_auth_hook) __P((char *user, char *passwd/*, char **msgp,
struct wordlist **paddrs, struct wordlist **paddrs,
struct wordlist **popts)) = NULL; struct wordlist **popts*/)) = NULL;
/* Hook for a plugin to know about the PAP user logout */ /* Hook for a plugin to know about the PAP user logout */
void (*pap_logout_hook) __P((void)) = NULL; void (*pap_logout_hook) __P((void)) = NULL;
@@ -739,6 +739,20 @@ check_passwd(unit, auser, userlen, apasswd, passwdlen, msg)
int passwdlen; int passwdlen;
char **msg; char **msg;
{ {
char passwd[64], user[64];
if (pap_auth_hook)
{
slprintf(passwd, sizeof(passwd), "%.*v", passwdlen, apasswd);
slprintf(user, sizeof(user), "%.*v", userlen, auser);
return (*pap_auth_hook)(user, passwd/*, NULL, NULL, NULL*/) ?
UPAP_AUTHACK : UPAP_AUTHNAK;
}
return UPAP_AUTHACK;
#if 0
int ret = (int)UPAP_AUTHNAK; int ret = (int)UPAP_AUTHNAK;
if (( userlen == 0 ) && ( passwdlen == 0 )) { if (( userlen == 0 ) && ( passwdlen == 0 )) {
@@ -747,6 +761,7 @@ check_passwd(unit, auser, userlen, apasswd, passwdlen, msg)
printf("check_passwd: %d\n", ret); printf("check_passwd: %d\n", ret);
return ret; return ret;
#endif
} }
/* /*
@@ -793,6 +808,9 @@ static int
have_pap_secret(lacks_ipp) have_pap_secret(lacks_ipp)
int *lacks_ipp; int *lacks_ipp;
{ {
return 1;
#if 0
int ret = (int)0; int ret = (int)0;
/* let the plugin decide, if there is one */ /* let the plugin decide, if there is one */
@@ -802,6 +820,7 @@ have_pap_secret(lacks_ipp)
} }
return ( ret ); return ( ret );
#endif
} }
@@ -1011,12 +1030,17 @@ auth_ip_addr(unit, addr)
int unit; int unit;
u_int32_t addr; u_int32_t addr;
{ {
#if 0
int ok; int ok;
#endif
/* don't allow loopback or multicast address */ /* don't allow loopback or multicast address */
if (bad_ip_adrs(addr)) if (bad_ip_adrs(addr))
return 0; return 0;
return 1;
#if 0
if (addresses[unit] != NULL) { if (addresses[unit] != NULL) {
ok = ip_addr_check(addr, addresses[unit]); ok = ip_addr_check(addr, addresses[unit]);
if (ok >= 0) if (ok >= 0)
@@ -1025,6 +1049,7 @@ auth_ip_addr(unit, addr)
if (auth_required) if (auth_required)
return 0; /* no addresses authorized */ return 0; /* no addresses authorized */
return allow_any_ip || !have_route_to(addr); return allow_any_ip || !have_route_to(addr);
#endif
} }
static int static int

View File

@@ -598,7 +598,7 @@ int c;
void chat_send (s) void chat_send (s)
register char *s; register char *s;
{ {
char file_data[STR_LEN]; /* char file_data[STR_LEN]; */
if (say_next) { if (say_next) {
say_next = 0; say_next = 0;

View File

@@ -480,9 +480,9 @@ extern int (*new_phase_hook) __P((int));
extern int (*idle_time_hook) __P((struct ppp_idle *)); extern int (*idle_time_hook) __P((struct ppp_idle *));
extern int (*holdoff_hook) __P((void)); extern int (*holdoff_hook) __P((void));
extern int (*pap_check_hook) __P((void)); extern int (*pap_check_hook) __P((void));
extern int (*pap_auth_hook) __P((char *user, char *passwd, char **msgp, extern int (*pap_auth_hook) __P((char *user, char *passwd/*, char **msgp,
struct wordlist **paddrs, struct wordlist **paddrs,
struct wordlist **popts)); struct wordlist **popts*/));
extern void (*pap_logout_hook) __P((void)); extern void (*pap_logout_hook) __P((void));
extern int (*pap_passwd_hook) __P((char *user, char *passwd)); extern int (*pap_passwd_hook) __P((char *user, char *passwd));
extern void (*ip_up_hook) __P((void)); extern void (*ip_up_hook) __P((void));

View File

@@ -955,7 +955,7 @@ dodefaultroute(g, cmd)
u_int32_t g; u_int32_t g;
int cmd; int cmd;
{ {
int status; /* int status; */
struct sockaddr_in address; struct sockaddr_in address;
struct sockaddr_in netmask; struct sockaddr_in netmask;
struct sockaddr_in gateway; struct sockaddr_in gateway;