Allow clearing all settable DOS mode bits. A mode value of zero is ignored by
[ira/wip.git] / source3 / libsmb / libsmbclient.c
index fbcb7f64e2c1f0de93eecba953d60f5420d2bfc2..2eb580a52d416aa071e5a85e586cb2ec3538360e 100644 (file)
@@ -4689,7 +4689,15 @@ dos_attr_parse(SMBCCTX *context,
        frame = talloc_stackframe();
        while (next_token_talloc(frame, &p, &tok, "\t,\r\n")) {
                if (StrnCaseCmp(tok, "MODE:", 5) == 0) {
-                       dad->mode = strtol(tok+5, NULL, 16);
+                        long request = strtol(tok+5, NULL, 16);
+                        if (request == 0) {
+                                dad->mode = (request |
+                                             (IS_DOS_DIR(dad->mode)
+                                              ? FILE_ATTRIBUTE_DIRECTORY
+                                              : FILE_ATTRIBUTE_NORMAL));
+                        } else {
+                                dad->mode = request;
+                        }
                        continue;
                }