diff options
author | schmonz <schmonz> | 2017-03-10 03:13:29 +0000 |
---|---|---|
committer | schmonz <schmonz> | 2017-03-10 03:13:29 +0000 |
commit | 7197840de1a401793fdf954de0cde284942731c8 (patch) | |
tree | 7959487af8fe39645abe459d4d8f520ecff6be5c /mail | |
parent | 428d56bb5ceb89435c8fc50c95d2836af60ac5b2 (diff) | |
download | pkgsrc-7197840de1a401793fdf954de0cde284942731c8.tar.gz |
Look up user/group IDs at runtime.
This lets us defer USERGROUP_PHASE to "pre-install", and is a step
closer to having the qmail users and groups be created at pkg_add time
(as with binary packages of typical software needing users and groups).
Based on Paul Fox's getpwnam.patch for qmail 0.96.
Diffstat (limited to 'mail')
-rw-r--r-- | mail/qmail/Makefile | 6 | ||||
-rw-r--r-- | mail/qmail/distinfo | 6 | ||||
-rw-r--r-- | mail/qmail/patches/patch-Makefile | 20 | ||||
-rw-r--r-- | mail/qmail/patches/patch-auto__uids.c | 59 | ||||
-rw-r--r-- | mail/qmail/patches/patch-auto__uids.h | 46 |
5 files changed, 131 insertions, 6 deletions
diff --git a/mail/qmail/Makefile b/mail/qmail/Makefile index fba3ed10319..ea8580dbb79 100644 --- a/mail/qmail/Makefile +++ b/mail/qmail/Makefile @@ -1,9 +1,9 @@ -# $NetBSD: Makefile,v 1.76 2016/04/10 16:39:28 joerg Exp $ +# $NetBSD: Makefile,v 1.77 2017/03/10 03:13:29 schmonz Exp $ # DISTNAME= ${PKGNAME_NOREV} PKGNAME= qmail-1.03 -PKGREVISION= 20 +PKGREVISION= 21 CATEGORIES= mail MASTER_SITES= http://qmail.org/ @@ -110,7 +110,7 @@ SUBST_SED.paths+= -e 's,@GREP@,${GREP:Q},g' SUBST_FILES.djbware+= cdb_seek.c dns.c -USERGROUP_PHASE= configure +USERGROUP_PHASE= pre-install PKG_GROUPS= qmail nofiles PKG_USERS+= alias:nofiles PKG_USERS+= qmaill:nofiles qmaild:nofiles qmailp:nofiles diff --git a/mail/qmail/distinfo b/mail/qmail/distinfo index 9506fa3c9eb..34e47d4872e 100644 --- a/mail/qmail/distinfo +++ b/mail/qmail/distinfo @@ -1,4 +1,4 @@ -$NetBSD: distinfo,v 1.28 2016/12/15 11:49:35 schmonz Exp $ +$NetBSD: distinfo,v 1.29 2017/03/10 03:13:29 schmonz Exp $ SHA1 (qmail-1.03.tar.gz) = 18fb960481291a0503e93a94df3f6094edb7f27a RMD160 (qmail-1.03.tar.gz) = b851f273f1d365d38efd949b1efcf35768ffa30f @@ -40,6 +40,8 @@ SHA1 (qmail-smtpd-viruscan-logging.patch) = ca7105b5561cf280e9e3a465d2d68a16673f RMD160 (qmail-smtpd-viruscan-logging.patch) = 79631cb7b5b120f98397011c4fb94726c48b83e4 SHA512 (qmail-smtpd-viruscan-logging.patch) = 6441dfb5dd8951a765d7172f44420d691976f4aa13c77ef16c459c6457cf32086a730278350bcb801ed4c986cbafa3c7a483c399ed073c02d53ad2ea18781efe Size (qmail-smtpd-viruscan-logging.patch) = 2157 bytes -SHA1 (patch-Makefile) = 66519495fcb2c051ef6a74b49498c565d89044d4 +SHA1 (patch-Makefile) = bd2b4bc966767df6e4b700213201fe2d38ca82aa +SHA1 (patch-auto__uids.c) = f900b61e047eb8776e5ff2e0381f2a53d49fafad +SHA1 (patch-auto__uids.h) = 5041dc91e51fc8413c0bf5e83c3d6b423f71cf86 SHA1 (patch-spawn.c) = aad06c4ed3ad4bd0e500ab561d7f7307c19e3283 SHA1 (patch-strerr_sys.c) = 15e6466c655058664cb660e5e12232bf45010814 diff --git a/mail/qmail/patches/patch-Makefile b/mail/qmail/patches/patch-Makefile index 07c835b43b8..d7dcbe76746 100644 --- a/mail/qmail/patches/patch-Makefile +++ b/mail/qmail/patches/patch-Makefile @@ -1,4 +1,4 @@ -$NetBSD: patch-Makefile,v 1.2 2014/05/30 21:35:04 schmonz Exp $ +$NetBSD: patch-Makefile,v 1.3 2017/03/10 03:13:29 schmonz Exp $ DESTDIR support. @@ -19,3 +19,21 @@ DESTDIR support. addresses.0: \ addresses.5 nroff -man addresses.5 > addresses.0 +@@ -110,7 +118,7 @@ auto_split.o: \ + compile auto_split.c + ./compile auto_split.c + +-auto_uids.c: \ ++auto_uids_orig.c: \ + auto-uid auto-gid conf-users conf-groups + ( ./auto-uid auto_uida `head -1 conf-users` \ + &&./auto-uid auto_uidd `head -2 conf-users | tail -1` \ +@@ -122,7 +130,7 @@ auto-uid auto-gid conf-users conf-groups + &&./auto-uid auto_uids `head -8 conf-users | tail -1` \ + &&./auto-gid auto_gidq `head -1 conf-groups` \ + &&./auto-gid auto_gidn `head -2 conf-groups | tail -1` \ +- ) > auto_uids.c.tmp && mv auto_uids.c.tmp auto_uids.c ++ ) > auto_uids_orig.c.tmp && mv auto_uids_orig.c.tmp auto_uids_orig.c + + auto_uids.o: \ + compile auto_uids.c diff --git a/mail/qmail/patches/patch-auto__uids.c b/mail/qmail/patches/patch-auto__uids.c new file mode 100644 index 00000000000..d49b768ad12 --- /dev/null +++ b/mail/qmail/patches/patch-auto__uids.c @@ -0,0 +1,59 @@ +$NetBSD: patch-auto__uids.c,v 1.1 2017/03/10 03:13:29 schmonz Exp $ + +Look up user/group IDs at runtime. Based on Paul Fox's getpwnam.patch. + +--- auto_uids.c.orig 2017-03-10 01:13:38.000000000 +0000 ++++ auto_uids.c +@@ -0,0 +1,52 @@ ++#include <pwd.h> ++#include <grp.h> ++#include <unistd.h> ++#include <sys/types.h> ++#include "auto_uids.h" ++ ++struct group *getgrnam(); ++struct passwd *getpwnam(); ++ ++static int ids[] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }; ++ ++static int ++name2uid(name) ++char *name; ++{ ++ struct passwd *pw; ++ pw = getpwnam(name); ++ if (!pw) _exit(113); ++ return (int)(pw->pw_uid); ++} ++ ++static int ++name2gid(name) ++char *name; ++{ ++ struct group *gr; ++ gr = getgrnam(name); ++ if (!gr) _exit(113); ++ return (int)(gr->gr_gid); ++} ++ ++int ++qm_id(id) ++int id; ++{ ++ if (ids[id] >= 0) return ids[id]; ++ ++ switch(id) { ++ case ID_OWNER: ids[id] = name2uid("root"); break; ++ case ID_ALIAS: ids[id] = name2uid("alias"); break; ++ case ID_DAEMON: ids[id] = name2uid("qmaild"); break; ++ case ID_LOG: ids[id] = name2uid("qmaill"); break; ++ case ID_PW: ids[id] = name2uid("qmailp"); break; ++ case ID_QUEUE: ids[id] = name2uid("qmailq"); break; ++ case ID_REMOTE: ids[id] = name2uid("qmailr"); break; ++ case ID_SEND: ids[id] = name2uid("qmails"); break; ++ case ID_QMAIL: ids[id] = name2gid("qmail"); break; ++ case ID_NOFILES: ids[id] = name2gid("nofiles"); break; ++ default: _exit(113); ++ } ++ return ids[id]; ++} diff --git a/mail/qmail/patches/patch-auto__uids.h b/mail/qmail/patches/patch-auto__uids.h new file mode 100644 index 00000000000..c0fe9df130b --- /dev/null +++ b/mail/qmail/patches/patch-auto__uids.h @@ -0,0 +1,46 @@ +$NetBSD: patch-auto__uids.h,v 1.1 2017/03/10 03:13:29 schmonz Exp $ + +Look up user/group IDs at runtime. Based on Paul Fox's getpwnam.patch. + +--- auto_uids.h.orig 1998-06-15 10:53:16.000000000 +0000 ++++ auto_uids.h +@@ -1,16 +1,29 @@ + #ifndef AUTO_UIDS_H + #define AUTO_UIDS_H + +-extern int auto_uida; +-extern int auto_uidd; +-extern int auto_uidl; +-extern int auto_uido; +-extern int auto_uidp; +-extern int auto_uidq; +-extern int auto_uidr; +-extern int auto_uids; ++#define ID_OWNER 0 ++#define ID_ALIAS 1 ++#define ID_DAEMON 2 ++#define ID_LOG 3 ++#define ID_PW 4 ++#define ID_QUEUE 5 ++#define ID_REMOTE 6 ++#define ID_SEND 7 ++#define ID_QMAIL 8 ++#define ID_NOFILES 9 + +-extern int auto_gidn; +-extern int auto_gidq; ++#define auto_uido qm_id(ID_OWNER) ++#define auto_uida qm_id(ID_ALIAS) ++#define auto_uidd qm_id(ID_DAEMON) ++#define auto_uidl qm_id(ID_LOG) ++#define auto_uidp qm_id(ID_PW) ++#define auto_uidq qm_id(ID_QUEUE) ++#define auto_uidr qm_id(ID_REMOTE) ++#define auto_uids qm_id(ID_SEND) ++ ++#define auto_gidq qm_id(ID_QMAIL) ++#define auto_gidn qm_id(ID_NOFILES) ++ ++extern int qm_id(); + + #endif |