Lines Matching refs:this

71         $this->min_length = $this->getConf('minlen');
72 $this->min_pools = $this->getConf('minpools');
73 $this->usernamecheck = $this->getConf('user');
74 $this->autotype = $this->getConf('autotype');
75 $this->autobits = $this->getConf('autobits');
76 $this->nocommon = $this->getConf('nocommon');
77 $this->noleaked = $this->getConf('noleaked');
79 $opts = explode(',', $this->getConf('pools'));
81 $this->usepools = array();
83 $this->usepools[$pool] = true;
86 if ($this->min_pools > count($this->usepools)) $this->min_pools = $this->usepools;
99 if ($this->autotype == 'pronouncable') {
100 $pw = $this->pronouncablePassword();
101 if ($pw && $this->checkPolicy($pw, $username)) return $pw;
104 if ($this->autotype == 'phrase') {
105 $pw = $this->randomPassphrase();
106 if ($pw && $this->checkPolicy($pw, $username)) return $pw;
109 $pw = $this->randomPassword();
110 if ($pw && $this->checkPolicy($pw, $username)) return $pw;
113 if ($try < 3) return $this->generatePassword($username, $try + 1);
136 foreach ($this->usepools as $pool => $on) {
141 if ($this->min_length) {
142 $text .= sprintf($this->getLang('length'), $this->min_length) . "\n";
144 if ($this->min_pools) {
145 $text .= sprintf($this->getLang('pools'), $this->min_pools, join(', ', $pools)) . "\n";
147 if ($this->usernamecheck == 1) {
148 $text .= $this->getLang('user1') . "\n";
150 if ($this->usernamecheck > 1) {
151 $text .= sprintf($this->getLang('user2'), $this->usernamecheck) . "\n";
153 if ($this->nocommon) {
154 $text .= $this->getLang('nocommon');
156 if ($this->noleaked) {
157 $text .= $this->getLang('noleaked');
172 $this->error = 0;
175 if (strlen($pass) < $this->min_length) {
176 $this->error = helper_plugin_passpolicy::LENGTH_VIOLATION;
181 if (!empty($this->usepools['lower'])) $matched_pools += (int)preg_match('/[a-z]/', $pass);
182 if (!empty($this->usepools['upper'])) $matched_pools += (int)preg_match('/[A-Z]/', $pass);
183 if (!empty($this->usepools['numeric'])) $matched_pools += (int)preg_match('/[0-9]/', $pass);
184 if (!empty($this->usepools['special'])) {
188 if ($matched_pools < $this->min_pools) {
189 $this->error = helper_plugin_passpolicy::POOL_VIOLATION;
196 if ($this->usernamecheck && $username) {
199 $this->error = helper_plugin_passpolicy::USERNAME_VIOLATION;
204 if ($this->usernamecheck > 1) {
206 for ($i = 0; $i < utf8_strlen($pass) - $this->usernamecheck + 1; $i++) {
207 $chunk = utf8_substr($pass, $i, $this->usernamecheck + 1);
218 $this->error = helper_plugin_passpolicy::USERNAME_VIOLATION;
224 if ($this->nocommon) {
227 $this->error = helper_plugin_passpolicy::COMMON_VIOLATION;
232 if ($this->noleaked && $this->isLeaked($pass)) {
233 $this->error = helper_plugin_passpolicy::LEAK_VIOLATION;
247 $num_bits = $this->autobits;
253 $pool_len = strlen($this->pools[$pool]);
254 $output .= $this->pools[$pool][$this->rand(0, $pool_len - 1)]; // add one char already
255 $characters .= $this->pools[$pool]; // add to full pool
256 $num_bits -= $this->bits($pool_len);
260 if (!empty($this->usepools['special'])) {
261 $pool_len = strlen($this->pools['special']);
262 $poolbits = $this->bits($pool_len);
264 $sane = ceil($this->autobits / 25);
266 $output .= $this->pools['special'][$this->rand(0, $pool_len - 1)];
273 $poolbits = $this->bits($pool_len);
277 $output .= $characters[$this->rand(0, $pool_len - 1)];
279 } while ($num_bits > 0 || strlen($output) < $this->min_length);
292 $num_bits = $this->autobits;
305 $c_bits = $this->bits($c_len);
306 $v_bits = $this->bits($v_len);
307 $a_bits = $this->bits($a_len);
311 if ($this->usepools['numeric']) {
312 $postfix .= $this->rand(10, 99);
313 $num_bits -= $this->bits(99 - 10);
315 if ($this->usepools['special']) {
316 $spec_len = strlen($this->pools['special']);
317 $postfix .= $this->pools['special'][rand(0, $spec_len - 1)];
318 $num_bits -= $this->bits($spec_len);
324 $output .= $consonants[$this->rand(0, $c_len - 1)];
325 $output .= $vowels[$this->rand(0, $v_len - 1)];
326 $output .= $all[$this->rand(0, $a_len - 1)];
331 } while ($num_bits > 0 || strlen($output) < $this->min_length);
334 if ($this->usepools['upper']) $output = ucfirst($output);
349 $num_bits = $this->autobits;
353 if ($this->usepools['numeric']) {
354 $prefix .= $this->rand(0, 999);
355 $num_bits -= $this->bits(999);
357 if ($this->usepools['special']) {
358 $spec_len = strlen($this->pools['special']);
359 $prefix .= $this->pools['special'][rand(0, $spec_len - 1)];
360 $num_bits -= $this->bits($spec_len);
364 $this->loadwordlist();
365 $wordbits = $this->bits($this->wordlistlength);
370 $output .= $this->wordlist[$this->rand(0, $this->wordlistlength - 1)] . ' ';
372 } while ($num_bits > 0 || strlen($output) < $this->min_length);
375 if ($this->usepools['upper']) $output = ucwords($output);
411 $mask = (1 << $this->bits($real_max)) - 1;
415 $bytes = $this->trueRandomBytes(4);
420 if (!$this->msgshown) {
422 $this->msgshown = true;
490 if ($this->wordlistlength) return; //list already loaded
494 $this->wordlist = $indexer->getIndex('w', $this->rand(4, 6));
495 $this->wordlist = array_filter($this->wordlist,
499 $this->wordlist += file(dirname(__FILE__) . '/words.txt', FILE_IGNORE_NEW_LINES);
500 $this->wordlistlength = count($this->wordlist);