diff --git a/auth.go b/auth.go index 5fecbd3..e9a494d 100644 --- a/auth.go +++ b/auth.go @@ -54,7 +54,7 @@ type Auth interface { func (conn *Conn) Auth(methods []Auth) error { if methods == nil { uid := strconv.Itoa(os.Geteuid()) - methods = []Auth{AuthExternal(uid), AuthCookieSha1(uid, getHomeDir())} + methods = []Auth{AuthExternal(), AuthCookieSha1(uid, getHomeDir())} } in := bufio.NewReader(conn.transport) err := conn.transport.SendNullByte() diff --git a/auth_external.go b/auth_external.go index 7e376d3..6153b75 100644 --- a/auth_external.go +++ b/auth_external.go @@ -1,24 +1,17 @@ package dbus -import ( - "encoding/hex" -) - -// AuthExternal returns an Auth that authenticates as the given user with the +// AuthExternal returns an Auth that authenticates with the // EXTERNAL mechanism. -func AuthExternal(user string) Auth { - return authExternal{user} +func AuthExternal() Auth { + return authExternal{} } // AuthExternal implements the EXTERNAL authentication mechanism. type authExternal struct { - user string } func (a authExternal) FirstData() ([]byte, []byte, AuthStatus) { - b := make([]byte, 2*len(a.user)) - hex.Encode(b, []byte(a.user)) - return []byte("EXTERNAL"), b, AuthOk + return []byte("EXTERNAL"), []byte, AuthOk } func (a authExternal) HandleData(b []byte) ([]byte, AuthStatus) {