|
|
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"); |
} | } |
| |
|
|
if (user[0] == 0) | if (user[0] == 0) |
strlcpy(user, our_name, sizeof(user)); | strlcpy(user, our_name, sizeof(user)); |
| |
|
script_setenv("LOCALNAME", user, 0); |
|
|
/* | /* |
* If we have a default route, require the peer to authenticate | * If we have a default route, require the peer to authenticate |
* unless the noauth option was given or the real user is root. | * unless the noauth option was given or the real user is root. |
|
|
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); |
} | } |