ports/175544: samba36 port: "net ads join -k" fails when LOGNAME env is not set

Dmitry Kazarov d.y.kazarov at mail.ru
Thu Jan 24 13:10:01 UTC 2013


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


More information about the freebsd-ports-bugs mailing list