Skip to content

Commit 7d7373e

Browse files
committed
Merge pull request #39 from alexlarsson/avoid-dynamic-linking
dbus: Hardcode EXTERNAL auth using the uid to avoid dynamic linking
2 parents d712533 + 759a16b commit 7d7373e

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

dbus/dbus.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ limitations under the License.
1818
package dbus
1919

2020
import (
21+
"os"
22+
"strconv"
2123
"strings"
2224
"sync"
2325

@@ -73,7 +75,12 @@ func (c *Conn) initConnection() error {
7375
return err
7476
}
7577

76-
err = c.sysconn.Auth(nil)
78+
// Only use EXTERNAL method, and hardcode the uid (not username)
79+
// to avoid a username lookup (which requires a dynamically linked
80+
// libc)
81+
methods := []dbus.Auth{dbus.AuthExternal(strconv.Itoa(os.Getuid()))}
82+
83+
err = c.sysconn.Auth(methods)
7784
if err != nil {
7885
c.sysconn.Close()
7986
return err

0 commit comments

Comments
 (0)