From cf432879a14568c4bb44cd2f9e5a9bd0e168edc1 Mon Sep 17 00:00:00 2001 From: Ilia Ross Date: Thu, 23 Apr 2026 18:00:07 +0200 Subject: [PATCH 1/3] Fix unsafe mailbox attachment handling --- mailboxes/detach.cgi | 17 +++++++++++++++-- mailboxes/detachall.cgi | 5 +++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/mailboxes/detach.cgi b/mailboxes/detach.cgi index a9bc8af6e..ea419b7c8 100755 --- a/mailboxes/detach.cgi +++ b/mailboxes/detach.cgi @@ -68,8 +68,21 @@ if ($in{'scale'}) { else { # Just output the attachment print "X-no-links: 1\n"; + $fn = $attach->{'filename'} ? &decode_mimewords($attach->{'filename'}) + : "attachment"; + $fn =~ s/[\r\n\0"\\\/]//g; + $fn ||= "attachment"; @download = split(/\t+/, $config{'download'}); - if ($in{'type'}) { + if ($attach->{'type'} =~ /^image\/svg(\+xml)?/i || + $in{'type'} =~ /^image\/svg(\+xml)?/i || + $fn =~ /\.svgz?$/i) { + # SVG can execute scripts when served from the Webmin origin. + print "Content-Disposition: Attachment; filename=\"$fn\"\n" + if ($in{'save'}); + print "Content-type: text/plain\n\n"; + print $attach->{'data'}; + } + elsif ($in{'type'}) { # Display as a specific MIME type print "Content-type: $in{'type'}\n\n"; print $attach->{'data'}; @@ -78,7 +91,7 @@ else { # Auto-detect type if ($in{'save'}) { # Force download - print "Content-Disposition: Attachment; filename=\"$attach->{'filename'}\"\n"; + print "Content-Disposition: Attachment; filename=\"$fn\"\n"; } if ($attach->{'type'} eq 'message/delivery-status') { print "Content-type: text/plain\n\n"; diff --git a/mailboxes/detachall.cgi b/mailboxes/detachall.cgi index 2f863406d..6a6a8b825 100755 --- a/mailboxes/detachall.cgi +++ b/mailboxes/detachall.cgi @@ -37,6 +37,11 @@ foreach $a (@attach) { else { $fn = "file".(++$n).".".&type_to_extension($a->{'type'}); } + $fn =~ s/[\r\n\0]//g; + $fn =~ s/\\/\//g; + $fn =~ s/^.*\///g; + $fn =~ /^\.+$/ && ($fn = ""); + $fn ||= "file".(++$n); # Write the file &open_tempfile(FILE, ">$temp/$fn", 0, 1); From 19190a6f5b4760faed01a2e570c7a8908a873675 Mon Sep 17 00:00:00 2001 From: Ilia Ross Date: Thu, 23 Apr 2026 21:00:32 +0200 Subject: [PATCH 2/3] Fix ACL option name --- apache/lang/ar.auto | 2 +- apache/lang/bg | 2 +- apache/lang/ca | 2 +- apache/lang/cs | 2 +- apache/lang/da | 2 +- apache/lang/de | 2 +- apache/lang/el | 2 +- apache/lang/en | 2 +- apache/lang/es.auto | 2 +- apache/lang/eu.auto | 2 +- apache/lang/fa.auto | 2 +- apache/lang/fi.auto | 2 +- apache/lang/fr | 2 +- apache/lang/hr | 2 +- apache/lang/hu.auto | 2 +- apache/lang/it.auto | 2 +- apache/lang/ja | 2 +- apache/lang/ko.auto | 2 +- apache/lang/ms | 2 +- apache/lang/nl | 2 +- apache/lang/no | 2 +- apache/lang/pl | 2 +- apache/lang/pt.auto | 2 +- apache/lang/pt_BR | 2 +- apache/lang/ru | 2 +- apache/lang/sk.auto | 2 +- apache/lang/sv | 2 +- apache/lang/tr.auto | 2 +- apache/lang/uk.auto | 2 +- apache/lang/zh | 2 +- apache/lang/zh_TW.auto | 2 +- 31 files changed, 31 insertions(+), 31 deletions(-) diff --git a/apache/lang/ar.auto b/apache/lang/ar.auto index f5293ec6e..1e7b66a5b 100644 --- a/apache/lang/ar.auto +++ b/apache/lang/ar.auto @@ -330,7 +330,7 @@ acl_types=أنواع التوجيه المتاحة acl_all=الكل acl_sel=المحدد .. acl_names=يمكن تعديل أسماء الخادم؟ -acl_dirs=Apache directives available
(Subject to types limit above) +acl_dirs=توجيهات Apache المتاحة، وفقًا لأنواع التوجيهات المحددة أعلاه acl_dirs0=الكل acl_dirs1=المدرجة فقط .. acl_dirs2=كل ما عدا المدرجة .. diff --git a/apache/lang/bg b/apache/lang/bg index 9bb2dd767..452834aa2 100644 --- a/apache/lang/bg +++ b/apache/lang/bg @@ -329,7 +329,7 @@ acl_types=Налични видове директиви acl_all=Всички acl_sel=Избрани.. acl_names=Може да редактира имена на сървъри? -acl_dirs=Достъпни директиви на Apache
(съгласно лимита на типове по-горе) +acl_dirs=Налични директиви на Apache, ограничени от избраните по-горе типове директиви acl_dirs0=Всички acl_dirs1=Само изброените .. acl_dirs2=Всички освен изброените .. diff --git a/apache/lang/ca b/apache/lang/ca index 13740921b..b9a629920 100644 --- a/apache/lang/ca +++ b/apache/lang/ca @@ -329,7 +329,7 @@ acl_types=Tipus de directives disponibles acl_all=Tots acl_sel=Seleccionats... acl_names=Pot editar els noms dels servidors -acl_dirs=Directives Apache disponibles
(Subjectes al límit de tipus superior) +acl_dirs=Directives Apache disponibles, limitades pels tipus de directiva seleccionats a sobre acl_dirs0=Totes acl_dirs1=Només les llistades acl_dirs2=Totes excepte les llistades diff --git a/apache/lang/cs b/apache/lang/cs index 8d226397c..4e164f7a6 100644 --- a/apache/lang/cs +++ b/apache/lang/cs @@ -320,7 +320,7 @@ acl_types=Typy direktiv k dispozici acl_all=Všechny acl_sel=Vybrané.. acl_names=Mohu upravovat názvy serverů? -acl_dirs=Direktivy Apache jsou přístupné
(Subject to types limit above) +acl_dirs=Dostupné direktivy Apache, omezené typy direktiv vybranými výše acl_dirs0=Vše acl_dirs1=Jen vybrané .. acl_dirs2=Vše kromě vybraných .. diff --git a/apache/lang/da b/apache/lang/da index 73bfbaa69..4483fc738 100644 --- a/apache/lang/da +++ b/apache/lang/da @@ -78,7 +78,7 @@ acl_types=Tilgængelige direktiv typer acl_all=Alle acl_sel=Valgte .. acl_names=Kan redigere servernavne? -acl_dirs=Apache direktiver tilgængelige
(Subjekt tor type begrænsinger ovenfor) +acl_dirs=Tilgængelige Apache-direktiver, begrænset af de direktivtyper, der er valgt ovenfor acl_dirs0=Alle acl_dirs1=Kun listede .. acl_dirs2=Alle undtagen listede .. diff --git a/apache/lang/de b/apache/lang/de index 8b1edb5e5..2c10da12b 100644 --- a/apache/lang/de +++ b/apache/lang/de @@ -331,7 +331,7 @@ acl_types=Verfügbare Direktiventypen acl_all=Alle acl_sel=Ausgewählt.. acl_names=Kann Servernamen bearbeiten? -acl_dirs=Verfügbare Apache-Direktiven
(Abhängig von obigen Typenbeschränkungen) +acl_dirs=Verfügbare Apache-Direktiven, eingeschränkt durch die oben ausgewählten Direktivtypen acl_dirs0=Alle acl_dirs1=Nur aufgeführte .. acl_dirs2=Alle außer aufgeführte .. diff --git a/apache/lang/el b/apache/lang/el index 79a97623e..9ec93139d 100644 --- a/apache/lang/el +++ b/apache/lang/el @@ -329,7 +329,7 @@ acl_types=Directive types available acl_all=All acl_sel=Selected.. acl_names=Can edit server names? -acl_dirs=Apache directives available
(Subject to types limit above) +acl_dirs=Διαθέσιμες οδηγίες Apache, περιορισμένες από τους τύπους οδηγιών που έχουν επιλεγεί παραπάνω acl_dirs0=All acl_dirs1=Only listed .. acl_dirs2=All except listed .. diff --git a/apache/lang/en b/apache/lang/en index 8e39f2a98..466f83f5b 100644 --- a/apache/lang/en +++ b/apache/lang/en @@ -332,7 +332,7 @@ acl_types=Directive types available acl_all=All acl_sel=Selected.. acl_names=Can edit server names? -acl_dirs=Apache directives available
(Subject to types limit above) +acl_dirs=Available Apache directives, limited by the directive types selected above acl_dirs0=All acl_dirs1=Only listed .. acl_dirs2=All except listed .. diff --git a/apache/lang/es.auto b/apache/lang/es.auto index 487518fea..eaf481b05 100644 --- a/apache/lang/es.auto +++ b/apache/lang/es.auto @@ -33,7 +33,7 @@ htaccess_err=Error al crear el archivo de opciones defines_list=Parámetros definidos acl_aliasdir=Limite los alias al directorio -acl_dirs=Directivas de Apache disponibles
(Sujeto al límite de tipos anterior) +acl_dirs=Directivas de Apache disponibles, limitadas por los tipos de directiva seleccionados arriba acl_dirs0=Todos acl_dirs1=Solo listado .. acl_dirs2=Todos excepto los enumerados. diff --git a/apache/lang/eu.auto b/apache/lang/eu.auto index abe8c1655..39a4713f4 100644 --- a/apache/lang/eu.auto +++ b/apache/lang/eu.auto @@ -331,7 +331,7 @@ acl_types=Zuzentarau motak eskuragarri acl_all=guztiak acl_sel=Hautatutako .. acl_names=Editatu al ditzakezu zerbitzariaren izenak? -acl_dirs=Apache zuzentzaileak eskuragarri daude (Aurreko muga moten menpe) +acl_dirs=Eskuragarri dauden Apache zuzentarauak, goian hautatutako zuzentarau motez mugatuta acl_dirs0=guztiak acl_dirs1=Zerrenda bakarra .. acl_dirs2=Zerrendatu guztiak .. diff --git a/apache/lang/fa.auto b/apache/lang/fa.auto index ec764f9dc..470d2dd3b 100644 --- a/apache/lang/fa.auto +++ b/apache/lang/fa.auto @@ -35,7 +35,7 @@ defines_list=پارامترهای تعریف شده acl_aliasdir=نام مستعار را به فهرست راهنما محدود كنيد acl_names=آیا می توانید نام سرور را ویرایش کنید؟ -acl_dirs=Apache directives available
(Subject to types limit above) +acl_dirs=دستورهای Apache موجود، محدود به انواع دستور انتخاب‌شده در بالا acl_dirs0=همه acl_dirs1=فقط ذکر شده .. acl_dirs2=همه به جز ذکر شده .. diff --git a/apache/lang/fi.auto b/apache/lang/fi.auto index 9bd66d4f2..4235e1fdf 100644 --- a/apache/lang/fi.auto +++ b/apache/lang/fi.auto @@ -331,7 +331,7 @@ acl_types=Direktiivityyppejä saatavana acl_all=Kaikki acl_sel=Valitut .. acl_names=Voiko palvelimen nimiä muokata? -acl_dirs=Apache-direktiivit saatavilla
(Ellei tyyppirajoitusta ole yllä) +acl_dirs=Saatavilla olevat Apache-direktiivit, joita yllä valitut direktiivityypit rajoittavat acl_dirs0=Kaikki acl_dirs1=Vain listattu .. acl_dirs2=Kaikki paitsi luetellut .. diff --git a/apache/lang/fr b/apache/lang/fr index 490a252fd..791d76d1f 100644 --- a/apache/lang/fr +++ b/apache/lang/fr @@ -331,7 +331,7 @@ acl_types=Types de directives disponibles acl_all=Tous acl_sel=Sélectionnés... acl_names=Peut modifier les noms de serveurs? -acl_dirs=Directives Apache disponibles
(assujetties aux limites ci-dessus) +acl_dirs=Directives Apache disponibles, limitées par les types de directives sélectionnés ci-dessus acl_dirs0=Toutes acl_dirs1=Seulement les suivantes ... acl_dirs2=Toutes sauf les suivantes ... diff --git a/apache/lang/hr b/apache/lang/hr index 005223a62..e49ef48ce 100644 --- a/apache/lang/hr +++ b/apache/lang/hr @@ -322,7 +322,7 @@ acl_types=Tipovi propisa dostupni acl_all=Sve acl_sel=Odabrano.. acl_names=Ne možete urediti nazive poslužitelja? -acl_dirs=Apache propisi dostupni
(Mterija tipova limita je iznad) +acl_dirs=Dostupne Apache direktive, ograničene vrstama direktiva odabranima iznad acl_dirs0=Sve acl_dirs1=Samo izlistano .. acl_dirs2=Sve prihvaćene liste .. diff --git a/apache/lang/hu.auto b/apache/lang/hu.auto index 5c70a4b61..000bddd21 100644 --- a/apache/lang/hu.auto +++ b/apache/lang/hu.auto @@ -32,7 +32,7 @@ htaccess_err=Nem sikerült létrehozni az opciós fájlt defines_list=Meghatározott paraméterek acl_aliasdir=Korlátozza az álneveket a könyvtárba -acl_dirs=Apache-irányelvek elérhetőek
(A fenti típuskorlátozástól függően) +acl_dirs=Elérhető Apache-irányelvek, a fent kiválasztott irányelvtípusok által korlátozva acl_dirs0=Összes acl_dirs1=Csak felsorolt .. acl_dirs2=Minden, kivéve a felsorolt .. diff --git a/apache/lang/it.auto b/apache/lang/it.auto index 90a30cff0..7d62d000c 100644 --- a/apache/lang/it.auto +++ b/apache/lang/it.auto @@ -45,7 +45,7 @@ restart_ecannot=Non è consentito applicare modifiche acl_apply=È possibile applicare le modifiche? acl_aliasdir=Limita gli alias alla directory acl_names=Puoi modificare i nomi dei server? -acl_dirs=Direttive Apache disponibili
(Soggetto al limite di tipi sopra) +acl_dirs=Direttive Apache disponibili, limitate dai tipi di direttiva selezionati sopra acl_dirs0=Tutti acl_dirs1=Solo elencato .. acl_dirs2=Tutti tranne quelli elencati. .. diff --git a/apache/lang/ja b/apache/lang/ja index c6375017c..08eaf8871 100644 --- a/apache/lang/ja +++ b/apache/lang/ja @@ -322,7 +322,7 @@ acl_types=利用可能なディレクティブのタイプ acl_all=すべて acl_sel=選択済み.. acl_names=サーバー名を編集できますか? -acl_dirs=利用可能なApacheディレクティブ
(上記のタイプ制限に従う) +acl_dirs=利用可能な Apache ディレクティブ。上で選択したディレクティブタイプに制限されます acl_dirs0=All acl_dirs1=のみ記載.. acl_dirs2=All except listed .. diff --git a/apache/lang/ko.auto b/apache/lang/ko.auto index 10e150f05..629607ee5 100644 --- a/apache/lang/ko.auto +++ b/apache/lang/ko.auto @@ -77,7 +77,7 @@ restart_ecannot=변경 사항을 적용 할 수 없습니다 acl_apply=변경 사항을 적용 할 수 있습니까? acl_aliasdir=디렉토리로 별명 제한 acl_names=서버 이름을 편집 할 수 있습니까? -acl_dirs=Apache 지시문 사용 가능
(위의 유형 제한에 따름) +acl_dirs=사용 가능한 Apache 지시문, 위에서 선택한 지시문 유형으로 제한됨 acl_dirs0=모두 acl_dirs1=목록 만 .. acl_dirs2=목록을 제외한 모든 .. diff --git a/apache/lang/ms b/apache/lang/ms index 25999dba0..8f0b871d2 100644 --- a/apache/lang/ms +++ b/apache/lang/ms @@ -297,7 +297,7 @@ acl_types=Jenis arahan boleh didapati acl_all=Semua acl_sel=Dipilih .. acl_names=Boleh sunting nama pelayan? -acl_dirs=Arahan Apache yang tersedia
(Tertakluk kepada jenis had seperti diatas) +acl_dirs=Arahan Apache yang tersedia, dihadkan oleh jenis arahan yang dipilih di atas acl_dirs0=Semua acl_dirs1=Hanya disenaraikan .. acl_dirs2=Semua kecuali yang disenaraikan .. diff --git a/apache/lang/nl b/apache/lang/nl index 673123739..6f7316481 100644 --- a/apache/lang/nl +++ b/apache/lang/nl @@ -328,7 +328,7 @@ acl_types=Beschikbare soorten richtlijnen acl_all=Alles acl_sel=Geselecteerd.. acl_names=Mag server namen bewerken? -acl_dirs=Beschikbare Apache richtlijnen
(Behalve de soorten hierboven) +acl_dirs=Beschikbare Apache-richtlijnen, beperkt door de hierboven geselecteerde richtlijntypen acl_dirs0=Alles acl_dirs1=Alleen die in de lijst acl_dirs2=Alles behalve die in de lijst .. diff --git a/apache/lang/no b/apache/lang/no index 6a042e138..77e8dc141 100644 --- a/apache/lang/no +++ b/apache/lang/no @@ -331,7 +331,7 @@ acl_types=Tilgjengelige direktivtyper acl_all=Alle acl_sel=Valgte.. acl_names=Kan redigere tjenernavn? -acl_dirs=Tilgjengelig Apache direktiver
(Med typebegrensninger som angitt ovenfor) +acl_dirs=Tilgjengelige Apache-direktiver, begrenset av direktivtypene som er valgt ovenfor acl_dirs0=Alle acl_dirs1=Kun de i listen .. acl_dirs2=Alle unntatt de i listen .. diff --git a/apache/lang/pl b/apache/lang/pl index 911ff7834..9478d01a1 100644 --- a/apache/lang/pl +++ b/apache/lang/pl @@ -331,7 +331,7 @@ acl_types=Dostępne typy dyrektyw acl_all=Wszystkie acl_sel=Wybrane.. acl_names=Może edytować nazwy serwerów? -acl_dirs=Dostępne dyrektywy Apache
(Zależne od ograniczeń typów powyżej) +acl_dirs=Dostępne dyrektywy Apache, ograniczone przez wybrane powyżej typy dyrektyw acl_dirs0=Wszystkie acl_dirs1=Tylko wymienione .. acl_dirs2=Wszystkie oprócz wymienionych .. diff --git a/apache/lang/pt.auto b/apache/lang/pt.auto index a667e527f..45cd73477 100644 --- a/apache/lang/pt.auto +++ b/apache/lang/pt.auto @@ -120,7 +120,7 @@ acl_defserv=Servidor Padrão acl_apply=Pode aplicar alterações? acl_aliasdir=Limitar aliases ao diretório acl_names=Pode editar nomes de servidores? -acl_dirs=Diretivas Apache disponíveis
(Sujeito ao limite de tipos acima) +acl_dirs=Diretivas Apache disponíveis, limitadas pelos tipos de diretiva selecionados acima acl_dirs0=Todos acl_dirs1=Apenas listado .. acl_dirs2=Todos, exceto listados .. diff --git a/apache/lang/pt_BR b/apache/lang/pt_BR index 91d6e9d86..9a1372bae 100644 --- a/apache/lang/pt_BR +++ b/apache/lang/pt_BR @@ -323,7 +323,7 @@ acl_types=Tipos de diretivas disponíveis acl_all=Todos acl_sel=Selecionados.. acl_names=Editar nome de servidores? -acl_dirs=Diretivas do Apache disponíveis
(Assunto para os tipos abaixo permitidos) +acl_dirs=Diretivas do Apache disponíveis, limitadas pelos tipos de diretiva selecionados acima acl_dirs0=Todos acl_dirs1=Somente listados .. acl_dirs2=Todos exceto os listados .. diff --git a/apache/lang/ru b/apache/lang/ru index 7213dacf8..a116952df 100644 --- a/apache/lang/ru +++ b/apache/lang/ru @@ -318,7 +318,7 @@ acl_types=Доступные типы директив acl_all=Все acl_sel=Выбранные.. acl_names=Отредактировать имена серверов? -acl_dirs=Имеющиеся директивы Apache
(С учетом типов ограничить выше) +acl_dirs=Доступные директивы Apache, ограниченные выбранными выше типами директив acl_dirs0=Все acl_dirs1=Только перечисленные... acl_dirs2=Все, кроме перечисленных... diff --git a/apache/lang/sk.auto b/apache/lang/sk.auto index 24e33e28a..c7facb636 100644 --- a/apache/lang/sk.auto +++ b/apache/lang/sk.auto @@ -331,7 +331,7 @@ acl_types=Dostupné typy smernice acl_all=všetko acl_sel=Vybraný .. acl_names=Môžete upravovať názvy serverov? -acl_dirs=Dostupné direktívy Apache
(podľa obmedzenia typov vyššie) +acl_dirs=Dostupné direktívy Apache, obmedzené typmi direktív vybranými vyššie acl_dirs0=všetko acl_dirs1=Iba uvedené .. acl_dirs2=Všetky okrem uvedených .. diff --git a/apache/lang/sv b/apache/lang/sv index f7d2d1586..8b7602c4f 100644 --- a/apache/lang/sv +++ b/apache/lang/sv @@ -323,7 +323,7 @@ acl_types=Tillgängliga direktiv typer acl_all=Alla acl_sel=Angivna ... acl_names=Kan ändra server namn? -acl_dirs=Apache direktiv tillgängliga
(Ämnen av typ begränsning under) +acl_dirs=Tillgängliga Apache-direktiv, begränsade av de direktivtyper som valts ovan acl_dirs0=Alla acl_dirs1=Endast listade .. acl_dirs2=Alla utom listade .. diff --git a/apache/lang/tr.auto b/apache/lang/tr.auto index 8a8e87622..ddbf9548c 100644 --- a/apache/lang/tr.auto +++ b/apache/lang/tr.auto @@ -134,7 +134,7 @@ acl_defserv=Varsayılan Sunucu acl_apply=Değişiklikler uygulayabilir mi? acl_aliasdir=Diğer adları dizine sınırla acl_names=Sunucu adlarını düzenleyebilir mi? -acl_dirs=Apache yönergeleri mevcut
(Yukarıdaki tür sınırlamasına tabidir) +acl_dirs=Kullanılabilir Apache yönergeleri, yukarıda seçilen yönerge türleriyle sınırlıdır acl_dirs0=Herşey acl_dirs1=Sadece listelenmiş .. acl_dirs2=Listelenenler hariç tümü .. diff --git a/apache/lang/uk.auto b/apache/lang/uk.auto index de2328126..5a411fb49 100644 --- a/apache/lang/uk.auto +++ b/apache/lang/uk.auto @@ -54,7 +54,7 @@ restart_ecannot=Вам заборонено застосовувати змін acl_apply=Чи можна застосувати зміни? acl_aliasdir=Обмежте псевдоніми до каталогу acl_names=Чи можна редагувати імена серверів? -acl_dirs=Доступні директиви Apache
(За умови обмеження типів вище) +acl_dirs=Доступні директиви Apache, обмежені вибраними вище типами директив acl_dirs0=Усі acl_dirs1=Тільки перераховані .. acl_dirs2=Усі, крім перерахованих .. diff --git a/apache/lang/zh b/apache/lang/zh index 9d90aa6b3..f7fd70234 100644 --- a/apache/lang/zh +++ b/apache/lang/zh @@ -331,7 +331,7 @@ acl_types=可用的指令类型 acl_all=全部 acl_sel=选择的… acl_names=是否编辑服务器名称吗 -acl_dirs=Apache指令可用
(受上述类型限制) +acl_dirs=可用的 Apache 指令,受上方所选指令类型限制 acl_dirs0=全部 acl_dirs1=仅列出 .. acl_dirs2=除列出外的所有内容 .. diff --git a/apache/lang/zh_TW.auto b/apache/lang/zh_TW.auto index 915f1df12..a6b0405b3 100644 --- a/apache/lang/zh_TW.auto +++ b/apache/lang/zh_TW.auto @@ -39,7 +39,7 @@ start_eafter=Apache似乎沒有運行 acl_aliasdir=將別名限制為目錄 acl_names=可以編輯服務器名稱嗎? -acl_dirs=可用的Apache指令
(受上述類型限制) +acl_dirs=可用的 Apache 指令,受上方所選指令類型限制 acl_dirs0=所有 acl_dirs1=只列出 .. acl_dirs2=除了列出的所有 .. From 68aab1c057683a6a576aa6b192163fbf9ddd3156 Mon Sep 17 00:00:00 2001 From: Ilia Ross Date: Thu, 23 Apr 2026 22:07:13 +0200 Subject: [PATCH 3/3] Fix to use proper API for ACL pages [no-build] --- apache/acl_security.pl | 180 +++++++---------- bind8/acl_security.pl | 261 +++++++++--------------- cluster-passwd/acl_security.pl | 93 ++++----- dfsadmin/acl_security.pl | 8 +- dhcpd/acl_security.pl | 219 +++++--------------- format/acl_security.pl | 33 ++- ldap-useradmin/acl_security.pl | 158 +++++++-------- lpadmin/acl_security.pl | 121 ++++------- mysql/acl_security.pl | 120 +++++------ postgresql/acl_security.pl | 142 +++++-------- samba/acl_security.pl | 354 +++++++++------------------------ sendmail/acl_security.pl | 266 ++++++++----------------- servers/acl_security.pl | 66 +++--- shorewall/acl_security.pl | 22 +- shorewall6/acl_security.pl | 22 +- squid/acl_security.pl | 34 ++-- useradmin/acl_security.pl | 342 ++++++++++++++----------------- 17 files changed, 871 insertions(+), 1570 deletions(-) diff --git a/apache/acl_security.pl b/apache/acl_security.pl index 91f10d1fa..2820a9b95 100755 --- a/apache/acl_security.pl +++ b/apache/acl_security.pl @@ -5,115 +5,84 @@ require 'apache-lib.pl'; # Output HTML for editing security options for the apache module sub acl_security_form { -print " $text{'acl_virts'}\n"; -print "\n"; -printf " %s\n", - $_[0]->{'virts'} eq '*' ? 'checked' : '', $text{'acl_vall'}; -printf " %s
\n", - $_[0]->{'virts'} eq '*' ? '' : 'checked', $text{'acl_vsel'}; -print "\n"; +print &ui_table_row($text{'acl_types'}, + &ui_radio("types_def", $o->{'types'} eq '*' ? 1 : 0, + [ [ 1, $text{'acl_all'} ], + [ 0, $text{'acl_sel'} ] ])."
\n". + &ui_select("types", \@typesel, \@typeopts, 5, 1), + 3); -print "$text{'acl_global'} \n", - $_[0]->{'global'} == 0 ? "selected" : ""; - -print " $text{'acl_create'} \n"; -printf " $text{'yes'}\n", - $_[0]->{'create'} ? "checked" : ""; -printf " $text{'no'} \n", - $_[0]->{'create'} ? "" : "checked"; - -print " $text{'acl_vuser'} \n"; -printf " $text{'yes'}\n", - $_[0]->{'vuser'} ? "checked" : ""; -printf " $text{'no'} \n", - $_[0]->{'vuser'} ? "" : "checked"; - -print " $text{'acl_vaddr'} \n"; -printf " $text{'yes'}\n", - $_[0]->{'vaddr'} ? "checked" : ""; -printf " $text{'no'} \n", - $_[0]->{'vaddr'} ? "" : "checked"; - -print " $text{'acl_pipe'} \n"; -printf " $text{'yes'}\n", - $_[0]->{'pipe'} ? "checked" : ""; -printf " $text{'no'}\n", - $_[0]->{'pipe'} ? "" : "checked"; - -print "$text{'acl_stop'} \n"; -printf " $text{'yes'}\n", - $_[0]->{'stop'} ? "checked" : ""; -printf " $text{'no'} \n", - $_[0]->{'stop'} ? "" : "checked"; - -print " $text{'acl_apply'} \n"; -printf " $text{'yes'}\n", - $_[0]->{'apply'} ? "checked" : ""; -printf " $text{'no'}\n", - $_[0]->{'apply'} ? "" : "checked"; - -print "$text{'acl_names'} \n"; -printf " $text{'yes'}\n", - $_[0]->{'names'} ? "checked" : ""; -printf " $text{'no'} \n", - $_[0]->{'names'} ? "" : "checked"; - -print " $text{'acl_dir'}\n"; -printf " %s \n", - $_[0]->{'dir'}, &file_chooser_button("dir", 1); - -print " $text{'acl_aliasdir'}\n"; -printf " %s \n", - $_[0]->{'aliasdir'}, &file_chooser_button("aliasdir", 1); - -print " $text{'acl_types'}\n"; -print "\n"; -printf " $text{'acl_all'} \n", - $_[0]->{'types'} eq '*' ? "checked" : ""; -printf " $text{'acl_sel'}
\n", - $_[0]->{'types'} eq '*' ? "" : "checked"; -map { $types{$_}++ } split(/\s+/, $_[0]->{'types'}); -print " \n"; - -print " $text{'acl_dirs'}\n"; -print "\n"; -print &ui_radio("dirsmode", $_[0]->{'dirsmode'}, - [ [ 0, $text{'acl_dirs0'} ], - [ 1, $text{'acl_dirs1'} ], - [ 2, $text{'acl_dirs2'} ] ]),"
\n"; -print &ui_textarea("dirs", join("\n", split(/\s+/, $_[0]->{'dirs'})), 5, 50); -print " \n"; +print &ui_table_row($text{'acl_dirs'}, + &ui_radio("dirsmode", $o->{'dirsmode'}, + [ [ 0, $text{'acl_dirs0'} ], + [ 1, $text{'acl_dirs1'} ], + [ 2, $text{'acl_dirs2'} ] ])."
\n". + &ui_textarea("dirs", join("\n", split(/\s+/, $o->{'dirs'})), 5, 50), + 3); } # acl_security_save(&options) @@ -141,4 +110,3 @@ $_[0]->{'names'} = $in{'names'}; $_[0]->{'dirsmode'} = $in{'dirsmode'}; $_[0]->{'dirs'} = join(" ", split(/\s+/, $in{'dirs'})); } - diff --git a/bind8/acl_security.pl b/bind8/acl_security.pl index edd16d880..450b6eb29 100755 --- a/bind8/acl_security.pl +++ b/bind8/acl_security.pl @@ -11,18 +11,10 @@ our (%config, %text, %in); # Output HTML for editing security options for the bind8 module sub acl_security_form { -my $m = $_[0]->{'zones'} eq '*' ? 1 : - $_[0]->{'zones'} =~ /^\!/ ? 2 : 0; -print " $text{'acl_zones'}\n"; -print "\n", - $m == 2 ? 'checked' : '', $text{'acl_znsel'}; +my ($o) = @_; +my $m = $o->{'zones'} eq '*' ? 1 : + $o->{'zones'} =~ /^\!/ ? 2 : 0; -print "
\n"; -printf " %s
\n", - $m == 1 ? 'checked' : '', $text{'acl_zall'}; -printf " %s
\n", - $m == 0 ? 'checked' : '', $text{'acl_zsel'}; -printf " %s
\n"; + +print &ui_table_row($text{'acl_zones'}, + &ui_radio("zones_def", $m, + [ [ 1, $text{'acl_zall'} ], + [ 0, $text{'acl_zsel'} ], + [ 2, $text{'acl_znsel'} ] ])."
\n". + &ui_select("zones", [ split(/\s+/, $o->{'zones'}) ], \@zoneopts, 4, 1), + 3); if (@views) { - print " $text{'acl_inviews'}\n"; - print "\n"; - print &ui_radio("inviews_def", $_[0]->{'inviews'} eq "*" ? 1 : 0, - [ [ 1, $text{'acl_vall'} ], - [ 0, $text{'acl_vsel'} ] ]),"
\n"; - print "\n"; + + print &ui_table_row($text{'acl_inviews'}, + &ui_radio("inviews_def", $o->{'inviews'} eq "*" ? 1 : 0, + [ [ 1, $text{'acl_vall'} ], + [ 0, $text{'acl_vsel'} ] ])."
\n". + &ui_select("inviews", [ split(/\s+/, $o->{'inviews'}) ], \@viewopts, + 4, 1), + 3); } -print " $text{'acl_types'} \n"; -printf " %s\n", - $_[0]->{'types'} ? "" : "checked", $text{'acl_types1'}; -printf " %s\n", - $_[0]->{'types'} ? "checked" : "", $text{'acl_types0'}; -printf " \n", - $_[0]->{'types'}; +print &ui_table_row($text{'acl_types'}, + &ui_opt_textbox("types", $o->{'types'}, 40, + $text{'acl_types1'}, $text{'acl_types0'}), + 3); -print " $text{'acl_dir'}\n"; -printf " %s
\n", - $_[0]->{'dir'}, &file_chooser_button("dir", 1); -printf " %s \n", - $_[0]->{'dironly'} ? "checked" : "", $text{'acl_dironly'}; +print &ui_table_row($text{'acl_dir'}, + &ui_textbox("dir", $o->{'dir'}, 30)." ".&file_chooser_button("dir", 1). + "
\n".&ui_checkbox("dironly", 1, $text{'acl_dironly'}, $o->{'dironly'}), + 3); -print " $text{'acl_defaults'} \n"; -printf " $text{'yes'}\n", - $_[0]->{'defaults'} ? "checked" : ""; -printf " $text{'no'} \n", - $_[0]->{'defaults'} ? "" : "checked"; +print &ui_table_row($text{'acl_defaults'}, + &ui_yesno_radio("defaults", $o->{'defaults'})); -print " $text{'acl_ztypes'} \n"; -foreach my $t ("master", "slave", "forward", "delegation") { - printf " %s\n", - $t, $_[0]->{$t} ? "checked" : "", $text{'acl_ztypes_'.$t}; - } -print " \n"; +print &ui_table_row($text{'acl_ztypes'}, + join("", map { &ui_checkbox($_, 1, $text{'acl_ztypes_'.$_}, $o->{$_}) } + ("master", "slave", "forward", "delegation")), + 3); -print " $text{'acl_reverse'} \n"; -printf " $text{'yes'}\n", - $_[0]->{'reverse'} ? "checked" : ""; -printf " $text{'no'}\n", - $_[0]->{'reverse'} ? "" : "checked"; +print &ui_table_row($text{'acl_reverse'}, + &ui_yesno_radio("reverse", $o->{'reverse'})); +print &ui_table_row($text{'acl_multiple'}, + &ui_yesno_radio("multiple", $o->{'multiple'})); -print "$text{'acl_multiple'} \n"; -printf " $text{'yes'}\n", - $_[0]->{'multiple'} ? "checked" : ""; -printf " $text{'no'} \n", - $_[0]->{'multiple'} ? "" : "checked"; +print &ui_table_row($text{'acl_ro'}, + &ui_yesno_radio("ro", $o->{'ro'})); +print &ui_table_row($text{'acl_apply'}, + &ui_select("apply", + defined($o->{'apply'}) && $o->{'apply'} ne '' ? $o->{'apply'} : 0, + [ [ 1, $text{'yes'} ], + [ 2, $text{'acl_applyonly'} ], + [ 3, $text{'acl_applygonly'} ], + [ 0, $text{'no'} ] ])); -print " $text{'acl_ro'} \n"; -printf " $text{'yes'}\n", - $_[0]->{'ro'} ? "checked" : ""; -printf " $text{'no'}\n", - $_[0]->{'ro'} ? "" : "checked"; +print &ui_table_row($text{'acl_file'}, + &ui_yesno_radio("file", $o->{'file'})); +print &ui_table_row($text{'acl_params'}, + &ui_yesno_radio("params", $o->{'params'})); -print "$text{'acl_apply'} \n"; -print &ui_select("apply", $_[0]->{'apply'}, - [ [ 1, $text{'yes'} ], - [ 2, $text{'acl_applyonly'} ], - [ 3, $text{'acl_applygonly'} ], - [ 0, $text{'no'} ] ])," \n"; +print &ui_table_row($text{'acl_opts'}, + &ui_yesno_radio("opts", $o->{'opts'})); +print &ui_table_row($text{'acl_delete'}, + &ui_yesno_radio("delete", $o->{'delete'})); -print " $text{'acl_file'} \n"; -printf " $text{'yes'}\n", - $_[0]->{'file'} ? "checked" : ""; -printf " $text{'no'}\n", - $_[0]->{'file'} ? "" : "checked"; +print &ui_table_row($text{'acl_gen'}, + &ui_yesno_radio("gen", $o->{'gen'})); +print &ui_table_row($text{'acl_whois'}, + &ui_yesno_radio("whois", $o->{'whois'})); -print "$text{'acl_params'} \n"; -printf " $text{'yes'}\n", - $_[0]->{'params'} ? "checked" : ""; -printf " $text{'no'} \n", - $_[0]->{'params'} ? "" : "checked"; +print &ui_table_row($text{'acl_findfree'}, + &ui_yesno_radio("findfree", $o->{'findfree'})); +print &ui_table_row($text{'acl_remote'}, + &ui_yesno_radio("remote", $o->{'remote'})); -print " $text{'acl_opts'} \n"; -printf " $text{'yes'}\n", - $_[0]->{'opts'} ? "checked" : ""; -printf " $text{'no'}\n", - $_[0]->{'opts'} ? "" : "checked"; +print &ui_table_row($text{'acl_slaves'}, + &ui_yesno_radio("slaves", $o->{'slaves'})); +print &ui_table_row($text{'acl_dnssec'}, + &ui_yesno_radio("dnssec", $o->{'dnssec'})); -print "$text{'acl_delete'} \n"; -printf " $text{'yes'}\n", - $_[0]->{'delete'} ? "checked" : ""; -printf " $text{'no'} \n", - $_[0]->{'delete'} ? "" : "checked"; - -print " $text{'acl_gen'} \n"; -printf " $text{'yes'}\n", - $_[0]->{'gen'} ? "checked" : ""; -printf " $text{'no'}\n", - $_[0]->{'gen'} ? "" : "checked"; - -print "$text{'acl_whois'} \n"; -printf " $text{'yes'}\n", - $_[0]->{'whois'} ? "checked" : ""; -printf " $text{'no'} \n", - $_[0]->{'whois'} ? "" : "checked"; - -print " $text{'acl_findfree'} \n"; -printf " $text{'yes'}\n", - $_[0]->{'findfree'} ? "checked" : ""; -printf " $text{'no'}\n", - $_[0]->{'findfree'} ? "" : "checked"; - -print "$text{'acl_remote'} \n"; -printf " $text{'yes'}\n", - $_[0]->{'remote'} ? "checked" : ""; -printf " $text{'no'} \n", - $_[0]->{'remote'} ? "" : "checked"; - -print " $text{'acl_slaves'} \n"; -printf " $text{'yes'}\n", - $_[0]->{'slaves'} ? "checked" : ""; -printf " $text{'no'}\n", - $_[0]->{'slaves'} ? "" : "checked"; - -print "$text{'acl_dnssec'} \n"; -printf " $text{'yes'}\n", - $_[0]->{'dnssec'} ? "checked" : ""; -printf " $text{'no'} \n", - $_[0]->{'dnssec'} ? "" : "checked"; - -print "\n"; - -print " $text{'acl_views'} \n"; -printf " $text{'yes'}\n", - $_[0]->{'views'} == 1 ? "checked" : ""; -printf " $text{'acl_edonly'}\n", - $_[0]->{'views'} == 2 ? "checked" : ""; -printf " $text{'no'} \n", - $_[0]->{'views'} ? "" : "checked"; +print &ui_table_row($text{'acl_views'}, + &ui_radio("views", defined($o->{'views'}) ? $o->{'views'} : 0, + [ [ 1, $text{'yes'} ], + [ 2, $text{'acl_edonly'} ], + [ 0, $text{'no'} ] ]), + 3); if (@views) { - my $m = $_[0]->{'vlist'} eq '*' ? 1 : - $_[0]->{'vlist'} =~ /^\!/ ? 2 : - $_[0]->{'vlist'} eq '' ? 3 : 0; - print " $text{'acl_vlist'}\n"; - print "\n", - $m == 3 ? 'checked' : '', $text{'acl_vnone'}; - - print "
\n"; - printf " %s
\n", - $m == 1 ? 'checked' : '', $text{'acl_vall'}; - printf " %s
\n", - $m == 0 ? 'checked' : '', $text{'acl_vsel'}; - printf " %s
\n", - $m == 2 ? 'checked' : '', $text{'acl_vnsel'}; - printf " %s
\n"; + my $vm = $o->{'vlist'} eq '*' ? 1 : + $o->{'vlist'} =~ /^\!/ ? 2 : + $o->{'vlist'} eq '' ? 3 : 0; + my @vopts = map { [ $_->{'value'}, $_->{'value'} ] } + sort { $a->{'value'} cmp $b->{'value'} } @views; + print &ui_table_row($text{'acl_vlist'}, + &ui_radio("vlist_def", $vm, + [ [ 1, $text{'acl_vall'} ], + [ 0, $text{'acl_vsel'} ], + [ 2, $text{'acl_vnsel'} ], + [ 3, $text{'acl_vnone'} ] ])."
\n". + &ui_select("vlist", [ split(/\s+/, $o->{'vlist'}) ], \@vopts, 4, 1), + 3); } } diff --git a/cluster-passwd/acl_security.pl b/cluster-passwd/acl_security.pl index cce8cab99..6dd00cbe8 100755 --- a/cluster-passwd/acl_security.pl +++ b/cluster-passwd/acl_security.pl @@ -5,66 +5,47 @@ require 'cluster-passwd-lib.pl'; # Output HTML for editing security options for the passwd module sub acl_security_form { -print " $passwd::text{'acl_users'} \n"; -printf " %s\n", - $_[0]->{'mode'} == 0 ? 'checked' : '', $passwd::text{'acl_mode0'}; +my ($o) = @_; -printf " %s
\n", - $_[0]->{'mode'} == 3 ? 'checked' : '', $passwd::text{'acl_mode3'}; +print &ui_table_row($passwd::text{'acl_users'}, + &ui_radio_table("mode", defined($o->{'mode'}) ? $o->{'mode'} : 0, + [ [ 0, $passwd::text{'acl_mode0'} ], + [ 3, $passwd::text{'acl_mode3'} ], + [ 1, $passwd::text{'acl_mode1'}, + &ui_textbox("users1", $o->{'mode'} == 1 ? $o->{'users'} : "", + 40)." ".&user_chooser_button("users1", 1) ], + [ 2, $passwd::text{'acl_mode2'}, + &ui_textbox("users2", $o->{'mode'} == 2 ? $o->{'users'} : "", + 40)." ".&user_chooser_button("users2", 1) ], + [ 4, $passwd::text{'acl_mode4'}, + &ui_textbox("low", $o->{'mode'} == 4 ? $o->{'low'} : "", 8). + " - ".&ui_textbox("high", + $o->{'mode'} == 4 ? $o->{'high'} : "", 8) ], + [ 5, $passwd::text{'acl_mode5'}, + &ui_textbox("groups", $o->{'mode'} == 5 ? $o->{'users'} : "", + 20)." ".&group_chooser_button("groups", 1)."
\n". + &ui_checkbox("sec", 1, $passwd::text{'acl_sec'}, $o->{'sec'}) ], + [ 6, $passwd::text{'acl_mode6'}, + &ui_textbox("match", $o->{'mode'} == 6 ? $o->{'users'} : "", + 15) ] ], 1), + 3); -printf " %s\n", - $_[0]->{'mode'} == 1 ? 'checked' : '', $passwd::text{'acl_mode1'}; -printf " %s
\n", - $_[0]->{'mode'} == 1 ? $_[0]->{'users'} : '', - &user_chooser_button("users1", 1); +print &ui_table_row($passwd::text{'acl_repeat'}, + &ui_yesno_radio("repeat", $o->{'repeat'}), 3); -printf " %s\n", - $_[0]->{'mode'} == 2 ? 'checked' : '', $passwd::text{'acl_mode2'}; -printf " %s
\n", - $_[0]->{'mode'} == 2 ? $_[0]->{'users'} : '', - &user_chooser_button("users2", 1); +print &ui_table_row($passwd::text{'acl_others'}, + &ui_radio("others", defined($o->{'others'}) ? $o->{'others'} : 0, + [ [ 1, $passwd::text{'yes'} ], + [ 2, $passwd::text{'acl_opt'} ], + [ 0, $passwd::text{'no'} ] ]), + 3); -printf " %s\n", - $_[0]->{'mode'} == 4 ? 'checked' : '', $passwd::text{'acl_mode4'}; -printf " -\n", - $_[0]->{'mode'} == 4 ? $_[0]->{'low'} : ''; -printf "
\n", - $_[0]->{'mode'} == 4 ? $_[0]->{'high'} : ''; - -printf " %s\n", - $_[0]->{'mode'} == 5 ? 'checked' : '', $passwd::text{'acl_mode5'}; -printf " %s
\n", - $_[0]->{'mode'} == 5 ? $_[0]->{'users'} : '', - &group_chooser_button("groups", 1); -printf "%s %s
\n", - " " x 5, $_[0]->{'sec'} ? 'checked' : '',$passwd::text{'acl_sec'}; - -printf " %s\n", - $_[0]->{'mode'} == 6 ? 'checked' : '', $passwd::text{'acl_mode6'}; -printf " \n", - $_[0]->{'mode'} == 6 ? $_[0]->{'users'} : ''; - -print " $passwd::text{'acl_repeat'} \n"; -printf " $passwd::text{'yes'}\n", - $_[0]->{'repeat'} ? "checked" : ""; -printf " $passwd::text{'no'} \n", - $_[0]->{'repeat'} ? "" : "checked"; - -print "$passwd::text{'acl_others'} \n"; -printf " $passwd::text{'yes'}\n", - $_[0]->{'others'} == 1 ? "checked" : ""; -printf " $passwd::text{'acl_opt'}\n", - $_[0]->{'others'} == 2 ? "checked" : ""; -printf " $passwd::text{'no'} \n", - $_[0]->{'others'} == 0 ? "checked" : ""; - -print " $passwd::text{'acl_old'} \n"; -printf " $passwd::text{'yes'}\n", - $_[0]->{'old'} == 1 ? "checked" : ""; -printf " $passwd::text{'acl_old_this'}\n", - $_[0]->{'old'} == 2 ? "checked" : ""; -printf " $passwd::text{'no'} \n", - $_[0]->{'old'} == 0 ? "checked" : ""; +print &ui_table_row($passwd::text{'acl_old'}, + &ui_radio("old", defined($o->{'old'}) ? $o->{'old'} : 0, + [ [ 1, $passwd::text{'yes'} ], + [ 2, $passwd::text{'acl_old_this'} ], + [ 0, $passwd::text{'no'} ] ]), + 3); } # acl_security_save(&options) diff --git a/dfsadmin/acl_security.pl b/dfsadmin/acl_security.pl index bdb382522..7acea9cd6 100755 --- a/dfsadmin/acl_security.pl +++ b/dfsadmin/acl_security.pl @@ -5,9 +5,11 @@ require 'dfsadmin-lib.pl'; # Output HTML for editing security options for the format module sub acl_security_form { -print " $text{'acl_view'}\n"; -print "",&ui_radio("view", $access{'view'}, - [ [ 0, $text{'yes'} ], [ 1, $text{'no'} ] ])," \n"; +my ($o) = @_; + +print &ui_table_row($text{'acl_view'}, + &ui_radio("view", $o->{'view'}, + [ [ 0, $text{'yes'} ], [ 1, $text{'no'} ] ])); } # acl_security_save(&options) diff --git a/dhcpd/acl_security.pl b/dhcpd/acl_security.pl index ad81325a7..94a6ca5e5 100755 --- a/dhcpd/acl_security.pl +++ b/dhcpd/acl_security.pl @@ -5,164 +5,53 @@ require 'dhcpd-lib.pl'; # Output HTML for editing security options for the dhcpd module sub acl_security_form { -print "\n$text{'acl_apply'} \n"; -printf " $text{'yes'}\n", - $_[0]->{'apply'} ? "checked" : ""; -printf " $text{'no'}\n", - $_[0]->{'apply'} ? "" : "checked"; -print "\n"; +my ($o) = @_; -print "\n$text{'acl_global'} \n"; -printf " $text{'yes'}\n", - $_[0]->{'global'} ? "checked" : ""; -printf " $text{'no'}\n", - $_[0]->{'global'} ? "" : "checked"; -print "\n"; +foreach my $f ('apply', 'global', 'r_leases', 'w_leases', 'zones') { + print &ui_table_row($text{'acl_'.$f}, + &ui_yesno_radio($f, $o->{$f})); + } -print "\n$text{'acl_r_leases'} \n"; -printf " $text{'yes'}\n", - $_[0]->{'r_leases'} ? "checked" : ""; -printf " $text{'no'}\n", - $_[0]->{'r_leases'} ? "" : "checked"; -print "\n"; +print &ui_table_hr(); -print "\n$text{'acl_w_leases'} \n"; -printf " $text{'yes'}\n", - $_[0]->{'w_leases'} ? "checked" : ""; -printf " $text{'no'}\n", - $_[0]->{'w_leases'} ? "" : "checked"; -print "\n"; +foreach my $f ('uniq_hst', 'uniq_sub', 'uniq_sha') { + print &ui_table_row($text{'acl_'.$f}, + &ui_yesno_radio($f, $o->{$f})); + } -print "\n$text{'acl_zones'} \n"; -printf " $text{'yes'}\n", - $_[0]->{'zones'} ? "checked" : ""; -printf " $text{'no'}\n", - $_[0]->{'zones'} ? "" : "checked"; -print "\n"; +print &ui_table_hr(); -print "
\n"; +print &ui_table_row($text{'acl_seclevel'}, + &ui_radio("smode", defined($o->{'smode'}) ? $o->{'smode'} : 0, + [ map { [ $_, $_ ] } 0 .. 3 ]), + 3); -# uniqs -print "\n$text{'acl_uniq_hst'} \n"; -printf " $text{'yes'}\n", - $_[0]->{'uniq_hst'} ? "checked" : ""; -printf " $text{'no'}\n", - $_[0]->{'uniq_hst'} ? "" : "checked"; -print "\n"; +print &ui_table_row($text{'acl_hide'}, + &ui_yesno_radio("hide", defined($o->{'hide'}) ? $o->{'hide'} : 0)); -print "\n$text{'acl_uniq_sub'} \n"; -printf " $text{'yes'}\n", - $_[0]->{'uniq_sub'} ? "checked" : ""; -printf " $text{'no'}\n", - $_[0]->{'uniq_sub'} ? "" : "checked"; -print "\n"; +print &ui_table_hr(); -print "\n$text{'acl_uniq_sha'} \n"; -printf " $text{'yes'}\n", - $_[0]->{'uniq_sha'} ? "checked" : ""; -printf " $text{'no'}\n", - $_[0]->{'uniq_sha'} ? "" : "checked"; -print "\n"; +foreach my $type (['hst', 'acl_ahst'], ['grp', 'acl_agrp'], + ['sub', 'acl_asub'], ['sha', 'acl_asha']) { + print &ui_table_row($text{$type->[1]}, + join("", map { &ui_checkbox($_."_".$type->[0], 1, + $text{"acl_".$_}, + $o->{$_."_".$type->[0]}) } + qw(c r w)), + 3); + } -print "
\n"; +print &ui_table_hr(); -# security mode settings -print "\n$text{'acl_seclevel'} \n"; -printf " 0\n", - $_[0]->{'smode'} == 0 ? "checked" : ""; -printf " 1\n", - $_[0]->{'smode'} == 1 ? "checked" : ""; -printf " 2\n", - $_[0]->{'smode'} == 2 ? "checked" : ""; -printf " 3\n", - $_[0]->{'smode'} == 3 ? "checked" : ""; -print "\n\n"; +foreach my $f ('per_sub_acls', 'per_sha_acls', + 'per_hst_acls', 'per_grp_acls') { + print &ui_table_row($text{'acl_'.$f}, + &ui_yesno_radio($f, $o->{$f})); + } -print "\n$text{'acl_hide'} \n"; -printf " $text{'yes'}\n", - $_[0]->{'hide'} == 1 ? "checked" : ""; -printf " $text{'no'}\n", - $_[0]->{'hide'} == 0 ? "checked" : ""; -print "\n"; - -print "
\n"; - -# global acls -print "\n$text{'acl_ahst'}\n"; -print "\n"; -printf " %s\n", - $_[0]->{'c_hst'} ? "checked" : "", $text{"acl_c"}; -printf " %s\n", - $_[0]->{'r_hst'} ? "checked" : "", $text{"acl_r"}; -printf " %s\n", - $_[0]->{'w_hst'} ? "checked" : "", $text{"acl_w"}; -print " \n"; - -print "\n$text{'acl_agrp'}\n"; -print "\n"; -printf " %s\n", - $_[0]->{'c_grp'} ? "checked" : "", $text{"acl_c"}; -printf " %s\n", - $_[0]->{'r_grp'} ? "checked" : "", $text{"acl_r"}; -printf " %s\n", - $_[0]->{'w_grp'} ? "checked" : "", $text{"acl_w"}; -print " \n"; - -print "\n$text{'acl_asub'}\n"; -print "\n"; -printf " %s\n", - $_[0]->{'c_sub'} ? "checked" : "", $text{"acl_c"}; -printf " %s\n", - $_[0]->{'r_sub'} ? "checked" : "", $text{"acl_r"}; -printf " %s\n", - $_[0]->{'w_sub'} ? "checked" : "", $text{"acl_w"}; -print " \n"; - -print "\n$text{'acl_asha'}\n"; -print "\n"; -printf " %s\n", - $_[0]->{'c_sha'} ? "checked" : "", $text{"acl_c"}; -printf " %s\n", - $_[0]->{'r_sha'} ? "checked" : "", $text{"acl_r"}; -printf " %s\n", - $_[0]->{'w_sha'} ? "checked" : "", $text{"acl_w"}; -print " \n"; - -print "
\n"; - -# per-subnet and per-host acls -print "$text{'acl_per_sub_acls'} \n"; -printf " $text{'yes'}\n", - $_[0]->{'per_sub_acls'} ? "checked" : ""; -printf " $text{'no'}\n", - $_[0]->{'per_sub_acls'} ? "" : "checked"; -print "\n"; - -print "$text{'acl_per_sha_acls'} \n"; -printf " $text{'yes'}\n", - $_[0]->{'per_sha_acls'} ? "checked" : ""; -printf " $text{'no'}\n", - $_[0]->{'per_sha_acls'} ? "" : "checked"; -print "\n"; - -print "$text{'acl_per_hst_acls'} \n"; -printf " $text{'yes'}\n", - $_[0]->{'per_hst_acls'} ? "checked" : ""; -printf " $text{'no'}\n", - $_[0]->{'per_hst_acls'} ? "" : "checked"; -print "\n"; - -print "$text{'acl_per_grp_acls'} \n"; -printf " $text{'yes'}\n", - $_[0]->{'per_grp_acls'} ? "checked" : ""; -printf " $text{'no'}\n", - $_[0]->{'per_grp_acls'} ? "" : "checked"; -print "\n"; - -print "
\n"; - -print "\n$text{'acl_per_obj_acls'} \n"; -&display_tree($_[0],&get_parent_config(),-2); +print &ui_table_hr(); +print &ui_table_span($text{'acl_per_obj_acls'}); +&display_tree($o, &get_parent_config(), -2); } # acl_security_save(&options) @@ -254,36 +143,18 @@ if (!$name && $node->{'name'} eq 'group') { } local $nodetype=$onames{$node->{'name'}}; local $aclname='ACL'.$nodetype.'_'.$name; - -print "\n"," "x$padding, - " $node->{'name'}: $name\n"; - if (($nodetype eq 'hst')||($nodetype eq 'sub')|| ($nodetype eq 'grp')||($nodetype eq 'sha')) { - print "\n"; - if($acc->{$aclname}) { - printf " %s\n", - !&perm_to('r',$nodetype,$acc,$name) ? - "checked" : "", $text{"acl_na"}; - printf " %s\n", - &perm_to('r',$nodetype,$acc,$name) && - !&perm_to('rw',$nodetype,$acc,$name) ? - "checked" : "",$text{"acl_r1"}; - printf " %s\n", - &perm_to('rw',$nodetype,$acc,$name) ? - "checked" : "", $text{"acl_rw"}; - } - else { - printf " %s\n", - $text{"acl_na"}; - printf " %s\n", - $text{"acl_r1"}; - printf " %s\n", - $text{"acl_rw"}; - } - print "\n"; + my $sel = !$acc->{$aclname} || !&perm_to('r', $nodetype, $acc, $name) ? '' : + &perm_to('rw', $nodetype, $acc, $name) ? 'rw' : 'r'; + print &ui_table_row( + (" " x $padding)." ".$node->{'name'}.": $name", + &ui_radio($aclname, $sel, + [ [ '', $text{'acl_na'} ], + [ 'r', $text{'acl_r1'} ], + [ 'rw', $text{'acl_rw'} ] ]), + 3); } -print "\n"; } 1; \ No newline at end of file diff --git a/format/acl_security.pl b/format/acl_security.pl index 7f58b02c5..405b4d9c6 100755 --- a/format/acl_security.pl +++ b/format/acl_security.pl @@ -5,27 +5,24 @@ require 'format-lib.pl'; # Output HTML for editing security options for the format module sub acl_security_form { -local @dlist = &list_disks(); -local ($d, %dcan); -map { $dcan{$_}++ } split(/\s+/, $_[0]->{'disks'}); -print " $text{'acl_disks'} \n"; -printf " %s\n", - $_[0]->{'disks'} eq '*' ? 'checked' : '', $text{'acl_dall'}; -printf " %s
\n", - $_[0]->{'disks'} eq '*' ? '' : 'checked', $text{'acl_dsel'}; -print " \n"; -print " $text{'acl_view'}\n"; -print "",&ui_radio("view", $access{'view'}, - [ [ 0, $text{'yes'} ], [ 1, $text{'no'} ] ])," \n"; +print &ui_table_row($text{'acl_disks'}, + &ui_radio("disks_def", $o->{'disks'} eq '*' ? 1 : 0, + [ [ 1, $text{'acl_dall'} ], + [ 0, $text{'acl_dsel'} ] ])."
\n". + &ui_select("disks", [ split(/\s+/, $o->{'disks'}) ], \@dopts, 4, 1), + 3); + +print &ui_table_row($text{'acl_view'}, + &ui_radio("view", $o->{'view'}, + [ [ 0, $text{'yes'} ], [ 1, $text{'no'} ] ])); } # acl_security_save(&options) diff --git a/ldap-useradmin/acl_security.pl b/ldap-useradmin/acl_security.pl index 0df059df7..8e5c6f6d7 100755 --- a/ldap-useradmin/acl_security.pl +++ b/ldap-useradmin/acl_security.pl @@ -7,102 +7,82 @@ require 'ldap-useradmin-lib.pl'; sub acl_security_form { local $o = $_[0]; +my $uedit_group = $o->{'uedit_mode'} == 5 ? + join(" ", map { "".getgrgid($_) } split(/\s+/, $o->{'uedit'})) : ""; -print " $text{'acl_uedit'} \n"; -printf " $text{'acl_uedit_all'}  \n", - $o->{'uedit_mode'} == 0 ? "checked" : ""; -printf " $text{'acl_uedit_none'} \n", - $o->{'uedit_mode'} == 1 ? "checked" : ""; -printf " $text{'acl_uedit_this'}
\n", - $o->{'uedit_mode'} == 6 ? "checked" : ""; -printf " $text{'acl_uedit_only'}\n", - $o->{'uedit_mode'} == 2 ? "checked" : ""; -printf " %s
\n", - $o->{'uedit_mode'} == 2 ? $o->{'uedit'} : "", - &user_chooser_button("uedit_can", 1); -printf " $text{'acl_uedit_except'}\n", - $o->{'uedit_mode'} == 3 ? "checked" : ""; -printf " %s
\n", - $o->{'uedit_mode'} == 3 ? $o->{'uedit'} : "", - &user_chooser_button("uedit_cannot", 1); -printf " $text{'acl_uedit_uid'}\n", - $o->{'uedit_mode'} == 4 ? "checked" : ""; -printf " - \n", - $o->{'uedit_mode'} == 4 ? $o->{'uedit'} : ""; -printf "
\n", - $o->{'uedit_mode'} == 4 ? $o->{'uedit2'} : ""; -printf " $text{'acl_uedit_group'}\n", - $o->{'uedit_mode'} == 5 ? "checked" : ""; -printf " %s
\n", - $o->{'uedit_mode'} == 5 ? - join(" ", map { "".getgrgid($_) } split(/\s+/, $o->{'uedit'})) :"", - &group_chooser_button("uedit_group", 1); -printf "%s %s
\n", - " " x 5, $o->{'uedit_sec'} ? 'checked' : '',$text{'acl_uedit_sec'}; -printf " $text{'acl_uedit_re'}\n", - $o->{'uedit_mode'} == 7 ? "checked" : ""; -printf " %s
\n", - $o->{'uedit_mode'} == 7 ? $o->{'uedit_re'} : ""; -print " \n"; +print &ui_table_row($text{'acl_uedit'}, + &ui_radio_table("uedit_mode", + defined($o->{'uedit_mode'}) ? $o->{'uedit_mode'} : 0, + [ [ 0, $text{'acl_uedit_all'} ], + [ 1, $text{'acl_uedit_none'} ], + [ 6, $text{'acl_uedit_this'} ], + [ 2, $text{'acl_uedit_only'}, + &ui_textbox("uedit_can", + $o->{'uedit_mode'} == 2 ? $o->{'uedit'} : "", 40). + " ".&user_chooser_button("uedit_can", 1) ], + [ 3, $text{'acl_uedit_except'}, + &ui_textbox("uedit_cannot", + $o->{'uedit_mode'} == 3 ? $o->{'uedit'} : "", 40). + " ".&user_chooser_button("uedit_cannot", 1) ], + [ 4, $text{'acl_uedit_uid'}, + &ui_textbox("uedit_uid", + $o->{'uedit_mode'} == 4 ? $o->{'uedit'} : "", 6). + " - ".&ui_textbox("uedit_uid2", + $o->{'uedit_mode'} == 4 ? $o->{'uedit2'} : "", 6) ], + [ 5, $text{'acl_uedit_group'}, + &ui_textbox("uedit_group", $uedit_group, 40)." ". + &group_chooser_button("uedit_group", 1)."
\n". + &ui_checkbox("uedit_sec", 1, $text{'acl_uedit_sec'}, + $o->{'uedit_sec'}) ], + [ 7, $text{'acl_uedit_re'}, + &ui_textbox("uedit_re", + $o->{'uedit_mode'} == 7 ? $o->{'uedit_re'} : "", 40) ] ], 1), + 3); -print " $text{'acl_ucreate'} \n"; -printf " $text{'yes'}\n", - $o->{'ucreate'} ? "checked" : ""; -printf " $text{'no'}\n", - $o->{'ucreate'} ? "" : "checked"; +print &ui_table_row($text{'acl_ucreate'}, + &ui_yesno_radio("ucreate", $o->{'ucreate'})); +print &ui_table_row($text{'acl_batch'}, + &ui_yesno_radio("batch", $o->{'batch'})); -print "$text{'acl_batch'} \n"; -printf " $text{'yes'}\n", - $o->{'batch'} ? "checked" : ""; -printf " $text{'no'} \n", - $o->{'batch'} ? "" : "checked"; +print &ui_table_row($text{'acl_home'}, + &ui_textbox("home", $o->{'home'}, 40)." ". + &file_chooser_button("home", 1)."
\n". + &ui_checkbox("autohome", 1, $text{'acl_autohome'}, $o->{'autohome'}), + 3); -print " $text{'acl_home'}\n"; -printf " %s
\n", - $o->{'home'}, &file_chooser_button("home", 1); -printf " %s \n", - $o->{'autohome'} ? "checked" : "", - $text{'acl_autohome'}; +print &ui_table_row($text{'acl_uid'}, + join("", map { &ui_checkbox($_, 1, $text{'acl_'.$_}, $o->{$_}) } + ('umultiple', 'gmultiple')), + 3); -print " $text{'acl_uid'}\n"; -print ""; -printf " %s
\n", - $o->{'umultiple'} ? "checked" : "", $text{'acl_umultiple'}; -printf " %s
\n", - $o->{'gmultiple'} ? "checked" : "", $text{'acl_gmultiple'}; -print " \n"; +print &ui_table_hr(); -print "
\n"; +print &ui_table_row($text{'acl_gedit'}, + &ui_radio_table("gedit_mode", + defined($o->{'gedit_mode'}) ? $o->{'gedit_mode'} : 0, + [ [ 0, $text{'acl_gedit_all'} ], + [ 1, $text{'acl_gedit_none'} ], + [ 2, $text{'acl_gedit_only'}, + &ui_textbox("gedit_can", + $o->{'gedit_mode'} == 2 ? $o->{'gedit'} : "", 40). + " ".&group_chooser_button("gedit_can", 1) ], + [ 3, $text{'acl_gedit_except'}, + &ui_textbox("gedit_cannot", + $o->{'gedit_mode'} == 3 ? $o->{'gedit'} : "", 40). + " ".&group_chooser_button("gedit_cannot", 1) ], + [ 4, $text{'acl_gedit_gid'}, + &ui_textbox("gedit_gid", + $o->{'gedit_mode'} == 4 ? $o->{'gedit'} : "", 6). + " - ".&ui_textbox("gedit_gid2", + $o->{'gedit_mode'} == 4 ? $o->{'gedit2'} : "", 6) ] ], 1), + 3); -print " $text{'acl_gedit'} \n"; -printf " $text{'acl_gedit_all'}  \n", - $o->{'gedit_mode'} == 0 ? "checked" : ""; -printf " $text{'acl_gedit_none'}
\n", - $o->{'gedit_mode'} == 1 ? "checked" : ""; -printf " $text{'acl_gedit_only'}\n", - $o->{'gedit_mode'} == 2 ? "checked" : ""; -printf " %s
\n", - $o->{'gedit_mode'} == 2 ? $o->{'gedit'} : "", - &group_chooser_button("gedit_can", 1); -printf " $text{'acl_gedit_except'}\n", - $o->{'gedit_mode'} == 3 ? "checked" : ""; -printf " %s
\n", - $o->{'gedit_mode'} == 3 ? $o->{'gedit'} : "", - &group_chooser_button("gedit_cannot", 1); -printf " $text{'acl_gedit_gid'}\n", - $o->{'gedit_mode'} == 4 ? "checked" : ""; -printf " -\n", - $o->{'gedit_mode'} == 4 ? $o->{'gedit'} : ""; -printf " \n", - $o->{'gedit_mode'} == 4 ? $o->{'gedit2'} : ""; - -print " $text{'acl_gcreate'} \n"; -printf " $text{'yes'}\n", - $o->{'gcreate'}==1 ? "checked" : ""; -printf " $text{'acl_gnew'}\n", - $o->{'gcreate'}==2 ? "checked" : ""; -printf " $text{'no'} \n", - $o->{'gcreate'}==0 ? "checked" : ""; +print &ui_table_row($text{'acl_gcreate'}, + &ui_radio("gcreate", defined($o->{'gcreate'}) ? $o->{'gcreate'} : 0, + [ [ 1, $text{'yes'} ], + [ 2, $text{'acl_gnew'} ], + [ 0, $text{'no'} ] ]), + 3); } # acl_security_save(&options) diff --git a/lpadmin/acl_security.pl b/lpadmin/acl_security.pl index 082092bcf..d6ba5a939 100755 --- a/lpadmin/acl_security.pl +++ b/lpadmin/acl_security.pl @@ -5,90 +5,55 @@ require 'lpadmin-lib.pl'; # Output HTML for editing security options for the lpadmin module sub acl_security_form { -print " $text{'acl_printers'}\n"; -print "\n"; -printf " %s\n", - $_[0]->{'printers'} eq '*' ? 'checked' : '', $text{'acl_pall'}; -printf " %s
\n", - $_[0]->{'printers'} eq '*' ? '' : 'checked', $text{'acl_psel'}; -print " \n"; +my ($o) = @_; +my @plist = &list_printers(); +my @popts = map { + my $prn = &get_printer($_); + [ $_, $prn->{'desc'}." ($_)" ] + } @plist; -print " $text{'acl_cancel'} \n"; -printf " $text{'no'}\n", - $_[0]->{'cancel'} == 0 ? "checked" : ""; -printf " $text{'yes'}\n", - $_[0]->{'cancel'} == 1 ? "checked" : ""; -printf " $text{'acl_listed'}
\n", - $_[0]->{'cancel'} == 2 ? "checked" : ""; -print " \n"; +print &ui_table_row($text{'acl_printers'}, + &ui_radio("printers_def", $o->{'printers'} eq '*' ? 1 : 0, + [ [ 1, $text{'acl_pall'} ], + [ 0, $text{'acl_psel'} ] ])."
\n". + &ui_select("printers", [ split(/\s+/, $o->{'printers'}) ], \@popts, 4, 1), + 3); -print " $text{'acl_user'} \n"; -printf " %s\n", - $_[0]->{'user'} eq '*' ? 'checked' : '', $text{'acl_user_all'}; -printf " %s\n", - $_[0]->{'user'} ? '' : 'checked', $text{'acl_user_this'}; -printf "\n", - $_[0]->{'user'} eq '*' || !$_[0]->{'user'} ? '' : 'checked'; -printf " \n", - $_[0]->{'user'} eq '*' || !$_[0]->{'user'} ? '' : $_[0]->{'user'}; +print &ui_table_row($text{'acl_cancel'}, + &ui_radio_table("cancel", + defined($o->{'cancel'}) ? $o->{'cancel'} : 0, + [ [ 0, $text{'no'} ], + [ 1, $text{'yes'} ], + [ 2, $text{'acl_listed'}, + &ui_select("jobs", [ split(/\s+/, $o->{'jobs'}) ], \@popts, 4, 1) ] ], 1), + 3); -print " $text{'acl_add'}\n"; -printf " $text{'yes'}\n", - $_[0]->{'add'} ? "checked" : ""; -printf " $text{'no'}\n", - $_[0]->{'add'} ? "" : "checked"; +my $user_def = $o->{'user'} eq '*' ? 1 : $o->{'user'} ? 0 : 2; +print &ui_table_row($text{'acl_user'}, + &ui_radio_table("user_def", $user_def, + [ [ 1, $text{'acl_user_all'} ], + [ 2, $text{'acl_user_this'} ], + [ 0, "", &ui_textbox("user", + $user_def == 0 ? $o->{'user'} : "", 13) ] ], 1), + 3); -print "$text{'acl_stop'}\n"; -printf " $text{'yes'}\n", - $_[0]->{'stop'} == 1 ? "checked" : ""; -printf " $text{'acl_restart'}\n", - $_[0]->{'stop'} == 2 ? "checked" : ""; -printf " $text{'no'} \n", - $_[0]->{'stop'} == 0 ? "checked" : ""; +print &ui_table_row($text{'acl_add'}, + &ui_yesno_radio("add", $o->{'add'})); +print &ui_table_row($text{'acl_stop'}, + &ui_radio("stop", defined($o->{'stop'}) ? $o->{'stop'} : 0, + [ [ 1, $text{'yes'} ], + [ 2, $text{'acl_restart'} ], + [ 0, $text{'no'} ] ])); -print " $text{'acl_view'}\n"; -printf " $text{'yes'}\n", - $_[0]->{'view'} ? "checked" : ""; -printf " $text{'no'}\n", - $_[0]->{'view'} ? "" : "checked"; +print &ui_table_row($text{'acl_view'}, + &ui_yesno_radio("view", $o->{'view'})); +print &ui_table_row($text{'acl_test'}, + &ui_yesno_radio("test", $o->{'test'})); -print "$text{'acl_test'}\n"; -printf " $text{'yes'}\n", - $_[0]->{'test'} ? "checked" : ""; -printf " $text{'no'} \n", - $_[0]->{'test'} ? "" : "checked"; - -print " $text{'acl_delete'}\n"; -printf " $text{'yes'}\n", - $_[0]->{'delete'} ? "checked" : ""; -printf " $text{'no'}\n", - $_[0]->{'delete'} ? "" : "checked"; - -print "$text{'acl_cluster'}\n"; -printf " $text{'yes'}\n", - $_[0]->{'cluster'} ? "checked" : ""; -printf " $text{'no'} \n", - $_[0]->{'cluster'} ? "" : "checked"; - -print "\n"; +print &ui_table_row($text{'acl_delete'}, + &ui_yesno_radio("delete", $o->{'delete'})); +print &ui_table_row($text{'acl_cluster'}, + &ui_yesno_radio("cluster", $o->{'cluster'})); } # acl_security_save(&options) diff --git a/mysql/acl_security.pl b/mysql/acl_security.pl index 945ddb6c4..36c62b184 100755 --- a/mysql/acl_security.pl +++ b/mysql/acl_security.pl @@ -5,85 +5,63 @@ require 'mysql-lib.pl'; # Output HTML for editing security options for the mysql module sub acl_security_form { -print " $text{'acl_dbs'}\n"; -print "\n"; -printf " %s\n", - $_[0]->{'dbs'} eq '*' ? 'checked' : '', $text{'acl_dall'}; -printf " %s
\n", - $_[0]->{'dbs'} eq '*' ? '' : 'checked', $text{'acl_dsel'}; -print "\n"; +my ($o) = @_; +my @dbs = &list_databases(); -print "$text{'acl_delete'} \n"; -printf " %s\n", - $_[0]->{'delete'} ? 'checked' : '', $text{'yes'}; -printf " %s \n", - $_[0]->{'delete'} ? '' : 'checked', $text{'no'}; +print &ui_table_row($text{'acl_dbs'}, + &ui_radio("dbs_def", $o->{'dbs'} eq '*' ? 1 : 0, + [ [ 1, $text{'acl_dall'} ], + [ 0, $text{'acl_dsel'} ] ])."
\n". + &ui_select("dbs", [ split(/\s+/, $o->{'dbs'}) ], \@dbs, 3, 1), + 3); -print " $text{'acl_stop'} \n"; -printf " %s\n", - $_[0]->{'stop'} ? 'checked' : '', $text{'yes'}; -printf " %s \n", - $_[0]->{'stop'} ? '' : 'checked', $text{'no'}; +print &ui_table_row($text{'acl_delete'}, + &ui_yesno_radio("delete", $o->{'delete'})); +print &ui_table_row($text{'acl_stop'}, + &ui_yesno_radio("stop", $o->{'stop'})); +print &ui_table_row($text{'acl_edonly'}, + &ui_yesno_radio("edonly", $o->{'edonly'})); -print " $text{'acl_edonly'} \n"; -printf " %s\n", - $_[0]->{'edonly'} ? 'checked' : '', $text{'yes'}; -printf " %s \n", - $_[0]->{'edonly'} ? '' : 'checked', $text{'no'}; +print &ui_table_row($text{'acl_indexes'}, + &ui_yesno_radio("indexes", $o->{'indexes'})); +print &ui_table_row($text{'acl_views'}, + &ui_yesno_radio("views", $o->{'views'})); -print " $text{'acl_indexes'}\n"; -print "",&ui_yesno_radio("indexes", $_[0]->{'indexes'}),"\n"; +print &ui_table_row($text{'acl_create'}, + &ui_radio_table("create", + defined($o->{'create'}) ? $o->{'create'} : 0, + [ [ 1, $text{'yes'} ], + [ 2, $text{'acl_max'}, + &ui_textbox("max", $o->{'max'}, 5) ], + [ 0, $text{'no'} ] ], 1), + 3); -print "$text{'acl_views'}\n"; -print "",&ui_yesno_radio("views", $_[0]->{'views'})," \n"; +print &ui_table_row($text{'acl_perms'}, + &ui_radio("perms", defined($o->{'perms'}) ? $o->{'perms'} : 0, + [ [ 1, $text{'yes'} ], + [ 2, $text{'acl_only'} ], + [ 0, $text{'no'} ] ]), + 3); -print " $text{'acl_create'} \n"; -printf " %s\n", - $_[0]->{'create'} == 1 ? 'checked' : '', $text{'yes'}; -printf " %s\n", - $_[0]->{'create'} == 2 ? 'checked' : '', $text{'acl_max'}; -printf "\n", - $_[0]->{'max'}; -printf " %s \n", - $_[0]->{'create'} == 0 ? 'checked' : '', $text{'no'}; +print &ui_table_row($text{'acl_login'}, + &ui_radio_table("user_def", $o->{'user'} ? 0 : 1, + [ [ 1, $text{'acl_user_def'} ], + [ 0, "", + $text{'acl_user'}." ". + &ui_textbox("user", $o->{'user'}, 10)." ". + $text{'acl_pass'}." ". + &ui_password("pass", $o->{'pass'}, 10) ] ], 1), + 3); -print " $text{'acl_perms'} \n"; -printf " %s\n", - $_[0]->{'perms'} == 1 ? 'checked' : '', $text{'yes'}; -printf " %s\n", - $_[0]->{'perms'} == 2 ? 'checked' : '', $text{'acl_only'}; -printf " %s\n", - $_[0]->{'perms'} == 0 ? 'checked' : '', $text{'no'}; -print " \n"; - -print " $text{'acl_login'} \n"; -printf " %s
\n", - $_[0]->{'user'} ? '' : 'checked', $text{'acl_user_def'}; -printf "\n", - $_[0]->{'user'} ? 'checked' : ''; -printf "%s \n", - $text{'acl_user'}, $_[0]->{'user'}; -printf "%s \n", - $text{'acl_pass'}, $_[0]->{'pass'}; - -print " $text{'acl_buser'}\n"; -printf " %s\n", - $_[0]->{'buser'} ? "" : "checked", $text{'acl_bnone'}; -printf "\n", - $_[0]->{'buser'} ? "checked" : ""; -printf " %s \n", - $_[0]->{'buser'}, &user_chooser_button("buser"); - -print " $text{'acl_bpath'}\n"; -printf " %s \n", - $_[0]->{'bpath'}, &file_chooser_button("bpath", 1); +print &ui_table_row($text{'acl_buser'}, + &ui_opt_textbox("buser", $o->{'buser'}, 8, $text{'acl_bnone'})." ". + &user_chooser_button("buser"), + 3); +print &ui_table_row($text{'acl_bpath'}, + &ui_textbox("bpath", $o->{'bpath'}, 40)." ". + &file_chooser_button("bpath", 1), + 3); } # acl_security_save(&options) diff --git a/postgresql/acl_security.pl b/postgresql/acl_security.pl index 5d8443e17..2e6d96cbd 100755 --- a/postgresql/acl_security.pl +++ b/postgresql/acl_security.pl @@ -5,108 +5,62 @@ require 'postgresql-lib.pl'; # Output HTML for editing security options for the postgresql module sub acl_security_form { -my (@listdb)=&list_databases(); -print " $text{'acl_dbs'}\n"; -print "
$text{'acl_dbscannot'}" unless @listdb; -print "\n"; -print "\n"; +my ($o) = @_; +my @listdb = &list_databases(); + if (@listdb) { - printf " %s\n", - $_[0]->{'dbs'} eq '*' ? 'checked' : '', $text{'acl_dall'}; - printf " %s
\n", - $_[0]->{'dbs'} eq '*' ? '' : 'checked', $text{'acl_dsel'}; - print ""; - print "\n"; - } -else { - print "{'dbs'}."\">\n"; + print &ui_table_row($text{'acl_dbs'}, + &ui_radio("dbs_def", $o->{'dbs'} eq '*' ? 1 : 0, + [ [ 1, $text{'acl_dall'} ], + [ 0, $text{'acl_dsel'} ] ])."
\n". + &ui_select("dbs", [ split(/\s+/, $o->{'dbs'}) ], \@listdb, 5, 1). + &ui_hidden("dblist", "1"), + 3); + } +else { + print &ui_table_row($text{'acl_dbs'}, + $text{'acl_dbscannot'}.&ui_hidden("dblist", "0 ".$o->{'dbs'}), + 3); } -print "\n"; -print "$text{'acl_create'} \n"; -printf " %s\n", - $_[0]->{'create'} == 1 ? 'checked' : '', $text{'yes'}; -printf " %s\n", - $_[0]->{'create'} == 2 ? 'checked' : '', $text{'acl_max'}; -printf "\n", - $_[0]->{'max'}; -printf " %s \n", - $_[0]->{'create'} == 0 ? 'checked' : '', $text{'no'}; +print &ui_table_row($text{'acl_create'}, + &ui_radio_table("create", + defined($o->{'create'}) ? $o->{'create'} : 0, + [ [ 1, $text{'yes'} ], + [ 2, $text{'acl_max'}, &ui_textbox("max", $o->{'max'}, 5) ], + [ 0, $text{'no'} ] ], 1), + 3); -print " $text{'acl_delete'} \n"; -printf " %s\n", - $_[0]->{'delete'} ? 'checked' : '', $text{'yes'}; -printf " %s \n", - $_[0]->{'delete'} ? '' : 'checked', $text{'no'}; +print &ui_table_row($text{'acl_delete'}, + &ui_yesno_radio("delete", $o->{'delete'})); +print &ui_table_row($text{'acl_stop'}, + &ui_yesno_radio("stop", $o->{'stop'})); +print &ui_table_row($text{'acl_users'}, + &ui_yesno_radio("users", $o->{'users'})); -print " $text{'acl_stop'} \n"; -printf " %s\n", - $_[0]->{'stop'} ? 'checked' : '', $text{'yes'}; -printf " %s \n", - $_[0]->{'stop'} ? '' : 'checked', $text{'no'}; +print &ui_table_row($text{'acl_login'}, + &ui_radio_table("user_def", $o->{'user'} ? 0 : 1, + [ [ 1, $text{'acl_user_def'} ], + [ 0, "", + $text{'acl_user'}." ".&ui_textbox("user", $o->{'user'}, 10)." ". + $text{'acl_pass'}." ".&ui_password("pass", $o->{'pass'}, 10)."
\n". + &ui_checkbox("sameunix", 1, $text{'acl_sameunix'}, $o->{'sameunix'}) ] ], 1), + 3); -print " $text{'acl_users'} \n"; -printf " %s\n", - $_[0]->{'users'} ? 'checked' : '', $text{'yes'}; -printf " %s \n", - $_[0]->{'users'} ? '' : 'checked', $text{'no'}; +print &ui_table_row($text{'acl_backup'}, + &ui_yesno_radio("backup", $o->{'backup'})); +print &ui_table_row($text{'acl_restore'}, + &ui_yesno_radio("restore", $o->{'restore'})); -print " $text{'acl_login'} \n"; -printf " %s
\n", - $_[0]->{'user'} ? '' : 'checked', $text{'acl_user_def'}; -printf "\n", - $_[0]->{'user'} ? 'checked' : ''; -printf "%s \n", - $text{'acl_user'}, $_[0]->{'user'}; -printf "%s
\n", - $text{'acl_pass'}, $_[0]->{'pass'}; -print "   \n"; -printf " %s \n", - $_[0]->{'sameunix'} ? "checked" : "", $text{'acl_sameunix'}; +print &ui_table_row($text{'acl_cmds'}, + &ui_yesno_radio("cmds", $o->{'cmds'})); +print &ui_table_row($text{'acl_views'}, + &ui_yesno_radio("views", $o->{'views'})); -print " $text{'acl_backup'} \n"; -printf " %s\n", - $_[0]->{'backup'} ? 'checked' : '', $text{'yes'}; -printf " %s\n", - $_[0]->{'backup'} ? '' : 'checked', $text{'no'}; - -print "$text{'acl_restore'} \n"; -printf " %s\n", - $_[0]->{'restore'} ? 'checked' : '', $text{'yes'}; -printf " %s \n", - $_[0]->{'restore'} ? '' : 'checked', $text{'no'}; - -print " $text{'acl_cmds'} \n"; -printf " %s\n", - $_[0]->{'cmds'} ? "checked" : "", $text{'yes'}; -printf " %s\n", - $_[0]->{'cmds'} ? "" : "checked", $text{'no'}; - -print "$text{'acl_views'} \n"; -printf " %s\n", - $_[0]->{'views'} ? 'checked' : '', $text{'yes'}; -printf " %s \n", - $_[0]->{'views'} ? '' : 'checked', $text{'no'}; - -print " $text{'acl_indexes'} \n"; -printf " %s\n", - $_[0]->{'indexes'} ? "checked" : "", $text{'yes'}; -printf " %s\n", - $_[0]->{'indexes'} ? "" : "checked", $text{'no'}; - -print "$text{'acl_seqs'} \n"; -printf " %s\n", - $_[0]->{'seqs'} ? 'checked' : '', $text{'yes'}; -printf " %s \n", - $_[0]->{'seqs'} ? '' : 'checked', $text{'no'}; - -print "\n"; +print &ui_table_row($text{'acl_indexes'}, + &ui_yesno_radio("indexes", $o->{'indexes'})); +print &ui_table_row($text{'acl_seqs'}, + &ui_yesno_radio("seqs", $o->{'seqs'})); } # acl_security_save(&options) diff --git a/samba/acl_security.pl b/samba/acl_security.pl index d62f5c958..682db5437 100755 --- a/samba/acl_security.pl +++ b/samba/acl_security.pl @@ -5,222 +5,83 @@ require 'samba-lib.pl'; # Output HTML for editing security options for the samba module sub acl_security_form { -print "\n$text{'acl_apply'} \n"; -printf " $text{'yes'}\n", - $_[0]->{'apply'} ? "checked" : ""; -printf " $text{'no'}\n", - $_[0]->{'apply'} ? "" : "checked"; -print "\n"; +my ($o) = @_; -print "\n$text{'acl_view_all_con'} \n"; -printf " $text{'yes'}\n", - $_[0]->{'view_all_con'} ? "checked" : ""; -printf " $text{'no'}\n", - $_[0]->{'view_all_con'} ? "" : "checked"; -print "\n"; - -print "\n$text{'acl_kill_con'} \n"; -printf " $text{'yes'}\n", - $_[0]->{'kill_con'} ? "checked" : ""; -printf " $text{'no'}\n", - $_[0]->{'kill_con'} ? "" : "checked"; -print "\n"; - -print "
\n"; - -print "\n$text{'acl_conf_net'} \n"; -printf " $text{'yes'}\n", - $_[0]->{'conf_net'} ? "checked" : ""; -printf " $text{'no'}\n", - $_[0]->{'conf_net'} ? "" : "checked"; -print "\n"; - -print "\n$text{'acl_conf_smb'} \n"; -printf " $text{'yes'}\n", - $_[0]->{'conf_smb'} ? "checked" : ""; -printf " $text{'no'}\n", - $_[0]->{'conf_smb'} ? "" : "checked"; -print "\n"; - -print "\n$text{'acl_conf_pass'} \n"; -printf " $text{'yes'}\n", - $_[0]->{'conf_pass'} ? "checked" : ""; -printf " $text{'no'}\n", - $_[0]->{'conf_pass'} ? "" : "checked"; -print "\n"; - -print "\n$text{'acl_conf_print'} \n"; -printf " $text{'yes'}\n", - $_[0]->{'conf_print'} ? "checked" : ""; -printf " $text{'no'}\n", - $_[0]->{'conf_print'} ? "" : "checked"; -print "\n"; - -print "\n$text{'acl_conf_misc'} \n"; -printf " $text{'yes'}\n", - $_[0]->{'conf_misc'} ? "checked" : ""; -printf " $text{'no'}\n", - $_[0]->{'conf_misc'} ? "" : "checked"; -print "\n"; - -print "\n$text{'acl_swat'} \n"; -printf " $text{'yes'}\n", - $_[0]->{'swat'} ? "checked" : ""; -printf " $text{'no'}\n", - $_[0]->{'swat'} ? "" : "checked"; -print "\n"; - -print "\n$text{'acl_manual'} \n"; -printf " $text{'yes'}\n", - $_[0]->{'manual'} ? "checked" : ""; -printf " $text{'no'}\n", - $_[0]->{'manual'} ? "" : "checked"; -print "\n"; - -print "\n$text{'acl_winbind'} \n"; -printf " $text{'yes'}\n", - $_[0]->{'winbind'} ? "checked" : ""; -printf " $text{'no'}\n", - $_[0]->{'winbind'} ? "" : "checked"; -print "\n"; - -print "\n$text{'acl_bind'} \n"; -printf " $text{'yes'}\n", - $_[0]->{'conf_bind'} ? "checked" : ""; -printf " $text{'no'}\n", - $_[0]->{'conf_bind'} ? "" : "checked"; -print "\n"; - -print "
\n"; - -# encripted passwords -print "\n$text{'acl_enc_passwd_opts'} \n"; - -print "\n$text{'acl_view_users'} \n"; -printf " $text{'yes'}\n", - $_[0]->{'view_users'} ? "checked" : ""; -printf " $text{'no'}\n", - $_[0]->{'view_users'} ? "" : "checked"; -print "\n"; - -print "\n$text{'acl_maint_users'} \n"; -printf " $text{'yes'}\n", - $_[0]->{'maint_users'} ? "checked" : ""; -printf " $text{'no'}\n", - $_[0]->{'maint_users'} ? "" : "checked"; -print "\n"; - -print "\n$text{'acl_maint_makepass'} \n"; -printf " $text{'yes'}\n", - $_[0]->{'maint_makepass'} ? "checked" : ""; -printf " $text{'no'}\n", - $_[0]->{'maint_makepass'} ? "" : "checked"; -print "\n"; - -print "\n$text{'acl_maint_sync'} \n"; -printf " $text{'yes'}\n", - $_[0]->{'maint_sync'} ? "checked" : ""; -printf " $text{'no'}\n", - $_[0]->{'maint_sync'} ? "" : "checked"; -print "\n"; - -print "
\n"; - -# encripted passwords -print "\n$text{'acl_group_opts'} \n"; - -print "\n$text{'acl_maint_groups'} \n"; -printf " $text{'yes'}\n", - $_[0]->{'maint_groups'} ? "checked" : ""; -printf " $text{'no'}\n", - $_[0]->{'maint_groups'} ? "" : "checked"; -print "\n"; - -print "\n$text{'acl_maint_gsync'} \n"; -printf " $text{'yes'}\n", - $_[0]->{'maint_gsync'} ? "checked" : ""; -printf " $text{'no'}\n", - $_[0]->{'maint_gsync'} ? "" : "checked"; -print "\n"; - -print "
\n"; - -# hide -print "\n$text{'acl_hide'} \n"; -printf " $text{'yes'}\n", - $_[0]->{'hide'} == 1 ? "checked" : ""; -printf " $text{'no'}\n", - $_[0]->{'hide'} == 0 ? "checked" : ""; -print "\n"; - -print "
\n"; - -# global acls -print "\n$text{'acl_afs'}\n"; -print "\n"; -printf " %s\n", - $_[0]->{'c_fs'} ? "checked" : "", $text{"acl_c"}; -printf " %s\n", - $_[0]->{'r_fs'} ? "checked" : "", $text{"acl_r"}; -printf " %s\n", - $_[0]->{'w_fs'} ? "checked" : "", $text{"acl_w"}; -print " \n"; - -print "\n$text{'acl_aps'}\n"; -print "\n"; -printf " %s\n", - $_[0]->{'c_ps'} ? "checked" : "", $text{"acl_c"}; -printf " %s\n", - $_[0]->{'r_ps'} ? "checked" : "", $text{"acl_r"}; -printf " %s\n", - $_[0]->{'w_ps'} ? "checked" : "", $text{"acl_w"}; -print " \n"; - -print "\n$text{'acl_copy'} \n"; -printf " $text{'yes'}\n", - $_[0]->{'copy'} ? "checked" : ""; -printf " $text{'no'}\n", - $_[0]->{'copy'} ? "" : "checked"; -print "\n"; - -print "
\n"; - -# per-share acls -print "$text{'acl_per_fs_acls'} \n"; -printf " $text{'yes'}\n", - $_[0]->{'per_fs_acls'} ? "checked" : ""; -printf " $text{'no'}\n", - $_[0]->{'per_fs_acls'} ? "" : "checked"; -print "\n"; - -print "$text{'acl_per_ps_acls'} \n"; -printf " $text{'yes'}\n", - $_[0]->{'per_ps_acls'} ? "checked" : ""; -printf " $text{'no'}\n", - $_[0]->{'per_ps_acls'} ? "" : "checked"; -print "\n"; - -print "
\n"; - -# table -print " \n\n"; -printf "\n", $text{'acl_per_share_acls'}; -print "\n"; -printf "\n", $text{'acl_sname'}; -printf "\n", $text{'acl_saccess'}; -printf "\n", $text{'acl_sconn'}; -printf "\n", $text{'acl_sopthdr'}; -print "\n\n"; -printf "\n", $text{'acl_ssec'}; -printf "\n", $text{'acl_sperm'}; -printf "\n", $text{'acl_snaming'}; -printf "\n", $text{'acl_smisc'}, $text{'acl_sprn'}; -print "\n"; - -foreach (&list_shares()) { - &display_acl_row($_[0], $_); +foreach my $f ('apply', 'view_all_con', 'kill_con') { + print &ui_table_row($text{'acl_'.$f}, + &ui_yesno_radio($f, $o->{$f})); } -print "
%s
%s%s%s%s
%s%s%s%s
%s
\n"; + +print &ui_table_hr(); + +foreach my $f ('conf_net', 'conf_smb', 'conf_pass', 'conf_print', + 'conf_misc', 'swat', 'manual', 'winbind') { + print &ui_table_row($text{'acl_'.$f}, + &ui_yesno_radio($f, $o->{$f})); + } +print &ui_table_row($text{'acl_bind'}, + &ui_yesno_radio("conf_bind", $o->{'conf_bind'})); + +print &ui_table_hr(); +print &ui_table_span($text{'acl_enc_passwd_opts'}); + +foreach my $f ('view_users', 'maint_users', 'maint_makepass', 'maint_sync') { + print &ui_table_row($text{'acl_'.$f}, + &ui_yesno_radio($f, $o->{$f})); + } + +print &ui_table_hr(); +print &ui_table_span($text{'acl_group_opts'}); + +foreach my $f ('maint_groups', 'maint_gsync') { + print &ui_table_row($text{'acl_'.$f}, + &ui_yesno_radio($f, $o->{$f})); + } + +print &ui_table_hr(); + +print &ui_table_row($text{'acl_hide'}, + &ui_yesno_radio("hide", defined($o->{'hide'}) ? $o->{'hide'} : 0)); + +print &ui_table_hr(); + +print &ui_table_row($text{'acl_afs'}, + join("", map { &ui_checkbox($_."_fs", 1, $text{"acl_".$_}, $o->{$_."_fs"}) } + qw(c r w)), + 3); + +print &ui_table_row($text{'acl_aps'}, + join("", map { &ui_checkbox($_."_ps", 1, $text{"acl_".$_}, $o->{$_."_ps"}) } + qw(c r w)), + 3); + +print &ui_table_row($text{'acl_copy'}, + &ui_yesno_radio("copy", $o->{'copy'})); + +print &ui_table_hr(); + +print &ui_table_row($text{'acl_per_fs_acls'}, + &ui_yesno_radio("per_fs_acls", $o->{'per_fs_acls'})); +print &ui_table_row($text{'acl_per_ps_acls'}, + &ui_yesno_radio("per_ps_acls", $o->{'per_ps_acls'})); + +print &ui_table_hr(); + +my @heads = ( + $text{'acl_sname'}, + $text{'acl_saccess'}, + $text{'acl_sconn'}, + $text{'acl_ssec'}, + $text{'acl_sperm'}, + $text{'acl_snaming'}, + $text{'acl_smisc'}." / ".$text{'acl_sprn'}, + ); +my $stable = &ui_columns_start(\@heads, 100); +foreach (&list_shares()) { + $stable .= &display_acl_row($o, $_); + } +$stable .= &ui_columns_end(); +print &ui_table_row($text{'acl_per_share_acls'}, $stable, 3); } # acl_security_save(&options) @@ -285,25 +146,23 @@ local %share; local $stype=&istrue('printable') ? 'ps' : 'fs'; local $aclname='ACL' . $stype . '_' . $name; -#display row -print "\n"; -printf $stype eq 'fs' ? "%s\n" : - "%s\n", $name; -&display_acl_cell($acc, $name, 'r', 'w', $aclname, - $text{'acl_na'}, $text{'acl_r1'}, $text{'acl_rw'}); -&display_acl_cell($acc, $name, 'v', 'V', $aclname, - $text{'acl_na'}, $text{'acl_view'}, $text{'acl_kill'}); -&display_acl_cell($acc, $name, 's', 'S', $aclname, - $text{'acl_na'}, $text{'acl_view'}, $text{'acl_edit'}); -$stype eq 'fs' ? &display_acl_cell($acc, $name, 'p', 'P', $aclname, - $text{'acl_na'}, $text{'acl_view'}, $text{'acl_edit'}) : - print " \n"; -$stype eq 'fs' ? &display_acl_cell($acc, $name, 'n', 'N', $aclname, - $text{'acl_na'}, $text{'acl_view'}, $text{'acl_edit'}) : - print " \n"; -&display_acl_cell($acc, $name, 'o', 'O', $aclname, - $text{'acl_na'}, $text{'acl_view'}, $text{'acl_edit'}); -print "\n"; +return &ui_columns_row([ + $stype eq 'fs' ? "$name" : "$name", + &display_acl_cell($acc, $name, 'r', 'w', $aclname, + $text{'acl_na'}, $text{'acl_r1'}, $text{'acl_rw'}), + &display_acl_cell($acc, $name, 'v', 'V', $aclname, + $text{'acl_na'}, $text{'acl_view'}, $text{'acl_kill'}), + &display_acl_cell($acc, $name, 's', 'S', $aclname, + $text{'acl_na'}, $text{'acl_view'}, $text{'acl_edit'}), + $stype eq 'fs' ? &display_acl_cell($acc, $name, 'p', 'P', $aclname, + $text{'acl_na'}, $text{'acl_view'}, + $text{'acl_edit'}) : "", + $stype eq 'fs' ? &display_acl_cell($acc, $name, 'n', 'N', $aclname, + $text{'acl_na'}, $text{'acl_view'}, + $text{'acl_edit'}) : "", + &display_acl_cell($acc, $name, 'o', 'O', $aclname, + $text{'acl_na'}, $text{'acl_view'}, $text{'acl_edit'}), + ]); } #display_acl_cell(\%access, $name, @@ -313,29 +172,12 @@ sub display_acl_cell { local ($acc, $name, $rp, $wp, $aclname, $text1, $text2, $text3) = @_; local $rn = $rp . $wp . '_' . $aclname; - -print "\n"; -if($acc->{$aclname}) { - printf " %s
\n", - !&perm_to($rp, $acc, $aclname) ? - "checked" : "", $text1; - printf " %s
\n", - &perm_to($rp, $acc, $aclname) && - !&perm_to($rp.$wp, $acc, $aclname) ? - "checked" : "",$text2; - printf " %s\n", - &perm_to($rp.$wp, $acc, $aclname) ? - "checked" : "", $text3; - } -else { - printf " %s
\n", - $text1; - printf " %s
\n", - $text2; - printf " %s\n", - $text3; - } -print "\n"; +my $sel = !$acc->{$aclname} || !&perm_to($rp, $acc, $aclname) ? '' : + &perm_to($rp.$wp, $acc, $aclname) ? $rp.$wp : $rp; +return &ui_radio($rn, $sel, + [ [ '', $text1."
" ], + [ $rp, $text2."
" ], + [ $rp.$wp, $text3 ] ]); } # perm_to($permissions_string,\%access,$ACLname) diff --git a/sendmail/acl_security.pl b/sendmail/acl_security.pl index e14212b84..7fe770275 100755 --- a/sendmail/acl_security.pl +++ b/sendmail/acl_security.pl @@ -5,202 +5,112 @@ require 'sendmail-lib.pl'; # Output HTML for editing security options for the sendmail module sub acl_security_form { -print " $text{'acl_opts'} \n"; -printf " $text{'yes'}\n", - $_[0]->{'opts'} ? "checked" : ""; -printf " $text{'no'}\n", - $_[0]->{'opts'} ? "" : "checked"; +my ($o) = @_; -print "$text{'acl_cws'} \n"; -printf " $text{'yes'}\n", - $_[0]->{'cws'} ? "checked" : ""; -printf " $text{'no'} \n", - $_[0]->{'cws'} ? "" : "checked"; - -print " $text{'acl_masq'} \n"; -printf " $text{'yes'}\n", - $_[0]->{'masq'} ? "checked" : ""; -printf " $text{'no'}\n", - $_[0]->{'masq'} ? "" : "checked"; - -print "$text{'acl_trusts'} \n"; -printf " $text{'yes'}\n", - $_[0]->{'trusts'} ? "checked" : ""; -printf " $text{'no'} \n", - $_[0]->{'trusts'} ? "" : "checked"; - -print " $text{'acl_cgs'} \n"; -printf " $text{'yes'}\n", - $_[0]->{'cgs'} ? "checked" : ""; -printf " $text{'no'}\n", - $_[0]->{'cgs'} ? "" : "checked"; - -print "$text{'acl_relay'} \n"; -printf " $text{'yes'}\n", - $_[0]->{'relay'} ? "checked" : ""; -printf " $text{'no'} \n", - $_[0]->{'relay'} ? "" : "checked"; - -print " $text{'acl_mailers'} \n"; -printf " $text{'yes'}\n", - $_[0]->{'mailers'} ? "checked" : ""; -printf " $text{'no'}\n", - $_[0]->{'mailers'} ? "" : "checked"; - -print "$text{'acl_access'} \n"; -printf " $text{'yes'}\n", - $_[0]->{'access'} ? "checked" : ""; -printf " $text{'no'} \n", - $_[0]->{'access'} ? "" : "checked"; - -print " $text{'acl_domains'} \n"; -printf " $text{'yes'}\n", - $_[0]->{'domains'} ? "checked" : ""; -printf " $text{'no'}\n", - $_[0]->{'domains'} ? "" : "checked"; - -print "$text{'acl_stop'} \n"; -printf " $text{'yes'}\n", - $_[0]->{'stop'} ? "checked" : ""; -printf " $text{'no'} \n", - $_[0]->{'stop'} ? "" : "checked"; - -print " $text{'acl_manual'} \n"; -printf " $text{'yes'}\n", - $_[0]->{'manual'} ? "checked" : ""; -printf " $text{'no'}\n", - $_[0]->{'manual'} ? "" : "checked"; - -print "$text{'acl_mailq'} \n"; - -print " $text{'acl_qdoms'} \n"; -printf " %s\n", - $_[0]->{'qdoms'} ? "" : "checked", $text{'acl_all'}; -printf " %s\n", - $_[0]->{'qdoms'} ? "checked" : "", $text{'acl_matching'}; -printf " \n", - $_[0]->{'qdoms'}; - -print " $text{'acl_qdomsmode'} \n"; -foreach $m (0 .. 2) { - printf " %s\n", - $m, $_[0]->{'qdomsmode'} == $m ? "checked" : "", - $text{'acl_qdomsmode'.$m}; +foreach my $f ('opts', 'cws', 'masq', 'trusts', 'cgs', 'relay', + 'mailers', 'access', 'domains', 'stop', 'manual') { + print &ui_table_row($text{'acl_'.$f}, + &ui_yesno_radio($f, $o->{$f})); } -print " \n"; -print " $text{'acl_flushq'} \n"; -printf " $text{'yes'}\n", - $_[0]->{'flushq'} ? "checked" : ""; -printf " $text{'no'}\n", - $_[0]->{'flushq'} ? "" : "checked"; +print &ui_table_row($text{'acl_mailq'}, + &ui_select("mailq", + defined($o->{'mailq'}) && $o->{'mailq'} ne '' ? $o->{'mailq'} : 0, + [ [ 2, $text{'acl_viewdel'} ], + [ 1, $text{'acl_view'} ], + [ 0, $text{'no'} ] ])); -print "$text{'acl_ports'} \n"; -printf " $text{'yes'}\n", - $_[0]->{'ports'} ? "checked" : ""; -printf " $text{'no'}\n", - $_[0]->{'ports'} ? "" : "checked"; +print &ui_table_row($text{'acl_qdoms'}, + &ui_radio_table("qdoms_def", $o->{'qdoms'} ? 0 : 1, + [ [ 1, $text{'acl_all'} ], + [ 0, $text{'acl_matching'}, + &ui_textbox("qdoms", $o->{'qdoms'}, 40) ] ], 1), + 3); -# Virtusers -print "
\n"; +print &ui_table_row($text{'acl_qdomsmode'}, + &ui_radio("qdomsmode", + defined($o->{'qdomsmode'}) ? $o->{'qdomsmode'} : 0, + [ map { [ $_, $text{'acl_qdomsmode'.$_} ] } 0 .. 2 ]), + 3); -print " $text{'acl_virtusers'} \n"; -printf " $text{'acl_none'}\n", - $_[0]->{'vmode'} == 0 ? "checked" : ""; -printf " $text{'acl_all'}\n", - $_[0]->{'vmode'} == 1 ? "checked" : ""; -printf " $text{'acl_vsame'}
\n", - $_[0]->{'vmode'} == 3 ? "checked" : ""; -printf " $text{'acl_matching'}\n", - $_[0]->{'vmode'} == 2 ? "checked" : ""; -printf " \n", - $_[0]->{'vaddrs'}; +print &ui_table_row($text{'acl_flushq'}, + &ui_yesno_radio("flushq", $o->{'flushq'})); +print &ui_table_row($text{'acl_ports'}, + &ui_yesno_radio("ports", $o->{'ports'})); -print " $text{'acl_vtypes'}\n"; -print "\n"; -for($n=0; $n<3; $n++) { - printf " %s\n", - $n, $_[0]->{"vedit_$n"} ? "checked" : "", $text{"acl_vtype$n"}; - } -print " \n"; +print &ui_table_hr(); -print " $text{'acl_vmax'}\n"; -printf " %s\n", - $_[0]->{'vmax'} ? "" : "checked", $text{'acl_unlimited'}; -printf "\n", - $_[0]->{'vmax'} ? "checked" : ""; -printf "\n", - $_[0]->{'vmax'}; +print &ui_table_row($text{'acl_virtusers'}, + &ui_radio_table("vmode", + defined($o->{'vmode'}) ? $o->{'vmode'} : 0, + [ [ 0, $text{'acl_none'} ], + [ 1, $text{'acl_all'} ], + [ 3, $text{'acl_vsame'} ], + [ 2, $text{'acl_matching'}, + &ui_textbox("vaddrs", $o->{'vaddrs'}, 40) ] ], 1), + 3); -print "$text{'acl_vcatchall'}\n"; -print "",&ui_yesno_radio("vcatchall", - int($_[0]->{'vcatchall'}))," \n"; +print &ui_table_row($text{'acl_vtypes'}, + join("", map { &ui_checkbox("vedit_".$_, 1, $text{"acl_vtype".$_}, + $o->{"vedit_".$_}) } 0 .. 2), + 3); -# Aliases -print "
\n"; +print &ui_table_row($text{'acl_vmax'}, + &ui_radio_table("vmax_def", $o->{'vmax'} ? 0 : 1, + [ [ 1, $text{'acl_unlimited'} ], + [ 0, "", &ui_textbox("vmax", $o->{'vmax'}, 5) ] ], 1), + 3); -print " $text{'acl_aliases'} \n"; -printf " $text{'acl_none'}\n", - $_[0]->{'amode'} == 0 ? "checked" : ""; -printf " $text{'acl_all'}\n", - $_[0]->{'amode'} == 1 ? "checked" : ""; -printf " $text{'acl_asame'}
\n", - $_[0]->{'amode'} == 3 ? "checked" : ""; -printf " $text{'acl_matching'}\n", - $_[0]->{'amode'} == 2 ? "checked" : ""; -printf " \n", - $_[0]->{'aliases'}; +print &ui_table_row($text{'acl_vcatchall'}, + &ui_yesno_radio("vcatchall", int($o->{'vcatchall'}))); -print " $text{'acl_atypes'} \n"; -for($n=1; $n<=6; $n++) { - printf " %s\n", - $n, $_[0]->{"aedit_$n"} ? "checked" : "", - $text{"acl_atype$n"}; - } -print " \n"; +print &ui_table_hr(); -print " $text{'acl_amax'}\n"; -printf " %s\n", - $_[0]->{'amax'} ? "" : "checked", $text{'acl_unlimited'}; -printf "\n", - $_[0]->{'amax'} ? "checked" : ""; -printf " \n", - $_[0]->{'amax'}; +print &ui_table_row($text{'acl_aliases'}, + &ui_radio_table("amode", + defined($o->{'amode'}) ? $o->{'amode'} : 0, + [ [ 0, $text{'acl_none'} ], + [ 1, $text{'acl_all'} ], + [ 3, $text{'acl_asame'} ], + [ 2, $text{'acl_matching'}, + &ui_textbox("aliases", $o->{'aliases'}, 40) ] ], 1), + 3); -print " $text{'acl_apath'}\n"; -printf " %s \n", - $_[0]->{'apath'}, &file_chooser_button("apath", 1); +print &ui_table_row($text{'acl_atypes'}, + join("", map { &ui_checkbox("aedit_".$_, 1, $text{"acl_atype".$_}, + $o->{"aedit_".$_}) } 1 .. 6), + 3); -# Outgoing address mappings -print "
\n"; +print &ui_table_row($text{'acl_amax'}, + &ui_radio_table("amax_def", $o->{'amax'} ? 0 : 1, + [ [ 1, $text{'acl_unlimited'} ], + [ 0, "", &ui_textbox("amax", $o->{'amax'}, 5) ] ], 1), + 3); -print " $text{'acl_outgoing'} \n"; -printf " $text{'acl_none'}\n", - $_[0]->{'omode'} == 0 ? "checked" : ""; -printf " $text{'acl_all'}
\n", - $_[0]->{'omode'} == 1 ? "checked" : ""; -printf " $text{'acl_matching'}\n", - $_[0]->{'omode'} == 2 ? "checked" : ""; -printf " \n", - $_[0]->{'oaddrs'}; +print &ui_table_row($text{'acl_apath'}, + &ui_textbox("apath", $o->{'apath'}, 40)." ". + &file_chooser_button("apath", 1), + 3); -# Spam control rules -print "
\n"; +print &ui_table_hr(); -print " $text{'acl_spam'} \n"; -printf " $text{'acl_all'}\n", - $_[0]->{'smode'} == 1 ? "checked" : ""; -printf " $text{'acl_matching'}\n", - $_[0]->{'smode'} == 2 ? "checked" : ""; -printf " \n", - $_[0]->{'saddrs'}; +print &ui_table_row($text{'acl_outgoing'}, + &ui_radio_table("omode", + defined($o->{'omode'}) ? $o->{'omode'} : 0, + [ [ 0, $text{'acl_none'} ], + [ 1, $text{'acl_all'} ], + [ 2, $text{'acl_matching'}, + &ui_textbox("oaddrs", $o->{'oaddrs'}, 40) ] ], 1), + 3); + +print &ui_table_hr(); + +print &ui_table_row($text{'acl_spam'}, + &ui_radio_table("smode", $o->{'smode'}, + [ [ 1, $text{'acl_all'} ], + [ 2, $text{'acl_matching'}, + &ui_textbox("saddrs", $o->{'saddrs'}, 40) ] ], 1), + 3); } # acl_security_save(&options) diff --git a/servers/acl_security.pl b/servers/acl_security.pl index ba422ac3f..e0474da47 100755 --- a/servers/acl_security.pl +++ b/servers/acl_security.pl @@ -5,47 +5,41 @@ require 'servers-lib.pl'; # Output HTML for editing security options for the servers module sub acl_security_form { -print " $text{'acl_servers'}\n"; -print "\n"; -printf " %s\n", - $_[0]->{'servers'} eq '*' ? 'checked' : '', $text{'acl_sall'}; -printf " %s
\n", - $_[0]->{'servers'} eq '*' ? '' : 'checked', $text{'acl_ssel'}; -print "\n"; +my ($o) = @_; +my @servers = sort { $a->{'host'} cmp $b->{'host'} } &list_servers(); +my %scan = map { $_, 1 } split(/\s+/, $o->{'servers'}); +my (@sopts, @ssel); +foreach my $s (sort { $a->{'value'} cmp $b->{'value'} } @servers) { + push(@sopts, [ $s->{'id'}, $s->{'host'} ]); + push(@ssel, $s->{'id'}) if ($scan{$s->{'host'}} || $scan{$s->{'id'}}); + } -print " $text{'acl_edit'} \n"; -print &ui_yesno_radio("edit", $_[0]->{'edit'}),"\n"; +print &ui_table_row($text{'acl_servers'}, + &ui_radio("servers_def", $o->{'servers'} eq '*' ? 1 : 0, + [ [ 1, $text{'acl_sall'} ], + [ 0, $text{'acl_ssel'} ] ])."
\n". + &ui_select("servers", \@ssel, \@sopts, 4, 1), + 3); -print "$text{'acl_find'} \n"; -print &ui_yesno_radio("find", $_[0]->{'find'})," \n"; +print &ui_table_row($text{'acl_edit'}, + &ui_yesno_radio("edit", $o->{'edit'})); +print &ui_table_row($text{'acl_find'}, + &ui_yesno_radio("find", $o->{'find'})); -print " $text{'acl_auto'} \n"; -print &ui_yesno_radio("auto", $_[0]->{'auto'}),"\n"; +print &ui_table_row($text{'acl_auto'}, + &ui_yesno_radio("auto", $o->{'auto'})); +print &ui_table_row($text{'acl_add'}, + &ui_yesno_radio("add", $o->{'add'})); -print "$text{'acl_add'} \n"; -print &ui_yesno_radio("add", $_[0]->{'add'})," \n"; +print &ui_table_row($text{'acl_forcefast'}, + &ui_yesno_radio("forcefast", $o->{'forcefast'})); +print &ui_table_row($text{'acl_forcetype'}, + &ui_yesno_radio("forcetype", $o->{'forcetype'})); -print " $text{'acl_forcefast'} \n"; -print &ui_yesno_radio("forcefast", $_[0]->{'forcefast'}),"\n"; - -print "$text{'acl_forcetype'} \n"; -print &ui_yesno_radio("forcetype", $_[0]->{'forcetype'})," \n"; - -print " $text{'acl_forcelink'} \n"; -print &ui_yesno_radio("forcelink", $_[0]->{'forcelink'}),"\n"; - -print "$text{'acl_links'} \n"; -print &ui_yesno_radio("links", $_[0]->{'links'})," \n"; +print &ui_table_row($text{'acl_forcelink'}, + &ui_yesno_radio("forcelink", $o->{'forcelink'})); +print &ui_table_row($text{'acl_links'}, + &ui_yesno_radio("links", $o->{'links'})); } # acl_security_save(&options) diff --git a/shorewall/acl_security.pl b/shorewall/acl_security.pl index 7c63437ff..1465317d0 100755 --- a/shorewall/acl_security.pl +++ b/shorewall/acl_security.pl @@ -5,20 +5,18 @@ do 'shorewall-lib.pl'; # Output HTML for editing security options for the acl module sub acl_security_form { -print " $text{'acl_nochange'} \n"; -printf " $text{'yes'}\n", - $_[0]->{'nochange'} ? '' : 'checked'; -printf " $text{'no'}\n", - $_[0]->{'nochange'} ? 'checked' : ''; +my ($o) = @_; -print "\n"; +print &ui_table_row($text{'acl_nochange'}, + &ui_yesno_radio("nochange", int($o->{'nochange'}), 0, 1)); -print " $text{'acl_files'} \n"; -print &ui_radio("files_def", $_[0]->{'files'} eq '*' ? 1 : 0, - [ [ 1, $text{'acl_all'} ], [ 0, $text{'acl_sel'} ] ]),"
\n"; -print &ui_select("files", [ split(/\s+/, $_[0]->{'files'}) ], - [ map { [ $_, $text{$_."_title"}." ($_)" ] } - @shorewall_files ], 5, 1); +print &ui_table_row($text{'acl_files'}, + &ui_radio("files_def", $o->{'files'} eq '*' ? 1 : 0, + [ [ 1, $text{'acl_all'} ], [ 0, $text{'acl_sel'} ] ])."
\n". + &ui_select("files", [ split(/\s+/, $o->{'files'}) ], + [ map { [ $_, $text{$_."_title"}." ($_)" ] } + @shorewall_files ], 5, 1), + 3); } # acl_security_save(&options) diff --git a/shorewall6/acl_security.pl b/shorewall6/acl_security.pl index b660bdc09..833289939 100755 --- a/shorewall6/acl_security.pl +++ b/shorewall6/acl_security.pl @@ -5,20 +5,18 @@ do 'shorewall6-lib.pl'; # Output HTML for editing security options for the acl module sub acl_security_form { -print " $text{'acl_nochange'} \n"; -printf " $text{'yes'}\n", - $_[0]->{'nochange'} ? '' : 'checked'; -printf " $text{'no'}\n", - $_[0]->{'nochange'} ? 'checked' : ''; +my ($o) = @_; -print "\n"; +print &ui_table_row($text{'acl_nochange'}, + &ui_yesno_radio("nochange", int($o->{'nochange'}), 0, 1)); -print " $text{'acl_files'} \n"; -print &ui_radio("files_def", $_[0]->{'files'} eq '*' ? 1 : 0, - [ [ 1, $text{'acl_all'} ], [ 0, $text{'acl_sel'} ] ]),"
\n"; -print &ui_select("files", [ split(/\s+/, $_[0]->{'files'}) ], - [ map { [ $_, $text{$_."_title"}." ($_)" ] } - @shorewall6_files ], 5, 1); +print &ui_table_row($text{'acl_files'}, + &ui_radio("files_def", $o->{'files'} eq '*' ? 1 : 0, + [ [ 1, $text{'acl_all'} ], [ 0, $text{'acl_sel'} ] ])."
\n". + &ui_select("files", [ split(/\s+/, $o->{'files'}) ], + [ map { [ $_, $text{$_."_title"}." ($_)" ] } + @shorewall6_files ], 5, 1), + 3); } # acl_security_save(&options) diff --git a/squid/acl_security.pl b/squid/acl_security.pl index d7e3a2d24..32c6f5be7 100755 --- a/squid/acl_security.pl +++ b/squid/acl_security.pl @@ -9,29 +9,23 @@ require 'squid-lib.pl'; # Output HTML for editing security options for the squid module sub acl_security_form { -print " $text{'acl_sections'}\n"; -print " \n"; +my ($o) = @_; -print " $text{'acl_root'}\n"; -printf " %s \n", - $_[0]->{'root'}, &file_chooser_button("root", 1); +print &ui_table_row($text{'acl_sections'}, + &ui_select("sections", + [ grep { $o->{$_} } @accopts ], + [ map { [ $_, $text{"index_${_}"} ] } @accopts ], + 6, 1), + 3); -print " $text{'acl_start'}\n"; -printf " %s\n", - $_[0]->{'start'} ? 'checked' : '', $text{'yes'}; -printf " %s \n", - $_[0]->{'start'} ? '' : 'checked', $text{'no'}; +print &ui_table_row($text{'acl_root'}, + &ui_textbox("root", $o->{'root'}, 40)." ".&file_chooser_button("root", 1), + 3); -print " $text{'acl_restart'}\n"; -printf " %s\n", - $_[0]->{'restart'} ? 'checked' : '', $text{'yes'}; -printf " %s \n", - $_[0]->{'restart'} ? '' : 'checked', $text{'no'}; +print &ui_table_row($text{'acl_start'}, + &ui_yesno_radio("start", $o->{'start'})); +print &ui_table_row($text{'acl_restart'}, + &ui_yesno_radio("restart", $o->{'restart'})); } # acl_security_save(&options) diff --git a/useradmin/acl_security.pl b/useradmin/acl_security.pl index d50055fb7..a9fb44e64 100755 --- a/useradmin/acl_security.pl +++ b/useradmin/acl_security.pl @@ -6,225 +6,173 @@ require 'user-lib.pl'; sub acl_security_form { local $o = $_[0]; +my $uedit_group = $o->{'uedit_mode'} == 5 ? + join(" ", map { "".&my_getgrgid($_) } split(/\s+/, $o->{'uedit'})) : ""; -print " $text{'acl_uedit'} \n"; -printf " $text{'acl_uedit_all'}  \n", - $o->{'uedit_mode'} == 0 ? "checked" : ""; -printf " $text{'acl_uedit_none'} \n", - $o->{'uedit_mode'} == 1 ? "checked" : ""; -printf " $text{'acl_uedit_this'}
\n", - $o->{'uedit_mode'} == 6 ? "checked" : ""; -printf " $text{'acl_uedit_only'}\n", - $o->{'uedit_mode'} == 2 ? "checked" : ""; -printf " %s
\n", - $o->{'uedit_mode'} == 2 ? $o->{'uedit'} : "", - &user_chooser_button("uedit_can", 1); -printf " $text{'acl_uedit_except'}\n", - $o->{'uedit_mode'} == 3 ? "checked" : ""; -printf " %s
\n", - $o->{'uedit_mode'} == 3 ? $o->{'uedit'} : "", - &user_chooser_button("uedit_cannot", 1); -printf " $text{'acl_uedit_uid'}\n", - $o->{'uedit_mode'} == 4 ? "checked" : ""; -printf " - \n", - $o->{'uedit_mode'} == 4 ? $o->{'uedit'} : ""; -printf "
\n", - $o->{'uedit_mode'} == 4 ? $o->{'uedit2'} : ""; -printf " $text{'acl_uedit_group'}\n", - $o->{'uedit_mode'} == 5 ? "checked" : ""; -printf " %s
\n", - $o->{'uedit_mode'} == 5 ? - join(" ", map { "".&my_getgrgid($_) } split(/\s+/, $o->{'uedit'})) :"", - &group_chooser_button("uedit_group", 1); -printf "%s %s
\n", - " " x 5, $o->{'uedit_sec'} ? 'checked' : '',$text{'acl_uedit_sec'}; -printf " $text{'acl_uedit_re'}\n", - $o->{'uedit_mode'} == 7 ? "checked" : ""; -printf " %s
\n", - $o->{'uedit_mode'} == 7 ? $o->{'uedit_re'} : ""; -print " \n"; +print &ui_table_row($text{'acl_uedit'}, + &ui_radio_table("uedit_mode", + defined($o->{'uedit_mode'}) ? $o->{'uedit_mode'} : 0, + [ [ 0, $text{'acl_uedit_all'} ], + [ 1, $text{'acl_uedit_none'} ], + [ 6, $text{'acl_uedit_this'} ], + [ 2, $text{'acl_uedit_only'}, + &ui_textbox("uedit_can", + $o->{'uedit_mode'} == 2 ? $o->{'uedit'} : "", 40). + " ".&user_chooser_button("uedit_can", 1) ], + [ 3, $text{'acl_uedit_except'}, + &ui_textbox("uedit_cannot", + $o->{'uedit_mode'} == 3 ? $o->{'uedit'} : "", 40). + " ".&user_chooser_button("uedit_cannot", 1) ], + [ 4, $text{'acl_uedit_uid'}, + &ui_textbox("uedit_uid", + $o->{'uedit_mode'} == 4 ? $o->{'uedit'} : "", 6). + " - ".&ui_textbox("uedit_uid2", + $o->{'uedit_mode'} == 4 ? $o->{'uedit2'} : "", 6) ], + [ 5, $text{'acl_uedit_group'}, + &ui_textbox("uedit_group", $uedit_group, 40)." ". + &group_chooser_button("uedit_group", 1)."
\n". + &ui_checkbox("uedit_sec", 1, $text{'acl_uedit_sec'}, + $o->{'uedit_sec'}) ], + [ 7, $text{'acl_uedit_re'}, + &ui_textbox("uedit_re", + $o->{'uedit_mode'} == 7 ? $o->{'uedit_re'} : "", 40) ] ], 1), + 3); -print " $text{'acl_ucreate'} \n"; -printf " $text{'yes'}\n", - $o->{'ucreate'} ? "checked" : ""; -printf " $text{'no'} \n", - $o->{'ucreate'} ? "" : "checked"; +print &ui_table_row($text{'acl_ucreate'}, + &ui_yesno_radio("ucreate", $o->{'ucreate'})); +print &ui_table_row($text{'acl_batch'}, + &ui_yesno_radio("batch", $o->{'batch'})); -print " $text{'acl_batch'} \n"; -printf " $text{'yes'}\n", - $o->{'batch'} ? "checked" : ""; -printf " $text{'no'} \n", - $o->{'batch'} ? "" : "checked"; +print &ui_table_row($text{'acl_export'}, + &ui_radio("export", defined($o->{'export'}) ? $o->{'export'} : 0, + [ [ 2, $text{'yes'} ], + [ 1, $text{'acl_export1'} ], + [ 0, $text{'no'} ] ]), + 3); -print " $text{'acl_export'} \n"; -printf " $text{'yes'}\n", - $o->{'export'} == 2 ? "checked" : ""; -printf " $text{'acl_export1'}\n", - $o->{'export'} == 1 ? "checked" : ""; -printf " $text{'no'} \n", - $o->{'export'} == 0 ? "checked" : ""; - -print " $text{'acl_uid'}\n"; -print " -\n"; -print "
\n"; -printf " %s
\n", - $o->{'autouid'} ? "checked" : "", $text{'acl_autouid'}; -printf " %s
\n", - $o->{'calcuid'} ? "checked" : "", $text{'acl_calcuid'}; -printf " %s
\n", - $o->{'useruid'} ? "checked" : "", $text{'acl_useruid'}; -printf " %s
\n", - $o->{'umultiple'} ? "checked" : "", $text{'acl_umultiple'}; -printf " %s \n", - $o->{'uuid'} ? "checked" : "", $text{'acl_uuid'}; +print &ui_table_row($text{'acl_uid'}, + &ui_textbox("lowuid", $o->{'lowuid'}, 6)." - ". + &ui_textbox("hiuid", $o->{'hiuid'}, 6)."
\n". + join("
", map { &ui_checkbox($_, 1, $text{'acl_'.$_}, $o->{$_}) } + ('autouid', 'calcuid', 'useruid', 'umultiple', 'uuid')), + 3); local $uedit_gmode = defined($o->{'uedit_gmode'}) ? $o->{'uedit_gmode'} : $o->{'ugroups'} eq '*' ? 0 : 2; -print " $text{'acl_ugroups'} \n"; -printf " $text{'acl_gedit_all'}
\n", - $uedit_gmode == 0 ? "checked" : ""; -printf " $text{'acl_gedit_only'}\n", - $uedit_gmode == 2 ? "checked" : ""; -printf " %s
\n", - $uedit_gmode == 2 ? $o->{'ugroups'} : "", - &group_chooser_button("uedit_gcan", 1); -printf " $text{'acl_gedit_except'}\n", - $uedit_gmode == 3 ? "checked" : ""; -printf " %s
\n", - $uedit_gmode == 3 ? $o->{'ugroups'} : "", - &group_chooser_button("uedit_gcannot", 1); -printf " $text{'acl_gedit_gid'}\n", - $uedit_gmode == 4 ? "checked" : ""; -printf " -\n", - $uedit_gmode == 4 ? $o->{'ugroups'} : ""; -printf " \n", - $uedit_gmode == 4 ? $o->{'ugroups2'} : ""; -print " $text{'acl_shells'} \n"; -printf " $text{'acl_any'}\n", - $o->{'shells'} eq "*" ? "checked" : ""; -printf " $text{'acl_listed'}
\n", - $o->{'shells'} eq "*" ? "" : "checked"; -print " \n"; +print &ui_table_row($text{'acl_ugroups'}, + &ui_radio_table("uedit_gmode", $uedit_gmode, + [ [ 0, $text{'acl_gedit_all'} ], + [ 2, $text{'acl_gedit_only'}, + &ui_textbox("uedit_gcan", + $uedit_gmode == 2 ? $o->{'ugroups'} : "", 40). + " ".&group_chooser_button("uedit_gcan", 1) ], + [ 3, $text{'acl_gedit_except'}, + &ui_textbox("uedit_gcannot", + $uedit_gmode == 3 ? $o->{'ugroups'} : "", 40). + " ".&group_chooser_button("uedit_gcannot", 1) ], + [ 4, $text{'acl_gedit_gid'}, + &ui_textbox("uedit_gid", + $uedit_gmode == 4 ? $o->{'ugroups'} : "", 6). + " - ".&ui_textbox("uedit_gid2", + $uedit_gmode == 4 ? $o->{'ugroups2'} : "", 6) ] ], 1), + 3); -print " $text{'acl_epeopt'} \n"; -printf " $text{'yes'}\n", - $o->{'peopt'} ? "checked" : ""; -printf " $text{'no'} \n", - $o->{'peopt'} ? "" : "checked"; +print &ui_table_row($text{'acl_shells'}, + &ui_radio_table("shells_def", $o->{'shells'} eq "*" ? 1 : 0, + [ [ 1, $text{'acl_any'} ], + [ 0, $text{'acl_listed'}, + &ui_textarea("shells", + $o->{'shells'} eq "*" ? "" : + join("\n", split(/\s+/, $o->{'shells'} || "")), + 3, 40) ] ], 1), + 3); -print " $text{'acl_home'}\n"; -printf " %s
\n", - $o->{'home'}, &file_chooser_button("home", 1); -printf " %s \n", - $o->{'autohome'} ? "checked" : "", - $text{'acl_autohome'}; +print &ui_table_row($text{'acl_epeopt'}, + &ui_yesno_radio("peopt", $o->{'peopt'})); -print " $text{'acl_udelete'} \n"; -printf " $text{'yes'}\n", - $o->{'udelete'} ? "checked" : ""; -printf " $text{'no'} \n", - $o->{'udelete'} ? "" : "checked"; +print &ui_table_row($text{'acl_home'}, + &ui_textbox("home", $o->{'home'}, 40)." ". + &file_chooser_button("home", 1)."
\n". + &ui_checkbox("autohome", 1, $text{'acl_autohome'}, $o->{'autohome'}), + 3); -print " $text{'acl_urename'} \n"; -printf " $text{'yes'}\n", - $o->{'urename'} ? "checked" : ""; -printf " $text{'no'} \n", - $o->{'urename'} ? "" : "checked"; +print &ui_table_row($text{'acl_udelete'}, + &ui_yesno_radio("udelete", $o->{'udelete'})); +print &ui_table_row($text{'acl_urename'}, + &ui_yesno_radio("urename", $o->{'urename'})); -print " $text{'acl_delhome'}\n"; -print "",&ui_radio("delhome", $o->{'delhome'}, - [ [ 2, $text{'acl_option'} ], - [ 1, $text{'acl_always'} ], - [ 0, $text{'acl_never'} ] ])," \n"; +print &ui_table_row($text{'acl_delhome'}, + &ui_radio("delhome", $o->{'delhome'}, + [ [ 2, $text{'acl_option'} ], + [ 1, $text{'acl_always'} ], + [ 0, $text{'acl_never'} ] ]), + 3); -# 0 = always on, 1 = can edit, 2 = always off -print " $text{'acl_saveopts'} ", - "\n"; -foreach $opt ('chuid', 'chgid', 'movehome', 'mothers', - 'makehome', 'copy', 'cothers', 'dothers') { - print "\n"; - printf "\n", - $o->{$opt} == 2 ? "checked" : "", $text{'acl_off'}; +print &ui_table_span($text{'acl_saveopts'}); +foreach my $opt ('chuid', 'chgid', 'movehome', 'mothers', + 'makehome', 'copy', 'cothers', 'dothers') { + print &ui_table_row($text{"uedit_$opt"}, + &ui_radio($opt, defined($o->{$opt}) ? $o->{$opt} : 0, + [ [ 1, $text{'acl_canedit'} ], + [ 0, $text{'acl_on'} ], + [ 2, $text{'acl_off'} ] ]), + 3); } -print "
",$text{"uedit_$opt"}," %s\n", - $o->{$opt} == 1 ? "checked" : "", $text{'acl_canedit'}; - printf " %s\n", - $o->{$opt} == 0 ? "checked" : "", $text{'acl_on'}; - printf " %s
\n"; -print "
\n"; +print &ui_table_hr(); -print " $text{'acl_gedit'} \n"; -printf " $text{'acl_gedit_all'}  \n", - $o->{'gedit_mode'} == 0 ? "checked" : ""; -printf " $text{'acl_gedit_none'}
\n", - $o->{'gedit_mode'} == 1 ? "checked" : ""; -printf " $text{'acl_gedit_only'}\n", - $o->{'gedit_mode'} == 2 ? "checked" : ""; -printf " %s
\n", - $o->{'gedit_mode'} == 2 ? $o->{'gedit'} : "", - &group_chooser_button("gedit_can", 1); -printf " $text{'acl_gedit_except'}\n", - $o->{'gedit_mode'} == 3 ? "checked" : ""; -printf " %s
\n", - $o->{'gedit_mode'} == 3 ? $o->{'gedit'} : "", - &group_chooser_button("gedit_cannot", 1); -printf " $text{'acl_gedit_gid'}\n", - $o->{'gedit_mode'} == 4 ? "checked" : ""; -printf " -\n", - $o->{'gedit_mode'} == 4 ? $o->{'gedit'} : ""; -printf " \n", - $o->{'gedit_mode'} == 4 ? $o->{'gedit2'} : ""; +print &ui_table_row($text{'acl_gedit'}, + &ui_radio_table("gedit_mode", + defined($o->{'gedit_mode'}) ? $o->{'gedit_mode'} : 0, + [ [ 0, $text{'acl_gedit_all'} ], + [ 1, $text{'acl_gedit_none'} ], + [ 2, $text{'acl_gedit_only'}, + &ui_textbox("gedit_can", + $o->{'gedit_mode'} == 2 ? $o->{'gedit'} : "", 40). + " ".&group_chooser_button("gedit_can", 1) ], + [ 3, $text{'acl_gedit_except'}, + &ui_textbox("gedit_cannot", + $o->{'gedit_mode'} == 3 ? $o->{'gedit'} : "", 40). + " ".&group_chooser_button("gedit_cannot", 1) ], + [ 4, $text{'acl_gedit_gid'}, + &ui_textbox("gedit_gid", + $o->{'gedit_mode'} == 4 ? $o->{'gedit'} : "", 6). + " - ".&ui_textbox("gedit_gid2", + $o->{'gedit_mode'} == 4 ? $o->{'gedit2'} : "", 6) ] ], 1), + 3); -print " $text{'acl_gcreate'} \n"; -printf " $text{'yes'}\n", - $o->{'gcreate'}==1 ? "checked" : ""; -printf " $text{'acl_gnew'}\n", - $o->{'gcreate'}==2 ? "checked" : ""; -printf " $text{'no'} \n", - $o->{'gcreate'}==0 ? "checked" : ""; +print &ui_table_row($text{'acl_gcreate'}, + &ui_radio("gcreate", defined($o->{'gcreate'}) ? $o->{'gcreate'} : 0, + [ [ 1, $text{'yes'} ], + [ 2, $text{'acl_gnew'} ], + [ 0, $text{'no'} ] ]), + 3); -print " $text{'acl_gid'}\n"; -print " -\n"; -print "
\n"; -printf " %s
\n", - $o->{'autogid'} ? "checked" : "", $text{'acl_autogid'}; -printf " %s
\n", - $o->{'calcgid'} ? "checked" : "", $text{'acl_calcgid'}; -printf " %s
\n", - $o->{'usergid'} ? "checked" : "", $text{'acl_usergid'}; -printf " %s
\n", - $o->{'gmultiple'} ? "checked" : "", $text{'acl_gmultiple'}; -printf " %s \n", - $o->{'ggid'} ? "checked" : "", $text{'acl_ggid'}; +print &ui_table_row($text{'acl_gid'}, + &ui_textbox("lowgid", $o->{'lowgid'}, 6)." - ". + &ui_textbox("higid", $o->{'higid'}, 6)."
\n". + join("
", map { &ui_checkbox($_, 1, $text{'acl_'.$_}, $o->{$_}) } + ('autogid', 'calcgid', 'usergid', 'gmultiple', 'ggid')), + 3); -print " $text{'acl_gdelete'} \n"; -printf " $text{'yes'}\n", - $o->{'gdelete'} ? "checked" : ""; -printf " $text{'no'} \n", - $o->{'gdelete'} ? "" : "checked"; +print &ui_table_row($text{'acl_gdelete'}, + &ui_yesno_radio("gdelete", $o->{'gdelete'})); +print &ui_table_row($text{'acl_grename'}, + &ui_yesno_radio("grename", $o->{'grename'})); -print " $text{'acl_grename'} \n"; -printf " $text{'yes'}\n", - $o->{'grename'} ? "checked" : ""; -printf " $text{'no'} \n", - $o->{'grename'} ? "" : "checked"; +print &ui_table_hr(); -print "
\n"; - -print "$text{'acl_logins'} \n"; -printf " $text{'acl_lnone'}
\n", - $o->{'logins'} ? "" : "checked"; -printf " $text{'acl_lall'}
\n", - $o->{'logins'} eq "*" ? "checked" : ""; -printf "\n", - $o->{'logins'} =~ /[^\*]/ ? "checked" : ""; -printf " %s \n", - $o->{'logins'} =~ /[^\*]/ ? $o->{'logins'} : "", - &user_chooser_button("logins", 1); +my $logins_mode = !$o->{'logins'} ? 0 : $o->{'logins'} eq "*" ? 1 : 2; +print &ui_table_row($text{'acl_logins'}, + &ui_radio_table("logins_mode", $logins_mode, + [ [ 0, $text{'acl_lnone'} ], + [ 1, $text{'acl_lall'} ], + [ 2, "", + &ui_textbox("logins", + $logins_mode == 2 ? $o->{'logins'} : "", 40)." ". + &user_chooser_button("logins", 1) ] ], 1), + 3); } # acl_security_save(&options)