Menu

#2333 (ok 2.10) Detecting missing permissions on session directory

Latest_Git
fixed
1
2013-06-11
2007-01-08
No

I am a moderator from russian speaking forum about phpMyAdmin http://forum.php-myadmin.ru/. Our user have a problem that we can't help him to solve.

4.11-STABLE FreeBSD
mysql Ver 14.7 Distrib 4.1.22, for portbld-freebsd4.11 (i386) using readline 5.2
PHP 4.4.4 with Suhosin-Patch 0.9.5 (cgi-fcgi) (built: Oct 18 2006 07:26:28)
phpMyAdmin – 2.8.2.4(2.9.1.1)

Trying to create a table have a message - "The field count is empty!". Working on this problem shows us that some POST elements disapears in this part of code.

./libraries/common.lib.php

if (!isset($_REQUEST['token']) || $_SESSION['PMA_token'] != $_REQUEST['token']) {
/* List of parameters which are allowed from unsafe source */
$allow_list = array(
'db', 'table', 'lang', 'server', 'convcharset', 'collation_connection', 'target',
/* Session ID */
'phpMyAdmin',
/* Cookie preferences */
'pma_lang', 'pma_charset', 'pma_collation_connection', 'pma_convcharset',
/* Possible login form */
'pma_username', 'pma_password',
);
$keys = array_keys($_REQUEST);
/* Remove any non allowed stuff from requests */
foreach($keys as $key) {
if (!in_array($key, $allow_list)) {
unset($_REQUEST[$key]);
unset($_GET[$key]);
unset($_POST[$key]);
unset($GLOBALS[$key]);
} else {
// allowed stuff could be compromised so escape it
$_REQUEST[$key] = htmlspecialchars($_REQUEST[$key], ENT_QUOTES);
}
}
}

Commenting every unset functions solve a problem but it's hard to test is everything works fine with this changes or not.

File tbl_create.php. String 219:
PMA_mysqlDie($strTableEmpty, '', '', $err_url);
Changed on:
PMA_mysqlDie($strTableEmpty . " \$num_fields = {$num_fields}. ", '', '', $err_url);

This change shows empty $num_fields.

File libraries/common.lib.php, string 2881: havd been added element 'num_fields' to array $allow_list.

With this change script works fine with first part of creation of the table but shows "The field count is empty!" again when we trying to create fields.

I see that it is probably not a phpMyAdmin problem but may be someone have any ideas?
There was this kind of problem in this thread http://sourceforge.net/tracker/index.php?func=detail&aid=1597047&group_id=23067&atid=377409 but nobody could clear this out.

Thanks a lot.

Discussion

