From: Paul Mackerras Date: Fri, 25 Oct 2024 06:24:30 +0000 (+1100) Subject: Remove pppgetpass program X-Git-Tag: v2.5.2~10^2~2 X-Git-Url: https://git.ozlabs.org/?a=commitdiff_plain;h=b9e627e21282aa97233c91f4360092995c377d5e;p=ppp.git Remove pppgetpass program This is associated with the passprompt plugin, and like it, seems not to be very useful any more now that no-one uses dial-up. Also, its function seems somewhat peripheral to PPP. Signed-off-by: Paul Mackerras --- diff --git a/Makefile.am b/Makefile.am index 3de35c8..8d3dff8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,6 +1,6 @@ ACLOCAL_AMFLAGS="-Im4" -SUBDIRS = chat contrib pppd pppstats pppdump +SUBDIRS = chat pppd pppstats pppdump if PPP_WITH_PLUGINS SUBDIRS += pppd/plugins diff --git a/configure.ac b/configure.ac index e30f161..b4f4335 100644 --- a/configure.ac +++ b/configure.ac @@ -317,22 +317,11 @@ AM_COND_IF([PPP_WITH_FILTER], [ ]) ]) -# -# Some contributions require GTK/GLIB -AC_ARG_WITH([gtk], AS_HELP_STRING([--with-gtk], [Build contributions with the GTK+ interface])) -if test "x${with_gtk}" = "xyes"; then - PKG_CHECK_MODULES([GTK], [gtk+-2.0]) - PKG_CHECK_MODULES([GLIB], [glib-2.0]) -fi -AM_CONDITIONAL([WITH_GTK], test "x${with_gtk}" = "xyes") - AC_DEFINE_UNQUOTED(PPPD_VERSION, "$VERSION", [Version of pppd]) AC_CONFIG_FILES([ Makefile chat/Makefile - contrib/Makefile - contrib/pppgetpass/Makefile include/Makefile pppd/Makefile pppd/pppd.pc diff --git a/contrib/Makefile.am b/contrib/Makefile.am deleted file mode 100644 index fb9a390..0000000 --- a/contrib/Makefile.am +++ /dev/null @@ -1 +0,0 @@ -SUBDIRS = pppgetpass diff --git a/contrib/pppgetpass/.gitignore b/contrib/pppgetpass/.gitignore deleted file mode 100644 index 1b8a1c8..0000000 --- a/contrib/pppgetpass/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -pppgetpass.vt -pppgetpass.gtk diff --git a/contrib/pppgetpass/Makefile.am b/contrib/pppgetpass/Makefile.am deleted file mode 100644 index be74d48..0000000 --- a/contrib/pppgetpass/Makefile.am +++ /dev/null @@ -1,17 +0,0 @@ -noinst_PROGRAMS = pppgetpass.vt - -pppgetpass_vt_SOURCES = pppgetpass.vt.c -pppgetpass_vt_CPPFLAGS = -Wno-unused-result - -if WITH_GTK -noinst_PROGRAMS += pppgetpass.gtk - -pppgetpass_gtk_SOURCES = pppgetpass.gtk.c -pppgetpass_gtk_CPPFLAGS = -Wno-deprecated-declarations -Wno-discarded-qualifiers -pppgetpass_gtk_CPPFLAGS += $(GLIB_CFLAGS) $(GTK_CFLAGS) -pppgetpass_gtk_LDADD = $(GLIB_LIBS) $(GTK_LIBS) -endif - -EXTRA_DIST = \ - pppgetpass.sh \ - pppgetpass.8 diff --git a/contrib/pppgetpass/pppgetpass.8 b/contrib/pppgetpass/pppgetpass.8 deleted file mode 100644 index ade5769..0000000 --- a/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/contrib/pppgetpass/pppgetpass.gtk.c b/contrib/pppgetpass/pppgetpass.gtk.c deleted file mode 100644 index 48ca042..0000000 --- a/contrib/pppgetpass/pppgetpass.gtk.c +++ /dev/null @@ -1,92 +0,0 @@ -#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 deleted file mode 100644 index 09c4805..0000000 --- a/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/contrib/pppgetpass/pppgetpass.vt.c b/contrib/pppgetpass/pppgetpass.vt.c deleted file mode 100644 index a152088..0000000 --- a/contrib/pppgetpass/pppgetpass.vt.c +++ /dev/null @@ -1,218 +0,0 @@ -#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; -}