|
|
struct wordlist **, struct wordlist **, | struct wordlist **, struct wordlist **, |
char *, int)); | char *, int)); |
static void free_wordlist __P((struct wordlist *)); | static void free_wordlist __P((struct wordlist *)); |
static void auth_script __P((char *)); |
static void auth_script __P((char *, int)); |
static void auth_script_done __P((void *)); | static void auth_script_done __P((void *)); |
static void set_allowed_addrs __P((int, struct wordlist *, struct wordlist *)); | static void set_allowed_addrs __P((int, struct wordlist *, struct wordlist *)); |
static int some_ip_ok __P((struct wordlist *)); | static int some_ip_ok __P((struct wordlist *)); |
|
|
if (auth_script_state == s_up && auth_script_pid == 0) { | if (auth_script_state == s_up && auth_script_pid == 0) { |
update_link_stats(unit); | update_link_stats(unit); |
auth_script_state = s_down; | auth_script_state = s_down; |
auth_script(_PATH_AUTHDOWN); |
auth_script(_PATH_AUTHDOWN, 0); |
} | } |
} | } |
if (!doing_multilink) { | if (!doing_multilink) { |
|
|
auth_state = s_up; | auth_state = s_up; |
if (auth_script_state == s_down && auth_script_pid == 0) { | if (auth_script_state == s_down && auth_script_pid == 0) { |
auth_script_state = s_up; | auth_script_state = s_up; |
auth_script(_PATH_AUTHUP); |
auth_script(_PATH_AUTHUP, 0); |
} | } |
} | } |
| |
|
|
* Authentication failure: take the link down | * Authentication failure: take the link down |
*/ | */ |
status = EXIT_PEER_AUTH_FAILED; | status = EXIT_PEER_AUTH_FAILED; |
|
auth_script(_PATH_AUTHFAIL, 1); |
lcp_close(unit, "Authentication failed"); | lcp_close(unit, "Authentication failed"); |
} | } |
| |
|
|
* authentication secrets. | * authentication secrets. |
*/ | */ |
status = EXIT_AUTH_TOPEER_FAILED; | status = EXIT_AUTH_TOPEER_FAILED; |
|
auth_script(_PATH_AUTHFAIL, 1); |
lcp_close(unit, "Failed to authenticate ourselves to peer"); | lcp_close(unit, "Failed to authenticate ourselves to peer"); |
} | } |
| |
|
|
case s_up: | case s_up: |
if (auth_state == s_down) { | if (auth_state == s_down) { |
auth_script_state = s_down; | auth_script_state = s_down; |
auth_script(_PATH_AUTHDOWN); |
auth_script(_PATH_AUTHDOWN, 0); |
} | } |
break; | break; |
case s_down: | case s_down: |
if (auth_state == s_up) { | if (auth_state == s_up) { |
auth_script_state = s_up; | auth_script_state = s_up; |
auth_script(_PATH_AUTHUP); |
auth_script(_PATH_AUTHUP, 0); |
} | } |
break; | break; |
} | } |
|
|
* interface-name peer-name real-user tty speed | * interface-name peer-name real-user tty speed |
*/ | */ |
static void | static void |
auth_script(script) |
auth_script(script, wait) |
char *script; | char *script; |
|
int wait; |
{ | { |
char strspeed[32]; | char strspeed[32]; |
struct passwd *pw; | struct passwd *pw; |
|
|
argv[5] = strspeed; | argv[5] = strspeed; |
argv[6] = NULL; | argv[6] = NULL; |
| |
auth_script_pid = run_program(script, argv, 0, auth_script_done, NULL, 0); |
if (wait) |
|
run_program(script, argv, 0, NULL, NULL, 1); |
|
else |
|
auth_script_pid = run_program(script, argv, 0, auth_script_done, NULL, 0); |
} | } |
|
|
#define _PATH_IPPREUP _ROOT_PATH "/etc/ppp/ip-pre-up" | #define _PATH_IPPREUP _ROOT_PATH "/etc/ppp/ip-pre-up" |
#define _PATH_AUTHUP _ROOT_PATH "/etc/ppp/auth-up" | #define _PATH_AUTHUP _ROOT_PATH "/etc/ppp/auth-up" |
#define _PATH_AUTHDOWN _ROOT_PATH "/etc/ppp/auth-down" | #define _PATH_AUTHDOWN _ROOT_PATH "/etc/ppp/auth-down" |
|
#define _PATH_AUTHFAIL _ROOT_PATH "/etc/ppp/auth-fail" |
#define _PATH_TTYOPT _ROOT_PATH "/etc/ppp/options." | #define _PATH_TTYOPT _ROOT_PATH "/etc/ppp/options." |
#define _PATH_CONNERRS _ROOT_PATH "/etc/ppp/connect-errors" | #define _PATH_CONNERRS _ROOT_PATH "/etc/ppp/connect-errors" |
#define _PATH_PEERFILES _ROOT_PATH "/etc/ppp/peers/" | #define _PATH_PEERFILES _ROOT_PATH "/etc/ppp/peers/" |
|
|
Pppd invokes scripts at various stages in its processing which can be | Pppd invokes scripts at various stages in its processing which can be |
used to perform site-specific ancillary processing. These scripts are | used to perform site-specific ancillary processing. These scripts are |
usually shell scripts, but could be executable code files instead. | usually shell scripts, but could be executable code files instead. |
Pppd does not wait for the scripts to finish (except for the ip-pre-up |
Pppd does not wait for the scripts to finish (except for the ip-pre-up, |
script). The scripts are |
and auth-fail scripts). The scripts are |
executed as root (with the real and effective user-id set to 0), so | executed as root (with the real and effective user-id set to 0), so |
that they can do things such as update routing tables or run | that they can do things such as update routing tables or run |
privileged daemons. Be careful that the contents of these scripts do | privileged daemons. Be careful that the contents of these scripts do |
|
|
/etc/ppp/auth\-up was previously executed. It is executed in the same | /etc/ppp/auth\-up was previously executed. It is executed in the same |
manner with the same parameters as /etc/ppp/auth\-up. | manner with the same parameters as /etc/ppp/auth\-up. |
.TP | .TP |
|
.B /etc/ppp/auth\-fail |
|
A program or script which is executed should authentication fail. pppd |
|
waits for this script to finish. It is executed in the same manner, with |
|
the same parameters as /etc/ppp/auth\-up. |
|
.TP |
.B /etc/ppp/ip\-pre\-up | .B /etc/ppp/ip\-pre\-up |
A program or script which is executed just before the ppp network | A program or script which is executed just before the ppp network |
interface is brought up. It is executed with the same parameters as | interface is brought up. It is executed with the same parameters as |