diff options
Diffstat (limited to 'inc')
-rw-r--r-- | inc/PassHash.class.php | 47 | ||||
-rw-r--r-- | inc/auth.php | 4 | ||||
-rw-r--r-- | inc/common.php | 11 | ||||
-rw-r--r-- | inc/fetch.functions.php | 2 | ||||
-rw-r--r-- | inc/infoutils.php | 4 | ||||
-rw-r--r-- | inc/lang/ko/draft.txt | 2 | ||||
-rw-r--r-- | inc/lang/ko/lang.php | 10 | ||||
-rw-r--r-- | inc/lang/ko/login.txt | 2 | ||||
-rw-r--r-- | inc/lang/ko/newpage.txt | 2 | ||||
-rw-r--r-- | inc/lang/ko/norev.txt | 2 | ||||
-rw-r--r-- | inc/lang/ko/read.txt | 2 | ||||
-rw-r--r-- | inc/lang/ko/searchpage.txt | 2 | ||||
-rw-r--r-- | inc/lang/ko/subscr_digest.txt | 2 | ||||
-rw-r--r-- | inc/lang/ko/subscr_list.txt | 2 | ||||
-rw-r--r-- | inc/lang/ko/subscr_single.txt | 2 | ||||
-rw-r--r-- | inc/media.php | 9 |
16 files changed, 79 insertions, 26 deletions
diff --git a/inc/PassHash.class.php b/inc/PassHash.class.php index 080fb4778..61bd74939 100644 --- a/inc/PassHash.class.php +++ b/inc/PassHash.class.php @@ -494,4 +494,51 @@ class PassHash { $this->init_salt($salt, 8, false); return ':B:'.$salt.':'.md5($salt.'-'.md5($clear)); } + + /** + * Wraps around native hash_hmac() or reimplents it + * + * This is not directly used as password hashing method, and thus isn't callable via the + * verify_hash() method. It should be used to create signatures and might be used in other + * password hashing methods. + * + * @see hash_hmac() + * @author KC Cloyd + * @link http://www.php.net/manual/en/function.hash-hmac.php#93440 + * + * @param string $algo Name of selected hashing algorithm (i.e. "md5", "sha256", "haval160,4", + * etc..) See hash_algos() for a list of supported algorithms. + * @param string $data Message to be hashed. + * @param string $key Shared secret key used for generating the HMAC variant of the message digest. + * @param bool $raw_output When set to TRUE, outputs raw binary data. FALSE outputs lowercase hexits. + * + * @return string + */ + public static function hmac($algo, $data, $key, $raw_output = false) { + // use native function if available and not in unit test + if(function_exists('hash_hmac') && !defined('SIMPLE_TEST')){ + return hash_hmac($algo, $data, $key, $raw_output); + } + + $algo = strtolower($algo); + $pack = 'H' . strlen($algo('test')); + $size = 64; + $opad = str_repeat(chr(0x5C), $size); + $ipad = str_repeat(chr(0x36), $size); + + if(strlen($key) > $size) { + $key = str_pad(pack($pack, $algo($key)), $size, chr(0x00)); + } else { + $key = str_pad($key, $size, chr(0x00)); + } + + for($i = 0; $i < strlen($key) - 1; $i++) { + $opad[$i] = $opad[$i] ^ $key[$i]; + $ipad[$i] = $ipad[$i] ^ $key[$i]; + } + + $output = $algo($opad . pack($pack, $algo($ipad . $data))); + + return ($raw_output) ? pack($pack, $output) : $output; + } } diff --git a/inc/auth.php b/inc/auth.php index 3f1f7925b..1f8489f03 100644 --- a/inc/auth.php +++ b/inc/auth.php @@ -54,7 +54,7 @@ function auth_setup() { } elseif ('auth' . $conf['authtype'] === $plugin) { // matches old auth backends (pre-Weatherwax) $auth = $plugin_controller->load('auth', $plugin); - msg('Your authtype setting is deprecated. You must set $conf[\'authtype\'] = ' . "auth" . $conf['authtype'] + msg('Your authtype setting is deprecated. You must set $conf[\'authtype\'] = "auth' . $conf['authtype'] . '"' . ' in your configuration (see <a href="https://www.dokuwiki.org/auth">Authentication Backends</a>)',-1,'','',MSG_ADMINS_ONLY); } } @@ -993,7 +993,7 @@ function act_resendpwd() { } // generate auth token - $token = md5(auth_cookiesalt().$user); //secret but user based + $token = md5(uniqid(mt_rand(), true)); // random secret $tfile = $conf['cachedir'].'/'.$token{0}.'/'.$token.'.pwauth'; $url = wl('', array('do'=> 'resendpwd', 'pwauth'=> $token), true, '&'); diff --git a/inc/common.php b/inc/common.php index 4d939ac77..59ceb0c0d 100644 --- a/inc/common.php +++ b/inc/common.php @@ -56,7 +56,7 @@ function stripctl($string) { * @return string */ function getSecurityToken() { - return md5(auth_cookiesalt().session_id().$_SERVER['REMOTE_USER']); + return PassHash::hmac('md5', session_id().$_SERVER['REMOTE_USER'], auth_cookiesalt()); } /** @@ -435,6 +435,11 @@ function exportlink($id = '', $format = 'raw', $more = '', $abs = false, $sep = */ function ml($id = '', $more = '', $direct = true, $sep = '&', $abs = false) { global $conf; + $isexternalimage = preg_match('#^(https?|ftp)://#i', $id); + if(!$isexternalimage) { + $id = cleanID($id); + } + if(is_array($more)) { // add token for resized images if($more['w'] || $more['h']){ @@ -467,10 +472,10 @@ function ml($id = '', $more = '', $direct = true, $sep = '&', $abs = false) } // external URLs are always direct without rewriting - if(preg_match('#^(https?|ftp)://#i', $id)) { + if($isexternalimage) { $xlink .= 'lib/exe/fetch.php'; // add hash: - $xlink .= '?hash='.substr(md5(auth_cookiesalt().$id), 0, 6); + $xlink .= '?hash='.substr(PassHash::hmac('md5', $id, auth_cookiesalt()), 0, 6); if($more) { $xlink .= $sep.$more; $xlink .= $sep.'media='.rawurlencode($id); diff --git a/inc/fetch.functions.php b/inc/fetch.functions.php index 59a76a798..e5411786c 100644 --- a/inc/fetch.functions.php +++ b/inc/fetch.functions.php @@ -99,7 +99,7 @@ function checkFileStatus(&$media, &$file, $rev = '', $width=0, $height=0) { //media to local file if(preg_match('#^(https?)://#i', $media)) { //check hash - if(substr(md5(auth_cookiesalt().$media), 0, 6) !== $INPUT->str('hash')) { + if(substr(PassHash::hmac('md5', $media, auth_cookiesalt()), 0, 6) !== $INPUT->str('hash')) { return array(412, 'Precondition Failed'); } //handle external images diff --git a/inc/infoutils.php b/inc/infoutils.php index 9fe5ee689..71e642995 100644 --- a/inc/infoutils.php +++ b/inc/infoutils.php @@ -107,8 +107,8 @@ function check(){ msg('DokuWiki version: '.getVersion(),1); } - if(version_compare(phpversion(),'5.1.2','<')){ - msg('Your PHP version is too old ('.phpversion().' vs. 5.1.2+ needed)',-1); + if(version_compare(phpversion(),'5.2.0','<')){ + msg('Your PHP version is too old ('.phpversion().' vs. 5.2.0+ needed)',-1); }else{ msg('PHP version '.phpversion(),1); } diff --git a/inc/lang/ko/draft.txt b/inc/lang/ko/draft.txt index f7787f981..b655d7c92 100644 --- a/inc/lang/ko/draft.txt +++ b/inc/lang/ko/draft.txt @@ -1,5 +1,5 @@ ====== 문서 초안 있음 ====== -이 문서의 마지막 편집 세션은 정상적으로 끝나지 않았습니다. DokuWiki는 작업 도중 자동으로 저장된 문서 초안을 사용하여 편집을 계속 할 수 있습니다. 마지막 세션 동안 저장된 문서 초안을 아래에서 볼 수 있습니다. +이 문서의 마지막 편집 세션은 정상적으로 끝나지 않았습니다. DokuWiki는 작업 도중 자동으로 저장된 문서 초안을 사용해 편집을 계속 할 수 있습니다. 마지막 세션 동안 저장된 문서 초안을 아래에서 볼 수 있습니다. 비정상적으로 끝난 편집 세션을 **되돌릴**지 여부를 결정하고, 자동으로 저장되었던 초안을 **삭제**하거나 편집 과정을 **취소**하세요.
\ No newline at end of file diff --git a/inc/lang/ko/lang.php b/inc/lang/ko/lang.php index 76d6a535d..76684659c 100644 --- a/inc/lang/ko/lang.php +++ b/inc/lang/ko/lang.php @@ -160,7 +160,7 @@ $lang['accessdenied'] = '이 문서를 볼 권한이 없습니다.'; $lang['mediausage'] = '이 파일을 참고하려면 다음 문법을 사용하세요:'; $lang['mediaview'] = '원본 파일 보기'; $lang['mediaroot'] = '루트 (root)'; -$lang['mediaupload'] = '파일을 현재 이름공간으로 올립니다. 하위 이름공간으로 만들려면 선택한 파일 이름 앞에 쌍점(:)으로 구분되는 이름을 붙이면 됩니다. 파일을 드래그 앤 드롭하여 선택할 수 있습니다.'; +$lang['mediaupload'] = '파일을 현재 이름공간으로 올립니다. 하위 이름공간으로 만들려면 선택한 파일 이름 앞에 쌍점(:)으로 구분되는 이름을 붙이면 됩니다. 파일을 드래그 앤 드롭해 선택할 수 있습니다.'; $lang['mediaextchange'] = '파일 확장자가 .%s에서 .%s(으)로 바뀌었습니다!'; $lang['reference'] = '참고'; $lang['ref_inuse'] = '다음 문서에서 아직 사용 중이므로 파일을 삭제할 수 없습니다:'; @@ -218,7 +218,7 @@ $lang['qb_hs'] = '문단 제목 선택'; $lang['qb_hplus'] = '상위 문단 제목'; $lang['qb_hminus'] = '하위 문단 제목'; $lang['qb_hequal'] = '동급 문단 제목'; -$lang['qb_link'] = '내부 링크'; +$lang['qb_link'] = '안쪽 링크'; $lang['qb_extlink'] = '바깥 링크'; $lang['qb_hr'] = '가로줄'; $lang['qb_ol'] = '순서 있는 목록'; @@ -231,7 +231,7 @@ $lang['upperns'] = '상위 이름공간으로 이동'; $lang['admin_register'] = '새 사용자 추가'; $lang['metaedit'] = '메타 데이터 편집'; $lang['metasaveerr'] = '메타 데이터 쓰기 실패'; -$lang['metasaveok'] = '메타 데이타 저장됨'; +$lang['metasaveok'] = '메타 데이터 저장됨'; $lang['img_backto'] = '뒤로'; $lang['img_title'] = '이름'; $lang['img_caption'] = '설명'; @@ -304,7 +304,7 @@ $lang['media_uploadtab'] = '올리기'; $lang['media_searchtab'] = '찾기'; $lang['media_file'] = '파일'; $lang['media_viewtab'] = '보기'; -$lang['media_edittab'] = '수정'; +$lang['media_edittab'] = '편집'; $lang['media_historytab'] = '역사'; $lang['media_list_thumbs'] = '섬네일'; $lang['media_list_rows'] = '목록'; @@ -318,7 +318,7 @@ $lang['media_view'] = '%s'; $lang['media_viewold'] = '%s (%s에 있음)'; $lang['media_edit'] = '%s 편집'; $lang['media_history'] = '%s 바뀜 내역'; -$lang['media_meta_edited'] = '메타데이터가 수정됨'; +$lang['media_meta_edited'] = '메타 데이터 편집됨'; $lang['media_perm_read'] = '이 파일을 읽을 권한이 없습니다.'; $lang['media_perm_upload'] = '파일을 올릴 권한이 없습니다.'; $lang['media_update'] = '새 판 올리기'; diff --git a/inc/lang/ko/login.txt b/inc/lang/ko/login.txt index 160b899d3..f8af4100f 100644 --- a/inc/lang/ko/login.txt +++ b/inc/lang/ko/login.txt @@ -1,3 +1,3 @@ ====== 로그인 ====== -로그인하지 않았습니다! 아래에서 로그인하세요. 로그인하려면 쿠키를 받도록 설정하여야 합니다.
\ No newline at end of file +로그인하지 않았습니다! 아래에서 로그인하세요. 로그인하려면 쿠키를 활성화해야 합니다.
\ No newline at end of file diff --git a/inc/lang/ko/newpage.txt b/inc/lang/ko/newpage.txt index 8db34f9cf..fa7864610 100644 --- a/inc/lang/ko/newpage.txt +++ b/inc/lang/ko/newpage.txt @@ -1,3 +1,3 @@ ====== 이 주제는 아직 없습니다 ====== -아직 없는 주제에 대한 링크를 따라왔습니다. **문서 만들기** 버튼을 클릭하여 새로 만들 수 있습니다.
\ No newline at end of file +아직 없는 주제에 대한 링크를 따라왔습니다. **문서 만들기** 버튼을 클릭해 새로 만들 수 있습니다.
\ No newline at end of file diff --git a/inc/lang/ko/norev.txt b/inc/lang/ko/norev.txt index 3e203b235..246f3e4f6 100644 --- a/inc/lang/ko/norev.txt +++ b/inc/lang/ko/norev.txt @@ -1,3 +1,3 @@ ====== 지정한 판 없음 ====== -지정한 판이 존재하지 않습니다. **이전 판** 버튼을 사용하여 이 문서의 이전 판 목록을 보세요.
\ No newline at end of file +지정한 판이 존재하지 않습니다. **이전 판** 버튼을 사용해 이 문서의 이전 판 목록을 보세요.
\ No newline at end of file diff --git a/inc/lang/ko/read.txt b/inc/lang/ko/read.txt index c510b598e..8f080fcb1 100644 --- a/inc/lang/ko/read.txt +++ b/inc/lang/ko/read.txt @@ -1 +1 @@ -이 문서는 읽기 전용입니다. 내용을 볼 수는 있지만 수정할 수는 없습니다. 문제가 있다고 생각하면 관리자에게 문의하세요.
\ No newline at end of file +이 문서는 읽기 전용입니다. 내용을 볼 수는 있지만 바꿀 수는 없습니다. 문제가 있다고 생각하면 관리자에게 문의하세요.
\ No newline at end of file diff --git a/inc/lang/ko/searchpage.txt b/inc/lang/ko/searchpage.txt index 8cc003950..d3b37ec7c 100644 --- a/inc/lang/ko/searchpage.txt +++ b/inc/lang/ko/searchpage.txt @@ -1,5 +1,5 @@ ====== 찾기 ====== -아래에서 찾기 결과를 볼 수 있습니다. 만일 원하는 문서를 찾지 못하였다면, **문서 만들기**나 **문서 편집** 버튼을 사용하여 쿼리 내용과 같은 이름의 문서를 만들거나 편집할 수 있습니다. +아래에서 찾기 결과를 볼 수 있습니다. 만일 원하는 문서를 찾지 못하였다면, **문서 만들기**나 **문서 편집** 버튼을 사용해 쿼리 내용과 같은 이름의 문서를 만들거나 편집할 수 있습니다. ===== 결과 =====
\ No newline at end of file diff --git a/inc/lang/ko/subscr_digest.txt b/inc/lang/ko/subscr_digest.txt index b67cc9bbc..6db7b963c 100644 --- a/inc/lang/ko/subscr_digest.txt +++ b/inc/lang/ko/subscr_digest.txt @@ -12,7 +12,7 @@ 이 문서의 알림을 취소하려면, @DOKUWIKIURL@에 로그인한 뒤 -@SUBSCRIBE@ 문서를 방문하여 문서나 이름공간의 구독을 취소하세요. +@SUBSCRIBE@ 문서를 방문해 문서나 이름공간의 구독을 취소하세요. -- @DOKUWIKIURL@의 DokuWiki가 자동으로 만들어낸 메일입니다.
\ No newline at end of file diff --git a/inc/lang/ko/subscr_list.txt b/inc/lang/ko/subscr_list.txt index 03ca86d2a..c13e0097a 100644 --- a/inc/lang/ko/subscr_list.txt +++ b/inc/lang/ko/subscr_list.txt @@ -8,7 +8,7 @@ -------------------------------------------------------- 이 문서의 알림을 취소하려면, @DOKUWIKIURL@에 로그인한 뒤 -@SUBSCRIBE@ 문서를 방문하여 문서나 이름공간의 구독을 취소하세요. +@SUBSCRIBE@ 문서를 방문해 문서나 이름공간의 구독을 취소하세요. -- @DOKUWIKIURL@의 DokuWiki가 자동으로 만들어낸 메일입니다.
\ No newline at end of file diff --git a/inc/lang/ko/subscr_single.txt b/inc/lang/ko/subscr_single.txt index 5f8b43b98..d4e38e044 100644 --- a/inc/lang/ko/subscr_single.txt +++ b/inc/lang/ko/subscr_single.txt @@ -14,7 +14,7 @@ 새 판 : @NEWPAGE@ 이 문서의 알림을 취소하려면, @DOKUWIKIURL@에 로그인한 뒤 -@SUBSCRIBE@ 문서를 방문하여 문서나 이름공간의 구독을 취소하세요. +@SUBSCRIBE@ 문서를 방문해 문서나 이름공간의 구독을 취소하세요. -- @DOKUWIKIURL@의 DokuWiki가 자동으로 만들어낸 메일입니다.
\ No newline at end of file diff --git a/inc/media.php b/inc/media.php index e29a47631..18148a446 100644 --- a/inc/media.php +++ b/inc/media.php @@ -1879,20 +1879,21 @@ function media_crop_image($file, $ext, $w, $h=0){ * cropped images have been internally generated - and prevent external * DDOS attacks via fetch * + * @author Christopher Smith <chris@jalakai.co.uk> + * * @param string $id id of the image * @param int $w resize/crop width * @param int $h resize/crop height - * - * @author Christopher Smith <chris@jalakai.co.uk> + * @return string */ function media_get_token($id,$w,$h){ // token is only required for modified images if ($w || $h) { - $token = auth_cookiesalt().$id; + $token = $id; if ($w) $token .= '.'.$w; if ($h) $token .= '.'.$h; - return substr(md5($token),0,6); + return substr(PassHash::hmac('md5', $token, auth_cookiesalt()),0,6); } return ''; |