pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/mail/qmail Look up user/group IDs at runtime.



details:   https://anonhg.NetBSD.org/pkgsrc/rev/7ec780f1e776
branches:  trunk
changeset: 359415:7ec780f1e776
user:      schmonz <schmonz%pkgsrc.org@localhost>
date:      Fri Mar 10 03:13:29 2017 +0000

description:
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:

 mail/qmail/Makefile                   |   6 +-
 mail/qmail/distinfo                   |   6 ++-
 mail/qmail/patches/patch-Makefile     |  20 +++++++++++-
 mail/qmail/patches/patch-auto__uids.c |  59 +++++++++++++++++++++++++++++++++++
 mail/qmail/patches/patch-auto__uids.h |  46 +++++++++++++++++++++++++++
 5 files changed, 131 insertions(+), 6 deletions(-)

diffs (187 lines):

diff -r ddc76af79083 -r 7ec780f1e776 mail/qmail/Makefile
--- a/mail/qmail/Makefile       Thu Mar 09 23:47:47 2017 +0000
+++ b/mail/qmail/Makefile       Fri Mar 10 03:13:29 2017 +0000
@@ -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_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 -r ddc76af79083 -r 7ec780f1e776 mail/qmail/distinfo
--- a/mail/qmail/distinfo       Thu Mar 09 23:47:47 2017 +0000
+++ b/mail/qmail/distinfo       Fri Mar 10 03:13:29 2017 +0000
@@ -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 @@
 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 -r ddc76af79083 -r 7ec780f1e776 mail/qmail/patches/patch-Makefile
--- a/mail/qmail/patches/patch-Makefile Thu Mar 09 23:47:47 2017 +0000
+++ b/mail/qmail/patches/patch-Makefile Fri Mar 10 03:13:29 2017 +0000
@@ -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 @@
  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 -r ddc76af79083 -r 7ec780f1e776 mail/qmail/patches/patch-auto__uids.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/mail/qmail/patches/patch-auto__uids.c     Fri Mar 10 03:13:29 2017 +0000
@@ -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 -r ddc76af79083 -r 7ec780f1e776 mail/qmail/patches/patch-auto__uids.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/mail/qmail/patches/patch-auto__uids.h     Fri Mar 10 03:13:29 2017 +0000
@@ -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



Home | Main Index | Thread Index | Old Index