Uploaded image for project: 'CUBRID APIs'
  1. CUBRID APIs
  2. APIS-294

PHP 응용에서 cubrid_connect_with_url 사용 시 함수인자로 user/pass가 주어지지 않으면 public으로 접속됨

    Details

      Description

      PHP 응용에서 cubrid_connect_with_url("cci:cubrid:192.168.0.231:39000:demodb:dba::?althosts=192.168.0.231:38000&rctime=30") 와 같이 user/pass를 함수인자로 사용하지 않고 url문자열에만 포함시키는 경우 public으로 변경하여 로그인 됨.
      Patch2 수정 사항중 CUBRIDSUS-6781 cci_connect_with_url()에서 사용자/암호가 URL과 함수 인자로 동시에 주어진 경우 함수 인자를 사용하도록 수정후 발생하는 것으로 추정됨.
      patch2부터 발생 확인됨

      재현 절차:

      • demodb dba계정으로 foo 테이블 생성.

        csql -u dba -c "create table foo(a int); insert foo values(1);" demodb

      • PHP 응용 생성

        <?php
        header('Content-type: text/html; charset=euc-kr');
        //$conn=cubrid_connect_with_url("cci:cubrid:192.168.0.231:39000:demodb:dba::?althosts=192.168.0.231:38000&rctime=30","dba","");
        $conn=cubrid_connect_with_url("cci:cubrid:192.168.0.231:39000:demodb:dba::?althosts=192.168.0.231:38000&rctime=30");
        $sql = "SELECT a from foo";

        $result=cubrid_execute($conn, $sql);
        $pResult = cubrid_fetch($result);
        echo($pResult[0]);
        echo("<br/>");
        cubrid_close_request($result);
        cubrid_rollback($conn);
        cubrid_disconnect($conn);
        ?>

      • php 실행하면 아래와 같은 오류 발생

        [tmp2@newTest3 ~]$ php/bin/php url_test.php
        PHP Warning: Error: DBMS, -494, Semantic: Select is not authorized on foo. select foo.a from foo foo in /home/tmp2/url_test.php on line 7

        Warning: Error: DBMS, -494, Semantic: Select is not authorized on foo. select foo.a from foo foo in /home/tmp2/url_test.php on line 7
        PHP Warning: cubrid_fetch() expects parameter 1 to be resource, boolean given in /home/tmp2/url_test.php on line 8

        Warning: cubrid_fetch() expects parameter 1 to be resource, boolean given in /home/tmp2/url_test.php on line 8
        <br/>PHP Warning: cubrid_close_request() expects parameter 1 to be resource, boolean given in /home/tmp2/url_test.php on line 11

        Warning: cubrid_close_request() expects parameter 1 to be resource, boolean given in /home/tmp2/url_test.php on line 11

        Issue Links

          Activity

          Hide
          hellohuizhang 张慧 added a comment -
          Show
          hellohuizhang 张慧 added a comment - bug from CUBRIDSUS-9277
          Hide
          hellohuizhang 张慧 added a comment -

          Commit rev on PHP-8.4.1: 868

          Show
          hellohuizhang 张慧 added a comment - Commit rev on PHP-8.4.1: 868

            People

            • Assignee:
              jinhu 李金虎
              Reporter:
              hellohuizhang 张慧
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: