|
|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: F T
Length: 12297 (0x3009)
Types: TextFile
Names: »FIX#4«
└─⟦a0efdde77⟧ Bits:30001252 EUUGD11 Tape, 1987 Spring Conference Helsinki
└─⟦this⟧ »EUUGD11/euug-87hel/sec8/mcp/FIX#4«
This patch (#4) makes the following changes in the mcp 1.0 distribution
1) The remove-from- commands now display the correct number of items
that they remove (thanx to tadguy@odu.edu).
2) Mcp now warns of alias/user name collisions. It would be rather
disconcerting to create a new user and have his/her incoming personal
mail go whistling into a mailing list. (thanx to john@odu.edu)
3) Fixed operator precedence problems in load.c. Oddly enough,
lint didn't complain about this. (thanx to lenlo@miraculix.ida.liu.se)
4) Routines that access /usr/adm/lastlog now check for negative uids.
(thanx to lenlo@miraculix.ida.liu.se)
5) Corrected two typos that I'm surprised haven't cuased problems
before now. (thanx to lenlo@miraculix.ida.liu.se)
This patch will not work if patches #1-3 have not been applied. These patches
may be obtained from me; send requests to my e-mail address.
To apply this patch from readnews, vnews or rn, type "s|patch -d -p0 DIR",
with DIR being the directory where the mcp sources and documentation are kept.
Alternately you can save this article and later cd to DIR and "patch -p0 <
thisarticle". Don't leave off the "-p0". If you don't have patch (alas!),
you'll have to apply the context diffs below by hand.
kyle jones, odu computer science
ARPA: kyle@xanth.cs.odu.edu CSNET: kyle@odu.csnet
UUCP: kyle@xanth.uucp
Index: src/version.c
Prereq: (#3)
*** src/version.c.old Thu Feb 26 17:53:36 1987
--- src/version.c Thu Feb 26 17:51:56 1987
***************
*** 3,9 ****
char *n_copyright;
};
static struct notice Note = {
! "mcp version 1.0 (#3) ",
"(c) 1986 by Kyle E. Jones\n\n\
All sources and documentation of this mcp distribution are\n\
included in this copyright, but permission is granted to\n\
--- 3,9 ----
char *n_copyright;
};
static struct notice Note = {
! "mcp version 1.0 (#4) ",
"(c) 1986 by Kyle E. Jones\n\n\
All sources and documentation of this mcp distribution are\n\
included in this copyright, but permission is granted to\n\
Index: src/lastlog.c
*** src/lastlog.c.old Thu Mar 12 16:47:53 1987
--- src/lastlog.c Thu Mar 12 14:18:11 1987
***************
*** 53,58 ****
--- 53,60 ----
int uid;
{
+ if (uid < 0)
+ return &zero;
if (LL_FileDes == UNDEFINED)
setllent();
lseek(LL_FileDes, (long)(uid * sizeof(struct lastlog)), L_SET)<0
***************
*** 67,72 ****
--- 69,76 ----
{
int fd;
+ if (uid < 0)
+ return;
fd = open(LASTLOG, O_WRONLY);
if (fd < 0) {
perr(LASTLOG);
Index: src/add.c
*** src/add.c.old Thu Mar 12 17:40:28 1987
--- src/add.c Thu Mar 12 17:31:57 1987
***************
*** 83,88 ****
--- 83,93 ----
err1("%s: alias exists", (char *)v[1]);
return;
}
+ if (userexists((char *)v[1])) {
+ err1("%s is also an existing user!", (char *)v[1]);
+ if (no("Create the alias anyway? [n] "))
+ return;
+ }
addressv = get_gpa(257);
GetLine("Addresses: ", 256, &cc, addressv, &Null_List);
***************
*** 800,805 ****
--- 805,819 ----
err1("%s: user exists", (char *) v[1]);
return;
}
+ #ifdef SENDMAIL
+ if (c > 1 && aliasexists((char *)v[1])) {
+ (void) sprintf(prompt,
+ "%s is also a mail alias! Use anyway? [n] ",
+ v[1]);
+ if (no(prompt))
+ return;
+ }
+ #endif
if (c > 1) {
(void) strcpy((char *)cap, (char *)v[1]);
capitalize((char *)cap);
Index: src/update.c
*** src/update.c.old Thu Mar 12 17:40:48 1987
--- src/update.c Thu Mar 12 17:30:16 1987
***************
*** 87,92 ****
--- 87,94 ----
err1("%s: alias exists", (char *)*namev);
return;
}
+ if (userexists((char *)*namev))
+ err1("warning: %s is also an existing user.", (char *)*namev);
critical();
***************
*** 584,590 ****
}
if (eq(*namev, v[1]))
; /* no change */
! else if (rangeexists((char *)namev)) {
err("that name is taken");
return;
}
--- 586,592 ----
}
if (eq(*namev, v[1]))
; /* no change */
! else if (rangeexists((char *)*namev)) {
err("that name is taken");
return;
}
***************
*** 731,736 ****
--- 733,742 ----
*/
(void) sprintf(prompt, "Login name [%s]: ", ac->ac_name);
GetLine(prompt, 1, &cc, namev, &Null_List);
+ #ifdef SENDMAIL
+ if (cc && !eq(*namev, ac->ac_name) && aliasexists((char *)*namev))
+ err1("warning: %s is also a mail alias.", (char *)*namev);
+ #endif
/*
* Change real name?
Index: src/job.c
*** src/job.c.old Thu Mar 12 16:48:10 1987
--- src/job.c Thu Mar 12 13:21:20 1987
***************
*** 19,25 ****
#include <sys/wait.h>
#include <sys/types.h>
#include <sys/time.h>
! #include <sys/resource.h
#include <sys/dir.h>
#include <lastlog.h>
#include "sysdep.h"
--- 19,25 ----
#include <sys/wait.h>
#include <sys/types.h>
#include <sys/time.h>
! #include <sys/resource.h>
#include <sys/dir.h>
#include <lastlog.h>
#include "sysdep.h"
Index: src/misc.c
*** src/misc.c.old Thu Mar 12 16:48:12 1987
--- src/misc.c Thu Mar 12 12:30:04 1987
***************
*** 139,145 ****
--- 139,149 ----
if (strlen((char *)v[c-1]) < 8) {
(void) strcpy((char *)user, (char *)v[c-1]);
strlower((char *)user);
+ #ifdef SENDMAIL
+ if (!userexists((char *)user) && !aliasexists((char *)user)) {
+ #else
if (!userexists((char *)user)) {
+ #endif
scrub((char *)user);
return user;
}
***************
*** 153,159 ****
--- 157,167 ----
up.p_cp[2] = ((char *)v[2])[0];
up.p_cp[3] = '\0';
strlower((char *)user);
+ #ifdef SENDMAIL
+ if (!userexists((char *)user) && !aliasexists((char *)user)) {
+ #else
if (!userexists((char *)user)) {
+ #endif
scrub((char *)user);
return user;
}
***************
*** 172,178 ****
--- 180,190 ----
up.p_cp[tail++] = ((char *)v[0])[0];
up.p_cp[tail--] = '\0';
strlower((char *)user);
+ #ifdef SENDMAIL
+ while (userexists((char *)user) || aliasexists((char *)user))
+ #else
while (userexists((char *)user))
+ #endif
up.p_cp[tail]++;
scrub((char *)user);
return user;
Index: src/load.c
*** src/load.c.old Thu Mar 12 16:48:35 1987
--- src/load.c Thu Mar 12 13:32:00 1987
***************
*** 189,197 ****
user = ac->ac_name;
(void) orstrlist(&ac->ac_groups, &groups);
orstrlist(&ac->ac_classes, &classes)&&
! ModBits |= AC;
orstrlist(&ac->ac_sigs, &sigs)&&
! ModBits |= AC;
for (i=0; i<groups.l_count; i++) {
gm2 = getgmnam((char *)groups.l_list[i]);
if (instrlist(&gm2->gm_mem, (char *)user))
--- 189,197 ----
user = ac->ac_name;
(void) orstrlist(&ac->ac_groups, &groups);
orstrlist(&ac->ac_classes, &classes)&&
! (ModBits |= AC);
orstrlist(&ac->ac_sigs, &sigs)&&
! (ModBits |= AC);
for (i=0; i<groups.l_count; i++) {
gm2 = getgmnam((char *)groups.l_list[i]);
if (instrlist(&gm2->gm_mem, (char *)user))
***************
*** 219,226 ****
added++;
ac = getacnam((char *)user);
(void) orstrlist(&ac->ac_groups, &groups);
! orstrlist(&ac->ac_classes, &classes)&&ModBits|=AC;
! orstrlist(&ac->ac_sigs, &sigs)&&ModBits|=AC;
for (i=0; i<groups.l_count; i++) {
gm2 = getgmnam((char *)groups.l_list[i]);
if (instrlist(&gm2->gm_mem, (char *)user))
--- 219,226 ----
added++;
ac = getacnam((char *)user);
(void) orstrlist(&ac->ac_groups, &groups);
! orstrlist(&ac->ac_classes, &classes) && (ModBits|=AC);
! orstrlist(&ac->ac_sigs, &sigs) && (ModBits|=AC);
for (i=0; i<groups.l_count; i++) {
gm2 = getgmnam((char *)groups.l_list[i]);
if (instrlist(&gm2->gm_mem, (char *)user))
Index: src/remove.c
*** src/remove.c.old Thu Mar 12 16:50:20 1987
--- src/remove.c Thu Mar 12 14:07:55 1987
***************
*** 309,315 ****
removed++;
}
if (removed) {
! (void) printf("%d removed\n");
ModBits |= AC;
}
else
--- 309,315 ----
removed++;
}
if (removed) {
! (void) printf("%d removed\n", removed);
ModBits |= AC;
}
else
***************
*** 370,376 ****
removed++;
}
if (removed) {
! (void) printf("%d removed\n");
ModBits |= AC|GR;
}
else
--- 370,376 ----
removed++;
}
if (removed) {
! (void) printf("%d removed\n", removed);
ModBits |= AC|GR;
}
else
***************
*** 430,436 ****
removed++;
}
if (removed) {
! (void) printf("%d removed\n");
ModBits |= AC;
}
else
--- 430,436 ----
removed++;
}
if (removed) {
! (void) printf("%d removed\n", removed);
ModBits |= AC;
}
else
***************
*** 722,734 ****
strlistdel(&Users, (char *)ac->ac_name);
#ifdef SENDMAIL
! for (i=0; i < AliasList.l_count; i++) {
! al = (struct alias *) AliasList.l_list[i];
! if (instrlist(&al->al_addresses, (char *)ac->ac_name)) {
! strlistdel(&al->al_addresses, (char *)ac->ac_name);
! ModBits |= AL;
! }
! }
#endif
FREEMEM((char *)ac->ac_name);
--- 722,741 ----
strlistdel(&Users, (char *)ac->ac_name);
#ifdef SENDMAIL
! /*
! * If an alias exists that matches the user name we're removing
! * then DON'T remove the name from the aliases. The *alias*
! * was receiving the mail anyway, not the user, therefore the aliases
! * should in be unaffected.
! */
! if (!aliasexists((char *)ac->ac_name))
! for (i=0; i < AliasList.l_count; i++) {
! al = (struct alias *) AliasList.l_list[i];
! if (instrlist(&al->al_addresses, (char *)ac->ac_name)) {
! strlistdel(&al->al_addresses, (char *)ac->ac_name);
! ModBits |= AL;
! }
! }
#endif
FREEMEM((char *)ac->ac_name);
Index: src/report.c
*** src/report.c.old Thu Mar 12 18:33:03 1987
--- src/report.c Thu Mar 12 18:25:09 1987
***************
*** 110,115 ****
--- 110,126 ----
if (!instrlist(&s, (char *)ac->ac_sigs.l_list[i]))
strlistadd(&s, (char *)ac->ac_sigs.l_list[i]);
}
+ #ifdef SENDMAIL
+ if (aliasexists((char *)ac->ac_name)) {
+ al = getalnam((char *)ac->ac_name);
+ if (al->al_addresses.l_count == 0)
+ (void) printf("user \"%s\"'s mail disappears into an empty alias.\n", (char *)ac->ac_name);
+ else {
+ (void) printf("user \"%s\"'s mail is distributed to ", (char *) ac->ac_name);
+ listlist(&al->al_addresses);
+ }
+ }
+ #endif
/*
* Skip home directory and shell check if not the super-user,
* since not some shells may not be accessible to non
***************
*** 212,218 ****
if (ac->ac_gid == gm->gm_gid)
memcount++;
}
! printf("\"%s\", %d member%s, %d groupie%s\n", gm->gm_name,
memcount - gm->gm_mem.l_count, S(memcount - gm->gm_mem.l_count),
gm->gm_mem.l_count, S(gm->gm_mem.l_count));
}
--- 223,229 ----
if (ac->ac_gid == gm->gm_gid)
memcount++;
}
! (void) printf("\"%s\", %d member%s, %d groupie%s\n", gm->gm_name,
memcount - gm->gm_mem.l_count, S(memcount - gm->gm_mem.l_count),
gm->gm_mem.l_count, S(gm->gm_mem.l_count));
}
***************
*** 225,231 ****
if (instrlist(&ac->ac_classes, cs->cs_name))
memcount++;
}
! printf("\"%s\", %d member%s, ends %s\n", cs->cs_name,
memcount, S(memcount), when(cs->cs_exptime));
}
if (SigList.l_count) puts("== Sigs ==");
--- 236,242 ----
if (instrlist(&ac->ac_classes, cs->cs_name))
memcount++;
}
! (void) printf("\"%s\", %d member%s, ends %s\n", cs->cs_name,
memcount, S(memcount), when(cs->cs_exptime));
}
if (SigList.l_count) puts("== Sigs ==");
***************
*** 237,243 ****
if (instrlist(&ac->ac_sigs, sg->sg_name))
memcount++;
}
! printf("\"%s\", %d member%s, ends %s\n", sg->sg_name,
memcount, S(memcount), when(sg->sg_exptime));
}
return;
--- 248,254 ----
if (instrlist(&ac->ac_sigs, sg->sg_name))
memcount++;
}
! (void) printf("\"%s\", %d member%s, ends %s\n", sg->sg_name,
memcount, S(memcount), when(sg->sg_exptime));
}
return;
Index: man/mcp.n
*** man/mcp.n.old Thu Mar 12 18:42:50 1987
--- man/mcp.n Thu Mar 12 18:42:15 1987
***************
*** 343,348 ****
--- 343,351 ----
\(bu empty aliases
.br
.ti -3
+ \(bu alias/user name collisions
+ .br
+ .ti -3
\(bu empty classes and sigs
.br
.ti -3