From nobody@FreeBSD.org  Wed Jun 26 13:09:46 2002
Return-Path: <nobody@FreeBSD.org>
Received: from www.freebsd.org (www.FreeBSD.org [216.136.204.117])
	by hub.freebsd.org (Postfix) with ESMTP id 3F32237B79A
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 26 Jun 2002 13:01:43 -0700 (PDT)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.12.4/8.12.4) with ESMTP id g5QJY4OT060554
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 26 Jun 2002 12:34:04 -0700 (PDT)
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.12.4/8.12.4/Submit) id g5QJY4UY060553;
	Wed, 26 Jun 2002 12:34:04 -0700 (PDT)
Message-Id: <200206261934.g5QJY4UY060553@www.freebsd.org>
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: setusercontext library call differs umask
X-Send-Pr-Version: www-1.0

>Number:         39893
>Category:       bin
>Synopsis:       setusercontext library call differs umask
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Jun 26 13:10:15 PDT 2002
>Closed-Date:    Fri Jun 15 23:48:04 GMT 2007
>Last-Modified:  Fri Jun 15 23:48:04 GMT 2007
>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 &#1080;&#1102;&#1085; 23:32 .
drwxrwxrwt  8 root  wheel  512 26 &#1080;&#1102;&#1085; 23:32 ..


>Fix:
      
>Release-Note:
>Audit-Trail:

From: Maxim Maximov <mcsi@agava.com>
To: freebsd-gnats-submit@FreeBSD.org, george@po.cs.msu.su
Cc:  
Subject: Re: bin/39893: setusercontext library call differs umask
Date: Fri, 19 Jul 2002 20:16:21 +0400

 You should write umask=0407, as a umask is an octal value.
 
 -- 
 Maxim Maximov
 System Administrator
 AGAVA Software (http://www.agava.com)
 
State-Changed-From-To: open->closed 
State-Changed-By: linimon 
State-Changed-When: Fri Jun 15 23:47:30 UTC 2007 
State-Changed-Why:  
This appears to have been user error. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=39893 
>Unformatted:
