|
41 | 41 | #include "qgseditorwidgetregistry.h" |
42 | 42 |
|
43 | 43 | #include <QDomDocument> |
44 | | -#include <QFile> |
45 | 44 | #include <QNetworkDiskCache> |
46 | 45 | #include <QImage> |
47 | 46 | #include <QSettings> |
48 | 47 | #include <QDateTime> |
49 | 48 | #include <QScopedPointer> |
50 | | -#include <QTextStream> |
51 | 49 | // TODO: remove, it's only needed by a single debug message |
52 | 50 | #include <fcgi_stdio.h> |
53 | 51 | #include <stdlib.h> |
@@ -360,46 +358,9 @@ bool QgsServer::init( int & argc, char ** argv ) |
360 | 358 |
|
361 | 359 | // Instantiate authentication system |
362 | 360 | // creates or uses qgis-auth.db in ~/.qgis2/ or directory defined by QGIS_AUTH_DB_DIR_PATH env variable |
| 361 | + // set the master password as first line of file defined by QGIS_AUTH_PASSWORD_FILE env variable |
| 362 | + // (QGIS_AUTH_PASSWORD_FILE variable removed from environment after accessing) |
363 | 363 | QgsAuthManager::instance()->init( QgsApplication::pluginPath() ); |
364 | | - // set the master password from first line of file defined by QGIS_AUTH_PASSWORD_FILE env variable |
365 | | - const char* passenv = "QGIS_AUTH_PASSWORD_FILE"; |
366 | | - if ( getenv( passenv ) ) |
367 | | - { |
368 | | - QString passpath( getenv( passenv ) ); |
369 | | - // clear the env variable, so it can not be accessed from plugins, etc. |
370 | | -#ifdef Q_OS_WIN |
371 | | - putenv( passenv ); |
372 | | -#else |
373 | | - unsetenv( passenv ); |
374 | | -#endif |
375 | | - QString masterpass; |
376 | | - QFile passfile( passpath ); |
377 | | - if ( passfile.exists() && passfile.open( QIODevice::ReadOnly | QIODevice::Text ) ) |
378 | | - { |
379 | | - QTextStream passin( &passfile ); |
380 | | - while ( !passin.atEnd() ) |
381 | | - { |
382 | | - masterpass = passin.readLine(); |
383 | | - break; |
384 | | - } |
385 | | - passfile.close(); |
386 | | - } |
387 | | - if ( !masterpass.isEmpty() ) |
388 | | - { |
389 | | - if ( QgsAuthManager::instance()->setMasterPassword( masterpass, true ) ) |
390 | | - { |
391 | | - QgsDebugMsg( "Authentication master password set" ); |
392 | | - } |
393 | | - else |
394 | | - { |
395 | | - QgsDebugMsg( "Setting authentication master password FAILED using file: " + passpath ); |
396 | | - } |
397 | | - } |
398 | | - else |
399 | | - { |
400 | | - QgsDebugMsg( "QGIS_AUTH_PASSWORD_FILE set, but FAILED to read file: " + passpath ); |
401 | | - } |
402 | | - } |
403 | 364 |
|
404 | 365 | QString defaultConfigFilePath; |
405 | 366 | QFileInfo projectFileInfo = defaultProjectFile(); //try to find a .qgs file in the server directory |
|
0 commit comments