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 /* bitmap NetJoinFlags */
79 #define NETSETUP_JOIN_DOMAIN ( 0x00000001 )
80 #define NETSETUP_ACCT_CREATE ( 0x00000002 )
81 #define NETSETUP_ACCT_DELETE ( 0x00000004 )
82 #define NETSETUP_WIN9X_UPGRADE ( 0x00000010 )
83 #define NETSETUP_DOMAIN_JOIN_IF_JOINED ( 0x00000020 )
84 #define NETSETUP_JOIN_UNSECURE ( 0x00000040 )
85 #define NETSETUP_MACHINE_PWD_PASSED ( 0x00000080 )
86 #define NETSETUP_DEFER_SPN_SET ( 0x00000100 )
87 #define NETSETUP_JOIN_DC_ACCOUNT ( 0x00000200 )
88 #define NETSETUP_JOIN_WITH_NEW_NAME ( 0x00000400 )
89 #define NETSETUP_INSTALL_INVOCATION ( 0x00040000 )
90 #define NETSETUP_IGNORE_UNSUPPORTED_FLAGS ( 0x10000000 )
92 #define FILTER_TEMP_DUPLICATE_ACCOUNT ( 0x0001 )
93 #define FILTER_NORMAL_ACCOUNT ( 0x0002 )
94 #define FILTER_INTERDOMAIN_TRUST_ACCOUNT ( 0x0008 )
95 #define FILTER_WORKSTATION_TRUST_ACCOUNT ( 0x0010 )
96 #define FILTER_SERVER_TRUST_ACCOUNT ( 0x0020 )
98 #define TIMEQ_FOREVER ( (uint32_t)-1L )
100 struct SERVER_INFO_1005
{
101 const char * sv1005_comment
;
105 const char * usri0_name
;
108 #define USER_PRIV_GUEST ( 0 )
109 #define USER_PRIV_USER ( 1 )
110 #define USER_PRIV_ADMIN ( 2 )
113 const char * usri1_name
;
114 const char * usri1_password
;
115 uint32_t usri1_password_age
;
117 const char * usri1_home_dir
;
118 const char * usri1_comment
;
119 uint32_t usri1_flags
;
120 const char * usri1_script_path
;
123 #define AF_OP_PRINT ( 0x1 )
124 #define AF_OP_COMM ( 0x2 )
125 #define AF_OP_SERVER ( 0x4 )
126 #define AF_OP_ACCOUNTS ( 0x8 )
129 const char * usri2_name
;
130 const char * usri2_password
;
131 uint32_t usri2_password_age
;
133 const char * usri2_home_dir
;
134 const char * usri2_comment
;
135 uint32_t usri2_flags
;
136 const char * usri2_script_path
;
137 uint32_t usri2_auth_flags
;
138 const char * usri2_full_name
;
139 const char * usri2_usr_comment
;
140 const char * usri2_parms
;
141 const char * usri2_workstations
;
142 uint32_t usri2_last_logon
;
143 uint32_t usri2_last_logoff
;
144 uint32_t usri2_acct_expires
;
145 uint32_t usri2_max_storage
;
146 uint32_t usri2_units_per_week
;
147 uint8_t *usri2_logon_hours
;/* [unique] */
148 uint32_t usri2_bad_pw_count
;
149 uint32_t usri2_num_logons
;
150 const char * usri2_logon_server
;
151 uint32_t usri2_country_code
;
152 uint32_t usri2_code_page
;
156 const char * usri3_name
;
157 uint32_t usri3_password_age
;
159 const char * usri3_home_dir
;
160 const char * usri3_comment
;
161 uint32_t usri3_flags
;
162 const char * usri3_script_path
;
163 uint32_t usri3_auth_flags
;
164 const char * usri3_full_name
;
165 const char * usri3_usr_comment
;
166 const char * usri3_parms
;
167 const char * usri3_workstations
;
168 uint32_t usri3_last_logon
;
169 uint32_t usri3_last_logoff
;
170 uint32_t usri3_acct_expires
;
171 uint32_t usri3_max_storage
;
172 uint32_t usri3_units_per_week
;
173 uint8_t *usri3_logon_hours
;/* [unique] */
174 uint32_t usri3_bad_pw_count
;
175 uint32_t usri3_num_logons
;
176 const char * usri3_logon_server
;
177 uint32_t usri3_country_code
;
178 uint32_t usri3_code_page
;
179 uint32_t usri3_user_id
;
180 uint32_t usri3_primary_group_id
;
181 const char * usri3_profile
;
182 const char * usri3_home_dir_drive
;
183 uint32_t usri3_password_expired
;
187 const char * usri4_name
;
188 const char * usri4_password
;
189 uint32_t usri4_password_age
;
191 const char * usri4_home_dir
;
192 const char * usri4_comment
;
193 uint32_t usri4_flags
;
194 const char * usri4_script_path
;
195 uint32_t usri4_auth_flags
;
196 const char * usri4_full_name
;
197 const char * usri4_usr_comment
;
198 const char * usri4_parms
;
199 const char * usri4_workstations
;
200 uint32_t usri4_last_logon
;
201 uint32_t usri4_last_logoff
;
202 uint32_t usri4_acct_expires
;
203 uint32_t usri4_max_storage
;
204 uint32_t usri4_units_per_week
;
205 uint8_t *usri4_logon_hours
;/* [unique] */
206 uint32_t usri4_bad_pw_count
;
207 uint32_t usri4_num_logons
;
208 const char * usri4_logon_server
;
209 uint32_t usri4_country_code
;
210 uint32_t usri4_code_page
;
211 struct domsid
*usri4_user_sid
;/* [unique] */
212 uint32_t usri4_primary_group_id
;
213 const char * usri4_profile
;
214 const char * usri4_home_dir_drive
;
215 uint32_t usri4_password_expired
;
218 struct USER_INFO_10
{
219 const char * usri10_name
;
220 const char * usri10_comment
;
221 const char * usri10_usr_comment
;
222 const char * usri10_full_name
;
225 struct USER_INFO_11
{
226 const char * usri11_name
;
227 const char * usri11_comment
;
228 const char * usri11_usr_comment
;
229 const char * usri11_full_name
;
230 uint32_t usri11_priv
;
231 uint32_t usri11_auth_flags
;
232 uint32_t usri11_password_age
;
233 const char * usri11_home_dir
;
234 const char * usri11_parms
;
235 uint32_t usri11_last_logon
;
236 uint32_t usri11_last_logoff
;
237 uint32_t usri11_bad_pw_count
;
238 uint32_t usri11_num_logons
;
239 const char * usri11_logon_server
;
240 uint32_t usri11_country_code
;
241 const char * usri11_workstations
;
242 uint32_t usri11_max_storage
;
243 uint32_t usri11_units_per_week
;
244 uint8_t *usri11_logon_hours
;/* [unique] */
245 uint32_t usri11_code_page
;
248 struct USER_INFO_20
{
249 const char * usri20_name
;
250 const char * usri20_full_name
;
251 const char * usri20_comment
;
252 uint32_t usri20_flags
;
253 uint32_t usri20_user_id
;
256 struct USER_INFO_21
{
257 uint8_t *usri21_password
;
260 struct USER_INFO_22
{
261 const char * usri22_name
;
262 uint8_t *usri22_password
;
263 uint32_t usri22_password_age
;
264 uint32_t usri22_priv
;
265 const char * usri22_home_dir
;
266 const char * usri22_comment
;
267 uint32_t usri22_flags
;
268 uint32_t usri22_script_path
;
269 uint32_t usri22_auth_flags
;
270 const char * usri22_full_name
;
271 const char * usri22_usr_comment
;
272 const char * usri22_parms
;
273 const char * usri22_workstations
;
274 uint32_t usri22_last_logon
;
275 uint32_t usri22_last_logoff
;
276 uint32_t usri22_acct_expires
;
277 uint32_t usri22_max_storage
;
278 uint32_t usri22_units_per_week
;
279 uint8_t *usri22_logon_hours
;/* [unique] */
280 uint32_t usri22_bad_pw_count
;
281 uint32_t usri22_num_logons
;
282 const char * usri22_logon_server
;
283 uint32_t usri22_country_code
;
284 uint32_t usri22_code_page
;
287 struct USER_INFO_23
{
288 const char * usri23_name
;
289 const char * usri23_full_name
;
290 const char * usri23_comment
;
291 uint32_t usri23_flags
;
292 struct domsid
*usri23_user_sid
;/* [unique] */
295 struct USER_INFO_1003
{
296 const char * usri1003_password
;
299 struct USER_INFO_1005
{
300 uint32_t usri1005_priv
;
303 struct USER_INFO_1006
{
304 const char * usri1006_home_dir
;
307 struct USER_INFO_1007
{
308 const char * usri1007_comment
;
311 struct USER_INFO_1008
{
312 uint32_t usri1008_flags
;
315 struct USER_INFO_1009
{
316 const char * usri1009_script_path
;
319 struct USER_INFO_1010
{
320 uint32_t usri1010_auth_flags
;
323 struct USER_INFO_1011
{
324 const char * usri1011_full_name
;
327 struct USER_INFO_1012
{
328 const char * usri1012_usr_comment
;
331 struct USER_INFO_1013
{
332 const char * usri1013_parms
;
335 struct USER_INFO_1014
{
336 const char * usri1014_workstations
;
339 struct USER_INFO_1017
{
340 uint32_t usri1017_acct_expires
;
343 struct USER_INFO_1018
{
344 uint32_t usri1018_max_storage
;
347 struct USER_INFO_1020
{
348 uint32_t usri1020_units_per_week
;
349 uint8_t *usri1020_logon_hours
;/* [unique] */
352 struct USER_INFO_1023
{
353 const char * usri1023_logon_server
;
356 struct USER_INFO_1024
{
357 uint32_t usri1024_country_code
;
360 struct USER_INFO_1025
{
361 uint32_t usri1025_code_page
;
364 struct USER_INFO_1051
{
365 uint32_t usri1051_primary_group_id
;
368 struct USER_INFO_1052
{
369 const char * usri1052_profile
;
372 struct USER_INFO_1053
{
373 const char * usri1053_home_dir_drive
;
376 struct USER_MODALS_INFO_0
{
377 uint32_t usrmod0_min_passwd_len
;
378 uint32_t usrmod0_max_passwd_age
;
379 uint32_t usrmod0_min_passwd_age
;
380 uint32_t usrmod0_force_logoff
;
381 uint32_t usrmod0_password_hist_len
;
384 struct USER_MODALS_INFO_1
{
385 uint32_t usrmod1_role
;
386 const char * usrmod1_primary
;
389 struct USER_MODALS_INFO_2
{
390 const char * usrmod2_domain_name
;
391 struct domsid
*usrmod2_domain_id
;/* [unique] */
394 struct USER_MODALS_INFO_3
{
395 uint32_t usrmod3_lockout_duration
;
396 uint32_t usrmod3_lockout_observation_window
;
397 uint32_t usrmod3_lockout_threshold
;
400 struct USER_MODALS_INFO_1001
{
401 uint32_t usrmod1001_min_passwd_len
;
404 struct USER_MODALS_INFO_1002
{
405 uint32_t usrmod1002_max_passwd_age
;
408 struct USER_MODALS_INFO_1003
{
409 uint32_t usrmod1003_min_passwd_age
;
412 struct USER_MODALS_INFO_1004
{
413 uint32_t usrmod1004_force_logoff
;
416 struct USER_MODALS_INFO_1005
{
417 uint32_t usrmod1005_password_hist_len
;
420 struct USER_MODALS_INFO_1006
{
421 uint32_t usrmod1006_role
;
424 struct USER_MODALS_INFO_1007
{
425 const char * usrmod1007_primary
;
428 struct NET_DISPLAY_USER
{
429 const char * usri1_name
;
430 const char * usri1_comment
;
431 uint32_t usri1_flags
;
432 const char * usri1_full_name
;
433 uint32_t usri1_user_id
;
434 uint32_t usri1_next_index
;
437 struct NET_DISPLAY_MACHINE
{
438 const char * usri2_name
;
439 const char * usri2_comment
;
440 uint32_t usri2_flags
;
441 uint32_t usri2_user_id
;
442 uint32_t usri2_next_index
;
445 struct NET_DISPLAY_GROUP
{
446 const char * grpi3_name
;
447 const char * grpi3_comment
;
448 uint32_t grpi3_group_id
;
449 uint32_t grpi3_attributes
;
450 uint32_t grpi3_next_index
;
453 struct GROUP_INFO_0
{
454 const char * grpi0_name
;
457 struct GROUP_INFO_1
{
458 const char * grpi1_name
;
459 const char * grpi1_comment
;
462 struct GROUP_INFO_2
{
463 const char * grpi2_name
;
464 const char * grpi2_comment
;
465 uint32_t grpi2_group_id
;
466 uint32_t grpi2_attributes
;
469 struct GROUP_INFO_3
{
470 const char * grpi3_name
;
471 const char * grpi3_comment
;
472 struct domsid
* grpi3_group_sid
;
473 uint32_t grpi3_attributes
;
476 struct GROUP_INFO_1002
{
477 const char * grpi1002_comment
;
480 struct GROUP_INFO_1005
{
481 uint32_t grpi1005_attributes
;
484 struct GROUP_USERS_INFO_0
{
485 const char * grui0_name
;
488 struct GROUP_USERS_INFO_1
{
489 const char * grui1_name
;
490 uint32_t grui1_attributes
;
493 struct LOCALGROUP_INFO_0
{
494 const char * lgrpi0_name
;
497 struct LOCALGROUP_INFO_1
{
498 const char * lgrpi1_name
;
499 const char * lgrpi1_comment
;
502 struct LOCALGROUP_INFO_1002
{
503 const char * lgrpi1002_comment
;
511 SidTypeWellKnownGroup
=5,
512 SidTypeDeletedAccount
=6,
519 struct LOCALGROUP_MEMBERS_INFO_0
{
520 struct domsid
*lgrmi0_sid
;/* [unique] */
523 struct LOCALGROUP_MEMBERS_INFO_1
{
524 struct domsid
*lgrmi1_sid
;/* [unique] */
525 enum SID_NAME_USE lgrmi1_sidusage
;
526 const char * lgrmi1_name
;
529 struct LOCALGROUP_MEMBERS_INFO_2
{
530 struct domsid
*lgrmi2_sid
;/* [unique] */
531 enum SID_NAME_USE lgrmi2_sidusage
;
532 const char * lgrmi2_domainandname
;
535 struct LOCALGROUP_MEMBERS_INFO_3
{
536 const char * lgrmi3_domainandname
;
539 struct TIME_OF_DAY_INFO
{
540 uint32_t tod_elapsedt
;
546 int32_t tod_timezone
;
547 uint32_t tod_tinterval
;
551 uint32_t tod_weekday
;
554 struct SHARE_INFO_2
{
555 const char * shi2_netname
;
557 const char * shi2_remark
;
558 uint32_t shi2_permissions
;
559 uint32_t shi2_max_uses
;
560 uint32_t shi2_current_uses
;
561 const char * shi2_path
;
562 const char * shi2_passwd
;
565 #endif /* _HEADER_libnetapi */
567 /****************************************************************
568 ****************************************************************/
570 struct libnetapi_ctx
{
578 int disable_policy_handle_cache
;
583 /****************************************************************
584 ****************************************************************/
586 NET_API_STATUS
libnetapi_init(struct libnetapi_ctx
**ctx
);
588 /****************************************************************
589 ****************************************************************/
591 NET_API_STATUS
libnetapi_free(struct libnetapi_ctx
*ctx
);
593 /****************************************************************
594 ****************************************************************/
596 NET_API_STATUS
libnetapi_getctx(struct libnetapi_ctx
**ctx
);
598 /****************************************************************
599 ****************************************************************/
601 NET_API_STATUS
libnetapi_set_debuglevel(struct libnetapi_ctx
*ctx
,
602 const char *debuglevel
);
604 /****************************************************************
605 ****************************************************************/
607 NET_API_STATUS
libnetapi_set_username(struct libnetapi_ctx
*ctx
,
608 const char *username
);
610 /****************************************************************
611 ****************************************************************/
613 NET_API_STATUS
libnetapi_set_password(struct libnetapi_ctx
*ctx
,
614 const char *password
);
616 /****************************************************************
617 ****************************************************************/
619 NET_API_STATUS
libnetapi_set_workgroup(struct libnetapi_ctx
*ctx
,
620 const char *workgroup
);
622 /****************************************************************
623 ****************************************************************/
625 NET_API_STATUS
libnetapi_set_use_kerberos(struct libnetapi_ctx
*ctx
);
627 /****************************************************************
628 ****************************************************************/
630 const char *libnetapi_errstr(NET_API_STATUS status
);
632 /****************************************************************
633 ****************************************************************/
635 const char *libnetapi_get_error_string(struct libnetapi_ctx
*ctx
,
636 NET_API_STATUS status
);
638 /****************************************************************
640 ****************************************************************/
642 NET_API_STATUS
NetApiBufferAllocate(uint32_t byte_count
,
645 /****************************************************************
647 ****************************************************************/
649 NET_API_STATUS
NetApiBufferFree(void *buffer
);
651 /************************************************************//**
653 * ConvertSidToStringSid
655 * @brief Convert a domain sid into a string
657 * @param[in] sid A pointer to a sid structure
658 * @param[in,out] sid_string A pointer that holds a pointer to a sid string. Caller
659 * needs to free with free(3)
661 ***************************************************************/
663 int ConvertSidToStringSid(const struct domsid
*sid
,
666 /************************************************************//**
668 * ConvertStringSidToSid
670 * @brief Convert a string into a domain sid
672 * @param[in] sid_string A pointer to a sid string.
673 * @param[in,out] sid A pointer that holds a pointer to a sid structure.
674 * Caller needs to free with free(3)
676 ***************************************************************/
678 int ConvertStringSidToSid(const char *sid_string
,
679 struct domsid
**sid
);
681 /************************************************************//**
685 * @brief Join a computer to a domain or workgroup
687 * @param[in] server The server name to connect to
688 * @param[in] domain The domain or workgroup to join
689 * @param[in] account_ou The organizational Unit to create the computer account
691 * @param[in] account The domain account used for joining a domain
692 * @param[in] password The domain account's password used for joining a domain
693 * @param[in] join_flags Bitmask field to define specific join features
694 * @return NET_API_STATUS
696 * example netdomjoin/netdomjoin.c
697 ***************************************************************/
699 NET_API_STATUS
NetJoinDomain(const char * server
/* [in] */,
700 const char * domain
/* [in] [ref] */,
701 const char * account_ou
/* [in] */,
702 const char * account
/* [in] */,
703 const char * password
/* [in] */,
704 uint32_t join_flags
/* [in] */);
706 /************************************************************//**
710 * @brief Unjoin a computer from a domain or workgroup
712 * @param[in] server_name The server name to connect to
713 * @param[in] account The domain account used for unjoining a domain
714 * @param[in] password The domain account's password used for unjoining a domain
715 * @param[in] unjoin_flags Bitmask field to define specific unjoin features
716 * @return NET_API_STATUS
718 ***************************************************************/
720 NET_API_STATUS
NetUnjoinDomain(const char * server_name
/* [in] */,
721 const char * account
/* [in] */,
722 const char * password
/* [in] */,
723 uint32_t unjoin_flags
/* [in] */);
725 /************************************************************//**
727 * NetGetJoinInformation
729 * @brief Unjoin a computer from a domain or workgroup
731 * @param[in] server_name The server name to connect to
732 * @param[out] name_buffer Returns the name of the workgroup or domain
733 * @param[out] name_type Returns the type of that name
734 * @return NET_API_STATUS
736 * example netdomjoin-gui/netdomjoin-gui.c
738 ***************************************************************/
740 NET_API_STATUS
NetGetJoinInformation(const char * server_name
/* [in] */,
741 const char * *name_buffer
/* [out] [ref] */,
742 uint16_t *name_type
/* [out] [ref] */);
744 /************************************************************//**
748 * @brief Query for the list of joinable organizational Units that can be used
751 * @param[in] server_name The server name to connect to
752 * @param[in] domain The AD domain to query
753 * @param[in] account The domain account used for the query
754 * @param[in] password The domain account's password used for the query
755 * @param[out] ou_count The number of ous returned
756 * @param[out] ous Returned string array containing the ous
757 * @return NET_API_STATUS
759 * example netdomjoin-gui/netdomjoin-gui.c
761 ***************************************************************/
763 NET_API_STATUS
NetGetJoinableOUs(const char * server_name
/* [in] */,
764 const char * domain
/* [in] [ref] */,
765 const char * account
/* [in] */,
766 const char * password
/* [in] */,
767 uint32_t *ou_count
/* [out] [ref] */,
768 const char * **ous
/* [out] [ref] */);
770 /************************************************************//**
774 * @brief Get Information on a server
776 * @param[in] server_name The server name to connect to
777 * @param[in] level The level to define which information is requested
778 * @param[out] buffer The returned buffer carrying the SERVER_INFO structure
779 * @return NET_API_STATUS
781 ***************************************************************/
783 NET_API_STATUS
NetServerGetInfo(const char * server_name
/* [in] */,
784 uint32_t level
/* [in] */,
785 uint8_t **buffer
/* [out] [ref] */);
787 /************************************************************//**
791 * @brief Get Information on a server
793 * @param[in] server_name The server name to connect to
794 * @param[in] level The level to define which information is set
795 * @param[in] buffer The buffer carrying the SERVER_INFO structure
796 * @param[out] parm_error On failure returns the invalid SERVER_INFO member
797 * @return NET_API_STATUS
799 ***************************************************************/
801 NET_API_STATUS
NetServerSetInfo(const char * server_name
/* [in] */,
802 uint32_t level
/* [in] */,
803 uint8_t *buffer
/* [in] [ref] */,
804 uint32_t *parm_error
/* [out] [ref] */);
806 /************************************************************//**
810 * @brief Query for the PDC for a given domain
812 * @param[in] server_name The server name to connect to
813 * @param[in] domain_name The name of the domain to lookup
814 * @param[out] buffer The name of the domain to lookup
815 * @return NET_API_STATUS
817 * example getdc/getdc.c
818 ***************************************************************/
820 NET_API_STATUS
NetGetDCName(const char * server_name
/* [in] */,
821 const char * domain_name
/* [in] */,
822 uint8_t **buffer
/* [out] [ref] */);
824 /************************************************************//**
828 * @brief Query for any DC for a given domain
830 * @param[in] server_name The server name to connect to
831 * @param[in] domain_name The name of the domain to lookup
832 * @param[out] buffer The name of the domain to lookup
833 * @return NET_API_STATUS
835 * example getdc/getdc.c
836 ***************************************************************/
838 NET_API_STATUS
NetGetAnyDCName(const char * server_name
/* [in] */,
839 const char * domain_name
/* [in] */,
840 uint8_t **buffer
/* [out] [ref] */);
843 /************************************************************//**
847 * @brief Lookup a DC for a given domain and return information structure
849 * @param[in] server_name The server name to connect to
850 * @param[in] domain_name The name of the domain to lookup (cannot be NULL)
851 * @param[in] domain_guid The GUID of the domain to lookup (optional)
852 * @param[in] site_name The name of the site the DC should reside in
853 * @param[in] flags A bitmask to request specific features supported by the DC
854 * @param[out] dc_info Pointer to a DOMAIN_CONTROLLER_INFO structure
855 * @return NET_API_STATUS
857 * example dsgetdc/dsgetdc.c
858 ***************************************************************/
860 NET_API_STATUS
DsGetDcName(const char * server_name
/* [in] [unique] */,
861 const char * domain_name
/* [in] [ref] */,
862 struct GUID
*domain_guid
/* [in] [unique] */,
863 const char * site_name
/* [in] [unique] */,
864 uint32_t flags
/* [in] */,
865 struct DOMAIN_CONTROLLER_INFO
**dc_info
/* [out] [ref] */);
867 /************************************************************//**
871 * @brief Create a user on a given server
873 * @param[in] server_name The server name to connect to
874 * @param[in] level The level of the USER_INFO structure passed in (Currently
875 * only level 1 is supported)
876 * @param[in] buffer The buffer carrying the USER_INFO structure
877 * @param[out] parm_error In case of error returns the failing member of the
879 * @return NET_API_STATUS
881 * example user/user_add.c
882 ***************************************************************/
884 NET_API_STATUS
NetUserAdd(const char * server_name
/* [in] */,
885 uint32_t level
/* [in] */,
886 uint8_t *buffer
/* [in] [ref] */,
887 uint32_t *parm_error
/* [out] [ref] */);
889 /************************************************************//**
893 * @brief Delete a user on a given server
895 * @param[in] server_name The server name to connect to
896 * @param[in] user_name The user account to delete
897 * @return NET_API_STATUS
899 * example user/user_del.c
900 ***************************************************************/
902 NET_API_STATUS
NetUserDel(const char * server_name
/* [in] */,
903 const char * user_name
/* [in] */);
905 /************************************************************//**
909 * @brief Enumerate accounts on a server
911 * @param[in] server_name The server name to connect to
912 * @param[in] level The enumeration level used for the query (Currently only
913 * level 0 is supported)
914 * @param[in] filter The account flags filter used for the query
915 * @param[out] buffer The returned enumeration buffer
916 * @param[in] prefmaxlen The requested maximal buffer size
917 * @param[out] entries_read The number of returned entries
918 * @param[out] total_entries The number of total entries
919 * @param[in,out] resume_handle A handle passed in and returned for resuming
921 * @return NET_API_STATUS
923 * example user/user_enum.c
924 ***************************************************************/
926 NET_API_STATUS
NetUserEnum(const char * server_name
/* [in] */,
927 uint32_t level
/* [in] */,
928 uint32_t filter
/* [in] */,
929 uint8_t **buffer
/* [out] [ref] */,
930 uint32_t prefmaxlen
/* [in] */,
931 uint32_t *entries_read
/* [out] [ref] */,
932 uint32_t *total_entries
/* [out] [ref] */,
933 uint32_t *resume_handle
/* [in,out] [ref] */);
935 /************************************************************//**
937 * NetUserChangePassword
939 * @brief Change the password for a user on a given server or in a given domain
941 * @param[in] domain_name The server or domain name to connect to
942 * @param[in] user_name The user account to change the password for
943 * @param[in] old_password The user account's old password
944 * @param[in] new_password The user account's new password
945 * @return NET_API_STATUS
947 * example user/user_chgpwd.c
948 ***************************************************************/
950 NET_API_STATUS
NetUserChangePassword(const char * domain_name
/* [in] */,
951 const char * user_name
/* [in] */,
952 const char * old_password
/* [in] */,
953 const char * new_password
/* [in] */);
955 /************************************************************//**
959 * @brief Get User Information
961 * @param[in] server_name The server name to connect to
962 * @param[in] user_name The name of the user that is going to be queried
963 * @param[in] level The level defining the requested USER_INFO_X structure
964 * @param[out] buffer The buffer containing a USER_INFO_X structure
965 * @return NET_API_STATUS
967 * example user/user_getinfo.c
968 ***************************************************************/
970 NET_API_STATUS
NetUserGetInfo(const char * server_name
/* [in] */,
971 const char * user_name
/* [in] */,
972 uint32_t level
/* [in] */,
973 uint8_t **buffer
/* [out] [ref] */);
975 /************************************************************//**
979 * @brief Set User Information
981 * @param[in] server_name The server name to connect to
982 * @param[in] user_name The name of the user that is going to be modified
983 * @param[in] level The level defining the requested USER_INFO_X structure
984 * @param[in] buffer The buffer containing a USER_INFO_X structure
985 * @param[out] parm_err The returned parameter error number if any
986 * @return NET_API_STATUS
988 * example user/user_setinfo.c
989 ***************************************************************/
991 NET_API_STATUS
NetUserSetInfo(const char * server_name
/* [in] */,
992 const char * user_name
/* [in] */,
993 uint32_t level
/* [in] */,
994 uint8_t *buffer
/* [in] [ref] */,
995 uint32_t *parm_err
/* [out] [ref] */);
997 /************************************************************//**
1001 * @brief Get SAM domain and password information
1003 * @param[in] server_name The server name to connect to
1004 * @param[in] level The level defining which USER_MODALS_INFO_X buffer to query
1005 * @param[out] buffer The returned USER_MODALS_INFO_X buffer
1006 * @return NET_API_STATUS
1008 * example user/user_modalsget.c
1009 ***************************************************************/
1011 NET_API_STATUS
NetUserModalsGet(const char * server_name
/* [in] */,
1012 uint32_t level
/* [in] */,
1013 uint8_t **buffer
/* [out] [ref] */);
1015 /************************************************************//**
1019 * @brief Set SAM domain and password information
1021 * @param[in] server_name The server name to connect to
1022 * @param[in] level The level defining which USER_MODALS_INFO_X buffer to query
1023 * @param[out] buffer The buffer conntaing a USER_MODALS_INFO_X structure
1024 * @param[out] parm_err The returned parameter error number if any
1025 * @return NET_API_STATUS
1027 * example user/user_modalsset.c
1028 ***************************************************************/
1030 NET_API_STATUS
NetUserModalsSet(const char * server_name
/* [in] */,
1031 uint32_t level
/* [in] */,
1032 uint8_t *buffer
/* [in] [ref] */,
1033 uint32_t *parm_err
/* [out] [ref] */);
1035 /************************************************************//**
1039 * @brief Enumerate grouplist of a user on a server
1041 * @param[in] server_name The server name to connect to
1042 * @param[in] user_name The user name to query
1043 * @param[in] level The enumeration level used for the query (Currently only
1044 * level 0 is supported)
1045 * @param[out] buffer The returned enumeration buffer
1046 * @param[in] prefmaxlen The requested maximal buffer size
1047 * @param[out] entries_read The number of returned entries
1048 * @param[out] total_entries The number of total entries
1049 * @return NET_API_STATUS
1051 * example user/user_getgroups.c
1052 ***************************************************************/
1054 NET_API_STATUS
NetUserGetGroups(const char * server_name
/* [in] */,
1055 const char * user_name
/* [in] */,
1056 uint32_t level
/* [in] */,
1057 uint8_t **buffer
/* [out] [ref] */,
1058 uint32_t prefmaxlen
/* [in] */,
1059 uint32_t *entries_read
/* [out] [ref] */,
1060 uint32_t *total_entries
/* [out] [ref] */);
1062 /************************************************************//**
1064 * NetQueryDisplayInformation
1066 * @brief Enumerate accounts on a server
1068 * @param[in] server_name The server name to connect to
1069 * @param[in] level The enumeration level used for the query
1070 * @param[in] idx The index to start the the display enumeration at
1071 * @param[in] entries_requested The number of entries requested
1072 * @param[in] prefmaxlen The requested maximal buffer size
1073 * @param[out] entries_read The number of returned entries
1074 * @param[out] buffer The returned display information buffer
1075 * @return NET_API_STATUS
1077 * example user/user_dispinfo.c
1078 ***************************************************************/
1080 NET_API_STATUS
NetQueryDisplayInformation(const char * server_name
/* [in] [unique] */,
1081 uint32_t level
/* [in] */,
1082 uint32_t idx
/* [in] */,
1083 uint32_t entries_requested
/* [in] */,
1084 uint32_t prefmaxlen
/* [in] */,
1085 uint32_t *entries_read
/* [out] [ref] */,
1086 void **buffer
/* [out] [noprint,ref] */);
1088 /************************************************************//**
1092 * @brief Create Domain Group
1094 * @param[in] server_name The server name to connect to
1095 * @param[in] level The level used for the new group creation
1096 * @param[in] buf The buffer containing the group structure
1097 * @param[out] parm_err The returned parameter error number if any
1098 * @return NET_API_STATUS
1100 * example group/group_add.c
1101 ***************************************************************/
1103 NET_API_STATUS
NetGroupAdd(const char * server_name
/* [in] */,
1104 uint32_t level
/* [in] */,
1105 uint8_t *buf
/* [in] [ref] */,
1106 uint32_t *parm_err
/* [out] [ref] */);
1108 /************************************************************//**
1112 * @brief Delete Domain Group
1114 * @param[in] server_name The server name to connect to
1115 * @param[in] group_name The name of the group that is going to be deleted
1116 * @return NET_API_STATUS
1118 * example group/group_del.c
1119 ***************************************************************/
1121 NET_API_STATUS
NetGroupDel(const char * server_name
/* [in] */,
1122 const char * group_name
/* [in] */);
1124 /************************************************************//**
1128 * @brief Enumerate groups on a server
1130 * @param[in] server_name The server name to connect to
1131 * @param[in] level The enumeration level used for the query (Currently only
1132 * level 0 is supported)
1133 * @param[out] buffer The returned enumeration buffer
1134 * @param[in] prefmaxlen The requested maximal buffer size
1135 * @param[out] entries_read The number of returned entries
1136 * @param[out] total_entries The number of total entries
1137 * @param[in,out] resume_handle A handle passed in and returned for resuming
1139 * @return NET_API_STATUS
1141 * example group/group_enum.c
1142 ***************************************************************/
1144 NET_API_STATUS
NetGroupEnum(const char * server_name
/* [in] */,
1145 uint32_t level
/* [in] */,
1146 uint8_t **buffer
/* [out] [ref] */,
1147 uint32_t prefmaxlen
/* [in] */,
1148 uint32_t *entries_read
/* [out] [ref] */,
1149 uint32_t *total_entries
/* [out] [ref] */,
1150 uint32_t *resume_handle
/* [in,out] [ref] */);
1152 /************************************************************//**
1156 * @brief Set Domain Group Information
1158 * @param[in] server_name The server name to connect to
1159 * @param[in] group_name The name of the group that is going to be modified
1160 * @param[in] level The level defining the structure type in buf
1161 * @param[in] buf The buffer containing a GROUP_INFO_X structure
1162 * @param[out] parm_err The returned parameter error number if any
1163 * @return NET_API_STATUS
1165 * example group/group_setinfo.c
1166 ***************************************************************/
1168 NET_API_STATUS
NetGroupSetInfo(const char * server_name
/* [in] */,
1169 const char * group_name
/* [in] */,
1170 uint32_t level
/* [in] */,
1171 uint8_t *buf
/* [in] [ref] */,
1172 uint32_t *parm_err
/* [out] [ref] */);
1174 /************************************************************//**
1178 * @brief Get Domain Group Information
1180 * @param[in] server_name The server name to connect to
1181 * @param[in] group_name The name of the group that is going to be queried
1182 * @param[in] level The level defining the requested GROUP_INFO_X structure
1183 * @param[out] buf The buffer containing a GROUP_INFO_X structure
1184 * @return NET_API_STATUS
1186 * example group/group_getinfo.c
1187 ***************************************************************/
1189 NET_API_STATUS
NetGroupGetInfo(const char * server_name
/* [in] */,
1190 const char * group_name
/* [in] */,
1191 uint32_t level
/* [in] */,
1192 uint8_t **buf
/* [out] [ref] */);
1194 /************************************************************//**
1198 * @brief Add existing User to existing Domain Group
1200 * @param[in] server_name The server name to connect to
1201 * @param[in] group_name The name of the group that is going to be modified
1202 * @param[in] user_name The name of the user that is going to be added to the
1204 * @return NET_API_STATUS
1206 * example group/group_adduser.c
1207 ***************************************************************/
1209 NET_API_STATUS
NetGroupAddUser(const char * server_name
/* [in] */,
1210 const char * group_name
/* [in] */,
1211 const char * user_name
/* [in] */);
1213 /************************************************************//**
1217 * @brief Remove User from Domain Group
1219 * @param[in] server_name The server name to connect to
1220 * @param[in] group_name The name of the group that is going to be modified
1221 * @param[in] user_name The name of the user that is going to be removed from
1223 * @return NET_API_STATUS
1225 * example group/group_deluser.c
1226 ***************************************************************/
1228 NET_API_STATUS
NetGroupDelUser(const char * server_name
/* [in] */,
1229 const char * group_name
/* [in] */,
1230 const char * user_name
/* [in] */);
1232 /************************************************************//**
1236 * @brief Get Users for a group on a server
1238 * @param[in] server_name The server name to connect to
1239 * @param[in] group_name The group name to enumerate users for
1240 * @param[in] level The enumeration level used for the query
1241 * @param[out] buffer The returned enumeration buffer
1242 * @param[in] prefmaxlen The requested maximal buffer size
1243 * @param[out] entries_read The number of returned entries
1244 * @param[out] total_entries The number of total entries
1245 * @param[in,out] resume_handle A handle passed in and returned for resuming
1247 * @return NET_API_STATUS
1249 * example group/group_getusers.c
1250 ***************************************************************/
1252 NET_API_STATUS
NetGroupGetUsers(const char * server_name
/* [in] */,
1253 const char * group_name
/* [in] */,
1254 uint32_t level
/* [in] */,
1255 uint8_t **buffer
/* [out] [ref] */,
1256 uint32_t prefmaxlen
/* [in] */,
1257 uint32_t *entries_read
/* [out] [ref] */,
1258 uint32_t *total_entries
/* [out] [ref] */,
1259 uint32_t *resume_handle
/* [in,out] [ref] */);
1261 /************************************************************//**
1265 * @brief Create Local Group
1267 * @param[in] server_name The server name to connect to
1268 * @param[in] level The level used for the new group creation
1269 * @param[in] buf The buffer containing the group structure
1270 * @param[out] parm_err The returned parameter error number if any
1271 * @return NET_API_STATUS
1273 * example localgroup/localgroup_add.c
1274 ***************************************************************/
1276 NET_API_STATUS
NetLocalGroupAdd(const char * server_name
/* [in] */,
1277 uint32_t level
/* [in] */,
1278 uint8_t *buf
/* [in] [ref] */,
1279 uint32_t *parm_err
/* [out] [ref] */);
1281 /************************************************************//**
1285 * @brief Delete Local Group
1287 * @param[in] server_name The server name to connect to
1288 * @param[in] group_name The name of the group that is going to be deleted
1289 * @return NET_API_STATUS
1291 * example localgroup/localgroup_del.c
1292 ***************************************************************/
1295 NET_API_STATUS
NetLocalGroupDel(const char * server_name
/* [in] */,
1296 const char * group_name
/* [in] */);
1298 /************************************************************//**
1300 * NetLocalGroupGetInfo
1302 * @brief Get Local Group Information
1304 * @param[in] server_name The server name to connect to
1305 * @param[in] group_name The name of the group that is going to be queried
1306 * @param[in] level The level defining the requested LOCALGROUP_INFO_X structure
1307 * @param[out] buf The buffer containing a LOCALGROUP_INFO_X structure
1308 * @return NET_API_STATUS
1310 * example localgroup/localgroup_getinfo.c
1311 ***************************************************************/
1313 NET_API_STATUS
NetLocalGroupGetInfo(const char * server_name
/* [in] */,
1314 const char * group_name
/* [in] */,
1315 uint32_t level
/* [in] */,
1316 uint8_t **buf
/* [out] [ref] */);
1318 /************************************************************//**
1320 * NetLocalGroupSetInfo
1322 * @brief Set Local Group Information
1324 * @param[in] server_name The server name to connect to
1325 * @param[in] group_name The name of the group that is going to be modified
1326 * @param[in] level The level defining the requested LOCALGROUP_INFO_X structure
1327 * @param[in] buf The buffer containing a LOCALGROUP_INFO_X structure
1328 * @param[out] parm_err The returned parameter error number if any
1329 * @return NET_API_STATUS
1331 * example localgroup/localgroup_setinfo.c
1332 ***************************************************************/
1335 NET_API_STATUS
NetLocalGroupSetInfo(const char * server_name
/* [in] */,
1336 const char * group_name
/* [in] */,
1337 uint32_t level
/* [in] */,
1338 uint8_t *buf
/* [in] [ref] */,
1339 uint32_t *parm_err
/* [out] [ref] */);
1341 /************************************************************//**
1345 * @brief Enumerate local groups on a server
1347 * @param[in] server_name The server name to connect to
1348 * @param[in] level The enumeration level used for the query (Currently only
1349 * level 0 is supported)
1350 * @param[out] buffer The returned enumeration buffer
1351 * @param[in] prefmaxlen The requested maximal buffer size
1352 * @param[out] entries_read The number of returned entries
1353 * @param[out] total_entries The number of total entries
1354 * @param[in,out] resume_handle A handle passed in and returned for resuming
1356 * @return NET_API_STATUS
1358 * example localgroup/localgroup_enum.c
1359 ***************************************************************/
1361 NET_API_STATUS
NetLocalGroupEnum(const char * server_name
/* [in] */,
1362 uint32_t level
/* [in] */,
1363 uint8_t **buffer
/* [out] [ref] */,
1364 uint32_t prefmaxlen
/* [in] */,
1365 uint32_t *entries_read
/* [out] [ref] */,
1366 uint32_t *total_entries
/* [out] [ref] */,
1367 uint32_t *resume_handle
/* [in,out] [ref] */);
1369 /************************************************************//**
1371 * NetLocalGroupAddMembers
1373 * @brief Add Members to a Local Group
1375 * @param[in] server_name The server name to connect to
1376 * @param[in] group_name The name of the group that is going to modified
1377 * @param[in] level The level defining the LOCALGROUP_MEMBERS_INFO_X structure
1378 * @param[in] buffer The buffer containing a LOCALGROUP_MEMBERS_INFO_X structure
1379 * @param[in] total_entries The number of LOCALGROUP_MEMBERS_INFO_X entries in
1381 * @return NET_API_STATUS
1383 * example localgroup/localgroup_addmembers.c
1384 ***************************************************************/
1386 NET_API_STATUS
NetLocalGroupAddMembers(const char * server_name
/* [in] */,
1387 const char * group_name
/* [in] */,
1388 uint32_t level
/* [in] */,
1389 uint8_t *buffer
/* [in] [ref] */,
1390 uint32_t total_entries
/* [in] */);
1392 /************************************************************//**
1394 * NetLocalGroupDelMembers
1396 * @brief Delete Members from a Local Group
1398 * @param[in] server_name The server name to connect to
1399 * @param[in] group_name The name of the group that is going to modified
1400 * @param[in] level The level defining the LOCALGROUP_MEMBERS_INFO_X structure
1401 * @param[in] buffer The buffer containing a LOCALGROUP_MEMBERS_INFO_X structure
1402 * @param[in] total_entries The number of LOCALGROUP_MEMBERS_INFO_X entries in
1404 * @return NET_API_STATUS
1406 * example localgroup/localgroup_delmembers.c
1407 ***************************************************************/
1409 NET_API_STATUS
NetLocalGroupDelMembers(const char * server_name
/* [in] */,
1410 const char * group_name
/* [in] */,
1411 uint32_t level
/* [in] */,
1412 uint8_t *buffer
/* [in] [ref] */,
1413 uint32_t total_entries
/* [in] */);
1415 /************************************************************//**
1417 * NetLocalGroupGetMembers
1419 * @brief Enumerate Members in a local group
1421 * @param[in] server_name The server name to connect to
1422 * @param[in] local_group_name The localgroup that is going to be queried
1423 * @param[in] level The level defining the LOCALGROUP_MEMBERS_INFO_X structure
1424 * @param[out] buffer The buffer containing a LOCALGROUP_MEMBERS_INFO_X
1426 * @param[in] prefmaxlen The requested maximal buffer size
1427 * @param[out] entries_read The number of LOCALGROUP_MEMBERS_INFO_X entries in the buffer
1428 * @param[out] total_entries The total number of LOCALGROUP_MEMBERS_INFO_X entries for that group
1429 * @param[in,out] resume_handle A handle passed in and returned for resuming
1431 * @return NET_API_STATUS
1433 * example localgroup/localgroup_getmembers.c
1434 ***************************************************************/
1436 NET_API_STATUS
NetLocalGroupGetMembers(const char * server_name
/* [in] */,
1437 const char * local_group_name
/* [in] */,
1438 uint32_t level
/* [in] */,
1439 uint8_t **buffer
/* [out] [ref] */,
1440 uint32_t prefmaxlen
/* [in] */,
1441 uint32_t *entries_read
/* [out] [ref] */,
1442 uint32_t *total_entries
/* [out] [ref] */,
1443 uint32_t *resume_handle
/* [in,out] [ref] */);
1445 /************************************************************//**
1447 * NetLocalGroupSetMembers
1449 * @brief Set Members in a Local Group
1451 * @param[in] server_name The server name to connect to
1452 * @param[in] group_name The name of the group that is going to modified
1453 * @param[in] level The level defining the LOCALGROUP_MEMBERS_INFO_X structure
1454 * @param[in] buffer The buffer containing a LOCALGROUP_MEMBERS_INFO_X structure
1455 * @param[in] total_entries The number of LOCALGROUP_MEMBERS_INFO_X entries in
1457 * @return NET_API_STATUS
1459 * example localgroup/localgroup_setmembers.c
1460 ***************************************************************/
1462 NET_API_STATUS
NetLocalGroupSetMembers(const char * server_name
/* [in] */,
1463 const char * group_name
/* [in] */,
1464 uint32_t level
/* [in] */,
1465 uint8_t *buffer
/* [in] [ref] */,
1466 uint32_t total_entries
/* [in] */);
1468 /************************************************************//**
1472 * @brief Query remote Time of Day
1474 * @param[in] server_name The server name to connect to
1475 * @param[out] buf The buffer containing a TIME_OF_DAY_INFO structure
1476 * @return NET_API_STATUS
1478 * example server/remote_tod.c
1479 ***************************************************************/
1481 NET_API_STATUS
NetRemoteTOD(const char * server_name
/* [in] */,
1482 uint8_t **buf
/* [out] [ref] */);
1484 /************************************************************//**
1490 * @param[in] server_name The server name to connect to
1491 * @param[in] level The level defining the requested SHARE_INFO_X structure
1492 * @param[in] buf The buffer containing a SHARE_INFO_X structure
1493 * @param[out] parm_err The returned parameter error number if any
1494 * @return NET_API_STATUS
1496 * example share/share_add.c
1497 ***************************************************************/
1499 NET_API_STATUS
NetShareAdd(const char * server_name
/* [in] */,
1500 uint32_t level
/* [in] */,
1501 uint8_t *buffer
/* [in] [ref] */,
1502 uint32_t *parm_err
/* [out] [ref] */);
1506 #endif /* __cplusplus */
1508 #endif /* __LIB_NETAPI_H__ */