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
;
95 const char * usri1_name
;
96 const char * usri1_password
;
97 uint32_t usri1_password_age
;
99 const char * usri1_home_dir
;
100 const char * usri1_comment
;
101 uint32_t usri1_flags
;
102 const char * usri1_script_path
;
106 const char * usri2_name
;
107 const char * usri2_password
;
108 uint32_t usri2_password_age
;
110 const char * usri2_home_dir
;
111 const char * usri2_comment
;
112 uint32_t usri2_flags
;
113 const char * usri2_script_path
;
114 uint32_t usri2_auth_flags
;
115 const char * usri2_full_name
;
116 const char * usri2_usr_comment
;
117 const char * usri2_parms
;
118 const char * usri2_workstations
;
119 uint32_t usri2_last_logon
;
120 uint32_t usri2_last_logoff
;
121 uint32_t usri2_acct_expires
;
122 uint32_t usri2_max_storage
;
123 uint32_t usri2_units_per_week
;
124 uint8_t *usri2_logon_hours
;/* [unique] */
125 uint32_t usri2_bad_pw_count
;
126 uint32_t usri2_num_logons
;
127 const char * usri2_logon_server
;
128 uint32_t usri2_country_code
;
129 uint32_t usri2_code_page
;
133 const char * usri3_name
;
134 uint32_t usri3_password_age
;
136 const char * usri3_home_dir
;
137 const char * usri3_comment
;
138 uint32_t usri3_flags
;
139 const char * usri3_script_path
;
140 uint32_t usri3_auth_flags
;
141 const char * usri3_full_name
;
142 const char * usri3_usr_comment
;
143 const char * usri3_parms
;
144 const char * usri3_workstations
;
145 uint32_t usri3_last_logon
;
146 uint32_t usri3_last_logoff
;
147 uint32_t usri3_acct_expires
;
148 uint32_t usri3_max_storage
;
149 uint32_t usri3_units_per_week
;
150 uint8_t *usri3_logon_hours
;/* [unique] */
151 uint32_t usri3_bad_pw_count
;
152 uint32_t usri3_num_logons
;
153 const char * usri3_logon_server
;
154 uint32_t usri3_country_code
;
155 uint32_t usri3_code_page
;
156 uint32_t usri3_user_id
;
157 uint32_t usri3_primary_group_id
;
158 const char * usri3_profile
;
159 const char * usri3_home_dir_drive
;
160 uint32_t usri3_password_expired
;
164 const char * usri4_name
;
165 const char * usri4_password
;
166 uint32_t usri4_password_age
;
168 const char * usri4_home_dir
;
169 const char * usri4_comment
;
170 uint32_t usri4_flags
;
171 const char * usri4_script_path
;
172 uint32_t usri4_auth_flags
;
173 const char * usri4_full_name
;
174 const char * usri4_usr_comment
;
175 const char * usri4_parms
;
176 const char * usri4_workstations
;
177 uint32_t usri4_last_logon
;
178 uint32_t usri4_last_logoff
;
179 uint32_t usri4_acct_expires
;
180 uint32_t usri4_max_storage
;
181 uint32_t usri4_units_per_week
;
182 uint8_t *usri4_logon_hours
;/* [unique] */
183 uint32_t usri4_bad_pw_count
;
184 uint32_t usri4_num_logons
;
185 const char * usri4_logon_server
;
186 uint32_t usri4_country_code
;
187 uint32_t usri4_code_page
;
188 struct dom_sid
*usri4_user_sid
;/* [unique] */
189 uint32_t usri4_primary_group_id
;
190 const char * usri4_profile
;
191 const char * usri4_home_dir_drive
;
192 uint32_t usri4_password_expired
;
195 struct USER_INFO_10
{
196 const char * usri10_name
;
197 const char * usri10_comment
;
198 const char * usri10_usr_comment
;
199 const char * usri10_full_name
;
202 struct USER_INFO_11
{
203 const char * usri11_name
;
204 const char * usri11_comment
;
205 const char * usri11_usr_comment
;
206 const char * usri11_full_name
;
207 uint32_t usri11_priv
;
208 uint32_t usri11_auth_flags
;
209 uint32_t usri11_password_age
;
210 const char * usri11_home_dir
;
211 const char * usri11_parms
;
212 uint32_t usri11_last_logon
;
213 uint32_t usri11_last_logoff
;
214 uint32_t usri11_bad_pw_count
;
215 uint32_t usri11_num_logons
;
216 const char * usri11_logon_server
;
217 uint32_t usri11_country_code
;
218 const char * usri11_workstations
;
219 uint32_t usri11_max_storage
;
220 uint32_t usri11_units_per_week
;
221 uint8_t *usri11_logon_hours
;/* [unique] */
222 uint32_t usri11_code_page
;
225 struct USER_INFO_20
{
226 const char * usri20_name
;
227 const char * usri20_full_name
;
228 const char * usri20_comment
;
229 uint32_t usri20_flags
;
230 uint32_t usri20_user_id
;
233 struct USER_INFO_21
{
234 uint8_t *usri21_password
;
237 struct USER_INFO_22
{
238 const char * usri22_name
;
239 uint8_t *usri22_password
;
240 uint32_t usri22_password_age
;
241 uint32_t usri22_priv
;
242 const char * usri22_home_dir
;
243 const char * usri22_comment
;
244 uint32_t usri22_flags
;
245 uint32_t usri22_script_path
;
246 uint32_t usri22_auth_flags
;
247 const char * usri22_full_name
;
248 const char * usri22_usr_comment
;
249 const char * usri22_parms
;
250 const char * usri22_workstations
;
251 uint32_t usri22_last_logon
;
252 uint32_t usri22_last_logoff
;
253 uint32_t usri22_acct_expires
;
254 uint32_t usri22_max_storage
;
255 uint32_t usri22_units_per_week
;
256 uint8_t *usri22_logon_hours
;/* [unique] */
257 uint32_t usri22_bad_pw_count
;
258 uint32_t usri22_num_logons
;
259 const char * usri22_logon_server
;
260 uint32_t usri22_country_code
;
261 uint32_t usri22_code_page
;
264 struct USER_INFO_23
{
265 const char * usri23_name
;
266 const char * usri23_full_name
;
267 const char * usri23_comment
;
268 uint32_t usri23_flags
;
269 struct domsid
*usri23_user_sid
;/* [unique] */
272 struct USER_INFO_1003
{
273 const char * usri1003_password
;
276 struct USER_INFO_1005
{
277 uint32_t usri1005_priv
;
280 struct USER_INFO_1006
{
281 const char * usri1006_home_dir
;
284 struct USER_INFO_1007
{
285 const char * usri1007_comment
;
288 struct USER_INFO_1008
{
289 uint32_t usri1008_flags
;
292 struct USER_INFO_1009
{
293 const char * usri1009_script_path
;
296 struct USER_INFO_1010
{
297 uint32_t usri1010_auth_flags
;
300 struct USER_INFO_1011
{
301 const char * usri1011_full_name
;
304 struct USER_INFO_1012
{
305 const char * usri1012_usr_comment
;
308 struct USER_INFO_1013
{
309 const char * usri1013_parms
;
312 struct USER_INFO_1014
{
313 const char * usri1014_workstations
;
316 struct USER_INFO_1017
{
317 uint32_t usri1017_acct_expires
;
320 struct USER_INFO_1018
{
321 uint32_t usri1018_max_storage
;
324 struct USER_INFO_1020
{
325 uint32_t usri1020_units_per_week
;
326 uint8_t *usri1020_logon_hours
;/* [unique] */
329 struct USER_INFO_1023
{
330 const char * usri1023_logon_server
;
333 struct USER_INFO_1024
{
334 uint32_t usri1024_country_code
;
337 struct USER_INFO_1025
{
338 uint32_t usri1025_code_page
;
341 struct USER_INFO_1051
{
342 uint32_t usri1051_primary_group_id
;
345 struct USER_INFO_1052
{
346 const char * usri1052_profile
;
349 struct USER_INFO_1053
{
350 const char * usri1053_home_dir_drive
;
353 struct USER_MODALS_INFO_0
{
354 uint32_t usrmod0_min_passwd_len
;
355 uint32_t usrmod0_max_passwd_age
;
356 uint32_t usrmod0_min_passwd_age
;
357 uint32_t usrmod0_force_logoff
;
358 uint32_t usrmod0_password_hist_len
;
361 struct USER_MODALS_INFO_1
{
362 uint32_t usrmod1_role
;
363 const char * usrmod1_primary
;
366 struct USER_MODALS_INFO_2
{
367 const char * usrmod2_domain_name
;
368 struct domsid
*usrmod2_domain_id
;/* [unique] */
371 struct USER_MODALS_INFO_3
{
372 uint32_t usrmod3_lockout_duration
;
373 uint32_t usrmod3_lockout_observation_window
;
374 uint32_t usrmod3_lockout_threshold
;
377 struct USER_MODALS_INFO_1001
{
378 uint32_t usrmod1001_min_passwd_len
;
381 struct USER_MODALS_INFO_1002
{
382 uint32_t usrmod1002_max_passwd_age
;
385 struct USER_MODALS_INFO_1003
{
386 uint32_t usrmod1003_min_passwd_age
;
389 struct USER_MODALS_INFO_1004
{
390 uint32_t usrmod1004_force_logoff
;
393 struct USER_MODALS_INFO_1005
{
394 uint32_t usrmod1005_password_hist_len
;
397 struct USER_MODALS_INFO_1006
{
398 uint32_t usrmod1006_role
;
401 struct USER_MODALS_INFO_1007
{
402 const char * usrmod1007_primary
;
405 struct NET_DISPLAY_USER
{
406 const char * usri1_name
;
407 const char * usri1_comment
;
408 uint32_t usri1_flags
;
409 const char * usri1_full_name
;
410 uint32_t usri1_user_id
;
411 uint32_t usri1_next_index
;
414 struct NET_DISPLAY_MACHINE
{
415 const char * usri2_name
;
416 const char * usri2_comment
;
417 uint32_t usri2_flags
;
418 uint32_t usri2_user_id
;
419 uint32_t usri2_next_index
;
422 struct NET_DISPLAY_GROUP
{
423 const char * grpi3_name
;
424 const char * grpi3_comment
;
425 uint32_t grpi3_group_id
;
426 uint32_t grpi3_attributes
;
427 uint32_t grpi3_next_index
;
430 struct GROUP_INFO_0
{
431 const char * grpi0_name
;
434 struct GROUP_INFO_1
{
435 const char * grpi1_name
;
436 const char * grpi1_comment
;
439 struct GROUP_INFO_2
{
440 const char * grpi2_name
;
441 const char * grpi2_comment
;
442 uint32_t grpi2_group_id
;
443 uint32_t grpi2_attributes
;
446 struct GROUP_INFO_3
{
447 const char * grpi3_name
;
448 const char * grpi3_comment
;
449 struct domsid
* grpi3_group_sid
;
450 uint32_t grpi3_attributes
;
453 struct GROUP_INFO_1002
{
454 const char * grpi1002_comment
;
457 struct GROUP_INFO_1005
{
458 uint32_t grpi1005_attributes
;
461 struct GROUP_USERS_INFO_0
{
462 const char * grui0_name
;
465 struct GROUP_USERS_INFO_1
{
466 const char * grui1_name
;
467 uint32_t grui1_attributes
;
470 struct LOCALGROUP_INFO_0
{
471 const char * lgrpi0_name
;
474 struct LOCALGROUP_INFO_1
{
475 const char * lgrpi1_name
;
476 const char * lgrpi1_comment
;
479 struct LOCALGROUP_INFO_1002
{
480 const char * lgrpi1002_comment
;
488 SidTypeWellKnownGroup
=5,
489 SidTypeDeletedAccount
=6,
496 struct LOCALGROUP_MEMBERS_INFO_0
{
497 struct domsid
*lgrmi0_sid
;/* [unique] */
500 struct LOCALGROUP_MEMBERS_INFO_1
{
501 struct domsid
*lgrmi1_sid
;/* [unique] */
502 enum SID_NAME_USE lgrmi1_sidusage
;
503 const char * lgrmi1_name
;
506 struct LOCALGROUP_MEMBERS_INFO_2
{
507 struct domsid
*lgrmi2_sid
;/* [unique] */
508 enum SID_NAME_USE lgrmi2_sidusage
;
509 const char * lgrmi2_domainandname
;
512 struct LOCALGROUP_MEMBERS_INFO_3
{
513 const char * lgrmi3_domainandname
;
516 struct TIME_OF_DAY_INFO
{
517 uint32_t tod_elapsedt
;
523 int32_t tod_timezone
;
524 uint32_t tod_tinterval
;
528 uint32_t tod_weekday
;
531 #endif /* _HEADER_libnetapi */
533 /****************************************************************
534 ****************************************************************/
536 struct libnetapi_ctx
{
544 int disable_policy_handle_cache
;
549 /****************************************************************
550 ****************************************************************/
552 NET_API_STATUS
libnetapi_init(struct libnetapi_ctx
**ctx
);
554 /****************************************************************
555 ****************************************************************/
557 NET_API_STATUS
libnetapi_free(struct libnetapi_ctx
*ctx
);
559 /****************************************************************
560 ****************************************************************/
562 NET_API_STATUS
libnetapi_getctx(struct libnetapi_ctx
**ctx
);
564 /****************************************************************
565 ****************************************************************/
567 NET_API_STATUS
libnetapi_set_debuglevel(struct libnetapi_ctx
*ctx
,
568 const char *debuglevel
);
570 /****************************************************************
571 ****************************************************************/
573 NET_API_STATUS
libnetapi_set_username(struct libnetapi_ctx
*ctx
,
574 const char *username
);
576 /****************************************************************
577 ****************************************************************/
579 NET_API_STATUS
libnetapi_set_password(struct libnetapi_ctx
*ctx
,
580 const char *password
);
582 /****************************************************************
583 ****************************************************************/
585 NET_API_STATUS
libnetapi_set_workgroup(struct libnetapi_ctx
*ctx
,
586 const char *workgroup
);
588 /****************************************************************
589 ****************************************************************/
591 NET_API_STATUS
libnetapi_set_use_kerberos(struct libnetapi_ctx
*ctx
);
593 /****************************************************************
594 ****************************************************************/
596 const char *libnetapi_errstr(NET_API_STATUS status
);
598 /****************************************************************
599 ****************************************************************/
601 const char *libnetapi_get_error_string(struct libnetapi_ctx
*ctx
,
602 NET_API_STATUS status
);
604 /****************************************************************
606 ****************************************************************/
608 NET_API_STATUS
NetApiBufferAllocate(uint32_t byte_count
,
611 /****************************************************************
613 ****************************************************************/
615 NET_API_STATUS
NetApiBufferFree(void *buffer
);
617 /************************************************************//**
619 * ConvertSidToStringSid
621 * @brief Convert a domain sid into a string
623 * @param[in] sid A pointer to a sid structure
624 * @param[in,out] sid_string A pointer that holds a pointer to a sid string. Caller
625 * needs to free with free(3)
627 ***************************************************************/
629 int ConvertSidToStringSid(const struct domsid
*sid
,
632 /************************************************************//**
634 * ConvertStringSidToSid
636 * @brief Convert a string into a domain sid
638 * @param[in] sid_string A pointer to a sid string.
639 * @param[in,out] sid A pointer that holds a pointer to a sid structure.
640 * Caller needs to free with free(3)
642 ***************************************************************/
644 int ConvertStringSidToSid(const char *sid_string
,
645 struct domsid
**sid
);
647 /************************************************************//**
651 * @brief Join a computer to a domain or workgroup
653 * @param[in] server The server name to connect to
654 * @param[in] domain The domain or workgroup to join
655 * @param[in] account_ou The organizational Unit to create the computer account
657 * @param[in] account The domain account used for joining a domain
658 * @param[in] password The domain account's password used for joining a domain
659 * @param[in] join_flags Bitmask field to define specific join features
660 * @return NET_API_STATUS
662 * example netdomjoin/netdomjoin.c
663 ***************************************************************/
665 NET_API_STATUS
NetJoinDomain(const char * server
/* [in] */,
666 const char * domain
/* [in] [ref] */,
667 const char * account_ou
/* [in] */,
668 const char * account
/* [in] */,
669 const char * password
/* [in] */,
670 uint32_t join_flags
/* [in] */);
672 /************************************************************//**
676 * @brief Unjoin a computer from a domain or workgroup
678 * @param[in] server_name The server name to connect to
679 * @param[in] account The domain account used for unjoining a domain
680 * @param[in] password The domain account's password used for unjoining a domain
681 * @param[in] unjoin_flags Bitmask field to define specific unjoin features
682 * @return NET_API_STATUS
684 ***************************************************************/
686 NET_API_STATUS
NetUnjoinDomain(const char * server_name
/* [in] */,
687 const char * account
/* [in] */,
688 const char * password
/* [in] */,
689 uint32_t unjoin_flags
/* [in] */);
691 /************************************************************//**
693 * NetGetJoinInformation
695 * @brief Unjoin a computer from a domain or workgroup
697 * @param[in] server_name The server name to connect to
698 * @param[out] name_buffer Returns the name of the workgroup or domain
699 * @param[out] name_type Returns the type of that name
700 * @return NET_API_STATUS
702 * example netdomjoin-gui/netdomjoin-gui.c
704 ***************************************************************/
706 NET_API_STATUS
NetGetJoinInformation(const char * server_name
/* [in] */,
707 const char * *name_buffer
/* [out] [ref] */,
708 uint16_t *name_type
/* [out] [ref] */);
710 /************************************************************//**
714 * @brief Query for the list of joinable organizational Units that can be used
717 * @param[in] server_name The server name to connect to
718 * @param[in] domain The AD domain to query
719 * @param[in] account The domain account used for the query
720 * @param[in] password The domain account's password used for the query
721 * @param[out] ou_count The number of ous returned
722 * @param[out] ous Returned string array containing the ous
723 * @return NET_API_STATUS
725 * example netdomjoin-gui/netdomjoin-gui.c
727 ***************************************************************/
729 NET_API_STATUS
NetGetJoinableOUs(const char * server_name
/* [in] */,
730 const char * domain
/* [in] [ref] */,
731 const char * account
/* [in] */,
732 const char * password
/* [in] */,
733 uint32_t *ou_count
/* [out] [ref] */,
734 const char * **ous
/* [out] [ref] */);
736 /************************************************************//**
740 * @brief Get Information on a server
742 * @param[in] server_name The server name to connect to
743 * @param[in] level The level to define which information is requested
744 * @param[out] buffer The returned buffer carrying the SERVER_INFO structure
745 * @return NET_API_STATUS
747 ***************************************************************/
749 NET_API_STATUS
NetServerGetInfo(const char * server_name
/* [in] */,
750 uint32_t level
/* [in] */,
751 uint8_t **buffer
/* [out] [ref] */);
753 /************************************************************//**
757 * @brief Get Information on a server
759 * @param[in] server_name The server name to connect to
760 * @param[in] level The level to define which information is set
761 * @param[in] buffer The buffer carrying the SERVER_INFO structure
762 * @param[out] parm_error On failure returns the invalid SERVER_INFO member
763 * @return NET_API_STATUS
765 ***************************************************************/
767 NET_API_STATUS
NetServerSetInfo(const char * server_name
/* [in] */,
768 uint32_t level
/* [in] */,
769 uint8_t *buffer
/* [in] [ref] */,
770 uint32_t *parm_error
/* [out] [ref] */);
772 /************************************************************//**
776 * @brief Query for the PDC for a given domain
778 * @param[in] server_name The server name to connect to
779 * @param[in] domain_name The name of the domain to lookup
780 * @param[out] buffer The name of the domain to lookup
781 * @return NET_API_STATUS
783 * example getdc/getdc.c
784 ***************************************************************/
786 NET_API_STATUS
NetGetDCName(const char * server_name
/* [in] */,
787 const char * domain_name
/* [in] */,
788 uint8_t **buffer
/* [out] [ref] */);
790 /************************************************************//**
794 * @brief Query for any DC for a given domain
796 * @param[in] server_name The server name to connect to
797 * @param[in] domain_name The name of the domain to lookup
798 * @param[out] buffer The name of the domain to lookup
799 * @return NET_API_STATUS
801 * example getdc/getdc.c
802 ***************************************************************/
804 NET_API_STATUS
NetGetAnyDCName(const char * server_name
/* [in] */,
805 const char * domain_name
/* [in] */,
806 uint8_t **buffer
/* [out] [ref] */);
809 /************************************************************//**
813 * @brief Lookup a DC for a given domain and return information structure
815 * @param[in] server_name The server name to connect to
816 * @param[in] domain_name The name of the domain to lookup (cannot be NULL)
817 * @param[in] domain_guid The GUID of the domain to lookup (optional)
818 * @param[in] site_name The name of the site the DC should reside in
819 * @param[in] flags A bitmask to request specific features supported by the DC
820 * @param[out] dc_info Pointer to a DOMAIN_CONTROLLER_INFO structure
821 * @return NET_API_STATUS
823 * example dsgetdc/dsgetdc.c
824 ***************************************************************/
826 NET_API_STATUS
DsGetDcName(const char * server_name
/* [in] [unique] */,
827 const char * domain_name
/* [in] [ref] */,
828 struct GUID
*domain_guid
/* [in] [unique] */,
829 const char * site_name
/* [in] [unique] */,
830 uint32_t flags
/* [in] */,
831 struct DOMAIN_CONTROLLER_INFO
**dc_info
/* [out] [ref] */);
833 /************************************************************//**
837 * @brief Create a user on a given server
839 * @param[in] server_name The server name to connect to
840 * @param[in] level The level of the USER_INFO structure passed in (Currently
841 * only level 1 is supported)
842 * @param[in] buffer The buffer carrying the USER_INFO structure
843 * @param[out] parm_error In case of error returns the failing member of the
845 * @return NET_API_STATUS
847 * example user/user_add.c
848 ***************************************************************/
850 NET_API_STATUS
NetUserAdd(const char * server_name
/* [in] */,
851 uint32_t level
/* [in] */,
852 uint8_t *buffer
/* [in] [ref] */,
853 uint32_t *parm_error
/* [out] [ref] */);
855 /************************************************************//**
859 * @brief Delete a user on a given server
861 * @param[in] server_name The server name to connect to
862 * @param[in] user_name The user account to delete
863 * @return NET_API_STATUS
865 * example user/user_del.c
866 ***************************************************************/
868 NET_API_STATUS
NetUserDel(const char * server_name
/* [in] */,
869 const char * user_name
/* [in] */);
871 /************************************************************//**
875 * @brief Enumerate accounts on a server
877 * @param[in] server_name The server name to connect to
878 * @param[in] level The enumeration level used for the query (Currently only
879 * level 0 is supported)
880 * @param[in] filter The account flags filter used for the query
881 * @param[out] buffer The returned enumeration buffer
882 * @param[in] prefmaxlen The requested maximal buffer size
883 * @param[out] entries_read The number of returned entries
884 * @param[out] total_entries The number of total entries
885 * @param[in,out] resume_handle A handle passed in and returned for resuming
887 * @return NET_API_STATUS
889 * example user/user_enum.c
890 ***************************************************************/
892 NET_API_STATUS
NetUserEnum(const char * server_name
/* [in] */,
893 uint32_t level
/* [in] */,
894 uint32_t filter
/* [in] */,
895 uint8_t **buffer
/* [out] [ref] */,
896 uint32_t prefmaxlen
/* [in] */,
897 uint32_t *entries_read
/* [out] [ref] */,
898 uint32_t *total_entries
/* [out] [ref] */,
899 uint32_t *resume_handle
/* [in,out] [ref] */);
901 /************************************************************//**
903 * NetUserChangePassword
905 * @brief Change the password for a user on a given server or in a given domain
907 * @param[in] domain_name The server or domain name to connect to
908 * @param[in] user_name The user account to change the password for
909 * @param[in] old_password The user account's old password
910 * @param[in] new_password The user account's new password
911 * @return NET_API_STATUS
913 * example user/user_chgpwd.c
914 ***************************************************************/
916 NET_API_STATUS
NetUserChangePassword(const char * domain_name
/* [in] */,
917 const char * user_name
/* [in] */,
918 const char * old_password
/* [in] */,
919 const char * new_password
/* [in] */);
921 /************************************************************//**
925 * @brief Get User Information
927 * @param[in] server_name The server name to connect to
928 * @param[in] user_name The name of the user that is going to be queried
929 * @param[in] level The level defining the requested USER_INFO_X structure
930 * @param[out] buffer The buffer containing a USER_INFO_X structure
931 * @return NET_API_STATUS
933 * example user/user_getinfo.c
934 ***************************************************************/
936 NET_API_STATUS
NetUserGetInfo(const char * server_name
/* [in] */,
937 const char * user_name
/* [in] */,
938 uint32_t level
/* [in] */,
939 uint8_t **buffer
/* [out] [ref] */);
941 /************************************************************//**
945 * @brief Set User Information
947 * @param[in] server_name The server name to connect to
948 * @param[in] user_name The name of the user that is going to be modified
949 * @param[in] level The level defining the requested USER_INFO_X structure
950 * @param[in] buffer The buffer containing a USER_INFO_X structure
951 * @param[out] parm_err The returned parameter error number if any
952 * @return NET_API_STATUS
954 * example user/user_setinfo.c
955 ***************************************************************/
957 NET_API_STATUS
NetUserSetInfo(const char * server_name
/* [in] */,
958 const char * user_name
/* [in] */,
959 uint32_t level
/* [in] */,
960 uint8_t *buffer
/* [in] [ref] */,
961 uint32_t *parm_err
/* [out] [ref] */);
963 /************************************************************//**
967 * @brief Get SAM domain and password information
969 * @param[in] server_name The server name to connect to
970 * @param[in] level The level defining which USER_MODALS_INFO_X buffer to query
971 * @param[out] buffer The returned USER_MODALS_INFO_X buffer
972 * @return NET_API_STATUS
974 * example user/user_modalsget.c
975 ***************************************************************/
977 NET_API_STATUS
NetUserModalsGet(const char * server_name
/* [in] */,
978 uint32_t level
/* [in] */,
979 uint8_t **buffer
/* [out] [ref] */);
981 /************************************************************//**
985 * @brief Set SAM domain and password information
987 * @param[in] server_name The server name to connect to
988 * @param[in] level The level defining which USER_MODALS_INFO_X buffer to query
989 * @param[out] buffer The buffer conntaing a USER_MODALS_INFO_X structure
990 * @param[out] parm_err The returned parameter error number if any
991 * @return NET_API_STATUS
993 * example user/user_modalsset.c
994 ***************************************************************/
996 NET_API_STATUS
NetUserModalsSet(const char * server_name
/* [in] */,
997 uint32_t level
/* [in] */,
998 uint8_t *buffer
/* [in] [ref] */,
999 uint32_t *parm_err
/* [out] [ref] */);
1001 /************************************************************//**
1005 * @brief Enumerate grouplist of a user on a server
1007 * @param[in] server_name The server name to connect to
1008 * @param[in] user_name The user name to query
1009 * @param[in] level The enumeration level used for the query (Currently only
1010 * level 0 is supported)
1011 * @param[out] buffer The returned enumeration buffer
1012 * @param[in] prefmaxlen The requested maximal buffer size
1013 * @param[out] entries_read The number of returned entries
1014 * @param[out] total_entries The number of total entries
1015 * @return NET_API_STATUS
1017 * example user/user_getgroups.c
1018 ***************************************************************/
1020 NET_API_STATUS
NetUserGetGroups(const char * server_name
/* [in] */,
1021 const char * user_name
/* [in] */,
1022 uint32_t level
/* [in] */,
1023 uint8_t **buffer
/* [out] [ref] */,
1024 uint32_t prefmaxlen
/* [in] */,
1025 uint32_t *entries_read
/* [out] [ref] */,
1026 uint32_t *total_entries
/* [out] [ref] */);
1028 /************************************************************//**
1030 * NetQueryDisplayInformation
1032 * @brief Enumerate accounts on a server
1034 * @param[in] server_name The server name to connect to
1035 * @param[in] level The enumeration level used for the query
1036 * @param[in] idx The index to start the the display enumeration at
1037 * @param[in] entries_requested The number of entries requested
1038 * @param[in] prefmaxlen The requested maximal buffer size
1039 * @param[out] entries_read The number of returned entries
1040 * @param[out] buffer The returned display information buffer
1041 * @return NET_API_STATUS
1043 * example user/user_dispinfo.c
1044 ***************************************************************/
1046 NET_API_STATUS
NetQueryDisplayInformation(const char * server_name
/* [in] [unique] */,
1047 uint32_t level
/* [in] */,
1048 uint32_t idx
/* [in] */,
1049 uint32_t entries_requested
/* [in] */,
1050 uint32_t prefmaxlen
/* [in] */,
1051 uint32_t *entries_read
/* [out] [ref] */,
1052 void **buffer
/* [out] [noprint,ref] */);
1054 /************************************************************//**
1058 * @brief Create Domain Group
1060 * @param[in] server_name The server name to connect to
1061 * @param[in] level The level used for the new group creation
1062 * @param[in] buf The buffer containing the group structure
1063 * @param[out] parm_err The returned parameter error number if any
1064 * @return NET_API_STATUS
1066 * example group/group_add.c
1067 ***************************************************************/
1069 NET_API_STATUS
NetGroupAdd(const char * server_name
/* [in] */,
1070 uint32_t level
/* [in] */,
1071 uint8_t *buf
/* [in] [ref] */,
1072 uint32_t *parm_err
/* [out] [ref] */);
1074 /************************************************************//**
1078 * @brief Delete Domain Group
1080 * @param[in] server_name The server name to connect to
1081 * @param[in] group_name The name of the group that is going to be deleted
1082 * @return NET_API_STATUS
1084 * example group/group_del.c
1085 ***************************************************************/
1087 NET_API_STATUS
NetGroupDel(const char * server_name
/* [in] */,
1088 const char * group_name
/* [in] */);
1090 /************************************************************//**
1094 * @brief Enumerate groups on a server
1096 * @param[in] server_name The server name to connect to
1097 * @param[in] level The enumeration level used for the query (Currently only
1098 * level 0 is supported)
1099 * @param[out] buffer The returned enumeration buffer
1100 * @param[in] prefmaxlen The requested maximal buffer size
1101 * @param[out] entries_read The number of returned entries
1102 * @param[out] total_entries The number of total entries
1103 * @param[in,out] resume_handle A handle passed in and returned for resuming
1105 * @return NET_API_STATUS
1107 * example group/group_enum.c
1108 ***************************************************************/
1110 NET_API_STATUS
NetGroupEnum(const char * server_name
/* [in] */,
1111 uint32_t level
/* [in] */,
1112 uint8_t **buffer
/* [out] [ref] */,
1113 uint32_t prefmaxlen
/* [in] */,
1114 uint32_t *entries_read
/* [out] [ref] */,
1115 uint32_t *total_entries
/* [out] [ref] */,
1116 uint32_t *resume_handle
/* [in,out] [ref] */);
1118 /************************************************************//**
1122 * @brief Set Domain Group Information
1124 * @param[in] server_name The server name to connect to
1125 * @param[in] group_name The name of the group that is going to be modified
1126 * @param[in] level The level defining the structure type in buf
1127 * @param[in] buf The buffer containing a GROUP_INFO_X structure
1128 * @param[out] parm_err The returned parameter error number if any
1129 * @return NET_API_STATUS
1131 * example group/group_setinfo.c
1132 ***************************************************************/
1134 NET_API_STATUS
NetGroupSetInfo(const char * server_name
/* [in] */,
1135 const char * group_name
/* [in] */,
1136 uint32_t level
/* [in] */,
1137 uint8_t *buf
/* [in] [ref] */,
1138 uint32_t *parm_err
/* [out] [ref] */);
1140 /************************************************************//**
1144 * @brief Get Domain Group Information
1146 * @param[in] server_name The server name to connect to
1147 * @param[in] group_name The name of the group that is going to be queried
1148 * @param[in] level The level defining the requested GROUP_INFO_X structure
1149 * @param[out] buf The buffer containing a GROUP_INFO_X structure
1150 * @return NET_API_STATUS
1152 * example group/group_getinfo.c
1153 ***************************************************************/
1155 NET_API_STATUS
NetGroupGetInfo(const char * server_name
/* [in] */,
1156 const char * group_name
/* [in] */,
1157 uint32_t level
/* [in] */,
1158 uint8_t **buf
/* [out] [ref] */);
1160 /************************************************************//**
1164 * @brief Add existing User to existing Domain Group
1166 * @param[in] server_name The server name to connect to
1167 * @param[in] group_name The name of the group that is going to be modified
1168 * @param[in] user_name The name of the user that is going to be added to the
1170 * @return NET_API_STATUS
1172 * example group/group_adduser.c
1173 ***************************************************************/
1175 NET_API_STATUS
NetGroupAddUser(const char * server_name
/* [in] */,
1176 const char * group_name
/* [in] */,
1177 const char * user_name
/* [in] */);
1179 /************************************************************//**
1183 * @brief Remove User from Domain Group
1185 * @param[in] server_name The server name to connect to
1186 * @param[in] group_name The name of the group that is going to be modified
1187 * @param[in] user_name The name of the user that is going to be removed from
1189 * @return NET_API_STATUS
1191 * example group/group_deluser.c
1192 ***************************************************************/
1194 NET_API_STATUS
NetGroupDelUser(const char * server_name
/* [in] */,
1195 const char * group_name
/* [in] */,
1196 const char * user_name
/* [in] */);
1198 /************************************************************//**
1202 * @brief Get Users for a group on a server
1204 * @param[in] server_name The server name to connect to
1205 * @param[in] group_name The group name to enumerate users for
1206 * @param[in] level The enumeration level used for the query
1207 * @param[out] buffer The returned enumeration buffer
1208 * @param[in] prefmaxlen The requested maximal buffer size
1209 * @param[out] entries_read The number of returned entries
1210 * @param[out] total_entries The number of total entries
1211 * @param[in,out] resume_handle A handle passed in and returned for resuming
1213 * @return NET_API_STATUS
1215 * example group/group_getusers.c
1216 ***************************************************************/
1218 NET_API_STATUS
NetGroupGetUsers(const char * server_name
/* [in] */,
1219 const char * group_name
/* [in] */,
1220 uint32_t level
/* [in] */,
1221 uint8_t **buffer
/* [out] [ref] */,
1222 uint32_t prefmaxlen
/* [in] */,
1223 uint32_t *entries_read
/* [out] [ref] */,
1224 uint32_t *total_entries
/* [out] [ref] */,
1225 uint32_t *resume_handle
/* [in,out] [ref] */);
1227 /************************************************************//**
1231 * @brief Create Local Group
1233 * @param[in] server_name The server name to connect to
1234 * @param[in] level The level used for the new group creation
1235 * @param[in] buf The buffer containing the group structure
1236 * @param[out] parm_err The returned parameter error number if any
1237 * @return NET_API_STATUS
1239 * example localgroup/localgroup_add.c
1240 ***************************************************************/
1242 NET_API_STATUS
NetLocalGroupAdd(const char * server_name
/* [in] */,
1243 uint32_t level
/* [in] */,
1244 uint8_t *buf
/* [in] [ref] */,
1245 uint32_t *parm_err
/* [out] [ref] */);
1247 /************************************************************//**
1251 * @brief Delete Local Group
1253 * @param[in] server_name The server name to connect to
1254 * @param[in] group_name The name of the group that is going to be deleted
1255 * @return NET_API_STATUS
1257 * example localgroup/localgroup_del.c
1258 ***************************************************************/
1261 NET_API_STATUS
NetLocalGroupDel(const char * server_name
/* [in] */,
1262 const char * group_name
/* [in] */);
1264 /************************************************************//**
1266 * NetLocalGroupGetInfo
1268 * @brief Get Local Group Information
1270 * @param[in] server_name The server name to connect to
1271 * @param[in] group_name The name of the group that is going to be queried
1272 * @param[in] level The level defining the requested LOCALGROUP_INFO_X structure
1273 * @param[out] buf The buffer containing a LOCALGROUP_INFO_X structure
1274 * @return NET_API_STATUS
1276 * example localgroup/localgroup_getinfo.c
1277 ***************************************************************/
1279 NET_API_STATUS
NetLocalGroupGetInfo(const char * server_name
/* [in] */,
1280 const char * group_name
/* [in] */,
1281 uint32_t level
/* [in] */,
1282 uint8_t **buf
/* [out] [ref] */);
1284 /************************************************************//**
1286 * NetLocalGroupSetInfo
1288 * @brief Set Local Group Information
1290 * @param[in] server_name The server name to connect to
1291 * @param[in] group_name The name of the group that is going to be modified
1292 * @param[in] level The level defining the requested LOCALGROUP_INFO_X structure
1293 * @param[in] buf The buffer containing a LOCALGROUP_INFO_X structure
1294 * @param[out] parm_err The returned parameter error number if any
1295 * @return NET_API_STATUS
1297 * example localgroup/localgroup_setinfo.c
1298 ***************************************************************/
1301 NET_API_STATUS
NetLocalGroupSetInfo(const char * server_name
/* [in] */,
1302 const char * group_name
/* [in] */,
1303 uint32_t level
/* [in] */,
1304 uint8_t *buf
/* [in] [ref] */,
1305 uint32_t *parm_err
/* [out] [ref] */);
1307 /************************************************************//**
1311 * @brief Enumerate local groups on a server
1313 * @param[in] server_name The server name to connect to
1314 * @param[in] level The enumeration level used for the query (Currently only
1315 * level 0 is supported)
1316 * @param[out] buffer The returned enumeration buffer
1317 * @param[in] prefmaxlen The requested maximal buffer size
1318 * @param[out] entries_read The number of returned entries
1319 * @param[out] total_entries The number of total entries
1320 * @param[in,out] resume_handle A handle passed in and returned for resuming
1322 * @return NET_API_STATUS
1324 * example localgroup/localgroup_enum.c
1325 ***************************************************************/
1327 NET_API_STATUS
NetLocalGroupEnum(const char * server_name
/* [in] */,
1328 uint32_t level
/* [in] */,
1329 uint8_t **buffer
/* [out] [ref] */,
1330 uint32_t prefmaxlen
/* [in] */,
1331 uint32_t *entries_read
/* [out] [ref] */,
1332 uint32_t *total_entries
/* [out] [ref] */,
1333 uint32_t *resume_handle
/* [in,out] [ref] */);
1335 /************************************************************//**
1337 * NetLocalGroupAddMembers
1339 * @brief Add Members to a Local Group
1341 * @param[in] server_name The server name to connect to
1342 * @param[in] group_name The name of the group that is going to modified
1343 * @param[in] level The level defining the LOCALGROUP_MEMBERS_INFO_X structure
1344 * @param[in] buffer The buffer containing a LOCALGROUP_MEMBERS_INFO_X structure
1345 * @param[in] total_entries The number of LOCALGROUP_MEMBERS_INFO_X entries in
1347 * @return NET_API_STATUS
1349 * example localgroup/localgroup_addmembers.c
1350 ***************************************************************/
1352 NET_API_STATUS
NetLocalGroupAddMembers(const char * server_name
/* [in] */,
1353 const char * group_name
/* [in] */,
1354 uint32_t level
/* [in] */,
1355 uint8_t *buffer
/* [in] [ref] */,
1356 uint32_t total_entries
/* [in] */);
1358 /************************************************************//**
1360 * NetLocalGroupDelMembers
1362 * @brief Delete Members from a Local Group
1364 * @param[in] server_name The server name to connect to
1365 * @param[in] group_name The name of the group that is going to modified
1366 * @param[in] level The level defining the LOCALGROUP_MEMBERS_INFO_X structure
1367 * @param[in] buffer The buffer containing a LOCALGROUP_MEMBERS_INFO_X structure
1368 * @param[in] total_entries The number of LOCALGROUP_MEMBERS_INFO_X entries in
1370 * @return NET_API_STATUS
1372 * example localgroup/localgroup_delmembers.c
1373 ***************************************************************/
1375 NET_API_STATUS
NetLocalGroupDelMembers(const char * server_name
/* [in] */,
1376 const char * group_name
/* [in] */,
1377 uint32_t level
/* [in] */,
1378 uint8_t *buffer
/* [in] [ref] */,
1379 uint32_t total_entries
/* [in] */);
1381 /************************************************************//**
1383 * NetLocalGroupGetMembers
1385 * @brief Enumerate Members in a local group
1387 * @param[in] server_name The server name to connect to
1388 * @param[in] local_group_name The localgroup that is going to be queried
1389 * @param[in] level The level defining the LOCALGROUP_MEMBERS_INFO_X structure
1390 * @param[out] buffer The buffer containing a LOCALGROUP_MEMBERS_INFO_X
1392 * @param[in] prefmaxlen The requested maximal buffer size
1393 * @param[out] entries_read The number of LOCALGROUP_MEMBERS_INFO_X entries in the buffer
1394 * @param[out] total_entries The total number of LOCALGROUP_MEMBERS_INFO_X entries for that group
1395 * @param[in,out] resume_handle A handle passed in and returned for resuming
1397 * @return NET_API_STATUS
1399 * example localgroup/localgroup_getmembers.c
1400 ***************************************************************/
1402 NET_API_STATUS
NetLocalGroupGetMembers(const char * server_name
/* [in] */,
1403 const char * local_group_name
/* [in] */,
1404 uint32_t level
/* [in] */,
1405 uint8_t **buffer
/* [out] [ref] */,
1406 uint32_t prefmaxlen
/* [in] */,
1407 uint32_t *entries_read
/* [out] [ref] */,
1408 uint32_t *total_entries
/* [out] [ref] */,
1409 uint32_t *resume_handle
/* [in,out] [ref] */);
1411 /************************************************************//**
1413 * NetLocalGroupSetMembers
1415 * @brief Set Members in a Local Group
1417 * @param[in] server_name The server name to connect to
1418 * @param[in] group_name The name of the group that is going to modified
1419 * @param[in] level The level defining the LOCALGROUP_MEMBERS_INFO_X structure
1420 * @param[in] buffer The buffer containing a LOCALGROUP_MEMBERS_INFO_X structure
1421 * @param[in] total_entries The number of LOCALGROUP_MEMBERS_INFO_X entries in
1423 * @return NET_API_STATUS
1425 * example localgroup/localgroup_setmembers.c
1426 ***************************************************************/
1428 NET_API_STATUS
NetLocalGroupSetMembers(const char * server_name
/* [in] */,
1429 const char * group_name
/* [in] */,
1430 uint32_t level
/* [in] */,
1431 uint8_t *buffer
/* [in] [ref] */,
1432 uint32_t total_entries
/* [in] */);
1434 /************************************************************//**
1438 * @brief Query remote Time of Day
1440 * @param[in] server_name The server name to connect to
1441 * @param[out] buf The buffer containing a TIME_OF_DAY_INFO structure
1442 * @return NET_API_STATUS
1444 * example server/remote_tod.c
1445 ***************************************************************/
1447 NET_API_STATUS
NetRemoteTOD(const char * server_name
/* [in] */,
1448 uint8_t **buf
/* [out] [ref] */);
1451 #endif /* __cplusplus */
1453 #endif /* __LIB_NETAPI_H__ */