r22804: convert libnet_rpc_userinfo function to use "continue" functions
[kai/samba-autobuild/.git] / source4 / libnet / libnet_user.h
1 /* 
2    Unix SMB/CIFS implementation.
3    
4    Copyright (C) Rafal Szczesniak <mimir@samba.org> 2005
5    
6    This program is free software; you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation; either version 2 of the License, or
9    (at your option) any later version.
10    
11    This program is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15    
16    You should have received a copy of the GNU General Public License
17    along with this program; if not, write to the Free Software
18    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 */
20
21
22 struct libnet_CreateUser {
23         struct {
24                 const char *user_name;
25                 const char *domain_name;
26         } in;
27         struct {
28                 const char *error_string;
29         } out;
30 };
31
32
33 struct libnet_DeleteUser {
34         struct {
35                 const char *user_name;
36                 const char *domain_name;
37         } in;
38         struct {
39                 const char *error_string;
40         } out;
41 };
42
43
44 struct libnet_ModifyUser {
45         struct {
46                 const char *user_name;
47                 const char *domain_name;
48
49                 const char *account_name;
50                 const char *full_name;
51                 const char *description;
52                 const char *home_directory;
53                 const char *home_drive;
54                 const char *comment;
55                 const char *logon_script;
56                 const char *profile_path;
57                 struct timeval *acct_expiry;
58                 struct timeval *allow_password_change;
59                 struct timeval *force_password_change;
60                 struct timeval *last_password_change;
61                 uint32_t acct_flags;
62         } in;
63         struct {
64                 const char *error_string;
65         } out;
66 };
67
68
69 #define SET_FIELD_LSA_STRING(new, current, mod, field, flag) \
70         if (new.field != NULL && \
71             !strequal_w(current->field.string, new.field)) { \
72                 \
73                 mod->field = talloc_strdup(mem_ctx, new.field); \
74                 if (mod->field == NULL) return NT_STATUS_NO_MEMORY; \
75                 \
76                 mod->fields |= flag; \
77         }
78
79 #define SET_FIELD_NTTIME(new, current, mod, field, flag) \
80         if (new.field != 0) { \
81                 NTTIME newval = timeval_to_nttime(new.field); \
82                 if (newval != current->field) { \
83                         mod->field = talloc_memdup(mem_ctx, new.field, sizeof(*new.field)); \
84                         if (mod->field == NULL) return NT_STATUS_NO_MEMORY; \
85                         mod->fields |= flag; \
86                 } \
87         }
88
89
90 struct libnet_UserInfo {
91         struct {
92                 const char *user_name;
93                 const char *domain_name;
94         } in;
95         struct {
96                 const char *account_name;
97                 const char *full_name;
98                 const char *description;
99                 const char *home_directory;
100                 const char *home_drive;
101                 const char *comment;
102                 const char *logon_script;
103                 const char *profile_path;
104                 struct timeval *acct_expiry;
105                 struct timeval *allow_password_change;
106                 struct timeval *force_password_change;
107                 struct timeval *last_logon;
108                 struct timeval *last_logoff;
109                 struct timeval *last_password_change;
110                 uint32_t acct_flags;
111                 
112                 const char *error_string;
113         } out;
114 };
115
116
117 struct libnet_UserList {
118         struct {
119                 const char *domain_name;
120                 int page_size;
121                 uint resume_index;
122         } in;
123         struct {
124                 int count;
125                 uint resume_index;
126
127                 struct userlist {
128                         const char *sid;
129                         const char *username;
130                 } *users;
131
132                 const char *error_string;
133         } out;
134 };