27 /*
28 * Security Accounts Manager RPC (SAMR) client-side interface.
29 *
30 * The SAM is a hierarchical database:
31 * - If you want to talk to the SAM you need a SAM handle.
32 * - If you want to work with a domain, use the SAM handle.
33 * to obtain a domain handle.
34 * - Use domain handles to obtain user handles etc.
35 *
36 * Be careful about returning null handles to the application. Use of a
37 * null handle may crash the domain controller if you attempt to use it.
38 */
39
40 #include <stdio.h>
41 #include <strings.h>
42 #include <stdlib.h>
43 #include <unistd.h>
44 #include <netdb.h>
45 #include <sys/param.h>
46
47 #include <smbsrv/libsmb.h>
48 #include <smbsrv/libmlrpc.h>
49 #include <smbsrv/libmlsvc.h>
50 #include <smbsrv/smbinfo.h>
51 #include <smbsrv/ntaccess.h>
52 #include <smbsrv/smb_sid.h>
53 #include <samlib.h>
54
55 static DWORD samr_connect2(char *, char *, char *, DWORD, mlsvc_handle_t *);
56 static DWORD samr_connect4(char *, char *, char *, DWORD, mlsvc_handle_t *);
57 static DWORD samr_connect5(char *, char *, char *, DWORD, mlsvc_handle_t *);
58
59 typedef DWORD (*samr_connop_t)(char *, char *, char *, DWORD,
60 mlsvc_handle_t *);
61
62 static int samr_setup_user_info(WORD, struct samr_QueryUserInfo *,
63 union samr_user_info *);
64
65 /*
66 * samr_open
67 *
68 * Wrapper round samr_connect to ensure that we connect using the server
|
27 /*
28 * Security Accounts Manager RPC (SAMR) client-side interface.
29 *
30 * The SAM is a hierarchical database:
31 * - If you want to talk to the SAM you need a SAM handle.
32 * - If you want to work with a domain, use the SAM handle.
33 * to obtain a domain handle.
34 * - Use domain handles to obtain user handles etc.
35 *
36 * Be careful about returning null handles to the application. Use of a
37 * null handle may crash the domain controller if you attempt to use it.
38 */
39
40 #include <stdio.h>
41 #include <strings.h>
42 #include <stdlib.h>
43 #include <unistd.h>
44 #include <netdb.h>
45 #include <sys/param.h>
46
47 #include <libmlrpc/libmlrpc.h>
48 #include <smbsrv/libsmb.h>
49 #include <smbsrv/libmlsvc.h>
50 #include <smbsrv/smbinfo.h>
51 #include <smbsrv/ntaccess.h>
52 #include <smbsrv/smb_sid.h>
53 #include <samlib.h>
54
55 static DWORD samr_connect2(char *, char *, char *, DWORD, mlsvc_handle_t *);
56 static DWORD samr_connect4(char *, char *, char *, DWORD, mlsvc_handle_t *);
57 static DWORD samr_connect5(char *, char *, char *, DWORD, mlsvc_handle_t *);
58
59 typedef DWORD (*samr_connop_t)(char *, char *, char *, DWORD,
60 mlsvc_handle_t *);
61
62 static int samr_setup_user_info(WORD, struct samr_QueryUserInfo *,
63 union samr_user_info *);
64
65 /*
66 * samr_open
67 *
68 * Wrapper round samr_connect to ensure that we connect using the server
|