Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

checkStaticAddreesIsFree func error #40

Closed
dimaxwork opened this issue Jul 28, 2021 · 3 comments · Fixed by #47
Closed

checkStaticAddreesIsFree func error #40

dimaxwork opened this issue Jul 28, 2021 · 3 comments · Fixed by #47
Assignees
Labels
bug Something isn't working
Milestone

Comments

@dimaxwork
Copy link

I hae large users in server with ccd like this
user 1 -> 10.10.0.14
user n -> push 10.10.0.169 10.10.0.170
user m -> 10.10.0.173
user k -> 10.10.0.177
if I change address for user 1 - 10.10.0.14 to 10.10.0.17 i get an error - ClientAddress "10.10.0.17" already assigned to another user!
func checkStaticAddressIsFree(staticAddress string, username string) bool {
o := runBash(fmt.Sprintf("**grep -rl %s %s | grep -vx %s/%s | wc -l", staticAddress, ccdDir, ccdDir, username))

if strings.TrimSpace(o) == "0" {
    return true
}
return false

}
RETURN = 3 and give error, BUT the real address 10.10.0.17!!! Need help with grep!

@pashcovich pashcovich added the bug Something isn't working label Jul 28, 2021
@pashcovich pashcovich self-assigned this Jul 28, 2021
@pashcovich pashcovich added this to the 1.7 milestone Jul 28, 2021
@dimaxwork
Copy link
Author

dimaxwork commented Jul 28, 2021

grep -rl ' %s ' %s | grep -vx %s/%s | wc -l
give the right effect!
If searching a ip address i add space before and after and final grep returned 0

@pashcovich
Copy link
Contributor

maybe space before ip address is not necessary

@pashcovich
Copy link
Contributor

if you prepare and test you changes as PR maybe i will merge it and release this week

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants