net_conf: reformat - re-indent one function call.
[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,
276                                           &share_names,
277                                           &num_params,
278                                           &param_names,
279                                           &param_values);
280                 if (!W_ERROR_IS_OK(werr)) {
281                         goto done;
282                 }
283                 for (sidx = 0; sidx < num_shares; sidx++) {
284                         werr = import_process_service(conf_ctx,
285                                         share_names[sidx],
286                                         num_params[sidx],
287                                         (const char **)param_names[sidx],
288                                         (const char **)param_values[sidx]);
289                         if (!W_ERROR_IS_OK(werr)) {
290                                 goto done;
291                         }
292                 }
293         }
294
295         ret = 0;
296
297 done:
298         TALLOC_FREE(mem_ctx);
299         return ret;
300 }
301
302 static int net_conf_listshares(struct smbconf_ctx *conf_ctx,
303                                int argc, const char **argv)
304 {
305         WERROR werr = WERR_OK;
306         int ret = -1;
307         uint32_t count, num_shares = 0;
308         char **share_names = NULL;
309         TALLOC_CTX *mem_ctx;
310
311         mem_ctx = talloc_stackframe();
312
313         if (argc != 0) {
314                 net_conf_listshares_usage(argc, argv);
315                 goto done;
316         }
317
318         werr = smbconf_get_share_names(conf_ctx, mem_ctx, &num_shares,
319                                        &share_names);
320         if (!W_ERROR_IS_OK(werr)) {
321                 goto done;
322         }
323
324         for (count = 0; count < num_shares; count++)
325         {
326                 d_printf("%s\n", share_names[count]);
327         }
328
329         ret = 0;
330
331 done:
332         TALLOC_FREE(mem_ctx);
333         return ret;
334 }
335
336 static int net_conf_drop(struct smbconf_ctx *conf_ctx,
337                          int argc, const char **argv)
338 {
339         int ret = -1;
340         WERROR werr;
341
342         if (argc != 0) {
343                 net_conf_drop_usage(argc, argv);
344                 goto done;
345         }
346
347         werr = smbconf_drop(conf_ctx);
348         if (!W_ERROR_IS_OK(werr)) {
349                 d_fprintf(stderr, "Error deleting configuration: %s\n",
350                           dos_errstr(werr));
351                 goto done;
352         }
353
354         ret = 0;
355
356 done:
357         return ret;
358 }
359
360 static int net_conf_showshare(struct smbconf_ctx *conf_ctx,
361                               int argc, const char **argv)
362 {
363         int ret = -1;
364         WERROR werr = WERR_OK;
365         const char *sharename = NULL;
366         TALLOC_CTX *mem_ctx;
367         uint32_t num_params;
368         uint32_t count;
369         char **param_names;
370         char **param_values;
371
372         mem_ctx = talloc_stackframe();
373
374         if (argc != 1) {
375                 net_conf_showshare_usage(argc, argv);
376                 goto done;
377         }
378
379         sharename = argv[0];
380
381         werr = smbconf_get_share(conf_ctx, mem_ctx, sharename, &num_params,
382                                  &param_names, &param_values);
383         if (!W_ERROR_IS_OK(werr)) {
384                 d_printf("error getting share parameters: %s\n",
385                          dos_errstr(werr));
386                 goto done;
387         }
388
389         d_printf("[%s]\n", sharename);
390
391         for (count = 0; count < num_params; count++) {
392                 d_printf("\t%s = %s\n", param_names[count],
393                          param_values[count]);
394         }
395
396         ret = 0;
397
398 done:
399         TALLOC_FREE(mem_ctx);
400         return ret;
401 }
402
403 /**
404  * Add a share, with a couple of standard parameters, partly optional.
405  *
406  * This is a high level utility function of the net conf utility,
407  * not a direct frontend to the smbconf API.
408  */
409 static int net_conf_addshare(struct smbconf_ctx *conf_ctx,
410                              int argc, const char **argv)
411 {
412         int ret = -1;
413         WERROR werr = WERR_OK;
414         char *sharename = NULL;
415         const char *path = NULL;
416         const char *comment = NULL;
417         const char *guest_ok = "no";
418         const char *writeable = "no";
419         SMB_STRUCT_STAT sbuf;
420
421         switch (argc) {
422                 case 0:
423                 case 1:
424                 default:
425                         net_conf_addshare_usage(argc, argv);
426                         goto done;
427                 case 5:
428                         comment = argv[4];
429                 case 4:
430                         if (!strnequal(argv[3], "guest_ok=", 9)) {
431                                 net_conf_addshare_usage(argc, argv);
432                                 goto done;
433                         }
434                         switch (argv[3][9]) {
435                                 case 'y':
436                                 case 'Y':
437                                         guest_ok = "yes";
438                                         break;
439                                 case 'n':
440                                 case 'N':
441                                         guest_ok = "no";
442                                         break;
443                                 default:
444                                         net_conf_addshare_usage(argc, argv);
445                                         goto done;
446                         }
447                 case 3:
448                         if (!strnequal(argv[2], "writeable=", 10)) {
449                                 net_conf_addshare_usage(argc, argv);
450                                 goto done;
451                         }
452                         switch (argv[2][10]) {
453                                 case 'y':
454                                 case 'Y':
455                                         writeable = "yes";
456                                         break;
457                                 case 'n':
458                                 case 'N':
459                                         writeable = "no";
460                                         break;
461                                 default:
462                                         net_conf_addshare_usage(argc, argv);
463                                         goto done;
464                         }
465                 case 2:
466                         path = argv[1];
467                         sharename = strdup_lower(argv[0]);
468                         break;
469         }
470
471         /*
472          * validate arguments
473          */
474
475         /* validate share name */
476
477         if (!validate_net_name(sharename, INVALID_SHARENAME_CHARS,
478                                strlen(sharename)))
479         {
480                 d_fprintf(stderr, "ERROR: share name %s contains "
481                         "invalid characters (any of %s)\n",
482                         sharename, INVALID_SHARENAME_CHARS);
483                 goto done;
484         }
485
486         if (getpwnam(sharename)) {
487                 d_fprintf(stderr, "ERROR: share name %s is already a valid "
488                           "system user name.\n", sharename);
489                 goto done;
490         }
491
492         if (strequal(sharename, GLOBAL_NAME)) {
493                 d_fprintf(stderr,
494                           "ERROR: 'global' is not a valid share name.\n");
495                 goto done;
496         }
497
498         if (smbconf_share_exists(conf_ctx, sharename)) {
499                 d_fprintf(stderr, "ERROR: share %s already exists.\n",
500                           sharename);
501                 goto done;
502         }
503
504         /* validate path */
505
506         if (path[0] != '/') {
507                 d_fprintf(stderr,
508                           "Error: path '%s' is not an absolute path.\n",
509                           path);
510                 goto done;
511         }
512
513         if (sys_stat(path, &sbuf) != 0) {
514                 d_fprintf(stderr,
515                           "ERROR: cannot stat path '%s' to ensure "
516                           "this is a directory.\n"
517                           "Error was '%s'.\n",
518                           path, strerror(errno));
519                 goto done;
520         }
521
522         if (!S_ISDIR(sbuf.st_mode)) {
523                 d_fprintf(stderr,
524                           "ERROR: path '%s' is not a directory.\n",
525                           path);
526                 goto done;
527         }
528
529         /*
530          * create the share
531          */
532
533         werr = smbconf_create_share(conf_ctx, sharename);
534         if (!W_ERROR_IS_OK(werr)) {
535                 d_fprintf(stderr, "Error creating share %s: %s\n",
536                           sharename, dos_errstr(werr));
537                 goto done;
538         }
539
540         /*
541          * fill the share with parameters
542          */
543
544         werr = smbconf_set_parameter(conf_ctx, sharename, "path", path);
545         if (!W_ERROR_IS_OK(werr)) {
546                 d_fprintf(stderr, "Error setting parameter %s: %s\n",
547                           "path", dos_errstr(werr));
548                 goto done;
549         }
550
551         if (comment != NULL) {
552                 werr = smbconf_set_parameter(conf_ctx, sharename, "comment",
553                                              comment);
554                 if (!W_ERROR_IS_OK(werr)) {
555                         d_fprintf(stderr, "Error setting parameter %s: %s\n",
556                                   "comment", dos_errstr(werr));
557                         goto done;
558                 }
559         }
560
561         werr = smbconf_set_parameter(conf_ctx, sharename, "guest ok", guest_ok);
562         if (!W_ERROR_IS_OK(werr)) {
563                 d_fprintf(stderr, "Error setting parameter %s: %s\n",
564                           "'guest ok'", dos_errstr(werr));
565                 goto done;
566         }
567
568         werr = smbconf_set_parameter(conf_ctx, sharename, "writeable",
569                                      writeable);
570         if (!W_ERROR_IS_OK(werr)) {
571                 d_fprintf(stderr, "Error setting parameter %s: %s\n",
572                           "writeable", dos_errstr(werr));
573                 goto done;
574         }
575
576         ret = 0;
577
578 done:
579         SAFE_FREE(sharename);
580         return ret;
581 }
582
583 static int net_conf_delshare(struct smbconf_ctx *conf_ctx,
584                              int argc, const char **argv)
585 {
586         int ret = -1;
587         const char *sharename = NULL;
588         WERROR werr = WERR_OK;
589
590         if (argc != 1) {
591                 net_conf_delshare_usage(argc, argv);
592                 goto done;
593         }
594         sharename = argv[0];
595
596         werr = smbconf_delete_share(conf_ctx, sharename);
597         if (!W_ERROR_IS_OK(werr)) {
598                 d_fprintf(stderr, "Error deleting share %s: %s\n",
599                           sharename, dos_errstr(werr));
600                 goto done;
601         }
602
603         ret = 0;
604 done:
605         return ret;
606 }
607
608 static int net_conf_setparm(struct smbconf_ctx *conf_ctx,
609                             int argc, const char **argv)
610 {
611         int ret = -1;
612         WERROR werr = WERR_OK;
613         char *service = NULL;
614         char *param = NULL;
615         const char *value_str = NULL;
616
617         if (argc != 3) {
618                 net_conf_setparm_usage(argc, argv);
619                 goto done;
620         }
621         service = strdup_lower(argv[0]);
622         param = strdup_lower(argv[1]);
623         value_str = argv[2];
624
625         if (!smbconf_share_exists(conf_ctx, service)) {
626                 werr = smbconf_create_share(conf_ctx, service);
627                 if (!W_ERROR_IS_OK(werr)) {
628                         d_fprintf(stderr, "Error creating share '%s': %s\n",
629                                   service, dos_errstr(werr));
630                         goto done;
631                 }
632         }
633
634         werr = smbconf_set_parameter(conf_ctx, service, param, value_str);
635
636         if (!W_ERROR_IS_OK(werr)) {
637                 d_fprintf(stderr, "Error setting value '%s': %s\n",
638                           param, dos_errstr(werr));
639                 goto done;
640         }
641
642         ret = 0;
643
644 done:
645         SAFE_FREE(service);
646         SAFE_FREE(param);
647         return ret;
648 }
649
650 static int net_conf_getparm(struct smbconf_ctx *conf_ctx,
651                             int argc, const char **argv)
652 {
653         int ret = -1;
654         WERROR werr = WERR_OK;
655         char *service = NULL;
656         char *param = NULL;
657         char *valstr = NULL;
658         TALLOC_CTX *mem_ctx;
659
660         mem_ctx = talloc_stackframe();
661
662         if (argc != 2) {
663                 net_conf_getparm_usage(argc, argv);
664                 goto done;
665         }
666         service = strdup_lower(argv[0]);
667         param = strdup_lower(argv[1]);
668
669         werr = smbconf_get_parameter(conf_ctx, mem_ctx, service, param, &valstr);
670
671         if (W_ERROR_EQUAL(werr, WERR_NO_SUCH_SERVICE)) {
672                 d_fprintf(stderr,
673                           "Error: given service '%s' does not exist.\n",
674                           service);
675                 goto done;
676         } else if (W_ERROR_EQUAL(werr, WERR_INVALID_PARAM)) {
677                 d_fprintf(stderr,
678                           "Error: given parameter '%s' is not set.\n",
679                           param);
680                 goto done;
681         } else if (!W_ERROR_IS_OK(werr)) {
682                 d_fprintf(stderr, "Error getting value '%s': %s.\n",
683                           param, dos_errstr(werr));
684                 goto done;
685         }
686
687         d_printf("%s\n", valstr);
688
689         ret = 0;
690 done:
691         SAFE_FREE(service);
692         SAFE_FREE(param);
693         TALLOC_FREE(mem_ctx);
694         return ret;
695 }
696
697 static int net_conf_delparm(struct smbconf_ctx *conf_ctx,
698                             int argc, const char **argv)
699 {
700         int ret = -1;
701         WERROR werr = WERR_OK;
702         char *service = NULL;
703         char *param = NULL;
704
705         if (argc != 2) {
706                 net_conf_delparm_usage(argc, argv);
707                 goto done;
708         }
709         service = strdup_lower(argv[0]);
710         param = strdup_lower(argv[1]);
711
712         werr = smbconf_delete_parameter(conf_ctx, service, param);
713
714         if (W_ERROR_EQUAL(werr, WERR_NO_SUCH_SERVICE)) {
715                 d_fprintf(stderr,
716                           "Error: given service '%s' does not exist.\n",
717                           service);
718                 goto done;
719         } else if (W_ERROR_EQUAL(werr, WERR_INVALID_PARAM)) {
720                 d_fprintf(stderr,
721                           "Error: given parameter '%s' is not set.\n",
722                           param);
723                 goto done;
724         } else if (!W_ERROR_IS_OK(werr)) {
725                 d_fprintf(stderr, "Error deleting value '%s': %s.\n",
726                           param, dos_errstr(werr));
727                 goto done;
728         }
729
730         ret = 0;
731
732 done:
733         SAFE_FREE(service);
734         SAFE_FREE(param);
735         return ret;
736 }
737
738
739 /**********************************************************************
740  *
741  * Wrapper and net_conf_run_function mechanism.
742  *
743  **********************************************************************/
744
745 /**
746  * Wrapper function to call the main conf functions.
747  * The wrapper calls handles opening and closing of the
748  * configuration.
749  */
750 static int net_conf_wrap_function(int (*fn)(struct smbconf_ctx *,
751                                             int, const char **),
752                                   int argc, const char **argv)
753 {
754         WERROR werr;
755         TALLOC_CTX *mem_ctx = talloc_stackframe();
756         struct smbconf_ctx *conf_ctx;
757         int ret = -1;
758
759         werr = smbconf_init_reg(mem_ctx, &conf_ctx, NULL);
760
761         if (!W_ERROR_IS_OK(werr)) {
762                 return -1;
763         }
764
765         ret = fn(conf_ctx, argc, argv);
766
767         smbconf_shutdown(conf_ctx);
768
769         return ret;
770 }
771
772 /*
773  * We need a functable struct of our own, because the
774  * functions are called through a wrapper that handles
775  * the opening and closing of the configuration, and so on.
776  */
777 struct conf_functable {
778         const char *funcname;
779         int (*fn)(struct smbconf_ctx *ctx, int argc, const char **argv);
780         const char *helptext;
781 };
782
783 /**
784  * This imitates net_run_function2 but calls the main functions
785  * through the wrapper net_conf_wrap_function().
786  */
787 static int net_conf_run_function(int argc, const char **argv,
788                                  const char *whoami,
789                                  struct conf_functable *table)
790 {
791         int i;
792
793         if (argc != 0) {
794                 for (i=0; table[i].funcname; i++) {
795                         if (StrCaseCmp(argv[0], table[i].funcname) == 0)
796                                 return net_conf_wrap_function(table[i].fn,
797                                                               argc-1,
798                                                               argv+1);
799                 }
800         }
801
802         for (i=0; table[i].funcname; i++) {
803                 d_printf("%s %-15s %s\n", whoami, table[i].funcname,
804                          table[i].helptext);
805         }
806
807         return -1;
808 }
809
810 /*
811  * Entry-point for all the CONF functions.
812  */
813
814 int net_conf(int argc, const char **argv)
815 {
816         int ret = -1;
817         struct conf_functable func_table[] = {
818                 {"list", net_conf_list,
819                  "Dump the complete configuration in smb.conf like format."},
820                 {"import", net_conf_import,
821                  "Import configuration from file in smb.conf format."},
822                 {"listshares", net_conf_listshares,
823                  "List the share names."},
824                 {"drop", net_conf_drop,
825                  "Delete the complete configuration."},
826                 {"showshare", net_conf_showshare,
827                  "Show the definition of a share."},
828                 {"addshare", net_conf_addshare,
829                  "Create a new share."},
830                 {"delshare", net_conf_delshare,
831                  "Delete a share."},
832                 {"setparm", net_conf_setparm,
833                  "Store a parameter."},
834                 {"getparm", net_conf_getparm,
835                  "Retrieve the value of a parameter."},
836                 {"delparm", net_conf_delparm,
837                  "Delete a parameter."},
838                 {NULL, NULL, NULL}
839         };
840
841         ret = net_conf_run_function(argc, argv, "net conf", func_table);
842
843         return ret;
844 }
845