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_m(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 | #define SET_FIELD_ACCT_FLAGS(new, current, mod, field, flag) \
|
---|
95 | if (new.field) { \
|
---|
96 | if (current->field != new.field) { \
|
---|
97 | mod->field = new.field; \
|
---|
98 | mod->fields |= flag; \
|
---|
99 | } \
|
---|
100 | }
|
---|
101 |
|
---|
102 | enum libnet_UserInfo_level {
|
---|
103 | USER_INFO_BY_NAME=0,
|
---|
104 | USER_INFO_BY_SID
|
---|
105 | };
|
---|
106 |
|
---|
107 | struct libnet_UserInfo {
|
---|
108 | struct {
|
---|
109 | const char *domain_name;
|
---|
110 | enum libnet_UserInfo_level level;
|
---|
111 | union {
|
---|
112 | const char *user_name;
|
---|
113 | const struct dom_sid *user_sid;
|
---|
114 | } data;
|
---|
115 | } in;
|
---|
116 | struct {
|
---|
117 | struct dom_sid *user_sid;
|
---|
118 | struct dom_sid *primary_group_sid;
|
---|
119 | const char *account_name;
|
---|
120 | const char *full_name;
|
---|
121 | const char *description;
|
---|
122 | const char *home_directory;
|
---|
123 | const char *home_drive;
|
---|
124 | const char *comment;
|
---|
125 | const char *logon_script;
|
---|
126 | const char *profile_path;
|
---|
127 | struct timeval *acct_expiry;
|
---|
128 | struct timeval *allow_password_change;
|
---|
129 | struct timeval *force_password_change;
|
---|
130 | struct timeval *last_logon;
|
---|
131 | struct timeval *last_logoff;
|
---|
132 | struct timeval *last_password_change;
|
---|
133 | uint32_t acct_flags;
|
---|
134 | const char *error_string;
|
---|
135 | } out;
|
---|
136 | };
|
---|
137 |
|
---|
138 |
|
---|
139 | struct libnet_UserList {
|
---|
140 | struct {
|
---|
141 | const char *domain_name;
|
---|
142 | int page_size;
|
---|
143 | uint32_t resume_index;
|
---|
144 | } in;
|
---|
145 | struct {
|
---|
146 | int count;
|
---|
147 | uint32_t resume_index;
|
---|
148 |
|
---|
149 | struct userlist {
|
---|
150 | const char *sid;
|
---|
151 | const char *username;
|
---|
152 | } *users;
|
---|
153 |
|
---|
154 | const char *error_string;
|
---|
155 | } out;
|
---|
156 | };
|
---|