diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bdeb9fd..4e929c7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,13 +5,13 @@ jobs: build: name: Build - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - - name: Set up Go 1.13 - uses: actions/setup-go@v1 + - name: Set up Go 1.19 + uses: actions/setup-go@v4 with: - go-version: 1.13 + go-version: 1.19 id: go - name: Install Cross binutils @@ -19,7 +19,7 @@ jobs: sudo apt-get install -y gcc-aarch64-linux-gnu - name: Check out code into the Go module directory - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Build run: | @@ -34,14 +34,13 @@ jobs: done - name: Keep artifacts - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: 'tunaccount-linux-arm64' path: 'tunaccount-linux-arm64-bin.tar.gz' - name: Keep artifacts - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: 'tunaccount-linux-amd64' path: 'tunaccount-linux-amd64-bin.tar.gz' - diff --git a/ldap.go b/ldap.go index 707d1f7..f16ec3f 100644 --- a/ldap.go +++ b/ldap.go @@ -180,9 +180,7 @@ func handleSearch(w ldap.ResponseWriter, m *ldap.Message) { e.AddAttribute("loginShell", ldapMsg.AttributeValue(u.LoginShell)) e.AddAttribute("homeDirectory", ldapMsg.AttributeValue(fmt.Sprintf("/home/%s", u.Username))) e.AddAttribute("userPassword", ldapMsg.AttributeValue(u.Password)) - e.AddAttribute("objectClass", "top") - e.AddAttribute("objectClass", "posixAccount") - e.AddAttribute("objectClass", "shadowAccount") + e.AddAttribute("objectClass", "top", "posixAccount", "shadowAccount") e.AddAttribute("shadowMax", "99999") w.Write(e) } @@ -192,11 +190,12 @@ func handleSearch(w ldap.ResponseWriter, m *ldap.Message) { e := ldap.NewSearchResultEntry(fmt.Sprintf("cn=%s,ou=groups,%s", g.Name, dcfg.LDAP.Suffix)) e.AddAttribute("cn", ldapMsg.AttributeValue(g.Name)) e.AddAttribute("gidNumber", ldapMsg.AttributeValue(strconv.Itoa(g.GID))) + members := []ldapMsg.AttributeValue{} for _, username := range g.Members { - e.AddAttribute("memberUid", ldapMsg.AttributeValue(username)) + members = append(members, ldapMsg.AttributeValue(username)) } - e.AddAttribute("objectClass", "top") - e.AddAttribute("objectClass", "posixGroup") + e.AddAttribute("memberUid", members...) + e.AddAttribute("objectClass", "top", "posixGroup") w.Write(e) } }