From owner-freebsd-current Tue Nov 12 20:24:26 2002 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3774A37B401 for ; Tue, 12 Nov 2002 20:24:25 -0800 (PST) Received: from edgemaster.zombie.org (edgemaster.creighton.edu [147.134.112.68]) by mx1.FreeBSD.org (Postfix) with ESMTP id 653D543EAF for ; Tue, 12 Nov 2002 20:24:21 -0800 (PST) (envelope-from smkelly@zombie.org) Received: by edgemaster.zombie.org (Postfix, from userid 1001) id 4EE1841513; Tue, 12 Nov 2002 22:24:20 -0600 (CST) Date: Tue, 12 Nov 2002 22:24:20 -0600 From: Sean Kelly To: Eirik Nygaard Cc: current@freebsd.org Subject: Re: rmuser Message-ID: <20021113042420.GC30866@edgemaster.zombie.org> References: <20021109152711.GA746@eirikn.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20021109152711.GA746@eirikn.net> User-Agent: Mutt/1.5.1i Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Sat, Nov 09, 2002 at 04:27:12PM +0100, Eirik Nygaard wrote: > I have rewritten the rmuser.perl script into C. But got no experiense with at, and I see the the perl port got a function that removes any at jobs for the user being removed. So I wonderd if anyone could make a patch that does that, any feedback on the code or bug reports would also be greate. > > I have sent in a mail once before, fixed all the style bugs since them :) > The source is attached. I really hope somebody with a commit bit looks at this. I know I don't want to have to install Perl in 5.0-RELEASE just to use rmuser. This looks much better than the previous submissions. My two bit comments on the code below. > char passwd_file[] = "/etc/master.passwd"; > char passwd_tmp[PATH_MAX] = "/etc/ptmp.XXXXX"; > char *passwd_tmp2; > char group_file[] = "/etc/group"; > char new_group_file[] = "/etc/group.new"; > char mail_dir[] = "/var/mail"; > char crontab_dir[] = "/var/cron/tabs"; > char path[] = "/bin:/sbin:/usr/bin:/usr/sbin"; Consider making a pathnames.h > printf("\nMatching password entry: \n"); > printf("\t%s:%s:%d:%d:%s:%s\n", password->pw_name, password->pw_passwd, password->pw_uid, password->pw_gid, password->pw_dir, password->pw_shell); It looks like it is done this way now, but does anybody have any security/privacy concerns with showing the encrypted password like that? Is it necessary? Consider strlcpy() as well. I saw a few uses of strncpy(), but strlcpy() may be better. Should all your "Warning:" lines be sent to stderr? There are some places that seem to break style(9). You might want to wrap long lines and such. > void > del_mail() I *think* this should be del_mail(void). I'm not sure how strictly style(9) is followed and I don't see a direct example of it though. Somebody else who enjoys enforcing style(9) might want to reply. Anyway, I wish you luck in your conquest to contribute and help FreeBSD's journey away from Perl. I just hope somebody else other than me replies to this thread and helps you take steps to get this code into the world. -- Sean Kelly | PGP KeyID: 77042C7B smkelly@zombie.org | http://www.zombie.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message