s4:dsdb/samldb: add let lockoutTime=0 reset badPwdCount=0
[Samba.git] / source3 / utils / net_conf_util.c
bloba188097cca45d27dc540fc916bfcc894302eb88c
1 /*
2 * Samba Unix/Linux SMB client library
3 * Distributed SMB/CIFS Server Management Utility
4 * Configuration interface
6 * Copyright (C) Michael Adam 2013
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 3 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, see <http://www.gnu.org/licenses/>.
23 * Utility functions for net conf and net rpc conf.
26 #include "includes.h"
27 #include "lib/smbconf/smbconf.h"
28 #include "lib/smbconf/smbconf_reg.h"
29 #include "lib/param/loadparm.h"
30 #include "net_conf_util.h"
32 bool net_conf_param_valid(const char *service,
33 const char *param,
34 const char *valstr)
36 const char *canon_param, *canon_valstr;
38 if (!lp_parameter_is_valid(param)) {
39 d_fprintf(stderr, "Invalid parameter '%s' given.\n", param);
40 return false;
43 if (!smbconf_reg_parameter_is_valid(param)) {
44 d_fprintf(stderr, "Parameter '%s' not allowed in registry.\n",
45 param);
46 return false;
49 if (!strequal(service, GLOBAL_NAME) && lp_parameter_is_global(param)) {
50 d_fprintf(stderr, "Global parameter '%s' not allowed in "
51 "service definition ('%s').\n", param, service);
52 return false;
55 if (!lp_canonicalize_parameter_with_value(param, valstr,
56 &canon_param,
57 &canon_valstr))
60 * We already know the parameter name is valid.
61 * So the value must be invalid.
63 d_fprintf(stderr, "invalid value '%s' given for "
64 "parameter '%s'\n", param, valstr);
65 return false;
68 return true;