The branch, v3-3-test has been updated
       via  ac5aaf29004584d0f1821689eb985d837cda1aa1 (commit)
       via  5d06891238d7dddedeb6fe2aca677c765b90c74a (commit)
       via  f4ce6887103d0f50bf9a91251e2aceb77674604f (commit)
       via  397d305e90e90f475b6de0efac7dd9630d698efd (commit)
       via  7020a5bd6e90c178085bb8d04325ac5ba83b4c3d (commit)
      from  b47899195e0c190445953243fe80da4e92994dd1 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-3-test


- Log -----------------------------------------------------------------
commit ac5aaf29004584d0f1821689eb985d837cda1aa1
Author: Günther Deschner <[EMAIL PROTECTED]>
Date:   Wed Jun 25 00:47:17 2008 +0200

    netapi: add NetUserChangePassword() example code.
    
    Guenther

commit 5d06891238d7dddedeb6fe2aca677c765b90c74a
Author: Günther Deschner <[EMAIL PROTECTED]>
Date:   Wed Jun 25 00:47:41 2008 +0200

    netapi: add NetUserChangePassword() to public headers.
    
    Guenther

commit f4ce6887103d0f50bf9a91251e2aceb77674604f
Author: Günther Deschner <[EMAIL PROTECTED]>
Date:   Wed Jun 25 00:32:02 2008 +0200

    netapi: add NetUserChangePassword skeleton.
    
    Guenther

commit 397d305e90e90f475b6de0efac7dd9630d698efd
Author: Günther Deschner <[EMAIL PROTECTED]>
Date:   Wed Jun 25 00:29:25 2008 +0200

    re-run make idl.
    
    Guenther

commit 7020a5bd6e90c178085bb8d04325ac5ba83b4c3d
Author: Günther Deschner <[EMAIL PROTECTED]>
Date:   Wed Jun 25 00:29:06 2008 +0200

    netapi: add NetUserChangePassword() to IDL.
    
    Guenther

-----------------------------------------------------------------------

Summary of changes:
 source/lib/netapi/examples/Makefile.in             |    6 +++
 .../{group/group_adduser.c => user/user_chgpwd.c}  |   30 ++++++++-----
 source/lib/netapi/libnetapi.c                      |   46 ++++++++++++++++++++
 source/lib/netapi/libnetapi.h                      |    8 +++
 source/lib/netapi/netapi.h                         |   20 +++++++++
 source/lib/netapi/user.c                           |   18 ++++++++
 source/librpc/gen_ndr/libnetapi.h                  |   15 ++++++
 source/librpc/gen_ndr/ndr_libnetapi.c              |   25 +++++++++++
 source/librpc/gen_ndr/ndr_libnetapi.h              |   31 ++++++++------
 source/librpc/idl/libnetapi.idl                    |   11 +++++
 10 files changed, 186 insertions(+), 24 deletions(-)
 copy source/lib/netapi/examples/{group/group_adduser.c => user/user_chgpwd.c} 
(74%)


Changeset truncated at 500 lines:

diff --git a/source/lib/netapi/examples/Makefile.in 
b/source/lib/netapi/examples/Makefile.in
index 4b5ce25..8e6a59a 100644
--- a/source/lib/netapi/examples/Makefile.in
+++ b/source/lib/netapi/examples/Makefile.in
@@ -26,6 +26,7 @@ PROGS = bin/[EMAIL PROTECTED]@ \
        bin/[EMAIL PROTECTED]@ \
        bin/[EMAIL PROTECTED]@ \
        bin/[EMAIL PROTECTED]@ \
+       bin/[EMAIL PROTECTED]@ \
        bin/[EMAIL PROTECTED]@ \
        bin/[EMAIL PROTECTED]@ \
        bin/[EMAIL PROTECTED]@ \
@@ -74,6 +75,7 @@ USERADD_OBJ = user/user_add.o $(CMDLINE_OBJ)
 USERDEL_OBJ = user/user_del.o $(CMDLINE_OBJ)
 USERENUM_OBJ = user/user_enum.o $(CMDLINE_OBJ)
 USERDISPINFO_OBJ = user/user_dispinfo.o $(CMDLINE_OBJ)
+USERCHGPWD_OBJ = user/user_chgpwd.o $(CMDLINE_OBJ)
 GROUPADD_OBJ = group/group_add.o $(CMDLINE_OBJ)
 GROUPDEL_OBJ = group/group_del.o $(CMDLINE_OBJ)
 GROUPSETINFO_OBJ = group/group_setinfo.o $(CMDLINE_OBJ)
