diff --git a/apps/useradmin/src/useradmin/ldap_access.py b/apps/useradmin/src/useradmin/ldap_access.py index f1a3ba7..b8bf238 100644 --- a/apps/useradmin/src/useradmin/ldap_access.py +++ b/apps/useradmin/src/useradmin/ldap_access.py @@ -107,7 +107,11 @@ class LdapConnection(object): ldap.set_option(ldap.OPT_X_TLS_REQUIRE_CERT, ldap.OPT_X_TLS_ALLOW) ldap.set_option(ldap.OPT_X_TLS_CACERTFILE, cert_file) - ldap.set_option(ldap.OPT_REFERRALS, 0) + # Set referral following based on FOLLOW_REFERRALS + if self.ldap_config.FOLLOW_REFERRALS.get(): + ldap.set_option(ldap.OPT_REFERRALS, 1) + else: + ldap.set_option(ldap.OPT_REFERRALS, 0) self.ldap_handle = ldap.initialize(ldap_url) @@ -358,4 +362,4 @@ class LdapConnection(object): return self._transform_find_group_results(result_data, name_attr, member_attr) def _get_root_dn(self): - return self.ldap_config.BASE_DN.get() \ No newline at end of file + return self.ldap_config.BASE_DN.get() diff --git a/desktop/conf.dist/hue.ini b/desktop/conf.dist/hue.ini index 192fcd6..b9bbe12 100644 --- a/desktop/conf.dist/hue.ini +++ b/desktop/conf.dist/hue.ini @@ -211,6 +211,9 @@ # Define the number of levels to search for nested members. ## nested_members_search_depth=10 + # Whether or not to follow referrals + ## follow_referrals=false + [[[users]]] # Base filter for searching for users @@ -263,6 +266,9 @@ ## Use search bind authentication. ## search_bind_authentication=true + # Whether or not to follow referrals + ## follow_referrals=false + ## [[[[[users]]]]] # Base filter for searching for users diff --git a/desktop/conf/pseudo-distributed.ini.tmpl b/desktop/conf/pseudo-distributed.ini.tmpl index e6ccd6a..ad6d207 100644 --- a/desktop/conf/pseudo-distributed.ini.tmpl +++ b/desktop/conf/pseudo-distributed.ini.tmpl @@ -221,6 +221,9 @@ # Define the number of levels to search for nested members. ## nested_members_search_depth=10 + # Whether or not to follow referrals + ## follow_referrals=false + [[[users]]] # Base filter for searching for users @@ -270,6 +273,9 @@ ## Use search bind authentication. ## search_bind_authentication=true + # Whether or not to follow referrals + ## follow_referrals=false + ## [[[[[users]]]]] # Base filter for searching for users diff --git a/desktop/core/src/desktop/auth/backend.py b/desktop/core/src/desktop/auth/backend.py index e69bbda..6fa6626 100644 --- a/desktop/core/src/desktop/auth/backend.py +++ b/desktop/core/src/desktop/auth/backend.py @@ -372,6 +372,12 @@ class LdapBackend(object): setattr(self._backend.settings, 'START_TLS', False) ldap.set_option(ldap.OPT_X_TLS_REQUIRE_CERT, ldap.OPT_X_TLS_NEVER) + # Set referral following based on FOLLOW_REFERRALS + if ldap_config.FOLLOW_REFERRALS.get(): + ldap.set_option(ldap.OPT_REFERRALS, 1) + else: + ldap.set_option(ldap.OPT_REFERRALS, 0) + def add_ldap_config_for_server(self, server): if desktop.conf.LDAP.LDAP_SERVERS.get(): # Choose from multiple server configs diff --git a/desktop/core/src/desktop/conf.py b/desktop/core/src/desktop/conf.py index 1385712..b58619b 100644 --- a/desktop/core/src/desktop/conf.py +++ b/desktop/core/src/desktop/conf.py @@ -476,6 +476,11 @@ LDAP = ConfigSection( help=_("Define the number of levels to search for nested members."), type=int, default=10), + FOLLOW_REFERRALS = Config("follow_referrals", + help=_("Whether or not to follow referrals."), + type=coerce_bool, + default=False), + LDAP_SERVERS = UnspecifiedConfigSection( key="ldap_servers", @@ -512,6 +517,10 @@ LDAP = ConfigSection( default=True, type=coerce_bool, help=_("Use search bind authentication.")), + FOLLOW_REFERRALS = Config("follow_referrals", + help=_("Whether or not to follow referrals."), + type=coerce_bool, + default=False), USERS = ConfigSection( key="users", diff --git a/desktop/libs/liboozie/src/liboozie/submittion.py b/desktop/libs/liboozie/src/liboozie/submittion.py index 5234a71..a7c806c 100644 --- a/desktop/libs/liboozie/src/liboozie/submittion.py +++ b/desktop/libs/liboozie/src/liboozie/submittion.py @@ -270,11 +270,16 @@ class Submission(object): # Copy the jar files to the workspace lib if files: for jar_file in files: - LOG.debug("Updating %s" % jar_file) - jar_lib_path = self.fs.join(lib_path, self.fs.basename(jar_file)) - if self.fs.exists(jar_lib_path): - self.fs.remove(jar_lib_path, skip_trash=True) - self.fs.copyfile(jar_file, jar_lib_path) + #If the path to the jar is in lib and relative, we don't want to delete as that + #is the original jar. + if self.fs.dirname(jar_file) != 'lib': + LOG.debug("Updating %s" % jar_file) + jar_lib_path = self.fs.join(lib_path, self.fs.basename(jar_file)) + if self.fs.exists(jar_lib_path): + self.fs.remove(jar_lib_path, skip_trash=True) + self.fs.copyfile(jar_file, jar_lib_path) + else: + LOG.debug("No need to update %s as the jar is already located in lib" % jar_file) def _do_as(self, username, fn, *args, **kwargs): prev_user = self.fs.user