Support multiple hba.conf files, for Debian
authorJamie Cameron <jcameron@webmin.com>
Thu, 29 Nov 2007 19:29:35 +0000 (19:29 +0000)
committerJamie Cameron <jcameron@webmin.com>
Thu, 29 Nov 2007 19:29:35 +0000 (19:29 +0000)
27 files changed:
postgresql/CHANGELOG
postgresql/backup_config.pl
postgresql/config-debian-linux-4.0-*
postgresql/config.info
postgresql/config.info.ca
postgresql/config.info.de
postgresql/config.info.es
postgresql/config.info.fr
postgresql/config.info.ja_JP.UTF-8
postgresql/config.info.ja_JP.euc
postgresql/config.info.ko_KR.UTF-8
postgresql/config.info.ko_KR.euc
postgresql/config.info.pl
postgresql/config.info.ru_SU
postgresql/config.info.sv
postgresql/config.info.tr
postgresql/config.info.uk_UA
postgresql/config.info.zh_CN
postgresql/config.info.zh_CN.UTF-8
postgresql/config.info.zh_TW.Big5
postgresql/config.info.zh_TW.UTF-8
postgresql/down.cgi
postgresql/index.cgi
postgresql/install_check.pl
postgresql/postgresql-lib.pl
postgresql/save_host.cgi
postgresql/up.cgi

index 6eb7f8e..bf973bd 100644 (file)
@@ -59,3 +59,4 @@ Fixed a bug that prevented the 'valid until' date from being displayed for exist
 ---- Changes since 1.370 ----
 Added an option on the backup form to create the destination directory if missing.
 Re-wrote the backup form to use the new Webmin UI library.
+Improved support for Debian/Ubuntu systems that can have different PostgreSQL versions.
index cd18e0e..dc90fa4 100644 (file)
@@ -5,7 +5,7 @@ do 'postgresql-lib.pl';
 # Returns files and directories that can be backed up
 sub backup_config_files
 {
-return ( $config{'hba_conf'} );
+return ( $hba_conf_file );
 }
 
 # pre_backup(&files)
index 1c5abff..e12af50 100644 (file)
@@ -1,12 +1,12 @@
-hba_conf=/etc/postgresql/7.4/main/pg_hba.conf
+hba_conf=/etc/postgresql/7.4/main/pg_hba.conf  /etc/postgresql/8.2/main/pg_hba.conf
 psql=/usr/bin/psql
-start_cmd=/etc/init.d/postgresql-7.4 start
+start_cmd=if [ -r /etc/init.d/postgresql-7.4 ]; then /etc/init.d/postgresql-7.4 start; else /etc/init.d/postgresql-8.2 start; fi
 basedb=template1
 perpage=25
 plib=
 pass=
 login=postgres
-stop_cmd=/etc/init.d/postgresql-7.4 stop
+stop_cmd=if [ -r /etc/init.d/postgresql-7.4 ]; then /etc/init.d/postgresql-7.4 stop; else /etc/init.d/postgresql-8.2 stop; fi
 pid_file=/var/run/postmaster.pid
 nodbi=0
 dump_cmd=/usr/bin/pg_dump
index 109a87e..0a39c6d 100644 (file)
@@ -20,7 +20,7 @@ start_cmd=Command to start PostgreSQL,0
 stop_cmd=Command to stop PostgreSQL,3,Kill process
 setup_cmd=Command to initialize PostgreSQL,3,None
 pid_file=Path to postmaster PID file,8
-hba_conf=Path to host access config file,8
+hba_conf=Paths to host access config file,9,60,3,\t
 host=PostgreSQL host to connect to,3,localhost
 port=PostgreSQL port to connect to,3,Default
 dump_cmd=Path to pg_dump command,0
index 56f57ef..3a6b823 100644 (file)
@@ -20,7 +20,6 @@ start_cmd=Ordre per iniciar PostgreSQL,0
 stop_cmd=Ordre per aturar PostgreSQL,3,Mata el procés
 setup_cmd=Ordre per inicialitzar PostgreSQL,3,Cap
 pid_file=Camí del fitxer de PID de postmaster,8