@@ -122,6 +124,10 @@ bin/[EMAIL PROTECTED]@: $(BINARY_PREREQS) 
$(USERDISPINFO_OBJ)
        @echo Linking $@
        @$(CC) $(FLAGS) -o $@ $(USERDISPINFO_OBJ) $(LDFLAGS) $(DYNEXP) 
$(CMDLINE_LIBS)
 
+bin/[EMAIL PROTECTED]@: $(BINARY_PREREQS) $(USERCHGPWD_OBJ)
+       @echo Linking $@
+       @$(CC) $(FLAGS) -o $@ $(USERCHGPWD_OBJ) $(LDFLAGS) $(DYNEXP) 
$(CMDLINE_LIBS)
+
 bin/[EMAIL PROTECTED]@: $(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_chgpwd.c
similarity index 74%
copy from source/lib/netapi/examples/group/group_adduser.c
copy to source/lib/netapi/examples/user/user_chgpwd.c
index 253b3c5..8b37ec2 100644
--- a/source/lib/netapi/examples/group/group_adduser.c
+++ b/source/lib/netapi/examples/user/user_chgpwd.c
@@ -1,6 +1,6 @@
 /*
  *  Unix SMB/CIFS implementation.
- *  NetGroupAddUser query
+ *  NetUserChangePassword query
  *  Copyright (C) Guenther Deschner 2008
  *
  *  This program is free software; you can redistribute it and/or modify
@@ -32,8 +32,9 @@ 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;
+       const char *old_password = NULL;
+       const char *new_password = NULL;
 
        poptContext pc;
        int opt;
@@ -49,9 +50,9 @@ int main(int argc, const char **argv)
                return status;
        }
 
-       pc = poptGetContext("group_adduser", argc, argv, long_options, 0);
+       pc = poptGetContext("user_chgpwd", argc, argv, long_options, 0);
 
-       poptSetOtherOptionHelp(pc, "hostname groupname username");
+       poptSetOtherOptionHelp(pc, "hostname username old_password 
new_password");
        while((opt = poptGetNextOpt(pc)) != -1) {
        }
 
@@ -65,21 +66,28 @@ 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;
        }
-       username = poptGetArg(pc);
+       old_password = poptGetArg(pc);
+
+       if (!poptPeekArg(pc)) {
+               poptPrintHelp(pc, stderr, 0);
+               goto out;
+       }
+       new_password = poptGetArg(pc);
 
-       /* NetGroupAddUser */
+       /* NetUserChangePassword */
 
-       status = NetGroupAddUser(hostname,
-                                groupname,
-                                username);
+       status = NetUserChangePassword(hostname,
+                                      username,
+                                      old_password,
+                                      new_password);
        if (status != 0) {
-               printf("NetGroupAddUser failed with: %s\n",
+               printf("NetUserChangePassword failed with: %s\n",
                        libnetapi_get_error_string(ctx, status));
        }
 
diff --git a/source/lib/netapi/libnetapi.c b/source/lib/netapi/libnetapi.c
index 173c4d3..659c4c7 100644
--- a/source/lib/netapi/libnetapi.c
+++ b/source/lib/netapi/libnetapi.c
@@ -586,6 +586,52 @@ NET_API_STATUS NetUserEnum(const char * server_name /* 
[in] [unique] */,
 }
 
 /****************************************************************
+ NetUserChangePassword
+****************************************************************/
+
+NET_API_STATUS NetUserChangePassword(const char * domain_name /* [in] */,
+                                    const char * user_name /* [in] */,
+                                    const char * old_password /* [in] */,
+                                    const char * new_password /* [in] */)
+{
+       struct NetUserChangePassword 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.domain_name = domain_name;
+       r.in.user_name = user_name;
+       r.in.old_password = old_password;
+       r.in.new_password = new_password;
+
+       /* Out parameters */
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(NetUserChangePassword, &r);
+       }
+
+       if (LIBNETAPI_LOCAL_SERVER(domain_name)) {
+               werr = NetUserChangePassword_l(ctx, &r);
+       } else {
+               werr = NetUserChangePassword_r(ctx, &r);
+       }
+
+       r.out.result = W_ERROR_V(werr);
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(NetUserChangePassword, &r);
+       }
+
+       return r.out.result;
+}
+
+/****************************************************************
  NetQueryDisplayInformation
 ****************************************************************/
 
