3bbe1cc65e804f12eb8fbb53f8647c4abdbd925c
[kai/samba.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 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
89 struct libnet_UserInfo {
90         struct {
91                 const char *user_name;
92                 const char *domain_name;
93         } in;
94         struct {
95                 struct dom_sid *user_sid;
96                 struct dom_sid *primary_group_sid;
97                 const char *account_name;
98                 const char *full_name;
99                 const char *description;
100                 const char *home_directory;
101                 const char *home_drive;
102                 const char *comment;
103                 const char *logon_script;
104                 const char *profile_path;
105                 struct timeval *acct_expiry;
106                 struct timeval *allow_password_change;
107                 struct timeval *force_password_change;
108                 struct timeval *last_logon;
109                 struct timeval *last_logoff;
110                 struct timeval *last_password_change;
111                 uint32_t acct_flags;
112                 
113                 const char *error_string;
114         } out;
115 };
116
117
118 struct libnet_UserList {
119         struct {
120                 const char *domain_name;
121                 int page_size;
122                 uint resume_index;
123         } in;
124         struct {
125                 int count;
126                 uint resume_index;
127
128                 struct userlist {
129                         const char *sid;
130                         const char *username;
131                 } *users;
132
133                 const char *error_string;
134         } out;
135 };