Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
Marsaud Smb2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
Marsaud Smb2
Commits
596e5dbf
Commit
596e5dbf
authored
Dec 03, 2018
by
Julien Fontanet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: strict comparisons
parent
24adc6c7
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
20 additions
and
20 deletions
+20
-20
lib/api/mkdir.js
lib/api/mkdir.js
+1
-1
lib/api/readFile.js
lib/api/readFile.js
+2
-2
lib/api/readdir.js
lib/api/readdir.js
+1
-1
lib/api/rename.js
lib/api/rename.js
+1
-1
lib/api/writeFile.js
lib/api/writeFile.js
+1
-1
lib/messages/query_directory.js
lib/messages/query_directory.js
+1
-1
lib/tools/bigint.js
lib/tools/bigint.js
+5
-5
lib/tools/message.js
lib/tools/message.js
+1
-1
lib/tools/smb2-connection.js
lib/tools/smb2-connection.js
+1
-1
lib/tools/smb2-message.js
lib/tools/smb2-message.js
+6
-6
No files found.
lib/api/mkdir.js
View file @
596e5dbf
...
...
@@ -13,7 +13,7 @@ var SMB2Request = SMB2Forge.request;
*
*/
module
.
exports
=
function
mkdir
(
path
,
mode
,
cb
)
{
if
(
typeof
mode
==
'
function
'
)
{
if
(
typeof
mode
==
=
'
function
'
)
{
cb
=
mode
;
mode
=
'
0777
'
;
}
...
...
lib/api/readFile.js
View file @
596e5dbf
...
...
@@ -19,7 +19,7 @@ var MAX_READ_LENGTH = require('../structures/constants').MAX_READ_LENGTH;
module
.
exports
=
function
readFile
(
filename
,
options
,
cb
)
{
var
connection
=
this
;
if
(
typeof
options
==
'
function
'
)
{
if
(
typeof
options
==
=
'
function
'
)
{
cb
=
options
;
options
=
{};
}
...
...
@@ -55,7 +55,7 @@ module.exports = function readFile(filename, options, cb) {
var
checkDone
=
function
()
{
if
(
stop
)
return
;
createPackets
();
if
(
nbRemainingPackets
==
0
&&
offset
.
ge
(
fileLength
))
{
if
(
nbRemainingPackets
==
=
0
&&
offset
.
ge
(
fileLength
))
{
SMB2Request
(
'
close
'
,
file
,
connection
,
function
()
{
if
(
options
.
encoding
)
{
result
=
result
.
toString
(
options
.
encoding
);
...
...
lib/api/readdir.js
View file @
596e5dbf
...
...
@@ -35,7 +35,7 @@ module.exports = function readdir(path, cb) {
return
v
.
Filename
;
})
// get the filename only
.
filter
(
function
(
v
)
{
return
v
!=
'
.
'
&&
v
!
=
'
..
'
;
return
v
!=
=
'
.
'
&&
v
!=
=
'
..
'
;
})
// remove '.' and '..' values
);
});
...
...
lib/api/rename.js
View file @
596e5dbf
...
...
@@ -16,7 +16,7 @@ var FILE_OPEN_IF = require('../structures/constants').FILE_OPEN_IF;
*
*/
module
.
exports
=
function
rename
(
oldPath
,
newPath
,
options
,
cb
)
{
if
(
typeof
options
==
'
function
'
)
{
if
(
typeof
options
==
=
'
function
'
)
{
cb
=
options
;
options
=
{};
}
...
...
lib/api/writeFile.js
View file @
596e5dbf
...
...
@@ -91,7 +91,7 @@ module.exports = function writeFile(filename, data, options, cb) {
function
checkDone
()
{
if
(
stop
)
return
;
createPackets
();
if
(
nbRemainingPackets
==
0
&&
offset
.
ge
(
fileLength
))
{
if
(
nbRemainingPackets
==
=
0
&&
offset
.
ge
(
fileLength
))
{
fileWritten
();
}
}
...
...
lib/messages/query_directory.js
View file @
596e5dbf
...
...
@@ -29,7 +29,7 @@ function parseFiles(buffer) {
var
files
=
[];
var
offset
=
0
;
var
nextFileOffset
=
-
1
;
while
(
nextFileOffset
!=
0
)
{
while
(
nextFileOffset
!=
=
0
)
{
// extract next file offset
nextFileOffset
=
buffer
.
readUInt32LE
(
offset
);
// extract the file
...
...
lib/tools/bigint.js
View file @
596e5dbf
...
...
@@ -9,7 +9,7 @@ var BigInt = (module.exports = function(n, v) {
v
=
v
||
0
;
if
(
v
!=
0
)
{
if
(
v
!=
=
0
)
{
if
(
v
<
0
)
{
this
.
sign
=
-
1
;
v
=
-
v
;
...
...
@@ -23,7 +23,7 @@ var BigInt = (module.exports = function(n, v) {
for
(
var
i
=
0
;
i
<
size
;
i
++
)
{
var
start
=
(
size
-
i
-
1
)
*
2
-
carry
;
this
.
buffer
.
writeUInt8
(
parseInt
(
start
==
-
1
?
v
.
substr
(
0
,
1
)
:
v
.
substr
(
start
,
2
),
16
),
parseInt
(
start
==
=
-
1
?
v
.
substr
(
0
,
1
)
:
v
.
substr
(
start
,
2
),
16
),
i
);
}
...
...
@@ -58,7 +58,7 @@ BigInt.prototype.add = function(v) {
v
=
BigInt
.
toBigInt
(
this
.
buffer
.
length
,
v
);
}
if
(
this
.
sign
!=
v
.
sign
)
{
if
(
this
.
sign
!=
=
v
.
sign
)
{
return
this
.
neg
().
sub
(
v
);
}
...
...
@@ -96,7 +96,7 @@ BigInt.prototype.sub = function(v) {
v
=
BigInt
.
toBigInt
(
this
.
buffer
.
length
,
v
);
}
if
(
this
.
sign
!=
v
.
sign
)
{
if
(
this
.
sign
!=
=
v
.
sign
)
{
return
this
.
add
(
v
.
neg
());
}
...
...
@@ -167,7 +167,7 @@ BigInt.prototype.compare = function(v) {
for
(
var
i
=
n
-
1
;
i
>=
0
;
i
--
)
{
var
a
=
i
<
this
.
buffer
.
length
?
this
.
buffer
.
readUInt8
(
i
)
:
0
;
var
b
=
i
<
v
.
buffer
.
length
?
v
.
buffer
.
readUInt8
(
i
)
:
0
;
if
(
a
!=
b
)
{
if
(
a
!=
=
b
)
{
return
a
>
b
?
this
.
sign
:
-
this
.
sign
;
}
}
...
...
lib/tools/message.js
View file @
596e5dbf
...
...
@@ -10,7 +10,7 @@ var defaults = {
return
function
(
response
)
{
var
h
=
response
.
getHeaders
();
var
err
=
MsErref
.
getStatus
(
bigint
.
fromBuffer
(
h
.
Status
).
toNumber
());
if
(
err
.
code
==
self
.
successCode
)
{
if
(
err
.
code
==
=
self
.
successCode
)
{
self
.
onSuccess
&&
self
.
onSuccess
(
connection
,
response
);
cb
&&
cb
(
null
,
self
.
parseResponse
&&
self
.
parseResponse
(
response
));
}
else
{
...
...
lib/tools/smb2-connection.js
View file @
596e5dbf
...
...
@@ -132,7 +132,7 @@ function clearAutoCloseTimeout(connection) {
}
function
setAutoCloseTimeout
(
connection
)
{
clearAutoCloseTimeout
(
connection
);
if
(
connection
.
autoCloseTimeout
!=
0
)
{
if
(
connection
.
autoCloseTimeout
!=
=
0
)
{
connection
.
scheduledAutoClose
=
setTimeout
(
function
()
{
SMB2Connection
.
close
(
connection
);
},
connection
.
autoCloseTimeout
);
...
...
lib/tools/smb2-message.js
View file @
596e5dbf
...
...
@@ -163,7 +163,7 @@ function dataToBuffer(data, length) {
}
// string to buffer
if
(
typeof
data
==
'
string
'
)
{
if
(
typeof
data
==
=
'
string
'
)
{
return
Buffer
.
from
(
data
);
}
...
...
@@ -196,7 +196,7 @@ function readData(buffer, offset, length) {
function
translate
(
key
,
value
)
{
if
(
headerTranslates
[
key
]
&&
typeof
headerTranslates
[
key
][
value
]
!=
'
undefined
'
typeof
headerTranslates
[
key
][
value
]
!=
=
'
undefined
'
)
{
return
headerTranslates
[
key
][
value
];
}
...
...
@@ -205,7 +205,7 @@ function translate(key, value) {
function
unTranslate
(
key
,
value
)
{
if
(
headerTranslates
[
key
])
{
for
(
var
t
in
headerTranslates
[
key
])
{
if
(
headerTranslates
[
key
][
t
]
==
value
)
{
if
(
headerTranslates
[
key
][
t
]
==
=
value
)
{
return
t
;
}
}
...
...
@@ -262,7 +262,7 @@ function readResponse(message, buffer, offset) {
for
(
var
i
in
message
.
structure
.
response
)
{
var
key
=
message
.
structure
.
response
[
i
][
0
];
var
length
=
message
.
structure
.
response
[
i
][
1
]
||
1
;
if
(
typeof
length
==
'
string
'
)
{
if
(
typeof
length
==
=
'
string
'
)
{
length
=
bufferToData
(
message
.
response
[
length
]);
}
message
.
response
[
key
]
=
readData
(
buffer
,
offset
,
length
);
...
...
@@ -279,9 +279,9 @@ function writeRequest(message, buffer, offset) {
var
key
=
message
.
structure
.
request
[
i
][
0
];
var
length
=
message
.
structure
.
request
[
i
][
1
]
||
1
;
var
defaultValue
=
message
.
structure
.
request
[
i
][
2
]
||
0
;
if
(
typeof
length
==
'
string
'
)
{
if
(
typeof
length
==
=
'
string
'
)
{
message
.
request
[
key
]
=
message
.
request
[
key
]
||
''
;
if
(
message
.
request
[
length
]
!=
message
.
request
[
key
].
length
)
{
if
(
message
.
request
[
length
]
!=
=
message
.
request
[
key
].
length
)
{
message
.
request
[
length
]
=
message
.
request
[
key
].
length
;
needsRewrite
=
true
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment