home *** CD-ROM | disk | FTP | other *** search
- From: lenny@icus.ICUS.COM (Lenny Tropiano)
- Newsgroups: unix-pc.sources,alt.sources
- Subject: Re: dpasswd: Dialup Password Administration/Version 2.1 (Patch1)
- Message-ID: <1204@icus.ICUS.COM>
- Date: 18 Jun 90 16:05:00 GMT
-
- This is a small update to the program that I thought of this morning while
- using it. It upgrades the program from 2.0 to 2.1.
-
- -- cut and apply patch -- -- cut and apply patch -- -- cut and apply patch --
-
- *** old/README Sun Jun 17 00:49:59 1990
- --- README Mon Jun 18 10:59:11 1990
- ***************
- *** 81,86
- dpasswd: Dialup terminal restriction added for /dev/ph1.
- dpasswd: Dialup program restriction added for /bin/ksh.
-
- Appropriate "messages" will be given for all cases.
-
- If the program is compiled with the -DDEBUG flag, then diagnostic output
-
- --- 81,98 -----
- dpasswd: Dialup terminal restriction added for /dev/ph1.
- dpasswd: Dialup program restriction added for /bin/ksh.
-
- + # dpasswd
- + Dialup lines:
- + tty001
- + tty002
- +
- + Login programs:
- + /bin/ksh
- + /bin/sh
- + * /usr/lib/uucp/uucico
- +
- + * = no password necessary
- +
- Appropriate "messages" will be given for all cases.
-
- If the program is compiled with the -DDEBUG flag, then diagnostic output
- *** old/dpasswd.1 Sun Jun 17 00:46:08 1990
- --- dpasswd.1 Mon Jun 18 10:58:25 1990
- ***************
- *** 56,61
- # dpasswd -n -p /usr/lib/uucp/uucico
- dpasswd: Dialup program restriction added for /usr/lib/uucp/uucico.
-
- .fi
-
- .RE
-
- --- 56,73 -----
- # dpasswd -n -p /usr/lib/uucp/uucico
- dpasswd: Dialup program restriction added for /usr/lib/uucp/uucico.
-
- + # dpasswd
- + Dialup lines:
- + tty001
- + tty002
- +
- + Login programs:
- + /bin/ksh
- + /bin/sh
- + * /usr/lib/uucp/uucico
- +
- + * = no password necessary
- +
- .fi
-
- .RE
- *** old/dpasswd.c Sun Jun 17 01:04:20 1990
- --- dpasswd.c Mon Jun 18 10:57:34 1990
- ***************
- *** 7,12
- ** Date: December 4, 1988 [Version 1.0] **
- ** May 16, 1990 [Version 1.6] **
- ** June 16, 1990 [Version 2.0] **
- ** **
- ** Modified by Gary Butler, ST, Pacific Bell [1.6] **
- ** Modified by Joe Wasik, ST, Pacific Bell [1.6] **
-
- --- 7,13 -----
- ** Date: December 4, 1988 [Version 1.0] **
- ** May 16, 1990 [Version 1.6] **
- ** June 16, 1990 [Version 2.0] **
- + ** June 18, 1990 [Version 2.1] **
- ** **
- ** Modified by Gary Butler, ST, Pacific Bell [1.6] **
- ** Modified by Joe Wasik, ST, Pacific Bell [1.6] **
- ***************
- *** 10,16
- ** **
- ** Modified by Gary Butler, ST, Pacific Bell [1.6] **
- ** Modified by Joe Wasik, ST, Pacific Bell [1.6] **
- ! ** Modified by Lenny Tropiano, ICUS Software Systems [2.0] **
- ** **
- **************************************************************************
- ** **
-
- --- 11,17 -----
- ** **
- ** Modified by Gary Butler, ST, Pacific Bell [1.6] **
- ** Modified by Joe Wasik, ST, Pacific Bell [1.6] **
- ! ** Modified by Lenny Tropiano, ICUS Software Systems [2.0, 2.1] **
- ** **
- **************************************************************************
- ** **
- ***************
- *** 120,125
- **
- ** - Lenny Tropiano
- **
- */
-
- #include <stdio.h>
-
- --- 121,133 -----
- **
- ** - Lenny Tropiano
- **
- + ** June 18, 1990
- + **
- + ** Modifications:
- + **
- + ** 1 - If no arguments are given, dialup password'ed shells and ttys are
- + ** displayed.
- + **
- */
-
- #include <stdio.h>
- ***************
- *** 220,226
- extern int optind;
- extern char *optarg;
- void manage_dialup(),
- ! manage_program();
-
-
- /*
-
- --- 228,235 -----
- extern int optind;
- extern char *optarg;
- void manage_dialup(),
- ! manage_program(),
- ! list_dialup();
-
-
- /*
- ***************
- *** 234,239
- if (debug)
- (void) printf("buffer length: %d\n", DPASSWDLEN);
-
- /*
- ** read command line options
- */
-
- --- 243,253 -----
- if (debug)
- (void) printf("buffer length: %d\n", DPASSWDLEN);
-
- + if (argc == 1) { /* no parameters given */
- + (void) list_dialup();
- + exit(0);
- + }
- +
- /*
- ** read command line options
- */
- ***************
- *** 268,274
-
- if (errflg || (!chgterm && !chgprog)) {
- (void) fprintf(stderr,
- ! "Usage: %s [-qnd] -p program -t terminal\n",
- thisprg);
- exit(1);
- }
-
- --- 282,288 -----
-
- if (errflg || (!chgterm && !chgprog)) {
- (void) fprintf(stderr,
- ! "Usage: %s [-qnd] [-p program] [-t terminal]\n",
- thisprg);
- exit(1);
- }
- ***************
- *** 693,698
- return 0;
- }
-
- #ifndef lint
- static char sccsid[] = "@(#)dpasswd.c Version 2.0";
- #endif
-
- --- 707,801 -----
- return 0;
- }
-
- + void list_dialup()
- + {
- + FILE *fp;
- + int fd,
- + nullfound;
- + char ttybuffer[TTYLEN],
- + pswbuffer[DPASSWDLEN],
- + *program,
- + *password,
- + *buffer,
- + *c;
- +
- + /* read in the old dialups file */
- + /* if it doesn't exist, then create it */
- +
- + if ((fp = fopen(dttyfile, "r")) == NULL) {
- +
- + if (debug)
- + (void) printf("creating %s\n", dttyfile);
- +
- + if ((fd = creat(dttyfile, DIALUPS_PERMS)) < 0) {
- + perror(dttyfile);
- + exit(1);
- + }
- +
- + fp = fdopen(fd, "r");
- + }
- +
- + printf("Dialup lines:\n");
- +
- + while (fgets(ttybuffer, TTYLEN, fp) != NULL) {
- +
- + if (strncmp(ttybuffer,"/dev/",5) == 0)
- + buffer = ttybuffer + 5;
- + else
- + buffer = ttybuffer;
- +
- + printf("\t%s", buffer);
- +
- + }
- + (void) fclose(fp);
- +
- + /* read in the old dialups password file */
- + /* if it doesn't exist, then create it */
- +
- + if ((fp = fopen(dpswfile, "r")) == NULL) {
- +
- + if (debug)
- + (void) printf("creating %s\n", dpswfile);
- +
- + if ((fd = creat(dpswfile, DIALUPS_PERMS)) < 0) {
- + perror(dpswfile);
- + exit(1);
- + }
- +
- + fp = fdopen(fd, "r");
- + }
- +
- + nullfound = 0;
- +
- + printf("\nLogin programs:\n");
- +
- + while (fgets(pswbuffer, DPASSWDLEN, fp) != NULL) {
- + /*
- + ** set the line which is "program:password:<CR>" to it's
- + ** individual components
- + */
- +
- + program = pswbuffer;
- + c = strrchr(pswbuffer, ':');
- + *c = '\0';
- + c = strchr(pswbuffer, ':');
- + password = c + 1;
- + *c = '\0';
- +
- + if (password[0] == '\0') {
- + nullfound = 1;
- + printf("*");
- + }
- +
- + printf("\t%s\n", program);
- + }
- + if (nullfound)
- + printf("\n* = no password necessary\n");
- +
- + (void) fclose(fp);
- + printf("\n");
- + }
- +
- #ifndef lint
- static char sccsid[] = "@(#)dpasswd.c Version 2.1";
- #endif
- ***************
- *** 694,698
- }
-
- #ifndef lint
- ! static char sccsid[] = "@(#)dpasswd.c Version 2.0";
- #endif
-
- --- 797,801 -----
- }
-
- #ifndef lint
- ! static char sccsid[] = "@(#)dpasswd.c Version 2.1";
- #endif
- --
- | Lenny Tropiano ICUS Software Systems lenny@icus.ICUS.COM |
- | {ames,pacbell,decuac,sbcs,hombre,rayssd}!icus!lenny attmail!icus!lenny |
- +------ ICUS Software Systems -- PO Box 1; Islip Terrace, NY 11752 ------+
-