Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Synchronet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Main
Synchronet
Commits
6845989e
Commit
6845989e
authored
16 years ago
by
rswindell
Browse files
Options
Downloads
Patches
Plain Diff
smb_msghashes() now accepts a bit-mask of hash source-types (instead of always
hashing all source types).
parent
7beacb49
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/sbbs3/chksmb.c
+2
-2
2 additions, 2 deletions
src/sbbs3/chksmb.c
src/smblib/smbadd.c
+2
-2
2 additions, 2 deletions
src/smblib/smbadd.c
src/smblib/smbhash.c
+5
-5
5 additions, 5 deletions
src/smblib/smbhash.c
src/smblib/smblib.h
+1
-1
1 addition, 1 deletion
src/smblib/smblib.h
with
10 additions
and
10 deletions
src/sbbs3/chksmb.c
+
2
−
2
View file @
6845989e
...
...
@@ -8,7 +8,7 @@
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* *
* Copyright 200
8
Rob Swindell - http://www.synchro.net/copyright.html *
* Copyright 200
9
Rob Swindell - http://www.synchro.net/copyright.html *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
...
...
@@ -344,7 +344,7 @@ int main(int argc, char **argv)
if
(
!
(
smb
.
status
.
attr
&
SMB_EMAIL
)
&&
chkhash
)
{
/* Look-up the message hashes */
hashes
=
smb_msghashes
(
&
msg
,
body
);
hashes
=
smb_msghashes
(
&
msg
,
body
,
SMB_HASH_SOURCE_ALL
);
if
(
hashes
!=
NULL
&&
hashes
[
0
]
!=
NULL
&&
(
i
=
smb_findhash
(
&
smb
,
hashes
,
NULL
,
SMB_HASH_SOURCE_ALL
,
/* mark */
TRUE
))
...
...
This diff is collapsed.
Click to expand it.
src/smblib/smbadd.c
+
2
−
2
View file @
6845989e
...
...
@@ -8,7 +8,7 @@
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* *
* Copyright 200
8
Rob Swindell - http://www.synchro.net/copyright.html *
* Copyright 200
9
Rob Swindell - http://www.synchro.net/copyright.html *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public License *
...
...
@@ -85,7 +85,7 @@ int SMBCALL smb_addmsg(smb_t* smb, smbmsg_t* msg, int storage, long dupechk_hash
msg
->
hdr
.
number
=
smb
->
status
.
last_msg
+
1
;
if
(
!
(
smb
->
status
.
attr
&
(
SMB_EMAIL
|
SMB_NOHASH
)))
{
hashes
=
smb_msghashes
(
msg
,
body
);
hashes
=
smb_msghashes
(
msg
,
body
,
SMB_HASH_SOURCE_ALL
);
if
(
smb_findhash
(
smb
,
hashes
,
&
found
,
dupechk_hashes
,
/* mark? */
FALSE
)
==
SMB_SUCCESS
)
{
safe_snprintf
(
smb
->
last_error
,
sizeof
(
smb
->
last_error
)
...
...
This diff is collapsed.
Click to expand it.
src/smblib/smbhash.c
+
5
−
5
View file @
6845989e
...
...
@@ -238,7 +238,7 @@ hash_t* SMBCALL smb_hashstr(ulong msgnum, ulong t, unsigned source, unsigned fla
/* Allocates and calculates all hashes for a single message */
/* Returns NULL on failure */
hash_t
**
SMBCALL
smb_msghashes
(
smbmsg_t
*
msg
,
const
uchar
*
body
)
hash_t
**
SMBCALL
smb_msghashes
(
smbmsg_t
*
msg
,
const
uchar
*
body
,
long
source_mask
)
{
size_t
h
=
0
;
uchar
flags
=
SMB_HASH_CRC16
|
SMB_HASH_CRC32
|
SMB_HASH_MD5
;
...
...
@@ -251,16 +251,16 @@ hash_t** SMBCALL smb_msghashes(smbmsg_t* msg, const uchar* body)
memset
(
hashes
,
0
,
sizeof
(
hash_t
*
)
*
(
SMB_HASH_SOURCE_TYPES
+
1
));
if
(
msg
->
id
!=
NULL
&&
if
(
msg
->
id
!=
NULL
&&
(
source_mask
&
(
1
<<
SMB_HASH_SOURCE_MSG_ID
))
&&
(
hash
=
smb_hashstr
(
msg
->
hdr
.
number
,
t
,
SMB_HASH_SOURCE_MSG_ID
,
flags
,
msg
->
id
))
!=
NULL
)
hashes
[
h
++
]
=
hash
;
if
(
msg
->
ftn_msgid
!=
NULL
&&
if
(
msg
->
ftn_msgid
!=
NULL
&&
(
source_mask
&
(
1
<<
SMB_HASH_SOURCE_FTN_ID
))
&&
(
hash
=
smb_hashstr
(
msg
->
hdr
.
number
,
t
,
SMB_HASH_SOURCE_FTN_ID
,
flags
,
msg
->
ftn_msgid
))
!=
NULL
)
hashes
[
h
++
]
=
hash
;
flags
|=
SMB_HASH_STRIP_WSP
|
SMB_HASH_STRIP_CTRL_A
;
if
(
body
!=
NULL
&&
if
(
body
!=
NULL
&&
(
source_mask
&
(
1
<<
SMB_HASH_SOURCE_BODY
))
&&
(
hash
=
smb_hashstr
(
msg
->
hdr
.
number
,
t
,
SMB_HASH_SOURCE_BODY
,
flags
,
body
))
!=
NULL
)
hashes
[
h
++
]
=
hash
;
...
...
@@ -285,7 +285,7 @@ int SMBCALL smb_hashmsg(smb_t* smb, smbmsg_t* msg, const uchar* text, BOOL updat
if
(
smb
->
status
.
attr
&
(
SMB_EMAIL
|
SMB_NOHASH
))
return
(
SMB_SUCCESS
);
hashes
=
smb_msghashes
(
msg
,
text
);
hashes
=
smb_msghashes
(
msg
,
text
,
SMB_HASH_SOURCE_ALL
);
if
(
smb_findhash
(
smb
,
hashes
,
&
found
,
SMB_HASH_SOURCE_ALL
,
update
)
==
SMB_SUCCESS
&&
!
update
)
{
retval
=
SMB_DUPE_MSG
;
...
...
This diff is collapsed.
Click to expand it.
src/smblib/smblib.h
+
1
−
1
View file @
6845989e
...
...
@@ -182,7 +182,7 @@ SMBEXPORT hash_t* SMBCALL smb_hash(ulong msgnum, ulong time, unsigned source
SMBEXPORT
hash_t
*
SMBCALL
smb_hashstr
(
ulong
msgnum
,
ulong
time
,
unsigned
source
,
unsigned
flags
,
const
char
*
str
);
SMBEXPORT
hash_t
**
SMBCALL
smb_msghashes
(
smbmsg_t
*
msg
,
const
uchar
*
text
);
SMBEXPORT
hash_t
**
SMBCALL
smb_msghashes
(
smbmsg_t
*
msg
,
const
uchar
*
text
,
long
source_mask
);
SMBEXPORT
int
SMBCALL
smb_addhashes
(
smb_t
*
smb
,
hash_t
**
hash_list
,
BOOL
skip_marked
);
SMBEXPORT
uint16_t
SMBCALL
smb_name_crc
(
const
char
*
name
);
SMBEXPORT
uint16_t
SMBCALL
smb_subject_crc
(
const
char
*
subj
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment