Skip to content

Commit

Permalink
Merge branch 'fix-ldap'
Browse files Browse the repository at this point in the history
  • Loading branch information
shankerwangmiao committed Dec 7, 2023
2 parents 027ab3d + e3ff8f1 commit 7a1e80f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
15 changes: 7 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@ 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
run: |
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: |
Expand All @@ -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'

11 changes: 5 additions & 6 deletions ldap.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand All @@ -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)
}
}
Expand Down

0 comments on commit 7a1e80f

Please sign in to comment.