[augeas-devel] augeas: master - Vsftpd: several fixes

David Lutterkort lutter at fedoraproject.org
Wed Apr 1 17:39:49 UTC 2009


Gitweb:        http://git.fedorahosted.org/git/augeas.git?p=augeas.git;a=commitdiff;h=ae9dd65582997b0c8e2d060180047db109897660
Commit:        ae9dd65582997b0c8e2d060180047db109897660
Parent:        f6122be6d2b0ab41b2c8cc7a9c5fb247ee9badb3
Author:        Marc Fournier <marc.fournier at camptocamp.com>
AuthorDate:    Wed Apr 1 10:38:46 2009 -0700
Committer:     David Lutterkort <lutter at redhat.com>
CommitterDate: Wed Apr 1 10:38:46 2009 -0700

Vsftpd: several fixes

* map comments as #comment
* handle empty lines
* find vsftpd.conf on Fedora/RHEL
---
 lenses/tests/test_vsftpd.aug |   52 ++++++++++++++++++++++++++++++++++++++++++
 lenses/vsftpd.aug            |    8 ++++--
 2 files changed, 57 insertions(+), 3 deletions(-)

diff --git a/lenses/tests/test_vsftpd.aug b/lenses/tests/test_vsftpd.aug
index 2b74bc0..df28d35 100644
--- a/lenses/tests/test_vsftpd.aug
+++ b/lenses/tests/test_vsftpd.aug
@@ -16,5 +16,57 @@ test Vsftpd.lns get "ftp_username=ftp_user\n" = { "ftp_username" = "ftp_user" }
 test Vsftpd.lns get "anon_root = /var/lib/vsftpd/anon" = *
 
 
+let conf = "# Example config file /etc/vsftpd/vsftpd.conf
+#
+# The default compiled in settings are fairly paranoid. This sample file
+# loosens things up a bit, to make the ftp daemon more usable.
+# Please see vsftpd.conf.5 for all compiled in defaults.
+#
+# Allow anonymous FTP? (Beware - allowed by default if you comment this out).
+anonymous_enable=YES
+#
+# Default umask for local users is 077. You may wish to change this to 022,
+# if your users expect that (022 is used by most other ftpd's)
+local_umask=022
+#
+# You may specify an explicit list of local users to chroot() to their home
+# directory. If chroot_local_user is YES, then this list becomes a list of
+# users to NOT chroot().
+chroot_list_enable=YES
+# (default follows)
+chroot_list_file=/etc/vsftpd/chroot_list
+#
 
+pam_service_name=vsftpd
+userlist_enable=YES
+tcp_wrappers=YES
+
+"
+
+test Vsftpd.lns get conf =
+  { "#comment" = "Example config file /etc/vsftpd/vsftpd.conf" }
+  {}
+  { "#comment" = "The default compiled in settings are fairly paranoid. This sample file" }
+  { "#comment" = "loosens things up a bit, to make the ftp daemon more usable." }
+  { "#comment" = "Please see vsftpd.conf.5 for all compiled in defaults." }
+  {}
+  { "#comment" = "Allow anonymous FTP? (Beware - allowed by default if you comment this out)." }
+  { "anonymous_enable" = "YES" }
+  {}
+  { "#comment" = "Default umask for local users is 077. You may wish to change this to 022," }
+  { "#comment" = "if your users expect that (022 is used by most other ftpd's)" }
+  { "local_umask" = "022" }
+  {}
+  { "#comment" = "You may specify an explicit list of local users to chroot() to their home" }
+  { "#comment" = "directory. If chroot_local_user is YES, then this list becomes a list of" }
+  { "#comment" = "users to NOT chroot()." }
+  { "chroot_list_enable" = "YES" }
+  { "#comment" = "(default follows)" }
+  { "chroot_list_file" = "/etc/vsftpd/chroot_list" }
+  {}
+  {}
+  { "pam_service_name" = "vsftpd" }
+  { "userlist_enable" = "YES" }
+  { "tcp_wrappers" = "YES" }
+  {}
 
diff --git a/lenses/vsftpd.aug b/lenses/vsftpd.aug
index e2acbe9..f95bdd0 100644
--- a/lenses/vsftpd.aug
+++ b/lenses/vsftpd.aug
@@ -5,6 +5,8 @@ module Vsftpd =
 (* The code in parseconf.c does not seem to allow for trailing whitespace *)
 (* in the config file                                                     *)
 let eol = Util.del_str "\n"
+let empty = Util.empty
+let comment = Util.comment
 
 let bool_option_re = /anonymous_enable|local_enable|pasv_enable|port_enable|chroot_local_user|write_enable|anon_upload_enable|anon_mkdir_write_enable|anon_other_write_enable|chown_uploads|connect_from_port_20|xferlog_enable|dirmessage_enable|anon_world_readable_only|async_abor_enable|ascii_upload_enable|ascii_download_enable|one_process_model|xferlog_std_format|pasv_promiscuous|deny_email_enable|chroot_list_enable|setproctitle_enable|text_userdb_names|ls_recurse_enable|log_ftp_protocol|guest_enable|userlist_enable|userlist_deny|use_localtime|check_shell|hide_ids|listen|port_promiscuous|passwd_chroot_enable|no_anon_password|tcp_wrappers|use_sendfile|force_dot_files|listen_ipv6|dual_log_enable|syslog_enable|background|virtual_use_local_privs|session_support|download_enable|dirlist_enable|chmod_enable|secure_email_list_enable|run_as_launching_user|no_log_lock|ssl_enable|allow_anon_ssl|force_local_logins_ssl|force_local_data_ssl|ssl_sslv2|ssl_sslv3|ssl_tlsv1|tilde_user_enable|fo
 rce_anon_logins_ssl|force_anon_data_ssl|mdtm_write|lock_upload_files|pasv_addr_resolve|debug_ssl|require_cert|validate_cert/
 
@@ -22,8 +24,8 @@ let str_option = option str_option_re /[^\n]+/
 
 let uint_option = option uint_option_re /[0-9]+/
 
-let comment = [ del /#.*\n/ "#\n" ]
+let lns = (bool_option|str_option|uint_option|comment|empty)*
 
-let lns = (bool_option|str_option|uint_option|comment)*
+let filter = (incl "/etc/vsftpd.conf") . (incl "/etc/vsftpd/vsftpd.conf")
 
-let xfm = transform lns (incl "/etc/vsftpd.conf")
+let xfm = transform lns filter




More information about the augeas-devel mailing list