diff options
author | Mystery Man <unknown@mandriva.org> | 2002-08-09 10:26:12 +0000 |
---|---|---|
committer | Mystery Man <unknown@mandriva.org> | 2002-08-09 10:26:12 +0000 |
commit | fdd0c69b55f6192d1825eb8ddd95bf2806e626f8 (patch) | |
tree | 01303c8c4445a5828d744737e6c87cb973fafba6 /mdk-stage1/ppp/contrib | |
parent | 9c49e6bfb611d4a73815cfa1a6e6821cd48a9ae2 (diff) | |
download | drakx-backup-do-not-use-1_1_9_9mdk.tar drakx-backup-do-not-use-1_1_9_9mdk.tar.gz drakx-backup-do-not-use-1_1_9_9mdk.tar.bz2 drakx-backup-do-not-use-1_1_9_9mdk.tar.xz drakx-backup-do-not-use-1_1_9_9mdk.zip |
This commit was manufactured by cvs2svn to create tag 'V1_1_9_9mdk'.V1_1_9_9mdk
Diffstat (limited to 'mdk-stage1/ppp/contrib')
-rw-r--r-- | mdk-stage1/ppp/contrib/pppgetpass/Makefile.linux | 16 | ||||
-rw-r--r-- | mdk-stage1/ppp/contrib/pppgetpass/pppgetpass.8 | 18 | ||||
-rw-r--r-- | mdk-stage1/ppp/contrib/pppgetpass/pppgetpass.gtk.c | 92 | ||||
-rw-r--r-- | mdk-stage1/ppp/contrib/pppgetpass/pppgetpass.sh | 7 | ||||
-rw-r--r-- | mdk-stage1/ppp/contrib/pppgetpass/pppgetpass.vt.c | 218 |
5 files changed, 0 insertions, 351 deletions
diff --git a/mdk-stage1/ppp/contrib/pppgetpass/Makefile.linux b/mdk-stage1/ppp/contrib/pppgetpass/Makefile.linux deleted file mode 100644 index 7eb217dac..000000000 --- a/mdk-stage1/ppp/contrib/pppgetpass/Makefile.linux +++ /dev/null @@ -1,16 +0,0 @@ -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/mdk-stage1/ppp/contrib/pppgetpass/pppgetpass.8 b/mdk-stage1/ppp/contrib/pppgetpass/pppgetpass.8 deleted file mode 100644 index ade576970..000000000 --- a/mdk-stage1/ppp/contrib/pppgetpass/pppgetpass.8 +++ /dev/null @@ -1,18 +0,0 @@ -.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/mdk-stage1/ppp/contrib/pppgetpass/pppgetpass.gtk.c b/mdk-stage1/ppp/contrib/pppgetpass/pppgetpass.gtk.c deleted file mode 100644 index 48ca04202..000000000 --- a/mdk-stage1/ppp/contrib/pppgetpass/pppgetpass.gtk.c +++ /dev/null @@ -1,92 +0,0 @@ -#include <glib.h> -#include <gdk/gdk.h> -#include <gtk/gtkwindow.h> -#include <gtk/gtkmain.h> -#include <gtk/gtkbutton.h> -#include <gtk/gtkvbox.h> -#include <gtk/gtklabel.h> -#include <gtk/gtkentry.h> -#include <gtk/gtksignal.h> - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <unistd.h> -#include <syslog.h> - -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/mdk-stage1/ppp/contrib/pppgetpass/pppgetpass.sh b/mdk-stage1/ppp/contrib/pppgetpass/pppgetpass.sh deleted file mode 100644 index 09c480519..000000000 --- a/mdk-stage1/ppp/contrib/pppgetpass/pppgetpass.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh - -if [ -z "$DISPLAY" ]; then - exec pppgetpass.vt "$@" -else - exec pppgetpass.gtk "$@" -fi diff --git a/mdk-stage1/ppp/contrib/pppgetpass/pppgetpass.vt.c b/mdk-stage1/ppp/contrib/pppgetpass/pppgetpass.vt.c deleted file mode 100644 index a1520883c..000000000 --- a/mdk-stage1/ppp/contrib/pppgetpass/pppgetpass.vt.c +++ /dev/null @@ -1,218 +0,0 @@ -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <errno.h> -#include <unistd.h> -#include <fcntl.h> -#include <sys/stat.h> -#include <sys/ioctl.h> -#include <syslog.h> -#include <termios.h> -#include <sys/vt.h> - -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; -} |