pradeepagrawal8184 commented on code in PR #1171:
URL: https://github.com/apache/ranger/pull/1171#discussion_r3958721059
##########
unixauthservice/src/main/java/org/apache/ranger/authentication/UnixAuthenticationService.java:
##########
@@ -105,31 +106,43 @@ public UnixAuthenticationService() {
}
public static void main(String[] args) {
- enableUnixAuth =
Arrays.stream(args).anyMatch("-enableUnixAuth"::equalsIgnoreCase);
UnixAuthenticationService service = new UnixAuthenticationService();
service.userSyncHAInitializerImpl =
UserSyncHAInitializerImpl.getInstance(UserGroupSyncConfig.getInstance().getUserGroupConfig());
service.run();
}
public void run() {
+ boolean unixAuthServiceStarted = false;
try {
+ UserGroupSyncConfig config = UserGroupSyncConfig.getInstance();
+ enableUnixAuth = config.getUserSyncUnixAuth();
+ unixBackend = config.getUnixBackend();
+
LOG.info("Starting User Sync Service!");
startUnixUserGroupSyncProcess();
Thread.sleep(5000);
- if (enableUnixAuth) {
+ if (enableUnixAuth && "passwd".equalsIgnoreCase(unixBackend)) {
LOG.info("Enabling Unix Auth Service!");
init();
+ unixAuthServiceStarted = true;
Review Comment:
unixAuthServiceStarted is set before startService() — If startService()
throws before entering its accept loop, finally will still stop the HA latch
while user sync keeps running. Unlikely in practice, and similar to
pre-existing behavior when auth was always enabled, but moving the flag to
after successful listener startup would be slightly safer.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]