[SCM] Samba Shared Repository - branch v3-3-test updated -
release-3-2-0pre2-3326-g5000d4c
Günther Deschner
gd at samba.org
Fri Jul 18 15:22:41 GMT 2008
The branch, v3-3-test has been updated
via 5000d4c743b09665405776569782f46eeb6c2e36 (commit)
via 0acf8352a3ca7deb2e3465be441f20d455eb802b (commit)
via 8cc555602f53f6afaded2eff58ed57f87b915c64 (commit)
via de9f40ddd08dad821d3242e60a396a771cf16fa0 (commit)
via e00d2affbc3bc848e727f60348aebc7ea8548459 (commit)
from d282e5eca298c4c45cbe91a93350273d1417a050 (commit)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-3-test
- Log -----------------------------------------------------------------
commit 5000d4c743b09665405776569782f46eeb6c2e36
Author: Günther Deschner <gd at samba.org>
Date: Fri Jul 18 02:23:29 2008 +0200
netapi: add NetUserSetInfo example code.
Guenther
commit 0acf8352a3ca7deb2e3465be441f20d455eb802b
Author: Günther Deschner <gd at samba.org>
Date: Fri Jul 18 01:40:14 2008 +0200
netapi: add NetUserSetInfo to public header.
Guenther
commit 8cc555602f53f6afaded2eff58ed57f87b915c64
Author: Günther Deschner <gd at samba.org>
Date: Thu Jul 17 01:00:33 2008 +0200
netapi: add skeleton for NetUserSetInfo.
Guenther
commit de9f40ddd08dad821d3242e60a396a771cf16fa0
Author: Günther Deschner <gd at samba.org>
Date: Thu Jul 17 00:59:57 2008 +0200
re-run make idl.
Guenther
commit e00d2affbc3bc848e727f60348aebc7ea8548459
Author: Günther Deschner <gd at samba.org>
Date: Thu Jul 17 00:59:13 2008 +0200
netapi: add NetUserSetInfo to IDL.
Guenther
-----------------------------------------------------------------------
Summary of changes:
source/lib/netapi/examples/Makefile.in | 6 +++
.../{group/group_adduser.c => user/user_setinfo.c} | 34 ++++++++------
source/lib/netapi/libnetapi.c | 48 ++++++++++++++++++++
source/lib/netapi/libnetapi.h | 9 ++++
source/lib/netapi/netapi.h | 22 +++++++++
source/lib/netapi/user.c | 18 +++++++
source/librpc/gen_ndr/libnetapi.h | 16 +++++++
source/librpc/gen_ndr/ndr_libnetapi.c | 32 +++++++++++++
source/librpc/gen_ndr/ndr_libnetapi.h | 33 ++++++++------
source/librpc/idl/libnetapi.idl | 12 +++++
10 files changed, 202 insertions(+), 28 deletions(-)
copy source/lib/netapi/examples/{group/group_adduser.c => user/user_setinfo.c} (76%)
Changeset truncated at 500 lines:
diff --git a/source/lib/netapi/examples/Makefile.in b/source/lib/netapi/examples/Makefile.in
index f15b099..b853f2f 100644
--- a/source/lib/netapi/examples/Makefile.in
+++ b/source/lib/netapi/examples/Makefile.in
@@ -28,6 +28,7 @@ PROGS = bin/getdc at EXEEXT@ \
bin/user_dispinfo at EXEEXT@ \
bin/user_chgpwd at EXEEXT@ \
bin/user_getinfo at EXEEXT@ \
+ bin/user_setinfo at EXEEXT@ \
bin/group_add at EXEEXT@ \
bin/group_del at EXEEXT@ \
bin/group_enum at EXEEXT@ \
@@ -79,6 +80,7 @@ USERENUM_OBJ = user/user_enum.o $(CMDLINE_OBJ)
USERDISPINFO_OBJ = user/user_dispinfo.o $(CMDLINE_OBJ)
USERCHGPWD_OBJ = user/user_chgpwd.o $(CMDLINE_OBJ)
USERGETINFO_OBJ = user/user_getinfo.o $(CMDLINE_OBJ)
+USERSETINFO_OBJ = user/user_setinfo.o $(CMDLINE_OBJ)
GROUPADD_OBJ = group/group_add.o $(CMDLINE_OBJ)
GROUPDEL_OBJ = group/group_del.o $(CMDLINE_OBJ)
GROUPENUM_OBJ = group/group_enum.o $(CMDLINE_OBJ)
@@ -136,6 +138,10 @@ bin/user_getinfo at EXEEXT@: $(BINARY_PREREQS) $(USERGETINFO_OBJ)
@echo Linking $@
@$(CC) $(FLAGS) -o $@ $(USERGETINFO_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
+bin/user_setinfo at EXEEXT@: $(BINARY_PREREQS) $(USERSETINFO_OBJ)
+ @echo Linking $@
+ @$(CC) $(FLAGS) -o $@ $(USERSETINFO_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
+
bin/group_add at EXEEXT@: $(BINARY_PREREQS) $(GROUPADD_OBJ)
@echo Linking $@
@$(CC) $(FLAGS) -o $@ $(GROUPADD_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
diff --git a/source/lib/netapi/examples/group/group_adduser.c b/source/lib/netapi/examples/user/user_setinfo.c
similarity index 76%
copy from source/lib/netapi/examples/group/group_adduser.c
copy to source/lib/netapi/examples/user/user_setinfo.c
index 253b3c5..ec46423 100644
--- a/source/lib/netapi/examples/group/group_adduser.c
+++ b/source/lib/netapi/examples/user/user_setinfo.c
@@ -1,6 +1,6 @@
/*
* Unix SMB/CIFS implementation.
- * NetGroupAddUser query
+ * NetUserSetInfo query
* Copyright (C) Guenther Deschner 2008
*
* This program is free software; you can redistribute it and/or modify
@@ -32,8 +32,11 @@ int main(int argc, const char **argv)
NET_API_STATUS status;
struct libnetapi_ctx *ctx = NULL;
const char *hostname = NULL;
- const char *groupname = NULL;
const char *username = NULL;
+ uint32_t level = 1007;
+ uint32_t parm_err = 0;
+
+ struct USER_INFO_1007 u1007;
poptContext pc;
int opt;
@@ -49,9 +52,9 @@ int main(int argc, const char **argv)
return status;
}
- pc = poptGetContext("group_adduser", argc, argv, long_options, 0);
+ pc = poptGetContext("user_setinfo", argc, argv, long_options, 0);
- poptSetOtherOptionHelp(pc, "hostname groupname username");
+ poptSetOtherOptionHelp(pc, "hostname username level");
while((opt = poptGetNextOpt(pc)) != -1) {
}
@@ -65,22 +68,25 @@ int main(int argc, const char **argv)
poptPrintHelp(pc, stderr, 0);
goto out;
}
- groupname = poptGetArg(pc);
+ username = poptGetArg(pc);
- if (!poptPeekArg(pc)) {
- poptPrintHelp(pc, stderr, 0);
- goto out;
+ if (poptPeekArg(pc)) {
+ level = atoi(poptGetArg(pc));
}
- username = poptGetArg(pc);
- /* NetGroupAddUser */
+ /* NetUserSetInfo */
- status = NetGroupAddUser(hostname,
- groupname,
- username);
+ u1007.usri1007_comment = "NetApi test comment";
+
+ status = NetUserSetInfo(hostname,
+ username,
+ level,
+ (uint8_t *)&u1007,
+ &parm_err);
if (status != 0) {
- printf("NetGroupAddUser failed with: %s\n",
+ printf("NetUserSetInfo failed with: %s\n",
libnetapi_get_error_string(ctx, status));
+ goto out;
}
out:
diff --git a/source/lib/netapi/libnetapi.c b/source/lib/netapi/libnetapi.c
index 8013c74..567fab6 100644
--- a/source/lib/netapi/libnetapi.c
+++ b/source/lib/netapi/libnetapi.c
@@ -678,6 +678,54 @@ NET_API_STATUS NetUserGetInfo(const char * server_name /* [in] */,
}
/****************************************************************
+ NetUserSetInfo
+****************************************************************/
+
+NET_API_STATUS NetUserSetInfo(const char * server_name /* [in] */,
+ const char * user_name /* [in] */,
+ uint32_t level /* [in] */,
+ uint8_t *buffer /* [in] [ref] */,
+ uint32_t *parm_err /* [out] [ref] */)
+{
+ struct NetUserSetInfo r;
+ struct libnetapi_ctx *ctx = NULL;
+ NET_API_STATUS status;
+ WERROR werr;
+
+ status = libnetapi_getctx(&ctx);
+ if (status != 0) {
+ return status;
+ }
+
+ /* In parameters */
+ r.in.server_name = server_name;
+ r.in.user_name = user_name;
+ r.in.level = level;
+ r.in.buffer = buffer;
+
+ /* Out parameters */
+ r.out.parm_err = parm_err;
+
+ if (DEBUGLEVEL >= 10) {
+ NDR_PRINT_IN_DEBUG(NetUserSetInfo, &r);
+ }
+
+ if (LIBNETAPI_LOCAL_SERVER(server_name)) {
+ werr = NetUserSetInfo_l(ctx, &r);
+ } else {
+ werr = NetUserSetInfo_r(ctx, &r);
+ }
+
+ r.out.result = W_ERROR_V(werr);
+
+ if (DEBUGLEVEL >= 10) {
+ NDR_PRINT_OUT_DEBUG(NetUserSetInfo, &r);
+ }
+
+ return r.out.result;
+}
+
+/****************************************************************
NetQueryDisplayInformation
****************************************************************/
diff --git a/source/lib/netapi/libnetapi.h b/source/lib/netapi/libnetapi.h
index 349c3c1..f104b72 100644
--- a/source/lib/netapi/libnetapi.h
+++ b/source/lib/netapi/libnetapi.h
@@ -116,6 +116,15 @@ WERROR NetUserGetInfo_r(struct libnetapi_ctx *ctx,
struct NetUserGetInfo *r);
WERROR NetUserGetInfo_l(struct libnetapi_ctx *ctx,
struct NetUserGetInfo *r);
+NET_API_STATUS NetUserSetInfo(const char * server_name /* [in] */,
+ const char * user_name /* [in] */,
+ uint32_t level /* [in] */,
+ uint8_t *buffer /* [in] [ref] */,
+ uint32_t *parm_err /* [out] [ref] */);
+WERROR NetUserSetInfo_r(struct libnetapi_ctx *ctx,
+ struct NetUserSetInfo *r);
+WERROR NetUserSetInfo_l(struct libnetapi_ctx *ctx,
+ struct NetUserSetInfo *r);
NET_API_STATUS NetQueryDisplayInformation(const char * server_name /* [in] [unique] */,
uint32_t level /* [in] */,
uint32_t idx /* [in] */,
diff --git a/source/lib/netapi/netapi.h b/source/lib/netapi/netapi.h
index 95ecbe3..9c3468d 100644
--- a/source/lib/netapi/netapi.h
+++ b/source/lib/netapi/netapi.h
@@ -708,6 +708,28 @@ NET_API_STATUS NetUserGetInfo(const char * server_name /* [in] */,
/************************************************************//**
*
+ * NetUserSetInfo
+ *
+ * @brief Set User Information
+ *
+ * @param[in] server_name The server name to connect to
+ * @param[in] user_name The name of the user that is going to be modified
+ * @param[in] level The level defining the requested USER_INFO_X structure
+ * @param[in] buf The buffer containing a USER_INFO_X structure
+ * @param[out] parm_err The returned parameter error number if any
+ * @return NET_API_STATUS
+ *
+ * example user/user_setinfo.c
+ ***************************************************************/
+
+NET_API_STATUS NetUserSetInfo(const char * server_name /* [in] */,
+ const char * user_name /* [in] */,
+ uint32_t level /* [in] */,
+ uint8_t *buffer /* [in] [ref] */,
+ uint32_t *parm_err /* [out] [ref] */);
+
+/************************************************************//**
+ *
* NetQueryDisplayInformation
*
* @brief Enumerate accounts on a server
diff --git a/source/lib/netapi/user.c b/source/lib/netapi/user.c
index b318aa6..2c18cd0 100644
--- a/source/lib/netapi/user.c
+++ b/source/lib/netapi/user.c
@@ -1204,3 +1204,21 @@ WERROR NetUserGetInfo_l(struct libnetapi_ctx *ctx,
return WERR_NOT_SUPPORTED;
}
+/****************************************************************
+****************************************************************/
+
+WERROR NetUserSetInfo_r(struct libnetapi_ctx *ctx,
+ struct NetUserSetInfo *r)
+{
+ return WERR_NOT_SUPPORTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+WERROR NetUserSetInfo_l(struct libnetapi_ctx *ctx,
+ struct NetUserSetInfo *r)
+{
+ return WERR_NOT_SUPPORTED;
+}
+
diff --git a/source/librpc/gen_ndr/libnetapi.h b/source/librpc/gen_ndr/libnetapi.h
index 1a6898c..ab658c2 100644
--- a/source/librpc/gen_ndr/libnetapi.h
+++ b/source/librpc/gen_ndr/libnetapi.h
@@ -504,6 +504,22 @@ struct NetUserGetInfo {
};
+struct NetUserSetInfo {
+ struct {
+ const char * server_name;
+ const char * user_name;
+ uint32_t level;
+ uint8_t *buffer;/* [ref] */
+ } in;
+
+ struct {
+ uint32_t *parm_err;/* [ref] */
+ enum NET_API_STATUS result;
+ } out;
+
+};
+
+
struct NetQueryDisplayInformation {
struct {
const char * server_name;/* [unique] */
diff --git a/source/librpc/gen_ndr/ndr_libnetapi.c b/source/librpc/gen_ndr/ndr_libnetapi.c
index 42d2163..3ee4ffa 100644
--- a/source/librpc/gen_ndr/ndr_libnetapi.c
+++ b/source/librpc/gen_ndr/ndr_libnetapi.c
@@ -1652,6 +1652,38 @@ _PUBLIC_ void ndr_print_NetUserGetInfo(struct ndr_print *ndr, const char *name,
ndr->depth--;
}
+_PUBLIC_ void ndr_print_NetUserSetInfo(struct ndr_print *ndr, const char *name, int flags, const struct NetUserSetInfo *r)
+{
+ ndr_print_struct(ndr, name, "NetUserSetInfo");
+ ndr->depth++;
+ if (flags & NDR_SET_VALUES) {
+ ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+ }
+ if (flags & NDR_IN) {
+ ndr_print_struct(ndr, "in", "NetUserSetInfo");
+ ndr->depth++;
+ ndr_print_string(ndr, "server_name", r->in.server_name);
+ ndr_print_string(ndr, "user_name", r->in.user_name);
+ ndr_print_uint32(ndr, "level", r->in.level);
+ ndr_print_ptr(ndr, "buffer", r->in.buffer);
+ ndr->depth++;
+ ndr_print_uint8(ndr, "buffer", *r->in.buffer);
+ ndr->depth--;
+ ndr->depth--;
+ }
+ if (flags & NDR_OUT) {
+ ndr_print_struct(ndr, "out", "NetUserSetInfo");
+ ndr->depth++;
+ ndr_print_ptr(ndr, "parm_err", r->out.parm_err);
+ ndr->depth++;
+ ndr_print_uint32(ndr, "parm_err", *r->out.parm_err);
+ ndr->depth--;
+ ndr_print_NET_API_STATUS(ndr, "result", r->out.result);
+ ndr->depth--;
+ }
+ ndr->depth--;
+}
+
_PUBLIC_ void ndr_print_NetQueryDisplayInformation(struct ndr_print *ndr, const char *name, int flags, const struct NetQueryDisplayInformation *r)
{
ndr_print_struct(ndr, name, "NetQueryDisplayInformation");
diff --git a/source/librpc/gen_ndr/ndr_libnetapi.h b/source/librpc/gen_ndr/ndr_libnetapi.h
index 29a8bb6..94df545 100644
--- a/source/librpc/gen_ndr/ndr_libnetapi.h
+++ b/source/librpc/gen_ndr/ndr_libnetapi.h
@@ -34,33 +34,35 @@
#define NDR_NETUSERGETINFO (0x0d)
-#define NDR_NETQUERYDISPLAYINFORMATION (0x0e)
+#define NDR_NETUSERSETINFO (0x0e)
-#define NDR_NETGROUPADD (0x0f)
+#define NDR_NETQUERYDISPLAYINFORMATION (0x0f)
-#define NDR_NETGROUPDEL (0x10)
+#define NDR_NETGROUPADD (0x10)
-#define NDR_NETGROUPENUM (0x11)
+#define NDR_NETGROUPDEL (0x11)
-#define NDR_NETGROUPSETINFO (0x12)
+#define NDR_NETGROUPENUM (0x12)
-#define NDR_NETGROUPGETINFO (0x13)
+#define NDR_NETGROUPSETINFO (0x13)
-#define NDR_NETGROUPADDUSER (0x14)
+#define NDR_NETGROUPGETINFO (0x14)
-#define NDR_NETGROUPDELUSER (0x15)
+#define NDR_NETGROUPADDUSER (0x15)
-#define NDR_NETLOCALGROUPADD (0x16)
+#define NDR_NETGROUPDELUSER (0x16)
-#define NDR_NETLOCALGROUPDEL (0x17)
+#define NDR_NETLOCALGROUPADD (0x17)
-#define NDR_NETLOCALGROUPGETINFO (0x18)
+#define NDR_NETLOCALGROUPDEL (0x18)
-#define NDR_NETLOCALGROUPSETINFO (0x19)
+#define NDR_NETLOCALGROUPGETINFO (0x19)
-#define NDR_NETREMOTETOD (0x1a)
+#define NDR_NETLOCALGROUPSETINFO (0x1a)
-#define NDR_LIBNETAPI_CALL_COUNT (27)
+#define NDR_NETREMOTETOD (0x1b)
+
+#define NDR_LIBNETAPI_CALL_COUNT (28)
enum ndr_err_code ndr_push_NET_API_STATUS(struct ndr_push *ndr, int ndr_flags, enum NET_API_STATUS r);
enum ndr_err_code ndr_pull_NET_API_STATUS(struct ndr_pull *ndr, int ndr_flags, enum NET_API_STATUS *r);
void ndr_print_NET_API_STATUS(struct ndr_print *ndr, const char *name, enum NET_API_STATUS r);
@@ -154,6 +156,9 @@ void ndr_print_NetUserChangePassword(struct ndr_print *ndr, const char *name, in
enum ndr_err_code ndr_push_NetUserGetInfo(struct ndr_push *ndr, int flags, const struct NetUserGetInfo *r);
enum ndr_err_code ndr_pull_NetUserGetInfo(struct ndr_pull *ndr, int flags, struct NetUserGetInfo *r);
void ndr_print_NetUserGetInfo(struct ndr_print *ndr, const char *name, int flags, const struct NetUserGetInfo *r);
+enum ndr_err_code ndr_push_NetUserSetInfo(struct ndr_push *ndr, int flags, const struct NetUserSetInfo *r);
+enum ndr_err_code ndr_pull_NetUserSetInfo(struct ndr_pull *ndr, int flags, struct NetUserSetInfo *r);
+void ndr_print_NetUserSetInfo(struct ndr_print *ndr, const char *name, int flags, const struct NetUserSetInfo *r);
enum ndr_err_code ndr_push_NetQueryDisplayInformation(struct ndr_push *ndr, int flags, const struct NetQueryDisplayInformation *r);
enum ndr_err_code ndr_pull_NetQueryDisplayInformation(struct ndr_pull *ndr, int flags, struct NetQueryDisplayInformation *r);
void ndr_print_NetQueryDisplayInformation(struct ndr_print *ndr, const char *name, int flags, const struct NetQueryDisplayInformation *r);
diff --git a/source/librpc/idl/libnetapi.idl b/source/librpc/idl/libnetapi.idl
index 0f311d4..69f78b9 100644
--- a/source/librpc/idl/libnetapi.idl
+++ b/source/librpc/idl/libnetapi.idl
@@ -361,6 +361,18 @@ interface libnetapi
);
/*******************************************/
+ /* NetUserSetInfo */
+ /*******************************************/
+
+ [nopush,nopull] NET_API_STATUS NetUserSetInfo(
+ [in] string server_name,
+ [in] string user_name,
+ [in] uint32 level,
+ [in] uint8 *buffer,
+ [out] uint32 *parm_err
+ );
+
+ /*******************************************/
/* NetQueryDisplayInformation */
/*******************************************/
--
Samba Shared Repository
More information about the samba-cvs
mailing list