Hey all,

I think I might have found the problem.  The mail spool is open()ed, and
then the fd is checked to see if there is an error (as is proper).  The
problem is, the fchown/fchmod calls happen in the same logic path as
error handling, not in an else block.  The attached patch should fix it.

I have to note in passing, though, that I had to change the line

if (strcasecmp (create_mail_spool, "yes") == 0) {

to 

if (strcasecmp (def_create_mail_spool, "yes") == 0) {

to even enter this block in the first place - is there an incomplete
variable name transition, or am I doing something wrong?

--- src/useradd.c~      2006-06-21 10:51:01.000000000 +0100
+++ src/useradd.c       2006-06-21 10:51:17.000000000 +0100
@@ -1599,6 +1599,7 @@
                if (fd < 0) {
                        perror (_("Creating mailbox file"));
                        return;
+               } else {

                        gr = getgrnam ("mail");
                        if (!gr) {

Take care,
-- 
 -----------------------------------------------------------------
|   ,''`.                                            Stephen Gran |
|  : :' :                                        [EMAIL PROTECTED] |
|  `. `'                        Debian user, admin, and developer |
|    `-                                     http://www.debian.org |
 -----------------------------------------------------------------

Attachment: signature.asc
Description: Digital signature

Reply via email to