chap.c (54912) | chap.c (54914) |
---|---|
1/* 2 * PPP CHAP Module 3 * 4 * Written by Toshiharu OHNO (tony-o@iij.ad.jp) 5 * 6 * Copyright (C) 1993, Internet Initiative Japan, Inc. All rights reserverd. 7 * 8 * Redistribution and use in source and binary forms are permitted 9 * provided that the above copyright notice and this paragraph are 10 * duplicated in all such forms and that any documentation, 11 * advertising materials, and other materials related to such 12 * distribution and use acknowledge that the software was developed 13 * by the Internet Initiative Japan, Inc. The name of the 14 * IIJ may not be used to endorse or promote products derived 15 * from this software without specific prior written permission. 16 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 17 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 18 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 19 * | 1/* 2 * PPP CHAP Module 3 * 4 * Written by Toshiharu OHNO (tony-o@iij.ad.jp) 5 * 6 * Copyright (C) 1993, Internet Initiative Japan, Inc. All rights reserverd. 7 * 8 * Redistribution and use in source and binary forms are permitted 9 * provided that the above copyright notice and this paragraph are 10 * duplicated in all such forms and that any documentation, 11 * advertising materials, and other materials related to such 12 * distribution and use acknowledge that the software was developed 13 * by the Internet Initiative Japan, Inc. The name of the 14 * IIJ may not be used to endorse or promote products derived 15 * from this software without specific prior written permission. 16 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 17 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 18 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 19 * |
20 * $FreeBSD: head/usr.sbin/ppp/chap.c 54912 1999-12-20 20:29:47Z brian $ | 20 * $FreeBSD: head/usr.sbin/ppp/chap.c 54914 1999-12-20 20:30:02Z brian $ |
21 * 22 * TODO: 23 */ 24#include <sys/param.h> 25#include <netinet/in.h> 26#include <netinet/in_systm.h> 27#include <netinet/ip.h> 28#include <sys/un.h> --- 196 unchanged lines hidden (view full) --- 225 close(in[1]); 226 close(out[0]); 227 close(out[1]); 228 chap->child.pid = 0; 229 return; 230 231 case 0: 232 timer_TermService(); | 21 * 22 * TODO: 23 */ 24#include <sys/param.h> 25#include <netinet/in.h> 26#include <netinet/in_systm.h> 27#include <netinet/ip.h> 28#include <sys/un.h> --- 196 unchanged lines hidden (view full) --- 225 close(in[1]); 226 close(out[0]); 227 close(out[1]); 228 chap->child.pid = 0; 229 return; 230 231 case 0: 232 timer_TermService(); |
233 234 if ((argc = command_Interpret(prog, strlen(prog), argv)) <= 0) { 235 if (argc < 0) { 236 log_Printf(LogWARN, "CHAP: Invalid command syntax\n"); 237 _exit(255); 238 } 239 _exit(0); 240 } 241 |
|
233 close(in[1]); 234 close(out[0]); 235 if (out[1] == STDIN_FILENO) 236 out[1] = dup(out[1]); 237 dup2(in[0], STDIN_FILENO); 238 dup2(out[1], STDOUT_FILENO); 239 close(STDERR_FILENO); 240 if (open(_PATH_DEVNULL, O_RDWR) != STDERR_FILENO) { 241 log_Printf(LogALERT, "Chap: Failed to open %s: %s\n", 242 _PATH_DEVNULL, strerror(errno)); 243 exit(1); 244 } 245 for (fd = getdtablesize(); fd > STDERR_FILENO; fd--) 246 fcntl(fd, F_SETFD, 1); 247 setuid(geteuid()); | 242 close(in[1]); 243 close(out[0]); 244 if (out[1] == STDIN_FILENO) 245 out[1] = dup(out[1]); 246 dup2(in[0], STDIN_FILENO); 247 dup2(out[1], STDOUT_FILENO); 248 close(STDERR_FILENO); 249 if (open(_PATH_DEVNULL, O_RDWR) != STDERR_FILENO) { 250 log_Printf(LogALERT, "Chap: Failed to open %s: %s\n", 251 _PATH_DEVNULL, strerror(errno)); 252 exit(1); 253 } 254 for (fd = getdtablesize(); fd > STDERR_FILENO; fd--) 255 fcntl(fd, F_SETFD, 1); 256 setuid(geteuid()); |
248 argc = command_Interpret(prog, strlen(prog), argv); | |
249 command_Expand(nargv, argc, (char const *const *)argv, 250 chap->auth.physical->dl->bundle, 0, pid); 251 execvp(nargv[0], nargv); 252 printf("exec() of %s failed: %s\n", nargv[0], strerror(errno)); 253 _exit(255); 254 255 default: 256 close(in[0]); --- 518 unchanged lines hidden --- | 257 command_Expand(nargv, argc, (char const *const *)argv, 258 chap->auth.physical->dl->bundle, 0, pid); 259 execvp(nargv[0], nargv); 260 printf("exec() of %s failed: %s\n", nargv[0], strerror(errno)); 261 _exit(255); 262 263 default: 264 close(in[0]); --- 518 unchanged lines hidden --- |