-hba_conf=Camí del fitxer de configuració d'accés a hosts,8
 host=Host PostgreSQL a connectar,3,localhost
 port=Port PostgreSQL a connectar,3,Defecte
 dump_cmd=Camí de l'ordre pg_dump,0
index 7e95360..4502a47 100644 (file)
@@ -3,7 +3,6 @@ basedb=Anf&#228;ngliche PostgreSQL-Datenbank,0
 blob_mode=Zeige Blob- und Textfelder als,1,0-Daten in der Tabelle,1-Zu downloadende Verbindungen
 date_subs=Verwende <tt>strftime</tt> als Ersatz der Backup-Speicherorte?,1,1-Ja,0-Nein
 dump_cmd=Pfad zu <tt>pg_dump</tt>,0
-hba_conf=Pfad zur Host-Zugriff-Konfigurationsdatei,0
 host=Verbinde zu PostgreSQL-Host,3,Localhost
 line1=Konfigurierbare Options,11
 line2=Systemkonfiguration,11
index db82aea..1afd5c3 100644 (file)
@@ -6,7 +6,6 @@ basedb=Base de datos inicial de PostgreSQL,0
 start_cmd=Comando para arrancar PostgreSQL,0
 stop_cmd=Comando para parar PostgreSQL,3,Matar proceso
 pid_file=Trayectoria a archivo PID del jefe de estafeta de correos,0
-hba_conf=Trayectoria archivo de configuración de acceso de máquinas,0
 perpage=Número de filas a mostrar por página,0
 host=Máquina PostgreSQL a conectarse,3,Local
 unix=Usuario de Unix como el que ejecutar los comandos de PostgreSQL,3,root
index 4392084..3784a80 100644 (file)
@@ -16,7 +16,6 @@ start_cmd=Commande pour d&#233;marrer PostgreSQL,0
 stop_cmd=Commande pour arr&#234;ter PostgreSQL,3,Tuer le processus
 setup_cmd=Commande pour initialiser PostgreSQL,3,Aucune
 pid_file=Chemin d'acc&#232;s au fichier PID du postmaster,0
-hba_conf=Chemin d'acc&#232;s au fichier de configuration d'acc&#232;s aux h&#244;tes,0
 host=H&#244;te PostgreSQL auquel se connecter,3,localhost
 port=Port PostgreSQL auquel se connecter,3,Par d&#233;faut
 dump_cmd=Chemin d'acc&#232;s &#224; la commande pg_dump,0
index 213d6b6..38649f5 100644 (file)
@@ -1,4 +1,3 @@
-hba_conf=pg_hba.confファイル,0
 start_cmd=PostgreSQL起動コマンド,0
 rstr_cmd=pg_restore コマンドのパス,0
 plib=PostgreSQL シェアードライブラリ,3,必要無し
index c7c70c9..1de8ae9 100644 (file)
@@ -15,7 +15,6 @@ start_cmd=PostgreSQL
 stop_cmd=PostgreSQLÄä»ß¥³¥Þ¥ó¥É,3,Kill ¥×¥í¥»¥¹
 setup_cmd=PostgreSQL ½é´ü²½¥³¥Þ¥ó¥É,3,̵¤·
 pid_file=postmaster PID ¥Õ¥¡¥¤¥ë,0
-hba_conf=pg_hba.conf¥Õ¥¡¥¤¥ë,0
 host=PostgreSQLÀܳ¥Û¥¹¥È,3,¥í¡¼¥«¥ë¥Û¥¹¥È
 port=PostgreSQL¤ÎÀܳ¥Ý¡¼¥È,3,¥Ç¥Õ¥©¥ë¥È
 dump_cmd=pg_dump ¥³¥Þ¥ó¥É¤Î¥Ñ¥¹,0
index 586c537..0c0163a 100644 (file)
@@ -1,4 +1,3 @@
-hba_conf=호스트 접근 설정 파일 경로,8
 start_cmd=PostgreSQL 시작 명령,0
 rstr_cmd=pg_restore 명령 경로,0
 plib=PostgreSQL 공유 라이브러리 경로,3,필요 없음
