LCOV - code coverage report
Current view: top level - source3/utils - net_user.c (source / functions) Hit Total Coverage
Test: coverage report for master 2f515e9b Lines: 5 22 22.7 %
Date: 2024-04-21 15:09:00 Functions: 1 2 50.0 %

          Line data    Source code
       1             : /*
       2             :    Samba Unix/Linux SMB client library
       3             :    net user commands
       4             :    Copyright (C) 2002  Jim McDonough  (jmcd@us.ibm.com)
       5             :    Copyright (C) 2002  Andrew Tridgell  (tridge@samba.org)
       6             :    Copyright (C) 2008  Kai Blin  (kai@samba.org)
       7             : 
       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.
      12             : 
      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.
      17             : 
      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/>.
      20             : */
      21             : 
      22             : #include "includes.h"
      23             : #include "utils/net.h"
      24             : 
      25           0 : int net_user_usage(struct net_context *c, int argc, const char **argv)
      26             : {
      27           0 :         d_printf(_("\nnet [<method>] user [misc. options] [targets]"
      28             :                    "\n\tList users\n\n"));
      29           0 :         d_printf(_("net [<method>] user DELETE <name> [misc. options] [targets]"
      30             :                    "\n\tDelete specified user\n"));
      31           0 :         d_printf(_("\nnet [<method>] user INFO <name> [misc. options] [targets]"
      32             :                    "\n\tList the domain groups of the specified user\n"));
      33           0 :         d_printf(_("\nnet [<method>] user ADD <name> [password] [-c container] "
      34             :                    "[-F user flags] [misc. options]"
      35             :                    " [targets]\n\tAdd specified user\n"));
      36           0 :         d_printf(_("\nnet [<method>] user RENAME <oldusername> <newusername>"
      37             :                    " [targets]\n\tRename specified user\n\n"));
      38             : 
      39           0 :         net_common_methods_usage(c, argc, argv);
      40           0 :         net_common_flags_usage(c, argc, argv);
      41           0 :         d_printf(_("\t-C or --comment=<comment>\tdescriptive comment "
      42             :                    "(for add only)\n"));
      43           0 :         d_printf(_("\t-c or --container=<container>\tLDAP container, defaults "
      44             :                    "to cn=Users (for add in ADS only)\n"));
      45           0 :         return -1;
      46             : }
      47             : 
      48           8 : int net_user(struct net_context *c, int argc, const char **argv)
      49             : {
      50           8 :         if (argc < 1)
      51           0 :                 return net_user_usage(c, argc, argv);
      52             : 
      53           8 :         if (strcasecmp_m(argv[0], "HELP") == 0) {
      54           0 :                 net_user_usage(c, argc, argv);
      55           0 :                 return 0;
      56             :         }
      57             : 
      58           8 :         if (net_ads_check(c) == 0)
      59           8 :                 return net_ads_user(c, argc, argv);
      60             : 
      61             :         /* if server is not specified, default to PDC? */
      62           0 :         if (net_rpc_check(c, NET_FLAGS_PDC))
      63           0 :                 return net_rpc_user(c, argc, argv);
      64             : 
      65           0 :         return net_rap_user(c, argc, argv);
      66             : }
      67             : 

Generated by: LCOV version 1.14