Date: Wed, 26 Jun 2002 12:34:04 -0700 (PDT) From: "George V. Kouryachy" <george@po.cs.msu.su> To: freebsd-gnats-submit@FreeBSD.org Subject: bin/39893: setusercontext library call differs umask Message-ID: <200206261934.g5QJY4UY060553@www.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 39893
>Category: bin
>Synopsis: setusercontext library call differs umask
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Wed Jun 26 13:10:15 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: George V. Kouryachy
>Release: 4.6-RELEASE
>Organization:
Moscow State Univercity
>Environment:
FreeBSD phobos.cs.msu.su 4.6-RELEASE FreeBSD 4.6-RELEASE #6: Thu Jun 20 17:44:32 MSD 2002 toor@phobos.cs.msu.su:/usr/obj/usr/src/sys/PHOBOS i386
>Description:
When calling setusercontext to the user, which have an 'umask=' entry in his login class in /etc/login.conf, some umasks are set incorrectly, E.g. when using "umask=407" (for incoming FTP not to store warez :) actually got d--xr-x--- instead of d-wxrwx--- permissions.
>How-To-Repeat:
Add
test:umask=407:\
:tc=default:
in /etc/login.conf, call cap_mkdb /etc/login.conf and do
pw user add tmpuser -L test -m
to create user.
simple program:
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <pwd.h>
#include <login_cap.h>
int main(int argc, char *argv[])
{
struct passwd *pw;
rmdir("/tmp/tmpdir");
pw = getpwnam("tmpuser");
setusercontext(NULL, pw, (uid_t)0,
LOGIN_SETLOGIN|LOGIN_SETGROUP|LOGIN_SETPRIORITY|
LOGIN_SETRESOURCES|LOGIN_SETUMASK);
system("mkdir /tmp/tmpdir");
system("ls -al /tmp/tmpdir");
}
will show
total 4
d--xr-x--- 2 root wheel 512 26 июн 23:32 .
drwxrwxrwt 8 root wheel 512 26 июн 23:32 ..
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200206261934.g5QJY4UY060553>
