3 * Author: Arvin Schnell <arvin@suse.de>
5 * This plugin let's you pass the password to the pppd via
6 * a file descriptor. That's easy and secure - no fiddling
7 * with pap- and chap-secrets files.
21 char pppd_version[] = VERSION;
23 static int passwdfd = -1;
24 static char save_passwd[MAXSECRETLEN];
26 static option_t options[] = {
27 { "passwordfd", o_int, &passwdfd,
28 "Receive password on this file descriptor" },
32 static int pwfd_check (void)
37 static int pwfd_passwd (char *user, char *passwd)
48 strcpy (passwd, save_passwd);
54 red = read (passwdfd, passwd + readgood, MAXSECRETLEN - 1 - readgood);
58 error ("Can't read secret from fd\n");
63 } while (readgood < MAXSECRETLEN - 1);
71 strcpy (save_passwd, passwd);
77 void plugin_init (void)
79 add_options (options);
81 pap_check_hook = pwfd_check;
82 pap_passwd_hook = pwfd_passwd;
84 chap_check_hook = pwfd_check;
85 chap_passwd_hook = pwfd_passwd;
88 eaptls_passwd_hook = pwfd_passwd;