Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 24 Jan 2013 13:08:16 GMT
From:      Dmitry Kazarov <d.y.kazarov@mail.ru>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/175544: samba36 port: "net ads join -k" fails when LOGNAME env is not set
Message-ID:  <201301241308.r0OD8Gca094414@red.freebsd.org>
Resent-Message-ID: <201301241310.r0ODA0xP011249@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>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:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201301241308.r0OD8Gca094414>