diff options
author | brian <brian@FreeBSD.org> | 1998-05-21 21:49:08 +0000 |
---|---|---|
committer | brian <brian@FreeBSD.org> | 1998-05-21 21:49:08 +0000 |
commit | 56df88b778aee0e60678672b107a48a8ea05cb48 (patch) | |
tree | 13b88ca17b38e787c84b0cd242677b3c3c0b93c3 /usr.sbin/ppp/id.c | |
parent | e077fa331b8a428923ded3a95d0b8d47084cf670 (diff) | |
download | FreeBSD-src-56df88b778aee0e60678672b107a48a8ea05cb48.zip FreeBSD-src-56df88b778aee0e60678672b107a48a8ea05cb48.tar.gz |
MFMP: Make ppp multilink capable.
See the file README.changes, and re-read the man page.
Diffstat (limited to 'usr.sbin/ppp/id.c')
-rw-r--r-- | usr.sbin/ppp/id.c | 77 |
1 files changed, 53 insertions, 24 deletions
diff --git a/usr.sbin/ppp/id.c b/usr.sbin/ppp/id.c index b6ff63f..2e4072c 100644 --- a/usr.sbin/ppp/id.c +++ b/usr.sbin/ppp/id.c @@ -23,14 +23,16 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: id.c,v 1.6 1998/01/21 02:15:16 brian Exp $ + * $Id: id.c,v 1.6.4.10 1998/05/01 19:24:41 brian Exp $ */ #include <sys/types.h> #include <sys/socket.h> +#include <sys/un.h> #include <sys/ioctl.h> #include <fcntl.h> +#include <stdarg.h> #include <stdio.h> #include <string.h> #include <sysexits.h> @@ -42,8 +44,6 @@ #endif #include <utmp.h> -#include "command.h" -#include "mbuf.h" #include "log.h" #include "main.h" #include "id.h" @@ -62,8 +62,8 @@ static void ID0setuser(void) { if (seteuid(uid) == -1) { - LogPrintf(LogERROR, "ID0setuser: Unable to seteuid!\n"); - Cleanup(EX_NOPERM); + log_Printf(LogERROR, "ID0setuser: Unable to seteuid!\n"); + AbortProgram(EX_NOPERM); } } @@ -77,8 +77,8 @@ static void ID0set0(void) { if (seteuid(euid) == -1) { - LogPrintf(LogERROR, "ID0set0: Unable to seteuid!\n"); - Cleanup(EX_NOPERM); + log_Printf(LogERROR, "ID0set0: Unable to seteuid!\n"); + AbortProgram(EX_NOPERM); } } @@ -89,7 +89,7 @@ ID0ioctl(int fd, unsigned long req, void *arg) ID0set0(); ret = ioctl(fd, req, arg); - LogPrintf(LogID0, "%d = ioctl(%d, %d, %p)\n", ret, fd, req, arg); + log_Printf(LogID0, "%d = ioctl(%d, %lu, %p)\n", ret, fd, req, arg); ID0setuser(); return ret; } @@ -101,7 +101,7 @@ ID0unlink(const char *name) ID0set0(); ret = unlink(name); - LogPrintf(LogID0, "%d = unlink(\"%s\")\n", ret, name); + log_Printf(LogID0, "%d = unlink(\"%s\")\n", ret, name); ID0setuser(); return ret; } @@ -113,7 +113,7 @@ ID0socket(int domain, int type, int protocol) ID0set0(); ret = socket(domain, type, protocol); - LogPrintf(LogID0, "%d = socket(%d, %d, %d)\n", ret, domain, type, protocol); + log_Printf(LogID0, "%d = socket(%d, %d, %d)\n", ret, domain, type, protocol); ID0setuser(); return ret; } @@ -125,20 +125,23 @@ ID0fopen(const char *path, const char *mode) ID0set0(); ret = fopen(path, mode); - LogPrintf(LogID0, "%p = fopen(\"%s\", \"%s\")\n", ret, path, mode); + log_Printf(LogID0, "%p = fopen(\"%s\", \"%s\")\n", ret, path, mode); ID0setuser(); return ret; } int -ID0open(const char *path, int flags) +ID0open(const char *path, int flags, ...) { int ret; + va_list ap; + va_start(ap, flags); ID0set0(); - ret = open(path, flags); - LogPrintf(LogID0, "%d = open(\"%s\", %d)\n", ret, path, flags); + ret = open(path, flags, va_arg(ap, int)); + log_Printf(LogID0, "%d = open(\"%s\", %d)\n", ret, path, flags); ID0setuser(); + va_end(ap); return ret; } @@ -149,7 +152,7 @@ ID0write(int fd, const void *data, size_t len) ID0set0(); ret = write(fd, data, len); - LogPrintf(LogID0, "%d = write(%d, data, %d)\n", ret, fd, len); + log_Printf(LogID0, "%d = write(%d, data, %d)\n", ret, fd, len); ID0setuser(); return ret; } @@ -161,7 +164,7 @@ ID0uu_lock(const char *basettyname) ID0set0(); ret = uu_lock(basettyname); - LogPrintf(LogID0, "%d = uu_lock(\"%s\")\n", ret, basettyname); + log_Printf(LogID0, "%d = uu_lock(\"%s\")\n", ret, basettyname); ID0setuser(); return ret; } @@ -173,7 +176,7 @@ ID0uu_unlock(const char *basettyname) ID0set0(); ret = uu_unlock(basettyname); - LogPrintf(LogID0, "%d = uu_unlock(\"%s\")\n", ret, basettyname); + log_Printf(LogID0, "%d = uu_unlock(\"%s\")\n", ret, basettyname); ID0setuser(); return ret; } @@ -183,13 +186,13 @@ ID0login(struct utmp *ut) { ID0set0(); if (logout(ut->ut_line)) { - LogPrintf(LogID0, "logout(\"%s\")\n", ut->ut_line); + log_Printf(LogID0, "logout(\"%s\")\n", ut->ut_line); logwtmp(ut->ut_line, "", ""); - LogPrintf(LogID0, "logwtmp(\"%s\", \"\", \"\")\n", ut->ut_line); + log_Printf(LogID0, "logwtmp(\"%s\", \"\", \"\")\n", ut->ut_line); } login(ut); - LogPrintf(LogID0, "login(\"%s\", \"%.*s\")\n", - ut->ut_line, sizeof ut->ut_name, ut->ut_name); + log_Printf(LogID0, "login(\"%s\", \"%.*s\")\n", + ut->ut_line, (int)(sizeof ut->ut_name), ut->ut_name); ID0setuser(); } @@ -203,10 +206,36 @@ ID0logout(const char *device) ID0set0(); if (logout(ut.ut_line)) { - LogPrintf(LogID0, "logout(\"%s\")\n", ut.ut_line); + log_Printf(LogID0, "logout(\"%s\")\n", ut.ut_line); logwtmp(ut.ut_line, "", ""); - LogPrintf(LogID0, "logwtmp(\"%s\", \"\", \"\")\n", ut.ut_line); + log_Printf(LogID0, "logwtmp(\"%s\", \"\", \"\")\n", ut.ut_line); } else - LogPrintf(LogERROR, "ID0logout: No longer logged in on %s\n", ut.ut_line); + log_Printf(LogERROR, "ID0logout: No longer logged in on %s\n", ut.ut_line); ID0setuser(); } + +int +ID0bind_un(int s, const struct sockaddr_un *name) +{ + int result; + + ID0set0(); + result = bind(s, (const struct sockaddr *)name, sizeof *name); + log_Printf(LogID0, "%d = bind(%d, \"%s\", %d)\n", + result, s, name->sun_path, sizeof *name); + ID0setuser(); + return result; +} + +int +ID0connect_un(int s, const struct sockaddr_un *name) +{ + int result; + + ID0set0(); + result = connect(s, (const struct sockaddr *)name, sizeof *name); + log_Printf(LogID0, "%d = connect(%d, \"%s\", %d)\n", + result, s, name->sun_path, sizeof *name); + ID0setuser(); + return result; +} |