mirror of
https://github.com/Li4n0/revsuit.git
synced 2026-09-26 00:21:54 +08:00
feat(ldap): add ldap protocol support (#50)
Co-authored-by: tardc <[email protected]> Co-authored-by: E99p1ant <[email protected]>
This commit is contained in:
+2
-2
@@ -191,10 +191,10 @@ func (s *Server) Run() {
|
||||
}
|
||||
}()
|
||||
|
||||
for s.Enable {
|
||||
for {
|
||||
tcpConn, err := listener.Accept()
|
||||
if err != nil {
|
||||
if !strings.Contains(err.Error(), net.ErrClosed.Error()) {
|
||||
if !errors.Is(err, net.ErrClosed) {
|
||||
log.Warn("RMI accept connection error: %v", err)
|
||||
} else {
|
||||
break
|
||||
|
||||
+3
-13
@@ -93,10 +93,7 @@ func ListRules(c *gin.Context) {
|
||||
}
|
||||
|
||||
db := database.DB.Model(&rmiRule)
|
||||
if rmiRule.Name != "" {
|
||||
db.Where("name = ?", rmiRule.Name)
|
||||
}
|
||||
db.Count(&count)
|
||||
db.Where(&rmiRule).Count(&count)
|
||||
|
||||
page, err := strconv.Atoi(c.Query("page"))
|
||||
if err != nil {
|
||||
@@ -130,10 +127,7 @@ func ListRules(c *gin.Context) {
|
||||
|
||||
// UpsertRules creates or updates rmi rule from user submit
|
||||
func UpsertRules(c *gin.Context) {
|
||||
var (
|
||||
rmiRule Rule
|
||||
update bool
|
||||
)
|
||||
var rmiRule Rule
|
||||
|
||||
if err := c.ShouldBind(&rmiRule); err != nil {
|
||||
c.JSON(400, gin.H{
|
||||
@@ -144,10 +138,6 @@ func UpsertRules(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
if rmiRule.ID != 0 {
|
||||
update = true
|
||||
}
|
||||
|
||||
if err := rmiRule.CreateOrUpdate(); err != nil {
|
||||
c.JSON(400, gin.H{
|
||||
"status": "failed",
|
||||
@@ -157,7 +147,7 @@ func UpsertRules(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
if update {
|
||||
if rmiRule.ID != 0 {
|
||||
log.Trace("RMI rule[id:%d] has been updated", rmiRule.ID)
|
||||
} else {
|
||||
log.Trace("RMI rule[id:%d] has been created", rmiRule.ID)
|
||||
|
||||
Reference in New Issue
Block a user