当前所在位置:珠峰网资料 >> 计算机 >> Oracle认证 >> 正文
  ORACLE密码策略验证程序(一)
发布时间:2010/11/27 14:09:45 来源:www.xue.net 编辑:城市总裁吧

  ORACLE密码策略非常重要,下面就为您详细介绍ORACLE密码策略验证程序,如果您对ORACLE密码策略方面感兴趣的话,不妨一看。

  密码字符串要求:

  -- Check if the password is same as the username

  -- Check for the minimum length of the password

  -- Check if the password contains at least one letter, one digit and one

  -- Check if the password differs from the previous password by at least

  CREATE OR REPLACE FUNCTION SYS.verify_function

  (username varchar2,

  password varchar2,

  old_password varchar2)

  RETURN boolean IS

  n boolean;

  m integer;

  differ integer;

  isdigit boolean;

  ischar boolean;

  ispunct boolean;

  digitarray varchar2(20);

  punctarray varchar2(25);

  chararray varchar2(52);

  BEGIN

  digitarray:= ’0123456789’;

  chararray:= ’abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ’;

  punctarray:=’!"#$%&()``*+,-/:;<=>?_’;

  -- Check if the password is same as the username

  IF NLS_LOWER(password) = NLS_LOWER(username) THEN

  raise_application_error(-20001, ’Password same as or similar to user’);

  END IF;

  -- Check for the minimum length of the password

  IF length(password) < 8 THEN

  raise_application_error(-20002, ’Password length less than 8’);

  END IF;

  -- Check if the password is too simple. A dictionary of words may be

  -- maintained and a check may be made so as not to allow the words

  -- that are too simple for the password.

  IF NLS_LOWER(password) IN (’welcome’, ’database’, ’account’, ’user’, ’password’, ’oracle’, ’computer’, ’abcd’) THEN

  raise_application_error(-20002, ’Password too simple’);

  END IF;

  -- Check if the password contains at least one letter, one digit and one

  -- punctuation mark.

  -- 1. Check for the digit

  1.isdigit:=FALSE;

  2.m := length(password);

  3.FOR i IN 1..10 LOOP

  4.FOR j IN 1..m LOOP

  5.IF substr(password,j,1) = substr(digitarray,i,1) THEN

  6.isdigit:=TRUE;

  7.GOTO findchar;

  8.END IF;

  9.END LOOP;

  10.END LOOP;

  11.IF isdigit = FALSE THEN

广告合作:400-664-0084 全国热线:400-664-0084
Copyright 2010 - 2017 www.my8848.com 珠峰网 粤ICP备15066211号
珠峰网 版权所有 All Rights Reserved