net_conf: add casts to avoid compiler warnings.
[ira/wip.git] / source3 / utils / net_conf.c
1 /*
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
6  *
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.
11  *
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.
16  *
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/>.
19  */
20
21 /*
22  * This is an interface to Samba's configuration as made available
23  * by the libsmbconf interface (source/lib/smbconf/smbconf.c).
24  *
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.
28  */
29
30 #include "includes.h"
31 #include "utils/net.h"
32
33 /**********************************************************************
34  *
35  * usage functions
36  *
37  **********************************************************************/
38
39 static int net_conf_list_usage(int argc, const char **argv)
40 {
41         d_printf("USAGE: net conf list\n");
42         return -1;
43 }
44
45 static int net_conf_import_usage(int argc, const char**argv)
46 {
47         d_printf("USAGE: net conf import [--test|-T] <filename> "
48                  "[<servicename>]\n"
49                  "\t[--test|-T]    testmode - do not act, just print "
50                         "what would be done\n"
51                  "\t<servicename>  only import service <servicename>, "
52                         "ignore the rest\n");
53         return -1;
54 }
55
56 static int net_conf_listshares_usage(int argc, const char **argv)
57 {
58         d_printf("USAGE: net conf listshares\n");
59         return -1;
60 }
61
62 static int net_conf_drop_usage(int argc, const char **argv)
63 {
64         d_printf("USAGE: net conf drop\n");
65         return -1;
66 }
67
68 static int net_conf_showshare_usage(int argc, const char **argv)
69 {
70         d_printf("USAGE: net conf showshare <sharename>\n");
71         return -1;
72 }
73
74 static int net_conf_addshare_usage(int argc, const char **argv)
75 {
76         d_printf("USAGE: net conf addshare <sharename> <path> "
77                  "[writeable={y|N} [guest_ok={y|N} [<comment>]]\n"
78                  "\t<sharename>      the new share name.\n"
79                  "\t<path>           the path on the filesystem to export.\n"
80                  "\twriteable={y|N}  set \"writeable to \"yes\" or "
81                  "\"no\" (default) on this share.\n"
82                  "\tguest_ok={y|N}   set \"guest ok\" to \"yes\" or "
83                  "\"no\" (default)   on this share.\n"
84                  "\t<comment>        optional comment for the new share.\n");
85         return -1;
86 }
87
88 static int net_conf_delshare_usage(int argc, const char **argv)
89 {
90         d_printf("USAGE: net conf delshare <sharename>\n");
91         return -1;
92 }
93
94 static int net_conf_setparm_usage(int argc, const char **argv)
95 {
96         d_printf("USAGE: net conf setparm <section> <param> <value>\n");
97         return -1;
98 }
99
100 static int net_conf_getparm_usage(int argc, const char **argv)
101 {
102         d_printf("USAGE: net conf getparm <section> <param>\n");
103         return -1;
104 }
105
106 static int net_conf_delparm_usage(int argc, const char **argv)
107 {
108         d_printf("USAGE: net conf delparm <section> <param>\n");
109         return -1;
110 }
111
112
113 /**********************************************************************
114  *
115  * Helper functions
116  *
117  **********************************************************************/
118
119 /**
120  * This functions process a service previously loaded with libsmbconf.
121  */
122 static WERROR import_process_service(struct smbconf_ctx *conf_ctx,
123                                      const char *servicename,
124                                      const uint32_t num_params,
125                                      const char **param_names,
126                                      const char **param_values)
127 {
128         uint32_t idx;
129         WERROR werr = WERR_OK;
130
131         if (opt_testmode) {
132                 d_printf("[%s]\n", servicename);
133         } else {
134                 werr = smbconf_delete_share(conf_ctx, servicename);
135                 if (!W_ERROR_IS_OK(werr)) {
136                         goto done;
137                 }
138         }
139
140         for (idx = 0; idx < num_params; idx ++) {
141                 if (opt_testmode) {
142                         d_printf("\t%s = %s\n", param_names[idx],
143                                  param_values[idx]);
144                 } else {
145                         werr = smbconf_set_parameter(conf_ctx,
146                                                      servicename,
147                                                      param_names[idx],
148                                                      param_values[idx]);
149                         if (!W_ERROR_IS_OK(werr)) {
150                                 goto done;
151                         }
152                 }
153         }
154
155 done:
156         return werr;
157 }
158
159
160 /**********************************************************************
161  *
162  * the main conf functions
163  *
164  **********************************************************************/
165
166 static int net_conf_list(struct smbconf_ctx *conf_ctx,
167                          int argc, const char **argv)
168 {
169         WERROR werr = WERR_OK;
170         int ret = -1;
171         TALLOC_CTX *mem_ctx;
172         uint32_t num_shares;
173         char **share_names;
174         uint32_t *num_params;
175         char ***param_names;
176         char ***param_values;
177         uint32_t share_count, param_count;
178
179         mem_ctx = talloc_stackframe();
180
181         if (argc != 0) {
182                 net_conf_list_usage(argc, argv);
183                 goto done;
184         }
185
186         werr = smbconf_get_config(conf_ctx, mem_ctx, &num_shares, &share_names,
187                                   &num_params, &param_names, &param_values);
188         if (!W_ERROR_IS_OK(werr)) {
189                 d_fprintf(stderr, "Error getting config: %s\n",
190                           dos_errstr(werr));
191                 goto done;
192         }
193
194         for (share_count = 0; share_count < num_shares; share_count++) {
195                 d_printf("[%s]\n", share_names[share_count]);
196                 for (param_count = 0; param_count < num_params[share_count];
197                      param_count++)
198                 {
199                         d_printf("\t%s = %s\n",
200                                  param_names[share_count][param_count],
201                                  param_values[share_count][param_count]);
202                 }
203                 d_printf("\n");
204         }
205
206         ret = 0;
207
208 done:
209         TALLOC_FREE(mem_ctx);
210         return ret;
211 }
212
213 static int net_conf_import(struct smbconf_ctx *conf_ctx,
214                            int argc, const char **argv)
215 {
216         int ret = -1;
217         const char *filename = NULL;
218         const char *servicename = NULL;
219         TALLOC_CTX *mem_ctx;
220         struct smbconf_ctx *txt_ctx;
221         WERROR werr;
222
223         mem_ctx = talloc_stackframe();
224
225         switch (argc) {
226                 case 0:
227                 default:
228                         net_conf_import_usage(argc, argv);
229                         goto done;
230                 case 2:
231                         servicename = argv[1];
232                 case 1:
233                         filename = argv[0];
234                         break;
235         }
236
237         DEBUG(3,("net_conf_import: reading configuration from file %s.\n",
238                 filename));
239
240         werr = smbconf_init_txt_simple(mem_ctx, &txt_ctx, filename);
241         if (!W_ERROR_IS_OK(werr)) {
242                 goto done;
243         }
244
245         if (opt_testmode) {
246                 d_printf("\nTEST MODE - "
247                          "would import the following configuration:\n\n");
248         }
249
250         if (servicename != NULL) {
251                 char **param_names, **param_values;
252                 uint32_t num_params;
253
254                 werr = smbconf_get_share(txt_ctx, mem_ctx,
255                                          servicename,
256                                          &num_params,
257                                          &param_names,
258                                          &param_values);
259                 if (!W_ERROR_IS_OK(werr)) {
260                         goto done;
261                 }
262                 werr = import_process_service(conf_ctx,
263                                               servicename,
264                                               num_params,
265                                               (const char **)param_names,
266                                               (const char **)param_values);
267                 if (!W_ERROR_IS_OK(werr)) {
268                         goto done;
269                 }
270         } else {
271                 char **share_names, ***param_names, ***param_values;
272                 uint32_t num_shares, *num_params, sidx;
273
274                 werr = smbconf_get_config(txt_ctx, mem_ctx,
275                                 &num_shares, &share_names,
276                                 &num_params, &param_names, &param_values);
277                 if (!W_ERROR_IS_OK(werr)) {
278                         goto done;
279                 }
280                 for (sidx = 0; sidx < num_shares; sidx++) {
281                         werr = import_process_service(conf_ctx,
282                                         share_names[sidx],
283                                         num_params[sidx],
284                                         (const char **)param_names[sidx],
285                                         (const char **)param_values[sidx]);
286                         if (!W_ERROR_IS_OK(werr)) {
287                                 goto done;
288                         }
289                 }
290         }
291
292         ret = 0;
293
294 done:
295         TALLOC_FREE(mem_ctx);
296         return ret;
297 }
298
299 static int net_conf_listshares(struct smbconf_ctx *conf_ctx,
300                                int argc, const char **argv)
301 {
302         WERROR werr = WERR_OK;
303         int ret = -1;
304         uint32_t count, num_shares = 0;
305         char **share_names = NULL;
306         TALLOC_CTX *mem_ctx;
307
308         mem_ctx = talloc_stackframe();
309
310         if (argc != 0) {
311                 net_conf_listshares_usage(argc, argv);
312                 goto done;
313         }
314
315         werr = smbconf_get_share_names(conf_ctx, mem_ctx, &num_shares,
316                                        &share_names);
317         if (!W_ERROR_IS_OK(werr)) {
318                 goto done;
319         }
320
321         for (count = 0; count < num_shares; count++)
322         {
323                 d_printf("%s\n", share_names[count]);
324         }
325
326         ret = 0;
327
328 done:
329         TALLOC_FREE(mem_ctx);
330         return ret;
331 }
332
333 static int net_conf_drop(struct smbconf_ctx *conf_ctx,
334                          int argc, const char **argv)
335 {
336         int ret = -1;
337         WERROR werr;
338
339         if (argc != 0) {
340                 net_conf_drop_usage(argc, argv);
341                 goto done;
342         }
343
344         werr = smbconf_drop(conf_ctx);
345         if (!W_ERROR_IS_OK(werr)) {
346                 d_fprintf(stderr, "Error deleting configuration: %s\n",
347                           dos_errstr(werr));
348                 goto done;
349         }
350
351         ret = 0;
352
353 done:
354         return ret;
355 }
356
357 static int net_conf_showshare(struct smbconf_ctx *conf_ctx,
358                               int argc, const char **argv)
359 {
360         int ret = -1;
361         WERROR werr = WERR_OK;
362         const char *sharename = NULL;
363         TALLOC_CTX *mem_ctx;
364         uint32_t num_params;
365         uint32_t count;
366         char **param_names;
367         char **param_values;
368
369         mem_ctx = talloc_stackframe();
370
371         if (argc != 1) {
372                 net_conf_showshare_usage(argc, argv);
373                 goto done;
374         }
375
376         sharename = argv[0];
377
378         werr = smbconf_get_share(conf_ctx, mem_ctx, sharename, &num_params,
379                                  &param_names, &param_values);
380         if (!W_ERROR_IS_OK(werr)) {
381                 d_printf("error getting share parameters: %s\n",
382                          dos_errstr(werr));
383                 goto done;
384         }
385
386         d_printf("[%s]\n", sharename);
387
388         for (count = 0; count < num_params; count++) {
389                 d_printf("\t%s = %s\n", param_names[count],
390                          param_values[count]);
391         }
392
393         ret = 0;
394
395 done:
396         TALLOC_FREE(mem_ctx);
397         return ret;
398 }
399
400 /**
401  * Add a share, with a couple of standard parameters, partly optional.
402  *
403  * This is a high level utility function of the net conf utility,
404  * not a direct frontend to the smbconf API.
405  */
406 static int net_conf_addshare(struct smbconf_ctx *conf_ctx,
407                              int argc, const char **argv)
408 {
409         int ret = -1;
410         WERROR werr = WERR_OK;
411         char *sharename = NULL;
412         const char *path = NULL;
413         const char *comment = NULL;
414         const char *guest_ok = "no";
415         const char *writeable = "no";
416         SMB_STRUCT_STAT sbuf;
417
418         switch (argc) {
419                 case 0:
420                 case 1:
421                 default:
422                         net_conf_addshare_usage(argc, argv);
423                         goto done;
424                 case 5:
425                         comment = argv[4];
426                 case 4:
427                         if (!strnequal(argv[3], "guest_ok=", 9)) {
428                                 net_conf_addshare_usage(argc, argv);
429                                 goto done;
430                         }
431                         switch (argv[3][9]) {
432                                 case 'y':
433                                 case 'Y':
434                                         guest_ok = "yes";
435                                         break;
436                                 case 'n':
437                                 case 'N':
438                                         guest_ok = "no";
439                                         break;
440                                 default:
441                                         net_conf_addshare_usage(argc, argv);
442                                         goto done;
443                         }
444                 case 3:
445                         if (!strnequal(argv[2], "writeable=", 10)) {
446                                 net_conf_addshare_usage(argc, argv);
447                                 goto done;
448                         }
449                         switch (argv[2][10]) {
450                                 case 'y':
451                                 case 'Y':
452                                         writeable = "yes";
453                                         break;
454                                 case 'n':
455                                 case 'N':
456                                         writeable = "no";
457                                         break;
458                                 default:
459                                         net_conf_addshare_usage(argc, argv);
460                                         goto done;
461                         }
462                 case 2:
463                         path = argv[1];
464                         sharename = strdup_lower(argv[0]);
465                         break;
466         }
467
468         /*
469          * validate arguments
470          */
471
472         /* validate share name */
473
474         if (!validate_net_name(sharename, INVALID_SHARENAME_CHARS,
475                                strlen(sharename)))
476         {
477                 d_fprintf(stderr, "ERROR: share name %s contains "
478                         "invalid characters (any of %s)\n",
479                         sharename, INVALID_SHARENAME_CHARS);
480                 goto done;
481         }
482
483         if (getpwnam(sharename)) {
484                 d_fprintf(stderr, "ERROR: share name %s is already a valid "
485                           "system user name.\n", sharename);
486                 goto done;
487         }
488
489         if (strequal(sharename, GLOBAL_NAME)) {
490                 d_fprintf(stderr,
491                           "ERROR: 'global' is not a valid share name.\n");
492                 goto done;
493         }
494
495         if (smbconf_share_exists(conf_ctx, sharename)) {
496                 d_fprintf(stderr, "ERROR: share %s already exists.\n",
497                           sharename);
498                 goto done;
499         }
500
501         /* validate path */
502
503         if (path[0] != '/') {
504                 d_fprintf(stderr,
505                           "Error: path '%s' is not an absolute path.\n",
506                           path);
507                 goto done;
508         }
509
510         if (sys_stat(path, &sbuf) != 0) {
511                 d_fprintf(stderr,
512                           "ERROR: cannot stat path '%s' to ensure "
513                           "this is a directory.\n"
514                           "Error was '%s'.\n",
515                           path, strerror(errno));
516                 goto done;
517         }
518
519         if (!S_ISDIR(sbuf.st_mode)) {
520                 d_fprintf(stderr,
521                           "ERROR: path '%s' is not a directory.\n",
522                           path);
523                 goto done;
524         }
525
526         /*
527          * create the share
528          */
529
530         werr = smbconf_create_share(conf_ctx, sharename);
531         if (!W_ERROR_IS_OK(werr)) {
532                 d_fprintf(stderr, "Error creating share %s: %s\n",
533                           sharename, dos_errstr(werr));
534                 goto done;
535         }
536
537         /*
538          * fill the share with parameters
539          */
540
541         werr = smbconf_set_parameter(conf_ctx, sharename, "path", path);
542         if (!W_ERROR_IS_OK(werr)) {
543                 d_fprintf(stderr, "Error setting parameter %s: %s\n",
544                           "path", dos_errstr(werr));
545                 goto done;
546         }
547
548         if (comment != NULL) {
549                 werr = smbconf_set_parameter(conf_ctx, sharename, "comment",
550                                              comment);
551                 if (!W_ERROR_IS_OK(werr)) {
552                         d_fprintf(stderr, "Error setting parameter %s: %s\n",
553                                   "comment", dos_errstr(werr));
554                         goto done;
555                 }
556         }
557
558         werr = smbconf_set_parameter(conf_ctx, sharename, "guest ok", guest_ok);
559         if (!W_ERROR_IS_OK(werr)) {
560                 d_fprintf(stderr, "Error setting parameter %s: %s\n",
561                           "'guest ok'", dos_errstr(werr));
562                 goto done;
563         }
564
565         werr = smbconf_set_parameter(conf_ctx, sharename, "writeable",
566                                      writeable);
567         if (!W_ERROR_IS_OK(werr)) {
568                 d_fprintf(stderr, "Error setting parameter %s: %s\n",
569                           "writeable", dos_errstr(werr));
570                 goto done;
571         }
572
573         ret = 0;
574
575 done:
576         SAFE_FREE(sharename);
577         return ret;
578 }
579
580 static int net_conf_delshare(struct smbconf_ctx *conf_ctx,
581                              int argc, const char **argv)
582 {
583         int ret = -1;
584         const char *sharename = NULL;
585         WERROR werr = WERR_OK;
586
587         if (argc != 1) {
588                 net_conf_delshare_usage(argc, argv);
589                 goto done;
590         }
591         sharename = argv[0];
592
593         werr = smbconf_delete_share(conf_ctx, sharename);
594         if (!W_ERROR_IS_OK(werr)) {
595                 d_fprintf(stderr, "Error deleting share %s: %s\n",
596                           sharename, dos_errstr(werr));
597                 goto done;
598         }
599
600         ret = 0;
601 done:
602         return ret;
603 }
604
605 static int net_conf_setparm(struct smbconf_ctx *conf_ctx,
606                             int argc, const char **argv)
607 {
608         int ret = -1;
609         WERROR werr = WERR_OK;
610         char *service = NULL;
611         char *param = NULL;
612         const char *value_str = NULL;
613
614         if (argc != 3) {
615                 net_conf_setparm_usage(argc, argv);
616                 goto done;
617         }
618         service = strdup_lower(argv[0]);
619         param = strdup_lower(argv[1]);
620         value_str = argv[2];
621
622         if (!smbconf_share_exists(conf_ctx, service)) {
623                 werr = smbconf_create_share(conf_ctx, service);
624                 if (!W_ERROR_IS_OK(werr)) {
625                         d_fprintf(stderr, "Error creating share '%s': %s\n",
626                                   service, dos_errstr(werr));
627                         goto done;
628                 }
629         }
630
631         werr = smbconf_set_parameter(conf_ctx, service, param, value_str);
632
633         if (!W_ERROR_IS_OK(werr)) {
634                 d_fprintf(stderr, "Error setting value '%s': %s\n",
635                           param, dos_errstr(werr));
636                 goto done;
637         }
638
639         ret = 0;
640
641 done:
642         SAFE_FREE(service);
643         SAFE_FREE(param);
644         return ret;
645 }
646
647 static int net_conf_getparm(struct smbconf_ctx *conf_ctx,
648                             int argc, const char **argv)
649 {
650         int ret = -1;
651         WERROR werr = WERR_OK;
652         char *service = NULL;
653         char *param = NULL;
654         char *valstr = NULL;
655         TALLOC_CTX *mem_ctx;
656
657         mem_ctx = talloc_stackframe();
658
659         if (argc != 2) {
660                 net_conf_getparm_usage(argc, argv);
661                 goto done;
662         }
663         service = strdup_lower(argv[0]);
664         param = strdup_lower(argv[1]);
665
666         werr = smbconf_get_parameter(conf_ctx, mem_ctx, service, param, &valstr);
667
668         if (W_ERROR_EQUAL(werr, WERR_NO_SUCH_SERVICE)) {
669                 d_fprintf(stderr,
670                           "Error: given service '%s' does not exist.\n",
671                           service);
672                 goto done;
673         } else if (W_ERROR_EQUAL(werr, WERR_INVALID_PARAM)) {
674                 d_fprintf(stderr,
675                           "Error: given parameter '%s' is not set.\n",
676                           param);
677                 goto done;
678         } else if (!W_ERROR_IS_OK(werr)) {
679                 d_fprintf(stderr, "Error getting value '%s': %s.\n",
680                           param, dos_errstr(werr));
681                 goto done;
682         }
683
684         d_printf("%s\n", valstr);
685
686         ret = 0;
687 done:
688         SAFE_FREE(service);
689         SAFE_FREE(param);
690         TALLOC_FREE(mem_ctx);
691         return ret;
692 }
693
694 static int net_conf_delparm(struct smbconf_ctx *conf_ctx,
695                             int argc, const char **argv)
696 {
697         int ret = -1;
698         WERROR werr = WERR_OK;
699         char *service = NULL;
700         char *param = NULL;
701
702         if (argc != 2) {
703                 net_conf_delparm_usage(argc, argv);
704                 goto done;
705         }
706         service = strdup_lower(argv[0]);
707         param = strdup_lower(argv[1]);
708
709         werr = smbconf_delete_parameter(conf_ctx, service, param);
710
711         if (W_ERROR_EQUAL(werr, WERR_NO_SUCH_SERVICE)) {
712                 d_fprintf(stderr,
713                           "Error: given service '%s' does not exist.\n",
714                           service);
715                 goto done;
716         } else if (W_ERROR_EQUAL(werr, WERR_INVALID_PARAM)) {
717                 d_fprintf(stderr,
718                           "Error: given parameter '%s' is not set.\n",
719                           param);
720                 goto done;
721         } else if (!W_ERROR_IS_OK(werr)) {
722                 d_fprintf(stderr, "Error deleting value '%s': %s.\n",
723                           param, dos_errstr(werr));
724                 goto done;
725         }
726
727         ret = 0;
728
729 done:
730         SAFE_FREE(service);
731         SAFE_FREE(param);
732         return ret;
733 }
734
735
736 /**********************************************************************
737  *
738  * Wrapper and net_conf_run_function mechanism.
739  *
740  **********************************************************************/
741
742 /**
743  * Wrapper function to call the main conf functions.
744  * The wrapper calls handles opening and closing of the
745  * configuration.
746  */
747 static int net_conf_wrap_function(int (*fn)(struct smbconf_ctx *,
748                                             int, const char **),
749                                   int argc, const char **argv)
750 {
751         WERROR werr;
752         TALLOC_CTX *mem_ctx = talloc_stackframe();
753         struct smbconf_ctx *conf_ctx;
754         int ret = -1;
755
756         werr = smbconf_init_reg(mem_ctx, &conf_ctx, NULL);
757
758         if (!W_ERROR_IS_OK(werr)) {
759                 return -1;
760         }
761
762         ret = fn(conf_ctx, argc, argv);
763
764         smbconf_shutdown(conf_ctx);
765
766         return ret;
767 }
768
769 /*
770  * We need a functable struct of our own, because the
771  * functions are called through a wrapper that handles
772  * the opening and closing of the configuration, and so on.
773  */
774 struct conf_functable {
775         const char *funcname;
776         int (*fn)(struct smbconf_ctx *ctx, int argc, const char **argv);
777         const char *helptext;
778 };
779
780 /**
781  * This imitates net_run_function2 but calls the main functions
782  * through the wrapper net_conf_wrap_function().
783  */
784 static int net_conf_run_function(int argc, const char **argv,
785                                  const char *whoami,
786                                  struct conf_functable *table)
787 {
788         int i;
789
790         if (argc != 0) {
791                 for (i=0; table[i].funcname; i++) {
792                         if (StrCaseCmp(argv[0], table[i].funcname) == 0)
793                                 return net_conf_wrap_function(table[i].fn,
794                                                               argc-1,
795                                                               argv+1);
796                 }
797         }
798
799         for (i=0; table[i].funcname; i++) {
800                 d_printf("%s %-15s %s\n", whoami, table[i].funcname,
801                          table[i].helptext);
802         }
803
804         return -1;
805 }
806
807 /*
808  * Entry-point for all the CONF functions.
809  */
810
811 int net_conf(int argc, const char **argv)
812 {
813         int ret = -1;
814         struct conf_functable func_table[] = {
815                 {"list", net_conf_list,
816                  "Dump the complete configuration in smb.conf like format."},
817                 {"import", net_conf_import,
818                  "Import configuration from file in smb.conf format."},
819                 {"listshares", net_conf_listshares,
820                  "List the share names."},
821                 {"drop", net_conf_drop,
822                  "Delete the complete configuration."},
823                 {"showshare", net_conf_showshare,
824                  "Show the definition of a share."},
825                 {"addshare", net_conf_addshare,
826                  "Create a new share."},
827                 {"delshare", net_conf_delshare,
828                  "Delete a share."},
829                 {"setparm", net_conf_setparm,
830                  "Store a parameter."},
831                 {"getparm", net_conf_getparm,
832                  "Retrieve the value of a parameter."},
833                 {"delparm", net_conf_delparm,
834                  "Delete a parameter."},
835                 {NULL, NULL, NULL}
836         };
837
838         ret = net_conf_run_function(argc, argv, "net conf", func_table);
839
840         return ret;
841 }
842