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

Add AIX variables for the load module function to work in AIX. #1437

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

KamathForAIX
Copy link
Contributor

Closes #1435.

@kwwcb
Copy link

kwwcb commented Feb 3, 2025

Hi @KamathForAIX thank you for this fix. You mentioned that the pow() function is linking to the wrong one (libbsd vs libc). Is there a way to fix this without recompiling? For example, creating and adding the right library to LD_LIBRARY_PATH?

@KamathForAIX
Copy link
Contributor Author

@kwwcb We have to recompile. No other way.

@micahsnyder Any update/comment for the PR?

@val-ms val-ms self-requested a review February 4, 2025 14:13
Copy link
Contributor

@val-ms val-ms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have any objection to this change though I will have to trust you to test that it works right for AIX.

I've made some suggestions to fix the formatting and reduce a couple lines of duplicate code.

Comment on lines 169 to 172
ld_library_path = getenv("LD_LIBRARY_PATH");
#ifdef _AIX
ld_library_path = getenv("LIBPATH");
#endif /* AIX */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ld_library_path = getenv("LD_LIBRARY_PATH");
#ifdef _AIX
ld_library_path = getenv("LIBPATH");
#endif /* AIX */
#ifdef _AIX
ld_library_path = getenv("LIBPATH");
#else
ld_library_path = getenv("LD_LIBRARY_PATH");
#endif

Comment on lines 190 to 196
snprintf(modulename, sizeof(modulename), "%s" PATHSEP "%s%s", tokens[token_index], name, suffixes[i]);

rhandle = dlopen(modulename, RTLD_NOW);
#ifdef _AIX
snprintf(modulename, sizeof(modulename), "%s%s(%s%s.%d)",name,".a",name,LT_MODULE_EXT,LIBCLAMAV_MAJORVER);
rhandle = dlopen(modulename, RTLD_NOW);
#endif /* AIX */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
snprintf(modulename, sizeof(modulename), "%s" PATHSEP "%s%s", tokens[token_index], name, suffixes[i]);
rhandle = dlopen(modulename, RTLD_NOW);
#ifdef _AIX
snprintf(modulename, sizeof(modulename), "%s%s(%s%s.%d)",name,".a",name,LT_MODULE_EXT,LIBCLAMAV_MAJORVER);
rhandle = dlopen(modulename, RTLD_NOW);
#endif /* AIX */
#ifdef _AIX
snprintf(modulename, sizeof(modulename),
"%s%s(%s%s.%d)",
name, ".a", name, LT_MODULE_EXT, LIBCLAMAV_MAJORVER);
#else
snprintf(modulename, sizeof(modulename),
"%s" PATHSEP "%s%s",
tokens[token_index], name, suffixes[i]);
#endif
rhandle = dlopen(modulename, RTLD_NOW);

#ifdef _AIX
snprintf(modulename, sizeof(modulename), "%s%s(%s%s.%d)",name,".a",name,LT_MODULE_EXT,LIBCLAMAV_MAJORVER);
rhandle = dlopen(modulename, RTLD_NOW | RTLD_MEMBER);
#endif /* AIX */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GitHub isn't allowing me to make a suggestion here because of the deleted line between sprintf and rhandle. 🤷 But you should do the same as I suggested above, with #ifdef + #else, and also cleaning up the formatting.

@KamathForAIX
Copy link
Contributor Author

@val-ms Kindly check now. I have made the changes.

@KamathForAIX
Copy link
Contributor Author

@val-ms Any updates on this PR? Kindly let me know.

@val-ms
Copy link
Contributor

val-ms commented Feb 10, 2025

I'm happy with what I see on github. I wanted to run it through our Jenkins but we had an unexpected issue with our build pipeline on macOS last week after an upgrade, so I haven't been able to run the build. I'll run it again as soon as I'm able.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Clamscan Crashes on AIX When Scanning ZIP Files Containing MS-EXE/DLL Files
3 participants