Merge commit 'release-4-0-0alpha1' into v4-0-test
[jelmer/samba4-debian.git] / source / 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 3 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, see <http://www.gnu.org/licenses/>.
18 */
19
20
21 struct libnet_CreateUser {
22         struct {
23                 const char *user_name;
24                 const char *domain_name;
25         } in;
26         struct {
27                 const char *error_string;
28         } out;
29 };
30
31
32 struct libnet_DeleteUser {
33         struct {
34                 const char *user_name;
35                 const char *domain_name;
36         } in;
37         struct {
38                 const char *error_string;
39         } out;
40 };
41
42
43 struct libnet_ModifyUser {
44         struct {
45                 const char *user_name;
46                 const char *domain_name;
47
48                 const char *account_name;
49                 const char *full_name;
50                 const char *description;
51                 const char *home_directory;
52                 const char *home_drive;
53                 const char *comment;
54                 const char *logon_script;
55                 const char *profile_path;
56                 struct timeval *acct_expiry;
57                 struct timeval *allow_password_change;
58                 struct timeval *force_password_change;
59                 struct timeval *last_password_change;
60                 uint32_t acct_flags;
61         } in;
62         struct {
63                 const char *error_string;
64         } out;
65 };
66
67
68 #define SET_FIELD_LSA_STRING(new, current, mod, field, flag) \
69         if (new.field != NULL && \
70             !strequal_w(current->field.string, new.field)) { \
71                 \
72                 mod->field = talloc_strdup(mem_ctx, new.field); \
73                 if (mod->field == NULL) return NT_STATUS_NO_MEMORY; \
74                 \
75                 mod->fields |= flag; \
76         }
77
78 #define SET_FIELD_NTTIME(new, current, mod, field, flag) \
79         if (new.field != 0) { \
80                 NTTIME newval = timeval_to_nttime(new.field); \
81                 if (newval != current->field) { \
82                         mod->field = talloc_memdup(mem_ctx, new.field, sizeof(*new.field)); \
83                         if (mod->field == NULL) return NT_STATUS_NO_MEMORY; \
84                         mod->fields |= flag; \
85                 } \
86         }
87
88 #define SET_FIELD_UINT32(new, current, mod, field, flag) \
89         if (current->field != new.field) { \
90                 mod->field = new.field; \
91                 mod->fields |= flag; \
92         }
93
94
95 struct libnet_UserInfo {
96         struct {
97                 const char *user_name;
98                 const char *domain_name;
99         } in;
100         struct {
101                 struct dom_sid *user_sid;
102                 struct dom_sid *primary_group_sid;
103                 const char *account_name;
104                 const char *full_name;
105                 const char *description;
106                 const char *home_directory;
107                 const char *home_drive;
108                 const char *comment;
109                 const char *logon_script;
110                 const char *profile_path;
111                 struct timeval *acct_expiry;
112                 struct timeval *allow_password_change;
113                 struct timeval *force_password_change;
114                 struct timeval *last_logon;
115                 struct timeval *last_logoff;
116                 struct timeval *last_password_change;
117                 uint32_t acct_flags;
118                 
119                 const char *error_string;
120         } out;
121 };
122
123
124 struct libnet_UserList {
125         struct {
126                 const char *domain_name;
127                 int page_size;
128                 uint resume_index;
129         } in;
130         struct {
131                 int count;
132                 uint resume_index;
133
134                 struct userlist {
135                         const char *sid;
136                         const char *username;
137                 } *users;
138
139                 const char *error_string;
140         } out;
141 };