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
[EMAIL PROTECTED] | http://www.zombie.org

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message
  • rmuser Eirik Nygaard
    • Sean Kelly

Reply via email to