2
* Samba Unix/Linux SMB client library
3
* Distributed SMB/CIFS Server Management Utility
4
* Local configuration interface
5
* Copyright (C) Michael Adam 2007-2008
7
* This program is free software; you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation; either version 3 of the License, or
10
* (at your option) any later version.
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
17
* You should have received a copy of the GNU General Public License
18
* along with this program; if not, see <http://www.gnu.org/licenses/>.
22
* This is an interface to Samba's configuration as made available
23
* by the libsmbconf interface (source/lib/smbconf/smbconf.c).
25
* This currently supports local interaction with the configuration
26
* stored in the registry. But other backends and remote access via
27
* rpc might get implemented in the future.
31
#include "utils/net.h"
33
/**********************************************************************
37
**********************************************************************/
39
static int net_conf_list_usage(struct net_context *c, int argc,
42
d_printf("USAGE: net conf list\n");
46
static int net_conf_import_usage(struct net_context *c, int argc,
49
d_printf("USAGE: net conf import [--test|-T] <filename> "
51
"\t[--test|-T] testmode - do not act, just print "
52
"what would be done\n"
53
"\t<servicename> only import service <servicename>, "
58
static int net_conf_listshares_usage(struct net_context *c, int argc,
61
d_printf("USAGE: net conf listshares\n");
65
static int net_conf_drop_usage(struct net_context *c, int argc,
68
d_printf("USAGE: net conf drop\n");
72
static int net_conf_showshare_usage(struct net_context *c, int argc,
75
d_printf("USAGE: net conf showshare <sharename>\n");
79
static int net_conf_addshare_usage(struct net_context *c, int argc,
82
d_printf("USAGE: net conf addshare <sharename> <path> "
83
"[writeable={y|N} [guest_ok={y|N} [<comment>]]\n"
84
"\t<sharename> the new share name.\n"
85
"\t<path> the path on the filesystem to export.\n"
86
"\twriteable={y|N} set \"writeable to \"yes\" or "
87
"\"no\" (default) on this share.\n"
88
"\tguest_ok={y|N} set \"guest ok\" to \"yes\" or "
89
"\"no\" (default) on this share.\n"
90
"\t<comment> optional comment for the new share.\n");
94
static int net_conf_delshare_usage(struct net_context *c, int argc,
97
d_printf("USAGE: net conf delshare <sharename>\n");
101
static int net_conf_setparm_usage(struct net_context *c, int argc,
104
d_printf("USAGE: net conf setparm <section> <param> <value>\n");
108
static int net_conf_getparm_usage(struct net_context *c, int argc,
111
d_printf("USAGE: net conf getparm <section> <param>\n");
115
static int net_conf_delparm_usage(struct net_context *c, int argc,
118
d_printf("USAGE: net conf delparm <section> <param>\n");
122
static int net_conf_getincludes_usage(struct net_context *c, int argc,
125
d_printf("USAGE: net conf getincludes <section>\n");
129
static int net_conf_setincludes_usage(struct net_context *c, int argc,
132
d_printf("USAGE: net conf setincludes <section> [<filename>]*\n");
136
static int net_conf_delincludes_usage(struct net_context *c, int argc,
139
d_printf("USAGE: net conf delincludes <section>\n");
144
/**********************************************************************
148
**********************************************************************/
151
* This functions process a service previously loaded with libsmbconf.
153
static WERROR import_process_service(struct net_context *c,
154
struct smbconf_ctx *conf_ctx,
155
struct smbconf_service *service)
158
WERROR werr = WERR_OK;
159
uint32_t num_includes = 0;
160
char **includes = NULL;
161
TALLOC_CTX *mem_ctx = talloc_stackframe();
163
if (c->opt_testmode) {
164
const char *indent = "";
165
if (service->name != NULL) {
166
d_printf("[%s]\n", service->name);
169
for (idx = 0; idx < service->num_params; idx++) {
170
d_printf("%s%s = %s\n", indent,
171
service->param_names[idx],
172
service->param_values[idx]);
178
if (smbconf_share_exists(conf_ctx, service->name)) {
179
werr = smbconf_delete_share(conf_ctx, service->name);
180
if (!W_ERROR_IS_OK(werr)) {
184
werr = smbconf_create_share(conf_ctx, service->name);
185
if (!W_ERROR_IS_OK(werr)) {
189
for (idx = 0; idx < service->num_params; idx ++) {
190
if (strequal(service->param_names[idx], "include")) {
191
includes = TALLOC_REALLOC_ARRAY(mem_ctx,
195
if (includes == NULL) {
199
includes[num_includes] = talloc_strdup(includes,
200
service->param_values[idx]);
201
if (includes[num_includes] == NULL) {
207
werr = smbconf_set_parameter(conf_ctx,
209
service->param_names[idx],
210
service->param_values[idx]);
211
if (!W_ERROR_IS_OK(werr)) {
212
d_printf("Error in section [%s], parameter \"%s\": %s\n",
213
service->name, service->param_names[idx],
220
werr = smbconf_set_includes(conf_ctx, service->name, num_includes,
221
(const char **)includes);
224
TALLOC_FREE(mem_ctx);
229
/**********************************************************************
231
* the main conf functions
233
**********************************************************************/
235
static int net_conf_list(struct net_context *c, struct smbconf_ctx *conf_ctx,
236
int argc, const char **argv)
238
WERROR werr = WERR_OK;
242
uint32_t share_count, param_count;
243
struct smbconf_service **shares = NULL;
245
mem_ctx = talloc_stackframe();
247
if (argc != 0 || c->display_usage) {
248
net_conf_list_usage(c, argc, argv);
252
werr = smbconf_get_config(conf_ctx, mem_ctx, &num_shares, &shares);
253
if (!W_ERROR_IS_OK(werr)) {
254
d_fprintf(stderr, "Error getting config: %s\n",
259
for (share_count = 0; share_count < num_shares; share_count++) {
260
const char *indent = "";
261
if (shares[share_count]->name != NULL) {
262
d_printf("[%s]\n", shares[share_count]->name);
265
for (param_count = 0;
266
param_count < shares[share_count]->num_params;
269
d_printf("%s%s = %s\n",
271
shares[share_count]->param_names[param_count],
272
shares[share_count]->param_values[param_count]);
280
TALLOC_FREE(mem_ctx);
284
static int net_conf_import(struct net_context *c, struct smbconf_ctx *conf_ctx,
285
int argc, const char **argv)
288
const char *filename = NULL;
289
const char *servicename = NULL;
290
char *conf_source = NULL;
292
struct smbconf_ctx *txt_ctx;
295
if (c->display_usage)
296
return net_conf_import_usage(c, argc, argv);
298
mem_ctx = talloc_stackframe();
303
net_conf_import_usage(c, argc, argv);
306
servicename = talloc_strdup(mem_ctx, argv[1]);
307
if (servicename == NULL) {
308
d_printf("error: out of memory!\n");
316
DEBUG(3,("net_conf_import: reading configuration from file %s.\n",
319
conf_source = talloc_asprintf(mem_ctx, "file:%s", filename);
320
if (conf_source == NULL) {
321
d_printf("error: out of memory!\n");
325
werr = smbconf_init(mem_ctx, &txt_ctx, conf_source);
326
if (!W_ERROR_IS_OK(werr)) {
327
d_printf("error loading file '%s': %s\n", filename,
332
if (c->opt_testmode) {
333
d_printf("\nTEST MODE - "
334
"would import the following configuration:\n\n");
337
if (servicename != NULL) {
338
struct smbconf_service *service = NULL;
340
werr = smbconf_get_share(txt_ctx, mem_ctx,
343
if (!W_ERROR_IS_OK(werr)) {
347
werr = smbconf_transaction_start(conf_ctx);
348
if (!W_ERROR_IS_OK(werr)) {
349
d_printf("error starting transaction: %s\n",
354
werr = import_process_service(c, conf_ctx, service);
355
if (!W_ERROR_IS_OK(werr)) {
359
struct smbconf_service **services = NULL;
360
uint32_t num_shares, sidx;
362
werr = smbconf_get_config(txt_ctx, mem_ctx,
365
if (!W_ERROR_IS_OK(werr)) {
368
if (!c->opt_testmode) {
369
werr = smbconf_drop(conf_ctx);
370
if (!W_ERROR_IS_OK(werr)) {
376
* Wrap the importing of shares into a transaction,
377
* but only 100 at a time, in order to serve memory.
378
* The allocated memory accumulates across the actions
379
* within the transaction, and for me, some 1500
380
* imported shares, the MAX_TALLOC_SIZE of 256 MB
383
werr = smbconf_transaction_start(conf_ctx);
384
if (!W_ERROR_IS_OK(werr)) {
385
d_printf("error starting transaction: %s\n",
390
for (sidx = 0; sidx < num_shares; sidx++) {
391
werr = import_process_service(c, conf_ctx,
393
if (!W_ERROR_IS_OK(werr)) {
401
werr = smbconf_transaction_commit(conf_ctx);
402
if (!W_ERROR_IS_OK(werr)) {
403
d_printf("error committing transaction: %s\n",
407
werr = smbconf_transaction_start(conf_ctx);
408
if (!W_ERROR_IS_OK(werr)) {
409
d_printf("error starting transaction: %s\n",
416
werr = smbconf_transaction_commit(conf_ctx);
417
if (!W_ERROR_IS_OK(werr)) {
418
d_printf("error committing transaction: %s\n",
427
werr = smbconf_transaction_cancel(conf_ctx);
428
if (!W_ERROR_IS_OK(werr)) {
429
d_printf("error cancelling transaction: %s\n",
434
TALLOC_FREE(mem_ctx);
438
static int net_conf_listshares(struct net_context *c,
439
struct smbconf_ctx *conf_ctx, int argc,
442
WERROR werr = WERR_OK;
444
uint32_t count, num_shares = 0;
445
char **share_names = NULL;
448
mem_ctx = talloc_stackframe();
450
if (argc != 0 || c->display_usage) {
451
net_conf_listshares_usage(c, argc, argv);
455
werr = smbconf_get_share_names(conf_ctx, mem_ctx, &num_shares,
457
if (!W_ERROR_IS_OK(werr)) {
461
for (count = 0; count < num_shares; count++)
463
d_printf("%s\n", share_names[count]);
469
TALLOC_FREE(mem_ctx);
473
static int net_conf_drop(struct net_context *c, struct smbconf_ctx *conf_ctx,
474
int argc, const char **argv)
479
if (argc != 0 || c->display_usage) {
480
net_conf_drop_usage(c, argc, argv);
484
werr = smbconf_drop(conf_ctx);
485
if (!W_ERROR_IS_OK(werr)) {
486
d_fprintf(stderr, "Error deleting configuration: %s\n",
497
static int net_conf_showshare(struct net_context *c,
498
struct smbconf_ctx *conf_ctx, int argc,
502
WERROR werr = WERR_OK;
503
const char *sharename = NULL;
506
struct smbconf_service *service = NULL;
508
mem_ctx = talloc_stackframe();
510
if (argc != 1 || c->display_usage) {
511
net_conf_showshare_usage(c, argc, argv);
515
sharename = talloc_strdup(mem_ctx, argv[0]);
516
if (sharename == NULL) {
517
d_printf("error: out of memory!\n");
521
werr = smbconf_get_share(conf_ctx, mem_ctx, sharename, &service);
522
if (!W_ERROR_IS_OK(werr)) {
523
d_printf("error getting share parameters: %s\n",
528
d_printf("[%s]\n", service->name);
530
for (count = 0; count < service->num_params; count++) {
531
d_printf("\t%s = %s\n", service->param_names[count],
532
service->param_values[count]);
538
TALLOC_FREE(mem_ctx);
543
* Add a share, with a couple of standard parameters, partly optional.
545
* This is a high level utility function of the net conf utility,
546
* not a direct frontend to the smbconf API.
548
static int net_conf_addshare(struct net_context *c,
549
struct smbconf_ctx *conf_ctx, int argc,
553
WERROR werr = WERR_OK;
554
char *sharename = NULL;
555
const char *path = NULL;
556
const char *comment = NULL;
557
const char *guest_ok = "no";
558
const char *writeable = "no";
559
SMB_STRUCT_STAT sbuf;
560
TALLOC_CTX *mem_ctx = talloc_stackframe();
562
if (c->display_usage) {
563
net_conf_addshare_usage(c, argc, argv);
572
net_conf_addshare_usage(c, argc, argv);
577
if (!strnequal(argv[3], "guest_ok=", 9)) {
578
net_conf_addshare_usage(c, argc, argv);
581
switch (argv[3][9]) {
591
net_conf_addshare_usage(c, argc, argv);
595
if (!strnequal(argv[2], "writeable=", 10)) {
596
net_conf_addshare_usage(c, argc, argv);
599
switch (argv[2][10]) {
609
net_conf_addshare_usage(c, argc, argv);
614
sharename = talloc_strdup(mem_ctx, argv[0]);
615
if (sharename == NULL) {
616
d_printf("error: out of memory!\n");
627
/* validate share name */
629
if (!validate_net_name(sharename, INVALID_SHARENAME_CHARS,
632
d_fprintf(stderr, "ERROR: share name %s contains "
633
"invalid characters (any of %s)\n",
634
sharename, INVALID_SHARENAME_CHARS);
638
if (strequal(sharename, GLOBAL_NAME)) {
640
"ERROR: 'global' is not a valid share name.\n");
644
if (smbconf_share_exists(conf_ctx, sharename)) {
645
d_fprintf(stderr, "ERROR: share %s already exists.\n",
652
if (path[0] != '/') {
654
"Error: path '%s' is not an absolute path.\n",
659
if (sys_stat(path, &sbuf) != 0) {
661
"ERROR: cannot stat path '%s' to ensure "
662
"this is a directory.\n"
664
path, strerror(errno));
668
if (!S_ISDIR(sbuf.st_mode)) {
670
"ERROR: path '%s' is not a directory.\n",
679
werr = smbconf_create_share(conf_ctx, sharename);
680
if (!W_ERROR_IS_OK(werr)) {
681
d_fprintf(stderr, "Error creating share %s: %s\n",
682
sharename, win_errstr(werr));
687
* fill the share with parameters
690
werr = smbconf_set_parameter(conf_ctx, sharename, "path", path);
691
if (!W_ERROR_IS_OK(werr)) {
692
d_fprintf(stderr, "Error setting parameter %s: %s\n",
693
"path", win_errstr(werr));
697
if (comment != NULL) {
698
werr = smbconf_set_parameter(conf_ctx, sharename, "comment",
700
if (!W_ERROR_IS_OK(werr)) {
701
d_fprintf(stderr, "Error setting parameter %s: %s\n",
702
"comment", win_errstr(werr));
707
werr = smbconf_set_parameter(conf_ctx, sharename, "guest ok", guest_ok);
708
if (!W_ERROR_IS_OK(werr)) {
709
d_fprintf(stderr, "Error setting parameter %s: %s\n",
710
"'guest ok'", win_errstr(werr));
714
werr = smbconf_set_parameter(conf_ctx, sharename, "writeable",
716
if (!W_ERROR_IS_OK(werr)) {
717
d_fprintf(stderr, "Error setting parameter %s: %s\n",
718
"writeable", win_errstr(werr));
725
TALLOC_FREE(mem_ctx);
729
static int net_conf_delshare(struct net_context *c,
730
struct smbconf_ctx *conf_ctx, int argc,
734
const char *sharename = NULL;
735
WERROR werr = WERR_OK;
736
TALLOC_CTX *mem_ctx = talloc_stackframe();
738
if (argc != 1 || c->display_usage) {
739
net_conf_delshare_usage(c, argc, argv);
742
sharename = talloc_strdup(mem_ctx, argv[0]);
743
if (sharename == NULL) {
744
d_printf("error: out of memory!\n");
748
werr = smbconf_delete_share(conf_ctx, sharename);
749
if (!W_ERROR_IS_OK(werr)) {
750
d_fprintf(stderr, "Error deleting share %s: %s\n",
751
sharename, win_errstr(werr));
757
TALLOC_FREE(mem_ctx);
761
static int net_conf_setparm(struct net_context *c, struct smbconf_ctx *conf_ctx,
762
int argc, const char **argv)
765
WERROR werr = WERR_OK;
766
char *service = NULL;
768
const char *value_str = NULL;
769
TALLOC_CTX *mem_ctx = talloc_stackframe();
771
if (argc != 3 || c->display_usage) {
772
net_conf_setparm_usage(c, argc, argv);
775
service = talloc_strdup(mem_ctx, argv[0]);
776
if (service == NULL) {
777
d_printf("error: out of memory!\n");
780
param = talloc_strdup_lower(mem_ctx, argv[1]);
782
d_printf("error: out of memory!\n");
787
werr = smbconf_transaction_start(conf_ctx);
788
if (!W_ERROR_IS_OK(werr)) {
789
d_printf("error starting transaction: %s\n",
794
if (!smbconf_share_exists(conf_ctx, service)) {
795
werr = smbconf_create_share(conf_ctx, service);
796
if (!W_ERROR_IS_OK(werr)) {
797
d_fprintf(stderr, "Error creating share '%s': %s\n",
798
service, win_errstr(werr));
803
werr = smbconf_set_parameter(conf_ctx, service, param, value_str);
805
if (!W_ERROR_IS_OK(werr)) {
806
d_fprintf(stderr, "Error setting value '%s': %s\n",
807
param, win_errstr(werr));
811
werr = smbconf_transaction_commit(conf_ctx);
812
if (!W_ERROR_IS_OK(werr)) {
813
d_printf("error committing transaction: %s\n",
822
werr = smbconf_transaction_cancel(conf_ctx);
823
if (!W_ERROR_IS_OK(werr)) {
824
d_printf("error cancelling transaction: %s\n",
829
TALLOC_FREE(mem_ctx);
833
static int net_conf_getparm(struct net_context *c, struct smbconf_ctx *conf_ctx,
834
int argc, const char **argv)
837
WERROR werr = WERR_OK;
838
char *service = NULL;
843
mem_ctx = talloc_stackframe();
845
if (argc != 2 || c->display_usage) {
846
net_conf_getparm_usage(c, argc, argv);
849
service = talloc_strdup(mem_ctx, argv[0]);
850
if (service == NULL) {
851
d_printf("error: out of memory!\n");
854
param = talloc_strdup_lower(mem_ctx, argv[1]);
856
d_printf("error: out of memory!\n");
860
werr = smbconf_get_parameter(conf_ctx, mem_ctx, service, param, &valstr);
862
if (W_ERROR_EQUAL(werr, WERR_NO_SUCH_SERVICE)) {
864
"Error: given service '%s' does not exist.\n",
867
} else if (W_ERROR_EQUAL(werr, WERR_INVALID_PARAM)) {
869
"Error: given parameter '%s' is not set.\n",
872
} else if (!W_ERROR_IS_OK(werr)) {
873
d_fprintf(stderr, "Error getting value '%s': %s.\n",
874
param, win_errstr(werr));
878
d_printf("%s\n", valstr);
882
TALLOC_FREE(mem_ctx);
886
static int net_conf_delparm(struct net_context *c, struct smbconf_ctx *conf_ctx,
887
int argc, const char **argv)
890
WERROR werr = WERR_OK;
891
char *service = NULL;
893
TALLOC_CTX *mem_ctx = talloc_stackframe();
895
if (argc != 2 || c->display_usage) {
896
net_conf_delparm_usage(c, argc, argv);
899
service = talloc_strdup(mem_ctx, argv[0]);
900
if (service == NULL) {
901
d_printf("error: out of memory!\n");
904
param = talloc_strdup_lower(mem_ctx, argv[1]);
906
d_printf("error: out of memory!\n");
910
werr = smbconf_delete_parameter(conf_ctx, service, param);
912
if (W_ERROR_EQUAL(werr, WERR_NO_SUCH_SERVICE)) {
914
"Error: given service '%s' does not exist.\n",
917
} else if (W_ERROR_EQUAL(werr, WERR_INVALID_PARAM)) {
919
"Error: given parameter '%s' is not set.\n",
922
} else if (!W_ERROR_IS_OK(werr)) {
923
d_fprintf(stderr, "Error deleting value '%s': %s.\n",
924
param, win_errstr(werr));
931
TALLOC_FREE(mem_ctx);
935
static int net_conf_getincludes(struct net_context *c,
936
struct smbconf_ctx *conf_ctx,
937
int argc, const char **argv)
940
uint32_t num_includes;
943
char **includes = NULL;
945
TALLOC_CTX *mem_ctx = talloc_stackframe();
947
if (argc != 1 || c->display_usage) {
948
net_conf_getincludes_usage(c, argc, argv);
952
service = talloc_strdup(mem_ctx, argv[0]);
953
if (service == NULL) {
954
d_printf("error: out of memory!\n");
958
werr = smbconf_get_includes(conf_ctx, mem_ctx, service,
959
&num_includes, &includes);
960
if (!W_ERROR_IS_OK(werr)) {
961
d_printf("error getting includes: %s\n", win_errstr(werr));
965
for (count = 0; count < num_includes; count++) {
966
d_printf("include = %s\n", includes[count]);
972
TALLOC_FREE(mem_ctx);
976
static int net_conf_setincludes(struct net_context *c,
977
struct smbconf_ctx *conf_ctx,
978
int argc, const char **argv)
982
uint32_t num_includes;
983
const char **includes;
985
TALLOC_CTX *mem_ctx = talloc_stackframe();
987
if (argc < 1 || c->display_usage) {
988
net_conf_setincludes_usage(c, argc, argv);
992
service = talloc_strdup(mem_ctx, argv[0]);
993
if (service == NULL) {
994
d_printf("error: out of memory!\n");
998
num_includes = argc - 1;
999
if (num_includes == 0) {
1002
includes = argv + 1;
1005
werr = smbconf_set_includes(conf_ctx, service, num_includes, includes);
1006
if (!W_ERROR_IS_OK(werr)) {
1007
d_printf("error setting includes: %s\n", win_errstr(werr));
1014
TALLOC_FREE(mem_ctx);
1018
static int net_conf_delincludes(struct net_context *c,
1019
struct smbconf_ctx *conf_ctx,
1020
int argc, const char **argv)
1025
TALLOC_CTX *mem_ctx = talloc_stackframe();
1027
if (argc != 1 || c->display_usage) {
1028
net_conf_delincludes_usage(c, argc, argv);
1032
service = talloc_strdup(mem_ctx, argv[0]);
1033
if (service == NULL) {
1034
d_printf("error: out of memory!\n");
1038
werr = smbconf_delete_includes(conf_ctx, service);
1039
if (!W_ERROR_IS_OK(werr)) {
1040
d_printf("error deleting includes: %s\n", win_errstr(werr));
1047
TALLOC_FREE(mem_ctx);
1052
/**********************************************************************
1054
* Wrapper and net_conf_run_function mechanism.
1056
**********************************************************************/
1059
* Wrapper function to call the main conf functions.
1060
* The wrapper calls handles opening and closing of the
1063
static int net_conf_wrap_function(struct net_context *c,
1064
int (*fn)(struct net_context *,
1065
struct smbconf_ctx *,
1066
int, const char **),
1067
int argc, const char **argv)
1070
TALLOC_CTX *mem_ctx = talloc_stackframe();
1071
struct smbconf_ctx *conf_ctx;
1074
werr = smbconf_init(mem_ctx, &conf_ctx, "registry:");
1076
if (!W_ERROR_IS_OK(werr)) {
1080
ret = fn(c, conf_ctx, argc, argv);
1082
smbconf_shutdown(conf_ctx);
1088
* We need a functable struct of our own, because the
1089
* functions are called through a wrapper that handles
1090
* the opening and closing of the configuration, and so on.
1092
struct conf_functable {
1093
const char *funcname;
1094
int (*fn)(struct net_context *c, struct smbconf_ctx *ctx, int argc,
1096
int valid_transports;
1097
const char *description;
1102
* This imitates net_run_function but calls the main functions
1103
* through the wrapper net_conf_wrap_function().
1105
static int net_conf_run_function(struct net_context *c, int argc,
1106
const char **argv, const char *whoami,
1107
struct conf_functable *table)
1112
for (i=0; table[i].funcname; i++) {
1113
if (StrCaseCmp(argv[0], table[i].funcname) == 0)
1114
return net_conf_wrap_function(c, table[i].fn,
1120
d_printf("Usage:\n");
1121
for (i=0; table[i].funcname; i++) {
1122
if (c->display_usage == false)
1123
d_printf("%s %-15s %s\n", whoami, table[i].funcname,
1124
table[i].description);
1126
d_printf("%s\n", table[i].usage);
1129
return c->display_usage?0:-1;
1133
* Entry-point for all the CONF functions.
1136
int net_conf(struct net_context *c, int argc, const char **argv)
1139
struct conf_functable func_table[] = {
1143
NET_TRANSPORT_LOCAL,
1144
"Dump the complete configuration in smb.conf like "
1147
" Dump the complete configuration in smb.conf like "
1154
NET_TRANSPORT_LOCAL,
1155
"Import configuration from file in smb.conf format.",
1157
" Import configuration from file in smb.conf format."
1161
net_conf_listshares,
1162
NET_TRANSPORT_LOCAL,
1163
"List the share names.",
1164
"net conf listshares\n"
1165
" List the share names."
1170
NET_TRANSPORT_LOCAL,
1171
"Delete the complete configuration.",
1173
" Delete the complete configuration."
1178
NET_TRANSPORT_LOCAL,
1179
"Show the definition of a share.",
1180
"net conf showshare\n"
1181
" Show the definition of a share."
1186
NET_TRANSPORT_LOCAL,
1187
"Create a new share.",
1188
"net conf addshare\n"
1189
" Create a new share."
1194
NET_TRANSPORT_LOCAL,
1196
"net conf delshare\n"
1202
NET_TRANSPORT_LOCAL,
1203
"Store a parameter.",
1204
"net conf setparm\n"
1205
" Store a parameter."
1210
NET_TRANSPORT_LOCAL,
1211
"Retrieve the value of a parameter.",
1212
"net conf getparm\n"
1213
" Retrieve the value of a parameter."
1218
NET_TRANSPORT_LOCAL,
1219
"Delete a parameter.",
1220
"net conf delparm\n"
1221
" Delete a parameter."
1225
net_conf_getincludes,
1226
NET_TRANSPORT_LOCAL,
1227
"Show the includes of a share definition.",
1228
"net conf getincludes\n"
1229
" Show the includes of a share definition."
1233
net_conf_setincludes,
1234
NET_TRANSPORT_LOCAL,
1235
"Set includes for a share.",
1236
"net conf setincludes\n"
1237
" Set includes for a share."
1241
net_conf_delincludes,
1242
NET_TRANSPORT_LOCAL,
1243
"Delete includes from a share definition.",
1244
"net conf setincludes\n"
1245
" Delete includes from a share definition."
1247
{NULL, NULL, 0, NULL, NULL}
1250
ret = net_conf_run_function(c, argc, argv, "net conf", func_table);