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
90ff2f3f
Commit
90ff2f3f
authored
4 months ago
by
Rob Swindell
Browse files
Options
Downloads
Patches
Plain Diff
Set "native" flag for newly created file types/protocols
Eliminate use of strcpy() and sprintf() in this file
parent
65cbf055
No related branches found
No related tags found
No related merge requests found
Pipeline
#7704
passed
4 months ago
Stage: build
Stage: test
Stage: cleanup
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/sbbs3/scfg/scfgxfr1.c
+37
-34
37 additions, 34 deletions
src/sbbs3/scfg/scfgxfr1.c
with
37 additions
and
34 deletions
src/sbbs3/scfg/scfgxfr1.c
+
37
−
34
View file @
90ff2f3f
...
...
@@ -97,10 +97,10 @@ void xfer_opts()
snprintf
(
opt
[
i
++
],
MAX_OPLN
,
"%-33.33s%u%%"
,
"Default Credit on Download"
,
cfg
.
cdt_dn_pct
);
if
(
cfg
.
leech_pct
)
sprintf
(
str
,
"%u%% after %u seconds"
s
n
printf
(
str
,
sizeof
str
,
"%u%% after %u seconds"
,
cfg
.
leech_pct
,
cfg
.
leech_sec
);
else
strcpy
(
str
,
"<disabled>"
);
SAFECOPY
(
str
,
"<disabled>"
);
snprintf
(
opt
[
i
++
],
MAX_OPLN
,
"%-33.33s%s"
,
"Leech Protocol Detection"
,
str
);
if
(
cfg
.
file_misc
&
FM_SAFEST
)
SAFECOPY
(
str
,
"Safest Subset"
);
...
...
@@ -110,12 +110,12 @@ void xfer_opts()
,
cfg
.
file_misc
&
FM_SPACES
?
"In"
:
"Ex"
);
snprintf
(
opt
[
i
++
],
MAX_OPLN
,
"%-33.33s%u characters"
,
"Allowed Filename Length"
,
cfg
.
filename_maxlen
);
snprintf
(
opt
[
i
++
],
MAX_OPLN
,
"%-33.33s%s"
,
"Allowed Filename Characters"
,
str
);
s
trcpy
(
opt
[
i
++
],
"Viewable Files..."
);
s
trcpy
(
opt
[
i
++
],
"Testable Files..."
);
s
trcpy
(
opt
[
i
++
],
"Download Events..."
);
s
trcpy
(
opt
[
i
++
],
"Extractable Files..."
);
s
trcpy
(
opt
[
i
++
],
"Compressible Files..."
);
s
trcpy
(
opt
[
i
++
],
"Transfer Protocols..."
);
s
nprintf
(
opt
[
i
++
],
MAX_OPLN
,
"Viewable Files..."
);
s
nprintf
(
opt
[
i
++
],
MAX_OPLN
,
"Testable Files..."
);
s
nprintf
(
opt
[
i
++
],
MAX_OPLN
,
"Download Events..."
);
s
nprintf
(
opt
[
i
++
],
MAX_OPLN
,
"Extractable Files..."
);
s
nprintf
(
opt
[
i
++
],
MAX_OPLN
,
"Compressible Files..."
);
s
nprintf
(
opt
[
i
++
],
MAX_OPLN
,
"Transfer Protocols..."
);
opt
[
i
][
0
]
=
0
;
uifc
.
helpbuf
=
"`File Transfer Configuration:`
\n
"
...
...
@@ -256,11 +256,11 @@ void xfer_opts()
break
;
case
__COUNTER__
:
/* Uploaded Filename characters allowed */
i
=
0
;
s
trcpy
(
opt
[
i
++
],
"Safest Subset Only (A-Z, a-z, 0-9, -, _, and .)"
);
s
trcpy
(
opt
[
i
++
],
"Most ASCII Characters, Excluding Spaces"
);
s
trcpy
(
opt
[
i
++
],
"Most ASCII Characters, Including Spaces"
);
s
trcpy
(
opt
[
i
++
],
"Most CP437 Characters, Excluding Spaces"
);
s
trcpy
(
opt
[
i
++
],
"Most CP437 Characters, Including Spaces"
);
s
nprintf
(
opt
[
i
++
],
MAX_OPLN
,
"Safest Subset Only (A-Z, a-z, 0-9, -, _, and .)"
);
s
nprintf
(
opt
[
i
++
],
MAX_OPLN
,
"Most ASCII Characters, Excluding Spaces"
);
s
nprintf
(
opt
[
i
++
],
MAX_OPLN
,
"Most ASCII Characters, Including Spaces"
);
s
nprintf
(
opt
[
i
++
],
MAX_OPLN
,
"Most CP437 Characters, Excluding Spaces"
);
s
nprintf
(
opt
[
i
++
],
MAX_OPLN
,
"Most CP437 Characters, Including Spaces"
);
opt
[
i
][
0
]
=
'\0'
;
if
(
cfg
.
file_misc
&
FM_SAFEST
)
j
=
0
;
...
...
@@ -386,8 +386,9 @@ void xfer_opts()
continue
;
}
memset
(
cfg
.
fview
[
0
],
0
,
sizeof
(
fview_t
));
strcpy
(
cfg
.
fview
[
0
]
->
ext
,
"*"
);
strcpy
(
cfg
.
fview
[
0
]
->
cmd
,
"?archive list %f"
);
SAFECOPY
(
cfg
.
fview
[
0
]
->
ext
,
"*"
);
SAFECOPY
(
cfg
.
fview
[
0
]
->
cmd
,
"?archive list %f"
);
cfg
.
fview
[
0
]
->
ex_mode
=
EX_NATIVE
;
}
else
{
for
(
j
=
cfg
.
total_fviews
;
j
>
i
;
j
--
)
...
...
@@ -468,8 +469,7 @@ void xfer_opts()
toggle_flag
(
native_opt
,
&
cfg
.
fview
[
i
]
->
ex_mode
,
EX_NATIVE
,
false
,
native_help
);
break
;
case
3
:
sprintf
(
str
,
"Viewable File Type %s"
,
cfg
.
fview
[
i
]
->
ext
);
snprintf
(
str
,
sizeof
str
,
"Viewable File Type %s"
,
cfg
.
fview
[
i
]
->
ext
);
getar
(
str
,
cfg
.
fview
[
i
]
->
arstr
);
break
;
}
...
...
@@ -521,9 +521,10 @@ void xfer_opts()
continue
;
}
memset
(
cfg
.
ftest
[
0
],
0
,
sizeof
(
ftest_t
));
strcpy
(
cfg
.
ftest
[
0
]
->
ext
,
"ZIP"
);
strcpy
(
cfg
.
ftest
[
0
]
->
cmd
,
"%@unzip -tqq %f"
);
strcpy
(
cfg
.
ftest
[
0
]
->
workstr
,
"Testing ZIP Integrity..."
);
SAFECOPY
(
cfg
.
ftest
[
0
]
->
ext
,
"ZIP"
);
SAFECOPY
(
cfg
.
ftest
[
0
]
->
cmd
,
"%@unzip -tqq %f"
);
SAFECOPY
(
cfg
.
ftest
[
0
]
->
workstr
,
"Testing ZIP Integrity..."
);
cfg
.
ftest
[
0
]
->
ex_mode
=
EX_NATIVE
;
}
else
{
...
...
@@ -613,7 +614,7 @@ void xfer_opts()
,
cfg
.
ftest
[
i
]
->
workstr
,
sizeof
(
cfg
.
ftest
[
i
]
->
workstr
)
-
1
,
K_EDIT
|
K_MSG
);
break
;
case
4
:
sprintf
(
str
,
"Testable File Type %s"
,
cfg
.
ftest
[
i
]
->
ext
);
s
n
printf
(
str
,
sizeof
str
,
"Testable File Type %s"
,
cfg
.
ftest
[
i
]
->
ext
);
getar
(
str
,
cfg
.
ftest
[
i
]
->
arstr
);
break
;
}
...
...
@@ -680,9 +681,10 @@ void xfer_opts()
continue
;
}
memset
(
cfg
.
dlevent
[
0
],
0
,
sizeof
(
dlevent_t
));
strcpy
(
cfg
.
dlevent
[
0
]
->
ext
,
"ZIP"
);
strcpy
(
cfg
.
dlevent
[
0
]
->
cmd
,
"%@zip -z %f < %zzipmsg.txt"
);
strcpy
(
cfg
.
dlevent
[
0
]
->
workstr
,
"Adding ZIP Comment..."
);
SAFECOPY
(
cfg
.
dlevent
[
0
]
->
ext
,
"ZIP"
);
SAFECOPY
(
cfg
.
dlevent
[
0
]
->
cmd
,
"%@zip -z %f < %zzipmsg.txt"
);
SAFECOPY
(
cfg
.
dlevent
[
0
]
->
workstr
,
"Adding ZIP Comment..."
);
cfg
.
dlevent
[
0
]
->
ex_mode
=
EX_NATIVE
;
}
else
{
...
...
@@ -771,7 +773,7 @@ void xfer_opts()
,
cfg
.
dlevent
[
i
]
->
workstr
,
sizeof
(
cfg
.
dlevent
[
i
]
->
workstr
)
-
1
,
K_EDIT
|
K_MSG
);
break
;
case
4
:
sprintf
(
str
,
"Download Event %s"
,
cfg
.
dlevent
[
i
]
->
ext
);
s
n
printf
(
str
,
sizeof
str
,
"Download Event %s"
,
cfg
.
dlevent
[
i
]
->
ext
);
getar
(
str
,
cfg
.
dlevent
[
i
]
->
arstr
);
break
;
}
...
...
@@ -832,8 +834,9 @@ void xfer_opts()
continue
;
}
memset
(
cfg
.
fextr
[
0
],
0
,
sizeof
(
fextr_t
));
strcpy
(
cfg
.
fextr
[
0
]
->
ext
,
"ZIP"
);
strcpy
(
cfg
.
fextr
[
0
]
->
cmd
,
"%@unzip -Cojqq %f %s -d %g"
);
SAFECOPY
(
cfg
.
fextr
[
0
]
->
ext
,
"ZIP"
);
SAFECOPY
(
cfg
.
fextr
[
0
]
->
cmd
,
"%@unzip -Cojqq %f %s -d %g"
);
cfg
.
fextr
[
0
]
->
ex_mode
=
EX_NATIVE
;
}
else
{
...
...
@@ -915,8 +918,7 @@ void xfer_opts()
toggle_flag
(
native_opt
,
&
cfg
.
fextr
[
i
]
->
ex_mode
,
EX_NATIVE
,
false
,
native_help
);
break
;
case
3
:
sprintf
(
str
,
"Extractable File Type %s"
,
cfg
.
fextr
[
i
]
->
ext
);
snprintf
(
str
,
sizeof
str
,
"Extractable File Type %s"
,
cfg
.
fextr
[
i
]
->
ext
);
getar
(
str
,
cfg
.
fextr
[
i
]
->
arstr
);
break
;
}
...
...
@@ -976,8 +978,9 @@ void xfer_opts()
continue
;
}
memset
(
cfg
.
fcomp
[
0
],
0
,
sizeof
(
fcomp_t
));
strcpy
(
cfg
.
fcomp
[
0
]
->
ext
,
"ZIP"
);
strcpy
(
cfg
.
fcomp
[
0
]
->
cmd
,
"%@zip -jD %f %s"
);
SAFECOPY
(
cfg
.
fcomp
[
0
]
->
ext
,
"ZIP"
);
SAFECOPY
(
cfg
.
fcomp
[
0
]
->
cmd
,
"%@zip -jD %f %s"
);
cfg
.
fcomp
[
0
]
->
ex_mode
=
EX_NATIVE
;
}
else
{
for
(
j
=
cfg
.
total_fcomps
;
j
>
i
;
j
--
)
...
...
@@ -1058,8 +1061,7 @@ void xfer_opts()
toggle_flag
(
native_opt
,
&
cfg
.
fcomp
[
i
]
->
ex_mode
,
EX_NATIVE
,
false
,
native_help
);
break
;
case
3
:
sprintf
(
str
,
"Compressible File Type %s"
,
cfg
.
fcomp
[
i
]
->
ext
);
snprintf
(
str
,
sizeof
str
,
"Compressible File Type %s"
,
cfg
.
fcomp
[
i
]
->
ext
);
getar
(
str
,
cfg
.
fcomp
[
i
]
->
arstr
);
break
;
}
...
...
@@ -1126,6 +1128,7 @@ void xfer_opts()
}
memset
(
cfg
.
prot
[
0
],
0
,
sizeof
(
prot_t
));
cfg
.
prot
[
0
]
->
mnemonic
=
'?'
;
cfg
.
prot
[
0
]
->
misc
=
PROT_NATIVE
;
}
else
{
for
(
j
=
cfg
.
total_prots
;
j
>
i
;
j
--
)
cfg
.
prot
[
j
]
=
cfg
.
prot
[
j
-
1
];
...
...
@@ -1217,7 +1220,7 @@ void xfer_opts()
,
cfg
.
prot
[
i
]
->
name
,
sizeof
(
cfg
.
prot
[
i
]
->
name
)
-
1
,
K_EDIT
);
break
;
case
2
:
sprintf
(
str
,
"Protocol %s"
,
cfg
.
prot
[
i
]
->
name
);
s
n
printf
(
str
,
sizeof
str
,
"Protocol %s"
,
cfg
.
prot
[
i
]
->
name
);
getar
(
str
,
cfg
.
prot
[
i
]
->
arstr
);
break
;
case
3
:
...
...
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