From: Ken Hornstein Date: Thu, 18 May 2017 18:03:09 +0000 (-0400) Subject: Remove support for aliases based on Unix groups. X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/afaab789954a1b36a5469d52a88c111f36e7ab45?hp=54fb590089a2bf43d7987861ba57acb17cebc150 Remove support for aliases based on Unix groups. Remove support for expanding aliases based on group membership (=) and all users who have a particular primary group (+). This was the result of a discussion on nmh-workers; these features were of dubious value, likely not used, and interfered with RFC-2047 encoded names in alias files. --- diff --git a/docs/pending-release-notes b/docs/pending-release-notes index 23cc77c0..98a9958d 100644 --- a/docs/pending-release-notes +++ b/docs/pending-release-notes @@ -83,6 +83,8 @@ OBSOLETE FEATURES deprecated in nmh 1.6, and was removed in this release. - Support for multiple hostnames in the "servers" entry of mts.conf has been removed. +- Support in alias files for expanding aliases based on group membership + (=) and primary group (+) has been removed. ------------------- DEPRECATED FEATURES diff --git a/man/mh-alias.man b/man/mh-alias.man index f3c63c7c..71fbe3d1 100644 --- a/man/mh-alias.man +++ b/man/mh-alias.man @@ -42,8 +42,6 @@ where: .nf .IR address-group " := " address-list .RI " | < " file -.RI " | = " Unix-group -.RI " | + " Unix-group .IR address-list " := " address .RI " | " address-list ", " address @@ -60,9 +58,6 @@ that comment line. and .I file are Unix file names. -.I Unix-group -is a group name or number from -the system's group database. Alias file contents are case-insensitive, with the exception of filesystem path names. .PP @@ -77,26 +72,6 @@ starts with a \*(lq<\*(rq, the file named after the .I address-list for the alias. .PP -If the -.I address-group -starts with an \*(lq=\*(rq, the -system's group database -is consulted for the Unix-group named after the \*(lq=\*(rq. Each login name -occurring as a member of the group is added to the -.I address-list -for the alias. -.PP -In contrast, if the -.I address-group -starts with a \*(lq+\*(rq, the system's group database -is consulted to determine the group-id of the -Unix-group named after the \*(lq+\*(rq. Each login name occurring in the -system's password database -whose group-id is indicated by this group is -added to the -.I address-list -for the alias. -.PP In match, a trailing \*(lq*\*(rq on an alias will match just about anything appropriate. .PP @@ -132,8 +107,6 @@ sgroup: fred, fear, freida fred: frated@UCI.example b-people: Blind List: bill, betty Unix\-committee: #include #include -#include #include static int akvis; @@ -37,8 +36,6 @@ static char *scanp (char *); static char *getp (char *); static char *seekp (char *, char *, char **); static int addfile (struct aka *, char *); -static int addgroup (struct aka *, char *); -static int addmember (struct aka *, char *); static char *getalias (char *); static void add_aka (struct aka *, char *); static struct aka *akalloc (char *); @@ -249,28 +246,6 @@ alias (char *file) } break; - case '=': /* UNIX group */ - if (!*(cp = getp (pp + 1))) { - fclose (fp); - return AK_ERROR; - } - if (!addgroup (ak, cp)) { - fclose (fp); - return AK_NOGROUP; - } - break; - - case '+': /* UNIX group members */ - if (!*(cp = getp (pp + 1))) { - fclose (fp); - return AK_ERROR; - } - if (!addmember (ak, cp)) { - fclose (fp); - return AK_NOGROUP; - } - break; - default: /* list */ while ((cp = getalias (pp))) add_aka (ak, cp); @@ -374,67 +349,6 @@ addfile (struct aka *ak, char *file) } -static int -addgroup (struct aka *ak, char *grp) -{ - char *gp; - struct group *gr = getgrnam (grp); - struct home *hm = NULL; - - if (!gr) - gr = getgrgid (atoi (grp)); - if (!gr) { - akerrst = grp; - return 0; - } - - while ((gp = *gr->gr_mem++)) - { - struct passwd *pw; - for (hm = homehead; hm; hm = hm->h_next) - if (!strcmp (hm->h_name, gp)) { - add_aka (ak, hm->h_name); - break; - } - if ((pw = getpwnam(gp))) - { - hmalloc(pw); - add_aka (ak, gp); - } - } - - return 1; -} - - -static int -addmember (struct aka *ak, char *grp) -{ - gid_t gid; - struct group *gr = getgrnam (grp); - struct home *hm = NULL; - - if (gr) - gid = gr->gr_gid; - else { - gid = atoi (grp); - gr = getgrgid (gid); - } - if (!gr) { - akerrst = grp; - return 0; - } - - init_pw (); - - for (hm = homehead; hm; hm = hm->h_next) - if (hm->h_gid == gid) - add_aka (ak, hm->h_name); - - return 1; -} - - static char * getalias (char *addrs) {