|
File mail_crypt.diff, 6.5 kB
(added by DPR, 1 year ago)
|
patch file for Omega 1.0 RC1
|
-
vhcs-omega-1.0.0-rc1/gui/client/add_mail_acc.php
| old |
new |
|
| 198 | 198 | global $cfg; |
|---|
| 199 | 199 | |
|---|
| 200 | 200 | $domain_id = $dmn_id; |
|---|
| | 201 | $enc_secret = 0; |
|---|
| 201 | 202 | |
|---|
| 202 | 203 | // standard whithout encoding |
|---|
| 203 | 204 | //$mail_acc = $_POST['username']; |
| … | … | |
| 221 | 222 | $mail_auto_respond = '_no_'; |
|---|
| 222 | 223 | |
|---|
| 223 | 224 | if ($_POST['mail_type'] === 'normal') { |
|---|
| | 225 | $enc_secret = 1; |
|---|
| | 226 | |
|---|
| 224 | 227 | if ($_POST['dmn_type'] === 'dmn') { |
|---|
| 225 | 228 | $mail_pass = $_POST['pass']; |
|---|
| 226 | 229 | $mail_forward = '_no_'; |
| … | … | |
| 339 | 342 | return; |
|---|
| 340 | 343 | } |
|---|
| 341 | 344 | |
|---|
| | 345 | // create crypted password if necessary |
|---|
| | 346 | if ($enc_secret == 1) { |
|---|
| | 347 | if (isset($cfg['ENCRYPT_MAIL_PASS'])) |
|---|
| | 348 | { |
|---|
| | 349 | // use MD5 if available, otherwise fallback to standard crypt method |
|---|
| | 350 | if (CRYPT_MD5 == 1) { |
|---|
| | 351 | srand(); |
|---|
| | 352 | $salt = substr(md5(rand()), 0,8); |
|---|
| | 353 | $secret = crypt($mail_pass, '$1$' . $salt . '$'); |
|---|
| | 354 | } else { |
|---|
| | 355 | $secret = crypt($mail_pass); |
|---|
| | 356 | } |
|---|
| | 357 | $mail_pass = '_no_'; |
|---|
| | 358 | } else { |
|---|
| | 359 | $secret = '_no_'; |
|---|
| | 360 | } |
|---|
| | 361 | } |
|---|
| | 362 | |
|---|
| 342 | 363 | check_for_lock_file(); |
|---|
| 343 | 364 | |
|---|
| 344 | 365 | $query = <<<SQL_QUERY |
| … | … | |
| 350 | 371 | mail_type, |
|---|
| 351 | 372 | sub_id, |
|---|
| 352 | 373 | status, |
|---|
| 353 | | mail_auto_respond) |
|---|
| | 374 | mail_auto_respond, |
|---|
| | 375 | mail_crypt) |
|---|
| 354 | 376 | VALUES |
|---|
| 355 | | (?, ?, ?, ?, ?, ?, ?, ?) |
|---|
| | 377 | (?, ?, ?, ?, ?, ?, ?, ?, ?) |
|---|
| 356 | 378 | SQL_QUERY; |
|---|
| 357 | 379 | |
|---|
| 358 | 380 | $rs = exec_query($sql, $query, array($mail_acc, |
| … | … | |
| 362 | 384 | $mail_type, |
|---|
| 363 | 385 | $sub_id, |
|---|
| 364 | 386 | $status, |
|---|
| 365 | | $mail_auto_respond)); |
|---|
| | 387 | $mail_auto_respond, |
|---|
| | 388 | $secret)); |
|---|
| 366 | 389 | |
|---|
| 367 | 390 | write_log($_SESSION['user_logged'].": add new mail account: ".$mail_acc."@".$dmn_name); |
|---|
| 368 | 391 | set_page_message(tr('Mail account scheduled for addition!')); |
-
vhcs-omega-1.0.0-rc1/gui/client/create_catchall.php
| old |
new |
|
| 282 | 282 | mail_type, |
|---|
| 283 | 283 | sub_id, |
|---|
| 284 | 284 | status, |
|---|
| 285 | | mail_auto_respond) |
|---|
| | 285 | mail_auto_respond, |
|---|
| | 286 | mail_crypt) |
|---|
| 286 | 287 | values |
|---|
| 287 | | (?, ?, ?, ?, ?, ?, ?, ?) |
|---|
| | 288 | (?, ?, ?, ?, ?, ?, ?, ?, ?) |
|---|
| 288 | 289 | SQL_QUERY; |
|---|
| 289 | 290 | |
|---|
| 290 | | $rs = exec_query($sql, $query, array($mail_acc, '_no_', '_no_', $domain_id, $mail_type, $sub_id, $status, '_no_')); |
|---|
| | 291 | $rs = exec_query($sql, $query, array($mail_acc, '_no_', '_no_', $domain_id, $mail_type, $sub_id, $status, '_no_', '_no_')); |
|---|
| 291 | 292 | |
|---|
| 292 | 293 | send_request(); |
|---|
| 293 | 294 | write_log($_SESSION['user_logged'].": add new email catch all"); |
| … | … | |
| 342 | 343 | mail_type, |
|---|
| 343 | 344 | sub_id, |
|---|
| 344 | 345 | status, |
|---|
| 345 | | mail_auto_respond) |
|---|
| | 346 | mail_auto_respond, |
|---|
| | 347 | mail_crypt) |
|---|
| 346 | 348 | values |
|---|
| 347 | | (?, ?, ?, ?, ?, ?, ?, ?) |
|---|
| | 349 | (?, ?, ?, ?, ?, ?, ?, ?, ?) |
|---|
| 348 | 350 | SQL_QUERY; |
|---|
| 349 | 351 | |
|---|
| 350 | | $rs = exec_query($sql, $query, array($mail_acc, '_no_', '_no_', $domain_id, $mail_type, $sub_id, $status, '_no_')); |
|---|
| | 352 | $rs = exec_query($sql, $query, array($mail_acc, '_no_', '_no_', $domain_id, $mail_type, $sub_id, $status, '_no_', '_no_')); |
|---|
| 351 | 353 | |
|---|
| 352 | 354 | send_request(); |
|---|
| 353 | 355 | write_log($_SESSION['user_logged'].": add new email catch all "); |
-
vhcs-omega-1.0.0-rc1/gui/client/edit_mail_acc.php
| old |
new |
|
| 132 | 132 | |
|---|
| 133 | 133 | function update_email_pass($sql) |
|---|
| 134 | 134 | { |
|---|
| | 135 | global $cfg; |
|---|
| | 136 | |
|---|
| 135 | 137 | if (!isset($_POST['uaction'])) { |
|---|
| 136 | 138 | return; |
|---|
| 137 | 139 | } |
| … | … | |
| 159 | 161 | global $cfg; |
|---|
| 160 | 162 | $status = $cfg['ITEM_CHANGE_STATUS']; |
|---|
| 161 | 163 | |
|---|
| | 164 | if (isset($cfg['ENCRYPT_MAIL_PASS'])) { |
|---|
| | 165 | if (CRYPT_MD5 == 1) { |
|---|
| | 166 | srand(); |
|---|
| | 167 | $salt = substr(md5(rand()), 0,8); |
|---|
| | 168 | $secret = crypt($pass, '$1$' . $salt . '$'); |
|---|
| | 169 | } else { |
|---|
| | 170 | $secret = crypt($pass); |
|---|
| | 171 | } |
|---|
| | 172 | $pass = '_no_'; |
|---|
| | 173 | } else { |
|---|
| | 174 | $secret = '_no_'; |
|---|
| | 175 | } |
|---|
| | 176 | |
|---|
| 162 | 177 | check_for_lock_file(); |
|---|
| 163 | 178 | |
|---|
| 164 | 179 | $query = <<<SQL_QUERY |
| … | … | |
| 166 | 181 | mail_users |
|---|
| 167 | 182 | set |
|---|
| 168 | 183 | mail_pass = ?, |
|---|
| | 184 | mail_crypt = ?, |
|---|
| 169 | 185 | status = ? |
|---|
| 170 | 186 | where |
|---|
| 171 | 187 | mail_id = ? |
|---|
| 172 | 188 | SQL_QUERY; |
|---|
| 173 | 189 | |
|---|
| 174 | | $rs = exec_query($sql, $query, array($pass, $status, $mail_id)); |
|---|
| | 190 | $rs = exec_query($sql, $query, array($pass, $secret, $status, $mail_id)); |
|---|
| 175 | 191 | |
|---|
| 176 | 192 | send_request(); |
|---|
| 177 | 193 | set_page_message(tr("Mail were updated successfully!")); |
-
vhcs-omega-1.0.0-rc1/gui/include/admin-functions.php
| old |
new |
|
| 1884 | 1884 | return; |
|---|
| 1885 | 1885 | } |
|---|
| 1886 | 1886 | |
|---|
| | 1887 | if (isset($cfg['ENCRYPT_MAIL_PASS'])) { |
|---|
| | 1888 | $pass_field = 'mail_crypt'; |
|---|
| | 1889 | } else { |
|---|
| | 1890 | $pass_field = 'mail_pass'; |
|---|
| | 1891 | } |
|---|
| | 1892 | |
|---|
| | 1893 | |
|---|
| 1887 | 1894 | $query = <<<SQL_QUERY |
|---|
| 1888 | 1895 | SELECT |
|---|
| 1889 | 1896 | mail_id, |
|---|
| 1890 | | mail_pass |
|---|
| | 1897 | $pass_field |
|---|
| 1891 | 1898 | FROM |
|---|
| 1892 | 1899 | mail_users |
|---|
| 1893 | 1900 | WHERE |
|---|
| 1894 | 1901 | domain_id = ? |
|---|
| 1895 | 1902 | AND |
|---|
| 1896 | | mail_pass != '_no_' |
|---|
| | 1903 | $pass_field != '_no_' |
|---|
| 1897 | 1904 | SQL_QUERY; |
|---|
| 1898 | 1905 | |
|---|
| 1899 | 1906 | $rs = exec_query($sql, $query, array($domain_id)); |
| … | … | |
| 1908 | 1915 | $mail_id = $rs -> fields['mail_id']; |
|---|
| 1909 | 1916 | $timestamp = time(); |
|---|
| 1910 | 1917 | $pass_prefix = substr(md5($timestamp),0,4); |
|---|
| 1911 | | $mail_pass = $pass_prefix.$rs -> fields['mail_pass']; |
|---|
| | 1918 | $mail_pass = $pass_prefix.$rs -> fields[$pass_field]; |
|---|
| 1912 | 1919 | |
|---|
| 1913 | 1920 | } else if ($action == 'enable') { |
|---|
| 1914 | 1921 | |
|---|
| 1915 | 1922 | $mail_id = $rs -> fields['mail_id']; |
|---|
| 1916 | | $mail_pass = substr($rs -> fields['mail_pass'],4,50); |
|---|
| | 1923 | $mail_pass = substr($rs -> fields[$pass_field],4,50); |
|---|
| 1917 | 1924 | |
|---|
| 1918 | 1925 | } else { |
|---|
| 1919 | 1926 | return; |
| … | … | |
| 1927 | 1934 | UPDATE |
|---|
| 1928 | 1935 | mail_users |
|---|
| 1929 | 1936 | SET |
|---|
| 1930 | | mail_pass = ?, |
|---|
| | 1937 | $pass_field = ?, |
|---|
| 1931 | 1938 | status = ? |
|---|
| 1932 | 1939 | WHERE |
|---|
| 1933 | 1940 | mail_id = ? |
|