~ubuntu-branches/ubuntu/dapper/phpmyadmin/dapper-updates

« back to all changes in this revision

Viewing changes to libraries/auth/config.auth.lib.php

  • Committer: Bazaar Package Importer
  • Author(s): Piotr Roszatycki
  • Date: 2004-12-13 19:23:57 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20041213192357-5jfwhvbnxaip4zbv
Tags: 2:2.6.1-rc1-1
* New upstream release.
* Security fix: Command execution and file disclosure was found.
  See http://www.phpmyadmin.net/home_page/security.php?issue=PMASA-2004-4
  Closes: #285488.
* Remove 003.non_standard_port_fix.diff applied to upstream.
* Add commented out options 'extension' and 'AllowRoot' to default config
  file.
* Support mysqli.so extension. Autodetect modules from 'extension' option.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
<?php
2
 
/* $Id: config.auth.lib.php,v 2.2 2003/11/26 22:52:24 rabus Exp $ */
 
2
/* $Id: config.auth.lib.php,v 2.9 2004/10/20 15:50:52 nijel Exp $ */
3
3
// vim: expandtab sw=4 ts=4 sts=4:
4
4
 
5
5
// +--------------------------------------------------------------------------+
6
 
// | Set of functions used to run config authentication (ie no                 |
 
6
// | Set of functions used to run config authentication (ie no                |
7
7
// | authentication).                                                         |
8
8
// +--------------------------------------------------------------------------+
9
9
 
44
44
function PMA_auth_set_user()
45
45
{
46
46
    return TRUE;
47
 
} // end of the 'PMA_auth_set_user()' function
 
47
} // end of the 'PMA_auth_set_user()' function 
48
48
 
49
49
 
50
50
/**
67
67
 */
