diff options
author | wiz <wiz> | 2001-05-22 12:23:28 +0000 |
---|---|---|
committer | wiz <wiz> | 2001-05-22 12:23:28 +0000 |
commit | 451ab46c645d7316d948b49e0e150bf43f4b5736 (patch) | |
tree | 0f6c2753212488758eb69b47664b854d25531086 /editors | |
parent | 03f468626fdf6ccc3d935bd610ec2d0e0628002c (diff) | |
download | pkgsrc-451ab46c645d7316d948b49e0e150bf43f4b5736.tar.gz |
Add one patch from OpenBSD to not use ./.joerc, and two from FreeBSD, one
against a symlink attack on 'DEADJOE', and one to use vi-style file
locking.
Bump version to 2.8nb1.
Diffstat (limited to 'editors')
-rw-r--r-- | editors/joe/Makefile | 5 | ||||
-rw-r--r-- | editors/joe/distinfo | 7 | ||||
-rw-r--r-- | editors/joe/patches/patch-ab | 100 | ||||
-rw-r--r-- | editors/joe/patches/patch-ac | 31 | ||||
-rw-r--r-- | editors/joe/patches/patch-ag | 12 |
5 files changed, 142 insertions, 13 deletions
diff --git a/editors/joe/Makefile b/editors/joe/Makefile index bac172ae3ad..0c9c5e8965f 100644 --- a/editors/joe/Makefile +++ b/editors/joe/Makefile @@ -1,9 +1,8 @@ -# $NetBSD: Makefile,v 1.10 2001/02/16 14:40:50 wiz Exp $ -# FreeBSD Id: Makefile,v 1.3 1996/11/17 07:01:28 obrien Exp +# $NetBSD: Makefile,v 1.11 2001/05/22 12:23:28 wiz Exp $ # DISTNAME= joe2.8 -PKGNAME= joe-2.8 +PKGNAME= joe-2.8nb1 CATEGORIES= editors MASTER_SITES= ftp://ftp.std.com/src/editors/ EXTRACT_SUFX= .tar.Z diff --git a/editors/joe/distinfo b/editors/joe/distinfo index 20c2dc0a245..658be20d103 100644 --- a/editors/joe/distinfo +++ b/editors/joe/distinfo @@ -1,10 +1,11 @@ -$NetBSD: distinfo,v 1.3 2001/05/22 11:37:16 wiz Exp $ +$NetBSD: distinfo,v 1.4 2001/05/22 12:23:28 wiz Exp $ SHA1 (joe2.8.tar.Z) = b2846ac8469fbdbfc7428cc0baf3f874d564959c Size (joe2.8.tar.Z) = 322108 bytes SHA1 (patch-aa) = 19170144f58d33816198dca4038c1a91c4e914d6 -SHA1 (patch-ab) = 2195fa218870d73cf8a49d5710aa0e93be454f25 -SHA1 (patch-ac) = 5dbe49449eec2c4454ea0ccf75ab59fbebea6979 +SHA1 (patch-ab) = a38742e02a443700753ece6ebc19da1b5792752b +SHA1 (patch-ac) = bb3b2c874e688b0b5eda5396166f579dcccd797a SHA1 (patch-ad) = 1f27980091800279c220535c0ee75a5a1379b1d8 SHA1 (patch-ae) = 094bed1da04f8549d63f8532f62c79af4ec91433 SHA1 (patch-af) = 9382bdb7467a55c76ad63db5f59bc978940efdbd +SHA1 (patch-ag) = 3cce5d9fe611f7469b79e713bc8bd25c8ea41369 diff --git a/editors/joe/patches/patch-ab b/editors/joe/patches/patch-ab index edf91acefd6..aef0103fbfd 100644 --- a/editors/joe/patches/patch-ab +++ b/editors/joe/patches/patch-ab @@ -1,8 +1,84 @@ -$NetBSD: patch-ab,v 1.3 2001/05/22 11:37:16 wiz Exp $ +$NetBSD: patch-ab,v 1.4 2001/05/22 12:23:28 wiz Exp $ --- b.c.orig Fri Jan 20 09:38:25 1995 +++ b.c -@@ -1928,7 +1928,7 @@ +@@ -21,6 +21,9 @@ + #include <pwd.h> + #endif + #include <errno.h> ++#include <sys/file.h> ++#include <sys/types.h> ++#include <sys/stat.h> + + #include "config.h" + #include "blocks.h" +@@ -201,6 +204,7 @@ + if(prop) b->o=prop->o; + else b->o=pdefault; + mset(b->marks,0,sizeof(b->marks)); ++ b->filehandle = -1; /* initialize filehandle &&& ob */ + b->rdonly=0; + b->orphan=0; + b->oldcur=0; +@@ -255,6 +259,10 @@ + { + if(b && !--b->count) + { ++ if (b->filehandle != -1) { ++ /* close filehandle, free lock &&& ob */ ++ close (b->filehandle); ++ } + if(b->changed) abrerr(b->name); + if(b==errbuf) errbuf=0; + if(b->undo) undorm(b->undo); +@@ -1671,7 +1679,8 @@ + B *b; + long skip,amnt; + char *n; +- int nowrite=0; ++ struct stat sb; ++ int nowrite=0,fh=-1; + + if(!s || !s[0]) + { +@@ -1704,6 +1713,28 @@ + else fclose(fi); + fi=fopen(n,"r"); + if(!fi) nowrite=0; ++/*printf ("nowrite open=%i\n", nowrite); */ ++ ++ /* check file mod, if no write flags set, ++ joe in read only mode. &&& ob */ ++ ++ if (!nowrite) { ++ nowrite = (!stat (n, &sb)) && (!(sb.st_mode & (S_IWUSR | S_IWGRP | S_IWOTH))); ++ } ++/*printf ("nowrite stat=%i\n", nowrite); */ ++ ++ /* lock the file if writable, or go into read only mode if ++ already locked, */ ++ ++ if ((fi) && (!nowrite)) { ++ fh = dup( fileno(fi) ); ++ nowrite = (flock (fh, LOCK_EX | LOCK_NB)); ++ } ++/*printf ("nowrite flock=%i\n", nowrite); */ ++ ++/*nowrite = 1; */ /* for test purpose */ ++/*printf ("nowrite=%i\n", nowrite); */ ++ + } + joesep(n); + +@@ -1761,6 +1792,7 @@ + vsrm(n); + + b->er=error; ++ if( fh != -1 ) b->filehandle = fh; + return b; + } + +@@ -1928,7 +1960,7 @@ if(s[0]=='!') pclose(f); else #endif @@ -11,3 +87,23 @@ $NetBSD: patch-ab,v 1.3 2001/05/22 11:37:16 wiz Exp $ else fflush(f); opnerr:; +@@ -1990,7 +2022,18 @@ + { + long tim=time(0); + B *b; +- FILE *f=fopen("DEADJOE","a"); ++ FILE *f; ++ struct stat sb; ++ if ((lstat("DEADJOE", &sb) == 0) && (((sb.st_mode & S_IFLNK) && (sb.st_uid != getuid())) || (sb.st_nlink > 1))) ++ { ++ printf("*** JOE was aborted "); ++ if (sig) printf("by signal %d, cannot save DEADJOE due to unsafe symlink\n",sig); ++ else printf("because the terminal closed, cannot save DEADJOE due to unsafe symlink\n"); ++ if(sig) ttclsn(); ++ _exit(1); ++ } ++ f=fopen("DEADJOE","a"); ++ chmod("DEADJOE", S_IRUSR | S_IWUSR); + fprintf(f,"\n*** Modified files in JOE when it aborted on %s",ctime(&tim)); + if(sig) fprintf(f,"*** JOE was aborted by signal %d\n",sig); + else fprintf(f,"*** JOE was aborted because the terminal closed\n"); diff --git a/editors/joe/patches/patch-ac b/editors/joe/patches/patch-ac index 18d962f6532..0bc1c8c26ed 100644 --- a/editors/joe/patches/patch-ac +++ b/editors/joe/patches/patch-ac @@ -1,4 +1,4 @@ -$NetBSD: patch-ac,v 1.3 2001/05/22 11:37:16 wiz Exp $ +$NetBSD: patch-ac,v 1.4 2001/05/22 12:23:28 wiz Exp $ --- main.c.orig Sun Jan 22 01:21:08 1995 +++ main.c @@ -13,11 +13,10 @@ $NetBSD: patch-ac,v 1.3 2001/05/22 11:37:16 wiz Exp $ #include "config.h" #include "w.h" #include "tty.h" -@@ -186,6 +190,20 @@ - #else +@@ -187,6 +191,20 @@ run=namprt(argv[0]); #endif -+ + +#if defined(__FreeBSD__) || defined(__NetBSD__) + setlocale(LC_ALL, ""); + for(c=0;c<256;c++) @@ -31,6 +30,28 @@ $NetBSD: patch-ac,v 1.3 2001/05/22 11:37:16 wiz Exp $ + xlatc[c]=c; + } +#endif - ++ if(s=getenv("LINES")) sscanf(s,"%d",&lines); if(s=getenv("COLUMNS")) sscanf(s,"%d",&columns); + if(s=getenv("BAUD")) sscanf(s,"%u",&Baud); +@@ -233,20 +251,6 @@ + } + + #else +- +- s=vsncpy(NULL,0,sc(".")); +- s=vsncpy(sv(s),sv(run)); +- s=vsncpy(sv(s),sc("rc")); +- c=procrc(cap,s); +- if(c==0) goto donerc; +- if(c==1) +- { +- char buf[8]; +- fprintf(stderr,"There were errors in '%s'. Use it anyway?",s); +- fflush(stderr); +- fgets(buf,8,stdin); +- if(buf[0]=='y' || buf[0]=='Y') goto donerc; +- } + + vsrm(s); + s=getenv("HOME"); diff --git a/editors/joe/patches/patch-ag b/editors/joe/patches/patch-ag new file mode 100644 index 00000000000..bb8dfe70096 --- /dev/null +++ b/editors/joe/patches/patch-ag @@ -0,0 +1,12 @@ +$NetBSD: patch-ag,v 1.1 2001/05/22 12:23:28 wiz Exp $ + +--- b.h.orig Wed Dec 21 13:04:46 1994 ++++ b.h +@@ -60,6 +60,7 @@ + int rdonly; /* Set for read-only */ + int internal; /* Set for internal buffers */ + int er; /* Error code when file was loaded */ ++ int filehandle; /* File handle for locking */ + }; + + extern int force; /* Set to have final '\n' added to file */ |