ovpn-admin icon indicating copy to clipboard operation
ovpn-admin copied to clipboard

Bug - user list only show 14 users

Open eatrisno opened this issue 2 years ago • 6 comments

is there any solution related with this issue ?

thanks

eatrisno avatar Apr 19 '22 08:04 eatrisno

which version of the openvpn server and ovpn-admin do you use? And what does your setup look like?

pashcovich avatar Apr 19 '22 08:04 pashcovich

I think it's because mgmtRead reads only 32768 bytes i fixed this problem in the following way

func (oAdmin *OvpnAdmin) mgmtRead(conn net.Conn) string {
    recvData := make([]byte, 32768)
    var out string
    var n int                                                                                                                                                                                                                         -
    var err error
    for {
       n, err = conn.Read(recvData)
       if n <= 0 || err != nil {
          break
       } else {
          out += string(recvData[:n])
          if strings.Contains(out, "type 'help' for more info") || strings.Contains(out, "END") {
             break
          }
       }
    }
    return out

Fhtgn avatar Apr 19 '22 13:04 Fhtgn

Oh, really. we need to check it

@vitaliy-sn fyi

pashcovich avatar Apr 19 '22 14:04 pashcovich

is it better to increase the size or loop the list?

eatrisno avatar Apr 19 '22 16:04 eatrisno

@eatrisno In my opinion, iteration is better. with it you will not reach the limit if the list of users grows even more

Fhtgn avatar Apr 19 '22 16:04 Fhtgn

noted, it is working btw I tried to increase the size and loop, both worked fine

eatrisno avatar Apr 20 '22 04:04 eatrisno