Client umask settings not horoured in CIFS.

Anders Karlsson trudheim at gmail.com
Mon Feb 5 10:44:05 GMT 2007


Hi there,

During testing, it has been noted that the CIFS client does not seem to
honour the umask
setting. A simple test-case;

#include <sys/stat.h>
#include <fcntl.h>
#include <stdlib.h>
int
main(int argc, char **argv) {
 int fd = open("666",O_WRONLY|O_CREAT|O_TRUNC|O_SYNC,0666);
 if (fd == -1) {
   perror("open 666:");
   exit(1);
 }
 if (close(fd) == -1) {
   perror("close:");
   exit(1);
 }
 fd = open("660",O_WRONLY|O_CREAT|O_TRUNC|O_SYNC,0660);
 if (fd == -1) {
   perror("open 660:");
   exit(1);
 }
 if (close(fd) == -1) {
   perror("close:");
   exit(1);
 }
 fd = open("600",O_WRONLY|O_CREAT|O_TRUNC|O_SYNC,0600);
 if (fd == -1) {
   perror("open 600:");
   exit(1);
 }
 if (close(fd) == -1) {
   perror("close:");
   exit(1);
 }
 return 0;
}

will demonstrate this. If you set 'umask 0022' - the files '666' and '660'
should respectively end
up with permissions 644 and 640, but they do get the permissions 666 and
660. Is this the
designed and expected behaviour in the CIFS client, or is this
broken/missing functionality?

Thanks!

-- 
Anders Karlsson <trudheim at gmail.com>


More information about the samba-technical mailing list