When executing a command as part of a dial/login/hangup

script, expand words in the same way as !bg does.
This commit is contained in:
brian 1999-02-12 00:52:30 +00:00
parent 170b02f946
commit bed92e102b
3 changed files with 21 additions and 8 deletions

View File

@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: chat.c,v 1.52 1998/10/27 22:53:25 brian Exp $
* $Id: chat.c,v 1.53 1999/01/28 01:56:31 brian Exp $
*/
#include <sys/param.h>
@ -65,6 +65,7 @@
#include "ipcp.h"
#include "filter.h"
#include "cbcp.h"
#include "command.h"
#include "datalink.h"
#ifndef NORADIUS
#include "radius.h"
@ -724,11 +725,13 @@ ExecStr(struct physical *physical, char *command, char *out, int olen)
{
pid_t pid;
int fids[2];
char *vector[MAXARGS], *startout, *endout;
int stat, nb;
char *argv[MAXARGS], *vector[MAXARGS], *startout, *endout;
int stat, nb, argc;
log_Printf(LogCHAT, "Exec: %s\n", command);
MakeArgs(command, vector, VECSIZE(vector));
argc = MakeArgs(command, vector, VECSIZE(vector));
command_Expand(argv, argc, (char const *const *)vector,
physical->dl->bundle, 0);
if (pipe(fids) < 0) {
log_Printf(LogCHAT, "Unable to create pipe in ExecStr: %s\n",
@ -749,8 +752,8 @@ ExecStr(struct physical *physical, char *command, char *out, int olen)
else
fcntl(3, F_SETFD, 1); /* Set close-on-exec flag */
setuid(geteuid());
execvp(vector[0], vector);
fprintf(stderr, "execvp failed: %s: %s\n", vector[0], strerror(errno));
execvp(argv[0], argv);
fprintf(stderr, "execvp: %s: %s\n", argv[0], strerror(errno));
exit(127);
} else {
char *name = strdup(vector[0]);

View File

@ -1,4 +1,4 @@
.\" $Id: ppp.8,v 1.145 1999/02/11 10:14:08 brian Exp $
.\" $Id: ppp.8,v 1.146 1999/02/11 16:34:15 brian Exp $
.Dd 20 September 1995
.nr XX \w'\fC00'
.Os FreeBSD
@ -3262,6 +3262,11 @@ This, of course means that it is possible to execute an entirely external
command rather than using the internal one. See
.Xr chat 8
for a good alternative.
.Pp
The external command that is executed is subjected to the same special
word expansions as the
.Dq !bg
command.
.It set enddisc Op label|IP|MAC|magic|psn value
This command sets our local endpoint discriminator. If set prior to
LCP negotiation,

View File

@ -1,4 +1,4 @@
.\" $Id: ppp.8,v 1.145 1999/02/11 10:14:08 brian Exp $
.\" $Id: ppp.8,v 1.146 1999/02/11 16:34:15 brian Exp $
.Dd 20 September 1995
.nr XX \w'\fC00'
.Os FreeBSD
@ -3262,6 +3262,11 @@ This, of course means that it is possible to execute an entirely external
command rather than using the internal one. See
.Xr chat 8
for a good alternative.
.Pp
The external command that is executed is subjected to the same special
word expansions as the
.Dq !bg
command.
.It set enddisc Op label|IP|MAC|magic|psn value
This command sets our local endpoint discriminator. If set prior to
LCP negotiation,