diff --git a/source/lib/netapi/libnetapi.h b/source/lib/netapi/libnetapi.h
index 12be1cc..1364a4c 100644
--- a/source/lib/netapi/libnetapi.h
+++ b/source/lib/netapi/libnetapi.h
@@ -100,6 +100,14 @@ WERROR NetUserEnum_r(struct libnetapi_ctx *ctx,
                     struct NetUserEnum *r);
 WERROR NetUserEnum_l(struct libnetapi_ctx *ctx,
                     struct NetUserEnum *r);
+NET_API_STATUS NetUserChangePassword(const char * domain_name /* [in] */,
+                                    const char * user_name /* [in] */,
+                                    const char * old_password /* [in] */,
+                                    const char * new_password /* [in] */);
+WERROR NetUserChangePassword_r(struct libnetapi_ctx *ctx,
+                              struct NetUserChangePassword *r);
+WERROR NetUserChangePassword_l(struct libnetapi_ctx *ctx,
+                              struct NetUserChangePassword *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 9496d77..113a72c 100644
--- a/source/lib/netapi/netapi.h
+++ b/source/lib/netapi/netapi.h
@@ -511,6 +511,26 @@ NET_API_STATUS NetUserEnum(const char * server_name /* 
[in] */,
 
 /************************************************************//**
  *
+ * NetUserChangePassword
+ *
+ * @brief Change the password for a user on a given server or in a given domain
+ *
+ * @param[in] domain_name The server or domain name to connect to
+ * @param[in] user_name The user account to change the password for
+ * @param[in] old_password The user account's old password
+ * @param[in] old_password The user account's new password
+ * @return NET_API_STATUS
+ *
+ * example user/user_chgpwd.c
+ ***************************************************************/
+
+NET_API_STATUS NetUserChangePassword(const char * domain_name /* [in] */,
+                                    const char * user_name /* [in] */,
+                                    const char * old_password /* [in] */,
+                                    const char * new_password /* [in] */);
+
+/************************************************************//**
+ *
  * NetQueryDisplayInformation
  *
  * @brief Enumerate accounts on a server
diff --git a/source/lib/netapi/user.c b/source/lib/netapi/user.c
index 53a307a..0d8065d 100644
--- a/source/lib/netapi/user.c
+++ b/source/lib/netapi/user.c
@@ -833,3 +833,21 @@ WERROR NetQueryDisplayInformation_l(struct libnetapi_ctx 
*ctx,
 {
        return WERR_NOT_SUPPORTED;
 }
+
+/****************************************************************
+****************************************************************/
+
+WERROR NetUserChangePassword_r(struct libnetapi_ctx *ctx,
+                              struct NetUserChangePassword *r)
+{
+       return WERR_NOT_SUPPORTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+WERROR NetUserChangePassword_l(struct libnetapi_ctx *ctx,
+                              struct NetUserChangePassword *r)
+{
+       return WERR_NOT_SUPPORTED;
+}
diff --git a/source/librpc/gen_ndr/libnetapi.h 
b/source/librpc/gen_ndr/libnetapi.h
index 5d2efcf..d6b8d99 100644
--- a/source/librpc/gen_ndr/libnetapi.h
+++ b/source/librpc/gen_ndr/libnetapi.h
@@ -334,6 +334,21 @@ struct NetUserEnum {
 };
 
 
+struct NetUserChangePassword {
+       struct {
+               const char * domain_name;
+               const char * user_name;
+               const char * old_password;
+               const char * new_password;
+       } in;
+
+       struct {
+               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 238cfdf..4bc966f 100644
--- a/source/librpc/gen_ndr/ndr_libnetapi.c
+++ b/source/librpc/gen_ndr/ndr_libnetapi.c
@@ -904,6 +904,31 @@ _PUBLIC_ void ndr_print_NetUserEnum(struct ndr_print *ndr, 
const char *name, int
        ndr->depth--;
 }
 
+_PUBLIC_ void ndr_print_NetUserChangePassword(struct ndr_print *ndr, const 
char *name, int flags, const struct NetUserChangePassword *r)
+{
+       ndr_print_struct(ndr, name, "NetUserChangePassword");
+       ndr->depth++;
+       if (flags & NDR_SET_VALUES) {
+               ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+       }
+       if (flags & NDR_IN) {
+               ndr_print_struct(ndr, "in", "NetUserChangePassword");
+               ndr->depth++;
+               ndr_print_string(ndr, "domain_name", r->in.domain_name);
+               ndr_print_string(ndr, "user_name", r->in.user_name);
+               ndr_print_string(ndr, "old_password", r->in.old_password);
+               ndr_print_string(ndr, "new_password", r->in.new_password);
+               ndr->depth--;
+       }
+       if (flags & NDR_OUT) {
+               ndr_print_struct(ndr, "out", "NetUserChangePassword");
+               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 422c702..fa7b586 100644
--- a/source/librpc/gen_ndr/ndr_libnetapi.h
+++ b/source/librpc/gen_ndr/ndr_libnetapi.h
@@ -30,31 +30,33 @@
 
 #define NDR_NETUSERENUM (0x0b)
 
-#define NDR_NETQUERYDISPLAYINFORMATION (0x0c)
+#define NDR_NETUSERCHANGEPASSWORD (0x0c)
 
-#define NDR_NETGROUPADD (0x0d)
+#define NDR_NETQUERYDISPLAYINFORMATION (0x0d)
 
-#define NDR_NETGROUPDEL (0x0e)
+#define NDR_NETGROUPADD (0x0e)
 
-#define NDR_NETGROUPSETINFO (0x0f)
+#define NDR_NETGROUPDEL (0x0f)
 
-#define NDR_NETGROUPGETINFO (0x10)
+#define NDR_NETGROUPSETINFO (0x10)
 
-#define NDR_NETGROUPADDUSER (0x11)
+#define NDR_NETGROUPGETINFO (0x11)
 
-#define NDR_NETGROUPDELUSER (0x12)
+#define NDR_NETGROUPADDUSER (0x12)
 
-#define NDR_NETLOCALGROUPADD (0x13)
+#define NDR_NETGROUPDELUSER (0x13)
 
-#define NDR_NETLOCALGROUPDEL (0x14)
+#define NDR_NETLOCALGROUPADD (0x14)
 
-#define NDR_NETLOCALGROUPGETINFO (0x15)
+#define NDR_NETLOCALGROUPDEL (0x15)
 
-#define NDR_NETLOCALGROUPSETINFO (0x16)
+#define NDR_NETLOCALGROUPGETINFO (0x16)
 
-#define NDR_NETREMOTETOD (0x17)
+#define NDR_NETLOCALGROUPSETINFO (0x17)
 
-#define NDR_LIBNETAPI_CALL_COUNT (24)
+#define NDR_NETREMOTETOD (0x18)
+
+#define NDR_LIBNETAPI_CALL_COUNT (25)
 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);
@@ -118,6 +120,9 @@ void ndr_print_NetUserDel(struct ndr_print *ndr, const char 
*name, int flags, co
 enum ndr_err_code ndr_push_NetUserEnum(struct ndr_push *ndr, int flags, const 
struct NetUserEnum *r);
 enum ndr_err_code ndr_pull_NetUserEnum(struct ndr_pull *ndr, int flags, struct 
NetUserEnum *r);
 void ndr_print_NetUserEnum(struct ndr_print *ndr, const char *name, int flags, 
const struct NetUserEnum *r);
+enum ndr_err_code ndr_push_NetUserChangePassword(struct ndr_push *ndr, int 
flags, const struct NetUserChangePassword *r);
+enum ndr_err_code ndr_pull_NetUserChangePassword(struct ndr_pull *ndr, int 
flags, struct NetUserChangePassword *r);
+void ndr_print_NetUserChangePassword(struct ndr_print *ndr, const char *name, 
int flags, const struct NetUserChangePassword *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 07b640d..c260b30 100644
--- a/source/librpc/idl/libnetapi.idl
+++ b/source/librpc/idl/libnetapi.idl
@@ -199,6 +199,17 @@ interface libnetapi
                );
 
        /*******************************************/
+       /* NetUserChangePassword                   */
+       /*******************************************/
+
+       [nopush,nopull] NET_API_STATUS NetUserChangePassword(
+               [in] string domain_name,
+               [in] string user_name,
+               [in] string old_password,
+               [in] string new_password
+               );
+
+       /*******************************************/
        /* NetQueryDisplayInformation              */
        /*******************************************/
 


-- 
Samba Shared Repository

Reply via email to