|
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: T f
Length: 3001 (0xbb9) Types: TextFile Names: »freeze.c«
└─⟦a0efdde77⟧ Bits:30001252 EUUGD11 Tape, 1987 Spring Conference Helsinki └─⟦this⟧ »EUUGD11/euug-87hel/sec8/mcp/src/freeze.c«
#include <stdio.h> #include <sys/types.h> #include <lastlog.h> #include "sysdep.h" #include "macros.h" #include "mem.h" #include "lists.h" #include "account.h" #include "groupmap.h" #include "save.h" #include "sort.h" #ifdef BSD4_3 time_t time(); #endif #define DAY (4*21600) extern struct list AccountList; extern int ModBits; char *sprintf(), *when(); freezeuser(c, v) int c; char **v; { struct account *ac; struct groupmap *gm; char errmsg[LONG_BUF]; if (c != 2) { err1("usage: %s <user>", (char *)v[0]); return; } ac = getacnam((char *)v[1]); if (!ac) { err1("%s: no such user", (char *)v[1]); return; } if (eq(ac->ac_shell, FREEZE_SH)) { err1("%s: already frozen", (char *)ac->ac_name); return; } gm = getgmgid(ac->ac_gid); if (!gm) { (void) sprintf(errmsg, "no group for gid %d!", ac->ac_gid); err(errmsg); return; } if (vigexists(gm->gm_name)) { (void) sprintf(errmsg, "%s is in vig %s, freeze anyway? [yes] ", ac->ac_name, gm->gm_name); if (yes(errmsg) == 0) return; } critical(); FREEMEM((char *)ac->ac_shell); savestr((char **)&ac->ac_shell, FREEZE_SH); ModBits |= PW; puts("frozen"); non_critical(); return; } freezeinactives(c, v) int c; char **v; { struct account *ac; struct groupmap *gm; time_t now, toolong, doomsday; register int indx; int frozen = 0; if (c != 2) { err1("usage: %s <user>", (char *)v[0]); return; } if (!validint((char *)v[1])) { err2("%s: %s doesn't make sense as a number", (char *)v[0], (char *)v[1]); return; } now = time((time_t *)0); toolong = atoi((char *)v[1]) * DAY; if (toolong <= 0) { err1("%s: Not bloody likely.", (char *)v[0]);; return; } doomsday = now - toolong; (void) printf("The axe falls %s\n", when(doomsday)); critical(); for (indx=0; indx < AccountList.l_count; indx++) { ac = (struct account *) AccountList.l_list[indx]; if (ac->ac_ll.ll_time > doomsday) continue; /* * Don't freeze cryos again. */ if (eq(ac->ac_shell, FREEZE_SH)) continue; gm = getgmgid(ac->ac_gid); if (gm && vigexists(gm->gm_name)) continue; FREEMEM((char *)ac->ac_shell); savestr((char **)&ac->ac_shell, FREEZE_SH); frozen++; } if (frozen) { (void) printf("%d frozen\n", frozen); ModBits |= PW; } else err("no change"); non_critical(); return; } freezedeadbeats() { struct account *ac; struct groupmap *gm; register int indx; int frozen = 0; critical(); for (indx=0; indx < AccountList.l_count; indx++) { ac = (struct account *) AccountList.l_list[indx]; if (ac->ac_classes.l_count || ac->ac_sigs.l_count) continue; /* * Don't freeze cryos again. */ if (eq(ac->ac_shell, FREEZE_SH)) continue; gm = getgmgid(ac->ac_gid); if (gm && vigexists(gm->gm_name)) continue; FREEMEM((char *)ac->ac_shell); savestr((char **)&ac->ac_shell, FREEZE_SH); frozen++; } if (frozen) { (void) printf("%d frozen\n", frozen); ModBits |= PW; } else err("no change"); non_critical(); return; }