diff options
author | Günther Deschner <gd@samba.org> | 2011-03-17 21:53:19 +0100 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2011-03-18 01:24:06 +0100 |
commit | f91bc89a52ea9c21dab4f6f93ac04260874a1622 (patch) | |
tree | 9db3e38e95dfcf466e72a42f5cb7752af1bb330a | |
parent | dd5460c2e5f8c074bffdd45314fea506d7dbbc8a (diff) | |
download | samba-f91bc89a52ea9c21dab4f6f93ac04260874a1622.tar.gz samba-f91bc89a52ea9c21dab4f6f93ac04260874a1622.tar.bz2 samba-f91bc89a52ea9c21dab4f6f93ac04260874a1622.zip |
s4-libcli/rap: add smbcli_rap_netuseradd().
Guenther
-rw-r--r-- | source4/libcli/rap/rap.c | 59 |
1 files changed, 58 insertions, 1 deletions
diff --git a/source4/libcli/rap/rap.c b/source4/libcli/rap/rap.c index 7217ac036b..1ad02346aa 100644 --- a/source4/libcli/rap/rap.c +++ b/source4/libcli/rap/rap.c @@ -4,7 +4,7 @@ Copyright (C) Volker Lendecke 2004 Copyright (C) Tim Potter 2005 Copyright (C) Jelmer Vernooij 2007 - Copyright (C) Guenther Deschner 2010 + Copyright (C) Guenther Deschner 2010-2011 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -1471,3 +1471,60 @@ NTSTATUS smbcli_rap_netsessionenum(struct smbcli_tree *tree, talloc_free(call); return result; } + +NTSTATUS smbcli_rap_netuseradd(struct smbcli_tree *tree, + TALLOC_CTX *mem_ctx, + struct rap_NetUserAdd *r) +{ + struct rap_call *call; + NTSTATUS result = NT_STATUS_UNSUCCESSFUL; + + if (!(call = new_rap_cli_call(mem_ctx, RAP_WUserAdd2))) { + return NT_STATUS_NO_MEMORY; + } + + rap_cli_push_word(call, r->in.level); + rap_cli_push_sendbuf(call, r->in.bufsize); + rap_cli_push_word(call, r->in.pwdlength); + rap_cli_push_word(call, r->in.unknown); + + switch (r->in.level) { + case 1: + rap_cli_expect_format(call, "B21BB16DWzzWz"); + break; + default: + result = NT_STATUS_INVALID_PARAMETER; + break; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(rap_NetUserAdd, r); + } + + NDR_GOTO(ndr_push_set_switch_value(call->ndr_push_data, &r->in.info, r->in.level)); + NDR_GOTO(ndr_push_rap_netuser_info(call->ndr_push_data, NDR_SCALARS|NDR_BUFFERS, &r->in.info)); + + result = rap_cli_do_call(tree, call); + + if (!NT_STATUS_IS_OK(result)) + goto done; + + result = NT_STATUS_INVALID_PARAMETER; + + NDR_GOTO(ndr_pull_rap_status(call->ndr_pull_param, NDR_SCALARS, &r->out.status)); + NDR_GOTO(ndr_pull_uint16(call->ndr_pull_param, NDR_SCALARS, &r->out.convert)); + + result = NT_STATUS_OK; + + if (!NT_STATUS_IS_OK(result)) { + goto done; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(rap_NetUserAdd, r); + } + + done: + talloc_free(call); + return result; +} |