From 2b8dc2ee5bee229a7e7886ee79e9dd4b2f8c6922 Mon Sep 17 00:00:00 2001 From: jbj Date: Thu, 2 Dec 1999 17:07:29 +0000 Subject: fail to package if absolute symlink points within build root. CVS patchset: 3452 CVS date: 1999/12/02 17:07:29 --- build/files.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'build') diff --git a/build/files.c b/build/files.c index 24b6e3c9e..7b3b4c3f9 100644 --- a/build/files.c +++ b/build/files.c @@ -886,8 +886,20 @@ static void genCpioListAndHeader(struct FileList *fl, &s, 1); buf[0] = '\0'; - if (S_ISLNK(flp->fl_mode)) - buf[readlink(flp->diskURL, buf, BUFSIZ)] = '\0'; + if (S_ISLNK(flp->fl_mode)) { + buf[Readlink(flp->diskURL, buf, BUFSIZ)] = '\0'; + if (fl->buildRootURL) { + const char * buildRoot; + (void) urlPath(fl->buildRootURL, &buildRoot); + + if (buf[0] == '/' && strcmp(buildRoot, "/") && + !strncmp(buf, buildRoot, strlen(buildRoot))) { + rpmError(RPMERR_BADSPEC, _("Symlink points to BuildRoot: %s -> %s"), + flp->fileURL, buf); + fl->processingFailed = 1; + } + } + } s = buf; headerAddOrAppendEntry(h, RPMTAG_FILELINKTOS, RPM_STRING_ARRAY_TYPE, &s, 1); -- cgit v1.2.3