From: Paul Mackerras Date: Sun, 27 Jul 2008 07:28:29 +0000 (+1000) Subject: Get the repository a bit closer to what will be released X-Git-Tag: ppp-2.4.7~75 X-Git-Url: http://git.ozlabs.org/?p=ppp.git;a=commitdiff_plain;h=3e451dfe42426b51e6ce1d66a3e04de43e055568;hp=7a7ed0a1a26961a165fd17183fd161c36a4b088f Get the repository a bit closer to what will be released * Remove .cvsignore files and create .gitignore files where needed * Add files that were in the last release but not in CVS Signed-off-by: Paul Mackerras --- diff --git a/.cvsignore b/.cvsignore deleted file mode 100644 index 6cc58ce..0000000 --- a/.cvsignore +++ /dev/null @@ -1,7 +0,0 @@ -Makefile -ppp.info -pppd-bsd -pppd-sunos4 -pppd-ultrix -pppd-linux -pppd-sol2 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..eb7087c --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +*.orig +*~ +*.o +*.so +*.a +*.cat8 +Makefile diff --git a/chat/.cvsignore b/chat/.cvsignore deleted file mode 100644 index f7d052a..0000000 --- a/chat/.cvsignore +++ /dev/null @@ -1,3 +0,0 @@ -Makefile -chat -chat.cat8 diff --git a/chat/.gitignore b/chat/.gitignore new file mode 100644 index 0000000..76cadc9 --- /dev/null +++ b/chat/.gitignore @@ -0,0 +1 @@ +chat diff --git a/contrib/pppgetpass/Makefile.linux b/contrib/pppgetpass/Makefile.linux new file mode 100644 index 0000000..7eb217d --- /dev/null +++ b/contrib/pppgetpass/Makefile.linux @@ -0,0 +1,16 @@ +all: pppgetpass.vt pppgetpass.gtk + +pppgetpass.vt: pppgetpass.vt.o + +pppgetpass.gtk: pppgetpass.gtk.o + $(CC) $(LDFLAGS) pppgetpass.gtk.o `gtk-config --libs` -o pppgetpass.gtk +pppgetpass.gtk.o: pppgetpass.gtk.c + $(CC) $(CFLAGS) -c pppgetpass.gtk.c `gtk-config --cflags` + +install: all + install -m 755 pppgetpass.sh /usr/bin/pppgetpass + install -m 4755 -o root -g root pppgetpass.vt /usr/bin/ + install -m 755 -o root -g root pppgetpass.gtk /usr/X11/bin/ + +clean: + rm -f *.o pppgetpass.gtk pppgetpass.vt core diff --git a/contrib/pppgetpass/pppgetpass.8 b/contrib/pppgetpass/pppgetpass.8 new file mode 100644 index 0000000..ade5769 --- /dev/null +++ b/contrib/pppgetpass/pppgetpass.8 @@ -0,0 +1,18 @@ +.TH PPPGETPASS 8 "26 Sep 1999" +.SH NAME +pppgetpass \- prompt for PAP password +.SH SYNOPSIS +.B pppgetpass +.I client server fd +.SH DESCRIPTION +.B pppgetpass +the outer half of a plugin for PAP password prompting in pppd. +If the peer requires PAP, and the +.B passprompt.so +plugin is loaded into pppd, it will run +.B /usr/sbin/pppgetpass +(or another program specified by the +.B promptprog +option) to prompt the user for the password. +.SH SEE ALSO +pppd(8) diff --git a/contrib/pppgetpass/pppgetpass.gtk.c b/contrib/pppgetpass/pppgetpass.gtk.c new file mode 100644 index 0000000..48ca042 --- /dev/null +++ b/contrib/pppgetpass/pppgetpass.gtk.c @@ -0,0 +1,92 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +int outfd; +int err; + +static void okpressed(void *widget, void *clientdata) +{ + GtkWidget *answer=clientdata; + gchar *pass; + int passlen; + ssize_t wrote; + (void)widget; + + pass=gtk_entry_get_text(GTK_ENTRY(answer)); + + passlen=strlen(pass); + if(!passlen) + return; + + if((wrote=write(outfd, pass, passlen))!=passlen) { + if(wrote<0) + syslog(LOG_ERR, "write error on outpipe: %m"); + else + syslog(LOG_ERR, "short write on outpipe"); + err=1; + } + gtk_main_quit(); +} + +int main(int argc, char **argv) +{ + GtkWidget *mainwindow, *vbox, *question, *answer, *ok; + char buf[1024]; + gtk_init(&argc, &argv); + + openlog(argv[0], LOG_PID, LOG_DAEMON); + if(argc!=4) { + syslog(LOG_WARNING, "Usage error"); + return 1; + } + outfd=atoi(argv[3]); + mainwindow=gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_window_set_title(GTK_WINDOW(mainwindow), "pppgetpass"); + gtk_signal_connect(GTK_OBJECT(mainwindow), "destroy", + GTK_SIGNAL_FUNC(gtk_main_quit), 0); + + vbox=gtk_vbox_new(FALSE, 5); + gtk_container_add(GTK_CONTAINER(mainwindow), vbox); + gtk_widget_show(vbox); + + if(argv[1][0] && argv[2][0]) + snprintf(buf, sizeof buf, "Password for PPP client %s on server %s: ", argv[1], argv[2]); + else if(argv[1][0] && !argv[2][0]) + snprintf(buf, sizeof buf, "Password for PPP client %s: ", argv[1]); + else if(!argv[1][0] && argv[2][0]) + snprintf(buf, sizeof buf, "Password for PPP on server %s: ", argv[2]); + else + snprintf(buf, sizeof buf, "Enter PPP password: "); + question=gtk_label_new(buf); + gtk_box_pack_start(GTK_BOX(vbox), question, FALSE, TRUE, 0); + gtk_widget_show(question); + + answer=gtk_entry_new(); + gtk_entry_set_visibility(GTK_ENTRY(answer), 0); + gtk_box_pack_start(GTK_BOX(vbox), answer, FALSE, TRUE, 0); + gtk_widget_show(answer); + + ok=gtk_button_new_with_label("OK"); + gtk_box_pack_start(GTK_BOX(vbox), ok, FALSE, TRUE, 0); + gtk_signal_connect(GTK_OBJECT(ok), "clicked", + GTK_SIGNAL_FUNC(okpressed), answer); + gtk_widget_show(ok); + + gtk_widget_show(mainwindow); + gtk_main(); + + return err; +} diff --git a/contrib/pppgetpass/pppgetpass.sh b/contrib/pppgetpass/pppgetpass.sh new file mode 100644 index 0000000..09c4805 --- /dev/null +++ b/contrib/pppgetpass/pppgetpass.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +if [ -z "$DISPLAY" ]; then + exec pppgetpass.vt "$@" +else + exec pppgetpass.gtk "$@" +fi diff --git a/contrib/pppgetpass/pppgetpass.vt.c b/contrib/pppgetpass/pppgetpass.vt.c new file mode 100644 index 0000000..a152088 --- /dev/null +++ b/contrib/pppgetpass/pppgetpass.vt.c @@ -0,0 +1,218 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static int console_owner(uid_t, int); + +int main(int argc, char **argv) +{ + int console; + uid_t uid; + struct vt_stat origstate; + int openvtnum; + char openvtname[256]; + int openvt; + gid_t gid; + int chowned; + FILE *fp; + struct termios t; + char pass[256], *nl; + int outfd, passlen; + ssize_t wrote; + console=open("/dev/console", O_RDWR); + + uid=getuid(); + gid=getgid(); + seteuid(uid); + + openlog(argv[0], LOG_PID, LOG_DAEMON); + + if(argc!=4) { + syslog(LOG_WARNING, "Usage error"); + return 1; + } + + if(console<0) { + syslog(LOG_ERR, "open(/dev/console): %m"); + return 1; + } + + if(ioctl(console, VT_GETSTATE, &origstate)<0) { + syslog(LOG_ERR, "VT_GETSTATE: %m"); + return 1; + } + + if(uid) { + if(!console_owner(uid, origstate.v_active)) { + int i; + for(i=0;i<64;++i) { + if(i!=origstate.v_active && console_owner(uid, i)) + break; + } + if(i==64) { + syslog(LOG_WARNING, "run by uid %lu not at console", (unsigned long)uid); + return 1; + } + } + } + + if(ioctl(console, VT_OPENQRY, &openvtnum)<0) { + syslog(LOG_ERR, "VT_OPENQRY: %m"); + return 1; + } + if(openvtnum==-1) { + syslog(LOG_ERR, "No free VTs"); + return 1; + } + + snprintf(openvtname, sizeof openvtname, "/dev/tty%d", openvtnum); + seteuid(0); + openvt=open(openvtname, O_RDWR); + if(openvt<0) { + seteuid(uid); + syslog(LOG_ERR, "open(%s): %m", openvtname); + return 1; + } + + chowned=fchown(openvt, uid, gid); + if(chowned<0) { + seteuid(uid); + syslog(LOG_ERR, "fchown(%s): %m", openvtname); + return 1; + } + + close(console); + + if(ioctl(openvt, VT_ACTIVATE, openvtnum)<0) { + seteuid(uid); + syslog(LOG_ERR, "VT_ACTIVATE(%d): %m", openvtnum); + return 1; + } + + while(ioctl(openvt, VT_WAITACTIVE, openvtnum)<0) { + if(errno!=EINTR) { + ioctl(openvt, VT_ACTIVATE, origstate.v_active); + seteuid(uid); + syslog(LOG_ERR, "VT_WAITACTIVE(%d): %m", openvtnum); + return 1; + } + } + + seteuid(uid); + fp=fdopen(openvt, "r+"); + if(!fp) { + seteuid(0); + ioctl(openvt, VT_ACTIVATE, origstate.v_active); + seteuid(uid); + syslog(LOG_ERR, "fdopen(%s): %m", openvtname); + return 1; + } + + if(tcgetattr(openvt, &t)<0) { + seteuid(0); + ioctl(openvt, VT_ACTIVATE, origstate.v_active); + seteuid(uid); + syslog(LOG_ERR, "tcgetattr(%s): %m", openvtname); + return 1; + } + t.c_lflag &= ~ECHO; + if(tcsetattr(openvt, TCSANOW, &t)<0) { + seteuid(0); + ioctl(openvt, VT_ACTIVATE, origstate.v_active); + seteuid(uid); + syslog(LOG_ERR, "tcsetattr(%s): %m", openvtname); + return 1; + } + + if(fprintf(fp, "\033[2J\033[H")<0) { + seteuid(0); + ioctl(openvt, VT_ACTIVATE, origstate.v_active); + seteuid(uid); + syslog(LOG_ERR, "write error on %s: %m", openvtname); + return 1; + } + if(argv[1][0] && argv[2][0]) { + if(fprintf(fp, "Password for PPP client %s on server %s: ", argv[1], argv[2])<0) { + seteuid(0); + ioctl(openvt, VT_ACTIVATE, origstate.v_active); + seteuid(uid); + syslog(LOG_ERR, "write error on %s: %m", openvtname); + return 1; + } + } else if(argv[1][0] && !argv[2][0]) { + if(fprintf(fp, "Password for PPP client %s: ", argv[1])<0) { + syslog(LOG_ERR, "write error on %s: %m", openvtname); + seteuid(0); + ioctl(openvt, VT_ACTIVATE, origstate.v_active); + seteuid(uid); + return 1; + } + } else if(!argv[1][0] && argv[2][0]) { + if(fprintf(fp, "Password for PPP on server %s: ", argv[2])<0) { + seteuid(0); + ioctl(openvt, VT_ACTIVATE, origstate.v_active); + seteuid(uid); + syslog(LOG_ERR, "write error on %s: %m", openvtname); + return 1; + } + } else { + if(fprintf(fp, "Enter PPP password: ")<0) { + seteuid(0); + ioctl(openvt, VT_ACTIVATE, origstate.v_active); + seteuid(uid); + syslog(LOG_ERR, "write error on %s: %m", openvtname); + return 1; + } + } + + if(!fgets(pass, sizeof pass, fp)) { + seteuid(0); + ioctl(openvt, VT_ACTIVATE, origstate.v_active); + seteuid(uid); + if(ferror(fp)) { + syslog(LOG_ERR, "read error on %s: %m", openvtname); + } + return 1; + } + if((nl=strchr(pass, '\n'))) + *nl=0; + passlen=strlen(pass); + + outfd=atoi(argv[3]); + if((wrote=write(outfd, pass, passlen))!=passlen) { + seteuid(0); + ioctl(openvt, VT_ACTIVATE, origstate.v_active); + seteuid(uid); + if(wrote<0) + syslog(LOG_ERR, "write error on outpipe: %m"); + else + syslog(LOG_ERR, "short write on outpipe"); + return 1; + } + + seteuid(0); + ioctl(openvt, VT_ACTIVATE, origstate.v_active); + seteuid(uid); + return 0; +} + +static int console_owner(uid_t uid, int cons) +{ + char name[256]; + struct stat st; + snprintf(name, sizeof name, "/dev/tty%d", cons); + if(stat(name, &st)<0) { + if(errno!=ENOENT) + syslog(LOG_ERR, "stat(%s): %m", name); + return 0; + } + return uid==st.st_uid; +} diff --git a/include/linux/if_ether.h b/include/linux/if_ether.h new file mode 100644 index 0000000..e9191ba --- /dev/null +++ b/include/linux/if_ether.h @@ -0,0 +1,99 @@ +/* + * INET An implementation of the TCP/IP protocol suite for the LINUX + * operating system. INET is implemented using the BSD Socket + * interface as the means of communication with the user level. + * + * Global definitions for the Ethernet IEEE 802.3 interface. + * + * Version: @(#)if_ether.h 1.0.1a 02/08/94 + * + * Author: Fred N. van Kempen, + * Donald Becker, + * Alan Cox, + * Steve Whitehouse, + * + * This program is free software; you can redistribute it and/or + * 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. + */ + +#ifndef _LINUX_IF_ETHER_H +#define _LINUX_IF_ETHER_H + +/* + * IEEE 802.3 Ethernet magic constants. The frame sizes omit the preamble + * and FCS/CRC (frame check sequence). + */ + +#define ETH_ALEN 6 /* Octets in one ethernet addr */ +#define ETH_HLEN 14 /* Total octets in header. */ +#define ETH_ZLEN 60 /* Min. octets in frame sans FCS */ +#define ETH_DATA_LEN 1500 /* Max. octets in payload */ +#define ETH_FRAME_LEN 1514 /* Max. octets in frame sans FCS */ + +/* + * These are the defined Ethernet Protocol ID's. + */ + +#define ETH_P_LOOP 0x0060 /* Ethernet Loopback packet */ +#define ETH_P_PUP 0x0200 /* Xerox PUP packet */ +#define ETH_P_PUPAT 0x0201 /* Xerox PUP Addr Trans packet */ +#define ETH_P_IP 0x0800 /* Internet Protocol packet */ +#define ETH_P_X25 0x0805 /* CCITT X.25 */ +#define ETH_P_ARP 0x0806 /* Address Resolution packet */ +#define ETH_P_BPQ 0x08FF /* G8BPQ AX.25 Ethernet Packet [ NOT AN OFFICIALLY REGISTERED ID ] */ +#define ETH_P_IEEEPUP 0x0a00 /* Xerox IEEE802.3 PUP packet */ +#define ETH_P_IEEEPUPAT 0x0a01 /* Xerox IEEE802.3 PUP Addr Trans packet */ +#define ETH_P_DEC 0x6000 /* DEC Assigned proto */ +#define ETH_P_DNA_DL 0x6001 /* DEC DNA Dump/Load */ +#define ETH_P_DNA_RC 0x6002 /* DEC DNA Remote Console */ +#define ETH_P_DNA_RT 0x6003 /* DEC DNA Routing */ +#define ETH_P_LAT 0x6004 /* DEC LAT */ +#define ETH_P_DIAG 0x6005 /* DEC Diagnostics */ +#define ETH_P_CUST 0x6006 /* DEC Customer use */ +#define ETH_P_SCA 0x6007 /* DEC Systems Comms Arch */ +#define ETH_P_RARP 0x8035 /* Reverse Addr Res packet */ +#define ETH_P_ATALK 0x809B /* Appletalk DDP */ +#define ETH_P_AARP 0x80F3 /* Appletalk AARP */ +#define ETH_P_IPX 0x8137 /* IPX over DIX */ +#define ETH_P_IPV6 0x86DD /* IPv6 over bluebook */ +#define ETH_P_PPP_DISC 0x8863 /* PPPoE discovery messages */ +#define ETH_P_PPP_SES 0x8864 /* PPPoE session messages */ +#define ETH_P_ATMMPOA 0x884c /* MultiProtocol Over ATM */ +#define ETH_P_ATMFATE 0x8884 /* Frame-based ATM Transport + * over Ethernet + */ + +/* + * Non DIX types. Won't clash for 1500 types. + */ + +#define ETH_P_802_3 0x0001 /* Dummy type for 802.3 frames */ +#define ETH_P_AX25 0x0002 /* Dummy protocol id for AX.25 */ +#define ETH_P_ALL 0x0003 /* Every packet (be careful!!!) */ +#define ETH_P_802_2 0x0004 /* 802.2 frames */ +#define ETH_P_SNAP 0x0005 /* Internal only */ +#define ETH_P_DDCMP 0x0006 /* DEC DDCMP: Internal only */ +#define ETH_P_WAN_PPP 0x0007 /* Dummy type for WAN PPP frames*/ +#define ETH_P_PPP_MP 0x0008 /* Dummy type for PPP MP frames */ +#define ETH_P_LOCALTALK 0x0009 /* Localtalk pseudo type */ +#define ETH_P_PPPTALK 0x0010 /* Dummy type for Atalk over PPP*/ +#define ETH_P_TR_802_2 0x0011 /* 802.2 frames */ +#define ETH_P_MOBITEX 0x0015 /* Mobitex (kaz@cafe.net) */ +#define ETH_P_CONTROL 0x0016 /* Card specific control frames */ +#define ETH_P_IRDA 0x0017 /* Linux-IrDA */ +#define ETH_P_ECONET 0x0018 /* Acorn Econet */ + +/* + * This is an Ethernet frame header. + */ + +struct ethhdr +{ + unsigned char h_dest[ETH_ALEN]; /* destination eth addr */ + unsigned char h_source[ETH_ALEN]; /* source ether addr */ + unsigned short h_proto; /* packet type ID field */ +}; + +#endif /* _LINUX_IF_ETHER_H */ diff --git a/modules/.cvsignore b/modules/.cvsignore deleted file mode 100644 index d287cd3..0000000 --- a/modules/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -debug diff --git a/netbsd-1.1/.cvsignore b/netbsd-1.1/.cvsignore deleted file mode 100644 index 2fa992c..0000000 --- a/netbsd-1.1/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -keep diff --git a/pppd/.cvsignore b/pppd/.cvsignore deleted file mode 100644 index 48b96a9..0000000 --- a/pppd/.cvsignore +++ /dev/null @@ -1,9 +0,0 @@ -Makefile -pppd -pppd.0 -pppd.cat8 -y.tab.h -y.tab.c -scanner.c -grammar.c -lex.yy.c diff --git a/pppd/.gitignore b/pppd/.gitignore new file mode 100644 index 0000000..5666003 --- /dev/null +++ b/pppd/.gitignore @@ -0,0 +1 @@ +pppd diff --git a/pppd/plugins/rp-pppoe/.gitignore b/pppd/plugins/rp-pppoe/.gitignore new file mode 100644 index 0000000..00c7f9c --- /dev/null +++ b/pppd/plugins/rp-pppoe/.gitignore @@ -0,0 +1 @@ +pppoe-discovery diff --git a/pppdump/.cvsignore b/pppdump/.cvsignore deleted file mode 100644 index c5eb835..0000000 --- a/pppdump/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -pppdump -Makefile diff --git a/pppdump/.gitignore b/pppdump/.gitignore new file mode 100644 index 0000000..f122623 --- /dev/null +++ b/pppdump/.gitignore @@ -0,0 +1 @@ +pppdump diff --git a/pppstats/.cvsignore b/pppstats/.cvsignore deleted file mode 100644 index ca3fe30..0000000 --- a/pppstats/.cvsignore +++ /dev/null @@ -1,3 +0,0 @@ -Makefile -pppstats -pppstats.cat8 diff --git a/pppstats/.gitignore b/pppstats/.gitignore new file mode 100644 index 0000000..25fd29e --- /dev/null +++ b/pppstats/.gitignore @@ -0,0 +1 @@ +pppstats diff --git a/solaris/.cvsignore b/solaris/.cvsignore deleted file mode 100644 index 4cbe14d..0000000 --- a/solaris/.cvsignore +++ /dev/null @@ -1,5 +0,0 @@ -ppp -ppp_ahdl -ppp_comp -Makefile -sparcv9 diff --git a/svr4/.cvsignore b/svr4/.cvsignore deleted file mode 100644 index 4cbe14d..0000000 --- a/svr4/.cvsignore +++ /dev/null @@ -1,5 +0,0 @@ -ppp -ppp_ahdl -ppp_comp -Makefile -sparcv9