Print this page
NEX-16818 Add fksmbcl development tool
NEX-17264 SMB client test tp_smbutil_013 fails after NEX-14666
Reviewed by: Evan Layton <evan.layton@nexenta.com>
Reviewed by: Matt Barden <matt.barden@nexenta.com>
and: (fix ref leaks)
NEX-4538 SMB1 create file should support extended_response format (2)
NEX-6116 Failures in smbtorture raw.open
Reviewed by: Evan Layton <evan.layton@nexenta.com>
Reviewed by: Kevin Crowe <kevin.crowe@nexenta.com>
Reviewed by: Matt Barden <matt.barden@nexenta.com>
Include this commit if upstreaming/backporting any of:
NEX-4540 SMB server declines EA support incorrectly
NEX-4239 smbtorture create failures re. allocation size
(illumos) 6398 SMB should support path names longer than 1024
NEX-3776 SMB should handle PreviousSessionID
Reviewed by: Gordon Ross <gwr@nexenta.com>
NEX-3620 need upstream cleanups for smbsrv
Reviewed by: Hans Rosenfeld <hans.rosenfeld@nexenta.com>
SMB-50 User-mode SMB server
Includes work by these authors:
Thomas Keiser <thomas.keiser@nexenta.com>
Albert Lee <trisk@nexenta.com>
| Split |
Close |
| Expand all |
| Collapse all |
--- old/usr/src/lib/libfakekernel/common/cred.c
+++ new/usr/src/lib/libfakekernel/common/cred.c
1 1 /*
2 2 * This file and its contents are supplied under the terms of the
|
↓ open down ↓ |
2 lines elided |
↑ open up ↑ |
3 3 * Common Development and Distribution License ("CDDL"), version 1.0.
4 4 * You may only use this file in accordance with the terms of version
5 5 * 1.0 of the CDDL.
6 6 *
7 7 * A full copy of the text of the CDDL should have accompanied this
8 8 * source. A copy of the CDDL is also available via the Internet at
9 9 * http://www.illumos.org/license/CDDL.
10 10 */
11 11
12 12 /*
13 - * Copyright 2013 Nexenta Systems, Inc. All rights reserved.
13 + * Copyright 2017 Nexenta Systems, Inc. All rights reserved.
14 14 * Copyright 2017 RackTop Systems.
15 15 */
16 16
17 -
18 17 #include <sys/types.h>
19 18 #include <sys/time.h>
20 19 #include <sys/thread.h>
21 20 #include <sys/cred.h>
21 +#include <sys/sid.h>
22 +#include <strings.h>
22 23
24 +/*
25 + * This library does not implement real credentials. All contexts
26 + * use an opaque cred_t object, and all activity happens in the
27 + * context of the user who runs the program.
28 + */
29 +
30 +extern struct zone zone0;
31 +
23 32 struct cred {
33 + uid_t cr_uid;
34 + ksid_t *cr_ksid;
24 35 uint32_t pad[100];
25 36 };
26 37
27 38 cred_t cred0;
28 39 cred_t *kcred = &cred0;
29 40
41 +/*
42 + * Note that fksmbd uses CRED() for SMB user logons, but uses
43 + * zone_kcred() for operations done internally by the server.
44 + * Let CRED() (_curcred()) return &cred1, so it's different from
45 + * kcred, otherwise tests like: (cred == kcred) are always true.
46 + * Also, only cred1 will have a ksid (not kcred).
47 + * The UID and SID are both "nobody".
48 + */
49 +ksiddomain_t ksdom1 = {1, 5, "S-1-0", {0}};
50 +ksid_t ksid1 = { 60001, 0, 0, &ksdom1};
51 +cred_t cred1 = { 60001, &ksid1 };
52 +
30 53 cred_t *
31 54 _curcred(void)
32 55 {
33 - /* Thread-specific data? */
34 - return (&cred0);
56 + return (&cred1);
35 57 }
36 58
37 59 /*ARGSUSED*/
38 60 void
39 61 crfree(cred_t *cr)
40 62 {
41 63 }
42 64
43 65 /*ARGSUSED*/
44 66 void
45 67 crhold(cred_t *cr)
46 68 {
47 69 }
48 70
49 71 /*ARGSUSED*/
50 72 uid_t
51 73 crgetuid(const cred_t *cr)
52 74 {
53 - return (0);
75 + return (cr->cr_uid);
54 76 }
55 77
56 78 /*ARGSUSED*/
57 79 uid_t
58 80 crgetruid(const cred_t *cr)
59 81 {
60 - return (0);
82 + return (cr->cr_uid);
61 83 }
62 84
63 85 /*ARGSUSED*/
64 86 uid_t
65 87 crgetgid(const cred_t *cr)
66 88 {
67 89 return (0);
68 90 }
69 91
70 92 /*ARGSUSED*/
71 93 int
72 94 crgetngroups(const cred_t *cr)
73 95 {
|
↓ open down ↓ |
3 lines elided |
↑ open up ↑ |
74 96 return (0);
75 97 }
76 98
77 99 /*ARGSUSED*/
78 100 const gid_t *
79 101 crgetgroups(const cred_t *cr)
80 102 {
81 103 return (NULL);
82 104 }
83 105
106 +/*ARGSUSED*/
107 +zoneid_t
108 +crgetzoneid(const cred_t *cr)
109 +{
110 + return (GLOBAL_ZONEID);
111 +}
112 +
113 +/*ARGSUSED*/
114 +struct zone *
115 +crgetzone(const cred_t *cr)
116 +{
117 + return (&zone0);
118 +}
119 +
84 120 cred_t *
85 121 zone_kcred(void)
86 122 {
87 123 return (kcred);
124 +}
125 +
126 +/*ARGSUSED*/
127 +ksid_t *
128 +crgetsid(const cred_t *cr, int i)
129 +{
130 + return (cr->cr_ksid);
131 +}
132 +
133 +cred_t *
134 +ddi_get_cred(void)
135 +{
136 + return (_curcred());
88 137 }
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX