4

I use mapserver 7.0.2 to display Points which are taken from a MYSQL-database. If the the SQL-statement fails (for example the database can't be reached) the mapserver gives out an OGR error-message, revealing the entire SQL-statement including user and password.

Example:

msDrawMap(): Image handling error. Failed to draw layer named '....'. msOGRFileNextShape(): OGR error. MySQL connect failed for: .....,user=.....,password=....,host=....,port=...,tables=..... Access denied for user '........' (using password: YES) 

Is there a way to disable these exceptions? I already tried the msencrypt feature to encrypt the password, but it does not affect the exception text.

This shows how i connect to the DB in the mapfile:

 CONNECTION "<OGRVRTDataSource>
    <OGRVRTLayer name='....'>
        <SrcDataSource>MYSQL:....,user=....,password=....,host=....,port=....,tables=....</SrcDataSource>
        <SrcSQL>
        SELECT .... FROM .... 
        WHERE ....
        </SrcSQL> 
        <GeometryType>wkbPoint</GeometryType>
        <GeometryField encoding='PointFromColumns' x='....' y='....'/>
    </OGRVRTLayer>
    </OGRVRTDataSource>"    

I have these problems on my CentOS installation. I just checked if this problem also occurs on MS4W and here its a bit different:

msDrawMap(): Image handling error. Failed to draw layer named '....'. msOGRFileNextShape(): OGR error. MySQL connect failed for: geobase,user=root,password=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX connect to MySQL server on 'localhost' (10061) 

It still prints the user (when with problem server / login) and the SQL-Statement (when the statement fails) but on ms4w it masks the password with XXXXXXXXX... which is alot better than printing it.

  • Is that error message visible also for users or only for the MapServer administrator? – user30184 Nov 29 '16 at 7:01
  • It is visible to all users which is a problem, instead of the image it gives back the error (if the statement fails). – Kain Nov 29 '16 at 10:09
4

This is fixed in Mapserver-7.0.3 and backported to other versions (6.0.5, 6.2.3, 6.4.4). Looks like Kain's question was taken as a bug report which was subsequently fixed. See OGR error messages too verbose .

  • Thx, i would recommend version 7.0.4 as version 7.0.3 fired a similar error message. – Kain Mar 15 '17 at 17:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.