68
68
function PMA_auth_fails()
69
69
{
70
 
    global $php_errormsg;
71
 
    global $connect_func, $server_port, $server_socket, $cfg;
 
70
    global $php_errormsg, $cfg;
72
71
    global $right_font_family, $font_size, $font_bigger;
73
 
    global $is_header_sent;
74
 
    if (PMA_mysql_error()) {
75
 
        $conn_error = PMA_mysql_error();
 
72
    if (PMA_DBI_getError()) {
 
73
        $conn_error = PMA_DBI_getError();
76
74
    } else if (isset($php_errormsg)) {
77
75
        $conn_error = $php_errormsg;
78
76
    } else {
79
 
        $conn_error = 'Cannot connect: invalid settings.';
 
77
        $conn_error = $GLOBALS['strConnectionError'];
80
78
    }
81
 
/* Commented out by Nijel: This causes displaying login and password from
82
 
 * config when connection to MySQL server can't be established. (SQL parser
83
 
 * fails on this and then displays it as wrong SQL.
84
 
 */
85
 
/*      $local_query    = $connect_func . '('
86
 
                    . $cfg['Server']['host'] . $server_port . $server_socket . ', '
87
 
                    . $cfg['Server']['user'] . ', '
88
 
                    . $cfg['Server']['password'] . ')';*/
89
 
    $local_query     = '';
90
79
 
91
80
    // Defines the charset to be used
92
81
    header('Content-Type: text/html; charset=' . $GLOBALS['charset']);
 
82
    // Defines the theme to be used
 
83
    require_once('./libraries/select_theme.lib.php');
93
84
    ?>
94
85
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
95
86
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
104
95
h1       {font-family: <?php echo $right_font_family; ?>; font-size: <?php echo $font_bigger; ?>; font-weight: bold}
105
96
//-->
106
97
</style>
 
98
<script language="JavaScript" type="text/javascript">
 
99
<!--
 
100
    /* added 2004-06-10 by Michael Keck
 
101
     *       we need this for Backwards-Compatibility and resolving problems
 
102
     *       with non DOM browsers, which may have problems with css 2 (like NC 4)
 
103
    */
 
104
    var isDOM      = (typeof(document.getElementsByTagName) != 'undefined'
 
105
                      && typeof(document.createElement) != 'undefined')
 
106
                   ? 1 : 0;
 
107
    var isIE4      = (typeof(document.all) != 'undefined'
 
108
                      && parseInt(navigator.appVersion) >= 4)
 
109
                   ? 1 : 0;
 
110
    var isNS4      = (typeof(document.layers) != 'undefined')
 
111
                   ? 1 : 0;
 
112
    var capable    = (isDOM || isIE4 || isNS4)
 
113
                   ? 1 : 0;
 
114
    // Uggly fix for Opera and Konqueror 2.2 that are half DOM compliant
 
115
    if (capable) {
 
116
        if (typeof(window.opera) != 'undefined') {
 
117
            var browserName = ' ' + navigator.userAgent.toLowerCase();
 
118
            if ((browserName.indexOf('konqueror 7') == 0)) {
 
119
                capable = 0;
 
120
            }
 
121
        } else if (typeof(navigator.userAgent) != 'undefined') {
 
122
            var browserName = ' ' + navigator.userAgent.toLowerCase();
 
123
            if ((browserName.indexOf('konqueror') > 0) && (browserName.indexOf('konqueror/3') == 0)) {
 
124
                capable = 0;
 
125
            }
 
126
        } // end if... else if...
 
127
    } // end if
 
128
    document.writeln('<link rel="stylesheet" type="text/css" href="<?php echo defined('PMA_PATH_TO_BASEDIR') ? PMA_PATH_TO_BASEDIR : './'; ?>css/phpmyadmin.css.php?lang=<?php echo $GLOBALS['available_languages'][$GLOBALS['lang']][2]; ?>&amp;js_frame=right&amp;js_isDOM=' + isDOM + '" />');
 
129
//-->
 
130
</script>
 
131
<noscript>
 
132
    <link rel="stylesheet" type="text/css" href="<?php echo defined('PMA_PATH_TO_BASEDIR') ? PMA_PATH_TO_BASEDIR : './'; ?>css/phpmyadmin.css.php?lang=<?php echo $GLOBALS['available_languages'][$GLOBALS['lang']][2]; ?>&amp;js_frame=right" />
 
133
</noscript>
 
134
 
107
135
</head>
108
136
 
109
137
<body bgcolor="<?php echo $cfg['RightBgColor']; ?>">
112
140
    <h1><?php echo sprintf($GLOBALS['strWelcome'], ' phpMyAdmin ' . PMA_VERSION); ?></h1>
113
141
</center>
114
142
<br />
 
143
<table border="0" cellpadding="0" cellspacing="3" align="center" width="80%">
 
144
    <tr>
 
145
        <td>
115
146
    <?php
116
147
    echo "\n";
117
 
    $is_header_sent = TRUE;
118
 
    echo '<p>' . $GLOBALS['strAccessDeniedExplanation'] . '</p>' . "\n";
119
 
    PMA_mysqlDie($conn_error, $local_query, FALSE);
120
 
 
 
148
    $GLOBALS['is_header_sent'] = TRUE;
 
149
 
 
150
    // if we display the "Server not responding" error, do not confuse users
 
151
    // by telling them they have a settings problem 
 
152
    // (note: it's true that they could have a badly typed host name, but
 
153
    //  anyway the current $strAccessDeniedExplanation tells that the server
 
154
    //  rejected the connection, which is not really what happened)
 
155
    // 2002 is the error given by mysqli
 
156
    // 2003 is the error given by mysql
 
157
 
 
158
    if (isset($GLOBALS['allowDeny_forbidden']) && $GLOBALS['allowDeny_forbidden']) {
 
159
        echo '<p>' . $GLOBALS['strAccessDenied'] . '</p>' . "\n";
 
160
    } else {
 
161
        if (!isset($GLOBALS['errno']) || (isset($GLOBALS['errno']) && $GLOBALS['errno'] != 2002) && $GLOBALS['errno'] != 2003) {
 
162
            echo '<p>' . $GLOBALS['strAccessDeniedExplanation'] . '</p>' . "\n";
 
163
        }
 
164
        PMA_mysqlDie($conn_error, '');
 
165
    }
 
166
?>
 
167
        </td>
 
168
    </tr>
 
169
</table>
 
170
<?php
 
171
    require_once('./footer.inc.php');
121
172
    return TRUE;
122
173
} // end of the 'PMA_auth_fails()' function
123
174