=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tip/Attic/tip.c,v retrieving revision 1.36 retrieving revision 1.37 diff -u -r1.36 -r1.37 --- src/usr.bin/tip/Attic/tip.c 2009/12/12 13:38:09 1.36 +++ src/usr.bin/tip/Attic/tip.c 2009/12/12 18:14:00 1.37 @@ -1,4 +1,4 @@ -/* $OpenBSD: tip.c,v 1.36 2009/12/12 13:38:09 nicm Exp $ */ +/* $OpenBSD: tip.c,v 1.37 2009/12/12 18:14:00 nicm Exp $ */ /* $NetBSD: tip.c,v 1.13 1997/04/20 00:03:05 mellon Exp $ */ /* @@ -59,10 +59,6 @@ /* XXX preserve previous braindamaged behavior */ setboolean(value(DC), TRUE); - gid = getgid(); - egid = getegid(); - uid = getuid(); - euid = geteuid(); if (equal(__progname, "cu")) { cumode = 1; cumain(argc, argv); @@ -144,15 +140,6 @@ loginit(); /* - * Now that we have the logfile and the ACU open - * return to the real uid and gid. These things will - * be closed on exit. Swap real and effective uid's - * so we can get the original permissions back - * for removing the uucp lock. - */ - user_uid(); - - /* * Kludge, their's no easy way to get the initialization * in the right order, so force it here */ @@ -169,20 +156,17 @@ if (HW && ttysetup(number(value(BAUDRATE)))) { fprintf(stderr, "%s: bad baud rate %ld\n", __progname, number(value(BAUDRATE))); - daemon_uid(); (void)uu_unlock(uucplock); exit(3); } if ((p = con())) { printf("\07%s\n[EOT]\n", p); - daemon_uid(); (void)uu_unlock(uucplock); exit(1); } if (!HW && ttysetup(number(value(BAUDRATE)))) { fprintf(stderr, "%s: bad baud rate %ld\n", __progname, number(value(BAUDRATE))); - daemon_uid(); (void)uu_unlock(uucplock); exit(3); } @@ -260,7 +244,6 @@ void cleanup(int signo) { - daemon_uid(); (void)uu_unlock(uucplock); if (odisc) ioctl(0, TIOCSETD, &odisc); @@ -273,42 +256,6 @@ } /* - * Muck with user ID's. We are setuid to the owner of the lock - * directory when we start. user_uid() reverses real and effective - * ID's after startup, to run with the user's permissions. - * daemon_uid() switches back to the privileged uid for unlocking. - * Finally, to avoid running a shell with the wrong real uid, - * shell_uid() sets real and effective uid's to the user's real ID. - */ -static int uidswapped; - -void -user_uid(void) -{ - if (uidswapped == 0) { - seteuid(uid); - uidswapped = 1; - } -} - -void -daemon_uid(void) -{ - - if (uidswapped) { - seteuid(euid); - uidswapped = 0; - } -} - -void -shell_uid(void) -{ - setegid(gid); - seteuid(uid); -} - -/* * put the controlling keyboard into raw mode */ void @@ -440,8 +387,6 @@ /* XXX does not check for EOF */ for (p = etable; p->e_char; p++) if (p->e_char == gch) { - if ((p->e_flags&PRIV) && uid) - continue; printf("%s", ctrl(c)); (*p->e_func)(gch); return (0); @@ -523,11 +468,8 @@ printf("%c\r\n", c); for (p = etable; p->e_char; p++) { - if ((p->e_flags&PRIV) && uid) - continue; printf("%2s", ctrl(character(value(ESCAPE)))); - printf("%-2s %c %s\r\n", ctrl(p->e_char), - p->e_flags&EXP ? '*': ' ', p->e_help); + printf("%-2s %s\r\n", ctrl(p->e_char), p->e_help); } }