pastebin - collaborative debugging tool
nrubsig.kpaste.net RSS

Difference between
modified post 794f94 by Anonymous on Tue 18th Jun 2024 16:13
original post fa5f01341 by Anonymous on Sat 15th Jun 2024 14:11
Download diff
Show old version | new version | both versions

    
11
diff --git a/daemon/acl.c b/daemon/acl.c
2-
index 54a5815..26dc42e 100644
2+
index 0aff8d2..f14714d 100644
33
--- a/daemon/acl.c
44
+++ b/daemon/acl.c
5-
@@ -100,6 +100,118 @@ static int check_4_special_identifiers(char *who, PSID *sid, DWORD *sid_len,
5+
@@ -41,7 +41,10 @@
6-
     return status;
6+
 /* Local prototypes */
7-
 }
7+
 static void map_winace2nfs4aceflags(BYTE win_aceflags, uint32_t *nfs4_aceflags);
8+
 static void map_nfs4aceflags2winaceflags(uint32_t nfs4_aceflags, DWORD *win_aceflags);
814
9-
+static void map_nfs4acemask2winaccessmask(uint32_t nfs4_mask, int file_type, ACCESS_MASK *winmask)
15+
 static int parse_getacl(unsigned char *buffer, uint32_t length,
10-
+{
16+
                         nfs41_upcall *upcall)
11-
+    DPRINTF(0,
17+
@@ -161,17 +164,28 @@ static int convert_nfs4acl_2_dacl(nfs41_daemon_globals *nfs41dg,
12-
+        ("--> map_nfs4acemask2winaccessmask("
18+
13-
+            "nfs4_mask=0x%x,file_type=%d)\n",
19+
         for (i = 0; i < acl->count; i++) {
14-
+            (int)nfs4_mask, file_type));
20+
             win_aceflags = 0;
15-
+    print_nfs_access_mask(1, nfs4_mask);
21+
+            mask = 0;
16-
+    bool is_generic = false;
22+
17-
+
23+
-            // nfs4 acemask should be exactly the same as file access mask
18-
+    /*
24+
-            mask = acl->aces[i].acemask;
19-
+     * Generic masks
25+
-            map_nfs4aceflags2winaceflags(acl->aces[i].aceflag, &win_aceflags);
20-
+     * (|ACE4_GENERIC_*| contain multiple bits
26+
+            map_nfs4aceflags2winaceflags(acl->aces[i].aceflag,
21-
+     */
27+
+                &win_aceflags);
22-
+    if ((nfs4_mask & ACE4_GENERIC_READ) == ACE4_GENERIC_READ) {
28+
+            map_nfs4acemask2winaccessmask(acl->aces[i].acemask,
23-
+        *winmask |= GENERIC_READ;
29+
+                file_type, &mask);
24-
+        is_generic = true;
30+
25-
+    }
31+
-            DPRINTF(ACLLVL, ("aces[%d].who='%s': "
26-
+    if ((nfs4_mask & ACE4_GENERIC_WRITE) == ACE4_GENERIC_WRITE) {
32+
-                "access mask=0x%x, acetype='%s', win_aceflags=0x%x\n",
27-
+        *winmask |= GENERIC_WRITE;
33+
+            if (DPRINTF_LEVEL_ENABLED(ACLLVL)) {
28-
+        is_generic = true;
34+
+                dprintf_out("nfs2win: acl->aces[%d].who='%s': "
29-
+    }
35+
+                    "acetype='%s', "
30-
+    if ((nfs4_mask & ACE4_GENERIC_EXECUTE) == ACE4_GENERIC_EXECUTE) {
36+
+                    "nfs_acemask=0x%lx, win_mask=0x%lx, "
31-
+        *winmask |= GENERIC_EXECUTE;
37+
+                    "win_aceflags=0x%lx\n",
32-
+        is_generic = true;
38+
                     i, acl->aces[i].who,
33-
+    }
39+
-                (int)mask,
34-
+    if (file_type == NF4DIR) {
40+
-                acl->aces[i].acetype?"DENIED ACE":"ALLOWED ACE",
35-
+        if ((nfs4_mask & ACE4_ALL_DIR) == ACE4_ALL_DIR) {
41+
-                (int)win_aceflags));
36-
+            *winmask |= GENERIC_ALL;
42+
+                    (acl->aces[i].acetype?"DENIED ACE":"ALLOWED ACE"),
37-
+            is_generic = true;
43+
+                    (long)acl->aces[i].acemask,
38-
+        }
44+
+                    (long)mask,
39-
+    }
45+
+                    (long)win_aceflags);
40-
+    else {
46+
+
41-
+        if ((nfs4_mask & ACE4_ALL_FILE) == ACE4_ALL_FILE) {
47+
+                print_nfs_access_mask(acl->aces[i].who,
42-
+            *winmask |= GENERIC_ALL;
48+
+                    acl->aces[i].acemask);
43-
+            is_generic = true;
49+
+                print_windows_access_mask(acl->aces[i].who, mask);
44-
+        }
50+
+            }
45-
+    }
51+
46-
+#if 0
52+
             if (acl->aces[i].acetype == ACE4_ACCESS_ALLOWED_ACE_TYPE) {
47-
+    if (is_generic)
53+
                 status = AddAccessAllowedAceEx(dacl, ACL_REVISION, win_aceflags, mask, sids[i]);
48-
+        goto mapping_done;
54+
@@ -238,7 +252,8 @@ static int handle_getacl(void *daemon_context, nfs41_upcall *upcall)
49-
+#endif
55+
     char owner[NFS4_OPAQUE_LIMIT+1], group[NFS4_OPAQUE_LIMIT+1];
50-
+    /* Individual flags */
56+
     nfsacl41 acl = { 0 };
51-
+    if (file_type == NF4DIR) {
57+
52-
+        if (nfs4_mask & ACE4_LIST_DIRECTORY) {
58+
-    DPRINTF(ACLLVL, ("--> handle_getacl()\n"));
53-
+            *winmask |= FILE_LIST_DIRECTORY;
59+
+    DPRINTF(ACLLVL, ("--> handle_getacl(state->path.path='%s')\n",
54-
+        }
60+
+        state->path.path));
55-
+        if (nfs4_mask & ACE4_ADD_FILE) {
61+
56-
+            *winmask |= FILE_ADD_FILE;
62+
     if (args->query & DACL_SECURITY_INFORMATION) {
57-
+        }
63+
 use_nfs41_getattr:
58-
+        if (nfs4_mask & ACE4_ADD_SUBDIRECTORY) {
64+
@@ -524,38 +539,209 @@ static void map_nfs4aceflags2winaceflags(uint32_t nfs4_aceflags, DWORD *win_acef
59-
+            *winmask |= FILE_ADD_SUBDIRECTORY;
65+
         (int)nfs4_aceflags, (int)*win_aceflags));
60-
+        }
66+
 }
61-
+        if (nfs4_mask & ACE4_DELETE_CHILD) {
67+
62-
+            *winmask |= FILE_DELETE_CHILD;
68+
-static void map_winaccessmask2nfs4acemask(ACCESS_MASK mask, int file_type, uint32_t *nfs4_mask)
63-
+        }
69+
+static
64-
+        if (nfs4_mask & ACE4_EXECUTE) {
70+
+void map_winaccessmask2nfs4acemask(ACCESS_MASK win_mask,
65-
+            *winmask |= FILE_TRAVERSE;
71+
+    int file_type, uint32_t *nfs4_mask)
66-
+        }
72+
 {
67-
+    }
73+
-    DPRINTF(ACLLVL,
68-
+    else {
74+
-        ("--> map_winaccessmask2nfs4acemask(mask=0x%x)\n",
69-
+        if (nfs4_mask & ACE4_READ_DATA) {
75+
-        (int)mask));
70-
+            *winmask |= FILE_READ_DATA;
76+
-    if (DPRINTF_LEVEL_ENABLED(ACLLVL)) {
71-
+        }
77+
-        print_windows_access_mask(mask);
72-
+        if (nfs4_mask & ACE4_WRITE_DATA) {
78+
-    }
73-
+            *winmask |= FILE_WRITE_DATA;
79+
     /* check if any GENERIC bits set */
74-
+        }
80+
-    if (mask & 0xf000000) {
75-
+        if (nfs4_mask & ACE4_APPEND_DATA) {
81+
-        if (mask & GENERIC_ALL) {
76-
+            *winmask |= FILE_APPEND_DATA;
82+
+    if (win_mask & 0xf000000) {
77-
+        }
83+
+        if (win_mask & GENERIC_ALL) {
78-
+        if (nfs4_mask & ACE4_EXECUTE) {
84+
             if (file_type == NF4DIR)
79-
+            *winmask |= FILE_EXECUTE;
85+
                 *nfs4_mask |= ACE4_ALL_DIR;
80-
+        }
86+
             else
81-
+    }
87+
                 *nfs4_mask |= ACE4_ALL_FILE;
82-
+
88+
         } else {
83-
+#ifdef NOT_IMPLEMENTED_YET
89+
-            if (mask & GENERIC_READ)
84-
+    if (nfs4_mask & ACE4_READ_NAMED_ATTRS) {
90+
+            if (win_mask & GENERIC_READ)
85-
+        *winmask |= xxx;
91+
                 *nfs4_mask |= ACE4_GENERIC_READ;
86-
+    }
92+
-            if (mask & GENERIC_WRITE)
87-
+    if (nfs4_mask & ACE4_WRITE_NAMED_ATTRS) {
93+
+            if (win_mask & GENERIC_WRITE)
88-
+        *winmask |= xxx;
94+
                 *nfs4_mask |= ACE4_GENERIC_WRITE;
89-
+    }
95+
-            if (mask & GENERIC_EXECUTE)
90-
+#endif /* NOT_IMPLEMENTED_YET */
96+
+            if (win_mask & GENERIC_EXECUTE)
91-
+    if (nfs4_mask & ACE4_READ_ATTRIBUTES) {
97+
                 *nfs4_mask |= ACE4_GENERIC_EXECUTE;
92-
+        *winmask |= FILE_READ_ATTRIBUTES;
98+
         }
93-
+    }
99+
     }
94-
+    if (nfs4_mask & ACE4_WRITE_ATTRIBUTES) {
100+
-    else /* ignoring generic and reserved bits */
95-
+        *winmask |= FILE_WRITE_ATTRIBUTES;
101+
-        *nfs4_mask = mask & 0x00ffffff;
96-
+    }
102+
-    if (DPRINTF_LEVEL_ENABLED(ACLLVL)) {
97-
+    if (nfs4_mask & ACE4_READ_ACL) {
103+
-        print_nfs_access_mask(*nfs4_mask);
98-
+        *winmask |= READ_CONTROL;
104+
+    else {
99-
+    }
105+
+       /* Individual flags */
100-
+    if (nfs4_mask & ACE4_WRITE_ACL) {
106+
+        if (file_type == NF4DIR) {
101-
+        *winmask |= WRITE_DAC;
107+
+            if (win_mask & FILE_LIST_DIRECTORY) {
102-
+    }
108+
+                *nfs4_mask |= ACE4_LIST_DIRECTORY;
103-
+    if (nfs4_mask & ACE4_WRITE_OWNER) {
109+
             }
104-
+        *winmask |= WRITE_OWNER;
110+
-    DPRINTF(ACLLVL,
105-
+    }
111+
-        ("<-- map_winaccessmask2nfs4acemask(mask=0x%x, *nfs4_mask=0x%x)\n",
106-
+    if (nfs4_mask & ACE4_SYNCHRONIZE) {
112+
-        (int)mask, (int)*nfs4_mask));
107-
+        *winmask |= SYNCHRONIZE;
113+
+            if (win_mask & FILE_ADD_FILE) {
108-
+    }
114+
+                *nfs4_mask |= ACE4_ADD_FILE;
109-
+    if (nfs4_mask & ACE4_DELETE) {
115+
+            }
110-
+        *winmask |= DELETE;
116+
+            if (win_mask & FILE_ADD_SUBDIRECTORY) {
111-
+    }
117+
+                *nfs4_mask |= ACE4_ADD_SUBDIRECTORY;
112-
+
118+
+            }
113-
+mapping_done:
119+
+            if (win_mask & FILE_DELETE_CHILD) {
114-
+    print_windows_access_mask(1, *winmask);
120+
+                *nfs4_mask |= ACE4_DELETE_CHILD;
115-
+    DPRINTF(0,
121+
+            }
116-
+        ("<-- map_nfs4acemask2winaccessmask("
122+
+            if (win_mask & FILE_TRAVERSE) {
117-
+            "nfs4_mask=0x%x,file_type=%d,*winmask=0x%x)\n",
123+
+                *nfs4_mask |= ACE4_EXECUTE;
118-
+            (int)nfs4_mask, file_type, (int)*winmask));
124+
+            }
119-
+}
125+
+        }
120-
+
126+
+        else {
121-
 static int convert_nfs4acl_2_dacl(nfs41_daemon_globals *nfs41dg,
127+
+            if (win_mask & FILE_READ_DATA) {
122-
     nfsacl41 *acl, int file_type, PACL *dacl_out, PSID **sids_out)
128+
+                *nfs4_mask |= ACE4_READ_DATA;
123-
 {
129+
+            }
124-
@@ -162,8 +274,14 @@ static int convert_nfs4acl_2_dacl(nfs41_daemon_globals *nfs41dg,
130+
+            if (win_mask & FILE_WRITE_DATA) {
125-
         for (i = 0; i < acl->count; i++) {
131+
+                *nfs4_mask |= ACE4_WRITE_DATA;
126-
             win_aceflags = 0;
132+
+            }
127-
133+
+            if (win_mask & FILE_APPEND_DATA) {
128-
+#if 0
134+
+                *nfs4_mask |= ACE4_APPEND_DATA;
129-
             // nfs4 acemask should be exactly the same as file access mask
135+
+            }
130-
             mask = acl->aces[i].acemask;
136+
+            if (win_mask & FILE_EXECUTE) {
131-
+#else
137+
+                *nfs4_mask |= ACE4_EXECUTE;
132-
+            mask = 0;
138+
+            }
133-
+            map_nfs4acemask2winaccessmask(acl->aces[i].acemask,
139+
+            /*
134-
+                file_type, &mask);
140+
+             * gisburn: Why does Win10 set |FILE_DELETE_CHILD| for
135-
+#endif
141+
+             * plain files ?
136-
             map_nfs4aceflags2winaceflags(acl->aces[i].aceflag, &win_aceflags);
142+
+             */
137-
143+
+            if (win_mask & FILE_DELETE_CHILD) {
138-
             DPRINTF(ACLLVL, ("aces[%d].who='%s': "
144+
+                *nfs4_mask |= ACE4_DELETE_CHILD;
139-
@@ -523,34 +641,104 @@ static void map_nfs4aceflags2winaceflags(uint32_t nfs4_aceflags, DWORD *win_acef
145+
+            }
140-
         (int)nfs4_aceflags, (int)*win_aceflags));
146+
+        }
141-
 }
147+
+    }
142-
148+
+
143-
-static void map_winaccessmask2nfs4acemask(ACCESS_MASK mask, int file_type, uint32_t *nfs4_mask)
149+
+    if (win_mask & FILE_READ_EA) {
144-
+static void map_winaccessmask2nfs4acemask(ACCESS_MASK winmask, int file_type, uint32_t *nfs4_mask)
150+
+        *nfs4_mask |= ACE4_READ_NAMED_ATTRS;
145-
 {
151+
+    }
146-
-    DPRINTF(ACLLVL,
152+
+    if (win_mask & FILE_WRITE_EA) {
147-
-        ("--> map_winaccessmask2nfs4acemask(mask=0x%x)\n",
153+
+        *nfs4_mask |= ACE4_WRITE_NAMED_ATTRS;
148-
-        (int)mask));
154+
+    }
149-
-    print_windows_access_mask(ACLLVL, mask);
155+
+    if (win_mask & FILE_READ_ATTRIBUTES) {
150-
+    DPRINTF(0,
156+
+        *nfs4_mask |= ACE4_READ_ATTRIBUTES;
151-
+        ("--> map_winaccessmask2nfs4acemask("
157+
+    }
152-
+        "winmask=0x%x,file_type=%d)\n",
158+
+    if (win_mask & FILE_WRITE_ATTRIBUTES) {
153-
+        (int)winmask, file_type));
159+
+        *nfs4_mask |= ACE4_WRITE_ATTRIBUTES;
154-
+    print_windows_access_mask(1, winmask);
160+
+    }
155-
     /* check if any GENERIC bits set */
161+
+    if (win_mask & READ_CONTROL) {
156-
-    if (mask & 0xf000000) {
162+
+        *nfs4_mask |= ACE4_READ_ACL;
157-
-        if (mask & GENERIC_ALL) {
163+
+    }
158-
+    if (winmask & 0xf000000) {
164+
+    if (win_mask & WRITE_DAC) {
159-
+        if (winmask & GENERIC_ALL) {
165+
+        *nfs4_mask |= ACE4_WRITE_ACL;
160-
             if (file_type == NF4DIR)
166+
+    }
161-
                 *nfs4_mask |= ACE4_ALL_DIR;
167+
+    if (win_mask & WRITE_OWNER) {
162-
             else
168+
+        *nfs4_mask |= ACE4_WRITE_OWNER;
163-
                 *nfs4_mask |= ACE4_ALL_FILE;
169+
+    }
164-
         } else {
170+
+    if (win_mask & SYNCHRONIZE) {
165-
-            if (mask & GENERIC_READ)
171+
+        *nfs4_mask |= ACE4_SYNCHRONIZE;
166-
+            if (winmask & GENERIC_READ)
172+
+    }
167-
                 *nfs4_mask |= ACE4_GENERIC_READ;
173+
+    if (win_mask & DELETE) {
168-
-            if (mask & GENERIC_WRITE)
174+
+        *nfs4_mask |= ACE4_DELETE;
169-
+            if (winmask & GENERIC_WRITE)
175+
+    }
170-
                 *nfs4_mask |= ACE4_GENERIC_WRITE;
176+
+
171-
-            if (mask & GENERIC_EXECUTE)
177+
+#if 1
172-
+            if (winmask & GENERIC_EXECUTE)
178+
+    /* Compare old and new code */
173-
                 *nfs4_mask |= ACE4_GENERIC_EXECUTE;
179+
+    if ((long)*nfs4_mask != (long)(win_mask & 0x00ffffff)) {
174-
         }
180+
+        DPRINTF(ACLLVL, ("#### map_winaccessmask2nfs4acemask: "
175-
     }
181+
+            "new code nfs4_mask=0x%lx, "
176-
-    else /* ignoring generic and reserved bits */
182+
+            "old code nfs4_mask=0x%lx\n",
177-
+    else {
183+
+            (long)*nfs4_mask, (long)(win_mask & 0x00ffffff)));
178-
+#if 0
184+
+    }
179-
+        /* ignoring generic and reserved bits */
185+
+#endif
180-
         *nfs4_mask = mask & 0x00ffffff;
186+
+}
181-
-    print_nfs_access_mask(ACLLVL, *nfs4_mask);
187+
+
182-
-    DPRINTF(ACLLVL,
188+
+static
183-
-        ("<-- map_winaccessmask2nfs4acemask(mask=0x%x, *nfs4_mask=0x%x)\n",
189+
+void map_nfs4acemask2winaccessmask(uint32_t nfs4_mask,
184-
-        (int)mask, (int)*nfs4_mask));
190+
+    int file_type, ACCESS_MASK *win_mask)
185-
+#else
191+
+{
186-
+        /* Individual flags */
192+
+    bool is_generic = false;
187-
+        if (file_type == NF4DIR) {
193+
+
188-
+            if (winmask & FILE_LIST_DIRECTORY) {
194+
+    /*
189-
+                *nfs4_mask |= ACE4_LIST_DIRECTORY;
195+
+     * Generic masks
190-
+            }
196+
+     * (|ACE4_GENERIC_*| contain multiple bits
191-
+            if (winmask & FILE_ADD_FILE) {
197+
+     */
192-
+                *nfs4_mask |= ACE4_ADD_FILE;
198+
+    if ((nfs4_mask & ACE4_GENERIC_READ) == ACE4_GENERIC_READ) {
193-
+            }
199+
+        *win_mask |= GENERIC_READ;
194-
+            if (winmask & FILE_ADD_SUBDIRECTORY) {
200+
+        is_generic = true;
195-
+                *nfs4_mask |= ACE4_ADD_SUBDIRECTORY;
201+
+    }
196-
+            }
202+
+    if ((nfs4_mask & ACE4_GENERIC_WRITE) == ACE4_GENERIC_WRITE) {
197-
+            if (winmask & FILE_DELETE_CHILD) {
203+
+        *win_mask |= GENERIC_WRITE;
198-
+                *nfs4_mask |= ACE4_DELETE_CHILD;
204+
+        is_generic = true;
199-
+            }
205+
+    }
200-
+            if (winmask & FILE_TRAVERSE) {
206+
+    if ((nfs4_mask & ACE4_GENERIC_EXECUTE) == ACE4_GENERIC_EXECUTE) {
201-
+                *nfs4_mask |= ACE4_EXECUTE;
207+
+        *win_mask |= GENERIC_EXECUTE;
202-
+            }
208+
+        is_generic = true;
209+
+    }
203214
+        }
204-
+        else {
215+
+    }
205-
+            if (winmask & FILE_READ_DATA) {
216+
+    else {
206-
+                *nfs4_mask |= ACE4_READ_DATA;
217+
+        if ((nfs4_mask & ACE4_ALL_FILE) == ACE4_ALL_FILE) {
207-
+            }
218+
+            *win_mask |= GENERIC_ALL;
208-
+            if (winmask & FILE_WRITE_DATA) {
219+
+            is_generic = true;
217220
+        }
218221
+    }
219-
+
222+
+#if 0
220-
+#ifdef NOT_IMPLEMENTED_YET
223+
+    if (is_generic)
221-
+    if (winmask & xxx) {
224+
+        goto mapping_done;
222-
+        *nfs4_mask |= ACE4_READ_NAMED_ATTRS;
225+
+#endif
223-
+    }
226+
+    /* Individual flags */
224-
+    if (winmask & xxx) {
227+
+    if (file_type == NF4DIR) {
225-
+        *nfs4_mask |= ACE4_WRITE_NAMED_ATTRS;
228+
+        if (nfs4_mask & ACE4_LIST_DIRECTORY) {
226-
+    }
229+
+            *win_mask |= FILE_LIST_DIRECTORY;
227-
+#endif /* NOT_IMPLEMENTED_YET */
230+
+        }
228-
+    if (winmask & FILE_READ_ATTRIBUTES) {
231+
+        if (nfs4_mask & ACE4_ADD_FILE) {
229-
+        *nfs4_mask |= ACE4_READ_ATTRIBUTES;
232+
+            *win_mask |= FILE_ADD_FILE;
230-
+    }
233+
+        }
231-
+    if (winmask & FILE_WRITE_ATTRIBUTES) {
234+
+        if (nfs4_mask & ACE4_ADD_SUBDIRECTORY) {
232-
+        *nfs4_mask |= ACE4_WRITE_ATTRIBUTES;
235+
+            *win_mask |= FILE_ADD_SUBDIRECTORY;
236+
+        }
233243
+    }
234-
+    if (winmask & READ_CONTROL) {
244+
+    else {
235-
+        *nfs4_mask |= ACE4_READ_ACL;
245+
+        if (nfs4_mask & ACE4_READ_DATA) {
236-
+    }
246+
+            *win_mask |= FILE_READ_DATA;
237-
+    if (winmask & WRITE_DAC) {
247+
+        }
238-
+        *nfs4_mask |= ACE4_WRITE_ACL;
248+
+        if (nfs4_mask & ACE4_WRITE_DATA) {
249+
+            *win_mask |= FILE_WRITE_DATA;
239257
+    }
240-
+    if (winmask & WRITE_OWNER) {
258+
+
241-
+        *nfs4_mask |= ACE4_WRITE_OWNER;
259+
+    if (nfs4_mask & ACE4_READ_NAMED_ATTRS) {
260+
+        *win_mask |= FILE_READ_EA;
242261
+    }
243-
+    if (winmask & SYNCHRONIZE) {
262+
+    if (nfs4_mask & ACE4_WRITE_NAMED_ATTRS) {
244-
+        *nfs4_mask |= ACE4_SYNCHRONIZE;
263+
+        *win_mask |= FILE_WRITE_EA;
245264
+    }
246-
+    if (winmask & DELETE) {
265+
+    if (nfs4_mask & ACE4_READ_ATTRIBUTES) {
247-
+        *nfs4_mask |= ACE4_DELETE;
266+
+        *win_mask |= FILE_READ_ATTRIBUTES;
248267
+    }
249-
+#endif
268+
+    if (nfs4_mask & ACE4_WRITE_ATTRIBUTES) {
250-
+
269+
+        *win_mask |= FILE_WRITE_ATTRIBUTES;
251-
+    print_nfs_access_mask(1, *nfs4_mask);
270+
+    }
252-
+    DPRINTF(0,
271+
+    if (nfs4_mask & ACE4_READ_ACL) {
253-
+        ("<-- map_winaccessmask2nfs4acemask("
272+
+        *win_mask |= READ_CONTROL;
254-
+            "winmask=0x%x,file_type=%d,*nfs4_mask=0x%x)\n",
273+
+    }
255-
+            (int)winmask, file_type, (int)*nfs4_mask));
274+
+    if (nfs4_mask & ACE4_WRITE_ACL) {
256-
 }
275+
+        *win_mask |= WRITE_DAC;
257-
276+
+    }
258-
 static int map_nfs4ace_who(PSID sid, PSID owner_sid, PSID group_sid, char *who_out, char *domain, SID_NAME_USE *sid_type_out)
277+
+    if (nfs4_mask & ACE4_WRITE_OWNER) {
259-
diff --git a/daemon/daemon_debug.c b/daemon/daemon_debug.c
278+
+        *win_mask |= WRITE_OWNER;
260-
index ab4cee6..685ecce 100644
279+
+    }
261-
--- a/daemon/daemon_debug.c
280+
+    if (nfs4_mask & ACE4_SYNCHRONIZE) {
262-
+++ b/daemon/daemon_debug.c
281+
+        *win_mask |= SYNCHRONIZE;
263-
@@ -805,7 +805,7 @@ void print_windows_access_mask(int on, ACCESS_MASK m)
282+
+    }
264-
 {
283+
+    if (nfs4_mask & ACE4_DELETE) {
265-
     if (!on)
284+
+        *win_mask |= DELETE;
266-
         return;
285+
+    }
267-
-    if (!DPRINTF_LEVEL_ENABLED(1))
286+
+#if 0
268-
+    if (!DPRINTF_LEVEL_ENABLED(0))
287+
+mapping_done:
269-
         return;
288+
+    ;
289+
+#endif
270291
271-
     dprintf_out("--> print_windows_access_mask: %x\n", m);
292+
 static int map_nfs4ace_who(PSID sid, PSID owner_sid, PSID group_sid, char *who_out, char *domain, SID_NAME_USE *sid_type_out)
272-
@@ -878,7 +878,7 @@ void print_windows_access_mask(int on, ACCESS_MASK m)
293+
@@ -723,6 +909,7 @@ static int map_dacl_2_nfs4acl(PACL acl, PSID sid, PSID gsid, nfsacl41 *nfs4_acl,
273-
 void print_nfs_access_mask(int on, int m)
294+
         PACE_HEADER ace;
274-
 {
295+
         PBYTE tmp_pointer;
275-
     if (!on) return;
296+
         SID_NAME_USE who_sid_type = 0;
276-
-    if (!DPRINTF_LEVEL_ENABLED(1))
297+
+        ACCESS_MASK win_mask;
279298
280-
     dprintf_out("--> print_nfs_access_mask: %x\n", m);
299+
         DPRINTF(ACLLVL, ("NON-NULL dacl with %d ACEs\n", acl->AceCount));
281-
diff --git a/daemon/nfs41_const.h b/daemon/nfs41_const.h
300+
         if (DPRINTF_LEVEL_ENABLED(ACLLVL)) {
282-
index 5010816..9613ea9 100644
301+
@@ -760,10 +947,6 @@ static int map_dacl_2_nfs4acl(PACL acl, PSID sid, PSID gsid, nfsacl41 *nfs4_acl,
283-
--- a/daemon/nfs41_const.h
302+
                 goto out_free;
284-
+++ b/daemon/nfs41_const.h
303+
             }
288304
289-
-#define ACE4_ALL_FILE ACE4_READ_DATA|ACE4_WRITE_DATA|ACE4_APPEND_DATA| \
305+
-            map_winace2nfs4aceflags(ace->AceFlags, &nfs4_acl->aces[i].aceflag);
290-
+#define ACE4_ALL_FILE (ACE4_READ_DATA|ACE4_WRITE_DATA|ACE4_APPEND_DATA| \
306+
-            map_winaccessmask2nfs4acemask(*(PACCESS_MASK)(ace + 1),
291-
         ACE4_READ_NAMED_ATTRS|ACE4_WRITE_NAMED_ATTRS|ACE4_EXECUTE| \
307+
-                file_type, &nfs4_acl->aces[i].acemask);
292-
         ACE4_READ_ATTRIBUTES|ACE4_WRITE_ATTRIBUTES| \
308+
-
293-
         ACE4_DELETE|ACE4_READ_ACL|ACE4_WRITE_ACL|ACE4_WRITE_OWNER| \
309+
             tmp_pointer += sizeof(ACCESS_MASK) + sizeof(ACE_HEADER);
303310
304-
-#define ACE4_GENERIC_READ ACE4_READ_DATA|ACE4_READ_NAMED_ATTRS| \
311+
             status = map_nfs4ace_who(tmp_pointer, sid, gsid, nfs4_acl->aces[i].who,
305-
-        ACE4_READ_ATTRIBUTES|ACE4_READ_ACL|ACE4_SYNCHRONIZE
312+
@@ -771,6 +954,27 @@ static int map_dacl_2_nfs4acl(PACL acl, PSID sid, PSID gsid, nfsacl41 *nfs4_acl,
306-
-#define ACE4_GENERIC_WRITE ACE4_WRITE_DATA|ACE4_WRITE_NAMED_ATTRS| \
313+
             if (status)
307-
-        ACE4_WRITE_ATTRIBUTES|ACE4_READ_ACL|ACE4_SYNCHRONIZE
314+
                 goto out_free;
316315
317-
316+
+            win_mask = *(PACCESS_MASK)(ace + 1);
318-
317+
+
319-
-#define ACE4_FILE_ALL_ACCESS ACE4_READ_DATA|ACE4_LIST_DIRECTORY| \
318+
+            map_winace2nfs4aceflags(ace->AceFlags,
320-
+#define ACE4_FILE_ALL_ACCESS (ACE4_READ_DATA|ACE4_LIST_DIRECTORY| \
319+
+                &nfs4_acl->aces[i].aceflag);
321-
         ACE4_WRITE_DATA|ACE4_ADD_FILE|ACE4_APPEND_DATA|ACE4_ADD_SUBDIRECTORY| \
320+
+            map_winaccessmask2nfs4acemask(win_mask,
322-
         ACE4_READ_NAMED_ATTRS|ACE4_WRITE_NAMED_ATTRS|ACE4_EXECUTE| \
321+
+                file_type, &nfs4_acl->aces[i].acemask);
323-
-        ACE4_READ_ATTRIBUTES|ACE4_WRITE_ATTRIBUTES
322+
+
324-
+        ACE4_READ_ATTRIBUTES|ACE4_WRITE_ATTRIBUTES)
323+
+            if (DPRINTF_LEVEL_ENABLED(ACLLVL)) {
325-
324+
+                dprintf_out("win2nfs: nfs4_acl->aces[%d].who='%s', "
326-
 /* ACLS aceflag4 field constants */
325+
+                    "acetype='%s', "
327-
 #define ACE4_FILE_INHERIT_ACE             0x00000001
326+
+                    "win_mask=0x%lx, nfs_acemask=0x%lx\n",
328-
diff --git a/sys/nfs41_driver.c b/sys/nfs41_driver.c
327+
+                    i, nfs4_acl->aces[i].who,
329-
index 58a312c..ae86c2a 100644
328+
+                    (nfs4_acl->aces[i].acetype?
330-
--- a/sys/nfs41_driver.c
329+
+                        "DENIED ACE":"ALLOWED ACE"),
331-
+++ b/sys/nfs41_driver.c
330+
+                    (long)win_mask, (long)nfs4_acl->aces[i].acemask);
332-
@@ -371,7 +371,11 @@ typedef struct _NFS41_NETROOT_EXTENSION {
331+
+                print_windows_access_mask(nfs4_acl->aces[i].who,
333-
         (PNFS41_NETROOT_EXTENSION)((pNetRoot)->Context))
332+
+                    win_mask);
334-
333+
+                print_nfs_access_mask(nfs4_acl->aces[i].who,
335-
 /* FileSystemName as reported by FileFsAttributeInfo query */
334+
+                    nfs4_acl->aces[i].acemask);
336-
+#if 1
335+
+            }
337-
 #define FS_NAME     L"NFS"
336+
+
338-
+#else
337+
             /*
339-
+#define FS_NAME     L"NFS41"
338+
              * Treat |SidTypeAlias| as (local) group
340-
+#endif
339+
              *
341-
 #define FS_NAME_LEN (sizeof(FS_NAME) - sizeof(WCHAR))
340+
@@ -814,7 +1018,8 @@ static int handle_setacl(void *daemon_context, nfs41_upcall *upcall)
342-
 #define FS_ATTR_LEN (sizeof(FILE_FS_ATTRIBUTE_INFORMATION) + FS_NAME_LEN)
341+
     char ownerbuf[NFS4_OPAQUE_LIMIT+1];
342+
     char groupbuf[NFS4_OPAQUE_LIMIT+1];
343343
344-
344+
-    DPRINTF(ACLLVL, ("--> handle_setacl()\n"));
345-
345+
+    DPRINTF(ACLLVL, ("--> handle_setacl(state->path.path='%s')\n",
346-
346+
+        state->path.path));
347347
348-
348+
     if (args->query & OWNER_SECURITY_INFORMATION) {
349-
349+
         DPRINTF(ACLLVL, ("handle_setacl: OWNER_SECURITY_INFORMATION\n"));
350-
350+
diff --git a/daemon/daemon_debug.c b/daemon/daemon_debug.c
351-
351+
index dcf2f4d..38f9856 100644
352-
352+
--- a/daemon/daemon_debug.c
353-
353+
+++ b/daemon/daemon_debug.c
354-
354+
@@ -819,13 +819,13 @@ const char *map_nfs_ftype2str(int ftype)
355-
355+
     return "<Unknown nfs_ftype4 type>";
356-
356+
 }
357357
358-
358+
-void print_windows_access_mask(ACCESS_MASK win_mask)
359-
359+
+void print_windows_access_mask(const char *label, ACCESS_MASK win_mask)
360-
360+
 {
361-
361+
-    dprintf_out("--> print_windows_access_mask: 0x%lx\n", (long)win_mask);
362-
362+
+    dprintf_out("--> print_windows_access_mask"
363-
363+
+        "(label='%s',win_mask=0x%lx)\n", label, (long)win_mask);
364-
364+
 #define PRINTWINACCESSMASKBITS(s) \
365-
365+
-    if ((win_mask & (s)) == (s)) { \
366-
366+
+    if (win_mask & (s)) { \
367-
367+
         dprintf_out("\t" #s "\n"); \
368-
368+
-        win_mask &= ~(s); \
369-
369+
     }
370-
370+
     PRINTWINACCESSMASKBITS(GENERIC_READ);
371-
371+
     PRINTWINACCESSMASKBITS(GENERIC_WRITE);
372-
372+
@@ -860,20 +860,16 @@ void print_windows_access_mask(ACCESS_MASK win_mask)
373-
373+
     PRINTWINACCESSMASKBITS(FILE_GENERIC_WRITE);
374-
374+
     PRINTWINACCESSMASKBITS(FILE_GENERIC_EXECUTE);
375375
376-
376+
-    /* Print any "leftover" bits */
377-
377+
-    if (win_mask) {
378-
378+
-        dprintf_out("\t0x%lx\n", (long)win_mask);
379-
379+
-    }
380-
380+
     dprintf_out("<-- print_windows_access_mask\n");
381-
381+
 }
382382
383-
383+
-void print_nfs_access_mask(uint32_t nfs_mask)
384-
384+
+void print_nfs_access_mask(const char *label, uint32_t nfs_mask)
385-
385+
 {
386-
386+
-    dprintf_out("--> print_nfs_access_mask: 0x%lx\n", (long)nfs_mask);
387-
387+
+    dprintf_out("--> print_nfs_access_mask("
388-
388+
+        "label='%s',nfs_mask=0x%lx)\n", label, (long)nfs_mask);
389-
389+
 #define PRINTNFSMASKBITS(s) \
390-
390+
-    if ((nfs_mask & (s)) == (s)) { \
391-
391+
+    if (nfs_mask & (s)) { \
392-
392+
         dprintf_out("\t" #s "\n"); \
393-
393+
-        nfs_mask &= ~(s); \
394-
394+
     }
395-
395+
     PRINTNFSMASKBITS(ACE4_READ_DATA);
396-
396+
     PRINTNFSMASKBITS(ACE4_LIST_DIRECTORY);
397-
397+
@@ -899,10 +895,6 @@ void print_nfs_access_mask(uint32_t nfs_mask)
398-
398+
     PRINTNFSMASKBITS(ACE4_GENERIC_EXECUTE);
399-
399+
     PRINTNFSMASKBITS(ACE4_FILE_ALL_ACCESS);
400400
401-
401+
-    /* Print any "leftover" bits */
402-
402+
-    if (nfs_mask) {
403-
403+
-        dprintf_out("\t0x%lx\n", (long)nfs_mask);
404-
404+
-    }
405-
405+
     dprintf_out("<-- print_nfs_access_mask\n");
406-
406+
 }
407407
408-
408+
diff --git a/daemon/daemon_debug.h b/daemon/daemon_debug.h
409-
409+
index 78e5925..25a0924 100644
410-
410+
--- a/daemon/daemon_debug.h
411-
411+
+++ b/daemon/daemon_debug.h
412-
412+
@@ -105,8 +105,8 @@ void eprintf_out(LPCSTR format, ...);
413-
413+
 void eprintf(LPCSTR format, ...);
414414
415-
415+
 const char *map_nfs_ftype2str(int ftype);
416-
416+
-void print_windows_access_mask(ACCESS_MASK win_mask);
417-
417+
-void print_nfs_access_mask(uint32_t nfs_mask);
418-
418+
+void print_windows_access_mask(const char *label, ACCESS_MASK win_mask);
419-
419+
+void print_nfs_access_mask(const char *label, uint32_t nfs_mask);
420-
420+
 void print_hexbuf_no_asci(const char *title, const unsigned char *buf, int len);
421-
421+
 void print_hexbuf(const char *title, const unsigned char *buf, int len);
422-
422+
 void print_create_attributes(int level, DWORD create_opts);
423423

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with {%HIGHLIGHT}




All content is user-submitted.
The administrators of this site (kpaste.net) are not responsible for their content.
Abuse reports should be emailed to us at