(Please CC. me because I'm not in freebsd-question@, thanks.)

We have a ftp site runs pure-ftpd-1.0.32 on a FreeBSD 7.2-RELEASE-p8 i386 box.
(I know 7.2 is very old, but that machine doesn't boot on later version...)

We find that the permission of newly created directory/files are always
750 and 640 (we set the umask to 022/133 for dir/file in pure-ftpd).
I try to trace the codes to figure it out. In order to find the problem,
I add some codes to print more information.

Here is the code for making a directory (FTP command MKD):


    /* my codes for debugging */
    fprintf(stderr, "getuid: %d\n", getuid());
    fprintf(stderr, "original umask: %o\n", umask((mode_t)0));
    fprintf(stderr, "umask: %o, mode: %o\n", u_mask_d, 0777 & ~u_mask_d);
    /* end of my codes */

    if ((mkdir(name, (mode_t) (0777 & ~u_mask_d))) < 0) {
#ifdef QUOTAS
        (void) quota_update(&quota, -1LL, 0LL, NULL);
#endif
        error(550, MSG_MKD_FAILURE);
    } else {
        addreply(257, "\"%s\" : " MSG_MKD_SUCCESS, name);
#ifndef MINIMAL
        cwd_failures = 0UL;
#endif
    }

    /* my codes for debugging */
    struct stat *tmp;
    stat(name, tmp);
    fprintf(stderr, "st_mode: %o\n", tmp->st_mode);
    /* end of my code */


When making the dir via ftp, the output is

getuid: 7000
original umask: 0
umask: 22, mode: 755
st_mode: 40750

I'm curious that why the st_mode is 750 not 755?
Is it normal or do I miss something?
Thanks!

Tz-Huan
_______________________________________________
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"

Reply via email to