Home | History | Annotate | Download | only in smbsrv
      1 /*
      2  * CDDL HEADER START
      3  *
      4  * The contents of this file are subject to the terms of the
      5  * Common Development and Distribution License (the "License").
      6  * You may not use this file except in compliance with the License.
      7  *
      8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
      9  * or http://www.opensolaris.org/os/licensing.
     10  * See the License for the specific language governing permissions
     11  * and limitations under the License.
     12  *
     13  * When distributing Covered Code, include this CDDL HEADER in each
     14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
     15  * If applicable, add the following below this CDDL HEADER, with the
     16  * fields enclosed by brackets "[]" replaced with your own identifying
     17  * information: Portions Copyright [yyyy] [name of copyright owner]
     18  *
     19  * CDDL HEADER END
     20  */
     21 /*
     22  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
     23  * Use is subject to license terms.
     24  */
     25 
     26 #ifndef _SMBSRV_SAMLIB_H
     27 #define	_SMBSRV_SAMLIB_H
     28 
     29 #pragma ident	"@(#)samlib.h	1.3	08/01/04 SMI"
     30 
     31 /*
     32  * Prototypes for the SAM library and RPC client side library interface.
     33  * There are two levels of interface defined here: sam_xxx and samr_xxx.
     34  * The sam_xxx functions provide a high level interface which make
     35  * multiple RPC calls and do all the work necessary to obtain and return
     36  * the requested information. The samr_xxx functions provide a low level
     37  * interface in which each function maps to a single underlying RPC.
     38  */
     39 
     40 #include <smbsrv/ndl/samrpc.ndl>
     41 #include <smbsrv/mlsvc_util.h>
     42 
     43 
     44 #ifdef __cplusplus
     45 extern "C" {
     46 #endif
     47 
     48 /*
     49  * samlib.c
     50  */
     51 int sam_lookup_user_info(char *server, char *domain_name, char *username,
     52     smb_userinfo_t *user_info);
     53 
     54 DWORD sam_create_trust_account(char *server, char *domain,
     55     smb_auth_info_t *auth);
     56 
     57 DWORD sam_create_account(char *server, char *domain_name, char *account_name,
     58     smb_auth_info_t *auth, DWORD account_flags);
     59 
     60 DWORD sam_remove_trust_account(char *server, char *domain);
     61 
     62 DWORD sam_delete_account(char *server, char *domain_name, char *account_name);
     63 
     64 DWORD sam_lookup_name(char *server, char *domain_name, char *account_name,
     65     DWORD *rid_ret);
     66 
     67 DWORD sam_get_local_domains(char *server, char *domain_name);
     68 DWORD sam_check_user(char *server, char *domain_name, char *account_name);
     69 
     70 /*
     71  * samr_open.c
     72  */
     73 int samr_open(char *server, char *domain, char *username,
     74     DWORD access_mask, mlsvc_handle_t *samr_handle);
     75 
     76 int samr_connect(char *server, char *domain, char *username,
     77     DWORD access_mask, mlsvc_handle_t *samr_handle);
     78 
     79 int samr_close_handle(mlsvc_handle_t *handle);
     80 
     81 DWORD samr_open_domain(mlsvc_handle_t *samr_handle, DWORD access_mask,
     82     struct samr_sid *sid, mlsvc_handle_t *domain_handle);
     83 
     84 DWORD samr_open_user(mlsvc_handle_t *domain_handle, DWORD access_mask,
     85     DWORD rid, mlsvc_handle_t *user_handle);
     86 
     87 DWORD samr_delete_user(mlsvc_handle_t *user_handle);
     88 
     89 int samr_open_group(mlsvc_handle_t *domain_handle, DWORD rid,
     90     mlsvc_handle_t *group_handle);
     91 
     92 DWORD samr_create_user(mlsvc_handle_t *domain_handle, char *username,
     93     DWORD account_flags, DWORD *rid, mlsvc_handle_t *user_handle);
     94 
     95 /*
     96  * samr_lookup.c
     97  */
     98 union samr_user_info {
     99 	struct info1 {
    100 		char *username;
    101 		char *fullname;
    102 		DWORD group_rid;
    103 		char *description;
    104 		char *unknown;
    105 	} info1;
    106 
    107 	struct info6 {
    108 		char *username;
    109 		char *fullname;
    110 	} info6;
    111 
    112 	struct info7 {
    113 		char *username;
    114 	} info7;
    115 
    116 	struct info8 {
    117 		char *fullname;
    118 	} info8;
    119 
    120 	struct info9 {
    121 		DWORD group_rid;
    122 	} info9;
    123 
    124 	struct info16 {
    125 		DWORD unknown;
    126 	} info16;
    127 };
    128 
    129 
    130 int samr_lookup_domain(mlsvc_handle_t *samr_handle, char *domain_name,
    131     smb_userinfo_t *user_info);
    132 
    133 DWORD samr_enum_local_domains(mlsvc_handle_t *samr_handle);
    134 
    135 DWORD samr_lookup_domain_names(mlsvc_handle_t *domain_handle, char *name,
    136     smb_userinfo_t *user_info);
    137 
    138 int samr_query_user_info(mlsvc_handle_t *user_handle, WORD switch_value,
    139     union samr_user_info *user_info);
    140 
    141 int samr_query_user_groups(mlsvc_handle_t *user_handle,
    142     smb_userinfo_t *user_info);
    143 
    144 DWORD samr_get_user_pwinfo(mlsvc_handle_t *user_handle);
    145 
    146 typedef struct oem_password {
    147 	BYTE data[512];
    148 	DWORD length;
    149 } oem_password_t;
    150 
    151 
    152 int sam_oem_password(oem_password_t *oem_password, unsigned char *new_password,
    153     unsigned char *old_password);
    154 
    155 #ifdef __cplusplus
    156 }
    157 #endif
    158 
    159 
    160 #endif /* _SMBSRV_SAMLIB_H */
    161