2 * Unix SMB/CIFS implementation.
4 * Copyright (C) Guenther Deschner 2007-2008
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.
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.
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/>.
20 #ifndef __LIB_NETAPI_H__
21 #define __LIB_NETAPI_H__
25 #endif /* __cplusplus */
27 /****************************************************************
29 ****************************************************************/
31 NET_API_STATUS_SUCCESS = 0
34 #define ERROR_MORE_DATA ( 234L )
36 #define ENCRYPTED_PWLEN ( 16 )
38 /****************************************************************
39 ****************************************************************/
46 uint16_t time_hi_and_version;
51 #endif /* _HEADER_misc */
53 #ifndef _HEADER_libnetapi
56 #define MAXSUBAUTHS 15 /* max sub authorities in a SID */
63 uint32_t sub_auths[MAXSUBAUTHS];
66 struct DOMAIN_CONTROLLER_INFO {
67 const char * domain_controller_name;
68 const char * domain_controller_address;
69 uint32_t domain_controller_address_type;
70 struct GUID domain_guid;
71 const char * domain_name;
72 const char * dns_forest_name;
74 const char * dc_site_name;
75 const char * client_site_name;
78 #define FILTER_TEMP_DUPLICATE_ACCOUNT ( 0x0001 )
79 #define FILTER_NORMAL_ACCOUNT ( 0x0002 )
80 #define FILTER_INTERDOMAIN_TRUST_ACCOUNT ( 0x0008 )
81 #define FILTER_WORKSTATION_TRUST_ACCOUNT ( 0x0010 )
82 #define FILTER_SERVER_TRUST_ACCOUNT ( 0x0020 )
84 #define TIMEQ_FOREVER ( (uint32_t)-1L )
86 struct SERVER_INFO_1005 {
87 const char * sv1005_comment;
91 const char * usri0_name;
94 #define USER_PRIV_GUEST ( 0 )
95 #define USER_PRIV_USER ( 1 )
96 #define USER_PRIV_ADMIN ( 2 )
99 const char * usri1_name;
100 const char * usri1_password;
101 uint32_t usri1_password_age;
103 const char * usri1_home_dir;
104 const char * usri1_comment;
105 uint32_t usri1_flags;
106 const char * usri1_script_path;
110 const char * usri2_name;
111 const char * usri2_password;
112 uint32_t usri2_password_age;
114 const char * usri2_home_dir;
115 const char * usri2_comment;
116 uint32_t usri2_flags;
117 const char * usri2_script_path;
118 uint32_t usri2_auth_flags;
119 const char * usri2_full_name;
120 const char * usri2_usr_comment;
121 const char * usri2_parms;
122 const char * usri2_workstations;
123 uint32_t usri2_last_logon;
124 uint32_t usri2_last_logoff;
125 uint32_t usri2_acct_expires;
126 uint32_t usri2_max_storage;
127 uint32_t usri2_units_per_week;
128 uint8_t *usri2_logon_hours;/* [unique] */
129 uint32_t usri2_bad_pw_count;
130 uint32_t usri2_num_logons;
131 const char * usri2_logon_server;
132 uint32_t usri2_country_code;
133 uint32_t usri2_code_page;
137 const char * usri3_name;
138 uint32_t usri3_password_age;
140 const char * usri3_home_dir;
141 const char * usri3_comment;
142 uint32_t usri3_flags;
143 const char * usri3_script_path;
144 uint32_t usri3_auth_flags;
145 const char * usri3_full_name;
146 const char * usri3_usr_comment;
147 const char * usri3_parms;
148 const char * usri3_workstations;
149 uint32_t usri3_last_logon;
150 uint32_t usri3_last_logoff;
151 uint32_t usri3_acct_expires;
152 uint32_t usri3_max_storage;
153 uint32_t usri3_units_per_week;
154 uint8_t *usri3_logon_hours;/* [unique] */
155 uint32_t usri3_bad_pw_count;
156 uint32_t usri3_num_logons;
157 const char * usri3_logon_server;
158 uint32_t usri3_country_code;
159 uint32_t usri3_code_page;
160 uint32_t usri3_user_id;
161 uint32_t usri3_primary_group_id;
162 const char * usri3_profile;
163 const char * usri3_home_dir_drive;
164 uint32_t usri3_password_expired;
168 const char * usri4_name;
169 const char * usri4_password;
170 uint32_t usri4_password_age;
172 const char * usri4_home_dir;
173 const char * usri4_comment;
174 uint32_t usri4_flags;
175 const char * usri4_script_path;
176 uint32_t usri4_auth_flags;
177 const char * usri4_full_name;
178 const char * usri4_usr_comment;
179 const char * usri4_parms;
180 const char * usri4_workstations;
181 uint32_t usri4_last_logon;
182 uint32_t usri4_last_logoff;
183 uint32_t usri4_acct_expires;
184 uint32_t usri4_max_storage;
185 uint32_t usri4_units_per_week;
186 uint8_t *usri4_logon_hours;/* [unique] */
187 uint32_t usri4_bad_pw_count;
188 uint32_t usri4_num_logons;
189 const char * usri4_logon_server;
190 uint32_t usri4_country_code;
191 uint32_t usri4_code_page;
192 struct domsid *usri4_user_sid;/* [unique] */
193 uint32_t usri4_primary_group_id;
194 const char * usri4_profile;
195 const char * usri4_home_dir_drive;
196 uint32_t usri4_password_expired;
199 struct USER_INFO_10 {
200 const char * usri10_name;
201 const char * usri10_comment;
202 const char * usri10_usr_comment;
203 const char * usri10_full_name;
206 struct USER_INFO_11 {
207 const char * usri11_name;
208 const char * usri11_comment;
209 const char * usri11_usr_comment;
210 const char * usri11_full_name;
211 uint32_t usri11_priv;
212 uint32_t usri11_auth_flags;
213 uint32_t usri11_password_age;
214 const char * usri11_home_dir;
215 const char * usri11_parms;
216 uint32_t usri11_last_logon;
217 uint32_t usri11_last_logoff;
218 uint32_t usri11_bad_pw_count;
219 uint32_t usri11_num_logons;
220 const char * usri11_logon_server;
221 uint32_t usri11_country_code;
222 const char * usri11_workstations;
223 uint32_t usri11_max_storage;
224 uint32_t usri11_units_per_week;
225 uint8_t *usri11_logon_hours;/* [unique] */
226 uint32_t usri11_code_page;
229 struct USER_INFO_20 {
230 const char * usri20_name;
231 const char * usri20_full_name;
232 const char * usri20_comment;
233 uint32_t usri20_flags;
234 uint32_t usri20_user_id;
237 struct USER_INFO_21 {
238 uint8_t *usri21_password;
241 struct USER_INFO_22 {
242 const char * usri22_name;
243 uint8_t *usri22_password;
244 uint32_t usri22_password_age;
245 uint32_t usri22_priv;
246 const char * usri22_home_dir;
247 const char * usri22_comment;
248 uint32_t usri22_flags;
249 uint32_t usri22_script_path;
250 uint32_t usri22_auth_flags;
251 const char * usri22_full_name;
252 const char * usri22_usr_comment;
253 const char * usri22_parms;
254 const char * usri22_workstations;
255 uint32_t usri22_last_logon;
256 uint32_t usri22_last_logoff;
257 uint32_t usri22_acct_expires;
258 uint32_t usri22_max_storage;
259 uint32_t usri22_units_per_week;
260 uint8_t *usri22_logon_hours;/* [unique] */
261 uint32_t usri22_bad_pw_count;
262 uint32_t usri22_num_logons;
263 const char * usri22_logon_server;
264 uint32_t usri22_country_code;
265 uint32_t usri22_code_page;
268 struct USER_INFO_23 {
269 const char * usri23_name;
270 const char * usri23_full_name;
271 const char * usri23_comment;
272 uint32_t usri23_flags;
273 struct domsid *usri23_user_sid;/* [unique] */
276 struct USER_INFO_1003 {
277 const char * usri1003_password;
280 struct USER_INFO_1005 {
281 uint32_t usri1005_priv;
284 struct USER_INFO_1006 {
285 const char * usri1006_home_dir;
288 struct USER_INFO_1007 {
289 const char * usri1007_comment;
292 struct USER_INFO_1008 {
293 uint32_t usri1008_flags;
296 struct USER_INFO_1009 {
297 const char * usri1009_script_path;
300 struct USER_INFO_1010 {
301 uint32_t usri1010_auth_flags;
304 struct USER_INFO_1011 {
305 const char * usri1011_full_name;
308 struct USER_INFO_1012 {
309 const char * usri1012_usr_comment;
312 struct USER_INFO_1013 {
313 const char * usri1013_parms;
316 struct USER_INFO_1014 {
317 const char * usri1014_workstations;
320 struct USER_INFO_1017 {
321 uint32_t usri1017_acct_expires;
324 struct USER_INFO_1018 {
325 uint32_t usri1018_max_storage;
328 struct USER_INFO_1020 {
329 uint32_t usri1020_units_per_week;
330 uint8_t *usri1020_logon_hours;/* [unique] */
333 struct USER_INFO_1023 {
334 const char * usri1023_logon_server;
337 struct USER_INFO_1024 {
338 uint32_t usri1024_country_code;
341 struct USER_INFO_1025 {
342 uint32_t usri1025_code_page;
345 struct USER_INFO_1051 {
346 uint32_t usri1051_primary_group_id;
349 struct USER_INFO_1052 {
350 const char * usri1052_profile;
353 struct USER_INFO_1053 {
354 const char * usri1053_home_dir_drive;
357 struct USER_MODALS_INFO_0 {
358 uint32_t usrmod0_min_passwd_len;
359 uint32_t usrmod0_max_passwd_age;
360 uint32_t usrmod0_min_passwd_age;
361 uint32_t usrmod0_force_logoff;
362 uint32_t usrmod0_password_hist_len;
365 struct USER_MODALS_INFO_1 {
366 uint32_t usrmod1_role;
367 const char * usrmod1_primary;
370 struct USER_MODALS_INFO_2 {
371 const char * usrmod2_domain_name;
372 struct domsid *usrmod2_domain_id;/* [unique] */
375 struct USER_MODALS_INFO_3 {
376 uint32_t usrmod3_lockout_duration;
377 uint32_t usrmod3_lockout_observation_window;
378 uint32_t usrmod3_lockout_threshold;
381 struct USER_MODALS_INFO_1001 {
382 uint32_t usrmod1001_min_passwd_len;
385 struct USER_MODALS_INFO_1002 {
386 uint32_t usrmod1002_max_passwd_age;
389 struct USER_MODALS_INFO_1003 {
390 uint32_t usrmod1003_min_passwd_age;
393 struct USER_MODALS_INFO_1004 {
394 uint32_t usrmod1004_force_logoff;
397 struct USER_MODALS_INFO_1005 {
398 uint32_t usrmod1005_password_hist_len;
401 struct USER_MODALS_INFO_1006 {
402 uint32_t usrmod1006_role;
405 struct USER_MODALS_INFO_1007 {
406 const char * usrmod1007_primary;
409 struct NET_DISPLAY_USER {
410 const char * usri1_name;
411 const char * usri1_comment;
412 uint32_t usri1_flags;
413 const char * usri1_full_name;
414 uint32_t usri1_user_id;
415 uint32_t usri1_next_index;
418 struct NET_DISPLAY_MACHINE {
419 const char * usri2_name;
420 const char * usri2_comment;
421 uint32_t usri2_flags;
422 uint32_t usri2_user_id;
423 uint32_t usri2_next_index;
426 struct NET_DISPLAY_GROUP {
427 const char * grpi3_name;
428 const char * grpi3_comment;
429 uint32_t grpi3_group_id;
430 uint32_t grpi3_attributes;
431 uint32_t grpi3_next_index;
434 struct GROUP_INFO_0 {
435 const char * grpi0_name;
438 struct GROUP_INFO_1 {
439 const char * grpi1_name;
440 const char * grpi1_comment;
443 struct GROUP_INFO_2 {
444 const char * grpi2_name;
445 const char * grpi2_comment;
446 uint32_t grpi2_group_id;
447 uint32_t grpi2_attributes;
450 struct GROUP_INFO_3 {
451 const char * grpi3_name;
452 const char * grpi3_comment;
453 struct domsid * grpi3_group_sid;
454 uint32_t grpi3_attributes;
457 struct GROUP_INFO_1002 {
458 const char * grpi1002_comment;
461 struct GROUP_INFO_1005 {
462 uint32_t grpi1005_attributes;
465 struct GROUP_USERS_INFO_0 {
466 const char * grui0_name;
469 struct GROUP_USERS_INFO_1 {
470 const char * grui1_name;
471 uint32_t grui1_attributes;
474 struct LOCALGROUP_INFO_0 {
475 const char * lgrpi0_name;
478 struct LOCALGROUP_INFO_1 {
479 const char * lgrpi1_name;
480 const char * lgrpi1_comment;
483 struct LOCALGROUP_INFO_1002 {
484 const char * lgrpi1002_comment;
492 SidTypeWellKnownGroup=5,
493 SidTypeDeletedAccount=6,
500 struct LOCALGROUP_MEMBERS_INFO_0 {
501 struct domsid *lgrmi0_sid;/* [unique] */
504 struct LOCALGROUP_MEMBERS_INFO_1 {
505 struct domsid *lgrmi1_sid;/* [unique] */
506 enum SID_NAME_USE lgrmi1_sidusage;
507 const char * lgrmi1_name;
510 struct LOCALGROUP_MEMBERS_INFO_2 {
511 struct domsid *lgrmi2_sid;/* [unique] */
512 enum SID_NAME_USE lgrmi2_sidusage;
513 const char * lgrmi2_domainandname;
516 struct LOCALGROUP_MEMBERS_INFO_3 {
517 const char * lgrmi3_domainandname;
520 struct TIME_OF_DAY_INFO {
521 uint32_t tod_elapsedt;
527 int32_t tod_timezone;
528 uint32_t tod_tinterval;
532 uint32_t tod_weekday;
535 #endif /* _HEADER_libnetapi */
537 /****************************************************************
538 ****************************************************************/
540 struct libnetapi_ctx {
548 int disable_policy_handle_cache;
553 /****************************************************************
554 ****************************************************************/
556 NET_API_STATUS libnetapi_init(struct libnetapi_ctx **ctx);
558 /****************************************************************
559 ****************************************************************/
561 NET_API_STATUS libnetapi_free(struct libnetapi_ctx *ctx);
563 /****************************************************************
564 ****************************************************************/
566 NET_API_STATUS libnetapi_getctx(struct libnetapi_ctx **ctx);
568 /****************************************************************
569 ****************************************************************/
571 NET_API_STATUS libnetapi_set_debuglevel(struct libnetapi_ctx *ctx,
572 const char *debuglevel);
574 /****************************************************************
575 ****************************************************************/
577 NET_API_STATUS libnetapi_set_username(struct libnetapi_ctx *ctx,
578 const char *username);
580 /****************************************************************
581 ****************************************************************/
583 NET_API_STATUS libnetapi_set_password(struct libnetapi_ctx *ctx,
584 const char *password);
586 /****************************************************************
587 ****************************************************************/
589 NET_API_STATUS libnetapi_set_workgroup(struct libnetapi_ctx *ctx,
590 const char *workgroup);
592 /****************************************************************
593 ****************************************************************/
595 NET_API_STATUS libnetapi_set_use_kerberos(struct libnetapi_ctx *ctx);
597 /****************************************************************
598 ****************************************************************/
600 const char *libnetapi_errstr(NET_API_STATUS status);
602 /****************************************************************
603 ****************************************************************/
605 const char *libnetapi_get_error_string(struct libnetapi_ctx *ctx,
606 NET_API_STATUS status);
608 /****************************************************************
610 ****************************************************************/
612 NET_API_STATUS NetApiBufferAllocate(uint32_t byte_count,
615 /****************************************************************
617 ****************************************************************/
619 NET_API_STATUS NetApiBufferFree(void *buffer);
621 /************************************************************//**
623 * ConvertSidToStringSid
625 * @brief Convert a domain sid into a string
627 * @param[in] sid A pointer to a sid structure
628 * @param[in,out] sid_string A pointer that holds a pointer to a sid string. Caller
629 * needs to free with free(3)
631 ***************************************************************/
633 int ConvertSidToStringSid(const struct domsid *sid,
636 /************************************************************//**
638 * ConvertStringSidToSid
640 * @brief Convert a string into a domain sid
642 * @param[in] sid_string A pointer to a sid string.
643 * @param[in,out] sid A pointer that holds a pointer to a sid structure.
644 * Caller needs to free with free(3)
646 ***************************************************************/
648 int ConvertStringSidToSid(const char *sid_string,
649 struct domsid **sid);
651 /************************************************************//**
655 * @brief Join a computer to a domain or workgroup
657 * @param[in] server The server name to connect to
658 * @param[in] domain The domain or workgroup to join
659 * @param[in] account_ou The organizational Unit to create the computer account
661 * @param[in] account The domain account used for joining a domain
662 * @param[in] password The domain account's password used for joining a domain
663 * @param[in] join_flags Bitmask field to define specific join features
664 * @return NET_API_STATUS
666 * example netdomjoin/netdomjoin.c
667 ***************************************************************/
669 NET_API_STATUS NetJoinDomain(const char * server /* [in] */,
670 const char * domain /* [in] [ref] */,
671 const char * account_ou /* [in] */,
672 const char * account /* [in] */,
673 const char * password /* [in] */,
674 uint32_t join_flags /* [in] */);
676 /************************************************************//**
680 * @brief Unjoin a computer from a domain or workgroup
682 * @param[in] server_name The server name to connect to
683 * @param[in] account The domain account used for unjoining a domain
684 * @param[in] password The domain account's password used for unjoining a domain
685 * @param[in] unjoin_flags Bitmask field to define specific unjoin features
686 * @return NET_API_STATUS
688 ***************************************************************/
690 NET_API_STATUS NetUnjoinDomain(const char * server_name /* [in] */,
691 const char * account /* [in] */,
692 const char * password /* [in] */,
693 uint32_t unjoin_flags /* [in] */);
695 /************************************************************//**
697 * NetGetJoinInformation
699 * @brief Unjoin a computer from a domain or workgroup
701 * @param[in] server_name The server name to connect to
702 * @param[out] name_buffer Returns the name of the workgroup or domain
703 * @param[out] name_type Returns the type of that name
704 * @return NET_API_STATUS
706 * example netdomjoin-gui/netdomjoin-gui.c
708 ***************************************************************/
710 NET_API_STATUS NetGetJoinInformation(const char * server_name /* [in] */,
711 const char * *name_buffer /* [out] [ref] */,
712 uint16_t *name_type /* [out] [ref] */);
714 /************************************************************//**
718 * @brief Query for the list of joinable organizational Units that can be used
721 * @param[in] server_name The server name to connect to
722 * @param[in] domain The AD domain to query
723 * @param[in] account The domain account used for the query
724 * @param[in] password The domain account's password used for the query
725 * @param[out] ou_count The number of ous returned
726 * @param[out] ous Returned string array containing the ous
727 * @return NET_API_STATUS
729 * example netdomjoin-gui/netdomjoin-gui.c
731 ***************************************************************/
733 NET_API_STATUS NetGetJoinableOUs(const char * server_name /* [in] */,
734 const char * domain /* [in] [ref] */,
735 const char * account /* [in] */,
736 const char * password /* [in] */,
737 uint32_t *ou_count /* [out] [ref] */,
738 const char * **ous /* [out] [ref] */);
740 /************************************************************//**
744 * @brief Get Information on a server
746 * @param[in] server_name The server name to connect to
747 * @param[in] level The level to define which information is requested
748 * @param[out] buffer The returned buffer carrying the SERVER_INFO structure
749 * @return NET_API_STATUS
751 ***************************************************************/
753 NET_API_STATUS NetServerGetInfo(const char * server_name /* [in] */,
754 uint32_t level /* [in] */,
755 uint8_t **buffer /* [out] [ref] */);
757 /************************************************************//**
761 * @brief Get Information on a server
763 * @param[in] server_name The server name to connect to
764 * @param[in] level The level to define which information is set
765 * @param[in] buffer The buffer carrying the SERVER_INFO structure
766 * @param[out] parm_error On failure returns the invalid SERVER_INFO member
767 * @return NET_API_STATUS
769 ***************************************************************/
771 NET_API_STATUS NetServerSetInfo(const char * server_name /* [in] */,
772 uint32_t level /* [in] */,
773 uint8_t *buffer /* [in] [ref] */,
774 uint32_t *parm_error /* [out] [ref] */);
776 /************************************************************//**
780 * @brief Query for the PDC for a given domain
782 * @param[in] server_name The server name to connect to
783 * @param[in] domain_name The name of the domain to lookup
784 * @param[out] buffer The name of the domain to lookup
785 * @return NET_API_STATUS
787 * example getdc/getdc.c
788 ***************************************************************/
790 NET_API_STATUS NetGetDCName(const char * server_name /* [in] */,
791 const char * domain_name /* [in] */,
792 uint8_t **buffer /* [out] [ref] */);
794 /************************************************************//**
798 * @brief Query for any DC for a given domain
800 * @param[in] server_name The server name to connect to
801 * @param[in] domain_name The name of the domain to lookup
802 * @param[out] buffer The name of the domain to lookup
803 * @return NET_API_STATUS
805 * example getdc/getdc.c
806 ***************************************************************/
808 NET_API_STATUS NetGetAnyDCName(const char * server_name /* [in] */,
809 const char * domain_name /* [in] */,
810 uint8_t **buffer /* [out] [ref] */);
813 /************************************************************//**
817 * @brief Lookup a DC for a given domain and return information structure
819 * @param[in] server_name The server name to connect to
820 * @param[in] domain_name The name of the domain to lookup (cannot be NULL)
821 * @param[in] domain_guid The GUID of the domain to lookup (optional)
822 * @param[in] site_name The name of the site the DC should reside in
823 * @param[in] flags A bitmask to request specific features supported by the DC
824 * @param[out] dc_info Pointer to a DOMAIN_CONTROLLER_INFO structure
825 * @return NET_API_STATUS
827 * example dsgetdc/dsgetdc.c
828 ***************************************************************/
830 NET_API_STATUS DsGetDcName(const char * server_name /* [in] [unique] */,
831 const char * domain_name /* [in] [ref] */,
832 struct GUID *domain_guid /* [in] [unique] */,
833 const char * site_name /* [in] [unique] */,
834 uint32_t flags /* [in] */,
835 struct DOMAIN_CONTROLLER_INFO **dc_info /* [out] [ref] */);
837 /************************************************************//**
841 * @brief Create a user on a given server
843 * @param[in] server_name The server name to connect to
844 * @param[in] level The level of the USER_INFO structure passed in (Currently
845 * only level 1 is supported)
846 * @param[in] buffer The buffer carrying the USER_INFO structure
847 * @param[out] parm_error In case of error returns the failing member of the
849 * @return NET_API_STATUS
851 * example user/user_add.c
852 ***************************************************************/
854 NET_API_STATUS NetUserAdd(const char * server_name /* [in] */,
855 uint32_t level /* [in] */,
856 uint8_t *buffer /* [in] [ref] */,
857 uint32_t *parm_error /* [out] [ref] */);
859 /************************************************************//**
863 * @brief Delete a user on a given server
865 * @param[in] server_name The server name to connect to
866 * @param[in] user_name The user account to delete
867 * @return NET_API_STATUS
869 * example user/user_del.c
870 ***************************************************************/
872 NET_API_STATUS NetUserDel(const char * server_name /* [in] */,
873 const char * user_name /* [in] */);
875 /************************************************************//**
879 * @brief Enumerate accounts on a server
881 * @param[in] server_name The server name to connect to
882 * @param[in] level The enumeration level used for the query (Currently only
883 * level 0 is supported)
884 * @param[in] filter The account flags filter used for the query
885 * @param[out] buffer The returned enumeration buffer
886 * @param[in] prefmaxlen The requested maximal buffer size
887 * @param[out] entries_read The number of returned entries
888 * @param[out] total_entries The number of total entries
889 * @param[in,out] resume_handle A handle passed in and returned for resuming
891 * @return NET_API_STATUS
893 * example user/user_enum.c
894 ***************************************************************/
896 NET_API_STATUS NetUserEnum(const char * server_name /* [in] */,
897 uint32_t level /* [in] */,
898 uint32_t filter /* [in] */,
899 uint8_t **buffer /* [out] [ref] */,
900 uint32_t prefmaxlen /* [in] */,
901 uint32_t *entries_read /* [out] [ref] */,
902 uint32_t *total_entries /* [out] [ref] */,
903 uint32_t *resume_handle /* [in,out] [ref] */);
905 /************************************************************//**
907 * NetUserChangePassword
909 * @brief Change the password for a user on a given server or in a given domain
911 * @param[in] domain_name The server or domain name to connect to
912 * @param[in] user_name The user account to change the password for
913 * @param[in] old_password The user account's old password
914 * @param[in] new_password The user account's new password
915 * @return NET_API_STATUS
917 * example user/user_chgpwd.c
918 ***************************************************************/
920 NET_API_STATUS NetUserChangePassword(const char * domain_name /* [in] */,
921 const char * user_name /* [in] */,
922 const char * old_password /* [in] */,
923 const char * new_password /* [in] */);
925 /************************************************************//**
929 * @brief Get User Information
931 * @param[in] server_name The server name to connect to
932 * @param[in] user_name The name of the user that is going to be queried
933 * @param[in] level The level defining the requested USER_INFO_X structure
934 * @param[out] buffer The buffer containing a USER_INFO_X structure
935 * @return NET_API_STATUS
937 * example user/user_getinfo.c
938 ***************************************************************/
940 NET_API_STATUS NetUserGetInfo(const char * server_name /* [in] */,
941 const char * user_name /* [in] */,
942 uint32_t level /* [in] */,
943 uint8_t **buffer /* [out] [ref] */);
945 /************************************************************//**
949 * @brief Set User Information
951 * @param[in] server_name The server name to connect to
952 * @param[in] user_name The name of the user that is going to be modified
953 * @param[in] level The level defining the requested USER_INFO_X structure
954 * @param[in] buffer The buffer containing a USER_INFO_X structure
955 * @param[out] parm_err The returned parameter error number if any
956 * @return NET_API_STATUS
958 * example user/user_setinfo.c
959 ***************************************************************/
961 NET_API_STATUS NetUserSetInfo(const char * server_name /* [in] */,
962 const char * user_name /* [in] */,
963 uint32_t level /* [in] */,
964 uint8_t *buffer /* [in] [ref] */,
965 uint32_t *parm_err /* [out] [ref] */);
967 /************************************************************//**
971 * @brief Get SAM domain and password information
973 * @param[in] server_name The server name to connect to
974 * @param[in] level The level defining which USER_MODALS_INFO_X buffer to query
975 * @param[out] buffer The returned USER_MODALS_INFO_X buffer
976 * @return NET_API_STATUS
978 * example user/user_modalsget.c
979 ***************************************************************/
981 NET_API_STATUS NetUserModalsGet(const char * server_name /* [in] */,
982 uint32_t level /* [in] */,
983 uint8_t **buffer /* [out] [ref] */);
985 /************************************************************//**
989 * @brief Set SAM domain and password information
991 * @param[in] server_name The server name to connect to
992 * @param[in] level The level defining which USER_MODALS_INFO_X buffer to query
993 * @param[out] buffer The buffer conntaing a USER_MODALS_INFO_X structure
994 * @param[out] parm_err The returned parameter error number if any
995 * @return NET_API_STATUS
997 * example user/user_modalsset.c
998 ***************************************************************/
1000 NET_API_STATUS NetUserModalsSet(const char * server_name /* [in] */,
1001 uint32_t level /* [in] */,
1002 uint8_t *buffer /* [in] [ref] */,
1003 uint32_t *parm_err /* [out] [ref] */);
1005 /************************************************************//**
1009 * @brief Enumerate grouplist of a user on a server
1011 * @param[in] server_name The server name to connect to
1012 * @param[in] user_name The user name to query
1013 * @param[in] level The enumeration level used for the query (Currently only
1014 * level 0 is supported)
1015 * @param[out] buffer The returned enumeration buffer
1016 * @param[in] prefmaxlen The requested maximal buffer size
1017 * @param[out] entries_read The number of returned entries
1018 * @param[out] total_entries The number of total entries
1019 * @return NET_API_STATUS
1021 * example user/user_getgroups.c
1022 ***************************************************************/
1024 NET_API_STATUS NetUserGetGroups(const char * server_name /* [in] */,
1025 const char * user_name /* [in] */,
1026 uint32_t level /* [in] */,
1027 uint8_t **buffer /* [out] [ref] */,
1028 uint32_t prefmaxlen /* [in] */,
1029 uint32_t *entries_read /* [out] [ref] */,
1030 uint32_t *total_entries /* [out] [ref] */);
1032 /************************************************************//**
1034 * NetQueryDisplayInformation
1036 * @brief Enumerate accounts on a server
1038 * @param[in] server_name The server name to connect to
1039 * @param[in] level The enumeration level used for the query
1040 * @param[in] idx The index to start the the display enumeration at
1041 * @param[in] entries_requested The number of entries requested
1042 * @param[in] prefmaxlen The requested maximal buffer size
1043 * @param[out] entries_read The number of returned entries
1044 * @param[out] buffer The returned display information buffer
1045 * @return NET_API_STATUS
1047 * example user/user_dispinfo.c
1048 ***************************************************************/
1050 NET_API_STATUS NetQueryDisplayInformation(const char * server_name /* [in] [unique] */,
1051 uint32_t level /* [in] */,
1052 uint32_t idx /* [in] */,
1053 uint32_t entries_requested /* [in] */,
1054 uint32_t prefmaxlen /* [in] */,
1055 uint32_t *entries_read /* [out] [ref] */,
1056 void **buffer /* [out] [noprint,ref] */);
1058 /************************************************************//**
1062 * @brief Create Domain Group
1064 * @param[in] server_name The server name to connect to
1065 * @param[in] level The level used for the new group creation
1066 * @param[in] buf The buffer containing the group structure
1067 * @param[out] parm_err The returned parameter error number if any
1068 * @return NET_API_STATUS
1070 * example group/group_add.c
1071 ***************************************************************/
1073 NET_API_STATUS NetGroupAdd(const char * server_name /* [in] */,
1074 uint32_t level /* [in] */,
1075 uint8_t *buf /* [in] [ref] */,
1076 uint32_t *parm_err /* [out] [ref] */);
1078 /************************************************************//**
1082 * @brief Delete Domain Group
1084 * @param[in] server_name The server name to connect to
1085 * @param[in] group_name The name of the group that is going to be deleted
1086 * @return NET_API_STATUS
1088 * example group/group_del.c
1089 ***************************************************************/
1091 NET_API_STATUS NetGroupDel(const char * server_name /* [in] */,
1092 const char * group_name /* [in] */);
1094 /************************************************************//**
1098 * @brief Enumerate groups on a server
1100 * @param[in] server_name The server name to connect to
1101 * @param[in] level The enumeration level used for the query (Currently only
1102 * level 0 is supported)
1103 * @param[out] buffer The returned enumeration buffer
1104 * @param[in] prefmaxlen The requested maximal buffer size
1105 * @param[out] entries_read The number of returned entries
1106 * @param[out] total_entries The number of total entries
1107 * @param[in,out] resume_handle A handle passed in and returned for resuming
1109 * @return NET_API_STATUS
1111 * example group/group_enum.c
1112 ***************************************************************/
1114 NET_API_STATUS NetGroupEnum(const char * server_name /* [in] */,
1115 uint32_t level /* [in] */,
1116 uint8_t **buffer /* [out] [ref] */,
1117 uint32_t prefmaxlen /* [in] */,
1118 uint32_t *entries_read /* [out] [ref] */,
1119 uint32_t *total_entries /* [out] [ref] */,
1120 uint32_t *resume_handle /* [in,out] [ref] */);
1122 /************************************************************//**
1126 * @brief Set Domain Group Information
1128 * @param[in] server_name The server name to connect to
1129 * @param[in] group_name The name of the group that is going to be modified
1130 * @param[in] level The level defining the structure type in buf
1131 * @param[in] buf The buffer containing a GROUP_INFO_X structure
1132 * @param[out] parm_err The returned parameter error number if any
1133 * @return NET_API_STATUS
1135 * example group/group_setinfo.c
1136 ***************************************************************/
1138 NET_API_STATUS NetGroupSetInfo(const char * server_name /* [in] */,
1139 const char * group_name /* [in] */,
1140 uint32_t level /* [in] */,
1141 uint8_t *buf /* [in] [ref] */,
1142 uint32_t *parm_err /* [out] [ref] */);
1144 /************************************************************//**
1148 * @brief Get Domain Group Information
1150 * @param[in] server_name The server name to connect to
1151 * @param[in] group_name The name of the group that is going to be queried
1152 * @param[in] level The level defining the requested GROUP_INFO_X structure
1153 * @param[out] buf The buffer containing a GROUP_INFO_X structure
1154 * @return NET_API_STATUS
1156 * example group/group_getinfo.c
1157 ***************************************************************/
1159 NET_API_STATUS NetGroupGetInfo(const char * server_name /* [in] */,
1160 const char * group_name /* [in] */,
1161 uint32_t level /* [in] */,
1162 uint8_t **buf /* [out] [ref] */);
1164 /************************************************************//**
1168 * @brief Add existing User to existing Domain Group
1170 * @param[in] server_name The server name to connect to
1171 * @param[in] group_name The name of the group that is going to be modified
1172 * @param[in] user_name The name of the user that is going to be added to the
1174 * @return NET_API_STATUS
1176 * example group/group_adduser.c
1177 ***************************************************************/
1179 NET_API_STATUS NetGroupAddUser(const char * server_name /* [in] */,
1180 const char * group_name /* [in] */,
1181 const char * user_name /* [in] */);
1183 /************************************************************//**
1187 * @brief Remove User from Domain Group
1189 * @param[in] server_name The server name to connect to
1190 * @param[in] group_name The name of the group that is going to be modified
1191 * @param[in] user_name The name of the user that is going to be removed from
1193 * @return NET_API_STATUS
1195 * example group/group_deluser.c
1196 ***************************************************************/
1198 NET_API_STATUS NetGroupDelUser(const char * server_name /* [in] */,
1199 const char * group_name /* [in] */,
1200 const char * user_name /* [in] */);
1202 /************************************************************//**
1206 * @brief Get Users for a group on a server
1208 * @param[in] server_name The server name to connect to
1209 * @param[in] group_name The group name to enumerate users for
1210 * @param[in] level The enumeration level used for the query
1211 * @param[out] buffer The returned enumeration buffer
1212 * @param[in] prefmaxlen The requested maximal buffer size
1213 * @param[out] entries_read The number of returned entries
1214 * @param[out] total_entries The number of total entries
1215 * @param[in,out] resume_handle A handle passed in and returned for resuming
1217 * @return NET_API_STATUS
1219 * example group/group_getusers.c
1220 ***************************************************************/
1222 NET_API_STATUS NetGroupGetUsers(const char * server_name /* [in] */,
1223 const char * group_name /* [in] */,
1224 uint32_t level /* [in] */,
1225 uint8_t **buffer /* [out] [ref] */,
1226 uint32_t prefmaxlen /* [in] */,
1227 uint32_t *entries_read /* [out] [ref] */,
1228 uint32_t *total_entries /* [out] [ref] */,
1229 uint32_t *resume_handle /* [in,out] [ref] */);
1231 /************************************************************//**
1235 * @brief Create Local Group
1237 * @param[in] server_name The server name to connect to
1238 * @param[in] level The level used for the new group creation
1239 * @param[in] buf The buffer containing the group structure
1240 * @param[out] parm_err The returned parameter error number if any
1241 * @return NET_API_STATUS
1243 * example localgroup/localgroup_add.c
1244 ***************************************************************/
1246 NET_API_STATUS NetLocalGroupAdd(const char * server_name /* [in] */,
1247 uint32_t level /* [in] */,
1248 uint8_t *buf /* [in] [ref] */,
1249 uint32_t *parm_err /* [out] [ref] */);
1251 /************************************************************//**
1255 * @brief Delete Local Group
1257 * @param[in] server_name The server name to connect to
1258 * @param[in] group_name The name of the group that is going to be deleted
1259 * @return NET_API_STATUS
1261 * example localgroup/localgroup_del.c
1262 ***************************************************************/
1265 NET_API_STATUS NetLocalGroupDel(const char * server_name /* [in] */,
1266 const char * group_name /* [in] */);
1268 /************************************************************//**
1270 * NetLocalGroupGetInfo
1272 * @brief Get Local Group Information
1274 * @param[in] server_name The server name to connect to
1275 * @param[in] group_name The name of the group that is going to be queried
1276 * @param[in] level The level defining the requested LOCALGROUP_INFO_X structure
1277 * @param[out] buf The buffer containing a LOCALGROUP_INFO_X structure
1278 * @return NET_API_STATUS
1280 * example localgroup/localgroup_getinfo.c
1281 ***************************************************************/
1283 NET_API_STATUS NetLocalGroupGetInfo(const char * server_name /* [in] */,
1284 const char * group_name /* [in] */,
1285 uint32_t level /* [in] */,
1286 uint8_t **buf /* [out] [ref] */);
1288 /************************************************************//**
1290 * NetLocalGroupSetInfo
1292 * @brief Set Local Group Information
1294 * @param[in] server_name The server name to connect to
1295 * @param[in] group_name The name of the group that is going to be modified
1296 * @param[in] level The level defining the requested LOCALGROUP_INFO_X structure
1297 * @param[in] buf The buffer containing a LOCALGROUP_INFO_X structure
1298 * @param[out] parm_err The returned parameter error number if any
1299 * @return NET_API_STATUS
1301 * example localgroup/localgroup_setinfo.c
1302 ***************************************************************/
1305 NET_API_STATUS NetLocalGroupSetInfo(const char * server_name /* [in] */,
1306 const char * group_name /* [in] */,
1307 uint32_t level /* [in] */,
1308 uint8_t *buf /* [in] [ref] */,
1309 uint32_t *parm_err /* [out] [ref] */);
1311 /************************************************************//**
1315 * @brief Enumerate local groups on a server
1317 * @param[in] server_name The server name to connect to
1318 * @param[in] level The enumeration level used for the query (Currently only
1319 * level 0 is supported)
1320 * @param[out] buffer The returned enumeration buffer
1321 * @param[in] prefmaxlen The requested maximal buffer size
1322 * @param[out] entries_read The number of returned entries
1323 * @param[out] total_entries The number of total entries
1324 * @param[in,out] resume_handle A handle passed in and returned for resuming
1326 * @return NET_API_STATUS
1328 * example localgroup/localgroup_enum.c
1329 ***************************************************************/
1331 NET_API_STATUS NetLocalGroupEnum(const char * server_name /* [in] */,
1332 uint32_t level /* [in] */,
1333 uint8_t **buffer /* [out] [ref] */,
1334 uint32_t prefmaxlen /* [in] */,
1335 uint32_t *entries_read /* [out] [ref] */,
1336 uint32_t *total_entries /* [out] [ref] */,
1337 uint32_t *resume_handle /* [in,out] [ref] */);
1339 /************************************************************//**
1341 * NetLocalGroupAddMembers
1343 * @brief Add Members to a Local Group
1345 * @param[in] server_name The server name to connect to
1346 * @param[in] group_name The name of the group that is going to modified
1347 * @param[in] level The level defining the LOCALGROUP_MEMBERS_INFO_X structure
1348 * @param[in] buffer The buffer containing a LOCALGROUP_MEMBERS_INFO_X structure
1349 * @param[in] total_entries The number of LOCALGROUP_MEMBERS_INFO_X entries in
1351 * @return NET_API_STATUS
1353 * example localgroup/localgroup_addmembers.c
1354 ***************************************************************/
1356 NET_API_STATUS NetLocalGroupAddMembers(const char * server_name /* [in] */,
1357 const char * group_name /* [in] */,
1358 uint32_t level /* [in] */,
1359 uint8_t *buffer /* [in] [ref] */,
1360 uint32_t total_entries /* [in] */);
1362 /************************************************************//**
1364 * NetLocalGroupDelMembers
1366 * @brief Delete Members from a Local Group
1368 * @param[in] server_name The server name to connect to
1369 * @param[in] group_name The name of the group that is going to modified
1370 * @param[in] level The level defining the LOCALGROUP_MEMBERS_INFO_X structure
1371 * @param[in] buffer The buffer containing a LOCALGROUP_MEMBERS_INFO_X structure
1372 * @param[in] total_entries The number of LOCALGROUP_MEMBERS_INFO_X entries in
1374 * @return NET_API_STATUS
1376 * example localgroup/localgroup_delmembers.c
1377 ***************************************************************/
1379 NET_API_STATUS NetLocalGroupDelMembers(const char * server_name /* [in] */,
1380 const char * group_name /* [in] */,
1381 uint32_t level /* [in] */,
1382 uint8_t *buffer /* [in] [ref] */,
1383 uint32_t total_entries /* [in] */);
1385 /************************************************************//**
1387 * NetLocalGroupGetMembers
1389 * @brief Enumerate Members in a local group
1391 * @param[in] server_name The server name to connect to
1392 * @param[in] local_group_name The localgroup that is going to be queried
1393 * @param[in] level The level defining the LOCALGROUP_MEMBERS_INFO_X structure
1394 * @param[out] buffer The buffer containing a LOCALGROUP_MEMBERS_INFO_X
1396 * @param[in] prefmaxlen The requested maximal buffer size
1397 * @param[out] entries_read The number of LOCALGROUP_MEMBERS_INFO_X entries in the buffer
1398 * @param[out] total_entries The total number of LOCALGROUP_MEMBERS_INFO_X entries for that group
1399 * @param[in,out] resume_handle A handle passed in and returned for resuming
1401 * @return NET_API_STATUS
1403 * example localgroup/localgroup_getmembers.c
1404 ***************************************************************/
1406 NET_API_STATUS NetLocalGroupGetMembers(const char * server_name /* [in] */,
1407 const char * local_group_name /* [in] */,
1408 uint32_t level /* [in] */,
1409 uint8_t **buffer /* [out] [ref] */,
1410 uint32_t prefmaxlen /* [in] */,
1411 uint32_t *entries_read /* [out] [ref] */,
1412 uint32_t *total_entries /* [out] [ref] */,
1413 uint32_t *resume_handle /* [in,out] [ref] */);
1415 /************************************************************//**
1417 * NetLocalGroupSetMembers
1419 * @brief Set Members in a Local Group
1421 * @param[in] server_name The server name to connect to
1422 * @param[in] group_name The name of the group that is going to modified
1423 * @param[in] level The level defining the LOCALGROUP_MEMBERS_INFO_X structure
1424 * @param[in] buffer The buffer containing a LOCALGROUP_MEMBERS_INFO_X structure
1425 * @param[in] total_entries The number of LOCALGROUP_MEMBERS_INFO_X entries in
1427 * @return NET_API_STATUS
1429 * example localgroup/localgroup_setmembers.c
1430 ***************************************************************/
1432 NET_API_STATUS NetLocalGroupSetMembers(const char * server_name /* [in] */,
1433 const char * group_name /* [in] */,
1434 uint32_t level /* [in] */,
1435 uint8_t *buffer /* [in] [ref] */,
1436 uint32_t total_entries /* [in] */);
1438 /************************************************************//**
1442 * @brief Query remote Time of Day
1444 * @param[in] server_name The server name to connect to
1445 * @param[out] buf The buffer containing a TIME_OF_DAY_INFO structure
1446 * @return NET_API_STATUS
1448 * example server/remote_tod.c
1449 ***************************************************************/
1451 NET_API_STATUS NetRemoteTOD(const char * server_name /* [in] */,
1452 uint8_t **buf /* [out] [ref] */);
1455 #endif /* __cplusplus */
1457 #endif /* __LIB_NETAPI_H__ */