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 /*
23 * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
24 * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
25 */
26
27 /*
28 * This module provides the high level interface to the SAM RPC
29 * functions.
30 */
31
32 #include <sys/types.h>
33 #include <sys/isa_defs.h>
34 #include <sys/byteorder.h>
35
36 #include <alloca.h>
37
38 #include <smbsrv/libsmb.h>
39 #include <smbsrv/libmlsvc.h>
40 #include <smbsrv/ntaccess.h>
41 #include <lsalib.h>
42 #include <samlib.h>
43
44 #ifdef _LITTLE_ENDIAN
45 /* little-endian values on little-endian */
46 #define htolel(x) ((uint32_t)(x))
47 #define letohl(x) ((uint32_t)(x))
48 #else /* (BYTE_ORDER == LITTLE_ENDIAN) */
49 /* little-endian values on big-endian (swap) */
50 #define letohl(x) BSWAP_32(x)
51 #define htolel(x) BSWAP_32(x)
52 #endif /* (BYTE_ORDER == LITTLE_ENDIAN) */
53
54 /*
55 * Valid values for the OEM OWF password encryption.
56 */
57 #define SAM_KEYLEN 16
58
59 static void samr_fill_userpw(struct samr_user_password *, const char *);
60 static void samr_make_encrypted_password(
|
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 /*
23 * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
24 * Copyright 2018 Nexenta Systems, Inc. All rights reserved.
25 */
26
27 /*
28 * This module provides the high level interface to the SAM RPC
29 * functions.
30 */
31
32 #include <sys/types.h>
33 #include <sys/isa_defs.h>
34 #include <sys/byteorder.h>
35
36 #include <alloca.h>
37
38 #include <smbsrv/libsmb.h>
39 #include <smbsrv/libmlsvc.h>
40 #include <smb/ntaccess.h>
41 #include <lsalib.h>
42 #include <samlib.h>
43
44 #ifdef _LITTLE_ENDIAN
45 /* little-endian values on little-endian */
46 #define htolel(x) ((uint32_t)(x))
47 #define letohl(x) ((uint32_t)(x))
48 #else /* (BYTE_ORDER == LITTLE_ENDIAN) */
49 /* little-endian values on big-endian (swap) */
50 #define letohl(x) BSWAP_32(x)
51 #define htolel(x) BSWAP_32(x)
52 #endif /* (BYTE_ORDER == LITTLE_ENDIAN) */
53
54 /*
55 * Valid values for the OEM OWF password encryption.
56 */
57 #define SAM_KEYLEN 16
58
59 static void samr_fill_userpw(struct samr_user_password *, const char *);
60 static void samr_make_encrypted_password(
|