From owner-freebsd-ports-bugs@FreeBSD.ORG Thu Jan 24 13:10:01 2013 Return-Path: Delivered-To: freebsd-ports-bugs@smarthost.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 29350C5A for ; Thu, 24 Jan 2013 13:10:01 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id 0BCD474D for ; Thu, 24 Jan 2013 13:10:01 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.6/8.14.6) with ESMTP id r0ODA0Se011253 for ; Thu, 24 Jan 2013 13:10:00 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.6/8.14.6/Submit) id r0ODA0xP011249; Thu, 24 Jan 2013 13:10:00 GMT (envelope-from gnats) Resent-Date: Thu, 24 Jan 2013 13:10:00 GMT Resent-Message-Id: <201301241310.r0ODA0xP011249@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Dmitry Kazarov Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id ACEBBC39 for ; Thu, 24 Jan 2013 13:08:17 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22]) by mx1.freebsd.org (Postfix) with ESMTP id 9F5C773C for ; Thu, 24 Jan 2013 13:08:17 +0000 (UTC) Received: from red.freebsd.org (localhost [127.0.0.1]) by red.freebsd.org (8.14.5/8.14.5) with ESMTP id r0OD8Gj1094415 for ; Thu, 24 Jan 2013 13:08:16 GMT (envelope-from nobody@red.freebsd.org) Received: (from nobody@localhost) by red.freebsd.org (8.14.5/8.14.5/Submit) id r0OD8Gca094414; Thu, 24 Jan 2013 13:08:16 GMT (envelope-from nobody) Message-Id: <201301241308.r0OD8Gca094414@red.freebsd.org> Date: Thu, 24 Jan 2013 13:08:16 GMT From: Dmitry Kazarov To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Subject: ports/175544: samba36 port: "net ads join -k" fails when LOGNAME env is not set X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Jan 2013 13:10:01 -0000 >Number: 175544 >Category: ports >Synopsis: samba36 port: "net ads join -k" fails when LOGNAME env is not set >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Jan 24 13:10:00 UTC 2013 >Closed-Date: >Last-Modified: >Originator: Dmitry Kazarov >Release: 9.0-RELEASE >Organization: >Environment: FreeBSD free-int.tp-local.ru 9.0-RELEASE FreeBSD 9.0-RELEASE #0: Tue Jan 3 07:15:25 UTC 2012 root@obrian.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC i386 >Description: su command with full login simulation ("-l" or "-" option) clears LOGNAME environment. The absence of LOGNAME environment makes "net ads join -k" to use 'anonymous' connections to domain controller and the joining fails. # kinit domadmin domadmin@DOMAIN.LOC's Password: # unset LOGNAME # net ads join -k Failed to join domain: failed to join domain 'DOMAIN.LOC' over rpc: Access denied # export LOGNAME=root # net ads join -k Using short domain name -- DOMAIN Joined 'HOSTNAME' to realm 'domain.loc' It's really not a problem to set the LOGNAME environment, but importance of this environment is not documented and 'net' issues no warning so it's very hard to find a source of a problem. Attached patch adds such warning. >How-To-Repeat: >Fix: Patch attached with submission follows: --- ./source3/utils/net.c.orig 2013-01-24 15:46:04.000000000 +0400 +++ ./source3/utils/net.c 2013-01-24 16:37:06.000000000 +0400 @@ -898,8 +898,13 @@ set_global_myname(c->opt_requester_name); } - if (!c->opt_user_name && getenv("LOGNAME")) { - c->opt_user_name = getenv("LOGNAME"); + if (!c->opt_user_name) { + if(getenv("LOGNAME")) + c->opt_user_name = getenv("LOGNAME"); + else + d_fprintf(stderr, + _("Environment LOGNAME is not defined." + " Trying anonymous access.\n")); } if (!c->opt_workgroup) { >Release-Note: >Audit-Trail: >Unformatted: