diff options
author | Garming Sam <garming@catalyst.net.nz> | 2014-01-14 17:53:49 +1300 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2014-02-12 13:17:13 +1300 |
commit | aea623e050530ad79c47e590373ad8241eb3914d (patch) | |
tree | ba04d7a711b70085ea9e33c1ca5585e65741157a | |
parent | a7d4185bb8cf7d4d71c07b9f1fdb42d948aa22c0 (diff) | |
download | samba-aea623e050530ad79c47e590373ad8241eb3914d.tar.gz samba-aea623e050530ad79c47e590373ad8241eb3914d.tar.xz samba-aea623e050530ad79c47e590373ad8241eb3914d.zip |
param: auto generate param_functions.c at build time
generate_param.py reads the documentation to define which functions need to
be generated.
To add new parameters, edit the xml files in docs-xml/smbdotconf.
Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
-rw-r--r-- | lib/param/README | 4 | ||||
-rw-r--r-- | lib/param/loadparm.c | 4 | ||||
-rw-r--r-- | lib/param/param_functions.c | 416 | ||||
-rw-r--r-- | lib/param/wscript_build | 10 | ||||
-rw-r--r-- | script/generate_param.py | 113 | ||||
-rw-r--r-- | source3/param/loadparm.c | 4 |
6 files changed, 131 insertions, 420 deletions
diff --git a/lib/param/README b/lib/param/README index b567d713e1..e0b590a44d 100644 --- a/lib/param/README +++ b/lib/param/README @@ -11,8 +11,8 @@ Adding a parameter ------------------ To add or change an smb.conf option, you only have to modify -lib/param/param_table.c and lib/param/param_functions.c. The rest is -generated for you. +lib/param/param_table.c and add the documentation to docs-xml/smbdotconf. +The rest is generated for you. Using smb.conf parameters in the code diff --git a/lib/param/loadparm.c b/lib/param/loadparm.c index d3bd85c013..fedabad775 100644 --- a/lib/param/loadparm.c +++ b/lib/param/loadparm.c @@ -324,6 +324,10 @@ FN_GLOBAL_BOOL(writeraw, bWriteRaw) FN_GLOBAL_CONST_STRING(cachedir, szCacheDir) FN_GLOBAL_CONST_STRING(statedir, szStateDir) +/* These functions cannot be auto-generated */ +FN_LOCAL_BOOL(autoloaded, autoloaded) +FN_GLOBAL_CONST_STRING(dnsdomain, dnsdomain) + /* local prototypes */ static struct loadparm_service *getservicebyname(struct loadparm_context *lp_ctx, const char *pszServiceName); diff --git a/lib/param/param_functions.c b/lib/param/param_functions.c deleted file mode 100644 index 5c941143c6..0000000000 --- a/lib/param/param_functions.c +++ /dev/null @@ -1,416 +0,0 @@ -/* - Unix SMB/CIFS implementation. - Parameter loading functions - Copyright (C) Karl Auer 1993-1998 - - Largely re-written by Andrew Tridgell, September 1994 - - Copyright (C) Simo Sorce 2001 - Copyright (C) Alexander Bokovoy 2002 - Copyright (C) Stefan (metze) Metzmacher 2002 - Copyright (C) Jim McDonough <jmcd@us.ibm.com> 2003 - Copyright (C) Michael Adam 2008 - Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2007 - Copyright (C) Andrew Bartlett 2011 - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ - -FN_LOCAL_STRING(path, path) -FN_LOCAL_LIST(hosts_allow, hosts_allow) -FN_LOCAL_LIST(hosts_deny, hosts_deny) -FN_LOCAL_STRING(fstype, fstype) -FN_LOCAL_LIST(ntvfs_handler, ntvfs_handler) -FN_LOCAL_BOOL(msdfs_root, msdfs_root) -FN_LOCAL_BOOL(browseable, browseable) -FN_LOCAL_BOOL(read_only, read_only) -FN_LOCAL_BOOL(printable, printable) -FN_LOCAL_BOOL(map_hidden, map_hidden) -FN_LOCAL_BOOL(map_archive, map_archive) -FN_LOCAL_BOOL(oplocks, oplocks) -FN_LOCAL_BOOL(strict_sync, strict_sync) -FN_LOCAL_BOOL(map_system, map_system) -FN_LOCAL_INTEGER(max_connections, max_connections) -FN_LOCAL_INTEGER(csc_policy, csc_policy) -FN_LOCAL_INTEGER(create_mask, create_mask) -FN_LOCAL_INTEGER(force_create_mode, force_create_mode) -FN_LOCAL_INTEGER(directory_mask, directory_mask) -FN_LOCAL_INTEGER(force_directory_mode, force_directory_mode) -FN_LOCAL_STRING(preexec, preexec) -FN_LOCAL_STRING(postexec, postexec) -FN_LOCAL_STRING(root_preexec, root_preexec) -FN_LOCAL_STRING(root_postexec, root_postexec) -FN_LOCAL_STRING(dont_descend, dont_descend) -FN_LOCAL_STRING(username, username) -FN_LOCAL_LIST(invalid_users, invalid_users) -FN_LOCAL_LIST(valid_users, valid_users) -FN_LOCAL_LIST(admin_users, admin_users) -FN_LOCAL_STRING(print_command, print_command) -FN_LOCAL_STRING(lpq_command, lpq_command) -FN_LOCAL_STRING(lprm_command, lprm_command) -FN_LOCAL_STRING(lppause_command, lppause_command) -FN_LOCAL_STRING(lpresume_command, lpresume_command) -FN_LOCAL_STRING(queuepause_command, queuepause_command) -FN_LOCAL_STRING(queueresume_command, queueresume_command) -FN_LOCAL_STRING(_printername, _printername) -FN_LOCAL_CONST_STRING(printjob_username, printjob_username) -FN_LOCAL_STRING(magic_script, magic_script) -FN_LOCAL_STRING(magic_output, magic_output) -FN_LOCAL_STRING(comment, comment) -FN_LOCAL_STRING(force_user, force_user) -FN_LOCAL_STRING(force_group, force_group) -FN_LOCAL_LIST(read_list, read_list) -FN_LOCAL_LIST(write_list, write_list) -FN_LOCAL_LIST(vfs_objects, vfs_objects) -FN_LOCAL_STRING(msdfs_proxy, msdfs_proxy) -FN_LOCAL_STRING(volume, volume) -FN_LOCAL_STRING(veto_files, veto_files) -FN_LOCAL_STRING(hide_files, hide_files) -FN_LOCAL_STRING(veto_oplock_files, veto_oplock_files) -FN_LOCAL_STRING(aio_write_behind, aio_write_behind) -FN_LOCAL_STRING(dfree_command, dfree_command) -FN_LOCAL_BOOL(autoloaded, autoloaded) -FN_LOCAL_BOOL(preexec_close, preexec_close) -FN_LOCAL_BOOL(root_preexec_close, root_preexec_close) -FN_LOCAL_INTEGER(case_sensitive, case_sensitive) -FN_LOCAL_BOOL(preserve_case, preserve_case) -FN_LOCAL_BOOL(short_preserve_case, short_preserve_case) -FN_LOCAL_BOOL(hide_dot_files, hide_dot_files) -FN_LOCAL_BOOL(hide_special_files, hide_special_files) -FN_LOCAL_BOOL(hide_unreadable, hide_unreadable) -FN_LOCAL_BOOL(hide_unwriteable_files, hide_unwriteable_files) -FN_LOCAL_BOOL(access_based_share_enum, access_based_share_enum) -FN_LOCAL_BOOL(guest_ok, guest_ok) -FN_LOCAL_BOOL(guest_only, guest_only) -FN_LOCAL_BOOL(administrative_share, administrative_share) -FN_LOCAL_BOOL(print_notify_backchannel, print_notify_backchannel) -FN_LOCAL_BOOL(store_dos_attributes, store_dos_attributes) -FN_LOCAL_BOOL(dmapi_support, dmapi_support) -FN_LOCAL_PARM_BOOL(locking, locking) -FN_LOCAL_PARM_INTEGER(strict_locking, strict_locking) -FN_LOCAL_PARM_BOOL(posix_locking, posix_locking) -FN_LOCAL_BOOL(kernel_oplocks, kernel_oplocks) -FN_LOCAL_BOOL(level2_oplocks, level2_oplocks) -FN_LOCAL_BOOL(kernel_share_modes, kernel_share_modes) -FN_LOCAL_BOOL(only_user, only_user) -FN_LOCAL_PARM_BOOL(mangled_names, mangled_names) -FN_LOCAL_BOOL(follow_symlinks, follow_symlinks) -FN_LOCAL_BOOL(sync_always, sync_always) -FN_LOCAL_BOOL(strict_allocate, strict_allocate) -FN_LOCAL_BOOL(delete_readonly, delete_readonly) -FN_LOCAL_BOOL(fake_oplocks, fake_oplocks) -FN_LOCAL_BOOL(delete_veto_files, delete_veto_files) -FN_LOCAL_BOOL(dos_filemode, dos_filemode) -FN_LOCAL_BOOL(dos_filetimes, dos_filetimes) -FN_LOCAL_BOOL(dos_filetime_resolution, dos_filetime_resolution) -FN_LOCAL_BOOL(fake_directory_create_times, fake_directory_create_times) -FN_LOCAL_BOOL(blocking_locks, blocking_locks) -FN_LOCAL_BOOL(inherit_permissions, inherit_permissions) -FN_LOCAL_BOOL(inherit_acls, inherit_acls) -FN_LOCAL_BOOL(inherit_owner, inherit_owner) -FN_LOCAL_BOOL(use_client_driver, use_client_driver) -FN_LOCAL_BOOL(default_devmode, default_devmode) -FN_LOCAL_BOOL(force_printername, force_printername) -FN_LOCAL_BOOL(nt_acl_support, nt_acl_support) -FN_LOCAL_BOOL(force_unknown_acl_user, force_unknown_acl_user) -FN_LOCAL_BOOL(ea_support, ea_support) -FN_LOCAL_BOOL(_use_sendfile, _use_sendfile) -FN_LOCAL_BOOL(profile_acls, profile_acls) -FN_LOCAL_BOOL(map_acl_inherit, map_acl_inherit) -FN_LOCAL_BOOL(afs_share, afs_share) -FN_LOCAL_BOOL(acl_check_permissions, acl_check_permissions) -FN_LOCAL_BOOL(acl_group_control, acl_group_control) -FN_LOCAL_BOOL(acl_map_full_control, acl_map_full_control) -FN_LOCAL_BOOL(acl_allow_execute_always, acl_allow_execute_always) -FN_LOCAL_INTEGER(default_case, default_case) -FN_LOCAL_INTEGER(min_print_space, min_print_space) -FN_LOCAL_INTEGER(printing, printing) -FN_LOCAL_INTEGER(max_reported_print_jobs, max_reported_print_jobs) -FN_LOCAL_INTEGER(oplock_contention_limit, oplock_contention_limit) -FN_LOCAL_INTEGER(write_cache_size, write_cache_size) -FN_LOCAL_INTEGER(block_size, block_size) -FN_LOCAL_INTEGER(dfree_cache_time, dfree_cache_time) -FN_LOCAL_INTEGER(allocation_roundup_size, allocation_roundup_size) -FN_LOCAL_INTEGER(aio_read_size, aio_read_size) -FN_LOCAL_INTEGER(aio_write_size, aio_write_size) -FN_LOCAL_INTEGER(map_readonly, map_readonly) -FN_LOCAL_INTEGER(directory_name_cache_size, directory_name_cache_size) -FN_LOCAL_INTEGER(smb_encrypt, smb_encrypt) -FN_LOCAL_PARM_CHAR(mangling_char, mangling_char) -FN_LOCAL_STRING(cups_options, cups_options) -FN_LOCAL_PARM_BOOL(change_notify, change_notify) -FN_LOCAL_PARM_BOOL(kernel_change_notify, kernel_change_notify) -FN_LOCAL_BOOL(durable_handles, durable_handles) - -FN_GLOBAL_BOOL(allow_insecure_wide_links, allow_insecure_wide_links) -FN_GLOBAL_BOOL(allow_nt4_crypto, allow_nt4_crypto) -FN_GLOBAL_BOOL(allow_trusted_domains, allow_trusted_domains) -FN_GLOBAL_BOOL(async_smb_echo_handler, async_smb_echo_handler) -FN_GLOBAL_BOOL(bind_interfaces_only, bind_interfaces_only) -FN_GLOBAL_BOOL(browse_list, browse_list) -FN_GLOBAL_BOOL(client_lanman_auth, client_lanman_auth) -FN_GLOBAL_BOOL(client_ntlmv2_auth, client_ntlmv2_auth) -FN_GLOBAL_BOOL(client_plaintext_auth, client_plaintext_auth) -FN_GLOBAL_BOOL(client_use_spnego, client_use_spnego) -FN_GLOBAL_BOOL(client_use_spnego_principal, client_use_spnego_principal) -FN_GLOBAL_BOOL(clustering, clustering) -FN_GLOBAL_BOOL(create_krb5_conf, create_krb5_conf) -FN_GLOBAL_BOOL(debug_class, debug_class) -FN_GLOBAL_BOOL(debug_hires_timestamp, debug_hires_timestamp) -FN_GLOBAL_BOOL(debug_pid, debug_pid) -FN_GLOBAL_BOOL(debug_prefix_timestamp, debug_prefix_timestamp) -FN_GLOBAL_BOOL(debug_uid, debug_uid) -FN_GLOBAL_BOOL(defer_sharing_violations, defer_sharing_violations) -FN_GLOBAL_BOOL(disable_netbios, disable_netbios) -FN_GLOBAL_BOOL(_disable_spoolss, _disable_spoolss) -FN_GLOBAL_BOOL(_domain_logons, _domain_logons) -FN_GLOBAL_BOOL(enable_asu_support, enable_asu_support) -FN_GLOBAL_BOOL(enable_core_files, enable_core_files) -FN_GLOBAL_BOOL(enable_privileges, enable_privileges) -FN_GLOBAL_BOOL(encrypt_passwords, encrypt_passwords) -FN_GLOBAL_BOOL(enhanced_browsing, enhanced_browsing) -FN_GLOBAL_BOOL(getwd_cache, getwd_cache) -FN_GLOBAL_BOOL(host_msdfs, host_msdfs) -FN_GLOBAL_BOOL(hostname_lookups, hostname_lookups) -FN_GLOBAL_BOOL(lanman_auth, lanman_auth) -FN_GLOBAL_BOOL(large_readwrite, large_readwrite) -FN_GLOBAL_BOOL(ldap_delete_dn, ldap_delete_dn) -FN_GLOBAL_BOOL(ldap_ssl_ads, ldap_ssl_ads) -FN_GLOBAL_BOOL(load_printers, load_printers) -FN_GLOBAL_BOOL(local_master, local_master) -FN_GLOBAL_BOOL(log_writeable_files_on_exit, log_writeable_files_on_exit) -FN_GLOBAL_BOOL(map_untrusted_to_domain, map_untrusted_to_domain) -FN_GLOBAL_BOOL(show_add_printer_wizard, show_add_printer_wizard) -FN_GLOBAL_BOOL(multicast_dns_register, multicast_dns_register) -FN_GLOBAL_BOOL(neutralize_nt4_emulation, neutralize_nt4_emulation) -FN_GLOBAL_BOOL(nis_homedir, nis_homedir) -FN_GLOBAL_BOOL(nmbd_bind_explicit_broadcast, nmbd_bind_explicit_broadcast) -FN_GLOBAL_BOOL(ntlm_auth, ntlm_auth) -FN_GLOBAL_BOOL(nt_pipe_support, nt_pipe_support) -FN_GLOBAL_BOOL(nt_status_support, nt_status_support) -FN_GLOBAL_BOOL(null_passwords, null_passwords) -FN_GLOBAL_BOOL(obey_pam_restrictions, obey_pam_restrictions) -FN_GLOBAL_BOOL(pam_password_change, pam_password_change) -FN_GLOBAL_BOOL(passdb_expand_explicit, passdb_expand_explicit) -FN_GLOBAL_BOOL(passwd_chat_debug, passwd_chat_debug) -FN_GLOBAL_BOOL(registry_shares, registry_shares) -FN_GLOBAL_BOOL(reject_md5_clients, reject_md5_clients) -FN_GLOBAL_BOOL(reject_md5_servers, reject_md5_servers) -FN_GLOBAL_BOOL(require_strong_key, require_strong_key) -FN_GLOBAL_BOOL(reset_on_zero_vc, reset_on_zero_vc) -FN_GLOBAL_BOOL(rpc_big_endian, rpc_big_endian) -FN_GLOBAL_BOOL(stat_cache, stat_cache) -FN_GLOBAL_BOOL(syslog_only, syslog_only) -FN_GLOBAL_BOOL(timestamp_logs, timestamp_logs) -FN_GLOBAL_BOOL(time_server, time_server) -FN_GLOBAL_BOOL(tls_enabled, tls_enabled) -FN_GLOBAL_BOOL(unicode, unicode) -FN_GLOBAL_BOOL(unix_extensions, unix_extensions) -FN_GLOBAL_BOOL(unix_password_sync, unix_password_sync) -FN_GLOBAL_BOOL(use_mmap, use_mmap) -FN_GLOBAL_BOOL(use_ntdb, use_ntdb) -FN_GLOBAL_BOOL(usershare_allow_guests, usershare_allow_guests) -FN_GLOBAL_BOOL(usershare_owner_only, usershare_owner_only) -FN_GLOBAL_BOOL(use_spnego, use_spnego) -FN_GLOBAL_BOOL(utmp, utmp) -FN_GLOBAL_BOOL(we_are_a_wins_server, we_are_a_wins_server) -FN_GLOBAL_BOOL(winbind_enum_groups, winbind_enum_groups) -FN_GLOBAL_BOOL(winbind_enum_users, winbind_enum_users) -FN_GLOBAL_BOOL(winbind_nested_groups, winbind_nested_groups) -FN_GLOBAL_BOOL(winbind_normalize_names, winbind_normalize_names) -FN_GLOBAL_BOOL(winbind_offline_logon, winbind_offline_logon) -FN_GLOBAL_BOOL(winbind_refresh_tickets, winbind_refresh_tickets) -FN_GLOBAL_BOOL(winbind_rpc_only, winbind_rpc_only) -FN_GLOBAL_BOOL(winbind_sealed_pipes, winbind_sealed_pipes) -FN_GLOBAL_BOOL(winbind_trusted_domains_only, winbind_trusted_domains_only) -FN_GLOBAL_BOOL(winbind_use_default_domain, winbind_use_default_domain) -FN_GLOBAL_BOOL(wins_dns_proxy, wins_dns_proxy) -FN_GLOBAL_BOOL(wins_proxy, wins_proxy) -FN_GLOBAL_CONST_STRING(afs_username_map, afs_username_map) -FN_GLOBAL_CONST_STRING(ctdbd_socket, ctdbd_socket) -FN_GLOBAL_CONST_STRING(dedicated_keytab_file, dedicated_keytab_file) -FN_GLOBAL_CONST_STRING(dnsdomain, dnsdomain) -FN_GLOBAL_CONST_STRING(dns_forwarder, dns_forwarder) -FN_GLOBAL_CONST_STRING(dos_charset, dos_charset) -FN_GLOBAL_CONST_STRING(guest_account, guest_account) -FN_GLOBAL_CONST_STRING(lock_directory, lock_directory) -FN_GLOBAL_CONST_STRING(logon_drive, logon_drive) -FN_GLOBAL_CONST_STRING(logon_home, logon_home) -FN_GLOBAL_CONST_STRING(logon_path, logon_path) -FN_GLOBAL_CONST_STRING(logon_script, logon_script) -FN_GLOBAL_CONST_STRING(nbt_client_socket_address, nbt_client_socket_address) -FN_GLOBAL_CONST_STRING(ncalrpc_dir, ncalrpc_dir) -FN_GLOBAL_CONST_STRING(netbios_name, netbios_name) -FN_GLOBAL_CONST_STRING(netbios_scope, netbios_scope) -FN_GLOBAL_CONST_STRING(ntp_signd_socket_directory, ntp_signd_socket_directory) -FN_GLOBAL_CONST_STRING(passdb_backend, passdb_backend) -FN_GLOBAL_CONST_STRING(password_server, password_server) -FN_GLOBAL_CONST_STRING(pid_directory, pid_directory) -FN_GLOBAL_CONST_STRING(private_dir, private_dir) -FN_GLOBAL_CONST_STRING(realm, realm) -FN_GLOBAL_CONST_STRING(smb_passwd_file, smb_passwd_file) -FN_GLOBAL_CONST_STRING(socket_options, socket_options) -FN_GLOBAL_CONST_STRING(template_homedir, template_homedir) -FN_GLOBAL_CONST_STRING(template_shell, template_shell) -FN_GLOBAL_CONST_STRING(unix_charset, unix_charset) -FN_GLOBAL_CONST_STRING(utmp_directory, utmp_directory) -FN_GLOBAL_CONST_STRING(winbindd_privileged_socket_directory, winbindd_privileged_socket_directory) -FN_GLOBAL_CONST_STRING(winbindd_socket_directory, winbindd_socket_directory) -FN_GLOBAL_CONST_STRING(winbind_separator, winbind_separator) -FN_GLOBAL_CONST_STRING(workgroup, workgroup) -FN_GLOBAL_CONST_STRING(wtmp_directory, wtmp_directory) -FN_GLOBAL_INTEGER(afs_token_lifetime, afs_token_lifetime) -FN_GLOBAL_INTEGER(algorithmic_rid_base, algorithmic_rid_base) -FN_GLOBAL_INTEGER(allow_dns_updates, allow_dns_updates) -FN_GLOBAL_INTEGER(cldap_port, cldap_port) -FN_GLOBAL_INTEGER(client_ldap_sasl_wrapping, client_ldap_sasl_wrapping) -FN_GLOBAL_INTEGER(client_schannel, client_schannel) -FN_GLOBAL_INTEGER(client_signing, client_signing) -FN_GLOBAL_INTEGER(client_max_protocol, client_max_protocol) -FN_GLOBAL_INTEGER(client_min_protocol, client_min_protocol) -FN_GLOBAL_INTEGER(config_backend, config_backend) -FN_GLOBAL_INTEGER(ctdb_locktime_warn_threshold, ctdb_locktime_warn_threshold) -FN_GLOBAL_INTEGER(ctdb_timeout, ctdb_timeout) -FN_GLOBAL_INTEGER(cups_connection_timeout, cups_connection_timeout) -FN_GLOBAL_INTEGER(deadtime, deadtime) -FN_GLOBAL_INTEGER(dgram_port, dgram_port) -FN_GLOBAL_INTEGER(_domain_master, _domain_master) -FN_GLOBAL_INTEGER(idmap_cache_time, idmap_cache_time) -FN_GLOBAL_INTEGER(idmap_negative_cache_time, idmap_negative_cache_time) -FN_GLOBAL_INTEGER(init_logon_delay, init_logon_delay) -FN_GLOBAL_INTEGER(keepalive, keepalive) -FN_GLOBAL_INTEGER(kerberos_method, kerberos_method) -FN_GLOBAL_INTEGER(kpasswd_port, kpasswd_port) -FN_GLOBAL_INTEGER(krb5_port, krb5_port) -FN_GLOBAL_INTEGER(ldap_connection_timeout, ldap_connection_timeout) -FN_GLOBAL_INTEGER(ldap_debug_level, ldap_debug_level) -FN_GLOBAL_INTEGER(ldap_debug_threshold, ldap_debug_threshold) -FN_GLOBAL_INTEGER(ldap_deref, ldap_deref) -FN_GLOBAL_INTEGER(ldap_follow_referral, ldap_follow_referral) -FN_GLOBAL_INTEGER(ldap_page_size, ldap_page_size) -FN_GLOBAL_INTEGER(ldap_passwd_sync, ldap_passwd_sync) -FN_GLOBAL_INTEGER(ldap_replication_sleep, ldap_replication_sleep) -FN_GLOBAL_INTEGER(ldap_ssl, ldap_ssl) -FN_GLOBAL_INTEGER(ldap_timeout, ldap_timeout) -FN_GLOBAL_INTEGER(lm_announce, lm_announce) -FN_GLOBAL_INTEGER(lm_interval, lm_interval) -FN_GLOBAL_INTEGER(lock_spin_time, lock_spin_time) -FN_GLOBAL_INTEGER(lpq_cache_time, lpq_cache_time) -FN_GLOBAL_INTEGER(machine_password_timeout, machine_password_timeout) -FN_GLOBAL_INTEGER(mangle_prefix, mangle_prefix) -FN_GLOBAL_INTEGER(map_to_guest, map_to_guest) -FN_GLOBAL_INTEGER(max_disk_size, max_disk_size) -FN_GLOBAL_INTEGER(max_log_size, max_log_size) -FN_GLOBAL_INTEGER(max_mux, max_mux) -FN_GLOBAL_INTEGER(max_open_files, max_open_files) -FN_GLOBAL_INTEGER(max_smbd_processes, max_smbd_processes) -FN_GLOBAL_INTEGER(max_stat_cache_size, max_stat_cache_size) -FN_GLOBAL_INTEGER(max_ttl, max_ttl) -FN_GLOBAL_INTEGER(max_wins_ttl, max_wins_ttl) -FN_GLOBAL_INTEGER(max_xmit, max_xmit) -FN_GLOBAL_INTEGER(min_wins_ttl, min_wins_ttl) -FN_GLOBAL_INTEGER(name_cache_timeout, name_cache_timeout) -FN_GLOBAL_INTEGER(nbt_port, nbt_port) -FN_GLOBAL_INTEGER(oplock_break_wait_time, oplock_break_wait_time) -FN_GLOBAL_INTEGER(os_level, os_level) -FN_GLOBAL_INTEGER(passwd_chat_timeout, passwd_chat_timeout) -FN_GLOBAL_INTEGER(printcap_cache_time, printcap_cache_time) -FN_GLOBAL_INTEGER(restrict_anonymous, restrict_anonymous) -FN_GLOBAL_INTEGER(_security, _security) -FN_GLOBAL_INTEGER(_server_role, _server_role) -FN_GLOBAL_INTEGER(server_schannel, server_schannel) -FN_GLOBAL_INTEGER(server_signing, server_signing) -FN_GLOBAL_INTEGER(smb2_max_read, smb2_max_read) -FN_GLOBAL_INTEGER(smb2_max_trans, smb2_max_trans) -FN_GLOBAL_INTEGER(smb2_max_write, smb2_max_write) -FN_GLOBAL_INTEGER(server_max_protocol, server_max_protocol) -FN_GLOBAL_INTEGER(server_min_protocol, server_min_protocol) -FN_GLOBAL_INTEGER(syslog, syslog) -FN_GLOBAL_INTEGER(username_level, username_level) -FN_GLOBAL_INTEGER(username_map_cache_time, username_map_cache_time) -FN_GLOBAL_INTEGER(usershare_max_shares, usershare_max_shares) -FN_GLOBAL_INTEGER(web_port, web_port) -FN_GLOBAL_INTEGER(winbind_cache_time, winbind_cache_time) -FN_GLOBAL_INTEGER(winbind_expand_groups, winbind_expand_groups) -FN_GLOBAL_INTEGER(winbind_max_clients, winbind_max_clients) -FN_GLOBAL_INTEGER(winbind_reconnect_delay, winbind_reconnect_delay) -FN_GLOBAL_LIST(auth_methods, auth_methods) -FN_GLOBAL_LIST(cluster_addresses, cluster_addresses) -FN_GLOBAL_LIST(dcerpc_endpoint_servers, dcerpc_endpoint_servers) -FN_GLOBAL_LIST(dns_update_command, dns_update_command) -FN_GLOBAL_LIST(eventlog_list, eventlog_list) -FN_GLOBAL_LIST(init_logon_delayed_hosts, init_logon_delayed_hosts) -FN_GLOBAL_LIST(interfaces, interfaces) -FN_GLOBAL_LIST(name_resolve_order, name_resolve_order) -FN_GLOBAL_LIST(netbios_aliases, netbios_aliases) -FN_GLOBAL_LIST(nsupdate_command, nsupdate_command) -FN_GLOBAL_LIST(preload_modules, preload_modules) -FN_GLOBAL_LIST(rndc_command, rndc_command) -FN_GLOBAL_LIST(samba_kcc_command, samba_kcc_command) -FN_GLOBAL_LIST(server_services, server_services) -FN_GLOBAL_LIST(smb_ports, smb_ports) -FN_GLOBAL_LIST(spn_update_command, spn_update_command) -FN_GLOBAL_LIST(svcctl_list, svcctl_list) -FN_GLOBAL_LIST(usershare_prefix_allow_list, usershare_prefix_allow_list) -FN_GLOBAL_LIST(usershare_prefix_deny_list, usershare_prefix_deny_list) -FN_GLOBAL_LIST(winbind_nss_info, winbind_nss_info) -FN_GLOBAL_LIST(wins_server_list, wins_server_list) -FN_GLOBAL_STRING(abort_shutdown_script, abort_shutdown_script) -FN_GLOBAL_STRING(add_group_script, add_group_script) -FN_GLOBAL_STRING(add_machine_script, add_machine_script) -FN_GLOBAL_STRING(addport_command, addport_command) -FN_GLOBAL_STRING(addprinter_command, addprinter_command) -FN_GLOBAL_STRING(add_share_command, add_share_command) -FN_GLOBAL_STRING(add_user_script, add_user_script) -FN_GLOBAL_STRING(add_user_to_group_script, add_user_to_group_script) -FN_GLOBAL_STRING(auto_services, auto_services) -FN_GLOBAL_STRING(change_share_command, change_share_command) -FN_GLOBAL_STRING(check_password_script, check_password_script) -FN_GLOBAL_STRING(cups_server, cups_server) -FN_GLOBAL_STRING(defaultservice, defaultservice) -FN_GLOBAL_STRING(deleteprinter_command, deleteprinter_command) -FN_GLOBAL_STRING(delete_share_command, delete_share_command) -FN_GLOBAL_STRING(delete_group_script, delete_group_script) -FN_GLOBAL_STRING(delete_user_from_group_script, delete_user_from_group_script) -FN_GLOBAL_STRING(delete_user_script, delete_user_script) -FN_GLOBAL_STRING(enumports_command, enumports_command) -FN_GLOBAL_STRING(get_quota_command, get_quota_command) -FN_GLOBAL_STRING(iprint_server, iprint_server) -FN_GLOBAL_STRING(ldap_admin_dn, ldap_admin_dn) -FN_GLOBAL_STRING(ldap_suffix, ldap_suffix) -FN_GLOBAL_STRING(logfile, logfile) -FN_GLOBAL_STRING(log_nt_token_command, log_nt_token_command) -FN_GLOBAL_STRING(mangling_method, mangling_method) -FN_GLOBAL_STRING(message_command, message_command) -FN_GLOBAL_STRING(homedir_map, homedir_map) -FN_GLOBAL_STRING(os2_driver_map, os2_driver_map) -FN_GLOBAL_STRING(panic_action, panic_action) -FN_GLOBAL_STRING(passwd_chat, passwd_chat) -FN_GLOBAL_STRING(passwd_program, passwd_program) -FN_GLOBAL_STRING(perfcount_module, perfcount_module) -FN_GLOBAL_STRING(remote_announce, remote_announce) -FN_GLOBAL_STRING(remote_browse_sync, remote_browse_sync) -FN_GLOBAL_STRING(rename_user_script, rename_user_script) -FN_GLOBAL_STRING(root_directory, root_directory) -FN_GLOBAL_STRING(server_string, server_string) -FN_GLOBAL_STRING(set_primary_group_script, set_primary_group_script) -FN_GLOBAL_STRING(set_quota_command, set_quota_command) -FN_GLOBAL_STRING(share_backend, share_backend) -FN_GLOBAL_STRING(shutdown_script, shutdown_script) -FN_GLOBAL_STRING(username_map_script, username_map_script) -FN_GLOBAL_STRING(username_map, username_map) -FN_GLOBAL_STRING(usershare_path, usershare_path) -FN_GLOBAL_STRING(wins_hook, wins_hook) -FN_GLOBAL_STRING(usershare_template_share, usershare_template_share) -FN_GLOBAL_STRING(log_level, log_level) diff --git a/lib/param/wscript_build b/lib/param/wscript_build index 8674f5f655..e5847b9560 100644 --- a/lib/param/wscript_build +++ b/lib/param/wscript_build @@ -1,10 +1,16 @@ #!/usr/bin/env python +bld.SAMBA_GENERATOR('param_functions.c', + source= '../../script/generate_param.py ../../docs-xml/smbdotconf/parameters.all.xml', + target='param_functions.c', + group='build_source', + rule='${PYTHON} ${SRC[0].abspath(env)} --file ${SRC[1].abspath(env)} --output ${TGT}') + bld.SAMBA_GENERATOR('param_local_h', - source= '../../script/mkparamdefs.pl param_functions.c ', + source= '../../script/mkparamdefs.pl loadparm.c param_functions.c ', target='param_local.h', group='build_source', - rule='${PERL} ${SRC[0].abspath(env)} ${SRC[1].abspath(env)} --file ${TGT} --generate-scope=LOCAL') + rule='${PERL} ${SRC[0].abspath(env)} ${SRC[1].abspath(env)} ${SRC[2].abspath(env)} --file ${TGT} --generate-scope=LOCAL') bld.SAMBA_GENERATOR('s3_param_h', diff --git a/script/generate_param.py b/script/generate_param.py new file mode 100644 index 0000000000..38ce37296c --- /dev/null +++ b/script/generate_param.py @@ -0,0 +1,113 @@ +# Unix SMB/CIFS implementation. +# Copyright (C) 2014 Catalyst.Net Ltd +# +# Auto generate param_functions.c +# +# ** NOTE! The following LGPL license applies to the ldb +# ** library. This does NOT imply that all of Samba is released +# ** under the LGPL +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, see <http://www.gnu.org/licenses/>. +# + +import errno +import os +import re +import subprocess +import xml.etree.ElementTree as ET +import sys +import optparse + +# parse command line arguments +parser = optparse.OptionParser() +parser.add_option("-f", "--file", dest="filename", + help="input file", metavar="FILE") +parser.add_option("-o", "--output", dest="output", + help='output file', metavar="FILE") +parser.add_option("--mode", type="choice", metavar="<FUNCTIONS>", + choices=["FUNCTIONS"], default="FUNCTIONS") + +(options, args) = parser.parse_args() + +if options.filename is None: + parser.error("No input file specified") +if options.output is None: + parser.error("No output file specified") + +def iterate_all(path): + """Iterate and yield all the parameters. + + :param path: path to parameters xml file + """ + + try: + p = open(path, 'r') + except IOError, e: + raise Exception("Error opening parameters file") + out = p.read() + + # parse the parameters xml file + root = ET.fromstring(out) + for parameter in root: + name = parameter.attrib.get("name") + param_type = parameter.attrib.get("type") + context = parameter.attrib.get("context") + func = parameter.attrib.get("function") + synonym = parameter.attrib.get("synonym") + removed = parameter.attrib.get("removed") + generated = parameter.attrib.get("generated_function") + if synonym == "1" or removed == "1" or generated == "0": + continue + constant = parameter.attrib.get("constant") + parm = parameter.attrib.get("parm") + if name is None or param_type is None or context is None: + raise Exception("Error parsing parameter: " + name) + if func is None: + func = name.replace(" ", "_").lower() + yield {'name': name, + 'type': param_type, + 'context': context, + 'function': func, + 'constant': (constant == '1'), + 'parm': (parm == '1')} + +# map doc attributes to a section of the generated function +context_dict = {"G": "_GLOBAL", "S": "_LOCAL"} +param_type_dict = {"boolean": "_BOOL", "list": "_LIST", "string": "_STRING", + "integer": "_INTEGER", "enum": "_INTEGER", "char" : "_CHAR", + "boolean-auto": "_INTEGER"} + +f = open(options.output, 'w') + +try: + for parameter in iterate_all(options.filename): + # filter out parameteric options + if ':' in parameter['name']: + continue + output_string = "FN" + temp = context_dict.get(parameter['context']) + if temp is None: + raise Exception(parameter['name'] + " has an invalid context " + parameter['context']) + output_string += temp + if parameter['constant']: + output_string += "_CONST" + if parameter['parm']: + output_string += "_PARM" + temp = param_type_dict.get(parameter['type']) + if temp is None: + raise Exception(parameter['name'] + " has an invalid param type " + parameter['type']) + output_string += temp + f.write(output_string + "(" + parameter['function'] +", " + parameter['function'] + ')\n') +finally: + f.close() diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index cf37348f5d..b4b79aaa29 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -1238,6 +1238,10 @@ FN_GLOBAL_STRING(configfile, szConfigFile) FN_LOCAL_STRING(servicename, szService) FN_LOCAL_CONST_STRING(const_servicename, szService) +/* These functions cannot be auto-generated */ +FN_LOCAL_BOOL(autoloaded, autoloaded) +FN_GLOBAL_CONST_STRING(dnsdomain, dnsdomain) + /* local prototypes */ static int map_parameter_canonical(const char *pszParmName, bool *inverse); |