summaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2010-12-15 09:42:03 +0200
committerPanu Matilainen <pmatilai@redhat.com>2010-12-15 09:44:54 +0200
commitbc457015f6c2c82f84a2ba7e805883944a64f679 (patch)
tree361205928162d445c8119c0540397bd0bea06955 /build
parenta2d002a34bc567e8ce88c9ed30270d55d7c904fd (diff)
downloadlibrpm-tizen-bc457015f6c2c82f84a2ba7e805883944a64f679.tar.gz
librpm-tizen-bc457015f6c2c82f84a2ba7e805883944a64f679.tar.bz2
librpm-tizen-bc457015f6c2c82f84a2ba7e805883944a64f679.zip
Remove the now unused user/group caching code
Diffstat (limited to 'build')
-rw-r--r--build/Makefile.am2
-rw-r--r--build/names.c180
-rw-r--r--build/rpmbuild_misc.h60
3 files changed, 1 insertions, 241 deletions
diff --git a/build/Makefile.am b/build/Makefile.am
index d229ee5e5..9012d9ed6 100644
--- a/build/Makefile.am
+++ b/build/Makefile.am
@@ -9,7 +9,7 @@ AM_CPPFLAGS += -I$(top_srcdir)/misc
usrlibdir = $(libdir)
usrlib_LTLIBRARIES = librpmbuild.la
librpmbuild_la_SOURCES = \
- build.c expression.c files.c misc.c names.c pack.c \
+ build.c expression.c files.c misc.c pack.c \
parseBuildInstallClean.c parseChangelog.c parseDescription.c \
parseFiles.c parsePreamble.c parsePrep.c parseReqs.c parseScript.c \
parseSpec.c reqprov.c rpmfc.c spec.c \
diff --git a/build/names.c b/build/names.c
deleted file mode 100644
index 838c1d5ba..000000000
--- a/build/names.c
+++ /dev/null
@@ -1,180 +0,0 @@
-/** \ingroup rpmbuild
- * \file build/names.c
- * Simple user/group name/id cache (plus hostname and buildtime)
- */
-
-
-#include "system.h"
-#include <pwd.h>
-#include <grp.h>
-#include <netdb.h>
-#include <rpm/rpmlog.h>
-#include <rpm/rpmstring.h>
-#include "build/rpmbuild_misc.h"
-#include "debug.h"
-
-#define UGIDMAX 1024
-
-typedef char * ugstr_t;
-
-static uid_t uids[UGIDMAX];
-static ugstr_t unames[UGIDMAX];
-static int uid_used = 0;
-
-static gid_t gids[UGIDMAX];
-static ugstr_t gnames[UGIDMAX];
-static int gid_used = 0;
-
-void freeNames(void)
-{
- int x;
- for (x = 0; x < uid_used; x++)
- unames[x] = _free(unames[x]);
- for (x = 0; x < gid_used; x++)
- gnames[x] = _free(gnames[x]);
-}
-
-const char *getUname(uid_t uid)
-{
- struct passwd *pw;
- int x;
-
- for (x = 0; x < uid_used; x++) {
- if (unames[x] == NULL) continue;
- if (uids[x] == uid)
- return unames[x];
- }
-
- /* XXX - This is the other hard coded limit */
- if (x == UGIDMAX)
- rpmlog(RPMLOG_CRIT, _("getUname: too many uid's\n"));
-
- if ((pw = getpwuid(uid)) == NULL)
- return NULL;
- uids[uid_used] = uid;
- unames[uid_used] = xstrdup(pw->pw_name);
- return unames[uid_used++];
-}
-
-const char *getUnameS(const char *uname)
-{
- struct passwd *pw;
- int x;
-
- for (x = 0; x < uid_used; x++) {
- if (unames[x] == NULL) continue;
- if (rstreq(unames[x],uname))
- return unames[x];
- }
-
- /* XXX - This is the other hard coded limit */
- if (x == UGIDMAX)
- rpmlog(RPMLOG_CRIT, _("getUnameS: too many uid's\n"));
-
- if ((pw = getpwnam(uname)) == NULL) {
- uids[uid_used] = -1;
- unames[uid_used] = xstrdup(uname);
- } else {
- uids[uid_used] = pw->pw_uid;
- unames[uid_used] = xstrdup(pw->pw_name);
- }
- return unames[uid_used++];
-}
-
-uid_t getUidS(const char *uname)
-{
- struct passwd *pw;
- int x;
-
- for (x = 0; x < uid_used; x++) {
- if (unames[x] == NULL) continue;
- if (rstreq(unames[x],uname))
- return uids[x];
- }
-
- /* XXX - This is the other hard coded limit */
- if (x == UGIDMAX)
- rpmlog(RPMLOG_CRIT, _("getUidS: too many uid's\n"));
-
- if ((pw = getpwnam(uname)) == NULL) {
- uids[uid_used] = -1;
- unames[uid_used] = xstrdup(uname);
- } else {
- uids[uid_used] = pw->pw_uid;
- unames[uid_used] = xstrdup(pw->pw_name);
- }
- return uids[uid_used++];
-}
-
-const char *getGname(gid_t gid)
-{
- struct group *gr;
- int x;
-
- for (x = 0; x < gid_used; x++) {
- if (gnames[x] == NULL) continue;
- if (gids[x] == gid)
- return gnames[x];
- }
-
- /* XXX - This is the other hard coded limit */
- if (x == UGIDMAX)
- rpmlog(RPMLOG_CRIT, _("getGname: too many gid's\n"));
-
- if ((gr = getgrgid(gid)) == NULL)
- return NULL;
- gids[gid_used] = gid;
- gnames[gid_used] = xstrdup(gr->gr_name);
- return gnames[gid_used++];
-}
-
-const char *getGnameS(const char *gname)
-{
- struct group *gr;
- int x;
-
- for (x = 0; x < gid_used; x++) {
- if (gnames[x] == NULL) continue;
- if (rstreq(gnames[x], gname))
- return gnames[x];
- }
-
- /* XXX - This is the other hard coded limit */
- if (x == UGIDMAX)
- rpmlog(RPMLOG_CRIT, _("getGnameS: too many gid's\n"));
-
- if ((gr = getgrnam(gname)) == NULL) {
- gids[gid_used] = -1;
- gnames[gid_used] = xstrdup(gname);
- } else {
- gids[gid_used] = gr->gr_gid;
- gnames[gid_used] = xstrdup(gr->gr_name);
- }
- return gnames[gid_used++];
-}
-
-gid_t getGidS(const char *gname)
-{
- struct group *gr;
- int x;
-
- for (x = 0; x < gid_used; x++) {
- if (gnames[x] == NULL) continue;
- if (rstreq(gnames[x], gname))
- return gids[x];
- }
-
- /* XXX - This is the other hard coded limit */
- if (x == UGIDMAX)
- rpmlog(RPMLOG_CRIT, _("getGidS: too many gid's\n"));
-
- if ((gr = getgrnam(gname)) == NULL) {
- gids[gid_used] = -1;
- gnames[gid_used] = xstrdup(gname);
- } else {
- gids[gid_used] = gr->gr_gid;
- gnames[gid_used] = xstrdup(gr->gr_name);
- }
- return gids[gid_used++];
-}
-
diff --git a/build/rpmbuild_misc.h b/build/rpmbuild_misc.h
index d1d1c8537..9665c975f 100644
--- a/build/rpmbuild_misc.h
+++ b/build/rpmbuild_misc.h
@@ -10,66 +10,6 @@ extern "C" {
#endif
/** \ingroup rpmbuild
- * Destroy uid/gid caches.
- */
-RPM_GNUC_INTERNAL
-void freeNames(void);
-
-/** \ingroup rpmbuild
- * Return cached user name from user id.
- * @todo Implement using hash.
- * @param uid user id
- * @return cached user name
- */
-RPM_GNUC_INTERNAL
-const char * getUname(uid_t uid);
-
-/** \ingroup rpmbuild
- * Return cached user name.
- * @todo Implement using hash.
- * @param uname user name
- * @return cached user name
- */
-RPM_GNUC_INTERNAL
-const char * getUnameS(const char * uname);
-
-/** \ingroup rpmbuild
- * Return cached user id.
- * @todo Implement using hash.
- * @param uname user name
- * @return cached uid
- */
-RPM_GNUC_INTERNAL
-uid_t getUidS(const char * uname);
-
-/** \ingroup rpmbuild
- * Return cached group name from group id.
- * @todo Implement using hash.
- * @param gid group id
- * @return cached group name
- */
-RPM_GNUC_INTERNAL
-const char * getGname(gid_t gid);
-
-/** \ingroup rpmbuild
- * Return cached group name.
- * @todo Implement using hash.
- * @param gname group name
- * @return cached group name
- */
-RPM_GNUC_INTERNAL
-const char * getGnameS(const char * gname);
-
-/** \ingroup rpmbuild
- * Return cached group id.
- * @todo Implement using hash.
- * @param gname group name
- * @return cached gid
- */
-RPM_GNUC_INTERNAL
-gid_t getGidS(const char * gname);
-
-/** \ingroup rpmbuild
* Truncate comment lines.
* @param s skip white space, truncate line at '#'
*/