Lines 260-266
Link Here
|
260 |
struct wordlist **, struct wordlist **, |
260 |
struct wordlist **, struct wordlist **, |
261 |
char *, int)); |
261 |
char *, int)); |
262 |
static void free_wordlist __P((struct wordlist *)); |
262 |
static void free_wordlist __P((struct wordlist *)); |
263 |
static void auth_script __P((char *)); |
263 |
static void auth_script __P((char *, int)); |
264 |
static void auth_script_done __P((void *)); |
264 |
static void auth_script_done __P((void *)); |
265 |
static void set_allowed_addrs __P((int, struct wordlist *, struct wordlist *)); |
265 |
static void set_allowed_addrs __P((int, struct wordlist *, struct wordlist *)); |
266 |
static int some_ip_ok __P((struct wordlist *)); |
266 |
static int some_ip_ok __P((struct wordlist *)); |
Lines 683-689
Link Here
|
683 |
if (auth_script_state == s_up && auth_script_pid == 0) { |
683 |
if (auth_script_state == s_up && auth_script_pid == 0) { |
684 |
update_link_stats(unit); |
684 |
update_link_stats(unit); |
685 |
auth_script_state = s_down; |
685 |
auth_script_state = s_down; |
686 |
auth_script(_PATH_AUTHDOWN); |
686 |
auth_script(_PATH_AUTHDOWN, 0); |
687 |
} |
687 |
} |
688 |
} |
688 |
} |
689 |
if (!doing_multilink) { |
689 |
if (!doing_multilink) { |
Lines 814-820
Link Here
|
814 |
auth_state = s_up; |
814 |
auth_state = s_up; |
815 |
if (auth_script_state == s_down && auth_script_pid == 0) { |
815 |
if (auth_script_state == s_down && auth_script_pid == 0) { |
816 |
auth_script_state = s_up; |
816 |
auth_script_state = s_up; |
817 |
auth_script(_PATH_AUTHUP); |
817 |
auth_script(_PATH_AUTHUP, 0); |
818 |
} |
818 |
} |
819 |
} |
819 |
} |
820 |
|
820 |
|
Lines 913-918
Link Here
|
913 |
* Authentication failure: take the link down |
913 |
* Authentication failure: take the link down |
914 |
*/ |
914 |
*/ |
915 |
status = EXIT_PEER_AUTH_FAILED; |
915 |
status = EXIT_PEER_AUTH_FAILED; |
|
|
916 |
auth_script(_PATH_AUTHFAIL, 1); |
916 |
lcp_close(unit, "Authentication failed"); |
917 |
lcp_close(unit, "Authentication failed"); |
917 |
} |
918 |
} |
918 |
|
919 |
|
Lines 991-996
Link Here
|
991 |
* authentication secrets. |
992 |
* authentication secrets. |
992 |
*/ |
993 |
*/ |
993 |
status = EXIT_AUTH_TOPEER_FAILED; |
994 |
status = EXIT_AUTH_TOPEER_FAILED; |
|
|
995 |
auth_script(_PATH_AUTHFAIL, 1); |
994 |
lcp_close(unit, "Failed to authenticate ourselves to peer"); |
996 |
lcp_close(unit, "Failed to authenticate ourselves to peer"); |
995 |
} |
997 |
} |
996 |
|
998 |
|
Lines 1223-1228
Link Here
|
1223 |
if (user[0] == 0) |
1225 |
if (user[0] == 0) |
1224 |
strlcpy(user, our_name, sizeof(user)); |
1226 |
strlcpy(user, our_name, sizeof(user)); |
1225 |
|
1227 |
|
|
|
1228 |
script_setenv("LOCALNAME", user, 0); |
1229 |
|
1226 |
/* |
1230 |
/* |
1227 |
* If we have a default route, require the peer to authenticate |
1231 |
* If we have a default route, require the peer to authenticate |
1228 |
* unless the noauth option was given or the real user is root. |
1232 |
* unless the noauth option was given or the real user is root. |
Lines 2524-2536
Link Here
|
2524 |
case s_up: |
2528 |
case s_up: |
2525 |
if (auth_state == s_down) { |
2529 |
if (auth_state == s_down) { |
2526 |
auth_script_state = s_down; |
2530 |
auth_script_state = s_down; |
2527 |
auth_script(_PATH_AUTHDOWN); |
2531 |
auth_script(_PATH_AUTHDOWN, 0); |
2528 |
} |
2532 |
} |
2529 |
break; |
2533 |
break; |
2530 |
case s_down: |
2534 |
case s_down: |
2531 |
if (auth_state == s_up) { |
2535 |
if (auth_state == s_up) { |
2532 |
auth_script_state = s_up; |
2536 |
auth_script_state = s_up; |
2533 |
auth_script(_PATH_AUTHUP); |
2537 |
auth_script(_PATH_AUTHUP, 0); |
2534 |
} |
2538 |
} |
2535 |
break; |
2539 |
break; |
2536 |
} |
2540 |
} |
Lines 2541-2548
Link Here
|
2541 |
* interface-name peer-name real-user tty speed |
2545 |
* interface-name peer-name real-user tty speed |
2542 |
*/ |
2546 |
*/ |
2543 |
static void |
2547 |
static void |
2544 |
auth_script(script) |
2548 |
auth_script(script, wait) |
2545 |
char *script; |
2549 |
char *script; |
|
|
2550 |
int wait; |
2546 |
{ |
2551 |
{ |
2547 |
char strspeed[32]; |
2552 |
char strspeed[32]; |
2548 |
struct passwd *pw; |
2553 |
struct passwd *pw; |
Lines 2566-2570
Link Here
|
2566 |
argv[5] = strspeed; |
2571 |
argv[5] = strspeed; |
2567 |
argv[6] = NULL; |
2572 |
argv[6] = NULL; |
2568 |
|
2573 |
|
2569 |
auth_script_pid = run_program(script, argv, 0, auth_script_done, NULL, 0); |
2574 |
if (wait) |
|
|
2575 |
run_program(script, argv, 0, NULL, NULL, 1); |
2576 |
else |
2577 |
auth_script_pid = run_program(script, argv, 0, auth_script_done, NULL, 0); |
2570 |
} |
2578 |
} |