From cbaba1a477680e29f4eb42017914db718e4cedcb Mon Sep 17 00:00:00 2001 From: Poul-Henning Kamp Date: Sat, 4 Feb 1995 19:20:49 +0000 Subject: [PATCH] A couple of sensible changes from down under... Reviewed by: phk Submitted by: Stephen McKay --- usr.sbin/ctm/ctm/ctm_pass1.c | 6 +++++- usr.sbin/ctm/ctm/ctm_pass2.c | 9 ++++++--- usr.sbin/ctm/ctm/ctm_pass3.c | 5 +++-- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/usr.sbin/ctm/ctm/ctm_pass1.c b/usr.sbin/ctm/ctm/ctm_pass1.c index d7784145a590..8d69b182c00b 100644 --- a/usr.sbin/ctm/ctm/ctm_pass1.c +++ b/usr.sbin/ctm/ctm/ctm_pass1.c @@ -6,7 +6,7 @@ * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp * ---------------------------------------------------------------------------- * - * $Id: ctm_pass1.c,v 1.4 1994/09/22 02:49:18 phk Exp $ + * $Id: ctm_pass1.c,v 1.5 1994/11/26 08:57:40 phk Exp $ * */ @@ -93,6 +93,10 @@ Pass1(FILE *fd) fprintf(stderr,"Warning: contains trailing slash\n"); slashwarn++; } + if (p[0] == '/') { + Fatal("Absolute paths are illegal."); + return Exit_Mess; + } break; case CTM_F_Uid: GETFIELD(p,sep); diff --git a/usr.sbin/ctm/ctm/ctm_pass2.c b/usr.sbin/ctm/ctm/ctm_pass2.c index ef6202cd933f..01546027bff3 100644 --- a/usr.sbin/ctm/ctm/ctm_pass2.c +++ b/usr.sbin/ctm/ctm/ctm_pass2.c @@ -6,7 +6,7 @@ * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp * ---------------------------------------------------------------------------- * - * $Id: ctm_pass2.c,v 1.4 1994/09/22 02:49:19 phk Exp $ + * $Id: ctm_pass2.c,v 1.5 1994/11/26 08:57:41 phk Exp $ * */ @@ -80,9 +80,12 @@ Pass2(FILE *fd) break; } if(-1 == stat(name,&st)) { - fprintf(stderr," %s: %s doesn't exists.\n", + fprintf(stderr," %s: %s doesn't exist.\n", sp->Key,name); - ret |= Exit_NotOK; + if (sp->Key[1] == 'R') + ret |= Exit_Forcible; + else + ret |= Exit_NotOK; break; } if (j & CTM_Q_Name_Dir) { diff --git a/usr.sbin/ctm/ctm/ctm_pass3.c b/usr.sbin/ctm/ctm/ctm_pass3.c index 3767b14b53d1..cb536fa97989 100644 --- a/usr.sbin/ctm/ctm/ctm_pass3.c +++ b/usr.sbin/ctm/ctm/ctm_pass3.c @@ -6,7 +6,7 @@ * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp * ---------------------------------------------------------------------------- * - * $Id: ctm_pass3.c,v 1.6 1994/11/27 16:01:29 bde Exp $ + * $Id: ctm_pass3.c,v 1.7 1994/12/04 04:47:31 phk Exp $ * */ @@ -160,7 +160,8 @@ Pass3(FILE *fd) if(!strcmp(sp->Key,"FR")) { if (0 != unlink(name)) { fprintf(stderr,"<%s> unlink failed\n",name); - WRONG + if (!Force) + WRONG } continue; }