summaryrefslogtreecommitdiff
path: root/source4/utils
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2006-01-06 02:13:01 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:49:46 -0500
commit03ab3429090a9fccc8778d949cd9d92042575558 (patch)
tree9778b002e200913d3c59b0bcfcd890c7e2a8a312 /source4/utils
parent37bc6b5f813d5c2ace7486a38331748dd86f121d (diff)
downloadsamba-03ab3429090a9fccc8778d949cd9d92042575558.tar.gz
samba-03ab3429090a9fccc8778d949cd9d92042575558.tar.bz2
samba-03ab3429090a9fccc8778d949cd9d92042575558.zip
r12729: Implement the --section-name option, for dumping only one section.
Andrew Bartlett (This used to be commit 3c49dd9219b12f5ed229ba108a02b85a18146df8)
Diffstat (limited to 'source4/utils')
-rw-r--r--source4/utils/testparm.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/source4/utils/testparm.c b/source4/utils/testparm.c
index 05aa5ff547..c4b7dd38d8 100644
--- a/source4/utils/testparm.c
+++ b/source4/utils/testparm.c
@@ -82,9 +82,9 @@ static int do_global_checks(void)
/*
static BOOL show_all_parameters = False;
static char *parameter_name = NULL;
- static const char *section_name = NULL;
static char *new_local_machine = NULL;
*/
+ static const char *section_name = NULL;
static const char *cname;
static const char *caddr;
static int show_defaults;
@@ -101,8 +101,8 @@ static int do_global_checks(void)
These are harder to do with the new code structure
{"show-all-parameters", '\0', POPT_ARG_VAL, &show_all_parameters, True, "Show the parameters, type, possible values" },
{"parameter-name", '\0', POPT_ARG_STRING, &parameter_name, 0, "Limit testparm to a named parameter" },
- {"section-name", '\0', POPT_ARG_STRING, &section_name, 0, "Limit testparm to a named section" },
*/
+ {"section-name", '\0', POPT_ARG_STRING, &section_name, 0, "Limit testparm to a named section" },
{"client-name", '\0', POPT_ARG_STRING, &cname, 0, "Client DNS name for 'hosts allow' checking (should match reverse lookup)"},
{"client-ip", '\0', POPT_ARG_STRING, &caddr, 0, "Client IP address for 'hosts allow' checking"},
POPT_COMMON_VERSION
@@ -196,7 +196,26 @@ static int do_global_checks(void)
fflush(stdout);
getc(stdin);
}
- lp_dump(stdout, show_defaults, lp_numservices());
+ if (section_name) {
+ BOOL isGlobal = False;
+ if (!section_name) {
+ section_name = GLOBAL_NAME;
+ isGlobal = True;
+ } else if ((isGlobal=!strwicmp(section_name, GLOBAL_NAME)) == 0 &&
+ (s=lp_servicenumber(section_name)) == -1) {
+ fprintf(stderr,"Unknown section %s\n",
+ section_name);
+ return(1);
+ }
+ if (isGlobal == True) {
+ lp_dump(stdout, show_defaults, 0);
+ } else {
+ lp_dump_one(stdout, show_defaults, s);
+ }
+ } else {
+ lp_dump(stdout, show_defaults, lp_numservices());
+ }
+ return(ret);
}
if(cname && caddr){