/*
* passprompt.c - pppd plugin to invoke an external PAP password prompter
*
* Copyright 1999 Paul Mackerras, Alan Curry.
*
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*/
#include <errno.h>
#include <unistd.h>
#include <fcntl.h>
#include <syslog.h>
#include "pppd.h"
"External PAP password prompting program",
{ NULL }
};
{
int p[2];
int red;
return -1; /* sorry, can't help */
/* This occurs when we're probed for the ability to supply a password */
return 1;
if (pipe(p)) {
return 0;
}
(void) close(p[0]);
(void) close(p[1]);
return 0;
}
/* we are the child, exec the program */
sys_close();
closelog();
p[1] = 3;
}
(void) close(p[0]);
if (detached) {
0600);
}
argv[0] = promptprog;
_exit(127);
}
/* we are the parent, read the password from the pipe */
(void) close(p[1]);
readgood = 0;
do {
if (red == 0)
break;
if (red < 0) {
continue;
readgood = -1;
break;
}
(void) close(p[0]);
/* now wait for child to exit */
break;
}
}
if (readgood < 0)
return 0;
if (WEXITSTATUS(wstat) != 0)
return 1;
}
void plugin_init(void)
{
}