index 106f4e9..446cbd2 100644 (file)
@@ -20,7 +20,6 @@ start_cmd=PostgreSQL 
 stop_cmd=PostgreSQL Á¤Áö ¸í·É,3,ÇÁ·Î¼¼½º Á×ÀÓ
 setup_cmd=PostgreSQL ÃʱâÈ­ ¸í·É,3,¾øÀ½
 pid_file=postmaster PID ÆÄÀÏ °æ·Î,8
-hba_conf=È£½ºÆ® Á¢±Ù ¼³Á¤ ÆÄÀÏ °æ·Î,8
 host=¿¬°áÇÒ PostgreSQL È£½ºÆ®,3,localhost
 port=¿¬°áÇÒ PostgreSQL Æ÷Æ®,3,±âº»
 dump_cmd=pg_dump ¸í·É °æ·Î,0
index 2ff7314..2033218 100644 (file)
@@ -6,6 +6,5 @@ basedb=Pocz
 start_cmd=Polecenie uruchamiaj±ce PostgreSQLa,0
 stop_cmd=Polecenie zatrzymuj±ce PostgreSQLa,3,Zabicie procesu
 pid_file=¦cie¿ka z&nbsp;numerem PID procesu <tt>postmaster</tt>,0
-hba_conf=¦cie¿ka do pliku konfiguracyjnego dostêpu hostów,0
 perpage=Ilo¶æ linii wy¶wietlanych na stronie,0
 host=Host PostgreSQLa&#44; z&nbsp;którym siê ³±czyæ,3,Localhost
index 58061a6..faac59a 100644 (file)
@@ -11,6 +11,5 @@ start_cmd=
 stop_cmd=ëÏÍÁÎÄÁ ÄÌÑ ÏÓÔÁÎÏ×ËÉ PostgreSQL,3,õÂÉÔØ ÐÒÏÃÅÓÓ
 setup_cmd=ëÏÍÁÎÄÁ ÄÌÑ ÉÎÉÃÉÁÌÉÚÁÃÉÉ PostgreSQL,3,îÅÔ
 pid_file=ðÕÔØ Ë ÆÁÊÌÕ PID postmaster,0
-hba_conf=ðÕÔØ Ë ÆÁÊÌ ÎÁÓÔÒÏÅË ÄÏÓÔÕÐÎÙÈ ÕÚÌÏ×,0
 host=õÚÅÌ PostgreSQL ÄÌÑ ÓÏÅÄÉÎÅÎÉÊ,3,localhost
 unix=ðÏÌØÚÏ×ÁÔÅÌØ unix, ÏÔ ËÏÔÏÒÏÇÏ ÂÕÄÕÔ ÚÁÐÕÓËÁÔØÓÑ ËÏÍÁÎÄÙ PostgreSQL,3,root
index 25f9391..f3eaec2 100644 (file)
@@ -6,6 +6,5 @@ basedb=PostgreSQL-databas att starta med,0
 start_cmd=Kommando för att starta PostgreSQL,0
 stop_cmd=Kommando för att stanna PostgreSQL,3,Döda processen
 pid_file=Sökväg till postmaster-PID-fil,0
-hba_conf=Sökväg till konfigurationsfil för datortillgång,0
 perpage=Antal rader som ska visas per sida,0
 host=PostgreSQL-dator att koppla upp mot,3,Localhost
index 7f6e10e..ce9c7fc 100644 (file)
@@ -20,7 +20,6 @@ start_cmd=Command to start PostgreSQL,0
 stop_cmd=Command to stop PostgreSQL,3,Kill process
 setup_cmd=Command to initialize PostgreSQL,3,None
 pid_file=Path to postmaster PID file,0
-hba_conf=Path to host access config file,0
 host=PostgreSQL host to connect to,3,localhost
 port=PostgreSQL port to connect to,3,Default
 dump_cmd=Path to pg_dump command,0
index f05f064..e0e2cb0 100644 (file)
@@ -1,4 +1,3 @@
-hba_conf=Øëÿõ äî ôàéë íàñòðîþâàíü äîñòóïíèõ âóçë³â,0\r
 start_cmd=Êîìàíäà äëÿ çàïóñêó PostgreSQL,0\r
 plib=Øëÿõ äî ïîä³ëþâàíèõ á³áë³îòåê PostgreSQL,3,Íå ïîòð³áíèé\r
 pass=Ïàðîëü àäì³í³ñòðàòîðà,12\r
