Subject: Re: restricted pico

From: [email-masked] (David Drum)
Date: 18 May 1995 16:24:43 GMT

>>>>> "Alina" == Alina Bartsch <[email-masked]> writes:
In article <[email-masked]> [email-masked] (Alina Bartsch) writes:

    Alina> I will use the eitor pico in a application.
    Alina> I will that the user cannot change the filename (is an parameter)
    Alina> an not use the file browser.
    Alina> Could I define this in the environment or as parameters?

    Alina> :-?

I have written a patch that does this.  You have to call pico with a new
"-r" parameter.  Here it is:

diff -crw pine3.91/pico/file.c spine3.91/pico/file.c
*** pine3.91/pico/file.c	Tue Oct 11 18:47:07 1994
--- spine3.91/pico/file.c	Mon Apr  3 17:26:25 1995
***************
*** 332,343 ****
  	else
  	  fname[0] = '\0';
  
  	menu_write[0].name  = "^T";
  	menu_write[0].label = "To Files";
  	menu_write[1].name  = NULL;
  	for(;;){
! 	    s = mlreplyd("File Name to write : ", fname, NFILEN,
! 			 QDEFLT|QFFILE, menu_write);
  
  	    fixpath(fname, NFILEN);		/*  fixup ~ in file name  */
  
--- 337,353 ----
  	else
  	  fname[0] = '\0';
  
+ /*APG*/	if (gmode&MDSCUR)
+ /*APG*/	    menu_write[0].name	= NULL;
+ /*APG*/	else {
  	    menu_write[0].name  = "^T";
  	    menu_write[0].label = "To Files";
  	    menu_write[1].name  = NULL;
+ /*APG*/	} /* else */
  	for(;;){
! /*APG*/	    if (!(gmode&MDSCUR))
! 		s = mlreplyd("File Name to write : ", fname, NFILEN, QDEFLT|QFFILE, menu_write);
! /*APG*/	    else s = TRUE;
  
  	    fixpath(fname, NFILEN);		/*  fixup ~ in file name  */
  
***************
*** 397,402 ****
--- 407,417 ----
  
  	    if(strcmp(fname, curbp->b_fname) == 0)
  		break;
+ /*APG*/
+ /*APG*/	    if((gmode&MDSCUR) && homeless (fname)) {
+ /*APG*/	        emlwrite("Can't write file outside home directory in secure mode",NULL);
+ /*APG*/	        return(s);
+ /*APG*/	    };
  
  	    if((s=fexist(fname, "w", &l)) == FIOSUC){ /* exists.  overwrite? */
  
diff -crw pine3.91/pico/main.c spine3.91/pico/main.c
*** pine3.91/pico/main.c	Mon Sep 12 13:32:15 1994
--- spine3.91/pico/main.c	Wed Apr  5 09:24:39 1995
***************
*** 138,143 ****
--- 138,146 ----
  	      case 'w':			/* -w turn off word wrap */
  		gmode ^= MDWRAP;
  		break;
+ /*APG*/	      case 'r':			/* -r keep users from editing filename or getting out of work directory */
+ /*APG*/		gmode ^= MDSCUR;
+ /*APG*/		break;
  #if	defined(DOS)
  	      case 'c':			/* -c[nr][fb] colors */
  		if(carg + 1 < argc){
--
"That man has a rare gift for obfuscation." -- ST:DS9

---

From: [email-masked] (L.G. "Ted" Stern)
Date: 17 May 1995 23:38:56 GMT

Alina> :-?

Questions about the "pico" editor can and probably _should_ be addressed to
the "comp.mail.pine" newsgroup.  PICO was developed to work within the pine
mailer.

Followups redirected.

--
 =============================================> University of Washington
 Ted Stern (206) 685-9304                       Dept. of Applied Mathematics
 [email-masked]                     Box 352420
 http://www.amath.washington.edu/~stern/        Seattle, WA  98195-2420