Skip to content

有害部落格同好會

2011/02/28 / php

mantis AD與DB密碼雙重認證

有兩個 AD 的情況下,分別去兩台不同的 LDAP 主機讀取資料

多此一舉的行為,沒事別這麼搞

====AD與DB密碼雙重認證====

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
修改檔案 core/authentication_api.php 如下:
在  function auth_does_password_match 裡
將
  if ( LDAP == $t_configured_login_method ) {
至
                       return true;
                     }
               }
 
改以以下程式碼取代
      $t_password         = user_get_field( $p_user_id, 'password' );
      $t_login_methods   = Array(MD5, CRYPT, PLAIN);
      foreach ( $t_login_methods as $t_login_method ) {
 
         # pass the stored password in as the salt
         if ( auth_process_plain_password( $p_test_password, $t_password, $t_login_method ) == $t_password ) {
            # Check for migration to another login method and test whether the password was encrypted
            # with our previously insecure implemention of the CRYPT method
            if ( ( $t_login_method != $t_configured_login_method ) ||
               ( ( CRYPT == $t_configured_login_method ) && substr( $t_password, 0, 2 ) == substr( $p_test_password, 0, 2 ) ) ) {
               user_set_password( $p_user_id, $p_test_password, true );
            }
 
            return true;
         }
      }
 
      if ( LDAP == $t_configured_login_method ) {
         return ldap_authenticate( $p_user_id, $p_test_password );
      }
在 function auth_process_plain_password 裡
在 case MD5: 前新增一行程式碼如下
       case LDAP:
在 mantis 目錄底下新增 custom_functions_inc.php,讓使用者可以修改自己的密碼
內容如下
 <?php
 function custom_function_override_auth_can_change_password() {
   return true;
 }
 ?>

修改檔案 core/authentication_api.php 如下: 在 function auth_does_password_match 裡 將 if ( LDAP == $t_configured_login_method ) { 至 return true; } } 改以以下程式碼取代 $t_password = user_get_field( $p_user_id, 'password' ); $t_login_methods = Array(MD5, CRYPT, PLAIN); foreach ( $t_login_methods as $t_login_method ) { # pass the stored password in as the salt if ( auth_process_plain_password( $p_test_password, $t_password, $t_login_method ) == $t_password ) { # Check for migration to another login method and test whether the password was encrypted # with our previously insecure implemention of the CRYPT method if ( ( $t_login_method != $t_configured_login_method ) || ( ( CRYPT == $t_configured_login_method ) && substr( $t_password, 0, 2 ) == substr( $p_test_password, 0, 2 ) ) ) { user_set_password( $p_user_id, $p_test_password, true ); } return true; } } if ( LDAP == $t_configured_login_method ) { return ldap_authenticate( $p_user_id, $p_test_password ); } 在 function auth_process_plain_password 裡 在 case MD5: 前新增一行程式碼如下 case LDAP: 在 mantis 目錄底下新增 custom_functions_inc.php,讓使用者可以修改自己的密碼 內容如下 <?php function custom_function_override_auth_can_change_password() { return true; } ?>

Post navigation

Previous Post:

Oracle form 裡開啟網頁

Next Post:

強制變更 mantis 預設 mysql 字元設定

分類

  • 新奇有趣の搶先報導
    • Raspberry Pi
    • 手機相關
    • 推薦軟體
    • 新鮮有趣
    • 生活資訊
  • 想破腦袋の程式技巧
    • Oracle EBS
    • Database
    • Excel, VBA
    • php
    • JavaScript, VBScript
    • VS.NET
    • Others
    • Windows
    • SAP
  • 撩動心弦の短文小品
  • 聚沙成塔の理財守則
  • 不可不知の職場實錄
  • 剎那永恆の生活翦影

近期文章

  • 受保護的內容: 如何透過Personalize功能呼叫另一form來回傳值
  • Win10 / 8 / 7 無法安裝 SSD
  • 受保護的內容: 樹梅派+遠端連線
  • EBS R12 取得客戶的phone, email, URL資料
  • 受保護的內容: 管控Workflow Administrator Role

友站

  • Masaya396's 協奏曲
  • 老塗的咁仔店

其他操作

  • 登入
  • 訂閱網站內容的資訊提供
  • 訂閱留言的資訊提供
  • WordPress.org 台灣繁體中文

Tag Cloud

你目前使用的瀏覽器不支援 HTML5 的 CANVAS 標籤。

  • Win7
  • VB.Net
  • Oracle EBS
  • WinXP
  • VB6
  • MySql
  • EBS 12.1.3
  • LDAP
  • EBS 11.5.10
  • SAP
  • php
  • CSS
  • javascript
  • 感情
  • excel
  • Oracle DB
  • 管理
  • HTC
  • VBA
  • SQL
© 2025 有害部落格同好會 - Powered by SimplyNews