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 1221-1226
Link Here
|
1221 |
if (user[0] == 0) |
1223 |
if (user[0] == 0) |
1222 |
strlcpy(user, our_name, sizeof(user)); |
1224 |
strlcpy(user, our_name, sizeof(user)); |
1223 |
|
1225 |
|
|
|
1226 |
script_setenv("LOCALNAME", user, 0); |
1227 |
|
1224 |
/* |
1228 |
/* |
1225 |
* If we have a default route, require the peer to authenticate |
1229 |
* If we have a default route, require the peer to authenticate |
1226 |
* unless the noauth option was given or the real user is root. |
1230 |
* unless the noauth option was given or the real user is root. |
Lines 2522-2534
Link Here
|
2522 |
case s_up: |
2526 |
case s_up: |
2523 |
if (auth_state == s_down) { |
2527 |
if (auth_state == s_down) { |
2524 |
auth_script_state = s_down; |
2528 |
auth_script_state = s_down; |
2525 |
auth_script(_PATH_AUTHDOWN); |
2529 |
auth_script(_PATH_AUTHDOWN, 0); |
2526 |
} |
2530 |
} |
2527 |
break; |
2531 |
break; |
2528 |
case s_down: |
2532 |
case s_down: |
2529 |
if (auth_state == s_up) { |
2533 |
if (auth_state == s_up) { |
2530 |
auth_script_state = s_up; |
2534 |
auth_script_state = s_up; |
2531 |
auth_script(_PATH_AUTHUP); |
2535 |
auth_script(_PATH_AUTHUP, 0); |
2532 |
} |
2536 |
} |
2533 |
break; |
2537 |
break; |
2534 |
} |
2538 |
} |
Lines 2539-2546
Link Here
|
2539 |
* interface-name peer-name real-user tty speed |
2543 |
* interface-name peer-name real-user tty speed |
2540 |
*/ |
2544 |
*/ |
2541 |
static void |
2545 |
static void |
2542 |
auth_script(script) |
2546 |
auth_script(script, wait) |
2543 |
char *script; |
2547 |
char *script; |
|
|
2548 |
int wait; |
2544 |
{ |
2549 |
{ |
2545 |
char strspeed[32]; |
2550 |
char strspeed[32]; |
2546 |
struct passwd *pw; |
2551 |
struct passwd *pw; |
Lines 2564-2568
Link Here
|
2564 |
argv[5] = strspeed; |
2569 |
argv[5] = strspeed; |
2565 |
argv[6] = NULL; |
2570 |
argv[6] = NULL; |
2566 |
|
2571 |
|
2567 |
auth_script_pid = run_program(script, argv, 0, auth_script_done, NULL, 0); |
2572 |
if (wait) |
|
|
2573 |
run_program(script, argv, 0, NULL, NULL, 1); |
2574 |
else |
2575 |
auth_script_pid = run_program(script, argv, 0, auth_script_done, NULL, 0); |
2568 |
} |
2576 |
} |