<< < 1 2 (Page 2 of 2)
  • Sebastian Mendel

    • priority: 5 --> 1
    • assigned_to: nobody --> cybot_tm
    • summary: Detecting a missing write permission on sessions directory --> (ok 2.11) Detecting missing permissions on session directory
    • status: open --> open-accepted
     
  • Jürgen Wind

    Jürgen Wind - 2007-01-31

    Logged In: YES
    user_id=1383652
    Originator: NO

    >we have no links to wiki in the source - all links go to local documentation,
    that's from the "pre wiki time", ok, but then link to (a new section?) in the docs,
    otherwise ppl will come to the forum and ask "i got this 'session' error, any ideas?".
    I will not answer those questions any longer ;) At least the offending path should be displayed (IMO).

     
  • Jürgen Wind

    Jürgen Wind - 2007-01-31

    Logged In: YES
    user_id=1383652
    Originator: NO

    another small typo: strSessionStartupErrorGenerall <- General

    and i still get (on demo and local):
    Warning: in /srv/http/pma.cihar.com/trunk-config/libraries/Theme.class.php on line 113

    Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /srv/http/pma.cihar.com/trunk-config/libraries/Theme.class.php:113) in /srv/http/pma.cihar.com/trunk-config/libraries/session.inc.php on line 123

    (deleting all pma-cookies did not help)

     
  • Sebastian Mendel

    Logged In: YES
    user_id=326580
    Originator: NO

    a cannot do anything about this error - as i cannot reproduce this on my testmachines, linux nor windows, with or without cookies, with or without valid session path

     
  • Jürgen Wind

    Jürgen Wind - 2007-01-31

    Logged In: YES
    user_id=1383652
    Originator: NO

    >a cannot do anything about this error - as i cannot reproduce this on my
    don't you run error_level = E_ALL (at least in the delel state)?

    until the culprit is found you could restore the previous behaviour (just to make demo look nicer ;) by adding the "@" again in line 99 only:

    } else {
    @session_start();
    }

     
  • Sebastian Mendel

    Logged In: YES
    user_id=326580
    Originator: NO

    > don't you run error_level = E_ALL (at least in the delel state)?

    of course - at least in the error log - but i do not get this error! nothing! nada! nichts!

    adding the @ makes it absolutely impossible for me to check my changes on pma.cihar.com - the only place where i currently can look at this error ...

     
  • Sebastian Mendel

    Logged In: YES
    user_id=326580
    Originator: NO

    can you remove the trigger_error() command on line 111 in Theme.class.php and check if the error is still there?

    or change it to a one-liner

     
  • Jürgen Wind

    Jürgen Wind - 2007-01-31

    Logged In: YES
    user_id=1383652
    Originator: NO

    yep,
    without "trigger_error" the warning is gone.

     
  • Sebastian Mendel

    Logged In: YES
    user_id=326580
    Originator: NO

    wired ... what PHP version you are using?

     
  • Jürgen Wind

    Jürgen Wind - 2007-01-31

    Logged In: YES
    user_id=1383652
    Originator: NO

    Apache/2.2.2 (Win32) DAV/2 mod_ssl/2.2.2 OpenSSL/0.9.8d mod_autoindex_color
    PHP/5.2.0
    on w2k, latest patches,
    (just for the comleteness: SeaMonkey 1.1, FF 1.5.0.9, IE6, Operea 9xx)

     
  • Sebastian Mendel

    Logged In: YES
    user_id=326580
    Originator: NO

    jürgen: can you please clear your session cookie - call the start page of phpMyAdmin at your test installation and send me the contents of the newly created session file in your tmp directory?

     
  • Jürgen Wind

    Jürgen Wind - 2007-02-01

    Logged In: YES
    user_id=1383652
    Originator: NO

    i found the culprit in Theme.class.php ;
    patch (line 99):

    function checkImgPath() {
    //$GLOBALS Array is empty here (sometimes?) !
    if(!isset($GLOBALS['cfg'])) {
    $GLOBALS['strThemeNoValidImgPath'] = 'No valid image path for theme %s found!';
    $GLOBALS['cfg']['ThemePath'] = substr($this->getPath(), 0, strrpos($this->getPath(), '/') );
    }

    ...

     
  • Sebastian Mendel

    Logged In: YES
    user_id=326580
    Originator: NO

    ;-) ... this was all i talking about

    you found the reason _why the message is *empty*_ (cause __qkaeup() is called at session_start() but at this time there is no $cfg or $str... defined this is loaded at a later stage)

    but this is not the _why the message *appears*_.

    as i removed __wakeup() there is no need for this patch for the empty message at the moment.

     
  • Jürgen Wind

    Jürgen Wind - 2007-02-03

    Logged In: YES
    user_id=1383652
    Originator: NO

    it would be helpful if this session check could be backported to pma 2.10 as well.

     
  • Sebastian Mendel

    Logged In: YES
    user_id=326580
    Originator: NO

    ok

     
  • Sebastian Mendel

    • summary: (ok 2.11) Detecting missing permissions on session directory --> (ok 2.10) Detecting missing permissions on session directory
    • status: open-accepted --> open-fixed
     
  • Marc Delisle

    Marc Delisle - 2007-02-28
    • status: open-fixed --> closed-fixed
     
  • Michal Čihař

    Michal Čihař - 2013-06-11
    • Status: closed-fixed --> fixed
     
<< < 1 2 (Page 2 of 2)