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

Refactoring the addagent files for improving the usability #757

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

netman2k
Copy link

@netman2k netman2k commented Mar 4, 2016

I found that If I use the getFullnameById function directly from other files. it could not find the full name properly. cause the code tries to load the key file statically even though it uses chroot environment.

I think that it should be changed as the diff.

Please investigate this problem and merge them if you do not find any problems.

Review on Reviewable

@netman2k
Copy link
Author

netman2k commented Mar 4, 2016

I use the ossec-authd daemon to register new agents for automation.
the problem is that there are too many duplicated agent record in the clients.key file.
so I started to modifying it.
but I think some codes have to be changed to increase the usability. cause you can not call these function directly. for instance, some function needs an environment variable to remove the agent.

so I changed the addagent/manage_agents.c file as below:

  1. creating a new function named remove_agent_by_id, which requires an id to remove the record.
  2. modified the previous function, remove_agent, this is no longer contains remove functionality.
    instead, it uses the remove_agent_by_id function.

@netman2k netman2k changed the title Need to change the codes that loads the key file to read or write Refactoring the addagent files for improving the usability Mar 4, 2016
@jrossi
Copy link
Member

jrossi commented Mar 12, 2016

Reviewed 3 of 3 files at r1.
Review status: all files reviewed at latest revision, 2 unresolved discussions, some commit checks failed.


src/addagent/manage_agents.c, line 344 [r1] (raw file):
Whole do look is not needed. As you break out of it. Should be noted that the original do loop was to allow multiple input. This do look do not do that.


src/addagent/manage_agents.c, line 345 [r1] (raw file):
Removing the Do loop means that this function and user interfaces changes. It will no longer loop and allow many input if i am reading this correctly.


Comments from the review on Reviewable.io

@jrossi jrossi self-assigned this Mar 12, 2016
@jrossi jrossi added this to the ossec-hids-2.9 milestone Mar 12, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants