2bea398b65c00e8f2370593a6e4b4813ca27bbfd
[bbaumbach/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_logon;
61                 struct timeval *last_logoff;
62                 struct timeval *last_password_change;
63                 uint32_t acct_flags;
64         } in;
65         struct {
66                 const char *error_string;
67         } out;
68 };
69
70
71 #define SET_FIELD_LSA_STRING(new, current, mod, field, flag) \
72         if (new.field != NULL && \
73             !strequal_w(current->field.string, new.field)) { \
74                 \
75                 mod->field = talloc_strdup(mem_ctx, new.field); \
76                 if (mod->field == NULL) return NT_STATUS_NO_MEMORY; \
77                 \
78                 mod->fields |= flag; \
79         }
80
81 #define SET_FIELD_NTTIME(new, current, mod, field, flag) \
82         if (new.field != 0) { \
83                 NTTIME newval = timeval_to_nttime(new.field); \
84                 if (newval != current->field) { \
85                         mod->field = talloc_memdup(mem_ctx, new.field, sizeof(*new.field)); \
86                         if (mod->field == NULL) return NT_STATUS_NO_MEMORY; \
87                         mod->fields |= flag; \
88                 } \
89         }