- fix: redundant entries in file manifests handled correctly (#46914).
- map uid/gid from metadata into payload headers. CVS patchset: 4915 CVS date: 2001/07/03 19:26:58
This commit is contained in:
parent
c33e408649
commit
20c2a42d4f
2
CHANGES
2
CHANGES
|
@ -146,6 +146,8 @@
|
|||
- fix: disambiguate typedef and struct name(s) for kpackage.
|
||||
- update intl dirs to gettext-0.10.38.
|
||||
- fix: sanity check for header size added in headerCopyLoad() (#46469).
|
||||
- fix: redundant entries in file manifests handled correctly (#46914).
|
||||
- map uid/gid from metadata into payload headers.
|
||||
|
||||
4.0 -> 4.0.[12]
|
||||
- add doxygen and lclint annotations most everywhere.
|
||||
|
|
|
@ -1017,22 +1017,15 @@ static void genCpioListAndHeader(/*@partial@*/ FileList fl,
|
|||
for (i = 0, flp = fl->fileList; i < fl->fileListRecsUsed; i++, flp++) {
|
||||
char *s;
|
||||
|
||||
#ifdef DYING
|
||||
if (i < (fl->fileListRecsUsed - 1) &&
|
||||
!strcmp(flp->fileURL, flp[1].fileURL))
|
||||
{
|
||||
rpmError(RPMERR_BADSPEC, _("File listed twice: %s\n"),
|
||||
flp->fileURL);
|
||||
fl->processingFailed = 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Merge duplicate entries. */
|
||||
while (i < (fl->fileListRecsUsed - 1) &&
|
||||
!strcmp(flp->fileURL, flp[1].fileURL)) {
|
||||
|
||||
/* Two entries for the same file found, merge the entries. */
|
||||
|
||||
rpmMessage(RPMMESS_WARNING, _("File listed twice: %s\n"),
|
||||
flp->fileURL);
|
||||
|
||||
/* file flags */
|
||||
flp[1].flags |= flp->flags;
|
||||
|
||||
|
@ -1247,6 +1240,11 @@ static void genCpioListAndHeader(/*@partial@*/ FileList fl,
|
|||
for (i = 0, flp = fl->fileList; i < fi->fc; i++, flp++) {
|
||||
char * b;
|
||||
|
||||
/* Skip (possible) duplicate file entries, use last entry info. */
|
||||
while (((flp - fl->fileList) < (fl->fileListRecsUsed - 1)) &&
|
||||
!strcmp(flp->fileURL, flp[1].fileURL))
|
||||
flp++;
|
||||
|
||||
/* Create disk directory and base name. */
|
||||
fi->dil[i] = i;
|
||||
fi->dnl[fi->dil[i]] = d;
|
||||
|
@ -1273,8 +1271,10 @@ static void genCpioListAndHeader(/*@partial@*/ FileList fl,
|
|||
continue;
|
||||
}
|
||||
fi->actions[i] = FA_COPYOUT;
|
||||
fi->fuids[i] = flp->fl_uid;
|
||||
fi->fgids[i] = flp->fl_gid;
|
||||
fi->fuids[i] = getUidS(flp->uname);
|
||||
fi->fgids[i] = getGidS(flp->gname);
|
||||
if (fi->fuids[i] == (uid_t)-1) fi->fuids[i] = 0;
|
||||
if (fi->fgids[i] == (gid_t)-1) fi->fgids[i] = 0;
|
||||
fi->fmapflags[i] =
|
||||
CPIO_MAP_PATH | CPIO_MAP_MODE | CPIO_MAP_UID | CPIO_MAP_GID;
|
||||
if (isSrc)
|
||||
|
@ -1905,11 +1905,12 @@ int processSourceFiles(Spec spec)
|
|||
|
||||
spec->sourceCpioList = NULL;
|
||||
|
||||
fl.fileList = xmalloc((spec->numSources + 1) * sizeof(*fl.fileList));
|
||||
fl.fileList = xcalloc((spec->numSources + 1), sizeof(*fl.fileList));
|
||||
fl.processingFailed = 0;
|
||||
fl.fileListRecsUsed = 0;
|
||||
fl.totalFileSize = 0;
|
||||
fl.prefix = NULL;
|
||||
fl.buildRootURL = NULL;
|
||||
|
||||
s = getStringBuf(sourceFiles);
|
||||
files = splitString(s, strlen(s), '\n');
|
||||
|
|
|
@ -69,6 +69,27 @@ const char *getUnameS(const char *uname)
|
|||
return unames[x];
|
||||
}
|
||||
|
||||
uid_t getUidS(const char *uname)
|
||||
{
|
||||
struct passwd *pw;
|
||||
int x;
|
||||
|
||||
for (x = 0; x < uid_used; x++) {
|
||||
if (!strcmp(unames[x],uname))
|
||||
return uids[x];
|
||||
}
|
||||
|
||||
/* XXX - This is the other hard coded limit */
|
||||
if (x == 1024)
|
||||
rpmlog(RPMLOG_CRIT, _("getUidS: too many uid's\n"));
|
||||
uid_used++;
|
||||
|
||||
pw = getpwnam(uname);
|
||||
uids[x] = (pw ? pw->pw_uid : -1);
|
||||
unames[x] = (pw ? xstrdup(pw->pw_name) : xstrdup(uname));
|
||||
return uids[x];
|
||||
}
|
||||
|
||||
const char *getGname(gid_t gid)
|
||||
{
|
||||
struct group *gr;
|
||||
|
@ -110,6 +131,27 @@ const char *getGnameS(const char *gname)
|
|||
gnames[x] = (gr ? xstrdup(gr->gr_name) : xstrdup(gname));
|
||||
return gnames[x];
|
||||
}
|
||||
|
||||
gid_t getGidS(const char *gname)
|
||||
{
|
||||
struct group *gr;
|
||||
int x;
|
||||
|
||||
for (x = 0; x < gid_used; x++) {
|
||||
if (!strcmp(gnames[x], gname))
|
||||
return gids[x];
|
||||
}
|
||||
|
||||
/* XXX - This is the other hard coded limit */
|
||||
if (x == 1024)
|
||||
rpmlog(RPMLOG_CRIT, _("getGidS: too many gid's\n"));
|
||||
gid_used++;
|
||||
|
||||
gr = getgrnam(gname);
|
||||
gids[x] = (gr ? gr->gr_gid : -1);
|
||||
gnames[x] = (gr ? xstrdup(gr->gr_name) : xstrdup(gname));
|
||||
return gids[x];
|
||||
}
|
||||
/*@=nullderef@*/
|
||||
|
||||
int_32 *const getBuildTime(void)
|
||||
|
|
|
@ -100,6 +100,14 @@ void freeNames(void)
|
|||
*/
|
||||
/*@observer@*/ const char * getUnameS(const char * uname) /*@*/;
|
||||
|
||||
/** \ingroup rpmbuild
|
||||
* Return cached user id.
|
||||
* @todo Implement using hash.
|
||||
* @param user name
|
||||
* @return cached uid
|
||||
*/
|
||||
uid_t getUidS(const char * uname) /*@*/;
|
||||
|
||||
/** \ingroup rpmbuild
|
||||
* Return cached group name from group id.
|
||||
* @todo Implement using hash.
|
||||
|
@ -116,6 +124,14 @@ void freeNames(void)
|
|||
*/
|
||||
/*@observer@*/ const char * getGnameS(const char * gname) /*@*/;
|
||||
|
||||
/** \ingroup rpmbuild
|
||||
* Return cached group id.
|
||||
* @todo Implement using hash.
|
||||
* @param group name
|
||||
* @return cached gid
|
||||
*/
|
||||
gid_t getGidS(const char * gname) /*@*/;
|
||||
|
||||
/** \ingroup rpmbuild
|
||||
* Return build hostname.
|
||||
* @return build hostname
|
||||
|
|
|
@ -630,7 +630,7 @@ int fsmMapAttrs(FSM_t fsm)
|
|||
(fi->fgids ? fi->fgids[i] : fi->gid); /* XXX chmod g-s */
|
||||
|
||||
if (fsm->mapFlags & CPIO_MAP_MODE)
|
||||
st->st_mode = (st->st_mode & S_IFMT) | finalMode;
|
||||
st->st_mode = (st->st_mode & S_IFMT) | (finalMode & ~S_IFMT);
|
||||
if (fsm->mapFlags & CPIO_MAP_UID)
|
||||
st->st_uid = finalUid;
|
||||
if (fsm->mapFlags & CPIO_MAP_GID)
|
||||
|
@ -1919,7 +1919,7 @@ if (!(fsm->mapFlags & CPIO_ALL_HARDLINKS)) break;
|
|||
rc = Readlink(fsm->path, fsm->rdbuf, fsm->rdsize - 1);
|
||||
if (_fsm_debug && (stage & FSM_SYSCALL))
|
||||
rpmMessage(RPMMESS_DEBUG, " %8s (%s, rdbuf, %d) %s\n", cur,
|
||||
fsm->path, (int)fsm->rdlen, (rc < 0 ? strerror(errno) : ""));
|
||||
fsm->path, (int)(fsm->rdsize -1), (rc < 0 ? strerror(errno) : ""));
|
||||
if (rc < 0) rc = CPIOERR_READLINK_FAILED;
|
||||
else {
|
||||
fsm->rdnb = rc;
|
||||
|
|
Loading…
Reference in New Issue