Allow clearing all settable DOS mode bits. A mode value of zero is ignored by
authorDerrell Lipman <derrell.lipman@unwireduniverse.com>
Thu, 24 Jan 2008 01:44:54 +0000 (20:44 -0500)
committerDerrell Lipman <derrell.lipman@unwireduniverse.com>
Thu, 24 Jan 2008 01:44:54 +0000 (20:44 -0500)
Windows.  If the requested mode is zero, we instead send the appropriate one
of 0x80 (NORMAL) or 0x10 (DIRECTORY).

Thanks Jeremy!

Derrell
(This used to be commit 54abf7d0e595e9cbeea115a40d4f7b995252a150)

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) {
        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;
                }
 
                        continue;
                }