From owner-freebsd-audit Tue Aug 7 8:41:38 2001 Delivered-To: freebsd-audit@freebsd.org Received: from arb.arb.za.net (arb.arb.za.net [196.7.148.4]) by hub.freebsd.org (Postfix) with ESMTP id D7C8C37B401 for ; Tue, 7 Aug 2001 08:41:29 -0700 (PDT) (envelope-from mark@grondar.za) Received: (from uucp@localhost) by arb.arb.za.net (8.11.3/8.11.3) with UUCP id f77FfTD07711 for audit@freebsd.org; Tue, 7 Aug 2001 17:41:29 +0200 (SAST) (envelope-from mark@grondar.za) Received: from grondar.za (localhost [127.0.0.1]) by grimreaper.grondar.za (8.11.5/8.11.4) with ESMTP id f77Aw6Z43835 for ; Tue, 7 Aug 2001 11:58:06 +0100 (BST) (envelope-from mark@grondar.za) Message-Id: <200108071058.f77Aw6Z43835@grimreaper.grondar.za> To: audit@freebsd.org Subject: [patch] su(1) WARNS=2 cleanup Date: Tue, 07 Aug 2001 11:58:05 +0100 From: Mark Murray Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Hi Please review. The PAM_SET_ITEM() thing is a separate commit. Thanks! M Index: Makefile =================================================================== RCS file: /home/ncvs/src/usr.bin/su/Makefile,v retrieving revision 1.32 diff -u -d -r1.32 Makefile --- Makefile 2001/05/26 09:52:36 1.32 +++ Makefile 2001/08/06 14:04:14 @@ -5,6 +5,7 @@ DPADD+= ${LIBUTIL} ${LIBPAM} LDADD+= -lutil ${MINUSLPAM} +WARNS?= 2 BINMODE=4555 INSTALLFLAGS=-fschg Index: su.c =================================================================== RCS file: /home/ncvs/src/usr.bin/su/su.c,v retrieving revision 1.39 diff -u -d -r1.39 su.c --- su.c 2001/05/26 09:52:36 1.39 +++ su.c 2001/08/06 14:07:11 @@ -67,7 +67,7 @@ #include #include -#define PAM_END do { \ +#define PAM_END() do { \ int local_ret; \ if (pamh != NULL && creds_set) { \ local_ret = pam_setcred(pamh, PAM_DELETE_CRED); \ @@ -120,9 +120,10 @@ gid_t gid; int asme, ch, asthem, fastlogin, prio, i, setwhat, retcode, statusp, child_pid, child_pgrp, ret_pid; - char *p, *user, *shell, *username, *cleanenv, **nargv, **np, - *class, *mytty, shellbuf[MAXPATHLEN], - myhost[MAXHOSTNAMELEN + 1]; + char *username, *cleanenv, **nargv, + *class, shellbuf[MAXPATHLEN], + myhost[MAXHOSTNAMELEN + 1], **np; + const char *p, *user, *shell, *mytty; shell = class = cleanenv = NULL; asme = asthem = fastlogin = statusp = 0; @@ -213,6 +214,8 @@ errx(1, "pam_start: %s", pam_strerror(pamh, retcode)); } + PAM_SET_ITEM(PAM_RUSER, (const void *)getlogin()); + gethostname(myhost, sizeof(myhost)); PAM_SET_ITEM(PAM_RHOST, myhost); @@ -325,11 +328,11 @@ } if (ret_pid == -1) err(1, "waitpid"); - PAM_END; + PAM_END(); exit(statusp); case -1: err(1, "fork"); - PAM_END; + PAM_END(); exit(1); case 0: /* @@ -378,18 +381,19 @@ if (iscsh == YES) { if (fastlogin) - *np-- = "-f"; + (const char *)(*np--) = "-f"; if (asme) - *np-- = "-m"; + (const char *)(*np--) = "-m"; } /* csh strips the first character... */ - *np = asthem ? "-su" : iscsh == YES ? "_su" : "su"; + (const char *)(*np) + = asthem ? "-su" : iscsh == YES ? "_su" : "su"; if (ruid != 0) syslog(LOG_NOTICE, "%s to %s%s", username, user, ontty()); - execv(shell, np); + execv(shell, (char * const *)np); err(1, "%s", shell); } } To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message