net: Don't crash on invalid command line options.
authorKai Blin <kai@samba.org>
Fri, 20 Jun 2008 22:07:21 +0000 (00:07 +0200)
committerKai Blin <kai@samba.org>
Fri, 20 Jun 2008 22:07:21 +0000 (00:07 +0200)
This backs out the workaround Jerry added in
4c3bfea9f8d238f9100eaa264b9b2941dff5a6dd.
Thanks for the catch.
(This used to be commit 20e0bb4800938863cb0aac1a19473748132043fc)

source3/utils/net.c
source3/utils/net_util.c

index c298fdb461a9aa6d4662359956123dbfbdf5e7e9..d086f947f1bf20ceebcda68c0f80879f8a2f36d4 100644 (file)
@@ -664,6 +664,7 @@ static struct functable net_func[] = {
        /* set default debug level to 0 regardless of what smb.conf sets */
        DEBUGLEVEL_CLASS[DBGC_ALL] = 0;
        dbf = x_stderr;
+       c->private_data = net_func;
 
        pc = poptGetContext(NULL, argc, (const char **) argv, long_options,
                            POPT_CONTEXT_KEEP_FIRST);
@@ -758,7 +759,6 @@ static struct functable net_func[] = {
                c->opt_password = getenv("PASSWD");
        }
 
-       c->private_data = net_func;
        rc = net_run_function(c, argc_new-1, argv_new+1, "net", net_func);
 
        DEBUG(2,("return code = %d\n", rc));
index 8938b9cf014d94713301b8c83337d4287f86a38b..ae1d4ea2b6968549f7e15997b77f267df0941bf7 100644 (file)
@@ -551,13 +551,6 @@ int net_run_function(struct net_context *c, int argc, const char **argv,
 {
        int i;
 
-       if (!table) {
-               d_fprintf(stderr, "Invalid command. Run \"%s\" for more details.\n",
-                         whoami);
-               return 1;
-       }
-
-
        if (argc != 0) {
                for (i=0; table[i].funcname != NULL; i++) {
                        if (StrCaseCmp(argv[0], table[i].funcname) == 0)