method5 icon indicating copy to clipboard operation
method5 copied to clipboard

Support 12c databases that have sec_case_sensitive_logon=FALSE

Open zhudock opened this issue 7 years ago • 2 comments

Suggestion to set a custom conditional compile flag and act accordingly within the 3 procedures of method5_admin.

Short version, add an additional replace() and alter session set plsql_ccflags='case_sensitive:#CASE_SENSITIVE#'; to those 3 procedures. See the example in create_user below

	function create_user return clob is
		v_12c_hash varchar2(4000);
		v_11g_hash_without_des varchar2(4000);
		v_11g_hash_with_des varchar2(4000);
		v_10g_hash varchar2(4000);
		v_profile varchar2(4000);
		v_sec_case_sensitive_logon varchar2(4000);
	begin
		sys.get_method5_hashes(v_12c_hash, v_11g_hash_without_des, v_11g_hash_with_des, v_10g_hash);

		select profile
		into v_profile
		from dba_users
		where username = 'METHOD5';

		select upper(value)
				into v_sec_case_sensitive_logon
				from v$parameter
				where name = 'sec_case_sensitive_logon';

		return replace(replace(replace(replace(replace(replace(replace(replace(
		q'[
alter session set plsql_ccflags='case_sensitive:#CASE_SENSITIVE#';
			--Create the Method5 user with the appropriate hash.
			declare
				v_sec_case_sensitive_logon varchar2(4000);
			begin
				select upper(value)
				into v_sec_case_sensitive_logon
				from v$parameter
				where name = 'sec_case_sensitive_logon';

				--Do nothing if this is the management database - the user already exists.
				if lower(sys_context('userenv', 'db_unique_name')) = '#DB_NAME#' then
					null;
				else
					--Change the hash for 10g and 11g.
					$if dbms_db_version.ver_le_11_2 or not $$case_sensitive $then
						if v_sec_case_sensitive_logon = 'TRUE' then
							execute immediate q'!create user method5 profile #PROFILE# identified by values '#11G_HASH_WITHOUT_DES#'!';
						else
							if '#10G_HASH#' is null then
								raise_application_error(-20000, 'The 10g hash is not available.  You must set '||
									'the target database sec_case_sensitive_logon to TRUE for this to work.');
							else
								execute immediate q'!create user method5 profile #PROFILE# identified by values '#11G_HASH_WITH_DES#'!';
							end if;
						end if;
					--Change the hash for 12c.
					$else
						execute immediate q'!create user method5 profile #PROFILE# identified by values '#12C_HASH#'!';
					$end
				end if;
			end;
			/]'
		, '#CASE_SENSITIVE#', v_sec_case_sensitive_logon)
		, '#12C_HASH#', nvl(v_12c_hash, v_11g_hash_without_des))
		, '#11G_HASH_WITHOUT_DES#', v_11g_hash_without_des)
		, '#10G_HASH#', v_10g_hash)
		, '#11G_HASH_WITH_DES#', v_11g_hash_with_des)
		, '#PROFILE#', v_profile)
		, '#DB_NAME#', lower(sys_context('userenv', 'db_unique_name')))
		, chr(10)||'			', chr(10))||chr(10)||chr(10);
	end;

zhudock avatar Nov 27 '18 21:11 zhudock

This may have been what #53 and #54 meant to address, but since the dbms_db_version.ver_le_11_2 test happens before the sec_case_sensitive_logon test, the 12c hash is always assumed for 12c databases, regardless of the sec_case_sensitive_logon value

zhudock avatar Nov 28 '18 16:11 zhudock

I'm going to put this one off until the next release, so I can get the 18c and other fixes out sooner.

jonheller1 avatar Jan 10 '19 18:01 jonheller1