index 113640c..270ee6f 100644 (file)
@@ -6,5 +6,4 @@ basedb=
 start_cmd=Æô¶¯ PostgreSQL µÄÃüÁî,0
 stop_cmd=Í£Ö¹ PostgreSQL µÄÃüÁî,3,¹Ø±Õ½ø³Ì
 pid_file=postmaster ½ø³Ì±êʶÎļþµÄ·¾¶,0
-hba_conf=Ö÷»ú·ÃÎÊÅäÖÃÎļþ·¾¶,0
 perpage=ÿҳÏÔʾµÄÐÐÊý,0
index 41c7a19..2c6e74a 100644 (file)
@@ -1,4 +1,3 @@
-hba_conf=主机访问配置文件路径,0
 start_cmd=启动 PostgreSQL 的命令,0
 perpage=每页显示的行数,0
 plib=PostgreSQL 共享库路径,3,不需要
index faa2c34..886163f 100644 (file)
@@ -6,7 +6,6 @@ basedb=
 start_cmd=±Ò°Ê PostgreSQL ªº©R¥O,0\r
 stop_cmd=°±¤î PostgreSQL ªº©R¥O,3,Ãö³¬µ{§Ç
 pid_file=postmaster PIDÀɮ׸ô®|,0
-hba_conf=¥D¾÷¶i¤J°t¸mÀɮ׸ô®|,0
 perpage=¨C­¶Åã¥Üªº¦æ¼Æ,0
 host=PostgreSQL¥D¾÷³s½u¨ì,3,¥»¦aºÝ
 unix=°õ¦æPostgreSQL«ü¥OªºUnix¨Ï¥ÎªÌ,3,root
index 337f505..61118dd 100644 (file)
@@ -1,4 +1,3 @@
-hba_conf=主機進入配置檔案路徑,0
 start_cmd=啟動 PostgreSQL 的命令,0
 host=PostgreSQL主機連線到,3,本地端
 perpage=每頁顯示的行數,0
index c9e7355..c9a6481 100755 (executable)
@@ -6,11 +6,11 @@ require './postgresql-lib.pl';
 &ReadParse();
 $access{'users'} || &error($text{'host_ecannot'});
 
-&lock_file($config{'hba_conf'});
+&lock_file($hba_conf_file);
 @hosts = &get_hba_config();
 $host = $hosts[$in{'idx'}];
 &swap_hba($host, $hosts[$in{'idx'}+1]);
-&unlock_file($config{'hba_conf'});
+&unlock_file($hba_conf_file);
 &restart_postgresql();
 &webmin_log('move', 'hba',
                   $host->{'type'} eq 'local' ? 'local' :
index 00be72e..d92c277 100755 (executable)
@@ -23,12 +23,13 @@ if (!-x $config{'psql'} || -d $config{'psql'}) {
        }
 
 # Check for the config file
-if (!-r $config{'hba_conf'}) {
+if (!-r $hba_conf_file) {
        &ui_print_header(undef, $text{'index_title'}, "", "intro", 1, 1, 0,
                &help_search_link("postgresql", "man", "doc", "google"));
+       ($hba_conf_file) = split(/\t+/, $config{'hba_conf'});
        if ($config{'setup_cmd'}) {
                # Offer to setup DB for first time
-               print &text('index_setup', "<tt>$config{'hba_conf'}</tt>",
+               print &text('index_setup', "<tt>$hba_conf_file</tt>",
                                  "<tt>$config{'setup_cmd'}</tt>"),"<p>\n";
                print "<form action=setup.cgi><center>\n";
                print "<input type=submit value='$text{'index_setupok'}'>\n";
@@ -36,7 +37,7 @@ if (!-r $config{'hba_conf'}) {
                }
        else {
                # Config file wasn't found
-               print &text('index_ehba', "<tt>$config{'hba_conf'}</tt>",
+               print &text('index_ehba', "<tt>$hba_conf_file</tt>",
                    "$gconfig{'webprefix'}/config.cgi?$module_name"),"<p>\n";
                }
        &ui_print_footer("/", $text{'index'});
index 205a420..737154a 100644 (file)
@@ -11,7 +11,7 @@ sub is_installed
 return 0 if (!-x $config{'psql'});
 if ($_[0]) {
        # Check for .conf and if can login
-       return 1 if (!-r $config{'hba_conf'});
+       return 1 if (!-r $hba_conf_file);
        return 2 if (&is_postgresql_running() == 1);
        }
 return 1;
index cf348a4..237e53e 100644 (file)
@@ -44,6 +44,12 @@ else {
                }
        $max_dbs = $config{'max_dbs'};
        }
+foreach my $hba (split(/\t+/, $config{'hba_conf'})) {
+       if (-r $hba) {
+               $hba_conf_file = $hba;
+               last;
+               }
+       }
 $cron_cmd = "$module_config_directory/backup.pl";
 
 if (!$config{'nodbi'}) {
@@ -517,7 +523,7 @@ else {
 sub get_hba_config
 {
 local $lnum = 0;
-open(HBA, $config{'hba_conf'});
+open(HBA, $hba_conf_file);
 while(<HBA>) {
        s/\r|\n//g;
        s/^\s*#.*$//g;
@@ -587,7 +593,7 @@ return @rv;
 # create_hba(&hba, version)
 sub create_hba
 {
-local $lref = &read_file_lines($config{'hba_conf'});
+local $lref = &read_file_lines($hba_conf_file);
 push(@$lref, &hba_line($_[0], $_[1]));
 &flush_file_lines();
 }
@@ -595,7 +601,7 @@ push(@$lref, &hba_line($_[0], $_[1]));
 # delete_hba(&hba, version)
 sub delete_hba
 {
-local $lref = &read_file_lines($config{'hba_conf'});
+local $lref = &read_file_lines($hba_conf_file);
 splice(@$lref, $_[0]->{'line'}, 1);
 &flush_file_lines();
 }
@@ -603,7 +609,7 @@ splice(@$lref, $_[0]->{'line'}, 1);
 # modify_hba(&hba, version)
 sub modify_hba
 {
-local $lref = &read_file_lines($config{'hba_conf'});
+local $lref = &read_file_lines($hba_conf_file);
 splice(@$lref, $_[0]->{'line'}, 1, &hba_line($_[0], $_[1]));
 &flush_file_lines();
 }
@@ -611,7 +617,7 @@ splice(@$lref, $_[0]->{'line'}, 1, &hba_line($_[0], $_[1]));
 # swap_hba(&hba1, &hba2)
 sub swap_hba
 {
-local $lref = &read_file_lines($config{'hba_conf'});
+local $lref = &read_file_lines($hba_conf_file);
 local $line0 = $lref->[$_[0]->{'line'}];
 local $line1 = $lref->[$_[1]->{'line'}];
 $lref->[$_[1]->{'line'}] = $line0;
index 35c4a92..23f0a58 100755 (executable)
@@ -4,7 +4,7 @@
 
 require './postgresql-lib.pl';
 &ReadParse();
-&lock_file($config{'hba_conf'});
+&lock_file($hba_conf_file);
 $v = &get_postgresql_version();
 @all = &get_hba_config($v);
 $host = $all[$in{'idx'}] if (!$in{'new'});
@@ -94,7 +94,7 @@ else {
                &modify_hba($host, $v);
                }
        }
-&unlock_file($config{'hba_conf'});
+&unlock_file($hba_conf_file);
 &restart_postgresql();
 &webmin_log($in{'new'} ? 'create' : $in{'delete'} ? 'delete' : 'modify',
            'hba', $host->{'type'} eq 'local' ? 'local' :
index b7d07a4..dfa489d 100755 (executable)
@@ -6,11 +6,11 @@ require './postgresql-lib.pl';
 &ReadParse();
 $access{'users'} || &error($text{'host_ecannot'});
 
-&lock_file($config{'hba_conf'});
+&lock_file($hba_conf_file);
 @hosts = &get_hba_config();
 $host = $hosts[$in{'idx'}];
 &swap_hba($host, $hosts[$in{'idx'}-1]);
-&unlock_file($config{'hba_conf'});
+&unlock_file($hba_conf_file);
 &restart_postgresql();
 &webmin_log('move', 'hba',
                   $host->{'type'} eq 'local' ? 'local' :