net: Remove globals
[tprouty/samba.git] / source3 / utils / net_rpc_sh_acct.c
index 00a7967f0708df2376912c9aeac7ba1ce419f1b3..15a20891f297c4f1c582647244e25a129f47f83d 100644 (file)
@@ -14,8 +14,8 @@
    GNU General Public License for more details.
    
    You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
 #include "includes.h"
 #include "utils/net.h"
 
  * it has modified, it can return 0 for no change.
  */
 
-static NTSTATUS rpc_sh_acct_do(TALLOC_CTX *mem_ctx,
+static NTSTATUS rpc_sh_acct_do(struct net_context *c,
+                              TALLOC_CTX *mem_ctx,
                               struct rpc_sh_ctx *ctx,
                               struct rpc_pipe_client *pipe_hnd,
                               int argc, const char **argv,
-                              int (*fn)(TALLOC_CTX *mem_ctx,
+                              int (*fn)(struct net_context *c,
+                                         TALLOC_CTX *mem_ctx,
                                          struct rpc_sh_ctx *ctx,
                                          struct samr_DomInfo1 *i1,
                                          struct samr_DomInfo3 *i3,
@@ -100,7 +102,7 @@ static NTSTATUS rpc_sh_acct_do(TALLOC_CTX *mem_ctx,
                goto done;
        }
 
-       store = fn(mem_ctx, ctx, &info1->info1, &info3->info3,
+       store = fn(c, mem_ctx, ctx, &info1->info1, &info3->info3,
                   &info12->info12, argc, argv);
 
        if (store <= 0) {
@@ -144,7 +146,8 @@ static NTSTATUS rpc_sh_acct_do(TALLOC_CTX *mem_ctx,
        return result;
 }
 
-static int account_show(TALLOC_CTX *mem_ctx, struct rpc_sh_ctx *ctx,
+static int account_show(struct net_context *c,
+                       TALLOC_CTX *mem_ctx, struct rpc_sh_ctx *ctx,
                        struct samr_DomInfo1 *i1,
                        struct samr_DomInfo3 *i3,
                        struct samr_DomInfo12 *i12,
@@ -204,15 +207,17 @@ static int account_show(TALLOC_CTX *mem_ctx, struct rpc_sh_ctx *ctx,
        return 0;               /* Don't save */
 }
 
-static NTSTATUS rpc_sh_acct_pol_show(TALLOC_CTX *mem_ctx,
+static NTSTATUS rpc_sh_acct_pol_show(struct net_context *c,
+                                    TALLOC_CTX *mem_ctx,
                                     struct rpc_sh_ctx *ctx,
                                     struct rpc_pipe_client *pipe_hnd,
                                     int argc, const char **argv) {
-       return rpc_sh_acct_do(mem_ctx, ctx, pipe_hnd, argc, argv,
+       return rpc_sh_acct_do(c, mem_ctx, ctx, pipe_hnd, argc, argv,
                              account_show);
 }
 
-static int account_set_badpw(TALLOC_CTX *mem_ctx, struct rpc_sh_ctx *ctx,
+static int account_set_badpw(struct net_context *c,
+                            TALLOC_CTX *mem_ctx, struct rpc_sh_ctx *ctx,
                             struct samr_DomInfo1 *i1,
                             struct samr_DomInfo3 *i3,
                             struct samr_DomInfo12 *i12,
@@ -230,16 +235,18 @@ static int account_set_badpw(TALLOC_CTX *mem_ctx, struct rpc_sh_ctx *ctx,
        return 12;
 }
 
-static NTSTATUS rpc_sh_acct_set_badpw(TALLOC_CTX *mem_ctx,
+static NTSTATUS rpc_sh_acct_set_badpw(struct net_context *c,
+                                     TALLOC_CTX *mem_ctx,
                                      struct rpc_sh_ctx *ctx,
                                      struct rpc_pipe_client *pipe_hnd,
                                      int argc, const char **argv)
 {
-       return rpc_sh_acct_do(mem_ctx, ctx, pipe_hnd, argc, argv,
+       return rpc_sh_acct_do(c, mem_ctx, ctx, pipe_hnd, argc, argv,
                              account_set_badpw);
 }
 
-static int account_set_lockduration(TALLOC_CTX *mem_ctx,
+static int account_set_lockduration(struct net_context *c,
+                                   TALLOC_CTX *mem_ctx,
                                    struct rpc_sh_ctx *ctx,
                                    struct samr_DomInfo1 *i1,
                                    struct samr_DomInfo3 *i3,
@@ -258,16 +265,18 @@ static int account_set_lockduration(TALLOC_CTX *mem_ctx,
        return 12;
 }
 
-static NTSTATUS rpc_sh_acct_set_lockduration(TALLOC_CTX *mem_ctx,
+static NTSTATUS rpc_sh_acct_set_lockduration(struct net_context *c,
+                                            TALLOC_CTX *mem_ctx,
                                             struct rpc_sh_ctx *ctx,
                                             struct rpc_pipe_client *pipe_hnd,
                                             int argc, const char **argv)
 {
-       return rpc_sh_acct_do(mem_ctx, ctx, pipe_hnd, argc, argv,
+       return rpc_sh_acct_do(c, mem_ctx, ctx, pipe_hnd, argc, argv,
                              account_set_lockduration);
 }
 
-static int account_set_resetduration(TALLOC_CTX *mem_ctx,
+static int account_set_resetduration(struct net_context *c,
+                                    TALLOC_CTX *mem_ctx,
                                     struct rpc_sh_ctx *ctx,
                                     struct samr_DomInfo1 *i1,
                                     struct samr_DomInfo3 *i3,
@@ -286,16 +295,18 @@ static int account_set_resetduration(TALLOC_CTX *mem_ctx,
        return 12;
 }
 
-static NTSTATUS rpc_sh_acct_set_resetduration(TALLOC_CTX *mem_ctx,
+static NTSTATUS rpc_sh_acct_set_resetduration(struct net_context *c,
+                                             TALLOC_CTX *mem_ctx,
                                              struct rpc_sh_ctx *ctx,
                                              struct rpc_pipe_client *pipe_hnd,
                                              int argc, const char **argv)
 {
-       return rpc_sh_acct_do(mem_ctx, ctx, pipe_hnd, argc, argv,
+       return rpc_sh_acct_do(c, mem_ctx, ctx, pipe_hnd, argc, argv,
                              account_set_resetduration);
 }
 
-static int account_set_minpwage(TALLOC_CTX *mem_ctx,
+static int account_set_minpwage(struct net_context *c,
+                               TALLOC_CTX *mem_ctx,
                                struct rpc_sh_ctx *ctx,
                                struct samr_DomInfo1 *i1,
                                struct samr_DomInfo3 *i3,
@@ -314,16 +325,18 @@ static int account_set_minpwage(TALLOC_CTX *mem_ctx,
        return 1;
 }
 
-static NTSTATUS rpc_sh_acct_set_minpwage(TALLOC_CTX *mem_ctx,
+static NTSTATUS rpc_sh_acct_set_minpwage(struct net_context *c,
+                                        TALLOC_CTX *mem_ctx,
                                         struct rpc_sh_ctx *ctx,
                                         struct rpc_pipe_client *pipe_hnd,
                                         int argc, const char **argv)
 {
-       return rpc_sh_acct_do(mem_ctx, ctx, pipe_hnd, argc, argv,
+       return rpc_sh_acct_do(c, mem_ctx, ctx, pipe_hnd, argc, argv,
                              account_set_minpwage);
 }
 
-static int account_set_maxpwage(TALLOC_CTX *mem_ctx,
+static int account_set_maxpwage(struct net_context *c,
+                               TALLOC_CTX *mem_ctx,
                                struct rpc_sh_ctx *ctx,
                                struct samr_DomInfo1 *i1,
                                struct samr_DomInfo3 *i3,
@@ -342,16 +355,18 @@ static int account_set_maxpwage(TALLOC_CTX *mem_ctx,
        return 1;
 }
 
-static NTSTATUS rpc_sh_acct_set_maxpwage(TALLOC_CTX *mem_ctx,
+static NTSTATUS rpc_sh_acct_set_maxpwage(struct net_context *c,
+                                        TALLOC_CTX *mem_ctx,
                                         struct rpc_sh_ctx *ctx,
                                         struct rpc_pipe_client *pipe_hnd,
                                         int argc, const char **argv)
 {
-       return rpc_sh_acct_do(mem_ctx, ctx, pipe_hnd, argc, argv,
+       return rpc_sh_acct_do(c, mem_ctx, ctx, pipe_hnd, argc, argv,
                              account_set_maxpwage);
 }
 
-static int account_set_minpwlen(TALLOC_CTX *mem_ctx,
+static int account_set_minpwlen(struct net_context *c,
+                               TALLOC_CTX *mem_ctx,
                                struct rpc_sh_ctx *ctx,
                                struct samr_DomInfo1 *i1,
                                struct samr_DomInfo3 *i3,
@@ -370,16 +385,18 @@ static int account_set_minpwlen(TALLOC_CTX *mem_ctx,
        return 1;
 }
 
-static NTSTATUS rpc_sh_acct_set_minpwlen(TALLOC_CTX *mem_ctx,
+static NTSTATUS rpc_sh_acct_set_minpwlen(struct net_context *c,
+                                        TALLOC_CTX *mem_ctx,
                                         struct rpc_sh_ctx *ctx,
                                         struct rpc_pipe_client *pipe_hnd,
                                         int argc, const char **argv)
 {
-       return rpc_sh_acct_do(mem_ctx, ctx, pipe_hnd, argc, argv,
+       return rpc_sh_acct_do(c, mem_ctx, ctx, pipe_hnd, argc, argv,
                              account_set_minpwlen);
 }
 
-static int account_set_pwhistlen(TALLOC_CTX *mem_ctx,
+static int account_set_pwhistlen(struct net_context *c,
+                                TALLOC_CTX *mem_ctx,
                                 struct rpc_sh_ctx *ctx,
                                 struct samr_DomInfo1 *i1,
                                 struct samr_DomInfo3 *i3,
@@ -398,16 +415,17 @@ static int account_set_pwhistlen(TALLOC_CTX *mem_ctx,
        return 1;
 }
 
-static NTSTATUS rpc_sh_acct_set_pwhistlen(TALLOC_CTX *mem_ctx,
+static NTSTATUS rpc_sh_acct_set_pwhistlen(struct net_context *c,
+                                         TALLOC_CTX *mem_ctx,
                                          struct rpc_sh_ctx *ctx,
                                          struct rpc_pipe_client *pipe_hnd,
                                          int argc, const char **argv)
 {
-       return rpc_sh_acct_do(mem_ctx, ctx, pipe_hnd, argc, argv,
+       return rpc_sh_acct_do(c, mem_ctx, ctx, pipe_hnd, argc, argv,
                              account_set_pwhistlen);
 }
 
-struct rpc_sh_cmd *net_rpc_acct_cmds(TALLOC_CTX *mem_ctx,
+struct rpc_sh_cmd *net_rpc_acct_cmds(struct net_context *c, TALLOC_CTX *mem_ctx,
                                     struct rpc_sh_ctx *ctx)
 {
        static struct rpc_sh_cmd cmds[9] = {