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.
17 char pppd_version
[] = VERSION
;
19 static int passwdfd
= -1;
20 static char save_passwd
[MAXSECRETLEN
];
22 static option_t options
[] = {
23 { "passwordfd", o_int
, &passwdfd
,
24 "Receive password on this file descriptor" },
28 static int pwfd_check (void)
33 static int pwfd_passwd (char *user
, char *passwd
)
44 strcpy (passwd
, save_passwd
);
50 red
= read (passwdfd
, passwd
+ readgood
, MAXSECRETLEN
- 1 - readgood
);
54 error ("Can't read secret from fd\n");
59 } while (readgood
< MAXSECRETLEN
- 1);
67 strcpy (save_passwd
, passwd
);
73 void plugin_init (void)
75 add_options (options
);
77 pap_check_hook
= pwfd_check
;
78 pap_passwd_hook
= pwfd_passwd
;
80 chap_check_hook
= pwfd_check
;
81 chap_passwd_hook
= pwfd_passwd
;